/* Instant Offers — Telegram Mini App
   Visual language from the Nocturne design export (MINIAPP/deploy/app.html):
   ink-navy ground, warm amber accent, Inter for text, Space Grotesk for numbers. */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url('fonts/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url('fonts/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #161826;
  --bg-deep: #0b0c14;
  --map: #1b1d2b;
  --card: #1f2130;
  --line: #292b31;
  --line-2: #3f424d;
  --text: #e9e9ed;
  --text-2: #b8bac7;
  --muted: #9a9daf;
  --muted-2: #75798c;

  --amber: #ff9900;
  --amber-2: #ffb24d;
  --amber-3: #ffd08f;
  --amber-4: #ffe7c2;
  --amber-deep: #a85f00;
  --amber-edge: #71400a;
  --amber-bg: #3d2508;
  --on-amber: #1a1206;

  --bad: #ff8a7a;
  --bad-bg: #3a1715;
  --bad-edge: #6b2a24;

  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-num: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --f-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --vh: var(--tg-viewport-stable-height, 100vh);
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-t: var(--tg-content-safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--f-body); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none; min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--amber-2); text-decoration: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
::selection { background: rgba(255,153,0,.3); }
svg.i { width: 1em; height: 1em; display: block; flex: none; fill: currentColor; }
.num { font-family: var(--f-num); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { max-width: 560px; margin: 0 auto; min-height: var(--vh); position: relative; padding-top: var(--safe-t); }

/* ─────────── boot / gates ─────────── */
.boot { min-height: var(--vh); display: grid; place-items: center; }
.boot-mark { width: 64px; height: 64px; display: block; animation: breathe 1.6s ease-in-out infinite; }
.boot-mark svg { width: 100%; height: 100%; }
@keyframes breathe { 0%,100% { transform: scale(.92); opacity: .75 } 50% { transform: scale(1); opacity: 1 } }

.gate {
  min-height: var(--vh); display: flex; flex-direction: column; justify-content: center;
  padding: 28px 20px calc(28px + var(--safe-b)); gap: 16px;
  background: radial-gradient(70% 45% at 20% 0%, #2a1a06, transparent 70%);
}
.gate-mark { width: 56px; height: 56px; }
.gate h1 { margin: 0; font-family: var(--f-num); font-weight: 600; font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; }
.gate p { margin: 0; color: var(--text-2); font-size: 14.5px; }
.gate .card { gap: 12px; }
.gate .links { display: flex; flex-direction: column; gap: 8px; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.step::before {
  counter-increment: s; content: counter(s);
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--f-num); font-weight: 600; font-size: 14px;
  background: var(--amber-bg); color: var(--amber-3); box-shadow: inset 0 0 0 1px var(--amber-deep);
}
.step .st { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.step p b { color: var(--text); font-weight: 600; }
.step p { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* ─────────── hero map ─────────── */
.hero { position: relative; height: 340px; overflow: hidden; background: var(--map); isolation: isolate; }
.tiles { position: absolute; inset: 0; z-index: 0; }
.tile {
  position: absolute; width: 256px; height: 256px; background: var(--map) center/cover no-repeat;
  filter: invert(1) hue-rotate(200deg) brightness(.8) saturate(.3) contrast(.95);
}
.hero-dim { position: absolute; inset: 0; z-index: 1; transition: background .3s; background: rgba(22,24,38,.55); }
.hero.on .hero-dim { background: transparent; }
.hero-fade { position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, var(--bg) 0%, rgba(22,24,38,0) 30%, rgba(22,24,38,0) 75%, var(--bg) 100%); }
.hero-radius {
  position: absolute; z-index: 2; left: 50%; top: 190px; width: 230px; height: 230px; border-radius: 50%;
  transform: translate(-50%,-50%); box-shadow: inset 0 0 0 1px rgba(154,157,175,.35); transition: all .3s;
}
.hero.on .hero-radius { background: rgba(255,153,0,.07); box-shadow: inset 0 0 0 1px rgba(255,153,0,.45); }
.pulse { position: absolute; z-index: 2; left: 50%; top: 176px; width: 0; height: 0; display: none; }
.hero.on .pulse { display: block; }
.pulse span {
  position: absolute; left: 0; top: 0; width: 96px; height: 96px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,153,0,.75); background: rgba(255,153,0,.06);
  transform: translate(-50%,-50%); animation: ring 2.4s ease-out infinite;
}
.pulse span + span { animation-delay: .8s; }
@keyframes ring { 0% { transform: translate(-50%,-50%) scale(.3); opacity: .9 } 100% { transform: translate(-50%,-50%) scale(1); opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .pulse span { animation: none; opacity: .5 } }
.pin { position: absolute; z-index: 3; left: 50%; top: 190px; transform: translate(-50%,-100%); display: flex; flex-direction: column; align-items: center; }
.pin-head {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px;
  background: var(--line-2); color: var(--text-2); box-shadow: 0 8px 20px rgba(0,0,0,.5); transition: all .25s;
}
.pin-tail { width: 3px; height: 8px; border-radius: 2px; background: var(--line-2); transition: background .25s; }
.hero.on .pin-head { background: var(--amber); color: var(--on-amber); box-shadow: 0 0 0 4px rgba(255,153,0,.25), 0 6px 16px rgba(0,0,0,.5); }
.hero.on .pin-tail { background: var(--amber); }
.hero.nomap .tiles, .hero.nomap .hero-radius { display: none; }

.status-card {
  position: absolute; z-index: 4; left: 14px; right: 14px; top: 10px; padding: 14px 16px; border-radius: 20px;
  background: radial-gradient(90% 160% at 0% 0%, rgba(61,37,8,.95), rgba(22,24,38,.9) 65%);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px var(--amber-edge), 0 14px 36px rgba(0,0,0,.5);
  display: flex; align-items: center; gap: 12px;
}
.status-card .txt { flex: 1; min-width: 0; }
.status-line { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 11.5px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.status-line .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: none; }
.hero.on .status-line { color: var(--amber-3); }
.hero.on .status-line .dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,153,0,.25); }
.loc-name { margin: 5px 0 0; font-family: var(--f-num); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-sub.warn { color: var(--amber-2); }

.switch {
  flex: none; position: relative; width: 58px; height: 34px; border-radius: 999px; padding: 0;
  background: var(--line-2); transition: background .2s, box-shadow .2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: left .2s, background .2s;
}
.switch[aria-checked="true"] { background: var(--amber); box-shadow: 0 0 18px rgba(255,153,0,.45); }
.switch[aria-checked="true"]::after { left: 27px; background: var(--on-amber); }
.switch.busy::after { animation: knob 0.9s ease-in-out infinite; }
@keyframes knob { 50% { transform: scale(.8) } }

.hero-actions { position: absolute; z-index: 4; left: 14px; right: 14px; bottom: 12px; display: flex; gap: 8px; }
.chip {
  flex: none; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: 14px;
  background: rgba(22,24,38,.9); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; color: var(--text-2);
}
.chip .i { font-size: 16px; color: var(--amber-2); }
.change-loc {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 14px;
  background: rgba(22,24,38,.9); box-shadow: inset 0 0 0 1px var(--amber); color: var(--amber-2); font-size: 14px; font-weight: 500;
}
.change-loc .i { font-size: 17px; }
.change-loc:active { background: var(--amber-bg); }
.attrib { position: absolute; z-index: 4; right: 16px; bottom: 60px; font-size: 9.5px; color: rgba(184,186,199,.55); }

/* ─────────── sections ─────────── */
.block { padding: 22px 14px 0; }
#route { padding-top: 6px; }
.eyebrow {
  margin: 0 4px 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 11.5px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase;
}
.eyebrow .aside { letter-spacing: 0; text-transform: none; color: var(--muted-2); display: flex; align-items: center; gap: 6px; }
.eyebrow button.aside { padding: 4px 0; }
.eyebrow button.aside .i { font-size: 14px; }
.eyebrow button.aside.spin .i { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

.card {
  border-radius: 22px; padding: 18px 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column;
}
.card.hot {
  background: radial-gradient(120% 70% at 0% 0%, var(--amber-bg), var(--card) 60%);
  box-shadow: inset 0 0 0 1px var(--amber-edge), 0 0 40px rgba(255,153,0,.08);
}
.card.bad { background: radial-gradient(120% 70% at 0% 0%, var(--bad-bg), var(--card) 60%); box-shadow: inset 0 0 0 1px var(--bad-edge); }

.pill {
  flex: none; padding: 5px 11px; border-radius: 999px; background: var(--amber-bg); box-shadow: inset 0 0 0 1px var(--amber-deep);
  font-family: var(--f-num); font-size: 14px; font-weight: 600; color: var(--amber-3); white-space: nowrap;
}
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--line); color: var(--text-2); white-space: nowrap;
}
.tag.on { background: var(--amber-bg); color: var(--amber-3); box-shadow: inset 0 0 0 1px var(--amber-deep); }
.tag.bad { background: var(--bad-bg); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-edge); }
.tag .i { font-size: 12px; }

/* route card */
.rc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rc-time { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.rc-price { margin: 8px 0 0; font-family: var(--f-num); font-size: 40px; font-weight: 600; letter-spacing: -0.045em; line-height: 1; color: var(--amber); }
.rc-meta { margin: 8px 0 0; font-size: 13.5px; color: var(--text-2); }
.rc-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted-2); }
.stops { margin-top: 14px; max-height: 176px; overflow-y: auto; border-top: 1px solid var(--line); overscroll-behavior: contain; }
.stop { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.stop .n {
  flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; background: var(--line); color: var(--text);
}
.stop.pickup .n { background: var(--amber); color: var(--on-amber); }
.stop .t { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.stop.pickup .t { color: var(--text); font-weight: 500; }
.stop .m { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.stop .m .i { color: var(--amber-2); font-size: 13px; }
.tools-label { margin: 14px 0 8px; font-size: 12px; color: var(--muted); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool {
  display: flex; align-items: center; gap: 9px; height: 44px; padding: 0 12px; border-radius: 12px;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13.5px; text-align: left;
}
.tool .i { font-size: 18px; color: var(--amber-2); }
.tool:active { box-shadow: inset 0 0 0 1px var(--amber-deep); background: var(--card); }

.empty { align-items: center; text-align: center; gap: 10px; padding: 28px 20px; }
.empty-icon {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: var(--line); color: var(--muted);
}
.empty-icon.on { background: var(--amber-bg); color: var(--amber); box-shadow: 0 0 0 8px rgba(255,153,0,.1); }
.empty-icon.bad { background: var(--bad-bg); color: var(--bad); }
.empty h3 { margin: 4px 0 0; font-family: var(--f-num); font-size: 19px; font-weight: 600; }
.empty p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); max-width: 290px; text-wrap: pretty; }
.empty .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* earnings */
.big { margin: 0; font-family: var(--f-num); font-size: 38px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.big-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.e-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.hours { margin-top: 16px; }
.hours-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bar { position: relative; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, var(--amber-deep), var(--amber)); }
.bar .pend { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--amber-3) 0 3px, transparent 3px 6px); opacity: .6; }
.tiles3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 16px; }
.mini { padding: 10px; border-radius: 12px; background: var(--bg); }
.mini .v { margin: 0; font-family: var(--f-num); font-size: 16px; font-weight: 600; white-space: nowrap; }
.mini .l { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.sub-label { margin: 18px 0 6px; font-size: 12px; color: var(--muted); }
.day { border-top: 1px solid var(--line); }
.day-row { width: 100%; display: flex; align-items: center; gap: 10px; height: 46px; }
.day-row .d { width: 62px; font-size: 13px; color: var(--text-2); text-align: left; flex: none; }
.day-row .today { color: var(--amber-2); }
.day-row .track { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.day-row .track div { height: 100%; border-radius: 999px; background: var(--amber); }
.day-row .amt { width: 76px; text-align: right; font-family: var(--f-num); font-size: 14px; font-weight: 600; flex: none; }
.day-row .i { font-size: 14px; color: var(--muted-2); transition: transform .2s; }
.day.open .day-row .i { transform: rotate(180deg); }
.day-detail { display: none; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 2px 0 14px; font-size: 12.5px; }
.day.open .day-detail { display: grid; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; white-space: nowrap; }
.kv .hl { color: var(--amber-3); }
.kv .warn { color: var(--amber-2); }

/* account */
.acct-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-family: var(--f-num); font-weight: 600; font-size: 17px; background: var(--amber-bg); color: var(--amber-3);
  box-shadow: inset 0 0 0 1px var(--amber-deep);
}
.acct-head .who { flex: 1; min-width: 0; }
.acct-head .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-head .who span { font-size: 12.5px; color: var(--muted); }
.rows { margin-top: 14px; border-top: 1px solid var(--line); }
.row-kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); font-size: 14px; }
.row-kv span:first-child { color: var(--muted); }
.row-kv span:last-child { font-weight: 500; text-align: right; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px;
  border-radius: 12px; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn .i { font-size: 17px; }
.btn-primary { height: 50px; border-radius: 14px; background: var(--amber); color: var(--on-amber); font-size: 15px; font-weight: 600; }
.btn-primary:active { background: var(--amber-2); }
.btn-outline { box-shadow: inset 0 0 0 1px var(--amber); color: var(--amber-2); }
.btn-outline:active { background: var(--amber-bg); }
.btn-ghost { box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); background: var(--bg); }
.btn-ghost:active { background: var(--card); }
.btn-text { height: auto; padding: 8px 4px; color: var(--muted); font-size: 13.5px; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* admin */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-tool {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: 16px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); text-align: left;
}
.admin-tool .i { font-size: 20px; color: var(--amber-2); }
.admin-tool b { font-weight: 600; font-size: 14px; }
.admin-tool span { font-size: 12px; color: var(--muted); }
.admin-tool:active { box-shadow: inset 0 0 0 1px var(--amber-deep); }

.foot { padding: 26px 18px calc(28px + var(--safe-b)); text-align: center; font-size: 11.5px; color: var(--muted-2); }
.foot a { color: var(--muted); }

/* skeleton */
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--line) 0%, #34363e 50%, var(--line) 100%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }

/* ─────────── layer: sheets, scanner ─────────── */
#layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.backdrop { position: absolute; inset: 0; background: rgba(5,5,7,.6); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.backdrop.in { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 88%;
  display: flex; flex-direction: column; border-radius: 28px 28px 0 0; background: var(--bg);
  box-shadow: inset 0 1px 0 var(--line-2), 0 -20px 50px rgba(0,0,0,.6);
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); pointer-events: auto;
}
.sheet.in { transform: translateY(0); }
.sheet.tall { height: 88%; }
.sheet-grip { align-self: center; width: 44px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 10px 0 4px; flex: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 16px 10px; flex: none; }
.sheet-title { font-family: var(--f-num); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-x { width: 32px; height: 32px; border-radius: 50%; background: var(--card); display: grid; place-items: center; color: var(--text-2); flex: none; font-size: 15px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.sheet-foot { flex: none; padding: 10px 16px calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -1px 0 var(--line); }
.sheet-foot:empty { display: none; }
.sheet-body:last-child { padding-bottom: calc(22px + var(--safe-b)); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card); }
.tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border-radius: 10px; font-size: 13px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--amber-bg); color: var(--amber-4); box-shadow: inset 0 0 0 1px var(--amber-deep); font-weight: 500; }

.opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-align: left; width: 100%;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
}
.opt > .i { font-size: 20px; color: var(--amber-2); }
.opt .txt { flex: 1; min-width: 0; }
.opt .txt p { margin: 0; font-size: 14.5px; font-weight: 500; }
.opt .txt small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.opt .radio { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); }
.opt[aria-checked="true"] { background: var(--amber-bg); box-shadow: inset 0 0 0 1px var(--amber-deep); }
.opt[aria-checked="true"] .radio { border: 5px solid var(--amber); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; font-size: 15px;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); border: 0; caret-color: var(--amber);
}
.input:focus { box-shadow: inset 0 0 0 1px var(--amber); }
textarea.input { min-height: 96px; resize: vertical; font-family: var(--f-mono); font-size: 13px; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.note { padding: 12px 14px; border-radius: 14px; background: var(--amber-bg); box-shadow: inset 0 0 0 1px var(--amber-edge); color: var(--amber-4); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.note .i { font-size: 18px; color: var(--amber); margin-top: 1px; }
.note.bad { background: var(--bad-bg); box-shadow: inset 0 0 0 1px var(--bad-edge); color: #ffd6cf; }
.note.bad .i { color: var(--bad); }

.list { display: flex; flex-direction: column; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 52px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .grow p { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.li .grow small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.li .lead { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; background: var(--line); }
.li .act { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; color: var(--amber-2); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); }
.li .act:active { background: var(--amber-bg); }
.li.dim .grow p { color: var(--muted-2); }

.pkg { padding: 14px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 10px; }
.pkg-h { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; }
.pkg-h .lead { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; background: var(--line); }
.bagids { display: flex; flex-direction: column; gap: 6px; }
.bagid { display: flex; align-items: center; gap: 8px; }
.bagid .code { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--f-mono); font-size: 13.5px; text-align: left; }
.bagid .code span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bagid .code .i { color: var(--muted-2); font-size: 15px; }
.bagid .qr { flex: none; height: 40px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--amber-2); box-shadow: inset 0 0 0 1px var(--amber-deep); }

.summary-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.route-img { width: 100%; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); display: block; }
.qr-box { align-self: center; width: min(280px, 80%); aspect-ratio: 1; border-radius: 18px; background: #fff; padding: 10px; }
.qr-box img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.progress { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 0; color: var(--muted); font-size: 14px; text-align: center; }
.progress .ring { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--amber); animation: spin .8s linear infinite; }
.tg-html { font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.tg-html pre { margin: 6px 0; padding: 10px; border-radius: 10px; background: var(--bg); font-family: var(--f-mono); font-size: 12.5px; white-space: pre; overflow-x: auto; }
.tg-html code { font-family: var(--f-mono); font-size: 13px; }
.search { position: sticky; top: 0; z-index: 1; }

/* scanner */
.scanner {
  position: absolute; inset: 0; margin: 0 auto; max-width: 560px; height: var(--vh); background: var(--bg-deep);
  display: flex; flex-direction: column; pointer-events: auto; transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
.scanner.in { transform: none; }
.scan-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex: none; }
.scan-head .ttl { flex: 1; font-family: var(--f-num); font-size: 18px; font-weight: 600; }
.scan-count { font-family: var(--f-num); font-weight: 600; font-size: 16px; }
.scan-count b { color: var(--amber); }
.video-wrap { position: relative; height: 38vh; min-height: 220px; background: #000; overflow: hidden; flex: none; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.reticle { position: absolute; top: 50%; left: 50%; width: 78%; height: 34%; transform: translate(-50%,-50%); border-radius: 14px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.65), 0 0 0 4000px rgba(0,0,0,.35); }
.reticle.ok { animation: okflash .35s ease; }
.reticle.dup { animation: dupflash .35s ease; }
@keyframes okflash { 0% { box-shadow: inset 0 0 0 2px var(--amber), 0 0 0 4000px rgba(255,153,0,.45) } 100% { box-shadow: inset 0 0 0 2px rgba(255,255,255,.65), 0 0 0 4000px rgba(0,0,0,.35) } }
@keyframes dupflash { 0% { box-shadow: inset 0 0 0 2px #fff, 0 0 0 4000px rgba(154,157,175,.45) } 100% { box-shadow: inset 0 0 0 2px rgba(255,255,255,.65), 0 0 0 4000px rgba(0,0,0,.35) } }
.cam-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.scan-last { padding: 10px 16px; font-size: 14px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); flex: none; min-height: 41px; }
.scan-last.ok { color: var(--amber-3); font-weight: 600; }
.scan-last.dup { color: var(--text-2); font-weight: 600; }
.scan-list { flex: 1; overflow-y: auto; padding: 6px 0; overscroll-behavior: contain; }
.zone { padding: 10px 16px 4px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 6px; }
.zone .i { font-size: 14px; color: var(--amber-2); }
.bagrow { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.bagrow .tick { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-2); display: grid; place-items: center; font-size: 13px; flex: none; color: var(--on-amber); }
.bagrow.done .tick { background: var(--amber); box-shadow: none; }
.bagrow .b { font-family: var(--f-mono); font-size: 15px; }
.bagrow.done .b { color: var(--muted-2); text-decoration: line-through; }
.bagrow .z { margin-left: auto; font-size: 12px; color: var(--muted); }
.scan-foot { flex: none; padding: 10px 14px calc(12px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -1px 0 var(--line); background: var(--bg); }
.manual-row { display: flex; gap: 8px; }
.manual-row .input { min-height: 44px; font-family: var(--f-mono); text-transform: none; }

/* toast */
#toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translate(-50%, 20px);
  max-width: min(92vw, 480px); padding: 12px 16px; border-radius: 14px; background: #2b2d3a; color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 1px var(--line-2); font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; text-align: center;
}
#toast.in { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad-bg); box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 0 0 1px var(--bad-edge); }

@media (min-width: 561px) {
  body { background: radial-gradient(60% 50% at 30% 0%, #2a1a06, var(--bg-deep) 70%); }
  #app { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
}
