/* ==========================================================================================================
   Stock moves: the visual system (D-052, docs/35 section 0). Light only. No outside file.
   Screen builders use ONLY these classes plus their own small stylesheet (css/today.css, box.css, lists.css, owner.css).

   PRINCIPLES
     Calm, dense, typographic. Hierarchy by size and weight, never by boxes: hairline rules between rows, aligned columns, whitespace.
     A card (.card) only for one thing you act on (the job of a box, a sheet). Never a box in a box.
     Neutral greys and ONE accent (blue: the main button, links, focus, "you can act"). Three state colours, used only for state, always
     with words: ok (green), needs a look (amber), blocked (red). No coloured bars, no filled banners, no shadows except the menu and sheets.

   TOKENS (custom properties on :root)
     colours   --bg --bg-2 --ink --text --muted --line --line-strong --accent --accent-ink --accent-tint
               --ok --ok-tint --look --look-tint --blocked --blocked-tint (older names kept as aliases: --surface --surface-2 --good
               --good-tint --warn --warn-tint --warn-edge --bad --bad-tint --bad-edge)
     type      one scale: --fs-label 13 · --fs-small 14 · --fs-body 16 · --fs-section 20 · --fs-title 24 (--fs-card 16, --fs-big 20)
               weights 400 and 500 only (600 for the page title). Sentence case everywhere; never tracked capitals.
     space     4 px grid: --s1 4 · --s2 8 · --s3 12 · --s4 16 · --s5 24 · --s6 32 · --s7 48
     shape     --r-ctl 6px (controls) · --r-card 8px (cards, sheets) · --r-pill 999px · --gutter · --bar-h 56px · --page-w 1280px
     control   --ctl-h 36px on a laptop, 44px on a phone (touch)

   PAGE AND TEXT
     .page .measure .page-head .page-title .page-sub .page-actions .section .section-title .section-head .card-title
     .small .muted .label (13 px, 500, sentence case) .num .bold .code .text-good .text-warn .text-bad .overflow-wrap .sr-only
     .only-wide (over 720 px) .only-narrow .stack .stack-s .stack-l .row .row-between .row-end .grow .divider .hide-empty .grid-auto .grid-3

   STATE
     .dot (8 px) + .dot-ok .dot-look .dot-blocked .dot-idle .dot-accent     never colour alone: a dot sits beside words
     .tag (13 px text with a dot) + .tag-ok .tag-look .tag-blocked .tag-idle .tag-accent
     .who  the actor of a job ("India team"), 13 px, 500, quiet

   COMPONENTS (ui.js makes them)
     .btn .btn-primary (the ONE filled button of a view) .btn-secondary .btn-quiet .btn-danger .btn-wide .btn-icon
     .pill (the step of a box) .chip (+ -todo -look -act -done -muted: text with a dot, no fill) .filter-chip .filter-row
     .tracker (.tracker-full, .tracker-phone, .track-done/-now/-todo/-stop) .track-mini
     .card .card-pad .card-link .card-head .card-foot
     .list .list-row .list-row-main .list-row-title .list-row-meta .list-row-end     rows with hairlines, no outer box
     .box-row (.box-row-title .box-row-status .box-row-next .box-row-end .box-row-meta)
     .list-table .list-table-wrap     a real table, hairline rows, 13 px heads
     .field .field-label .field-hint .field-error .input .select .textarea .input-count .check .seg .date-trio
     .action-bar .action-bar-inner .action-bar-info .action-bar-main
     .dlg (sheet) .skeleton .state .notice .banner .toast .details .menu
   ========================================================================================================== */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #FFFFFF;
  --bg-2: #F6F6F4;
  --ink: #1D1C1A;
  --text: #1D1C1A;
  --muted: #67645F;
  --line: #E6E5E2;
  --line-strong: #CFCDC8;
  --accent: #2557C7;
  --accent-ink: #FFFFFF;
  --accent-tint: #EDF2FC;
  --ok: #1D7A4B;
  --ok-tint: #E9F5EE;
  --look: #9A5B00;
  --look-tint: #FBF2E2;
  --blocked: #C0331F;
  --blocked-tint: #FCEDEA;
  --idle: #A3A09A;

  /* the older names, kept so every screen file reads the same tokens */
  --surface: var(--bg); --surface-2: var(--bg-2);
  --good: var(--ok); --good-tint: var(--ok-tint);
  --warn: var(--look); --warn-tint: var(--look-tint); --warn-edge: #D99A2B;
  --bad: var(--blocked); --bad-tint: var(--blocked-tint); --bad-edge: var(--blocked);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-card: 8px; --r-ctl: 6px; --r-pill: 999px;
  --gutter: 32px;
  --page-w: 1280px;
  --card-pad: 20px;
  --bar-h: 56px;
  --ctl-h: 36px;

  --fs-big: 20px; --fs-title: 24px; --fs-section: 20px; --fs-card: 16px; --fs-body: 16px; --fs-small: 14px; --fs-label: 13px;
  --shadow-sheet: 0 12px 40px rgba(29, 28, 26, .16), 0 0 0 1px rgba(29, 28, 26, .06);
}
@media (max-width: 720px) {
  :root { --fs-title: 20px; --fs-section: 16px; --gutter: 16px; --card-pad: 16px; --ctl-h: 44px; }
}
@media (pointer: coarse) { :root { --ctl-h: 44px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-small)/1.5 var(--font); font-variant-numeric: tabular-nums;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--bg); padding: var(--s3) var(--s4); z-index: 100; }
.skip:focus { left: var(--s2); top: var(--s2); }

/* ---------------------------------------------------------------------------------------------- text */
.page-title { font: 600 var(--fs-title)/1.25 var(--font); letter-spacing: -0.01em; }
.page-title:focus { outline: none; }
.page-sub { color: var(--muted); font-size: var(--fs-small); line-height: 1.5; margin-top: var(--s1); }
.section-title { font: 500 var(--fs-card)/1.4 var(--font); }
.card-title { font: 500 var(--fs-card)/1.4 var(--font); }
.small { font-size: var(--fs-small); line-height: 1.5; }
.muted { color: var(--muted); }
.label { font: 500 var(--fs-label)/1.4 var(--font); color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.bold { font-weight: 500; }
.code { font-size: var(--fs-label); color: var(--muted); line-height: 1.4; font-variant-numeric: tabular-nums; }
.text-good { color: var(--ok); } .text-warn { color: var(--look); } .text-bad { color: var(--blocked); }
.overflow-wrap { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.link { color: var(--accent); }

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-s { display: flex; flex-direction: column; gap: var(--s2); }
.stack-l { display: flex; flex-direction: column; gap: var(--s6); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row-end { margin-left: auto; }
.grow { flex: 1 1 auto; min-width: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.hide-empty:empty { display: none; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr; } .only-wide { display: none !important; } }
@media (min-width: 721px) { .only-narrow { display: none !important; } }

/* ---------------------------------------------------------------------------------------------- state: dot, tag, who */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--idle); vertical-align: middle; }
.dot-ok { background: var(--ok); } .dot-look { background: #D99A2B; } .dot-blocked { background: var(--blocked); }
.dot-idle { background: transparent; box-shadow: inset 0 0 0 1.5px var(--idle); } .dot-accent { background: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-label)/1.4 var(--font); color: var(--muted); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--idle); flex: none; }
.tag-ok { color: var(--ok); } .tag-ok::before { background: var(--ok); }
.tag-look { color: var(--look); } .tag-look::before { background: #D99A2B; }
.tag-blocked { color: var(--blocked); } .tag-blocked::before { background: var(--blocked); }
.tag-accent { color: var(--accent); } .tag-accent::before { background: var(--accent); }
.tag-idle::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--idle); }
.who { display: inline-block; font: 500 var(--fs-label)/1.4 var(--font); color: var(--muted); white-space: nowrap; }

/* ---------------------------------------------------------------------------------------------- page frame */
main { display: block; padding: var(--s6) var(--gutter) var(--s7); }
main:has(.action-bar) { padding-bottom: 150px; }
main:focus { outline: none; }
.page { margin: 0 auto; width: 100%; max-width: var(--page-w); }
.page-sub, .state-hint, .measure { max-width: 68ch; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.section { margin-top: var(--s7); }
.section:first-child { margin-top: 0; }
.section > .section-title, .section-head { margin-bottom: var(--s3); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.section-head .section-title { margin-bottom: 0; }

/* ---------------------------------------------------------------------------------------------- app bar, sub nav, tab bar */
.app-bar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.app-bar-inner { max-width: calc(var(--page-w) + 2 * var(--gutter)); margin: 0 auto; height: var(--bar-h); padding: 0 var(--gutter); display: flex; align-items: center; gap: var(--s5); }
.brand { font: 500 var(--fs-small)/1 var(--font); color: var(--ink); text-decoration: none; white-space: nowrap; padding: var(--s3) 0; }
.nav { display: flex; align-items: stretch; gap: var(--s1); height: 100%; }
.nav a { display: flex; align-items: center; padding: 0 var(--s3); font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.app-search { display: flex; align-items: center; margin-left: auto; flex: 0 1 260px; min-width: 0; }
.app-bar-inner > * { flex-shrink: 0; }
.app-bar-inner > .app-search { flex-shrink: 1; }
.app-bar-inner > .app-bar-end { flex-shrink: 1; min-width: 0; }
.app-search .input { width: 100%; min-height: 32px; height: 32px; font-size: var(--fs-small); background: var(--bg-2); border-color: transparent; }
.app-search .input:focus { background: var(--bg); border-color: var(--line-strong); }
.app-bar-end { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.menu-wrap { min-width: 0; position: relative; }
.sample-chip { white-space: nowrap; font: 500 var(--fs-label)/1 var(--font); color: var(--muted); }
.alarm-link { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-label)/1 var(--font); color: var(--blocked); text-decoration: none; white-space: nowrap; }
.alarm-link::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blocked); }
.alarm-link:hover { text-decoration: underline; }
.menu-btn { display: inline-flex; align-items: center; gap: var(--s1); min-height: 32px; padding: 0 var(--s2); background: transparent; border: 0; border-radius: var(--r-ctl); font-weight: 500; cursor: pointer; max-width: 180px; color: var(--ink); }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { background: var(--bg-2); }
.menu-btn .icon { transform: rotate(90deg); width: 14px; height: 14px; color: var(--muted); }
.menu-btn .menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; max-width: calc(100vw - 16px); top: calc(100% + var(--s1)); z-index: 30; width: 240px; background: var(--bg); border-radius: var(--r-card); box-shadow: var(--shadow-sheet); padding: var(--s1); }
.menu-title { font: 500 var(--fs-label)/1.4 var(--font); color: var(--muted); padding: var(--s2) var(--s3) var(--s1); }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); width: 100%; min-height: 36px; padding: 0 var(--s3); background: transparent; border: 0; border-radius: var(--r-ctl); text-align: left; cursor: pointer; font-weight: 400; }
.menu-item:hover { background: var(--bg-2); }
.menu-item[aria-checked="true"] { font-weight: 500; }
.menu-item .icon { width: 16px; height: 16px; color: var(--accent); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: var(--s1) 0; }

.sub-nav { background: var(--bg); border-bottom: 1px solid var(--line); }
.sub-nav-inner { max-width: calc(var(--page-w) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); display: flex; gap: var(--s1); overflow-x: auto; }
.sub-nav a { display: flex; align-items: center; min-height: 40px; padding: 0 var(--s3); font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.sub-nav a:first-child { padding-left: 0; }
.sub-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.tab-bar { display: none; }
@media (max-width: 720px) {
  .nav, .app-search { display: none; }
  .app-bar-end { margin-left: auto; }
  .app-bar-inner { gap: var(--s2); }
  .menu-btn { max-width: 100%; min-height: 44px; }
  .app-bar-end { flex: 0 1 auto; }
  main { padding-top: var(--s5); padding-bottom: calc(var(--bar-h) + var(--s6) + env(safe-area-inset-bottom)); }
  main:has(.action-bar) { padding-bottom: calc(var(--bar-h) + 150px + env(safe-area-inset-bottom)); }
  .tab-bar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--line);
  }
  .tab-bar.tabs-5 { grid-template-columns: repeat(5, 1fr); }
  /* D-054: the owner has six tabs once "Out of stock" is there. Six still fit at 390px because the tab bar uses the short label. */
  .tab-bar.tabs-6 { grid-template-columns: repeat(6, 1fr); }
  .tab-bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 500 var(--fs-label)/1 var(--font); color: var(--muted); text-decoration: none; min-height: 44px; }
  .tab-bar a[aria-current="page"] { color: var(--ink); }
  .tab-bar .icon { width: 20px; height: 20px; }
  .sub-nav a { min-height: 44px; }
}
@media (min-width: 721px) and (max-width: 1000px) {
  .app-bar-inner { gap: var(--s3); }
  .nav a { padding: 0 var(--s2); }
  .menu-btn { max-width: 110px; }
  .sample-chip { display: none; }
}

/* ---------------------------------------------------------------------------------------------- icons */
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 24px; height: 24px; }

/* ---------------------------------------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--ctl-h); padding: 0 var(--s4); border-radius: var(--r-ctl); border: 1px solid transparent;
  font: 500 var(--fs-small)/1.2 var(--font); text-decoration: none; cursor: pointer; background: transparent; color: var(--ink); white-space: nowrap; text-align: center;
}
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not([disabled]) { background: #1D4AAF; }
.btn-secondary { background: var(--bg); border-color: var(--line-strong); }
.btn-secondary:hover:not([disabled]) { background: var(--bg-2); }
.btn-quiet { color: var(--accent); padding: 0 var(--s2); }
.btn-quiet:hover:not([disabled]) { background: var(--accent-tint); }
.btn-danger { background: var(--bg); color: var(--blocked); border-color: var(--line-strong); }
.btn-danger:hover:not([disabled]) { background: var(--blocked-tint); border-color: var(--blocked); }
.btn-wide { width: 100%; }
.btn-icon .icon { width: 16px; height: 16px; }
@media (max-width: 720px) { .btn { white-space: normal; } }

/* ---------------------------------------------------------------------------------------------- form controls */
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field-label { font: 500 var(--fs-small)/1.4 var(--font); }
.field-hint { font-size: var(--fs-label); color: var(--muted); line-height: 1.4; }
.field-error { font-size: var(--fs-label); color: var(--blocked); line-height: 1.4; }
.input, .select, .textarea {
  width: 100%; min-height: var(--ctl-h); padding: 0 var(--s3); font-size: var(--fs-small); line-height: 1.3;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
}
@media (max-width: 720px) { .input, .select, .textarea { font-size: 16px; } }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
.textarea { padding: var(--s2) var(--s3); min-height: 88px; resize: vertical; }
.input::placeholder { color: var(--muted); opacity: .75; }
.input[aria-invalid="true"] { border-color: var(--blocked); }
.input-count {
  width: 64px; min-height: var(--ctl-h); padding: 0; font: 500 var(--fs-body)/1 var(--font); font-variant-numeric: tabular-nums; text-align: center;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
}
.input-count:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
@media (max-width: 600px) { .input-count { width: 56px; min-height: 44px; } }
.input-count.is-short { border-color: #D99A2B; background: var(--look-tint); }
.input-count.is-more { border-color: var(--accent); background: var(--accent-tint); }
.input-count.is-none, .input-count.is-bad { border-color: var(--blocked); background: var(--blocked-tint); }
.date-trio { display: grid; grid-template-columns: 64px 1fr 88px; gap: var(--s2); max-width: 320px; }
.check { display: flex; align-items: center; gap: var(--s3); min-height: 40px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); margin: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); border: 0; padding: 0; margin: 0; min-width: 0; }
.seg legend { padding: 0; margin-bottom: var(--s2); font: 500 var(--fs-small)/1.4 var(--font); }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 var(--s2); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--bg); font-weight: 500; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------------------------------------- number, pill, chip, filter chip */
.big-number { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.big-number-num { font: 500 var(--fs-big)/1.2 var(--font); font-variant-numeric: tabular-nums; }
.big-number-cap { font-size: var(--fs-label); line-height: 1.4; color: var(--muted); }
.big-number.is-warn .big-number-num { color: var(--look); }
.big-number.is-bad .big-number-num { color: var(--blocked); }
.big-number.is-good .big-number-num { color: var(--ok); }
.stat-row { display: flex; align-items: flex-end; gap: var(--s6); flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--s2); border-radius: var(--r-pill); border: 1px solid var(--line); font: 500 var(--fs-label)/1 var(--font); white-space: nowrap; color: var(--muted); background: transparent; }
.pill-arrived, .pill-cancelled { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-label)/1.4 var(--font); white-space: nowrap; color: var(--muted); }
.chip .icon { display: none; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--idle); flex: none; }
.chip-todo { color: var(--accent); } .chip-todo::before { background: var(--accent); }
.chip-look { color: var(--look); } .chip-look::before { background: #D99A2B; }
.chip-act { color: var(--blocked); } .chip-act::before { background: var(--blocked); }
.chip-done { color: var(--ok); } .chip-done::before { background: var(--ok); }
.chip-muted::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--idle); }
.filter-row { display: flex; gap: var(--s1); flex-wrap: wrap; }
.filter-chip { position: relative; display: inline-flex; align-items: center; height: 30px; padding: 0 var(--s3); border-radius: var(--r-ctl); border: 1px solid transparent; background: transparent; color: var(--muted); font: 500 var(--fs-small)/1 var(--font); cursor: pointer; white-space: nowrap; }
.filter-chip:hover { color: var(--ink); background: var(--bg-2); }
.filter-chip::after { content: ""; position: absolute; inset: -7px 0; }
.filter-chip[aria-pressed="true"] { background: var(--bg-2); border-color: var(--line); color: var(--ink); }
@media (max-width: 720px) { .filter-chip { height: 36px; } }
@media (max-width: 600px) { .filter-row.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); } }

/* ---------------------------------------------------------------------------------------------- step tracker: a thin line of steps */
.tracker { display: block; }
.tracker-full { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 0; list-style: none; margin: 0; padding: 0; }
.tracker-phone { display: none; }
.tracker.track-n-2 { --n: 2; } .tracker.track-n-3 { --n: 3; } .tracker.track-n-4 { --n: 4; } .tracker.track-n-5 { --n: 5; }
.tracker-step { position: relative; padding-top: var(--s3); display: flex; flex-direction: column; gap: 0; min-width: 0; }
.tracker-step::before { content: ""; position: absolute; top: 0; left: 0; right: 4px; height: 2px; border-radius: 1px; background: var(--line); }
.tracker-name { font: 500 var(--fs-label)/1.4 var(--font); color: var(--muted); }
.tracker-date { font-size: var(--fs-label); line-height: 1.4; color: var(--muted); }
.tracker-step.track-done::before { background: var(--ink); }
.tracker-step.track-done .tracker-name { color: var(--ink); }
.tracker-step.track-now::before { background: var(--accent); }
.tracker-step.track-now .tracker-name { color: var(--accent); }
.tracker-step.track-stop::before { background: var(--idle); }
.tracker-phone-bar { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 3px; }
.track-seg { height: 2px; border-radius: 1px; background: var(--line); }
.track-seg.track-done { background: var(--ink); }
.track-seg.track-now { background: var(--accent); }
.track-seg.track-stop { background: var(--idle); }
.tracker-phone-text { margin-top: var(--s2); font: 500 var(--fs-label)/1.4 var(--font); }
.tracker-phone-text span { color: var(--muted); font-weight: 400; }
@media (max-width: 600px) { .tracker-full { display: none; } .tracker-phone { display: block; } }
.track-mini { display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 2px; width: 48px; }
.track-mini.track-n-2 { --n: 2; } .track-mini.track-n-3 { --n: 3; } .track-mini.track-n-4 { --n: 4; } .track-mini.track-n-5 { --n: 5; }
.track-mini i { display: block; height: 2px; border-radius: 1px; background: var(--line-strong); }
.track-mini i.track-done { background: var(--ink); }
.track-mini i.track-now { background: var(--accent); }
.track-mini i.track-stop { background: var(--idle); }

/* ---------------------------------------------------------------------------------------------- card: one object you act on */
.card { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card-pad { padding: var(--card-pad); }
.card.is-muted { background: var(--bg); }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--line-strong); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.card-foot { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); font-size: var(--fs-small); color: var(--muted); }

/* ---------------------------------------------------------------------------------------------- list: rows with hairlines, no box */
.list { border-top: 1px solid var(--line); }
.list > * { border-bottom: 1px solid var(--line); }
.list-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px var(--s4); padding: var(--s3) 0; min-height: 52px; color: inherit; text-decoration: none; }
a.list-row:hover { background: var(--bg-2); box-shadow: -8px 0 0 var(--bg-2), 8px 0 0 var(--bg-2); }
.list-row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row-title { font: 500 var(--fs-small)/1.45 var(--font); }
.list-row-meta { font-size: var(--fs-small); line-height: 1.45; color: var(--muted); }
.list-row-end { display: flex; align-items: center; gap: var(--s3); justify-content: flex-end; white-space: nowrap; }

/* one box in a list: dot, name, status line, next line; pieces and step on the right */
.box-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto 14px; grid-template-areas: "dot title end go" ". status end go" ". next end go"; align-items: center; column-gap: var(--s3); row-gap: 2px; padding: var(--s3) 0; color: inherit; text-decoration: none; }
a.box-row:hover { background: var(--bg-2); box-shadow: -8px 0 0 var(--bg-2), 8px 0 0 var(--bg-2); }
.box-row > .dot { grid-area: dot; align-self: center; }
.box-row-title { grid-area: title; font: 500 var(--fs-small)/1.45 var(--font); min-width: 0; }
.box-row-status { grid-area: status; font-size: var(--fs-small); line-height: 1.45; color: var(--ink); min-width: 0; }
.box-row-next { grid-area: next; font-size: var(--fs-small); line-height: 1.45; color: var(--muted); min-width: 0; }
.box-row-next .who { margin-right: var(--s2); color: var(--ink); }
.box-row-end { grid-area: end; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; font-size: var(--fs-small); }
.box-row-end .code { text-align: right; }
.box-row > .icon-go { grid-area: go; width: 14px; height: 14px; color: var(--idle); }
@media (max-width: 600px) {
  .box-row { grid-template-columns: 8px minmax(0, 1fr) 14px; grid-template-areas: "dot title go" ". status go" ". next go" ". end go"; }
  .box-row-end { flex-direction: row; align-items: center; gap: var(--s3); }
}

.list-table { width: 100%; border-collapse: collapse; }
.list-table th { font: 500 var(--fs-label)/1.4 var(--font); color: var(--muted); padding: var(--s2) var(--s3); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list-table td { padding: var(--s3); font-size: var(--fs-small); border-bottom: 1px solid var(--line); vertical-align: top; }
.list-table th:first-child, .list-table td:first-child { padding-left: 0; }
.list-table th:last-child, .list-table td:last-child { padding-right: 0; }
.list-table th.num, .list-table td.num { text-align: right; }
.list-table a { color: inherit; text-decoration: none; font-weight: 500; }
.list-table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------------------------------------- count rows (the Box screen) */
.count-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name input" "status status"; align-items: center; gap: var(--s1) var(--s3); padding: var(--s2) var(--s4); background: var(--bg); }
.count-row.is-short { background: var(--look-tint); }
.count-row.is-more { background: var(--accent-tint); }
.count-row.is-none { background: var(--blocked-tint); }
.count-name { grid-area: name; min-width: 0; font-weight: 500; }
.count-code { display: block; font: 400 var(--fs-label)/1.4 var(--font); color: var(--muted); }
.count-planned { font-size: var(--fs-small); color: var(--muted); }
.count-status { grid-area: status; font-size: var(--fs-label); color: var(--muted); display: flex; gap: var(--s2); align-items: center; }
.count-row .input-count { grid-area: input; }
.count-row.is-short .count-status { color: var(--look); font-weight: 500; }
.count-row.is-more .count-status { color: var(--accent); font-weight: 500; }
.count-row.is-none .count-status { color: var(--blocked); font-weight: 500; }

/* ---------------------------------------------------------------------------------------------- the bar fixed to the bottom */
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--bg); border-top: 1px solid var(--line); padding: var(--s3) var(--gutter) calc(var(--s3) + env(safe-area-inset-bottom)); }
.action-bar-inner { max-width: var(--page-w); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4); flex-wrap: wrap; }
.action-bar-info { flex: 1 1 260px; min-width: 0; font-size: var(--fs-small); line-height: 1.45; }
.action-bar-info strong { font-weight: 500; font-size: var(--fs-small); }
.action-bar-main { flex: 0 0 auto; display: flex; gap: var(--s2); }
@media (max-width: 720px) {
  .action-bar { bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding-bottom: var(--s3); }
  .action-bar-inner { flex-direction: column; align-items: stretch; gap: var(--s2); }
  .action-bar-info { flex: 0 0 auto; }
  .action-bar-main { width: 100%; }
  .action-bar-main .btn { flex: 1; }
}

/* ---------------------------------------------------------------------------------------------- sheet (confirm dialog) */
.dlg { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: var(--s5); border: 0; border-radius: 12px; background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sheet); }
.dlg-wide { width: min(600px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(29, 28, 26, .32); }
.dlg-title { font: 500 var(--fs-card)/1.4 var(--font); margin-bottom: var(--s3); }
.dlg-title:focus { outline: none; }
.dlg-body { display: flex; flex-direction: column; gap: var(--s3); font-size: var(--fs-small); }
.dlg-body p { line-height: 1.5; }
.dlg-list { margin: 0; padding: var(--s2) 0 var(--s2) var(--s5); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); max-height: 40vh; overflow: auto; }
.dlg-list li + li { margin-top: var(--s1); }
.dlg-list-title { font-weight: 500; }
.dlg-item { display: flex; justify-content: space-between; gap: var(--s3); }
.dlg-warning { display: flex; gap: var(--s2); align-items: flex-start; color: var(--look); font-weight: 500; }
.dlg-warning .icon { margin-top: 2px; }
.dlg-result { display: flex; gap: var(--s3); align-items: flex-start; }
.dlg-result .icon { width: 20px; height: 20px; margin-top: 1px; }
.dlg-result strong { display: block; font-weight: 500; }
.dlg-result p { overflow-wrap: anywhere; white-space: pre-line; color: var(--ink); }
.dlg-result.is-good { color: var(--ok); }
.dlg-result.is-warn { color: var(--look); }
.dlg-result.is-bad { color: var(--blocked); }
.dlg-result.is-info { color: var(--ink); }
.dlg-foot { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); flex-wrap: wrap; }
.dlg-working { display: flex; align-items: center; gap: var(--s3); color: var(--muted); }
@media (max-width: 600px) {
  .dlg { margin: auto 0 0; width: 100vw; max-width: none; border-radius: 12px 12px 0 0; padding: var(--s5) var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom)); }
  .dlg-foot { flex-direction: column-reverse; }
  .dlg-foot .btn { width: 100%; }
}

/* ---------------------------------------------------------------------------------------------- loading, empty, notices, toast, details */
@keyframes cr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.skeleton { display: flex; flex-direction: column; gap: var(--s4); }
.skel-line { height: 12px; border-radius: 4px; background: var(--bg-2); animation: cr-pulse 1.4s ease-in-out infinite; }
.skel-line.short { width: 40%; } .skel-line.mid { width: 65%; }
.skel-line.title { height: 16px; width: 40%; }
.skel-card, .skel-row { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .skel-line { animation: none; } }

.state { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); padding: var(--s5) 0; }
.state .icon-lg { display: none; }
.state-title { font: 500 var(--fs-small)/1.5 var(--font); display: flex; align-items: center; gap: var(--s2); }
.state-good .state-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.state-hint { font-size: var(--fs-small); color: var(--muted); line-height: 1.5; }
.state-error .state-title { color: var(--blocked); }
.state .btn { margin-top: var(--s2); }

.banner, .notice { display: flex; align-items: flex-start; gap: var(--s2); padding: var(--s2) 0; font-weight: 400; line-height: 1.5; font-size: var(--fs-small); color: var(--ink); }
.banner .icon, .notice .icon { margin-top: 2px; color: var(--muted); }
.banner .grow, .notice .grow { min-width: 0; }
.banner a { white-space: nowrap; }
.banner-bad .icon, .notice-bad .icon { color: var(--blocked); }
.banner-bad, .notice-bad { color: var(--blocked); }
.banner .icon, .notice-warn .icon { color: var(--look); }
.notice-warn > .grow { color: var(--ink); }
.notice-good .icon, .banner-good .icon { color: var(--ok); }
.notice-info .icon, .banner-info .icon { color: var(--accent); }
.notice .btn { margin-left: auto; margin-top: -6px; margin-bottom: -6px; }

.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--bar-h) + var(--s4) + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; padding: 0 var(--gutter); }
@media (min-width: 721px) { .toast-host { bottom: var(--s5); } }
.toast { pointer-events: auto; max-width: 480px; padding: var(--s2) var(--s4); border-radius: var(--r-ctl); background: var(--ink); color: #fff; font-weight: 500; box-shadow: var(--shadow-sheet); }
.toast.is-bad { background: var(--blocked); }

.details { border-top: 1px solid var(--line); }
.details:last-child { border-bottom: 1px solid var(--line); }
.details-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 48px; padding: var(--s2) 0; font: 500 var(--fs-small)/1.4 var(--font); cursor: pointer; list-style: none; }
.details-summary::-webkit-details-marker { display: none; }
.details-summary .icon { transition: transform .15s; color: var(--muted); }
.details[open] > .details-summary .icon { transform: rotate(90deg); }
.details-body { padding: 0 0 var(--s5); }

/* ---------------------------------------------------------------------------------------------- sign-in */
.signin { max-width: 400px; margin: var(--s7) auto 0; display: flex; flex-direction: column; gap: var(--s5); }
.signin .card-pad { display: flex; flex-direction: column; gap: var(--s4); }

@media print { .app-bar, .tab-bar, .action-bar, .sub-nav { display: none; } }

@media (max-width: 480px) { .sample-chip { display: none; } }

/* a row that needs a look (or is blocked, or is yours to do) carries a dot before its title: never a coloured bar */
.list-row:is(.is-warn, .is-bad, .is-todo) .list-row-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: var(--s2); vertical-align: 1px; }
.list-row.is-warn .list-row-title::before { background: #D99A2B; }
.list-row.is-bad .list-row-title::before { background: var(--blocked); }
.list-row.is-todo .list-row-title::before { background: var(--accent); }
