/* Clearline Vape Space Planner — 2027 system
   Calm surfaces, hairline edges, one typeface, big confident numbers.
   Brand: navy #101322 and orange #E25127 from the Clearline logo. Orange is used sparingly:
   the main action, the "best spot", and the number that matters on each screen. */
:root {
  --navy: #101322;
  --navy-2: #1b1f33;
  --accent: #e25127;
  --accent-btn: #c94420;       /* white text passes contrast on this */
  --accent-ink: #b8401e;       /* orange text on light surfaces */
  --accent-tint: rgba(226, 81, 39, .1);
  --accent-soft: rgba(226, 81, 39, .1);
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;        /* tonal fills: inputs, tracks, secondary buttons */
  --card: var(--surface);
  --card-2: var(--surface-2);
  --ink: #0f1220;
  --ink-2: #3a3f50;
  --muted: #6b7183;
  --hair: rgba(15, 18, 32, .08);
  --line: #e2e5ea;
  --warn: #9a4a00;
  --warn-bg: #fff1df;
  --bad: #b42318;
  --bad-bg: #fde7e4;
  --good: #0a7a46;
  --good-bg: #e3f5ea;
  --rail: #b7bec9;
  --fixture: #1a1e2c;
  --sel: #101322;
  --glass: rgba(255, 255, 255, .72);
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --lift: 0 1px 0 var(--hair), 0 18px 40px -24px rgba(16, 19, 34, .28);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-body: var(--font);
  --font-display: var(--font);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b10; --surface: #14161f; --surface-2: #1d202c; --ink: #eef0f6; --ink-2: #c5c9d6; --muted: #9298a9;
    --hair: rgba(255, 255, 255, .08); --line: #262a37; --accent-ink: #ff8f6b; --accent-tint: rgba(226, 81, 39, .16); --accent-soft: rgba(226, 81, 39, .16);
    --warn: #f3b25e; --warn-bg: #2f220f; --bad: #ff8a80; --bad-bg: #3a1714; --good: #6fd39b; --good-bg: #10291b;
    --rail: #5d6575; --fixture: #10131c; --sel: #f0f1f5; --glass: rgba(20, 22, 31, .72);
    --lift: 0 1px 0 var(--hair), 0 18px 40px -24px rgba(0, 0, 0, .7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0b10; --surface: #14161f; --surface-2: #1d202c; --ink: #eef0f6; --ink-2: #c5c9d6; --muted: #9298a9;
  --hair: rgba(255, 255, 255, .08); --line: #262a37; --accent-ink: #ff8f6b; --accent-tint: rgba(226, 81, 39, .16); --accent-soft: rgba(226, 81, 39, .16);
  --warn: #f3b25e; --warn-bg: #2f220f; --bad: #ff8a80; --bad-bg: #3a1714; --good: #6fd39b; --good-bg: #10291b;
  --rail: #5d6575; --fixture: #10131c; --sel: #f0f1f5; --glass: rgba(20, 22, 31, .72);
  --lift: 0 1px 0 var(--hair), 0 18px 40px -24px rgba(0, 0, 0, .7); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15.5px/1.5 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }
a { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; line-height: 1.1; text-wrap: balance; font-weight: 650; letter-spacing: -0.025em; }
h1 { font-size: 22px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; letter-spacing: -0.015em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.num, .tk b, .stat b, .ticket b, .rule-num b, .score b, .brand-nums, .check-n, .balance b, .total-bar b { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; }

/* Screen transitions (View Transitions API, where supported) */
::view-transition-old(root) { animation: 160ms var(--ease) both vt-out; }
::view-transition-new(root) { animation: 260ms var(--ease) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; transition: none !important; }
}

/* ---------- glass header */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  background: var(--glass); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--hair); color: var(--ink);
}
.top h1 { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { display: grid; place-items: center; width: 36px; height: 36px; margin-left: -6px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 26px; line-height: 1; padding-bottom: 3px; }
.top .back:active { background: var(--surface-2); }
.brandbar { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brandbar img { height: 26px; width: auto; display: block; }
.brandbar .app-name { font-size: 12.5px; font-weight: 500; color: var(--muted); border-left: 1px solid var(--hair); padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-d { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-l { display: none !important; } :root:not([data-theme="light"]) .logo-d { display: block !important; } }
:root[data-theme="dark"] .logo-l { display: none !important; }
:root[data-theme="dark"] .logo-d { display: block !important; }
.pill { font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.off { background: #f59e0b; color: #241400; }
.pill.sync { background: #2f6fed; color: #fff; }
.banner { margin: 12px 16px 0; padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn); font-size: 13px; }
@media (min-width: 860px) { .banner { max-width: 828px; margin-left: auto; margin-right: auto; } }

main { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(120px + var(--safe-b)); }

/* ---------- floating tab bar */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 20;
  display: flex; gap: 4px; padding: 6px; border-radius: 14px; width: min(380px, calc(100% - 32px));
  background: var(--glass); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid var(--hair); box-shadow: 0 12px 32px -12px rgba(16, 19, 34, .35);
}
.tabs a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600; transition: background .2s var(--ease), color .2s; }
.tabs a svg { width: 20px; height: 20px; flex: none; }
.tabs a.on { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs a.on { background: #f0f1f5; color: #101322; } }
:root[data-theme="dark"] .tabs a.on { background: #f0f1f5; color: #101322; }

/* ---------- surfaces */
.card, .space-block, .rule, .list, .brand-row, .line { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--lift); }
.card { padding: 20px; margin-bottom: 14px; }
.card > h2 { margin-bottom: 12px; font-size: 19px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 10px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sub { margin: 28px 4px 12px; font-size: 17px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }

/* ---------- forms: tonal, quiet */
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
label.f > span { display: block; margin: 0 2px 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 12px 14px; min-height: 50px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; padding: 0; accent-color: var(--accent-btn); flex: none; }
textarea { min-height: 88px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; align-items: end; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; align-items: end; }
.check { display: flex; gap: 12px; align-items: center; font-weight: 500; margin: 6px 0 14px; }

/* ---------- buttons: pills */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font: 600 16px/1 var(--font); letter-spacing: -0.01em; border-radius: 13px; padding: 0 22px; min-height: 54px;
  background: var(--accent-btn); color: #fff; text-decoration: none;
  transition: transform .12s var(--ease), background .2s, box-shadow .2s;
  box-shadow: 0 10px 24px -14px rgba(201, 68, 32, .9);
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.dark { background: var(--navy); color: #fff; box-shadow: 0 10px 24px -14px rgba(16, 19, 34, .9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.dark { background: #f0f1f5; color: #101322; } }
:root[data-theme="dark"] .btn.dark { background: #f0f1f5; color: #101322; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: none; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.step { width: 44px; height: 44px; border-radius: 11px; border: 0; background: var(--surface-2); color: var(--ink); font: 500 22px/1 var(--font); cursor: pointer; transition: transform .1s; }
.step:active { transform: scale(.92); background: var(--accent-tint); }
.linkbtn { background: none; border: 0; padding: 6px 0; color: var(--accent-ink); font: 600 13px var(--font); cursor: pointer; text-align: left; }

/* ---------- lists */
.search { position: sticky; top: 56px; z-index: 10; background: linear-gradient(var(--bg) 82%, transparent); padding: 4px 0 12px; }
.search input[type="search"] { border-radius: 12px; padding-left: 44px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b7183' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m13 13 4 4'/%3E%3C/svg%3E") no-repeat 17px 50%; box-shadow: var(--lift); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--hair); background: var(--surface); color: var(--ink-2); border-radius: 9px; padding: 8px 14px; font: 600 13px var(--font); cursor: pointer; transition: background .2s, color .2s; }
.chip.on { background: var(--sel); border-color: var(--sel); color: var(--surface); }
.chip-n { margin-left: 5px; font-weight: 500; opacity: .6; font-variant-numeric: tabular-nums; }
.list { overflow: hidden; }
.card .list { box-shadow: none; background: var(--surface-2); border-radius: var(--r-md); }
.item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; text-decoration: none; color: inherit; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 74px; right: 0; height: 1px; background: var(--hair); }
.card .item + .item::before, .order-list .item + .item::before { left: 18px; }
a.item { transition: background .15s; }
a.item:active { background: var(--surface-2); }
.item .t { font-weight: 600; letter-spacing: -0.01em; }
.item .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fascia { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font: 600 13.5px var(--font); color: #fff; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; background: var(--accent-tint); color: var(--accent-ink); white-space: nowrap; }
.tag.grey { background: var(--surface-2); color: var(--muted); border: 0; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.thumb { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: contain; background: #fff; border: 1px solid var(--hair); flex: none; }
.swatch { width: 44px; height: 44px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; font: 600 13px var(--font); }

/* ---------- numbers */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 14px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--lift); padding: 16px 4px; }
.stat { padding: 0 16px; border-left: 1px solid var(--hair); }
.stat:first-child { border-left: 0; }
.stat b, .tk b { display: block; font-size: 34px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.stat span, .tk span { display: block; margin-top: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.card .stats { box-shadow: none; background: var(--surface-2); }

/* ---------- hero: deep navy, quiet orange glow */
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--r-lg); padding: 22px 20px 20px; margin-bottom: 16px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(226, 81, 39, .32) 0%, rgba(226, 81, 39, 0) 46%), var(--navy);
  box-shadow: 0 24px 48px -28px rgba(16, 19, 34, .8);
}
.hero .eyebrow { color: rgba(255, 255, 255, .62); }
.hero h2 { font-size: 30px; font-weight: 650; margin: 6px 0 16px; color: #fff; letter-spacing: -0.035em; }
.hero-top { display: flex; align-items: flex-start; gap: 10px; }
.hero .tickets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; }
.hero .tk { padding: 2px 14px; border-left: 1px solid rgba(255, 255, 255, .14); color: #fff; }
.hero .tk:first-child { padding-left: 0; border-left: 0; }
.hero .tk span { color: rgba(255, 255, 255, .62); }
.hero .tk-warn b { color: #ffb38f; }
.tk-warn b { color: var(--accent-ink); }
.hero-slim .tickets { margin-bottom: 14px; }
.hero-addr { margin: -8px 0 6px; color: rgba(255, 255, 255, .78); font-size: 14.5px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: rgba(255, 255, 255, .55); font-family: var(--font-mono); }
.hero-btn { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.hero .tag.grey { background: rgba(255, 255, 255, .14); color: #fff; }
.hero .tag.warn { background: #ffd8a8; color: #3a2100; }
.hero .tag:not(.grey):not(.warn) { background: var(--accent-btn); color: #fff; }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); overflow: hidden; margin: 2px 0 10px; }
.progress i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #ff8a5c, var(--accent)); transition: width .5s var(--ease); }
.hero-slim .small { color: rgba(255, 255, 255, .78); }

/* ---------- segmented control */
.seg { display: flex; gap: 2px; padding: 4px; margin-bottom: 16px; border-radius: 12px; background: var(--surface-2); position: sticky; top: 64px; z-index: 8; box-shadow: 0 8px 20px -16px rgba(16, 19, 34, .5); }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: 600 14px var(--font); padding: 10px 6px; border-radius: 9px; cursor: pointer; transition: background .25s var(--ease), color .2s, box-shadow .25s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 19, 34, .12), 0 4px 12px -6px rgba(16, 19, 34, .25); }
.seg-sm { position: static; box-shadow: none; margin-bottom: 14px; }
.seg-sm button { font-size: 13px; padding: 8px 4px; }

/* ---------- spaces */
.space-block { padding: 16px; margin-bottom: 16px; }
.space-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 2px 2px 12px; }
.space-head h3 { font-size: 18px; }
.tier { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 5px; }
.tier-prime { background: var(--accent-tint); color: var(--accent-ink); }
.tier-standard { background: var(--surface-2); color: var(--muted); }
.tier-low { background: var(--warn-bg); color: var(--warn); }
.shot { position: relative; border-radius: var(--r-md); overflow: hidden; background: #0c0e16; min-height: 120px; line-height: 0; cursor: zoom-in; }
.shot img { width: 100%; display: block; }
.shot img:not([src]) { min-height: 200px; }
.shot::after { content: "Tap to zoom"; position: absolute; right: 10px; bottom: 10px; line-height: 1; font: 600 11.5px var(--font); color: #fff; background: rgba(16, 19, 34, .55); padding: 6px 10px; border-radius: 6px; pointer-events: none; }
.shot-wait { position: absolute; inset: 0; display: grid; place-items: center; color: #b9bed0; font-size: 14px; line-height: 1.4; background: #0c0e16; }
.space-block > .shot-wait { position: static; min-height: 180px; border-radius: var(--r-md); }

/* ---------- the "1 facing =" rule */
.rule { display: flex; gap: 18px; align-items: center; padding: 18px 20px; margin-bottom: 16px; }
.rule-num { flex: none; min-width: 72px; }
.rule-num b { display: block; font-size: 46px; font-weight: 600; line-height: .95; letter-spacing: -0.05em; color: var(--accent-ink); }
.rule-num span { display: block; margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.rule-txt { font-size: 14.5px; color: var(--ink-2); min-width: 0; }
.rule-txt b { color: var(--ink); font-weight: 600; }

/* ---------- facing lines */
.lines { display: grid; gap: 10px; }
.line { display: flex; gap: 14px; align-items: center; padding: 14px; }
.ticket { flex: none; width: 60px; height: 64px; border-radius: var(--r-md); display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink); position: relative; overflow: hidden; }
.ticket::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand, var(--accent)); }
.ticket b { font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.ticket span { margin-top: 3px; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.ticket.sm { width: 50px; height: 48px; flex-direction: row; gap: 1px; border-radius: var(--r-sm); }
.ticket.sm b { font-size: 22px; }
.ticket.sm span { margin: 0; font-size: 14px; }
.line-main { flex: 1; min-width: 0; }
.line-name { font-weight: 600; font-size: 16px; line-height: 1.25; letter-spacing: -0.015em; }
.line-name .rank { display: inline-block; min-width: 20px; color: var(--muted); font-weight: 500; font-size: 12.5px; font-family: var(--font-mono); margin-right: 2px; }
.line-meta { font-size: 12.5px; color: var(--muted); margin: 2px 0 10px; display: flex; flex-wrap: wrap; gap: 4px 8px; padding-right: 64px; }
.edited { color: var(--accent-ink); font-weight: 600; }
.sales-bar { position: relative; height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 2px; }
.sales-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.sales-bar span { position: absolute; right: 0; top: -21px; font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.why { font-size: 13px; margin-top: 8px; line-height: 1.4; color: var(--ink-2); }
.stepper { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.stepper .step { width: 40px; height: 40px; font-size: 20px; }
.delta-up { color: var(--good); font-size: 12px; font-weight: 600; }
.delta-down { color: var(--bad); font-size: 12px; font-weight: 600; }

/* ---------- brands */
.brand-rows { display: grid; gap: 10px; }
.brand-row { padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-name i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.brand-nums { display: flex; align-items: flex-end; gap: 10px; font-size: 26px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.brand-nums small { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.brand-nums .arrow { color: var(--muted); font-size: 18px; padding-bottom: 3px; }
.brand-nums span:not(.plan-n):not(.arrow) { color: var(--muted); }
.dual { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }
.dual > div { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.dual i { display: block; height: 100%; border-radius: 3px; }
.dual.dim i { background: var(--rail); }

/* ---------- actions & balance */
.actions { display: grid; gap: 10px; margin-top: 20px; }
.balance {
  position: sticky; bottom: calc(84px + var(--safe-b)); z-index: 6; margin-top: 16px; border-radius: 14px; padding: 14px 22px;
  display: flex; align-items: baseline; gap: 10px; color: #fff; box-shadow: 0 16px 32px -14px rgba(16, 19, 34, .55);
}
.balance b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.balance span { font-size: 13px; opacity: .8; }
.balance.ok { background: rgba(16, 19, 34, .94); }
.balance.spare { background: rgba(27, 31, 51, .94); box-shadow: inset 4px 0 0 var(--accent), 0 16px 32px -14px rgba(16, 19, 34, .55); }
.balance.over { background: rgba(180, 35, 24, .95); }

/* ---------- set-up checklist */
.setup-shelf { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--hair); }
.setup-shelf-h { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 4px 6px; }
.setup-shelf-h span { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.setup-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 6px; border: 0; border-radius: var(--r-md); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.setup-row:active { background: var(--surface-2); }
.tickbox { flex: none; width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; transition: background .2s, border-color .2s, transform .2s var(--ease); }
.setup-row.done .tickbox { background: var(--accent-btn); border-color: var(--accent-btn); transform: scale(1.05); }
.setup-row.done .setup-name b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.setup-name { display: flex; flex-direction: column; min-width: 0; }
.setup-name b { font-size: 16px; font-weight: 600; }
.setup-name small { font-size: 12.5px; color: var(--muted); }
.setup-gap { font-size: 13px; color: var(--muted); padding: 10px; border: 1.5px dashed var(--line); border-radius: var(--r-md); margin-top: 8px; text-align: center; }

/* ---------- measure: spaces editor */
.unit { border: 0; border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; background: var(--surface-2); }
.unit input, .unit select { background: var(--surface); }
.unit .chip { background: var(--surface); }
.unit .chip.on { background: var(--sel); color: var(--surface); }
.unit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.shelf-row { border-top: 1px solid var(--hair); padding-top: 12px; margin-top: 4px; }
.total-bar {
  position: sticky; bottom: calc(84px + var(--safe-b)); z-index: 5; border-radius: 14px; padding: 8px 8px 8px 22px;
  display: flex; align-items: center; gap: 12px; color: #fff; background: rgba(16, 19, 34, .95);
  box-shadow: 0 16px 32px -14px rgba(16, 19, 34, .6);
}
.total-bar .small { opacity: .7; }
.total-bar b { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; }
.total-bar .btn { min-height: 48px; }

/* ---------- drawn planogram */
.pog { background: var(--fixture); border-radius: var(--r-md); padding: 10px 10px 2px; }
.pog .scroll-x { padding-top: 4px; }
.pog-unit { color: #c2c7d6; font-size: 12px; font-weight: 600; margin: 4px 2px 6px; }
.shelf { position: relative; display: flex; gap: 2px; min-height: 68px; background: #232838; border-bottom: 5px solid var(--rail); border-radius: 6px 6px 2px 2px; padding: 3px 3px 0; margin-bottom: 8px; }
.shelf .lbl { position: absolute; left: 4px; top: 4px; font-size: 10.5px; font-weight: 600; background: rgba(0, 0, 0, .5); color: #fff; padding: 2px 7px; border-radius: 5px; z-index: 2; }
.shelf.eye { box-shadow: inset 0 0 0 2px var(--accent); }
.blk { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; border-radius: 5px 5px 0 0; overflow: hidden; color: #fff; text-align: center; padding: 4px 2px; font-size: 10.5px; line-height: 1.15; }
.blk img { width: 100%; height: 38px; object-fit: contain; background: rgba(255, 255, 255, .92); border-radius: 4px; margin-bottom: 2px; }
.blk .n { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; hyphens: auto; font-weight: 500; }
.blk .x { font-weight: 700; font-size: 13px; }
.empty-slot { flex: 1; border: 1px dashed #6b7385; border-radius: 5px; }

/* ---------- tables & notices */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 4px; border-bottom: 1px solid var(--hair); }
td { padding: 10px 4px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.fc { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.fc b { min-width: 22px; text-align: center; font-size: 16px; }
.warnbox { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-md); padding: 12px 16px; font-size: 13.5px; margin-bottom: 14px; }
.warnbox ul { margin: 4px 0 0; padding-left: 18px; }
.okbox { background: var(--good-bg); color: var(--good); border-radius: var(--r-md); padding: 12px 16px; font-size: 13.5px; margin-bottom: 14px; }
.photo { width: 100%; border-radius: var(--r-md); margin-top: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; margin: 6px 4px 8px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.scroll-x { overflow-x: auto; }

/* ---------- sign in */
.login-hero { padding: calc(env(safe-area-inset-top, 0px) + 64px) 16px 88px; display: grid; place-items: center;
  background: radial-gradient(90% 120% at 100% 0%, rgba(226, 81, 39, .35), rgba(226, 81, 39, 0) 55%), var(--navy); }
.login-hero img { width: 240px; max-width: 72%; height: auto; }
.login { max-width: 420px; margin: -48px auto 0; padding: 0 16px 40px; }
.login-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--lift); padding: 24px; }

/* ---------- photo capture & review */
.ph-frame { position: relative; border-radius: var(--r-md); overflow: hidden; background: #000; line-height: 0; }
.ph-frame img { width: 100%; display: block; }
.ph-box { position: absolute; border: 2px solid #e25127; background: rgba(226, 81, 39, .12); border-radius: 6px; }
.ph-box.off { border: 2px dashed rgba(255, 255, 255, .7); background: rgba(0, 0, 0, .3); }
.ph-box span { position: absolute; left: 4px; top: 4px; background: #e25127; color: #fff; font: 600 12px/1 var(--font); padding: 4px 7px; border-radius: 5px; }
.ph-box.off span { background: #6b7183; }
.ph-num { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 6px; background: var(--accent-btn); color: #fff; font: 600 12.5px var(--font); }
.shelf-row.off { opacity: .55; }
.shelf-row.off .ph-num { background: var(--muted); }

/* ---------- zoomed photo */
.zoom { position: fixed; inset: 0; z-index: 100; background: rgba(5, 6, 10, .96); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); animation: vt-in .25s var(--ease); }
.zoom-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; color: #c2c7d6; font-size: 13px; }
.zoom-bar .btn.dark { background: #f0f1f5; color: #101322; }
.zoom-scroll { flex: 1; overflow: auto; touch-action: pan-x pan-y pinch-zoom; display: flex; align-items: center; }
.zoom-scroll img { width: 240%; max-width: none; display: block; }
@media (min-width: 900px) { .zoom-scroll img { width: 140%; } }

/* ---------- store page, shelf check */
.plan-link { display: block; color: inherit; text-decoration: none; transition: transform .15s var(--ease); }
.plan-link:active { transform: scale(.99); }
.plan-link .chev { font-size: 26px; color: var(--muted); }
.score { padding: 8px 14px; border-radius: var(--r-md); min-width: 84px; }
.score b { display: block; font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; }
.score span { font-size: 11.5px; font-weight: 500; }
.score.good { background: var(--good-bg); color: var(--good); }
.score.mid { background: var(--warn-bg); color: var(--warn); }
.score.low { background: var(--bad-bg); color: var(--bad); }
.check-card .brand-rows { gap: 0; }
.check-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 84px; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--hair); }
.check-row:last-child { border-bottom: 0; }
.check-row .brand-name { font-size: 15px; }
.check-n { font-size: 18px; font-weight: 600; letter-spacing: -0.03em; }
.check-n small { font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.check-gap { font-size: 12.5px; font-weight: 600; text-align: right; color: var(--good); }
.check-gap.short { color: var(--bad); }
.check-gap.over { color: var(--muted); }

/* ---------- before / after */
.ba { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: #0c0e16; user-select: none; }
.ba > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba .ba-after { clip-path: inset(0 0 0 var(--pos)); }
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.ba-line::after { content: ""; position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; transform: translate(-50%, -50%); border-radius: 9px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23101322' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 6-4 4 4 4M13 6l4 4-4 4'/%3E%3C/svg%3E") no-repeat center; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.ba-range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; min-height: 0; padding: 0; }
.ba-tag { position: absolute; top: 12px; font: 600 12px var(--font); color: #fff; padding: 5px 10px; border-radius: 6px; pointer-events: none; }
.ba-tag-b { left: 12px; background: rgba(16, 19, 34, .7); }
.ba-tag-a { right: 12px; background: rgba(201, 68, 32, .92); }
.ba-none { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa; font-size: 13px; }
.ba-wait { min-height: 140px; border-radius: var(--r-md); margin-bottom: 16px; position: static; }

/* ---------- order */
.deep { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; margin: 2px 4px; }
.deep b { font-size: 18px; font-weight: 600; min-width: 14px; text-align: center; }
.sm-step { width: 32px; height: 32px; font-size: 18px; border-radius: 8px; }
.order-list .ticket.sm { width: 56px; }

@media (min-width: 700px) {
  .blk img { height: 52px; }
  .shelf { min-height: 84px; }
  .hero h2 { font-size: 38px; }
  .hero { padding: 28px; }
}
@media print {
  .shelf { min-width: 0 !important; }
  .top, .tabs, .no-print, .total-bar, .banner, .balance { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .pog, .blk, .swatch, .hero, .ticket { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- notifications */
#toasts { position: fixed; z-index: 120; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 64px); display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden; width: min(440px, 100%);
  display: flex; align-items: center; gap: 12px; padding: 14px 16px 15px 14px; border-radius: 12px;
  font: 600 15px/1.35 var(--font); letter-spacing: -0.01em; cursor: pointer;
  box-shadow: 0 18px 40px -12px rgba(16, 19, 34, .45), 0 2px 6px rgba(16, 19, 34, .12);
  animation: toast-in .42s cubic-bezier(.2, 1.3, .3, 1) both;
}
.toast.out { animation: toast-out .24s var(--ease) both; }
.toast-ic { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.toast-ic svg { width: 20px; height: 20px; }
.toast-msg { flex: 1; min-width: 0; }
.toast-life { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; animation: toast-life var(--life, 3200ms) linear both; }
.toast-success { background: var(--accent-btn); color: #fff; }
.toast-success .toast-ic { background: #fff; color: var(--accent-btn); }
.toast-success .toast-life { background: rgba(255, 255, 255, .55); }
.toast-warn { background: #ffd27a; color: #2b1800; }
.toast-warn .toast-ic { background: #2b1800; color: #ffd27a; }
.toast-warn .toast-life { background: rgba(43, 24, 0, .35); }
.toast-info, .toast-busy { background: var(--surface); color: var(--ink); box-shadow: 0 18px 40px -12px rgba(16, 19, 34, .45), inset 0 0 0 1px var(--hair); }
.toast-info .toast-ic, .toast-busy .toast-ic { background: var(--accent-tint); color: var(--accent-ink); }
.toast-info .toast-life, .toast-busy .toast-life { background: var(--accent); }
.toast-spin { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--accent-tint); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-18px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toast-life { to { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.out { animation: none; } .toast-life { animation: none; } }

/* ---------- box images */
.img-cta { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; padding: 14px 16px; }
.img-cta b { font-weight: 600; }
.img-cta .chev { font-size: 24px; color: var(--muted); }
.img-cta-stack { display: flex; flex: none; height: 52px; align-items: flex-end; }
.img-cta-stack img { height: 52px; width: auto; max-width: 40px; object-fit: contain; margin-left: -10px; filter: drop-shadow(0 4px 6px rgba(16, 19, 34, .25)); }
.img-cta-stack img:first-child { margin-left: 0; }
.img-cta-empty { width: 46px; height: 52px; border-radius: 6px; border: 1.5px dashed var(--line); }
.dropzone { display: grid; place-items: center; gap: 4px; text-align: center; padding: 34px 16px; border-radius: var(--r-md); border: 1.5px dashed var(--line); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone b { font-weight: 600; font-size: 16px; color: var(--accent-ink); }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-tint); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.img-cell { display: grid; gap: 6px; align-content: start; padding: 10px; border-radius: var(--r-md); background: var(--surface-2); min-width: 0; }
.img-cell .tag { justify-self: start; }
.img-cell select { min-height: 42px; padding: 8px 10px; font-size: 13.5px; background: var(--surface); }
.img-face { height: 130px; display: grid; place-items: center; border-radius: 6px; background: repeating-conic-gradient(var(--surface) 0 25%, var(--surface-2) 0 50%) 0 0 / 14px 14px; }
.img-face img { max-height: 118px; max-width: 90%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(16, 19, 34, .25)); }
.img-file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.img-cell.err .img-face { background: var(--bad-bg); }
.progress.light { background: var(--surface-2); height: 8px; margin-bottom: 8px; }
.pack-preview { display: grid; gap: 6px; justify-items: start; margin-bottom: 14px; }
.pack-shelf { display: flex; gap: 6px; align-items: flex-end; padding: 12px 14px 0; border-radius: 6px 6px 2px 2px; background: var(--fixture); border-bottom: 6px solid var(--rail); min-height: 120px; }
.pack-shelf img { height: 104px; width: auto; max-width: 84px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); }
.blk-img { background: transparent !important; padding: 2px 1px 3px; justify-content: flex-end; border-bottom: 3px solid var(--brand); border-radius: 0; }
.blk-img .faces { display: flex; align-items: flex-end; gap: 2px; width: 100%; height: 100%; min-height: 0; flex: 1; }
.blk-img .faces img { flex: 1 1 0; min-width: 0; width: 100%; height: auto; max-height: 64px; object-fit: contain; object-position: bottom; background: none; margin: 0; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5)); }
.blk-img .x { color: #fff; font-size: 12px; line-height: 1.2; }
@media (min-width: 700px) { .blk-img .faces img { max-height: 80px; } }
.mini-pack { height: 28px; width: auto; max-width: 24px; object-fit: contain; vertical-align: -8px; margin-right: 8px; }
.setup-pack { flex: none; height: 44px; width: 34px; object-fit: contain; }

/* ---------- store search & adding stores */
.search-row { position: relative; }
.search-row input { padding-right: 70px; }
.kb-toggle { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); height: 36px; min-width: 52px; padding: 0 10px; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--ink); font: 600 13px var(--font-mono); letter-spacing: .02em; cursor: pointer; }
.kb-toggle:active { background: var(--accent-tint); }
.new-dot { color: var(--accent-ink); font-weight: 600; }
.empty-find { display: grid; gap: 4px; padding: 22px 18px; text-align: center; }
.add-store { margin-top: 12px; }
