:root {
  --ink: #0d0d0d;
  --ink-2: #3a3a3a;
  --muted: #7a7a7a;
  --line: #e2e2df;
  --line-2: #cfcfcb;
  --bg: #f4f4f2;
  --card: #ffffff;
  --soft: #ececea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(244,244,242,.9);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; mix-blend-mode: multiply; }
.brand b { font-size: 17px; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-weight: 400; }
.top .spacer { flex: 1; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 64px; }

/* ---------- hero ---------- */
.hero { padding: 18px 0 22px; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 8px; }
.hero p { margin: 0; color: var(--ink-2); max-width: 560px; }

/* ---------- steps ---------- */
.steps { display: flex; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 500;
}
.steps li i {
  font-style: normal; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; font-size: 12px;
}
.steps li.on { background: var(--ink); color: #fff; }
.steps li.on i { background: #fff; color: var(--ink); }
.steps li.done { color: var(--ink); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.card h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 11px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font-weight: 600; cursor: pointer;
  transition: transform .06s ease, background .15s, opacity .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #2a2a2a; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; height: 52px; font-size: 16px; }

/* ---------- printer picker ---------- */
.pick { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .pick { grid-template-columns: 1.15fr 1fr; } }
#map {
  height: 300px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--soft);
}
@media (min-width: 860px) { #map { height: 100%; min-height: 440px; } }
#map .leaflet-tile-pane { filter: grayscale(1) contrast(1.05) brightness(1.02); }
.pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--ink); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.pin.off { background: #9a9a9a; }
.pin.sel { background: #fff; border-color: var(--ink); }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #555; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(0,0,0,.12); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.plist { display: flex; flex-direction: column; gap: 8px; max-height: 520px; overflow: auto; padding: 2px; }
.prow {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.prow:hover { border-color: var(--line-2); }
.prow.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.prow.off { cursor: not-allowed; opacity: .55; }
.prow .nm { font-weight: 600; }
.prow .ad { color: var(--muted); font-size: 13px; grid-column: 1; }
.prow .pr { font-weight: 700; text-align: right; white-space: nowrap; }
.prow .meta { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; font-size: 12px; color: var(--muted); grid-column: 1 / -1; }
.prow .meta .warn { color: var(--ink); font-weight: 600; }
.dot { display: inline-flex; align-items: center; gap: 5px; }
.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.dot.off::before { background: #bbb; }

/* ---------- upload ---------- */
.chosen { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--soft); margin-bottom: 14px; }
.chosen .t { flex: 1; min-width: 0; }
.chosen .t b { display: block; }
.chosen .t span { color: var(--muted); font-size: 13px; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  min-height: 220px; padding: 26px; border: 1.5px dashed var(--line-2); border-radius: var(--radius);
  background: #fafaf9; cursor: pointer; transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { border-color: var(--ink); background: #f2f2f0; }
.drop svg { width: 40px; height: 40px; }
.drop b { font-size: 16px; }
.drop span { color: var(--muted); font-size: 13px; }

.progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }
.progress.indet i { width: 35%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.working { padding: 26px 4px; display: flex; flex-direction: column; gap: 12px; }
.working .f { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.working .f b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.err { padding: 12px 14px; border-radius: 12px; background: #1a1a1a; color: #fff; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.err::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; font-weight: 800; font-size: 13px; }

/* ---------- order summary ---------- */
.order { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px) { .order { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 210 / 297; background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.thumb canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb small { position: absolute; bottom: 4px; right: 6px; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.85); padding: 0 4px; border-radius: 4px; }
.thumb.more { background: var(--soft); color: var(--ink-2); font-weight: 600; }

.bignum { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 14px; }
.bignum b { font-size: 44px; line-height: 1; letter-spacing: -.03em; }
.bignum span { color: var(--muted); }
.rows { border-top: 1px solid var(--line); margin: 0 0 16px; }
.rows div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rows div span:first-child { color: var(--muted); }
.rows .total { font-size: 18px; font-weight: 700; border-bottom: 0; }
.rows .total span:first-child { color: var(--ink); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.stepper button { width: 36px; height: 34px; border: 0; background: #fff; cursor: pointer; font-size: 18px; }
.stepper button:hover { background: var(--soft); }
.stepper input { width: 44px; height: 34px; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
@media (max-width: 420px) { #duplexRow { flex-direction: column; align-items: stretch; } .seg button { flex: 1; } }
.note { font-size: 12px; color: var(--muted); margin-top: 10px; text-align: center; }

/* ---------- status ---------- */
.status { max-width: 520px; margin: 0 auto; text-align: center; }
.status .ico { width: 72px; height: 72px; margin: 6px auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; }
.status .ico svg { width: 34px; height: 34px; }
.status .ico.spin svg { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status h2 { font-size: 24px; margin: 0 0 6px; }
.timeline { text-align: left; margin: 22px 0 6px; padding: 0; list-style: none; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; color: var(--muted); align-items: center; }
.timeline li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.timeline li.done { color: var(--ink); }
.timeline li.done i { background: var(--ink); border-color: var(--ink); }
.timeline li.done i::after { content: ""; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.timeline li.cur { color: var(--ink); font-weight: 600; }
.timeline li.cur i { border-color: var(--ink); }
.timeline li.cur i::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .25; } to { opacity: 1; } }
.code { display: inline-block; font-size: 30px; font-weight: 800; letter-spacing: .25em; padding: 8px 14px 8px 20px; border: 2px solid var(--ink); border-radius: 12px; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 32px; }
footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; }
footer nav a { color: var(--ink-2); text-decoration: none; }
footer nav a:hover { text-decoration: underline; }

/* ---------- legal pages ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: clamp(18px, 4vw, 36px); }
.doc h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 6px; }
.doc .upd { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.doc h2 { font-size: 17px; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--ink-2); }
.doc p { margin: 0 0 10px; }
.doc ol, .doc ul { padding-left: 22px; margin: 0 0 10px; }
.doc li { margin-bottom: 6px; }
.doc .missing { background: #fff3c4; color: #5a4700; padding: 0 4px; border-radius: 4px; }
.doc dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 20px; margin: 0; }
.doc dt { color: var(--muted); }
.doc dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.doc dd a { text-decoration: none; border-bottom: 1px solid var(--line-2); }
.doc .box { background: var(--soft); border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.legal-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }
.legal-note a { color: var(--ink-2); }

/* ---------- admin ---------- */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat b { display: block; font-size: 24px; letter-spacing: -.02em; margin-top: 2px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; background: var(--soft); padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
td.wrap-t { white-space: normal; min-width: 180px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--soft); font-size: 12px; font-weight: 600; }
.badge.dark { background: var(--ink); color: #fff; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.form input, .form select, .login input {
  height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff;
}
.form input:focus, .login input:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.form .full { grid-column: 1 / -1; }
.tokenbox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 10px; word-break: break-all; }
.login { max-width: 360px; margin: 60px auto; display: flex; flex-direction: column; gap: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 2000; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
