:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef2ff;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --border: #e5e7eb;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
.wrap { max-width: 540px; margin: 0 auto; padding: 14px 16px calc(40px + env(safe-area-inset-bottom)); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--primary-dark); }
.agent { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.agent .dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
.agent.on { color: var(--ok); border-color: #bbf7d0; }
.agent.on .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.agent.off { color: var(--warn); border-color: #fde68a; }
.agent.off .dot { background: var(--warn); }

.notice { background: var(--warn-soft); color: #92400e; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 14px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 10px 30px -14px rgba(17, 24, 39, .18);
}
.step { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin: 0 0 14px; }
.step .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 14px; }
.step-sm { font-size: 15px; font-weight: 700; margin: 0 0 10px; color: var(--muted); }

.drop {
  border: 2px dashed #c7d2fe;
  border-radius: 14px;
  padding: 26px 16px 22px;
  text-align: center;
  background: #f8faff;
  color: var(--primary);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  outline: none;
}
.drop:focus-visible, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop.busy { pointer-events: none; opacity: .7; }
.drop-title { margin: 8px 0 12px; color: var(--text); font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 20px; font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-big { width: 100%; padding: 16px; font-size: 18px; margin-top: 8px; }
.btn-link { background: transparent; color: var(--muted); width: 100%; font-weight: 600; margin-top: 4px; }
.btn-link:hover { color: var(--text); }

.progress { margin-top: 14px; }
.bar { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.ptext { margin: 8px 0 0; font-size: 14px; color: var(--muted); text-align: center; }

.error { background: var(--err-soft); color: #991b1b; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }

.file { display: flex; align-items: center; gap: 12px; background: #f9fafb; border: 1px solid var(--border); border-radius: 12px; padding: 12px; color: var(--primary); margin-bottom: 6px; }
.file-info { min-width: 0; color: var(--text); }
.fname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmeta { font-size: 13px; color: var(--muted); }

.label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.opt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt-card {
  position: relative; display: block; border: 2px solid var(--border); border-radius: 12px; padding: 12px 12px 10px;
  cursor: pointer; background: #fff; transition: border-color .15s, background .15s; user-select: none;
}
.opt-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt-card .t { display: block; font-weight: 800; font-size: 16px; }
.opt-card .p { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.opt-card .s { display: block; font-size: 15px; font-weight: 700; color: var(--primary-dark); margin-top: 6px; }
.opt-card .s:empty { display: none; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row .label { margin: 16px 0 8px; }
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 8px; }
.stepper button { width: 44px; height: 42px; border: 0; background: #f9fafb; font-size: 22px; font-weight: 700; color: var(--primary); cursor: pointer; font-family: inherit; }
.stepper button:disabled { color: #c4c8d0; cursor: not-allowed; }
.stepper output { min-width: 48px; text-align: center; font-weight: 800; font-size: 18px; }

.summary { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.sline { margin: 0; font-size: 13.5px; color: var(--muted); }
.total { margin: 6px 0 0; font-size: 22px; font-weight: 800; }
.total strong { color: var(--primary-dark); font-size: 26px; }

.order-num { font-size: 44px; font-weight: 900; color: var(--primary-dark); text-align: center; letter-spacing: -.02em; margin: 6px 0 10px; }
.status { display: block; text-align: center; font-weight: 800; font-size: 17px; border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.st-awaiting { background: var(--warn-soft); color: #92400e; }
.st-queued { background: var(--info-soft); color: #1e40af; }
.st-printing { background: var(--info-soft); color: #1e40af; animation: pulse 1.4s ease-in-out infinite; }
.st-done { background: var(--ok-soft); color: #166534; }
.st-error { background: var(--err-soft); color: #991b1b; }
.st-cancelled { background: #f3f4f6; color: var(--muted); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.odesc { margin: 0; text-align: center; color: var(--muted); font-size: 14px; word-break: break-word; }
.ototal { margin: 8px 0 0; text-align: center; font-size: 20px; font-weight: 800; }
#stepDone .hint { text-align: center; font-size: 14px; margin: 10px 0 6px; }

.rlist { list-style: none; margin: 0; padding: 0; }
.rlist li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.rlist li:first-child { border-top: 0; }
.rlist .num { font-weight: 800; color: var(--primary-dark); font-size: 17px; }
.rlist .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.rlist .meta { grid-column: 2; font-size: 12.5px; color: var(--muted); }
.rlist .chip { grid-row: 1 / span 2; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 8px 0 0; }

.opt.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 440px) {
  .opt.three { grid-template-columns: 1fr 1fr; }
  .opt.three .opt-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
  .opt, .opt.three { grid-template-columns: 1fr; }
  .brand { font-size: 17px; }
}
