/* ==========================================================================
   ELITE GROUP · Purchase & Inventory · design system (app.css)
   Every colour comes from a CSS variable, so the dark theme works everywhere.
   Screen agents: REUSE these classes instead of inventing new ones.

   REUSABLE CLASSES
   ----------------
   Layout ........ .stack (vertical gap) .stack-sm .stack-lg | .row (horizontal, wraps) .row-tight
                   .row-nowrap | .spacer (pushes the rest to the right) | .grid2 .grid3 .grid4
                   (responsive columns) | .grid-auto (auto-fit cards) | .split (2/3 + 1/3)
                   .hide-phone .only-phone .hide-print | .center .right .nowrap .wrap .grow
                   .mt0 .mt1 .mt2 .mt3 .mb0 .mb1 .mb2 .mb3
   Text .......... .h1 .h2 .h3 .eyebrow (small caps label) .muted .small .tiny .strong .num
                   (tabular right-aligned numbers) .big-num .mono .link .text-green .text-amber
                   .text-red .text-blue .truncate .strike (cancelled / voided text)
   Cards ......... .card (+ .card-pad-0, .card-flat, .card-click) .card-head (title row)
                   .card-title .card-sub .card-foot | .section-title
                   .stat (stat card: .stat-icon .stat-label .stat-value .stat-sub; tones
                   .tone-green .tone-amber .tone-red .tone-blue .tone-violet .tone-teal
                   .tone-indigo .tone-gray) | .list (rows inside a card) .list-item
                   (.list-main .list-title .list-sub .list-side)
   Buttons ....... .btn (default = soft) .btn.primary .btn.accent .btn.ghost .btn.danger
                   .btn.success .btn.sm .btn.lg .btn.block .btn.icon (square icon button)
                   .btn.is-loading (spinner) | .btn-group | .linkbtn (text-only button)
   Badges ........ .badge + .green .amber .red .blue .violet .teal .indigo .gray | .badge.dot
                   .count-badge (small round counter) | .chip (timeline chip) + .tl-immediate
                   .tl-overdue .tl-due_soon .tl-on_track .tl-done_on_time .tl-done_late
                   .tl-closed .tl-risk | .tag (quiet label)
   Forms ......... .form (vertical form) .field .field-label .hint .req (red star)
                   .input (auto on input/select/textarea inside .field) .input-lg
                   .input-group (input + unit/addon: .addon) | .check (checkbox/radio row)
                   .choices (grid of big choice buttons) .choice .choice-body .choice-title
                   .choice-sub | .quick-picks (row of small pick buttons) .pick (.active)
                   .form-error | .line-rows .line-row (repeating request/quotation lines)
                   .draft-bar (restore-draft notice)
   Filter bar .... .filterbar .search .filters .filter .daterange .result-count
                   (all produced by App.table)
   Tables ........ .table-wrap .table (th.num td.num, tr.clickable, tr.row-muted, tr.row-warn,
                   tr.row-danger, td.actions) -> becomes cards on phones through data-label
                   .table.compact | .table.sheet (Excel-like grid for the quotation sheet)
                   .show-more
   Detail page ... .page-head (.page-head-main .page-head-title .page-head-meta
                   .page-head-actions) .back-link | .actionbar (sticky primary action;
                   sits above the phone tab bar) | .info-list (.info-row .info-label
                   .info-value) | .tabs .tab (.active) .tab-panel
   Feedback ...... .banner + .info .warning .danger .success (.banner-title .banner-text
                   .banner-action) | .empty (.empty-art .empty-title .empty-text)
                   .skeleton .sk-line .sk-card .sk-row .sk-stat | .toast-host .toast
                   .progress (+ .green .amber .red .blue) | .spinner | .pulse-dot
   Flow .......... .stepper .step (.done .current) .step-dot .step-label .stepper-note
                   .timeline .tl-item (.tl-dot .tl-body .tl-title .tl-text .tl-meta)
                   .changes .change (.change-field .change-old .change-new)
   Charts ........ .bars .bar-row (.bar-label .bar-track .bar-fill .bar-value)
                   .cols .col (.col-bar .col-fill .col-value .col-label) | .legend
   Photos ........ .thumbs .thumb (.thumb.add .thumb.file .thumb.is-loading .thumb.is-failed
                   .thumb.is-hidden) .lightbox
   Overlays ...... .modal-host .modal (.modal.wide) .modal-head .modal-body .modal-foot
                   .panel (notification panel) .menu .menu-item
   Shell ......... .shell .sidebar .nav-item .topbar .tabbar .tabbar-item .demo-ribbon
                   .notice-host .notice | .auth (login / setup / storage screens) .skyline
   Print ......... .print-doc .print-head .print-title .print-meta .print-table .print-sign
                   .print-foot (used by App.printHtml), .hide-print
   Motion ........ .stagger (children fade up one after another) .fade-in .pop-in .shake
                   data-w="0-100" (bar grows), data-h="0-100" (column grows),
                   data-count="123" [data-money="1"] (number counts up) - set by helpers
   ========================================================================== */

:root {
  --font: "Plus Jakarta Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-display: "Sora", "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --bg: #f5f2eb;
  --bg-2: #ede8dd;
  --surface: #fffdf9;
  --surface-2: #f7f3ea;
  --surface-3: #efe9dc;
  --text: #16223a;
  --ink: #0d1a30;
  --muted: #5b667e;
  --faint: #97a0b3;
  --line: #e3dccd;
  --line-strong: #cfc6b2;
  --brand: #10203c;
  --brand-2: #1a3158;
  --brand-3: #27467a;
  --on-brand: #f4efe2;
  --on-brand-muted: #9fb0cc;
  --accent: #e2a21d;
  --accent-2: #f3c659;
  --accent-ink: #4a3200;
  --accent-soft: #fbefcf;
  --green: #17895a;  --green-bg: #dff3e8;  --green-ink: #0e5a3b;
  --amber: #c97f00;  --amber-bg: #fdeecb;  --amber-ink: #7a4b00;
  --red: #d2402f;    --red-bg: #fbe1dc;    --red-ink: #8c2015;
  --blue: #2c6bd8;   --blue-bg: #dfeafc;   --blue-ink: #17418c;
  --violet: #7a4bd6; --violet-bg: #ebe2fb; --violet-ink: #4a2a92;
  --teal: #0e8f96;   --teal-bg: #d8f1f1;   --teal-ink: #095a5f;
  --indigo: #4a54d1; --indigo-bg: #e2e4fb; --indigo-ink: #2b3288;
  --gray: #6b7385;   --gray-bg: #e9e6df;   --gray-ink: #434a59;
  --shadow-sm: 0 1px 2px rgba(16, 32, 60, .06), 0 1px 1px rgba(16, 32, 60, .04);
  --shadow: 0 6px 20px -8px rgba(16, 32, 60, .18), 0 2px 6px rgba(16, 32, 60, .05);
  --shadow-lg: 0 24px 60px -20px rgba(8, 18, 38, .45), 0 8px 20px -10px rgba(8, 18, 38, .2);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --sidebar-w: 264px;
  --topbar-h: 62px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --focus: 0 0 0 3px rgba(226, 162, 29, .38);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a111e;
  --bg-2: #0d1626;
  --surface: #121c30;
  --surface-2: #17233b;
  --surface-3: #1e2c48;
  --text: #e7ecf5;
  --ink: #f4f6fb;
  --muted: #9ba8c0;
  --faint: #7d8aa3;
  --line: #24334f;
  --line-strong: #34466a;
  --brand: #0b1424;
  --brand-2: #142341;
  --brand-3: #223b68;
  --accent: #f0b440;
  --accent-2: #f7d27a;
  --accent-ink: #2b1d00;
  --accent-soft: #3a2e12;
  --green: #3fc48a;  --green-bg: #123526;  --green-ink: #8fe6bd;
  --amber: #f0b440;  --amber-bg: #3a2c0c;  --amber-ink: #f7d27a;
  --red: #f0705f;    --red-bg: #40191a;    --red-ink: #ffb1a6;
  --blue: #6aa2ff;   --blue-bg: #14294d;   --blue-ink: #b3d0ff;
  --violet: #a988f5; --violet-bg: #2a2050; --violet-ink: #d3c2ff;
  --teal: #3cc3c9;   --teal-bg: #0f3236;   --teal-ink: #9be5e8;
  --indigo: #8a92f7; --indigo-bg: #1e2352; --indigo-ink: #c5c9ff;
  --gray: #96a1b6;   --gray-bg: #222d43;   --gray-ink: #c3cbda;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .75);
  --focus: 0 0 0 3px rgba(240, 180, 64, .4);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, .h1, .h2, .h3 { font-family: var(--font-display); color: var(--ink); letter-spacing: -.015em; line-height: 1.25; }
.h1 { font-size: 26px; font-weight: 700; }
.h2 { font-size: 20px; font-weight: 700; }
.h3 { font-size: 16px; font-weight: 700; }
a { color: inherit; }
a.link, .link { color: var(--blue); text-decoration: none; font-weight: 600; cursor: pointer; }
a.link:hover, .link:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
svg.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
svg.icon.sm { width: 16px; height: 16px; vertical-align: -3px; }
svg.icon.lg { width: 28px; height: 28px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
::selection { background: var(--accent-2); color: #1a1200; }

.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; color: var(--ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.big-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.text-green { color: var(--green); } .text-amber { color: var(--amber); } .text-red { color: var(--red); } .text-blue { color: var(--blue); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.strike { text-decoration: line-through; color: var(--faint); }
.nowrap { white-space: nowrap; } .wrap { white-space: normal; overflow-wrap: anywhere; }
.center { text-align: center; } .right { text-align: right; } .grow { flex: 1 1 0; min-width: 0; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb1 { margin-bottom: 8px; } .mb2 { margin-bottom: 16px; } .mb3 { margin-bottom: 24px; }

/* ---------- layout utilities ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row-tight { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row-nowrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.spacer { flex: 1 1 auto; }
.grid2, .grid3, .grid4, .grid-auto, .split { display: grid; gap: 16px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.only-phone { display: none !important; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px; min-width: 0;
}
.card-pad-0 { padding: 0; overflow: hidden; }
.card-flat { box-shadow: none; background: var(--surface-2); }
.card-click { cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.card-click:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-click:active { transform: scale(.985); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-pad-0 > .card-head { padding: 16px 18px 0; }
.card-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); }
.card-sub { font-size: 13px; color: var(--muted); }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.section-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }

.stat {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit; min-width: 0;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--accent)); }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
a.stat:active { transform: scale(.985); }
.stat-icon { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tone-bg, var(--accent-soft)); color: var(--tone, var(--accent)); }
.stat-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-right: 46px; }
.stat-value { font-family: var(--font-display); font-size: 27px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.tone-green { --tone: var(--green); --tone-bg: var(--green-bg); --tone-ink: var(--green-ink); }
.tone-amber { --tone: var(--amber); --tone-bg: var(--amber-bg); --tone-ink: var(--amber-ink); }
.tone-red { --tone: var(--red); --tone-bg: var(--red-bg); --tone-ink: var(--red-ink); }
.tone-blue { --tone: var(--blue); --tone-bg: var(--blue-bg); --tone-ink: var(--blue-ink); }
.tone-violet { --tone: var(--violet); --tone-bg: var(--violet-bg); --tone-ink: var(--violet-ink); }
.tone-teal { --tone: var(--teal); --tone-bg: var(--teal-bg); --tone-ink: var(--teal-ink); }
.tone-indigo { --tone: var(--indigo); --tone-bg: var(--indigo-bg); --tone-ink: var(--indigo-ink); }
.tone-gray { --tone: var(--gray); --tone-bg: var(--gray-bg); --tone-ink: var(--gray-ink); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; min-height: 56px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; transition: background .15s; }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); }
.list-main { flex: 1 1 0; min-width: 0; }
.list-title { font-weight: 650; color: var(--ink); }
.list-sub { font-size: 13px; color: var(--muted); }
.list-side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 650; font-size: 14.5px; text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .15s var(--ease), background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
  position: relative;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; box-shadow: 0 6px 14px -8px rgba(16, 32, 60, .7); }
.btn.primary:hover { background: var(--brand-3); border-color: var(--brand-3); }
[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #2a1c00; box-shadow: 0 6px 14px -8px rgba(226, 162, 29, .9); }
.btn.accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger.ghost, .btn.ghost.danger { background: transparent; border-color: transparent; color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { min-height: 52px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
.btn.block { display: flex; width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.btn.icon.sm { width: 36px; }
.btn[disabled], .btn.is-loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn.is-loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.is-retry { background: var(--red); border-color: var(--red); color: #fff; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.linkbtn { background: none; border: 0; padding: 6px 2px; font: inherit; font-weight: 650; color: var(--blue); cursor: pointer; min-height: 36px; }
.linkbtn:hover { text-decoration: underline; }
.spinner { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }

/* ---------- badges, chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  line-height: 1.5; white-space: nowrap; background: var(--gray-bg); color: var(--gray-ink);
}
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.green { background: var(--green-bg); color: var(--green-ink); }
.badge.amber { background: var(--amber-bg); color: var(--amber-ink); }
.badge.red { background: var(--red-bg); color: var(--red-ink); }
.badge.blue { background: var(--blue-bg); color: var(--blue-ink); }
.badge.violet { background: var(--violet-bg); color: var(--violet-ink); }
.badge.teal { background: var(--teal-bg); color: var(--teal-ink); }
.badge.indigo { background: var(--indigo-bg); color: var(--indigo-ink); }
.badge.gray { background: var(--gray-bg); color: var(--gray-ink); }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 700;
  white-space: nowrap; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
}
.chip svg.icon { width: 14px; height: 14px; vertical-align: 0; }
.chip.tl-on_track { color: var(--text); }
.chip.tl-due_soon, .chip.tl-risk { background: var(--amber-bg); border-color: transparent; color: var(--amber-ink); }
.chip.tl-overdue, .chip.tl-done_late { background: var(--red-bg); border-color: transparent; color: var(--red-ink); }
.chip.tl-done_on_time { background: var(--green-bg); border-color: transparent; color: var(--green-ink); }
.chip.tl-closed { background: var(--gray-bg); border-color: transparent; color: var(--gray-ink); }
.chip.tl-immediate { background: var(--red); border-color: transparent; color: #fff; animation: pulse-red 1.6s ease-in-out infinite; }
.chip .risk-mark { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--amber); color: #fff; font-size: 10px; font-weight: 900; }
.pulse-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: pulse-red 1.6s ease-in-out infinite; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.req { color: var(--red); margin-left: 2px; }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea,
.filterbar input, .filterbar select {
  width: 100%; min-height: 46px; padding: 10px 13px; border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 88px; resize: vertical; line-height: 1.45; }
.field select, select.input, .filterbar select {
  padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .filterbar input:focus, .filterbar select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus);
}
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.input[disabled], .field input[disabled], .field select[disabled] { background: var(--surface-3); color: var(--muted); }
.input-lg { min-height: 54px; font-size: 18px; }
.input-group { display: flex; align-items: stretch; }
.input-group > input, .input-group > select { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; min-width: 0; }
.input-group > .addon { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--line-strong); border-left: 0; border-radius: 0 12px 12px 0; background: var(--surface-3); color: var(--muted); font-weight: 650; font-size: 14px; white-space: nowrap; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice-body {
  display: flex; flex-direction: column; gap: 2px; height: 100%; min-height: 64px; padding: 12px 14px; border: 2px solid var(--line-strong);
  border-radius: 14px; background: var(--surface); transition: border-color .15s, background-color .15s, transform .15s var(--ease);
}
.choice:active .choice-body { transform: scale(.98); }
.choice-title { font-weight: 750; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.choice-sub { font-size: 12.5px; color: var(--muted); }
.choice input:checked + .choice-body { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.choice input:focus-visible + .choice-body { box-shadow: var(--focus); }
.choice.danger input:checked + .choice-body { border-color: var(--red); background: var(--red-bg); box-shadow: 0 0 0 1px var(--red) inset; }
.quick-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer; transition: transform .15s var(--ease), background-color .15s, border-color .15s; }
.pick:active { transform: scale(.96); }
.pick.active { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
[data-theme="dark"] .pick.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.form-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--red-bg); color: var(--red-ink); font-weight: 600; font-size: 14px; }
.line-rows { display: flex; flex-direction: column; gap: 10px; }
.line-row { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--blue-bg); color: var(--blue-ink); font-size: 14px; font-weight: 600; }

/* ---------- filter bar ---------- */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.filterbar .search { position: relative; flex: 1 1 220px; max-width: 340px; }
.filterbar .search svg { position: absolute; left: 12px; top: 50%; margin-top: -9px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.filterbar .search input { padding-left: 38px; }
.filterbar input, .filterbar select { min-height: 42px; font-size: 14.5px; padding-top: 8px; padding-bottom: 8px; }
.filterbar .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filterbar .filter { width: auto; max-width: 190px; }
.filterbar .filter.is-set, .filterbar .daterange.is-set input { border-color: var(--accent); background-color: var(--accent-soft); }
.filterbar .daterange { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.filterbar .daterange input { width: 146px; }
.result-count { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.filter-toggle { display: none; }

/* ---------- tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); user-select: none; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--ink); }
.table th .sort-mark { opacity: .9; margin-left: 4px; color: var(--accent); }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.clickable { cursor: pointer; transition: background-color .12s; }
.table tr.clickable:hover { background: var(--surface-2); }
.table tr.row-muted td { color: var(--faint); }
.table tr.row-warn { box-shadow: inset 4px 0 0 var(--amber); }
.table tr.row-danger { box-shadow: inset 4px 0 0 var(--red); }
.table td.actions { text-align: right; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 8px 10px; font-size: 13.5px; }
.table.sheet { font-size: 13.5px; }
.table.sheet th { background: var(--brand-2); color: #fff; letter-spacing: .04em; border: 1px solid var(--brand-3); }
.table.sheet td { border: 1px solid var(--line-strong); padding: 8px 10px; }
.table.sheet tr.best td { background: var(--green-bg); }
.table.sheet tr.picked td { background: var(--accent-soft); font-weight: 650; }
.show-more { margin-top: 12px; }

/* ---------- detail page ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; color: var(--muted); font-weight: 650; font-size: 13.5px; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.page-head-main { flex: 1 1 280px; min-width: 0; }
.page-head-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; line-height: 1.2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actionbar {
  position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px -4px 0; padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.info-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; margin: 0; }
.info-row { min-width: 0; }
.info-label { font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0; }
.info-value { margin: 2px 0 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex: none; min-height: 46px; padding: 0 14px; background: none; border: 0; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--ink); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transform: scaleX(0); transition: transform .22s var(--ease); }
.tab.active { color: var(--ink); }
.tab.active::after { transform: scaleX(1); }
.tab-panel { animation: fade-up .22s var(--ease) both; }

/* ---------- banners, empty, skeleton, progress ---------- */
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid transparent; background: var(--blue-bg); color: var(--blue-ink); }
.banner > svg.icon { margin-top: 1px; }
.banner.info { background: var(--blue-bg); color: var(--blue-ink); }
.banner.warning { background: var(--amber-bg); color: var(--amber-ink); }
.banner.danger { background: var(--red-bg); color: var(--red-ink); }
.banner.success { background: var(--green-bg); color: var(--green-ink); }
.banner-main { flex: 1 1 0; min-width: 0; }
.banner-title { font-weight: 800; }
.banner-text { font-size: 14px; opacity: .92; overflow-wrap: anywhere; }
.banner-action { flex: none; align-self: center; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 20px; color: var(--muted); }
.empty-art { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; animation: pop-in .35s var(--ease) both; }
.empty-art svg.icon { width: 34px; height: 34px; }
.empty-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--ink); }
.empty-text { max-width: 420px; font-size: 14px; }
.skeleton { display: flex; flex-direction: column; gap: 12px; }
.sk-line, .sk-card, .sk-row, .sk-stat {
  border-radius: 10px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 45%, var(--surface-3) 65%); background-size: 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk-line { height: 14px; } .sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w80 { width: 80%; }
.sk-card { height: 150px; border-radius: var(--radius); }
.sk-row { height: 52px; }
.sk-stat { height: 96px; border-radius: var(--radius); }
.progress { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--accent); transform: scaleX(0); transform-origin: left center; transition: transform .7s var(--ease); }
.progress.green > i { background: var(--green); } .progress.amber > i { background: var(--amber); }
.progress.red > i { background: var(--red); } .progress.blue > i { background: var(--blue); }

/* ---------- stepper, timeline, changes ---------- */
.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.step { position: relative; flex: 1 1 0; min-width: 84px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.step::before { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 3px; background: var(--line-strong); border-radius: 3px; }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--green); animation: grow-x .5s var(--ease) both; transform-origin: left center; }
.step-dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--surface); border: 2.5px solid var(--line-strong); color: var(--muted); }
.step-dot svg.icon { width: 16px; height: 16px; stroke-width: 2.6; vertical-align: 0; }
.step.done .step-dot { background: var(--green); border-color: var(--green); color: #fff; animation: pop-in .3s var(--ease) both; }
.step.current .step-dot { background: var(--accent); border-color: var(--accent); color: #2a1c00; box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); animation: pulse-amber 1.8s ease-in-out infinite; }
.step-label { font-size: 12.5px; font-weight: 700; color: var(--muted); line-height: 1.25; padding: 0 4px; }
.step.done .step-label, .step.current .step-label { color: var(--ink); }
.step-sub { font-size: 11.5px; color: var(--faint); }
.stepper-note { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; background: var(--amber-bg); color: var(--amber-ink); font-size: 13.5px; font-weight: 700; }
.timeline { display: flex; flex-direction: column; }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child { padding-bottom: 0; } .tl-item:last-child::before { display: none; }
.tl-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--tone-bg, var(--surface-3)); color: var(--tone, var(--muted)); z-index: 1; }
.tl-dot svg.icon { width: 15px; height: 15px; vertical-align: 0; }
.tl-body { flex: 1 1 0; min-width: 0; padding-top: 2px; }
.tl-title { font-weight: 700; color: var(--ink); }
.tl-text { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.tl-meta { font-size: 12.5px; color: var(--muted); }
.changes { display: flex; flex-direction: column; gap: 6px; }
.change { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.change-field { flex: 0 0 150px; font-weight: 700; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.change-old { color: var(--red-ink); background: var(--red-bg); padding: 1px 8px; border-radius: 6px; text-decoration: line-through; overflow-wrap: anywhere; }
.change-arrow { color: var(--faint); font-weight: 800; }
.change-new { color: var(--green-ink); background: var(--green-bg); padding: 1px 8px; border-radius: 6px; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- charts ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13.5px; text-decoration: none; color: inherit; }
.bar-label { font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--tone, var(--brand-3)), color-mix(in srgb, var(--tone, var(--brand-3)) 70%, var(--accent))); transform: scaleX(0); transform-origin: left center; transition: transform .8s var(--ease); }
[data-theme="dark"] .bar-fill { background: linear-gradient(90deg, var(--tone, var(--accent)), var(--tone, var(--accent-2))); }
.bar-value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 8px; overflow-x: auto; }
.col { flex: 1 1 0; min-width: 38px; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.col-value { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.col-bar { flex: 1 1 0; width: 100%; max-width: 46px; display: flex; align-items: flex-end; border-radius: 8px 8px 3px 3px; background: var(--surface-3); overflow: hidden; }
.col-fill { width: 100%; height: 100%; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--brand-3))); transform: scaleY(0); transform-origin: center bottom; transition: transform .8s var(--ease); }
.col-label { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); }

/* ---------- photos ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); display: grid; place-items: center; cursor: pointer; padding: 0; font: inherit; color: var(--muted); text-align: center; text-decoration: none; transition: transform .15s var(--ease); }
.thumb:active { transform: scale(.96); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.file, .thumb.add { flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 6px; display: flex; align-items: center; justify-content: center; }
.thumb.add { border: 2px dashed var(--line-strong); background: transparent; color: var(--ink); }
.thumb.add input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.thumb .thumb-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.thumb.is-loading::after { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.thumb.is-loading > * { opacity: .25; }
.thumb.is-failed { border: 2px solid var(--red); background: var(--red-bg); color: var(--red-ink); font-size: 11.5px; font-weight: 800; padding: 6px; }
.thumb.is-hidden { opacity: .45; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(5, 10, 20, .92); display: flex; flex-direction: column; animation: fade-in .2s both; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 10px; color: #fff; }
.lightbox-bar .btn { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.lightbox-img { flex: 1 1 0; min-height: 0; display: grid; place-items: center; padding: 8px 8px calc(16px + var(--safe-b)); }
.lightbox-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

/* ---------- modal, toast, panel, menu ---------- */
.modal-host { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 16, 32, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade-in .2s both; }
.modal-host.closing { animation: fade-out .18s both; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: modal-in .26s var(--ease) both; overflow: hidden; }
.modal.wide { max-width: 880px; }
.modal-host.closing .modal { animation: modal-out .18s ease-in both; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1 1 0; font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-foot .form-error { flex: 1 1 100%; }
.toast-host { position: fixed; z-index: 140; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--brand); color: #fff; font-weight: 650; font-size: 14.5px; box-shadow: var(--shadow-lg); border-left: 5px solid var(--accent); animation: toast-in .28s var(--ease) both; max-width: 100%; cursor: pointer; }
[data-theme="dark"] .toast { background: var(--surface-3); border: 1px solid var(--line-strong); border-left: 5px solid var(--accent); }
.toast.green { border-left-color: var(--green); } .toast.red { border-left-color: var(--red); } .toast.amber { border-left-color: var(--amber); } .toast.blue { border-left-color: var(--blue); }
.toast.leaving { animation: toast-out .2s ease-in both; }
.panel { position: fixed; z-index: 60; top: calc(var(--topbar-h) + 6px); right: 14px; width: 390px; max-width: calc(100vw - 28px); max-height: min(560px, calc(100vh - 100px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; transform-origin: top right; animation: panel-in .2s var(--ease) both; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.notif { display: flex; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; font: inherit; color: inherit; min-height: 56px; }
.notif:first-child { border-top: 0; }
.notif:hover { background: var(--surface-2); }
.notif-dot { flex: none; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: transparent; }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif.unread .notif-dot { background: var(--accent); }
.notif.unread .notif-title { font-weight: 800; }
.notif-title { font-weight: 650; color: var(--ink); }
.notif-body { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.notif-time { font-size: 12px; color: var(--faint); margin-top: 2px; }
.menu { position: fixed; z-index: 60; top: calc(var(--topbar-h) + 6px); right: 14px; width: 250px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; transform-origin: top right; animation: panel-in .18s var(--ease) both; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-weight: 650; color: var(--text); cursor: pointer; text-align: left; text-decoration: none; }
.menu-item:hover { background: var(--surface-2); }

/* ---------- notices (version bar, offline) ---------- */
.notice-host { position: fixed; z-index: 150; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 16px); pointer-events: none; }
.notice { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 13.5px; font-weight: 650; box-shadow: var(--shadow-lg); animation: drop-in .28s var(--ease) both; max-width: 100%; }
.notice.amber { background: var(--amber); color: #201400; } .notice.red { background: var(--red); } .notice.green { background: var(--green); }
.notice .btn { min-height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; background: rgba(255, 255, 255, .18); border-color: transparent; color: inherit; }
.notice-text { padding: 4px 4px 4px 0; }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%); color: var(--on-brand);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 12px; padding: calc(18px + var(--safe-t)) 20px 16px; text-decoration: none; color: inherit; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #241700; font-family: var(--font-display); font-weight: 800; font-size: 19px; box-shadow: 0 8px 18px -8px rgba(226, 162, 29, .9); flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 800; letter-spacing: .14em; font-size: 15px; line-height: 1.1; color: #fff; }
.brand-sub { font-size: 11px; letter-spacing: .08em; color: var(--on-brand-muted); text-transform: uppercase; }
.nav { flex: 1 1 0; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
.nav-group { margin: 14px 10px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--on-brand-muted); opacity: .75; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--on-brand-muted); text-decoration: none; font-weight: 650; font-size: 14.5px; transition: background-color .15s, color .15s, transform .15s var(--ease); }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item:active { transform: scale(.98); }
.nav-item.active { background: rgba(255, 255, 255, .11); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); animation: grow-y .25s var(--ease) both; }
.nav-item.active svg.icon { color: var(--accent-2); }
.nav-item .count-badge { margin-left: auto; }
.sidebar-foot { padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; color: var(--on-brand-muted); }
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(8, 16, 32, .5); opacity: 0; pointer-events: none; transition: opacity .25s; }
.main { margin-left: var(--sidebar-w); min-width: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: var(--topbar-h);
  padding: var(--safe-t) 22px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-titles { flex: 1 1 0; min-width: 0; }
.topbar-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn.icon { border-color: transparent; background: transparent; position: relative; }
.topbar .btn.icon:hover { background: var(--surface-3); }
.topbar .count-badge { position: absolute; top: 4px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; box-shadow: 0 0 0 2px var(--bg); }
.bell.ring svg { animation: ring .7s var(--ease); transform-origin: 50% 10%; }
.demo-ribbon { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: repeating-linear-gradient(135deg, var(--accent) 0 10px, var(--accent-2) 10px 20px); color: #241700; font-size: 12px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-2); color: var(--accent-2); font-weight: 800; font-size: 13px; flex: none; }
.user-chip-name { font-weight: 700; font-size: 13.5px; line-height: 1.15; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { font-size: 11.5px; color: var(--muted); line-height: 1.15; }
.view { flex: 1 1 auto; width: 100%; max-width: 1320px; margin: 0 auto; padding: 22px 24px 40px; min-width: 0; }
.view-page { animation: page-in .24s var(--ease) both; }
.tabbar { display: none; }
.menu-btn { display: none; }

/* ---------- auth screens (login, setup, storage) ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); background: var(--bg); }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 48px 0; color: #fff;
  background: radial-gradient(1200px 600px at 20% -10%, #2a4a80 0%, transparent 60%), linear-gradient(180deg, #0b1730 0%, #132748 55%, #1d3a66 100%); }
.auth-hero .brand { padding: 0; }
.auth-tagline { position: relative; z-index: 2; margin-top: 44px; max-width: 520px; }
.auth-tagline h1 { color: #fff; font-size: clamp(28px, 3.4vw, 44px); font-weight: 800; line-height: 1.12; letter-spacing: -.03em; }
.auth-tagline h1 em { font-style: normal; color: var(--accent-2); }
.auth-tagline p { margin-top: 14px; color: #b9c7e0; font-size: 16px; max-width: 440px; }
.auth-points { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.auth-points span { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .12); font-size: 12.5px; font-weight: 650; color: #dbe5f6; animation: fade-up .5s var(--ease) both; }
.auth-points span:nth-child(2) { animation-delay: .08s; } .auth-points span:nth-child(3) { animation-delay: .16s; } .auth-points span:nth-child(4) { animation-delay: .24s; }
.skyline { position: relative; z-index: 1; width: calc(100% + 96px); margin: 20px -48px 0; display: block; height: auto; max-height: 52vh; }
.auth-side { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 24px calc(32px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 420px; animation: fade-up .45s var(--ease) both; }
.auth-card h2 { font-size: 26px; font-weight: 800; }
.auth-card .lead { color: var(--muted); margin: 6px 0 22px; }
.auth-foot { margin-top: 22px; font-size: 12.5px; color: var(--faint); text-align: center; }
.demo-box { margin-top: 20px; padding: 14px; border-radius: 16px; border: 1.5px dashed var(--accent); background: var(--accent-soft); }
.demo-box-title { font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.demo-accounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.demo-account { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font: inherit; text-align: left; color: var(--ink); transition: transform .15s var(--ease), border-color .15s; }
.demo-account:hover { border-color: var(--accent); transform: translateY(-1px); }
.demo-account b { font-size: 13.5px; } .demo-account span { font-size: 12px; color: var(--muted); }
.auth-full { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 50% -10%, #2a4a80 0%, transparent 60%), linear-gradient(180deg, #0b1730, #1d3a66); }
.auth-full .card { max-width: 620px; width: 100%; padding: 28px; box-shadow: var(--shadow-lg); animation: modal-in .35s var(--ease) both; }
.danger-mark { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--red-bg); color: var(--red); margin-bottom: 14px; animation: pulse-red 1.8s ease-in-out infinite; }
.danger-mark svg.icon { width: 32px; height: 32px; }
.tech-box { padding: 12px 14px; border-radius: 12px; background: var(--surface-3); font-size: 13.5px; }
.tech-box code { font-family: ui-monospace, Consolas, monospace; background: var(--surface); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: linear-gradient(180deg, #0b1730, #1d3a66); color: #fff; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.splash .brand-mark { width: 64px; height: 64px; border-radius: 20px; font-size: 30px; animation: pulse-amber 1.6s ease-in-out infinite; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px !important; }
.pw-toggle { position: absolute; right: 4px; top: 50%; margin-top: -20px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 10px; display: grid; place-items: center; }

/* skyline motion graphic */
.sk-sky-dot { fill: #fff; opacity: .5; animation: twinkle 3.2s ease-in-out infinite; }
.sk-sun { fill: #f3c659; opacity: .95; animation: sun-rise 1.6s var(--ease) both; transform-box: fill-box; transform-origin: center; }
.sk-sun-glow { fill: #f3c659; opacity: .14; animation: glow 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.sk-cloud { fill: #fff; opacity: .1; animation: drift 38s linear infinite; }
.sk-cloud.c2 { animation-duration: 54s; animation-delay: -20s; opacity: .07; }
.sk-b { transform-box: fill-box; transform-origin: center bottom; animation: rise .9s var(--ease) both; }
.sk-b-a { fill: #0a1529; } .sk-b-b { fill: #152c52; } .sk-b-c { fill: #1f3d6d; }
.sk-w { fill: #f3c659; opacity: .12; animation: window 6s ease-in-out infinite; }
.sk-w.w1 { animation-delay: -1.1s; } .sk-w.w2 { animation-delay: -2.6s; } .sk-w.w3 { animation-delay: -3.9s; } .sk-w.w4 { animation-delay: -5s; }
.sk-ws { fill: #f3c659; opacity: .1; } .sk-ws.on { opacity: .5; }
.sk-ground { fill: #081225; }
.sk-crane { fill: #e2a21d; stroke: #e2a21d; }
.sk-crane-line { stroke: #e2a21d; stroke-width: 2; fill: none; }
.sk-crane-arm { transform-box: fill-box; transform-origin: 62% 100%; animation: crane-in 1.2s var(--ease) .5s both; }
.sk-trolley { animation: trolley 9s ease-in-out infinite; }
.sk-cable { stroke: #f4efe2; stroke-width: 1.5; transform-box: fill-box; transform-origin: center top; animation: cable 9s ease-in-out infinite; }
.sk-load { fill: #f4efe2; animation: load 9s ease-in-out infinite; }
.sk-floor { fill: #27467a; stroke: #e2a21d; stroke-width: 1; opacity: 0; animation: floor 14s var(--ease) infinite backwards; }
.sk-scaffold { stroke: #e2a21d; stroke-width: 1; opacity: .35; fill: none; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .15s; } .d3 { animation-delay: .25s; } .d4 { animation-delay: .35s; }
.d5 { animation-delay: .45s; } .d6 { animation-delay: .55s; } .d7 { animation-delay: .65s; } .d8 { animation-delay: .75s; }
.sk-floor.f1 { animation-delay: 1s; } .sk-floor.f2 { animation-delay: 2.2s; } .sk-floor.f3 { animation-delay: 3.4s; }
.sk-floor.f4 { animation-delay: 4.6s; } .sk-floor.f5 { animation-delay: 5.8s; } .sk-floor.f6 { animation-delay: 7s; }

/* ---------- motion ---------- */
.fade-in { animation: fade-in .25s both; }
.pop-in { animation: pop-in .3s var(--ease) both; }
.shake { animation: shake .35s both; }
.stagger > * { animation: fade-up .32s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .08s; } .stagger > *:nth-child(4) { animation-delay: .11s; }
.stagger > *:nth-child(5) { animation-delay: .14s; } .stagger > *:nth-child(6) { animation-delay: .17s; }
.stagger > *:nth-child(7) { animation-delay: .2s; } .stagger > *:nth-child(8) { animation-delay: .23s; }
.stagger > *:nth-child(9) { animation-delay: .26s; } .stagger > *:nth-child(10) { animation-delay: .29s; }
.stagger > *:nth-child(11) { animation-delay: .32s; } .stagger > *:nth-child(n+12) { animation-delay: .35s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes modal-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { from { transform: none; } to { transform: translateY(100%); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pulse-red { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .72; transform: scale(1.04); } }
@keyframes pulse-amber { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes ring { 0% { transform: rotate(0); } 20% { transform: rotate(16deg); } 40% { transform: rotate(-14deg); } 60% { transform: rotate(9deg); } 80% { transform: rotate(-5deg); } 100% { transform: rotate(0); } }
@keyframes rise { from { transform: scaleY(0); opacity: .2; } to { transform: scaleY(1); opacity: 1; } }
@keyframes window { 0%, 100% { opacity: .1; } 45%, 60% { opacity: .85; } }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .7; } }
@keyframes glow { 0%, 100% { transform: scale(1); opacity: .12; } 50% { transform: scale(1.15); opacity: .2; } }
@keyframes sun-rise { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: .95; } }
@keyframes drift { from { transform: translateX(-260px); } to { transform: translateX(900px); } }
@keyframes crane-in { from { transform: rotate(-10deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes trolley { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-120px); } }
@keyframes cable { 0%, 100% { transform: scaleY(1); } 25% { transform: scaleY(1.9); } 50% { transform: scaleY(1.1); } 75% { transform: scaleY(2.1); } }
@keyframes load { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(54px); } 50% { transform: translateY(6px); } 75% { transform: translateY(66px); } }
@keyframes floor { 0% { opacity: 0; transform: translateY(-16px); } 7% { opacity: 1; transform: none; } 88% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }

/* ---------- responsive: tablet ---------- */
@media (max-width: 1100px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- responsive: phone (drawer + bottom tabs) ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); transition: transform .28s var(--ease); width: min(86vw, 310px); box-shadow: var(--shadow-lg); }
  .shell.drawer-open .sidebar { transform: none; }
  .shell.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabs-h) + var(--safe-b)); }
  .topbar { padding-left: 8px; padding-right: 8px; gap: 4px; }
  .topbar-title { font-size: 17px; }
  .user-chip { padding: 4px; border: 0; background: none; }
  .user-chip-text { display: none; }
  .view { padding: 14px 14px 28px; }
  .tabbar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(16, 32, 60, .35);
  }
  .tabbar-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; cursor: pointer; padding: 0 2px; }
  .tabbar-item svg.icon { width: 23px; height: 23px; transition: transform .2s var(--ease); }
  .tabbar-item.active { color: var(--ink); }
  .tabbar-item.active svg.icon { color: var(--accent); transform: translateY(-2px) scale(1.08); }
  .tabbar-item.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); animation: grow-x .25s var(--ease) both; }
  .tabbar-item .count-badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; box-shadow: 0 0 0 2px var(--surface); }
  .toast-host { bottom: calc(var(--tabs-h) + var(--safe-b) + 14px); }
  .actionbar { bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); margin-left: 0; margin-right: 0; }
  .actionbar .btn { flex: 1 1 auto; min-height: 50px; }
  .panel { top: 0; right: 0; left: 0; bottom: 0; width: auto; max-width: none; max-height: none; border-radius: 0; border: 0; padding-top: var(--safe-t); animation: sheet-in .28s var(--ease) both; }
  .menu { right: 8px; }
  .hide-phone { display: none !important; }
  .menu-btn { display: inline-flex; }
  .only-phone { display: revert !important; }
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-hero { padding: calc(22px + var(--safe-t)) 22px 0; }
  .auth-tagline { margin-top: 18px; }
  .auth-tagline h1 { font-size: 24px; }
  .auth-tagline p, .auth-points { display: none; }
  .skyline { width: calc(100% + 44px); margin: 6px -22px 0; max-height: 26vh; }
  .auth-side { justify-content: flex-start; padding-top: 24px; }
}
@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .btn { min-height: 48px; }
  .btn.sm { min-height: 40px; }
  .btn.icon { width: 48px; } .btn.icon.sm { width: 40px; }
  .stat { padding: 14px; } .stat-value { font-size: 22px; } .stat-icon { width: 32px; height: 32px; right: 10px; top: 10px; }
  .page-head-title { font-size: 20px; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1 1 auto; }
  .line-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .line-row > :first-child { grid-column: 1 / -1; }
  .change-field { flex-basis: 100%; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  /* filter bar: search stays, dropdowns fold behind a Filters button */
  .filterbar .search { flex: 1 1 100%; max-width: none; order: -2; }
  .filter-toggle { display: inline-flex; }
  .filterbar .filters { display: none; flex: 1 1 100%; order: 5; }
  .filterbar.open .filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); animation: fade-up .2s var(--ease) both; }
  .filterbar .filter { max-width: none; width: 100%; }
  .filterbar .daterange { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); }
  .filterbar .daterange input { width: 100%; }
  /* tables become cards */
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards thead { display: none; }
  .table.cards tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px 14px; margin-bottom: 10px; }
  .table.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 4px 0; border: 0; text-align: right; white-space: normal; }
  .table.cards td::before { content: attr(data-label); flex: none; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .table.cards td:first-child { font-size: 16px; font-weight: 750; color: var(--ink); text-align: left; padding-bottom: 6px; justify-content: flex-start; }
  .table.cards td:first-child::before { display: none; }
  .table.cards td.is-empty { display: none; }
  .table.cards td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.cards td.actions::before { display: none; }
  .table.cards tr.row-warn { box-shadow: inset 4px 0 0 var(--amber), var(--shadow-sm); }
  .table.cards tr.row-danger { box-shadow: inset 4px 0 0 var(--red), var(--shadow-sm); }
  /* modal becomes a bottom sheet */
  .modal-host { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; max-height: calc(100vh - 24px - var(--safe-t)); max-height: calc(100dvh - 24px - var(--safe-t)); border-radius: 22px 22px 0 0; animation: sheet-in .3s var(--ease) both; }
  .modal-host.closing .modal { animation: sheet-out .2s ease-in both; }
  .modal-foot .btn { flex: 1 1 auto; min-height: 50px; }
  .stepper { flex-direction: column; gap: 0; overflow: visible; }
  .step { flex-direction: row; align-items: center; text-align: left; gap: 12px; min-width: 0; width: 100%; padding: 5px 0; }
  .step::before { top: -50%; left: 14px; right: auto; width: 3px; height: 100%; transform-origin: center top; }
  .step.done::before, .step.current::before { animation-name: grow-y; }
  .step-label { padding: 0; font-size: 14px; }
  .demo-ribbon span { display: none; }
}
@media (max-width: 380px) {
  .view { padding: 12px 10px 24px; }
  .stat-value { font-size: 20px; }
  .demo-accounts { grid-template-columns: minmax(0, 1fr); }
  .tabbar-item { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .sk-floor { opacity: 1; }
}

/* ---------- print (App.printHtml builds a hidden iframe with body.print-body) ---------- */
body.print-body { background: #fff; color: #111; font-size: 12.5px; padding: 0; margin: 0; }
.print-doc { max-width: 190mm; margin: 0 auto; padding: 6mm 4mm; color: #111; font-family: var(--font); }
.print-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 3px solid #10203c; margin-bottom: 14px; }
.print-brand { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: .16em; color: #10203c; line-height: 1; }
.print-brand small { display: block; margin-top: 4px; font-family: var(--font); font-size: 10px; letter-spacing: .14em; font-weight: 700; color: #555; text-transform: uppercase; }
.print-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; text-align: right; color: #10203c; }
.print-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; margin-bottom: 12px; }
.print-meta div { display: flex; gap: 8px; } .print-meta b { min-width: 110px; color: #444; font-weight: 700; }
.print-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.print-table th { background: #10203c; color: #fff; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; text-align: left; padding: 6px 8px; border: 1px solid #10203c; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-table td { padding: 6px 8px; border: 1px solid #999; vertical-align: top; }
.print-table .num { text-align: right; white-space: nowrap; }
.print-table tfoot td { font-weight: 800; background: #f1f1f1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-sign { display: flex; justify-content: space-between; gap: 30px; margin-top: 44px; }
.print-sign div { flex: 1 1 0; border-top: 1px solid #555; padding-top: 6px; font-size: 11px; color: #444; text-align: center; }
.print-foot { margin-top: 18px; font-size: 10.5px; color: #666; border-top: 1px solid #ccc; padding-top: 6px; }
@page { size: A4; margin: 12mm; }
@media print {
  .sidebar, .topbar, .tabbar, .scrim, .toast-host, .notice-host, .actionbar, .filterbar, .hide-print, .modal-host, .panel, .menu { display: none !important; }
  .main { margin: 0; padding: 0; } .view { padding: 0; max-width: none; }
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}

/* ==========================================================================
   APP LAYER (public/js/pwa.js) - photo / file picker, gallery viewer, install
   steps. Added by the app-layer agent; everything above belongs to the shell.
   Classes: .attach (.attach-list .attach-add .attach-cam .attach-tile + .st-up
   .st-ok .st-fail, .attach-bar .attach-status .attach-x .attach-note
   .attach-skip .attach-skip-box .attach-skip-label .attach-skip-note)
   .attach-gallery (+ .show-hidden) | .attach-view (.attach-view-note
   .attach-view-file .attach-nav) | .install-steps .install-n
   ========================================================================== */
.attach { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.attach .attach-cam { display: none; }
@media (hover: none) and (pointer: coarse) { .attach .attach-cam { display: flex; } }
.attach.is-full .attach-add { display: none; }
.attach-add span { text-align: center; line-height: 1.2; }
.attach-add:focus-within { border-color: var(--accent); }
.attach-tile { animation: pop-in .25s var(--ease) both; }
.attach-tile img { transition: opacity .2s; }
.attach-tile.st-up img, .attach-tile.st-up > svg, .attach-tile.st-up .thumb-name { opacity: .45; }
.attach-tile.is-busy { opacity: .5; pointer-events: none; }
.attach-status { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 4px 5px; font-size: 10.5px; font-weight: 800; line-height: 1.15; text-align: center; color: #fff; background: rgba(10, 20, 40, .72); }
.attach-status svg { width: 12px; height: 12px; flex: none; }
.attach-tile.st-ok .attach-status { background: var(--green); color: #fff; }
.attach-tile.st-fail { border: 2px solid var(--red); }
.attach-tile.st-fail .attach-status { position: absolute; inset: 0; padding: 22px 6px 6px; background: var(--red-bg); color: var(--red-ink); font-size: 11.5px; }
.attach-tile.st-fail img { opacity: .25; }
.attach-bar { position: absolute; left: 6px; right: 6px; bottom: 26px; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .55); overflow: hidden; box-shadow: 0 0 0 1px rgba(10, 20, 40, .25); }
.attach-bar i { display: block; width: 100%; height: 100%; border-radius: 999px; background: var(--accent); transform: scaleX(.03); transform-origin: left center; transition: transform .25s linear; }
.attach-x { position: absolute; top: 0; right: 0; z-index: 2; width: 40px; height: 40px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: start end; }
.attach-x svg { width: 24px; height: 24px; padding: 5px; margin: 4px; border-radius: 50%; background: rgba(10, 20, 40, .78); color: #fff; box-sizing: border-box; }
.attach-x:active svg { transform: scale(.9); }
.attach-note:empty { display: none; }
.attach-skip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.attach-skip-box { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.attach-skip-label { display: flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; flex: 1 1 0; }
.attach-skip-note { display: none; flex: 1 1 100%; }
.attach-skip-box:checked ~ .attach-skip-note { display: block; animation: fade-up .2s var(--ease) both; }

.attach-gallery { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.attach-gallery .thumbs { width: 100%; }
.attach-gallery .thumb.is-hidden { display: none; }
.attach-gallery.show-hidden .thumb.is-hidden { display: grid; }
.attach-gallery.show-hidden .thumb.file.is-hidden { display: flex; }
.attach-gallery .thumb.is-hidden .attach-status { background: rgba(10, 20, 40, .85); }

.attach-view .lightbox-img { position: relative; }
.attach-view-note { margin: 0 14px 6px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 13px; font-weight: 600; }
.attach-view-file { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 22px; border-radius: 18px; background: rgba(255, 255, 255, .08); color: #fff; text-align: center; max-width: 320px; overflow-wrap: anywhere; }
.attach-view-file > svg { width: 48px; height: 48px; }
.attach-nav { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; transition: transform .15s var(--ease), opacity .15s; }
.attach-nav.prev { left: 10px; } .attach-nav.next { right: 10px; }
.attach-nav:active { transform: scale(.92); }
.attach-nav[disabled] { opacity: .25; cursor: default; }

.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.install-steps li { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.4; animation: fade-up .3s var(--ease) both; }
.install-steps li:nth-child(2) { animation-delay: .06s; } .install-steps li:nth-child(3) { animation-delay: .12s; }
.install-steps svg { vertical-align: -3px; }
.install-n { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--ink); font-weight: 800; }
@media print { .attach-add, .attach-x, .attach-view { display: none !important; } }
.attach .attach-note.text-red { color: var(--red); font-weight: 650; }

/* phones: keep the notice bar clear of the page title by showing it just above the bottom tabs */
@media (max-width: 760px) { .notice-host { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 78px); } }

/* Elite Group logo (same mark as the HRMS) */
.brand-mark.logo { background: #fff; padding: 5px; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .55); }
.brand-mark.logo img { width: 100%; height: 100%; display: block; }
.print-head .print-logo { width: 46px; height: 46px; margin-right: 10px; flex: none; }

.print-head .print-brand { margin-right: auto; }

/* list rows: title and each detail line on their own line */
.list-main > .list-title, .list-main > .list-sub { display: block; }

/* ---- Tick boxes and choice dots: one look everywhere (a tick box is never drawn like a text field) ---- */
input[type="checkbox"], input[type="radio"],
.field input[type="checkbox"], .field input[type="radio"],
.filterbar input[type="checkbox"], .filterbar input[type="radio"],
.modal input[type="checkbox"], .modal input[type="radio"] {
  -webkit-appearance: none; appearance: none; box-sizing: border-box; flex: none; margin: 0; padding: 0;
  width: 22px; height: 22px; min-height: 0; min-width: 0; display: inline-grid; place-content: center; vertical-align: middle;
  border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 7px; cursor: pointer; box-shadow: none;
  transition: background-color .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
}
input[type="radio"], .field input[type="radio"], .filterbar input[type="radio"], .modal input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 12px; height: 12px; transform: scale(0); transition: transform .14s var(--ease); background: var(--accent-ink, #201400);
  clip-path: polygon(14% 52%, 0 66%, 40% 100%, 100% 22%, 86% 9%, 39% 70%); }
input[type="radio"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; transform: scale(0); transition: transform .14s var(--ease); background: var(--accent-ink, #201400); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--accent); }
input[type="checkbox"]:active, input[type="radio"]:active { transform: scale(.94); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }

/* a tick box that turns something on or off in a toolbar reads better as a switch */
.filterbar .check input[type="checkbox"], .check.switch input[type="checkbox"] {
  width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); border-color: var(--line-strong); place-content: center start; padding: 0 2px;
}
.filterbar .check input[type="checkbox"]::before, .check.switch input[type="checkbox"]::before {
  width: 18px; height: 18px; border-radius: 50%; clip-path: none; background: #fff; transform: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  transition: transform .18s var(--ease);
}
.filterbar .check input[type="checkbox"]:checked::before, .check.switch input[type="checkbox"]:checked::before { transform: translateX(16px); }
.filterbar .check { min-height: 42px; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.filterbar .check:has(input:checked) { color: var(--ink); }
/* inputs that are deliberately invisible (big choice cards) stay invisible and fill their card */
.choice input[type="radio"], .choice input[type="checkbox"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; border-radius: 0; background: none; display: block; }
.choice input[type="radio"]::before, .choice input[type="checkbox"]::before { content: none; }

/* ---- Sidebar that opens and closes (desktop): full menu <-> icon rail, remembered per browser ---- */
.menu-btn { display: inline-flex; }
.sidebar { transition: width .22s var(--ease); }
.main { transition: margin-left .22s var(--ease); }
.side-toggle {
  position: absolute; top: calc(22px + var(--safe-t)); right: -13px; z-index: 2; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .22s var(--ease), background-color .15s;
}
.side-toggle:hover { background: var(--accent-soft); }
.side-toggle svg { width: 15px; height: 15px; }
@media (min-width: 901px) {
  .shell.side-collapsed { --sidebar-w: 76px; }
  .shell.side-collapsed .side-toggle { transform: rotate(180deg); }
  .shell.side-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .shell.side-collapsed .brand > span:not(.brand-mark), .shell.side-collapsed .nav-item > span:not(.count-badge),
  .shell.side-collapsed .nav-group, .shell.side-collapsed .sidebar-foot { display: none; }
  .shell.side-collapsed .nav { padding-left: 10px; padding-right: 10px; overflow-x: hidden; }
  .shell.side-collapsed .nav-item { justify-content: center; padding: 0; gap: 0; }
  .shell.side-collapsed .nav-item.active::before { left: -10px; }
  .shell.side-collapsed .nav-item .count-badge { position: absolute; top: 4px; right: 6px; margin: 0; transform: scale(.82); }
  .shell.side-collapsed .nav::before { content: ""; display: block; height: 8px; }
}
@media (max-width: 900px) { .side-toggle { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar, .main, .side-toggle { transition: none; } }

/* ---- Phone footer: a floating oval bar, lifted off the screen edge, with the current tab in its own pill ---- */
@media (max-width: 900px) {
  :root { --tabs-h: 66px; --tabs-gap: 10px; }
  .tabbar {
    left: 12px; right: 12px; bottom: calc(var(--safe-b) + var(--tabs-gap)); width: auto;
    height: var(--tabs-h); padding: 6px; border-radius: 999px; border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
    box-shadow: 0 14px 34px -12px rgba(8, 16, 32, .45), 0 2px 6px rgba(8, 16, 32, .08);
    align-items: stretch; gap: 2px;
  }
  .tabbar-item { border-radius: 999px; min-height: 0; gap: 2px; transition: background-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease); }
  .tabbar-item:active { transform: scale(.94); }
  .tabbar-item.active { background: var(--brand); color: #fff; }
  .tabbar-item.active svg.icon { color: var(--accent-2); transform: none; }
  .tabbar-item.active::before { content: none; }
  .tabbar-item .count-badge { top: 4px; box-shadow: 0 0 0 2px var(--surface); }
  .main { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + var(--tabs-gap) + 14px); }
  .toast-host { bottom: calc(var(--tabs-h) + var(--safe-b) + var(--tabs-gap) + 14px); }
  .actionbar { bottom: calc(var(--tabs-h) + var(--safe-b) + var(--tabs-gap) + 10px); }
  .notice-host { bottom: calc(var(--tabs-h) + var(--safe-b) + var(--tabs-gap) + 12px); }
}

/* ---- Header: account chip and account menu ---- */
.topbar { gap: 8px; }
.user-chip { gap: 10px; padding: 4px 12px 4px 4px; margin-left: 4px; text-align: left; box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease); }
.user-chip:hover { border-color: var(--accent); background: var(--surface-2); }
.user-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.user-chip .avatar { width: 36px; height: 36px; background: linear-gradient(135deg, var(--brand), var(--brand-3, var(--brand-2))); color: #fff; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--accent); font-size: 13px; letter-spacing: .02em; }
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.user-chip-name { font-size: 14px; line-height: 1.15; color: var(--ink); max-width: 150px; }
.user-chip-role { font-size: 11.5px; line-height: 1.15; font-weight: 600; color: var(--muted); }
.user-chip-caret { display: inline-grid; place-items: center; width: 16px; color: var(--muted); font-size: 11px; transition: transform .2s var(--ease); }
.user-chip-caret svg { width: 14px; height: 14px; }
.account-menu { width: 288px; padding: 8px; border-radius: 18px; }
.account-head { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 0 0 6px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; background: rgba(255, 255, 255, .14); color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.account-id { min-width: 0; }
.account-name { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 999px; background: var(--accent); color: #241700; font-size: 11px; font-weight: 800; letter-spacing: .03em; }
.account-user { margin-top: 5px; font-size: 12px; color: var(--on-brand-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.menu-item.danger { color: var(--red); }
.menu-item.danger svg { color: var(--red); }
.menu-item.danger:hover { background: var(--red-bg); }
@media (max-width: 900px) {
  .user-chip { padding: 2px; margin-left: 0; box-shadow: none; }
  .user-chip-caret { display: none; }
  .account-menu { width: min(300px, calc(100vw - 16px)); }
}

/* ==========================================================================
   POLISH LAYER - contrast, focus, rhythm, motion and consistency fixes.
   Everything here refines the classes above.
   STATUS COLOURS (fixed meaning, always shown with a text label, never colour alone):
     gray = draft / closed      blue = submitted / waiting     amber = needs action / partly done
     green = done / paid        red = rejected / overdue       violet = with the director / MD
   New classes: .tbl-tools (count + export, right side of a filter bar) .active-filters .af-chip
   (removable chips of the filters in use) .date-pick .date-text (readable date over a date input)
   .field.has-error .field-error .sr-only | .table.striped | .btn.wa (quiet WhatsApp button)
   .btn.danger.solid .btn.success.solid | .hide-narrow (column hidden on 721-1439 px screens)
   .col-wide (text column that needs room) | .rules-form
   Tokens: --focus-ring --field-border --link --green-text --amber-text --red-text --danger-fill
   --success-fill --amber-fill --on-fill --ctl-h --row-h --dur-fast --dur-mid --dur-slow --sp-1 ... --sp-8
   ========================================================================== */
:root {
  --focus-ring: #27467a;
  --field-border: #8a826f;
  --link: #2459b8;
  --green-text: #127a50; --amber-text: #9a6200; --red-text: #b3311f; --blue-text: #2459b8;
  --danger-fill: #b3311f; --success-fill: #127a50; --amber-fill: #9a6200; --on-fill: #fff;
  --ctl-h: 44px; --row-h: 48px;
  --dur-fast: 120ms; --dur-mid: 240ms; --dur-slow: 400ms;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 48px;
}
[data-theme="dark"] {
  --focus-ring: #f0b440;
  --field-border: #6b7fa3;
  --link: #6aa2ff;
  --green-text: var(--green); --amber-text: var(--amber); --red-text: var(--red); --blue-text: var(--blue);
  --danger-fill: var(--red); --success-fill: var(--green); --amber-fill: var(--amber); --on-fill: #0a111e;
}

/* ---- focus: a solid 2px ring with 3:1 contrast on every control ---- */
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; box-shadow: none; }
.user-chip:focus-visible, .side-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .filterbar input:focus, .filterbar select:focus {
  border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring);
}
.input:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible,
.filterbar input:focus-visible, .filterbar select:focus-visible { outline: 0; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.choice input:focus-visible + .choice-body { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus-ring); }
.rq-line-extra > input:focus-visible { border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring); }
.table tr.clickable:focus-visible { outline-offset: -2px; }

/* ---- field borders that can be seen (3:1); dividers keep --line-strong ---- */
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea,
.filterbar input, .filterbar select, .input-group > .addon, .rq-line-extra > input[type="text"], .rq-line-extra > input[type="date"] {
  border-color: var(--field-border);
}
input[type="checkbox"], input[type="radio"],
.field input[type="checkbox"], .field input[type="radio"],
.filterbar input[type="checkbox"], .filterbar input[type="radio"],
.modal input[type="checkbox"], .modal input[type="radio"] { border-color: var(--field-border); }
input[type="checkbox"]:checked, input[type="radio"]:checked { border-color: var(--accent); }
.input-group > .addon { min-width: 3.25rem; }

/* ---- readable secondary text ---- */
.table tr.row-muted td, .step-sub, .notif-time, .auth-foot, .strike, .change-arrow { color: var(--muted); }
.text-green { color: var(--green-text); } .text-amber { color: var(--amber-text); }
.text-red { color: var(--red-text); } .text-blue { color: var(--blue-text); }
a.link, .link, .linkbtn { color: var(--link); }
a.link.text-red, .link.text-red { color: var(--red-text); }
a.link.text-green, .link.text-green { color: var(--green-text); }
.menu-item.danger, .menu-item.danger svg { color: var(--red-text); }

/* ---- spacing: one scale (4 8 12 16 20 24 32 48) ---- */
.card { padding: var(--sp-5); }
.card-pad-0 { padding: 0; }
.card-pad-0 > .card-head { padding: var(--sp-4) var(--sp-5) 0; }
.card-head { gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-foot { margin-top: var(--sp-4); padding-top: var(--sp-3); gap: var(--sp-3); }
.form { gap: var(--sp-4); }
.line-rows { gap: var(--sp-3); }
.line-row { gap: var(--sp-3); }
.page-head { gap: var(--sp-4); margin-bottom: var(--sp-5); }
.empty { padding: var(--sp-8) var(--sp-5); }
.banner { padding: var(--sp-3) var(--sp-4); }
.list-item { padding: var(--sp-3) var(--sp-5); }
.stat { padding: var(--sp-4) var(--sp-5); }
.info-list { gap: var(--sp-4) var(--sp-5); }
.modal-body { padding: var(--sp-5); }
.modal-foot { padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + var(--safe-b)); gap: var(--sp-2); }
.modal-head { padding: var(--sp-4) var(--sp-4) var(--sp-3) var(--sp-5); }

/* ---- 12px minimum for readable text, calmer letter-spacing ---- */
.eyebrow { font-size: 12px; letter-spacing: .06em; }
.nav-group { font-size: 12px; letter-spacing: .06em; }
.info-label { font-size: 12px; letter-spacing: .04em; }
.stat-label { letter-spacing: .04em; }
.col-value, .col-label, .step-sub { font-size: 12px; }
.change-field { letter-spacing: .03em; }

/* ---- buttons: one obvious primary, quieter status buttons ---- */
.btn { transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast), color var(--dur-fast); }
/* success: a soft green button; a solid fill only for the final step inside a dialog */
.btn.success { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--green-ink); box-shadow: none; }
.btn.success:hover { border-color: var(--green); background: color-mix(in srgb, var(--green-bg) 85%, var(--green)); }
.modal-foot .btn.success, .btn.success.solid { background: var(--success-fill); border-color: var(--success-fill); color: var(--on-fill); }
/* danger: outlined red; solid red only for the confirm step inside a dialog */
.btn.danger { background: var(--surface); border-color: color-mix(in srgb, var(--red) 55%, transparent); color: var(--red-text); box-shadow: none; }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.modal-foot .btn.danger, .btn.danger.solid { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-fill); }
.btn.danger.ghost, .btn.ghost.danger { background: transparent; border-color: transparent; color: var(--red-text); }
.btn.danger.ghost:hover, .btn.ghost.danger:hover { background: var(--red-bg); }
.btn.is-retry { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-fill); }
/* WhatsApp: a normal button with a green mark */
.btn.wa svg.icon { color: var(--green); }
/* row actions inside tables never compete with the page's main button */
.table td .btn.primary, .table td .btn.accent, [data-theme="dark"] .table td .btn.primary {
  background: var(--surface); border-color: var(--field-border); color: var(--ink); box-shadow: none;
}
.table td .btn.primary:hover, .table td .btn.accent:hover, [data-theme="dark"] .table td .btn.primary:hover { background: var(--surface-2); border-color: var(--ink); }
.table td .btn.primary svg.icon, .table td .btn.accent svg.icon { color: var(--amber-text); }
.btn[aria-busy="true"] { cursor: progress; }
.linkbtn { padding: 6px 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }

/* ---- solid status fills: readable text in both themes ---- */
.count-badge { background: var(--danger-fill); color: var(--on-fill); font-size: 11.5px; }
.chip.tl-immediate { background: var(--danger-fill); color: var(--on-fill); }
.chip .risk-mark { background: var(--amber-fill); color: var(--on-fill); }
.step.done .step-dot { background: var(--success-fill); border-color: var(--success-fill); color: var(--on-fill); }

/* ---- motion: three durations, no endless pulsing ---- */
.chip.tl-immediate, .pulse-dot, .step.current .step-dot, .danger-mark { animation-iteration-count: 3; }
.card-click, .stat, a.stat { transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.list-item, .notif, .menu-item, .table tr.clickable { transition: background-color var(--dur-fast), color var(--dur-fast); }
.nav-item { transition: background-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease); }
.input, .field input, .field select, .field textarea, .filterbar input, .filterbar select { transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.choice-body, .pick, .thumb, .demo-account { transition-duration: var(--dur-fast); }
.tab::after { transition: transform var(--dur-mid) var(--ease); }
.tab-panel, .view-page, .modal, .toast, .stagger > *, .fade-in, .pop-in, .empty-art { animation-duration: var(--dur-mid); }
.modal-host, .panel, .menu { animation-duration: var(--dur-fast); }
.modal-host.closing, .modal-host.closing .modal { animation-duration: 160ms; }

/* skeletons wait a moment, so a fast load never flashes grey blocks */
.skeleton { animation: sk-wait 0s .35s both; }
@keyframes sk-wait { from { visibility: hidden; } to { visibility: visible; } }

/* ---- forms ---- */
.field.has-error { box-shadow: inset 4px 0 0 var(--red-text); padding-left: var(--sp-3); }
.field.has-error input:not([type="checkbox"]):not([type="radio"]), .field.has-error select, .field.has-error textarea,
[aria-invalid="true"]:not([type="checkbox"]):not([type="radio"]) { border-color: var(--red-text) !important; border-width: 2px; }
.field-error { margin: 0; font-size: 14px; font-weight: 650; color: var(--red-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rules-form .input-group { max-width: 16rem; }
.rules-form .actionbar { justify-content: flex-end; }
.field input[type="date"] { min-width: 150px; }
.rq-note-field { flex: 1 1 260px; }
/* switches only where the change applies at once (filter bars); inside dialogs a tick box reads better */
.modal .check.switch input[type="checkbox"] { width: 22px; height: 22px; border-radius: 7px; place-content: center; padding: 0; }
.modal .check.switch input[type="checkbox"]::before { width: 12px; height: 12px; border-radius: 0; box-shadow: none; background: var(--accent-ink); transform: scale(0);
  clip-path: polygon(14% 52%, 0 66%, 40% 100%, 100% 22%, 86% 9%, 39% 70%); }
.modal .check.switch input[type="checkbox"]:checked::before { transform: scale(1); }
.filterbar .check input[type="checkbox"]::before, .check.switch input[type="checkbox"]::before { transition: transform var(--dur-fast) var(--ease); }

/* ---- filter bar: one control height, tidy right-hand tools ---- */
.filterbar { gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); }
.filterbar input:not([type="checkbox"]):not([type="radio"]), .filterbar select, .filterbar .btn, .filterbar .check { min-height: var(--ctl-h); }
.filterbar .filters { gap: var(--sp-2); }
.tbl-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-2) var(--sp-3); margin-left: auto; }
.filterbar.is-empty-list > .search, .filterbar.is-empty-list > .filter-toggle, .filterbar.is-empty-list > .filters,
.filterbar.is-empty-list .result-count, .filterbar.is-empty-list [data-export], .filterbar.is-empty-list [data-clear] { display: none !important; }
.filterbar .daterange { gap: var(--sp-2); }
.filterbar .daterange input { width: 156px; }
.date-pick { position: relative; display: inline-flex; min-width: 0; }
.date-pick input::-webkit-datetime-edit { opacity: 0; }
@supports (-moz-appearance: none) { .date-pick input { color: transparent; } }
.date-text { position: absolute; left: 13px; right: 34px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 14.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-text.is-empty { color: var(--muted); }
.active-filters { display: none; flex-wrap: wrap; gap: var(--sp-2); margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }
.af-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--accent-ink);
  font: inherit; font-size: 13.5px; font-weight: 650; text-align: left; white-space: normal; overflow-wrap: anywhere;
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.af-chip svg.icon { flex: none; }
.af-chip:active { transform: scale(.96); }
.af-chip.af-clear { background: transparent; border-color: var(--field-border); color: var(--ink); padding-right: 12px; }
[data-theme="dark"] .af-chip:not(.af-clear) { color: var(--accent-2); }

/* ---- tables: comfortable rows, readable headers ---- */
.table th { font-size: 12px; letter-spacing: .04em; padding: 12px 14px; height: var(--row-h); }
.table td { padding: 12px 14px; height: var(--row-h); }
.table.compact td, .table.compact th { height: 40px; padding: 8px 10px; }
.table tbody tr:hover { background: var(--surface-2); }
.table.striped tbody tr:nth-child(even) { background: var(--surface-2); }
.table.striped tbody tr:hover { background: var(--surface-3); }
.table .mono { white-space: nowrap; }
.table td.actions { padding-left: var(--sp-4); }
.table td.actions > .btn + .btn { margin-left: var(--sp-2); }
@media (min-width: 721px) {
  /* the list scrolls inside its box, so the header row stays in view */
  [data-body] > .table-wrap { max-height: max(380px, calc(100vh - var(--topbar-h) - 180px)); max-height: max(380px, calc(100dvh - var(--topbar-h) - 180px)); overflow: auto; }
  .table th { z-index: 2; box-shadow: inset 0 -1px 0 var(--line), 0 6px 8px -8px rgba(16, 32, 60, .35); }
  /* a soft shadow at the edge when a wide table can scroll sideways */
  .table-wrap {
    background:
      linear-gradient(90deg, var(--surface) 30%, transparent) left center / 40px 100% no-repeat local,
      linear-gradient(270deg, var(--surface) 30%, transparent) right center / 40px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(16, 32, 60, .2), transparent) left center / 14px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(16, 32, 60, .2), transparent) right center / 14px 100% no-repeat scroll,
      var(--surface);
  }
  .table td.wrap, .table td.col-wide, .table td.vo-wide { min-width: 11rem; }
  .table td.col-mid { min-width: 9rem; }
  .table td:first-child { min-width: 6.5rem; }
  .table td .chip { white-space: normal; }
  .table .wrap, .table .change-old, .table .change-new { overflow-wrap: break-word; }
  .table .change-old, .table .change-new { white-space: nowrap; }
  .table td.actions { width: 1%; }
  .table td.actions .row, .table td.actions .row-tight { flex-wrap: wrap; justify-content: flex-end; max-width: 15rem; margin-left: auto; }
  .table td.actions { white-space: normal; }
}
@media (min-width: 721px) and (max-width: 1439px) { .table .hide-narrow { display: none; } }

/* ---- detail pages ---- */
.actionbar { margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); }
.row > .grow:not(.btn) { min-width: min(100%, 14rem); flex-basis: 14rem; }

/* ---- stat cards fill the row without orphans ---- */
.grid4:has(> .stat), .grid3:has(> .stat), .grid4:has(> .sk-stat) { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }

/* ---- sidebar: the first group label never hides under the brand ---- */
.nav { padding-top: var(--sp-2); }
@media (min-width: 901px) and (max-height: 800px) {
  .nav-item { min-height: 40px; }
  .nav-group { margin: 10px 10px 4px; }
}

/* ---- charts and splits: room for long names ---- */
.bar-row { grid-template-columns: minmax(10rem, 32%) minmax(0, 1fr) auto; }
.inv-split-row { grid-template-columns: minmax(0, 1.6fr) minmax(40px, 1fr) auto; }

/* ---- phones ---- */
@media (max-width: 900px) {
  .menu-item.only-phone { display: flex !important; }
  .user-chip-text { display: none; }
  .topbar-titles { flex: 1 1 auto; min-width: 0; }
  .topbar-sub { display: none; }
  .demo-ribbon { padding: 3px 8px; font-size: 11.5px; }
}
@media (max-width: 720px) {
  .card { padding: var(--sp-4); }
  .stat { padding: var(--sp-3) var(--sp-4); }
  .list-item { padding: var(--sp-3) var(--sp-4); }
  .grid4:has(> .stat), .grid3:has(> .stat), .grid4:has(> .sk-stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .grid4 > .stat:last-child:nth-child(odd), .grid3 > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-label { font-size: 12px; line-height: 1.3; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  /* filter bar: search on top, then Filters + count/export; chips show what is on */
  .filterbar .tbl-tools { display: contents; }
  .filterbar .result-count { margin-left: auto; }
  .filterbar:not(.open) [data-clear] { display: none; }
  .filterbar [data-export] { font-size: 0; gap: 0; width: 44px; padding: 0; }
  .filterbar [data-export] svg.icon { width: 20px; height: 20px; }
  .filterbar.open .filters { padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .filterbar.open .filters > select:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
  .filterbar .daterange { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; }
  .filterbar .daterange > span:first-child { grid-column: 1 / -1; font-size: 13px; color: var(--ink); }
  .filterbar .daterange .date-pick, .filterbar .daterange .date-pick input { width: 100%; }
  .active-filters:not([hidden]) { display: flex; }
  .filterbar.open + .active-filters { display: none; }
  /* table cards: clear labels, tappable links and full-width actions */
  .table.cards td::before { font-size: 12px; letter-spacing: .04em; }
  /* a cell with several pieces wraps them under each other instead of running off the card */
  .table.cards td { flex-wrap: wrap; justify-content: flex-end; column-gap: var(--sp-2); }
  .table.cards td::before { margin-right: auto; }
  .table.cards td:first-child { justify-content: flex-start; }
  .btn.block { white-space: normal; text-align: center; padding-top: 8px; padding-bottom: 8px; line-height: 1.3; }
  .page-head-actions .btn { flex: 1 1 0; min-width: 9.5rem; min-height: 44px; padding: 0 10px; white-space: normal; line-height: 1.2; text-align: center; font-size: 14px; }
  .table.cards td { height: auto; }
  .table.cards tr:hover { background: var(--surface); }
  .table.cards td a.link, .table.cards td .link { display: inline-flex; align-items: center; min-height: 44px; }
  .table.cards td.actions { flex-wrap: wrap; gap: var(--sp-2); }
  .table.cards td.actions > .btn, .table.cards td.actions > .row-tight { flex: 1 1 auto; }
  .table.cards td.actions > .btn + .btn { margin-left: 0; }
  .table.cards td.actions .btn { min-height: 44px; }
  /* sticky action bar: buttons side by side so the bar stays one row */
  .actionbar { flex-wrap: nowrap; padding: var(--sp-2); gap: var(--sp-2); }
  .actionbar .btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 10px; white-space: normal; line-height: 1.2; text-align: center; font-size: 14.5px; }
  /* lists: the side column drops under the text instead of squeezing it */
  .list-item { flex-wrap: wrap; row-gap: 6px; }
  .list-item > .list-main + .list-side { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; }
  .card-head { flex-wrap: wrap; }
  /* tabs: a fade at the right edge says "more" */
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); padding-right: 32px; }
  .rq-sheet-wrap { -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
  .modal-foot { padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-b)); }
  .modal-body { padding: var(--sp-4); }
  .field input[type="date"] { min-width: 0; width: 100%; }
  /* new request: remove button in the corner of each material line, quantity and unit side by side */
  .rq-line { padding-top: 14px; }
  .rq-line > .rq-line-remove { position: absolute; top: 6px; right: 6px; }
  .rq-line > .field:first-child { padding-right: 48px; }
  .rq-line > .field:nth-child(2) { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  /* the demo marker shrinks to a small striped dot so the page title has room */
  .demo-ribbon { font-size: 0; gap: 0; width: 14px; height: 14px; padding: 0; margin: 0 4px; }
  .topbar-title { font-size: 16px; }
}
@media (max-width: 380px) { .tabbar-item { font-size: 11px; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; visibility: visible; }
}

/* ---- Phone cards for tables: label on the left, value in its own column, left-aligned and free to wrap.
        (A long value used to be squeezed into a thin right-aligned strip.) ---- */
@media (max-width: 760px) {
  .table.cards td {
    display: grid; grid-template-columns: minmax(6.25rem, 34%) minmax(0, 1fr); column-gap: 12px; align-items: start;
    justify-content: stretch; text-align: left; padding: 7px 0; line-height: 1.4; overflow-wrap: anywhere;
  }
  .table.cards td + td { border-top: 1px dashed var(--line); }
  .table.cards td::before { margin: 0; padding-top: 2px; line-height: 1.3; }
  .table.cards td > * { min-width: 0; text-align: left; justify-self: start; }
  .table.cards td.num, .table.cards td.num > * { text-align: left; font-variant-numeric: tabular-nums; }
  .table.cards td:first-child { display: block; border-top: 0; padding: 0 0 8px; }
  .table.cards td:first-child + td { border-top: 0; }
  .table.cards td.actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 0; padding-top: 10px; }
  .table.cards td.actions > * { justify-self: auto; }
  .table.cards td a.link, .table.cards td .link { display: inline; min-height: 0; padding: 4px 0; line-height: 1.45; }
  .table.cards td .badge, .table.cards td .chip { justify-self: start; }
}
@media (max-width: 760px) {
  /* every part of a value stays in the value column, stacked under each other */
  .table.cards td::before { grid-column: 1; grid-row: 1 / span 20; }
  .table.cards td > * { grid-column: 2; }
  .table.cards td:first-child > *, .table.cards td.actions > * { grid-column: auto; }
}

/* ---- Phone cards, final shape: the label sits in a fixed left column and the whole value flows beside it ---- */
@media (max-width: 760px) {
  .table.cards td { display: block; position: relative; padding: 8px 0 8px calc(34% + 12px); min-height: 34px; text-align: left; }
  .table.cards td::before { position: absolute; left: 0; top: 9px; width: 34%; margin: 0; padding: 0; grid-column: auto; grid-row: auto; white-space: normal; }
  .table.cards td > * { grid-column: auto; max-width: 100%; }
  .table.cards td > * + * { margin-top: 4px; }
  .table.cards td:first-child { padding: 0 0 8px; min-height: 0; }
  .table.cards td.actions { display: flex; padding: 10px 0 0; min-height: 0; }
  .table.cards td.actions > * + * { margin-top: 0; }
}

/* ---- One menu control per screen size: phones use "More" in the footer, desktops use the button in the header ---- */
@media (max-width: 900px) { .menu-btn { display: none; } .topbar { padding-left: 14px; } }
.side-toggle { display: none; }

/* ==========================================================================
   MOBILE FLOW LAYER - phone flow and clarity fixes. Keep this the LAST block
   in the file: nothing after it may undo these rules.
   New classes:
     stepper states .step.todo (still to come) .step.skipped (not needed) .step-now .step-skip
     .next-step (+ -icon -body -title -text -acts -close)  done card with the next step (App.nextStep)
     .date-say    the chosen date in words under a date box (added by core.js)
     .filters-sheet-head .filters-sheet-title .filters-sheet-foot   phone filter sheet (App.table)
     .more-acts .more-acts-list .more-acts-help   rare actions folded behind one button (order page)
   ========================================================================== */

/* ---- stepper: done = green tick, current = amber + "In progress", still to come = hollow and dashed ---- */
.step.done .step-label { color: var(--ink); font-weight: 650; }
.step.current .step-label { color: var(--ink); font-weight: 800; }
.step.todo .step-dot { background: var(--surface); border-style: dashed; border-color: var(--field-border); color: var(--muted); }
.step.todo .step-label { color: var(--muted); font-weight: 550; }
.step.todo::before { background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 11px); animation: none; }
.step.skipped::before { background: var(--green); }
.step.skipped .step-dot { background: var(--surface-2); border-color: var(--line-strong); color: var(--muted); font-size: 16px; }
.step.skipped .step-label { color: var(--muted); font-weight: 550; text-decoration: line-through; text-decoration-color: var(--line-strong); }
.step-now, .step-skip {
  display: inline-block; margin: 2px 0 0 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 750; line-height: 1.5;
  white-space: nowrap; vertical-align: 1px; text-decoration: none;
}
.step-now { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); }
.step-skip { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.step.skipped .step-label .step-skip { display: inline-block; }
@media (max-width: 720px) {
  .step.todo::before { background: repeating-linear-gradient(180deg, var(--line-strong) 0 5px, transparent 5px 9px); }
  .step { min-height: 40px; }
  .step-label { line-height: 1.3; }
}

/* ---- done card: what just happened, and the natural next step ---- */
.next-step {
  display: flex; align-items: flex-start; gap: var(--sp-3); margin: 0 0 var(--sp-4); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border: 1px solid color-mix(in srgb, var(--green) 45%, transparent); border-left: 5px solid var(--green); border-radius: var(--radius);
  background: var(--green-bg); color: var(--ink); animation: pop-in var(--dur-mid) var(--ease) both;
}
.next-step-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--success-fill); color: var(--on-fill); }
.next-step-icon svg.icon { width: 18px; height: 18px; stroke-width: 2.6; }
.next-step-body { flex: 1 1 auto; min-width: 0; }
.next-step-title { font-weight: 800; font-size: 15.5px; line-height: 1.3; color: var(--green-ink); overflow-wrap: anywhere; }
.next-step-text { margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.next-step-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.next-step-acts .btn { min-height: 44px; }
.next-step-close { flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin: -6px -6px 0 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.next-step-close:hover { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--ink); }
@media (max-width: 720px) {
  .next-step-acts .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---- dates in words under date boxes ---- */
.date-say { display: block; margin-top: 4px; font-size: 13px; font-weight: 650; color: var(--muted); }
.date-say[hidden] { display: none; }

/* ---- lists: a lone chevron stays beside the text instead of dropping to its own line ---- */
@media (max-width: 720px) {
  .list-item > .list-main + .list-side:has(> svg.icon:only-child) { flex: none; width: auto; align-self: center; }
}

/* ---- phones: toasts sit above a sticky action bar, never on top of its buttons ---- */
@media (max-width: 900px) {
  body:has(#view .actionbar) .toast-host { bottom: calc(var(--tabs-h) + var(--safe-b) + var(--tabs-gap) + 84px); }
}

/* ---- phone cards: the row's main action looks like the main action again, links are thumb-sized ---- */
@media (max-width: 760px) {
  .table.cards td.actions .btn.primary, .table.cards td.actions .btn.accent {
    background: var(--brand-2); border-color: var(--brand-2); color: var(--on-fill); box-shadow: var(--shadow-sm);
  }
  [data-theme="dark"] .table.cards td.actions .btn.primary, [data-theme="dark"] .table.cards td.actions .btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .table.cards td.actions .btn.primary svg.icon, .table.cards td.actions .btn.accent svg.icon { color: inherit; }
  .table.cards td.actions a.link, .table.cards td.actions .linkbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; }
}

/* ---- phones: filters open as a sheet from the bottom ("Filters" button with a count; chips show what is on) ---- */
.filters-sheet-head, .filters-sheet-foot { display: none; }
@media (max-width: 720px) {
  .filterbar.open::before { content: ""; position: fixed; inset: 0; z-index: 160; background: color-mix(in srgb, var(--brand) 55%, transparent); animation: fade-in var(--dur-fast) both; }
  .filterbar.open .filters {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 161; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3);
    max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 0 var(--sp-4);
    border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; background: var(--surface); box-shadow: var(--shadow-lg);
    animation: sheet-in var(--dur-mid) var(--ease) both;
  }
  .filterbar.open .filters > * { grid-column: 1 / -1; }
  .filterbar.open .filters-sheet-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); position: sticky; top: 0; z-index: 1;
    margin: 0 calc(-1 * var(--sp-4)); padding: var(--sp-3) var(--sp-2) var(--sp-3) var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .filters-sheet-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--ink); }
  .filterbar.open .filters-sheet-foot {
    display: flex; gap: var(--sp-2); position: sticky; bottom: 0; z-index: 1; margin: var(--sp-1) calc(-1 * var(--sp-4)) 0;
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line);
  }
  .filters-sheet-foot .btn { flex: 1 1 0; min-height: 48px; }
  .filters-sheet-foot .btn.primary { flex-grow: 2; }
  .filterbar.open .filters select, .filterbar.open .filters .filter { width: 100%; max-width: none; min-height: 48px; }
  .filterbar.open .filters .daterange { display: grid; }
  html.filter-sheet-open, html.filter-sheet-open body { overflow: hidden; }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  .filterbar.open .filters, .filterbar.open::before { animation: none; }
}
/* the page's entry animation must not leave a transform behind: it would trap fixed sheets inside the page */
.view-page { animation-fill-mode: backwards; }
html.filter-sheet-open .view-page { animation: none; transform: none; }
/* rows of a list never shrink below their content (a scrolling list used to squeeze rows so they overlapped) */
.list > .list-item, .list > a.list-item { flex-shrink: 0; }
.due-list { max-height: none; overflow: visible; }
/* ---- "Change this order": rare actions folded behind one button ---- */
.more-acts { flex: 1 1 100%; }
.more-acts > summary { list-style: none; cursor: pointer; }
.more-acts > summary::-webkit-details-marker { display: none; }
.more-acts > summary::after { content: "+"; margin-left: auto; padding-left: 8px; font-size: 18px; line-height: 1; transition: transform var(--dur-fast) var(--ease); }
.more-acts[open] > summary::after { transform: rotate(45deg); }
.more-acts-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.more-acts-help { flex: 1 1 100%; }
@media (min-width: 721px) { .more-acts { flex: 0 1 auto; } }
@media (max-width: 720px) {
  .more-acts > summary { width: 100%; justify-content: flex-start; min-height: 44px; }
  .more-acts-list .btn { flex: 1 1 calc(50% - var(--sp-2)); min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .more-acts > summary::after { transition: none; } }
/* payment and bill dialogs: the order summary in two columns, so the form starts higher on a phone */
@media (max-width: 720px) {
  .vo-paybox .info-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .vo-paybox .info-list > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* phones: label/value lists in two columns, so a card is half as tall */
@media (max-width: 720px) {
  .info-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); }
  .info-list > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dash-pp .card-foot { flex-wrap: nowrap; }
  .dash-pp .card-foot .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
}
/* report filters on phones: project on its own line, dates side by side, quick ranges, then the Show button */
@media (max-width: 720px) {
  .rep-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .rep-filter > .rep-filter-grid { display: contents; }
  .rep-filter > .rep-filter-grid > .field:first-child, .rep-filter > .rep-filter-grid > [data-ps-partner] { grid-column: 1 / -1; }
  .rep-filter > .quick-picks { grid-column: 1 / -1; order: 5; margin-top: 0; }
  .rep-filter > .rep-filter-grid > .rep-apply { grid-column: 1 / -1; order: 6; }
  .rep-filter > .rep-filter-grid > .rep-apply > .field-label { display: none; }
  .rep-filter > .hint { grid-column: 1 / -1; order: 7; margin-top: 0; }
  .rep-filter > :not(.rep-filter-grid):not(.quick-picks):not(.hint) { grid-column: 1 / -1; order: 8; }
}
/* phone numbers are easy to tap */
@media (max-width: 720px) { a.link[href^="tel:"] { display: inline-flex; align-items: center; min-height: 40px; } }

/* ==========================================================================
   ALERTS LAYER - browser push prompt (public/js/pwa.js) and alert screens.
   Added by the alert-screens agent. Screen-only rules live in css/views-alerts.css.
   New classes:
     .push-ask (+ -icon -body -title -text -acts)   one-time "Get alerts on this phone" card on Home
   Also: a switch that is on now fills its track with the accent colour (.check.switch and filter-bar switches).
   ========================================================================== */
.push-ask {
  display: flex; align-items: center; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; margin: 0 0 var(--sp-4);
  padding: var(--sp-4); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-left: 5px solid var(--accent);
  background: var(--accent-soft); color: var(--ink); animation: pop-in var(--dur-mid) var(--ease) both;
}
[data-theme="dark"] .push-ask { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.push-ask-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.push-ask-icon svg.icon { width: 20px; height: 20px; }
.push-ask-body { flex: 1 1 220px; min-width: 0; }
.push-ask-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.3; color: var(--ink); }
.push-ask-text { margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.push-ask-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.push-ask-acts .btn { min-height: 44px; }
html.is-native-app .push-ask { display: none; }
@media (max-width: 720px) {
  .push-ask-acts { width: 100%; }
  .push-ask-acts .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .push-ask { animation: none; } }
/* switches that are on read as on: the track fills with the accent colour (it used to stay grey, only the knob moved) */
.check.switch input[type="checkbox"]:checked, .filterbar .check input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.modal .check.switch input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }

/* ---- Any dropdown anywhere in the app gets the app's look, not the browser's bare one ---- */
.view select, .modal select, .panel select {
  -webkit-appearance: none; appearance: none; min-height: var(--ctl-h, 44px); max-width: 100%; padding: 8px 36px 8px 12px;
  border: 1px solid var(--field-border, var(--line-strong)); border-radius: 12px; background-color: var(--surface); color: var(--text);
  font: inherit; font-size: 14.5px; line-height: 1.3; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.view select:hover, .modal select:hover, .panel select:hover { border-color: var(--accent); }
.view select:focus-visible, .modal select:focus-visible, .panel select:focus-visible { outline: 2px solid var(--focus-ring, var(--accent)); outline-offset: 2px; }
.view select:disabled, .modal select:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Sign-in skyline: a soft halo round the sun instead of a flat disc, and it holds up on wide screens ---- */
.sk-sun-glow { opacity: .42; filter: blur(26px); }
.sk-sun { filter: drop-shadow(0 0 10px rgba(243, 198, 89, .8)) drop-shadow(0 0 34px rgba(243, 198, 89, .35)); }
.sk-cloud { opacity: .055; filter: blur(2px); }
.sk-cloud.c2 { opacity: .04; }
@media (min-width: 901px) {
  /* on a wide or full-screen window the picture keeps its proportions and sits on the bottom edge, never stretched or cropped into the sun */
  .skyline { max-height: min(58vh, 44vw); margin-top: auto; }
  .auth-hero { justify-content: flex-start; gap: 28px; }
}
@media (prefers-reduced-motion: reduce) { .sk-sun-glow { animation: none; } }

/* the sun's halo spills past the edge of the drawing: let it, so it is never cut in a straight line */
.skyline { overflow: visible; }
.sk-sun-glow { filter: blur(22px); }

/* ==========================================================================
   PRINT & SHARE LAYER - letterhead printing, the one "Share / Print" button,
   History sections, the Letterhead and Sharing settings. Added by the
   print-share screens agent. Screen-only rules live in css/views-share.css.
   New classes:
     .print-frame                the hidden frame App.printHtml prints from
     .share-btn                  the "Share / Print" button (same look on every record and list)
     .share-sheet (+ -opts -acts -act -act-icon -act-body -act-title -act-sub -note -links)
     .opt-row                    a switch row inside the share sheet (switches stay switches there)
     .hist (+ -item -when -who -what -kind)   the History section of a record
     .doc-preview (+ -frame -bar)              a live letterhead preview (scaled sheet of A4)
   ========================================================================== */
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.share-btn[hidden] { display: none !important; }
.share-sheet { display: grid; gap: var(--sp-4); }
.share-sheet-opts { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.share-sheet-sels { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-1); }
.share-sheet-sels select { width: 100%; }
/* inside the share sheet an on/off choice stays a switch (it applies at once, nothing is saved) */
.modal .check.switch.opt-row { min-height: 40px; gap: 10px; font-size: 14.5px; color: var(--ink); }
.modal .check.switch.opt-row small { display: block; font-size: 12.5px; color: var(--muted); }
.modal .check.switch.opt-row input[type="checkbox"] { width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); place-content: center start; padding: 0 2px; }
.modal .check.switch.opt-row input[type="checkbox"]::before { width: 18px; height: 18px; border-radius: 50%; clip-path: none; background: #fff; transform: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .28); }
.modal .check.switch.opt-row input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.modal .check.switch.opt-row input[type="checkbox"]:checked::before { transform: translateX(16px); }
.share-sheet-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-2); }
.share-act { display: flex; align-items: center; gap: var(--sp-3); min-height: 60px; padding: var(--sp-2) var(--sp-3); text-align: left; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.share-act:hover { border-color: var(--accent); background: var(--accent-soft); }
.share-act:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.share-act.is-loading { opacity: .6; pointer-events: none; }
.share-act-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); color: var(--ink); }
.share-act[data-share-act="whatsapp"] .share-act-icon { color: var(--green); }
.share-act-body { display: grid; gap: 1px; min-width: 0; }
.share-act-title { font-weight: 750; font-size: 15px; }
.share-act-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.share-sheet-note { display: flex; gap: 6px; align-items: center; }
.share-made { display: grid; gap: var(--sp-2); margin: var(--sp-3) 0; padding: var(--sp-3); border: 1px solid color-mix(in srgb, var(--green) 45%, transparent); border-left: 5px solid var(--green); border-radius: var(--radius); background: var(--green-bg); }
.share-made input { width: 100%; font-size: 13px; }
.hist .tl-body .badge { margin: 2px 0; }
@media (max-width: 720px) {
  .share-sheet-acts { grid-template-columns: 1fr; }
  .share-act { min-height: 56px; }
}

/* ===== Sign-in extras (keep me signed in, Caps Lock, Android app button) and Devices signed in ===== */
.auth-card .keep-signed { align-items: flex-start; gap: 10px; margin-top: calc(var(--sp-1) * -1); font-weight: 650; color: var(--ink); }
.auth-card .keep-signed input { margin-top: 1px; }
.keep-signed .keep-hint { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; line-height: 1.4; color: var(--muted); }
.caps-warn { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--amber-bg); color: var(--amber-ink); font-size: 13.5px; font-weight: 650; }
.caps-warn[hidden] { display: none; }
.caps-warn svg { width: 16px; height: 16px; flex: none; }
.auth-app-btn { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin-top: var(--sp-3); min-height: 48px; text-decoration: none; }
.auth-app-btn .auth-app-ver { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.dev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.dev-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.dev-row.is-this { border-color: color-mix(in srgb, var(--green) 50%, var(--line)); background: var(--green-bg); }
.dev-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--ink); }
.dev-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dev-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.dev-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; overflow-wrap: anywhere; }
.dev-row > .btn { flex: none; }
.dev-foot { margin-top: var(--sp-3); }
.dev-foot[hidden] { display: none; }
@media (max-width: 480px) {
  .dev-row { flex-wrap: wrap; }
  .dev-row > .btn { width: 100%; justify-content: center; }
}

/* on narrow screens the skyline is cropped to its strip again, so it never rides over the headline */
@media (max-width: 900px) { .skyline { overflow: hidden; } .sk-sun-glow { filter: blur(14px); } }
