:root {
  --bg: #0f1216; --panel: #181c22; --panel2: #1f242c; --line: #2b323c; --text: #e9ecf1; --mute: #98a2b3;
  --gold: #d4af37; --gold-ink: #17130a; --good: #3fb37f; --warn: #e0a341; --bad: #e5604f; --info: #5aa2e6;
  --r: 12px; --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root.light {
  --bg: #f3f1ea; --panel: #ffffff; --panel2: #f7f5ee; --line: #ddd8cc; --text: #1b1a17; --mute: #6b665c;
  --gold: #85660f; --gold-ink: #ffffff; --good: #1b7a4b; --warn: #8f5400; --bad: #c0392b; --info: #2e6fb0;   /* §407: every token at 4.5:1 or better on the panels */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 17px; }
p { margin: 0 0 10px; }
a { color: var(--gold); text-decoration: none; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--gold); font-size: 28px; font-weight: 700; letter-spacing: .08em; }
.mute { color: var(--mute); } .small { font-size: 13px; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.r { text-align: right; } .good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); } .gold { color: var(--gold); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1 1 auto; min-width: 0; } .spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* shell */
.shell { display: grid; grid-template-columns: 208px 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px calc(10px + env(safe-area-inset-bottom)); gap: 4px; overflow-y: auto; }
.brand { color: var(--gold); font-weight: 800; letter-spacing: .12em; font-size: 18px; padding: 6px 10px 14px; }
.brand .powered { color: var(--mute); font-weight: 500; letter-spacing: 0; font-size: 11px; margin-top: 2px; }   /* §384: Starter and Pro */
.brand .biz { color: var(--mute); font-weight: 500; letter-spacing: 0; font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 12px; border-radius: 10px; color: var(--text); font-weight: 550; }
.nav a .ico { width: 22px; text-align: center; font-size: 18px; }
.nav a.on { background: var(--gold); color: var(--gold-ink); }
.nav a.locked { opacity: .55; }   /* a screen the plan does not include (§327): shown, opens to the upgrade card */
.nav a .badge { margin-left: auto; background: var(--bad); color: var(--gold-ink); border-radius: 99px; font-size: 12px; padding: 1px 7px; }
.nav a.on .badge { background: var(--gold-ink); color: var(--gold); }
.who { margin-top: auto; padding: 10px; font-size: 13px; color: var(--mute); border-top: 1px solid var(--line); }
.who b { color: var(--text); display: block; font-size: 14px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.spotbar { display: flex; gap: 18px; align-items: center; flex: 1; min-width: 0; font-size: 14px; overflow-x: auto; white-space: nowrap; padding: 2px 0; }
.gsearch-wrap { position: relative; flex: 0 1 300px; min-width: 120px; }
.gsearch { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.gsearch-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(520px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.45); z-index: 40; padding: 6px 0; }
.bell-wrap { position: relative; }
.bell { position: relative; background: transparent; border: 1px solid var(--line); border-radius: 10px; min-height: 36px; padding: 4px 10px; font-size: 16px; cursor: pointer; color: var(--text); }
.bell-badge { position: absolute; top: -6px; right: -6px; background: var(--bad); color: var(--gold-ink); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 6px; min-width: 18px; text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.45); z-index: 40; padding: 4px 0 6px; }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; cursor: pointer; border-left: 3px solid transparent; }
.bell-item:hover { background: var(--bg); } .bell-item.unread { border-left-color: var(--gold); } .bell-ico { width: 18px; text-align: center; color: var(--mute); }
.gsearch-k { padding: 8px 12px 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.gsearch-hit { padding: 7px 12px; cursor: pointer; border-left: 3px solid transparent; }
.gsearch-hit:hover, .gsearch-hit.on { background: var(--bg); border-left-color: var(--gold); }
.spotbar .m b { font-variant-numeric: tabular-nums; }
.spotbar .stale { color: var(--warn); }
.spotbar .m.up b { color: var(--good); } .spotbar .m.down b { color: var(--bad); } .spotbar .m b { transition: color .8s; }
.view { flex: 1; overflow-y: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.view > .stack { max-width: 1180px; margin: 0 auto; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* pieces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card h2 { margin-bottom: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; }
.tile .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--mute); font-size: 13px; }
.tile.alert .n { color: var(--warn); }
.tile.good .n { color: var(--good); }
.btn { min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }   /* a link dressed as a button sits like one */
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--mute); } .btn.ghost:hover { border-color: var(--line); color: var(--text); background: var(--panel2); }
.btn.big { min-height: 64px; font-size: 19px; padding: 0 26px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.on { outline: 2px solid var(--gold); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field .lbl { font-size: 13px; color: var(--mute); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--mute); }
input, select, textarea { min-height: var(--tap); width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
/* a checkbox or radio is a small square beside its words, never a full-width field (the rule above would make it one) */
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; vertical-align: middle; accent-color: var(--gold); flex: none; }
label.row > input[type=checkbox], label.row > input[type=radio] { margin-right: 2px; }
textarea { min-height: 72px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid .wide { grid-column: 1 / -1; }
.scanbox { font-size: 20px; min-height: 58px; border: 2px solid var(--gold); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--panel2); color: var(--mute); white-space: nowrap; }
.pill.good { background: rgba(63,179,127,.16); color: var(--good); } .pill.warn { background: rgba(224,163,65,.16); color: var(--warn); }
.pill.bad { background: rgba(229,96,79,.16); color: var(--bad); } .pill.mute { opacity: .7; } .pill.gold { background: rgba(212,175,55,.18); color: var(--gold); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th.r, .tbl td.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:active { background: var(--panel2); }
.tbl tr.dim td { opacity: .55; }
.empty { padding: 26px; text-align: center; color: var(--mute); border: 1px dashed var(--line); border-radius: var(--r); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; } .kv dt { color: var(--mute); } .kv dd { margin: 0; }
.kv-acts { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; } .kv-acts .btn { margin: 0; }   /* a value with its buttons: they wrap as a row, never centred on their own line */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs .btn { min-height: 40px; }

/* tags on screen */
.tag-preview { background: #cfd3d8; padding: 14px; border-radius: var(--r); display: inline-block; }
.tag-preview svg { display: block; width: auto; height: auto; max-width: 320px; max-height: 320px; box-shadow: 0 1px 4px rgba(0,0,0,.4); margin-bottom: 10px; }
.tag-preview svg:last-child { margin-bottom: 0; }
.tag-choices { display: flex; gap: 12px; flex-wrap: wrap; }
.tag-choice { cursor: pointer; border: 2px solid transparent; border-radius: 10px; padding: 6px; background: #cfd3d8; }
.tag-choice.on { border-color: var(--gold); }
.tag-choice svg { display: block; width: 192px; height: 96px; }
.tag-choice span { display: block; text-align: center; font-size: 12px; color: #222; font-weight: 650; padding-top: 4px; }

/* live show */
.block { background: var(--panel); border: 2px solid var(--gold); border-radius: 16px; padding: 22px; min-height: 190px; }
.block .lot { color: var(--gold); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; }
.block .title { font-size: clamp(24px, 4vw, 40px); font-weight: 750; line-height: 1.12; margin: 6px 0; }
.block .meta { color: var(--mute); font-size: 17px; }
.block.idle { border-color: var(--line); display: grid; place-items: center; color: var(--mute); font-size: 20px; text-align: center; }
.block .nums { display: flex; gap: 26px; margin-top: 12px; flex-wrap: wrap; } .block .nums div b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.block .nums div span { color: var(--mute); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.showgrid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* scan-first (phone) mode on the live screen: scan box + wins only, large */
.scanfirst .showgrid { grid-template-columns: 1fr; }
.scanfirst .showgrid > .stack:first-child > :not(.scanrow):not(.scanbox):not(.row):not(.blockbox):not(.queuedbox) { display: none; }
.scanfirst .showgrid > .stack:first-child > .row:not(.scanrow) > :not(.phonebtn) { display: none; }
.scanfirst .showgrid > .stack:last-child > :not(:nth-child(2)) { display: none; }
.scanfirst .scanbox { font-size: 22px; min-height: 58px; }
.scanfirst .head h1 { font-size: 18px; }
.outcomes { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 10px; margin-top: 12px; } .outcomes .btn { padding: 0 8px; }
.flash { animation: flash .6s ease-out; } @keyframes flash { from { background: rgba(212,175,55,.35); } to { background: var(--panel); } }

/* packing */
.buyer-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.buyer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; }
.buyer .u { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; } .buyer .p { color: var(--gold); font-weight: 700; }
.bar { height: 8px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin-top: 8px; } .bar i { display: block; height: 100%; background: var(--good); }
.packrow { display: flex; gap: 12px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.packrow:last-child { border-bottom: 0; }
.packrow .tick { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; flex: none; }
.packrow.done .tick { background: var(--good); border-color: var(--good); color: #06281a; } .packrow.done .t { color: var(--mute); text-decoration: line-through; }

/* sign in */
.signin { max-width: 380px; margin: 12vh auto 0; padding: 0 18px; }

/* pop-ups and messages */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; gap: 12px; }
.modal-body { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-back.alarm { background: rgba(170, 28, 16, .93); }
.alarm-box { text-align: center; color: #fff; display: flex; flex-direction: column; gap: 18px; align-items: center; max-width: 720px; }
.alarm-title { font-size: clamp(40px, 9vw, 84px); font-weight: 850; letter-spacing: .02em; }
.alarm-text { font-size: clamp(18px, 3vw, 26px); }
.alarm-box .btn { background: #fff; color: #7a1208; border-color: #fff; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(520px, 92vw); }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 5px solid var(--good); padding: 12px 14px; border-radius: 10px; box-shadow: 0 6px 22px rgba(0,0,0,.45); }
.toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
/* the demo tour card (tour.js): rides along the bottom right, above the page, below modals */
.tour { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 32px)); background: var(--panel2); border: 1px solid var(--gold); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.5); z-index: 45; }
.demo-banner.clickable { cursor: pointer; text-decoration: underline dotted; }

/* phone and narrow iPad: tabs along the bottom */
@media (max-width: 820px) {
  /* pinned to the visible screen so only .view scrolls (iOS otherwise lets the whole page
     scroll under the address bar and the bottom tabs drift away) */
  .shell { position: fixed; inset: 0; height: auto; overflow: hidden; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .side { order: 2; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; gap: 2px; }
  .brand, .who { display: none; }
  .nav { display: flex; flex: 1; gap: 2px; }
  .nav a { flex: 1 0 62px; flex-direction: column; gap: 0; font-size: 11px; justify-content: center; padding: 4px 2px; min-height: 52px; position: relative; }
  .nav a .badge { position: absolute; top: 2px; right: 8px; margin: 0; }
  /* §404: the day's first screens as tabs, the rest behind More; headings and plan pills have no place in a 62 px tab */
  .nav-group, .nav a .pill, .nav a.secondary { display: none !important; }
  .nav a.more-tab { display: flex !important; }   /* the desktop rule below hides it; on a phone it wins */
  .main { height: 100%; min-height: 0; }
  .side { flex: none; }
  .view { padding: 12px; }
  .topbar { flex-wrap: wrap; padding-left: 12px; padding-right: 12px; gap: 6px; }
  .gsearch-wrap { flex: 1 1 120px; min-width: 0; }
  /* a screen's tools row (Inventory, Orders) slides sideways on a phone instead of stacking three deep */
  .row.tools { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; scrollbar-width: none; }
  .row.tools::-webkit-scrollbar { display: none; }
  .row.tools > * { flex: none; white-space: nowrap; }
  .topbar .askbtn { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
  .topbar .bell { padding: 4px 8px; }
  /* spot prices on their own full-width line under the search, scrolling sideways when there are many */
  .spotbar { order: 3; flex: 1 1 100%; gap: 14px; font-size: 13px; padding: 0 0 2px; }
  .bell-panel { left: 0; right: 0; width: auto; }
  .gsearch-panel { left: 0; right: 0; width: auto; }
  .showgrid { grid-template-columns: 1fr; }
  .tbl { font-size: 14px; } .tbl td, .tbl th { padding: 9px 8px; } .tbl td.mono { white-space: nowrap; }
  .table-wrap .tbl { min-width: 520px; }
  h1 { font-size: 22px; }
  /* floor screens: the head with its buttons stays put, targets get bigger */
  /* only the floor screens pin their head (scan box and buttons stay put); Home and the rest scroll normally */
  .view[data-screen="packing"] .head, .view[data-screen="count"] .head, .view[data-screen="scrap"] .head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0; margin: -6px 0 6px; flex-wrap: wrap; }
  .head .btn, .scanrow .btn { min-height: 44px; }
  .scanrow input { font-size: 18px; min-height: 48px; }
  .btn.sm { min-height: 36px; }
  .row.pack-actions .btn, .count-actions .btn { flex: 1 1 45%; min-height: 48px; }
  .tbl td .btn.sm { min-height: 40px; }
  .more { width: 100%; margin-top: 6px; }
}

/* installed on a phone's home screen the page runs under the status bar: pad the top bar for it (a browser tab already leaves room, so no padding there) */
@media (display-mode: standalone), (display-mode: fullscreen) { .topbar { padding-top: calc(6px + env(safe-area-inset-top)); } }

/* printing: only the tags, one per 2x1 page */
#print-area { display: none; }
@media print {
  @page { size: 2in 1in; margin: 0; }
  html, body { background: #fff; height: auto; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  .tag-page { width: 2in; height: 1in; page-break-after: always; break-after: page; overflow: hidden; }
  .tag-page:last-child { page-break-after: auto; break-after: auto; }
  .tag-page svg { display: block; width: 2in; height: 1in; }
}

/* reports: month bars */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 6px 0 0; overflow-x: auto; }
.bar-col { flex: 1 1 0; min-width: 34px; display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.bar-stack { flex: 1; position: relative; }
.bar { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 4px 4px 0 0; }
.bar.sales { background: rgba(212,175,55,.35); }
.bar.profit { background: var(--good); width: 50%; left: 25%; }
.bar-l { color: var(--mute); font-size: 11px; text-align: center; padding-top: 4px; white-space: nowrap; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.swatch.sales { background: rgba(212,175,55,.5); } .swatch.profit { background: var(--good); }

.help { padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; max-width: 70ch; }
.buyer-tag { cursor: pointer; border-bottom: 1px dotted var(--mute); }
.scanrow { flex-wrap: nowrap; } .scanrow .btn.cam { min-height: 58px; font-size: 22px; padding: 0 14px; }

/* Home: needs attention */
ul.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.attn li { cursor: pointer; padding: 6px 8px; border-radius: 8px; }
ul.attn li:hover, ul.attn li:focus { background: var(--line); outline: none; }
ul.attn li b { display: inline-block; min-width: 2.2em; text-align: right; color: var(--warn); }

/* item photos */
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; background: var(--panel2); }

/* ---------- home dashboard ---------- */
.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .tile.kpi .n { font-size: 22px; } }
.tile.kpi { display: flex; flex-direction: column; gap: 2px; }
.tile.kpi .n { font-size: 26px; line-height: 1.15; }
.tile.kpi .sub { font-size: 13px; }
.tile.kpi .spark { align-self: flex-end; margin-top: 4px; opacity: .9; }
.meter { height: 8px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin-top: 8px; position: static; }
.meter i { display: block; height: 100%; background: var(--gold); border-radius: 9px; }
.dash { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 12px; align-items: start; margin-top: 12px; }
@media (max-width: 980px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.dash > .stack, .dash .card { min-width: 0; }   /* a wide chart scrolls inside its card, never the page (Home at phone width) */
@media (max-width: 480px) { .bars { gap: 2px; } .bar-col { min-width: 6px; } }
.spark .line { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--gold); opacity: .12; stroke: none; }
.spark .dot { fill: var(--gold); }
ul.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.feed li { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; border-top: 1px solid var(--line); }
ul.feed li:first-child { border-top: 0; }
ul.feed li:hover, ul.feed li:focus { background: var(--line); outline: none; }
ul.feed .ico { width: 22px; text-align: center; flex: none; opacity: .85; }
ul.feed .when { flex: none; min-width: 64px; text-align: right; }
ol.top { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 5px; }
ol.top li { display: flex; gap: 10px; align-items: baseline; }
ol.top li::marker { color: var(--mute); }
.spots { display: flex; flex-direction: column; gap: 6px; }
.spot-row { display: flex; gap: 12px; align-items: center; padding: 4px 0; border-top: 1px solid var(--line); }
.spot-row:first-child { border-top: 0; }
.card.insights { padding: 8px 12px; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-t { height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.hbar-t i { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.hbar-t i.good { background: var(--good); } .hbar-t i.bad { background: var(--bad); }
.hbar-v { color: var(--mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.heat { display: grid; grid-template-columns: auto repeat(7, 1fr); gap: 3px; font-size: 11px; }
.heat-h { color: var(--mute); padding: 2px 6px 2px 0; white-space: nowrap; align-self: center; text-align: center; }
.heat-c { height: 26px; border-radius: 4px; background: var(--panel2); display: flex; align-items: center; justify-content: center; color: var(--text); position: relative; overflow: hidden; }
.heat-c::before { content: ''; position: absolute; inset: 0; background: var(--gold); opacity: var(--a, 0); }
.heat-c span { position: relative; font-variant-numeric: tabular-nums; }
.heat-c.future { opacity: .35; }
.heat-c.hi span { color: var(--gold-ink); font-weight: 600; }
.note { white-space: pre-wrap; line-height: 1.45; }
@media (max-width: 520px) { .hbar { grid-template-columns: 80px 1fr; } .hbar-v { grid-column: 2; font-size: 11px; } .heat-c span { font-size: 9px; } }

.offline-strip { padding: 6px 18px; font-size: 13px; font-weight: 600; text-align: center; }
.offline-strip.bad { background: var(--bad); color: var(--gold-ink); } .offline-strip.warn { background: var(--warn); color: var(--gold-ink); }

/* the HUD: the app in a bare window on top of the stream software */
.hud-mode .side, .hud-mode .topbar { display: none; }
.hud-mode .shell { grid-template-columns: 1fr; }
.hud-mode .view { padding: 10px; }
.hud { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.hud-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.hud-big { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; color: var(--good); }
.hud-goal { position: relative; height: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.hud-goal i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); opacity: .7; }
.hud-goal span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.hud-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; }
.hud-row > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; display: flex; flex-direction: column; }
.hud-row b { font-size: 18px; font-variant-numeric: tabular-nums; } .hud-row span { color: var(--mute); font-size: 11px; }
.hud-list { display: flex; flex-direction: column; gap: 4px; }
.hud-win { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; }
.hud-win.big { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }

.card.dropping { outline: 2px dashed var(--gold); outline-offset: -4px; background: var(--panel2); }
.dropbox { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
.dropbox.dropping { border-color: var(--gold); background: var(--panel2); }
.dashtbl { width: 100%; border-collapse: collapse; }
.dashtbl th { text-align: left; font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dashtbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dashtbl tr:last-child td { border-bottom: 0; }
.dashtbl th.r, .dashtbl td.r { text-align: right; font-variant-numeric: tabular-nums; }

.modal.docview { width: min(1100px, 100%); height: 92vh; padding: 12px 14px; }
.docview-body { flex: 1; min-height: 0; display: flex; overflow: auto; background: var(--panel2); border-radius: 10px; }
.docview-body iframe { flex: 1; }
.docthumbs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.docthumb { width: 88px; height: 88px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel2); cursor: pointer; }
.docthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.vfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 20px; }
.vfact-l { color: var(--mute); font-size: 12px; }
.vfact-v { font-size: 15px; font-variant-numeric: tabular-nums; }

.askbtn { white-space: nowrap; }
.ask-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 40; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); box-shadow: -8px 0 30px rgba(0,0,0,.35); }
.ask-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.ask-msg { display: flex; flex-direction: column; gap: 6px; }
.ask-msg.user { align-items: flex-end; }
.ask-bubble { max-width: 92%; padding: 9px 12px; border-radius: 12px; background: var(--panel2); line-height: 1.4; white-space: pre-wrap; }
.ask-msg.user .ask-bubble { background: var(--gold); color: #111; white-space: normal; }
.ask-li { padding-left: 14px; position: relative; } .ask-li::before { content: '•'; position: absolute; left: 2px; }
.ask-table summary { cursor: pointer; }
.ask-drawer textarea { flex: 1; resize: none; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--gold); }
th.sorted { color: var(--gold); }
.sortmark { font-size: 0.8em; }

/* sections rail (Settings, Reports): one section at a time, a find box, the rail sticky beside the cards */
[hidden] { display: none !important; }
.railed { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.rail-side { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 8px; }
.rail { display: flex; flex-direction: column; gap: 2px; }
.rail-item { text-align: left; background: transparent; border: 1px solid transparent; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.rail-item:hover { background: var(--panel2); }
.rail-item.on { background: var(--panel); border-color: var(--line); font-weight: 600; }
.rail-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rail-body > .rail-title { margin: 0 0 -4px; }
@media (max-width: 820px) {
  .railed { grid-template-columns: minmax(0, 1fr); }
  .rail-side { position: static; }
  .rail { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .rail-item { border: 1px solid var(--line); padding: 6px 10px; }
}
.nav-group { color: var(--mute); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 10px 12px 2px; }
.nav a.more-tab { display: none; }   /* a phone's tab only (§404) */
.more-sheet a.btn { justify-content: flex-start; gap: 10px; }
.row.tools { gap: 6px; margin-top: -6px; }
.ask-proposal { max-width: 92%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--gold); background: var(--panel2); display: flex; flex-direction: column; gap: 4px; }
.ask-proposal.done { border-color: var(--line); opacity: .8; }
.ask-plines { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: .92em; }
.ask-pline code { font-size: .9em; }
.card.brief { border-color: var(--gold); }
.brief-head { font-size: 1.08em; font-weight: 600; margin: 4px 0 8px; }
.brief-lines { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.brief-week { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); } .brief-week .review-todo { margin-top: 0; margin-bottom: 6px; }
.ask-start { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel2); color: inherit; border-radius: 999px; padding: 5px 11px; font-size: .9em; cursor: pointer; }
.chip:hover { border-color: var(--gold); }
.price-suggest { display: flex; align-items: baseline; gap: 12px; }
.price-ask { font-size: 1.9em; font-weight: 700; color: var(--gold); }
.ask-photo { display: flex; gap: 8px; align-items: flex-start; }
.ask-photo img { max-height: 96px; max-width: 160px; border-radius: 8px; border: 1px solid var(--line); }
.ask-bubble table.ask-md { border-collapse: collapse; margin: 6px 0; font-size: 13px; display: block; overflow-x: auto; max-width: 100%; }
.ask-bubble table.ask-md th, .ask-bubble table.ask-md td { border: 1px solid var(--line); padding: 3px 8px; text-align: left; white-space: nowrap; }
.ask-bubble table.ask-md th { background: var(--panel); font-weight: 600; }
.ask-drawer .btn.live, .btn.live.mic, .row .btn.live { border-color: var(--bad); color: var(--bad); animation: askpulse 1.2s ease-in-out infinite; }
@keyframes askpulse { 50% { opacity: .55; } }
.ask-ctx { padding: 2px 0; }
.ask-bubble a.ask-sku { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold); }
.block .pitch { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 6px; font-size: 14px; line-height: 1.35; }
.block .pitch .pitch-text { flex: 1; min-width: 0; }
.block .pitch:not(.has) .pitch-text:empty { display: none; }
.review-todo { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.review-item { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.review-item.done span { text-decoration: line-through; color: var(--mute); }

.switch-biz { margin-top: 6px; width: 100%; min-height: 0; padding: 4px 6px; font-size: 12px; }

/* §336: Home's frame before its data — grey tiles that breathe until the real ones replace them */
.skel-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 10px 0 }
.skel-tiles .tile { background: var(--panel); color: transparent; animation: vm-breathe 1.2s ease-in-out infinite; pointer-events: none }
.skel-tiles .tile .n, .skel-tiles .tile .l { background: rgba(127,127,127,.18); border-radius: 6px; min-height: 1em }
.skel-tiles .tile .n { width: 40%; height: 1.6em; margin-bottom: 6px }
.skel-tiles .tile .l { width: 70%; height: .9em }
@keyframes vm-breathe { 0%, 100% { opacity: .55 } 50% { opacity: 1 } }

/* §338: the melt guide */
.melt-spot { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; margin: 6px 0 10px }
.melt-spot-tile { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 14px; min-width: 150px; background: var(--panel) }
.melt-spot-tile .l { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute) }
.melt-spot-tile .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums }
.melt-spot-tile.gold .n { color: var(--gold) }
.melt-spark { display: block; width: 100%; height: 28px; margin-top: 4px; color: var(--mute) }
.melt-chips { display: flex; gap: 6px; flex-wrap: wrap }
.melt-chips .chip.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold) }
.melt-bar { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0 }
.melt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px }
.melt-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--panel2) }
.melt-card.metal-gold { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)) }
.melt-pic { flex: 0 0 92px; width: 92px; height: 92px; border-radius: 12px; background: var(--panel) center/contain no-repeat; display: flex; align-items: center; justify-content: center; overflow: hidden }
.melt-pic.catalog { background-color: #fff }
.melt-pic.drawn svg { width: 80px; height: 80px }
.melt-pic.link { cursor: pointer }
.melt-pic input { display: none }
.melt-dot { width: 32px; height: 32px; border-radius: 50%; background: #fff center/cover no-repeat; overflow: hidden }
.melt-dot svg { width: 32px; height: 32px }
.melt-body { min-width: 0; display: flex; flex-direction: column; gap: 2px }
.melt-title { font-size: 15px; line-height: 1.25 }
.melt-val { font-size: 22px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums }
@media print { .melt-bar, .melt-tools, .head button, .nav, .topbar { display: none !important } .melt-spot-tile { break-inside: avoid } }
/* folded lists (§362): the two big catalog tables on the Shopify screen stay closed until asked */
details.fold > summary { cursor: pointer; list-style: none; padding: 6px 0; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '▸ '; color: var(--mute, #888); }
details.fold[open] > summary::before { content: '▾ '; }

/* §407 light pills: the dark tints were hard-coded; in the light theme the colour sits on a pale wash of itself */
:root.light .pill.good { background: #e2f2e9; } :root.light .pill.warn { background: #faeedb; } :root.light .pill.bad { background: #f8e1dd; } :root.light .pill.gold { background: #f5ecd2; }
/* §407 the keyboard: everything a hand can click can be reached and shows where it is */
.buyer:focus-visible, .tile:focus-visible, .rail-item:focus-visible, th.sortable:focus-visible, tr.click:focus-visible, .chip:focus-visible, [role=link][tabindex]:focus-visible, [role=button][tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* §462 Intake: the photo zone, the step heads, the parts a lookup filled */
.photo-zone { border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px; min-height: 64px; background: var(--panel2); transition: border-color .15s, background .15s; }
.photo-zone.dropping { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--panel2)); }
.photo-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-height: 44px; }
.photo-thumb { position: relative; display: inline-block; width: 96px; height: 96px; cursor: grab; }
.photo-thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; cursor: pointer; }
.photo-thumb.cover img { border: 2px solid var(--gold); }
.photo-thumb .x { position: absolute; top: -6px; right: -6px; padding: 0 6px; min-height: 0; height: 20px; line-height: 18px; font-size: 12px; background: var(--panel); }
.photo-thumb .cover-tag { position: absolute; left: 6px; bottom: 6px; font-size: 10px; background: var(--gold); color: var(--gold-ink); border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.step .stepno { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: 13px; align-items: center; justify-content: center; }
.field.filled .lbl::after { content: ' •'; color: var(--gold); }
details.more > summary { cursor: pointer; list-style: none; } details.more > summary::before { content: '▸ '; } details.more[open] > summary::before { content: '▾ '; }

/* §467c the platform pages */
.doc h1 { font-size: 22px; margin: 0 0 8px; } .doc h2 { font-size: 17px; margin: 16px 0 6px; } .doc p, .doc li { line-height: 1.5; } .doc ul, .doc ol { padding-left: 22px; } .doc em { color: var(--mute); }

/* §405 helper mode: a stranger's hands on the live screen — scan, the block, the four outcomes; nothing else, no numbers */
.helperbar { display: none; }
body.helper .helperbar { display: block; background: var(--gold); color: var(--gold-ink); border-radius: var(--r); padding: 10px 14px; font-size: 15px; user-select: none; -webkit-user-select: none; touch-action: none; }
body.helper .helperbar .mute { color: var(--gold-ink); opacity: .75; }
body.helper .helperbar.holding { outline: 3px solid var(--text); }
body.helper .nav, body.helper .spotbar, body.helper .bell, body.helper .gsearch, body.helper .topbar .btn, body.helper .who { display: none !important; }
body.helper .head > :not(h1) { display: none; }
body.helper .showgrid { grid-template-columns: 1fr; }
body.helper .showgrid > .stack:first-child > :not(.helperbar):not(.scanrow):not(.scanbox):not(.blockbox):not(.queuedbox) { display: none; }
body.helper .showgrid > .stack:last-child { display: none; }
body.helper .block .nums, body.helper .block .meta, body.helper .block .pitch, body.helper .block .under { display: none !important; }
body.helper .block .title { font-size: 22px; }
body.helper .scanbox { font-size: 24px; min-height: 64px; }
body.helper .outcomes { grid-template-columns: 1fr 1fr; gap: 14px; }
body.helper .outcomes .btn { min-height: 84px; font-size: 22px; }
