/* Ambar design system.

   One rule per thing. A part is styled once, in its own section. The only repeats are
   its narrow-box, touch, tablet, phone and reduced-motion variants, which sit in
   "Responsive" and "Motion" at the end (the folding table keeps its own with the tables).

   Contents
    1. Tokens                      light, dark, touch
    2. Reset and base
    3. Type
    4. Layout helpers              row, stack, cols, icon, query containers
    5. Buttons
    6. Fields and inputs
    7. Tags, avatars, cards, notes
    8. Tables                      base, paper, matrix, reports, entry, row links, fold
    9. Display parts               stats, lists, calendar, board
   10. Charts
   11. Layout parts                tabs, accordion, steps, tree, dialogs, palette, menus
   12. Feedback                    toast, tooltip, popover, spinner
   13. Voucher parts
   14. Stock, accounts and print parts
   15. Navigation and action parts
   16. AI parts                    samples, bill scan, ask page
   17. App parts                   the phone frame
   18. Store parts
   19. Shell and catalogue pages   side menu, main column, phone top bar, part cards
   20. App screens                 page head, list bar, form bar, schema-drawn areas
   21. Responsive                  container queries, touch, desk, tablet, phone
   22. Motion preferences

   Source order still decides ties between rules of equal weight. Where a block depends on
   its order, a comment says so. */


/* ---------- 1. Tokens ----------
   Colours, radii, control height, shadows, timing and layers. Parts only ever use these. */
:root {
  --page: 1320px; /* the widest a page grows: room for a bill and its totals, or a full list */
  --red: #c00d0d;            /* the logo */
  --paper: #f7f5f1;
  --surface: #ffffff;
  --sunken: #f0ede7;
  --ink: #1a1714;
  --ink-2: #5a554e;
  --ink-3: #938c83;
  --line: #ebe6de;
  --line-2: #dbd4c9;
  --accent: var(--red);
  --accent-soft: #fbeaea;
  --on-accent: #ffffff;
  --pos: #18794e;  --pos-soft: #e3f3ea;
  --neg: #c00d0d;  --neg-soft: #fbeaea;
  --warn: #9a6200; --warn-soft: #fbf0d6;
  --info: #1d5fa8; --info-soft: #e4eefa;
  --c1: #c00d0d; --c2: #2b3a55; --c3: #d99a1c; --c4: #2f8f83; --c5: #a8a29a;

  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 8px; --r-lg: 12px;
  --h: 36px;                 /* control height */
  --shadow-1: 0 1px 2px rgb(26 23 20 / .06);
  --shadow-2: 0 16px 40px -12px rgb(26 23 20 / .22), 0 2px 6px rgb(26 23 20 / .06);
  --shadow-card: 0 1px 2px rgb(26 23 20 / .04), 0 8px 20px -14px rgb(26 23 20 / .12);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t-fast: 120ms; --t: 200ms;
  --z-sticky: 10; --z-menu: 20; --z-dialog: 30; --z-toast: 40;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #141210; --surface: #1d1a17; --sunken: #100e0c;
  --ink: #f0ebe4; --ink-2: #b5aea5; --ink-3: #7d766d;
  --line: #2d2925; --line-2: #403a34;
  --accent: #f0524b; --accent-soft: #3a1513; --on-accent: #1a0706;
  --pos: #4cc38a; --pos-soft: #10301f;
  --neg: #f0524b; --neg-soft: #3a1513;
  --warn: #e3b341; --warn-soft: #33270a;
  --info: #70a7ee; --info-soft: #12253d;
  --c1: #f0524b; --c2: #8ea2c9; --c3: #e3b341; --c4: #5cc2b4; --c5: #6f6961;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 10px 32px rgb(0 0 0 / .55);
  --shadow-card: 0 1px 2px rgb(0 0 0 / .4);
  color-scheme: dark;
}
/* Touch screens get taller controls. The rest of the touch rules are under Responsive. */
@media (pointer: coarse) { :root { --h: 44px; } }


/* ---------- 2. Reset and base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 var(--font); letter-spacing: -.003em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 20%, transparent); }
[hidden] { display: none !important; }


/* ---------- 3. Type ---------- */
.t-display { font-size: 34px; line-height: 1.1; font-weight: 750; letter-spacing: -.03em; }
.t-title { font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.t-head { font-size: 16px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.t-body { font-size: 14px; }
.t-small { font-size: 12.5px; }
.t-caps { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }


/* ---------- 4. Layout helpers ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; } .row.between { justify-content: space-between; }
/* a stack keeps its rows together at the top when its box is taller than its content */
.stack { display: grid; gap: 12px; align-content: start; } .stack.s { gap: 6px; } .stack.l { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 200px)), 1fr)); }
.cols.two-one { grid-template-columns: 2fr 1fr; }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.scroll-x { overflow-x: auto; }
/* Query containers. Parts never look at the window. They look at the space they were given
   (container queries), so the same part works in a full page, a side panel or a phone.
   These are the boxes that space is measured from. */
.part > .body, .card > .body, .resize, .scroll-x, .sarea { container-type: inline-size; }


/* ---------- 5. Buttons ----------
   Order matters in this block. .brand and .danger sit before :hover, so a hovered button
   takes the shared hover border; .primary and .ghost sit after it and keep their own.
   :active sits first so the coloured variants keep their own shadow when pressed. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h); padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 1.5px rgb(26 23 20 / .07), inset 0 -1px 0 rgb(26 23 20 / .035);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:active { transform: translateY(.5px); box-shadow: inset 0 1px 2px rgb(26 23 20 / .1); }
.btn.brand { background: linear-gradient(color-mix(in srgb, var(--accent) 90%, white), var(--accent)); border-color: var(--accent); color: var(--on-accent);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 45%, transparent), inset 0 1px 0 rgb(255 255 255 / .2); }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 45%, var(--line-2)); }
.btn:hover { background: color-mix(in srgb, var(--sunken) 70%, var(--surface)); border-color: color-mix(in srgb, var(--ink-3) 55%, var(--line-2)); text-decoration: none; }
.btn.primary { background: linear-gradient(color-mix(in srgb, var(--ink) 86%, var(--paper)), var(--ink)); border-color: var(--ink); color: var(--paper);
  box-shadow: 0 1px 2px rgb(26 23 20 / .3), inset 0 1px 0 rgb(255 255 255 / .14); }
.btn.brand:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.danger:hover { background: var(--neg-soft); }
.btn.primary:hover { background: linear-gradient(color-mix(in srgb, var(--ink) 78%, var(--paper)), color-mix(in srgb, var(--ink) 92%, var(--paper))); border-color: var(--ink); }
.btn.ghost { border-color: var(--line-2); background: transparent; box-shadow: none; }
.btn.ghost:hover { border-color: var(--ink-3); background: color-mix(in srgb, var(--sunken) 70%, transparent); }
.btn.ghost:active { box-shadow: none; }
.btn.icon.ghost { border-color: transparent; } .btn.icon.ghost:hover { border-color: transparent; background: var(--sunken); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12.5px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 15px; border-radius: 10px; }
.btn.icon { width: var(--h); padding: 0; } .btn.icon.sm { width: 26px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled:hover { transform: none; }
.kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface); color: var(--ink-2); box-shadow: 0 1px 0 var(--line-2); }


/* ---------- 6. Fields and inputs ---------- */
.field { display: grid; gap: 4px; min-width: 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.help { font-size: 12px; color: var(--ink-3); }
.input { width: 100%; height: var(--h); padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
  box-shadow: inset 0 1px 1px rgb(26 23 20 / .035); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea.input { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select.input { appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c867e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
.input.num { text-align: right; }
.input.invalid { border-color: var(--neg); }

/* an input with a fixed piece before or after it */
.affix { display: flex; align-items: stretch; height: var(--h); border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); overflow: hidden;
  box-shadow: inset 0 1px 1px rgb(26 23 20 / .035); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.affix:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.affix > .input { border: 0; height: auto; box-shadow: none; border-radius: 0; background: none; }
.affix > .pre, .affix > .suf { display: flex; align-items: center; padding: 0 9px; color: var(--ink-3); background: color-mix(in srgb, var(--sunken) 65%, var(--surface)); font-size: 13px; font-weight: 550; gap: 6px; }
.affix > .pre { border-right: 1px solid var(--line); } .affix > .suf { border-left: 1px solid var(--line); }
.affix > .plain { background: none; border: 0; padding-right: 0; }
.affix > button { border: 0; cursor: pointer; }
.affix > select.pre { appearance: none; border: 0; border-right: 1px solid var(--line); }
.affix > button.suf:hover { background: var(--sunken); color: var(--ink); }
.affix > .pre.plain { padding-left: 12px; } .affix > .suf.plain { padding-right: 8px; }

/* check, radio, switch: native inputs, accent coloured */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 20px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

/* chips: a hidden input and a visible span */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); font-size: 13px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.chip span:hover { border-color: var(--ink-3); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip input:disabled + span { opacity: .45; text-decoration: line-through; cursor: not-allowed; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--sunken); border: 1px solid var(--line); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 4px 12px; border-radius: 6px; font-size: 13px; font-weight: 550; color: var(--ink-2);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* choice cards */
.cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.cards label { cursor: pointer; }
.cards input { position: absolute; opacity: 0; pointer-events: none; }
.cards span { display: grid; gap: 2px; height: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.cards span:hover { border-color: var(--ink-3); }
.cards b { font-weight: 600; } .cards small { color: var(--ink-3); font-size: 12px; }
.cards input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.cards input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* range, and a two-thumb range made of two inputs on one track */
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.dual { position: relative; height: 20px; }
.dual input { position: absolute; inset: 0; pointer-events: none; appearance: none; background: none; }
.dual input::-webkit-slider-thumb { pointer-events: auto; }
.dual input::-moz-range-thumb { pointer-events: auto; }
.dual::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 4px; border-radius: 4px; background: var(--line-2); }

.stepper { display: inline-flex; }
.stepper .input { width: 56px; border-radius: 0; text-align: center; margin: 0 -1px; position: relative; }
.stepper .btn:first-child { border-radius: var(--r) 0 0 var(--r); } .stepper .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }

.stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.stars input { position: absolute; opacity: 0; }
.stars label { cursor: pointer; color: var(--line-2); }
.stars label .i { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--c3); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--sw); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }

/* file drop, one-time code, signature pad, edit in place */
.drop { display: grid; place-items: center; gap: 6px; padding: 22px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-2); text-align: center; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop .i { width: 22px; height: 22px; }
.otp { display: flex; gap: 6px; }
.otp .input { width: 38px; height: 44px; padding: 0; text-align: center; font: 600 18px var(--mono); }
.sign { width: 100%; height: 110px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface) linear-gradient(var(--line), var(--line)) no-repeat 12px 82px / calc(100% - 24px) 1px; touch-action: none; cursor: crosshair; display: block; }
.inline-edit { padding: 2px 6px; margin: -2px -6px; border-radius: 4px; border-bottom: 1px dashed var(--line-2); }
.inline-edit:hover { background: var(--sunken); }
.inline-edit:focus { outline: 2px solid var(--accent); background: var(--surface); border-color: transparent; }


/* ---------- 7. Tags, avatars, cards, notes ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; width: fit-content; max-width: 100%; height: 22px; padding: 0 8px;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent); border-radius: 20px; background: var(--sunken); color: var(--ink-2);
  font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.tag.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.pos { background: var(--pos-soft); color: var(--pos); } .tag.neg { background: var(--neg-soft); color: var(--neg); }
.tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.info { background: var(--info-soft); color: var(--info); }
.tag.count { min-width: 20px; height: 20px; padding: 0 6px; justify-content: center; border: 0; background: var(--accent); color: var(--on-accent); }
.tag .i { width: 12px; height: 12px; } .tag .spin { width: 10px; height: 10px; }
/* a tag inside a field label is smaller */
.label .tag { height: 17px; padding: 0 6px; font-size: 10.5px; margin-left: 4px; vertical-align: 1px; }

.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--c2); color: #fff; font-size: 12px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; } .avatar.sq { border-radius: var(--r); }
.avatar.a2 { background: var(--c3); } .avatar.a3 { background: var(--c4); } .avatar.a4 { background: var(--c1); }
.avatars { display: flex; } .avatars .avatar { border: 2px solid var(--surface); margin-left: -8px; } .avatars .avatar:first-child { margin-left: 0; }
.avatars .more { background: var(--sunken); color: var(--ink-2); }
/* an avatar inside a button is a small mark, not a full-size one */
.btn .avatar { width: 22px; height: 22px; font-size: 10px; margin-left: -3px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
/* a card holding a table or a line grid keeps its rows' backgrounds (the grey footer, a hovered row) inside its rounded corners */
.card.scroll-x, .card:has(> .scroll-x, > table) { overflow: hidden; overflow: clip; }
.card.pad { padding: 14px 16px; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; }
.card > .body { padding: 14px; }   /* 16px from 761px up and 12px on phones, see Responsive */
.card > footer { padding: 10px 16px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, var(--surface)); border-radius: 0 0 var(--r-lg) var(--r-lg); }
/* A table inside a card must not poke its square corners over the card's rounded ones. */
.card > .scroll-x:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.card > .scroll-x:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }
.card.scroll-x, .card > .scroll-x { overflow-y: hidden; }

.note { display: flex; gap: 10px; padding: 11px 13px; border: 1px solid color-mix(in srgb, currentColor 0%, var(--line)); border-radius: 10px; background: var(--surface); }
.note .i { margin-top: 2px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 28%, transparent); background: var(--warn-soft); } .note.warn .i { color: var(--warn); }
.note.neg { border-color: color-mix(in srgb, var(--neg) 28%, transparent); background: var(--neg-soft); } .note.neg .i { color: var(--neg); }
.note.pos { border-color: color-mix(in srgb, var(--pos) 28%, transparent); background: var(--pos-soft); } .note.pos .i { color: var(--pos); }
.note.info { border-color: color-mix(in srgb, var(--info) 28%, transparent); background: var(--info-soft); } .note.info .i { color: var(--info); }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--info-soft); color: var(--info); border-radius: var(--r); font-weight: 550; }
.banner .btn { margin-left: auto; }


/* ---------- 8. Tables ----------
   Order matters here: the special tables (paper, matrix, reports, entry) come after the base
   rules and in this order, because several of them tie on weight for the same cell. */
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 10px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: color-mix(in srgb, var(--sunken) 55%, var(--surface)); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: color-mix(in srgb, var(--sunken) 55%, var(--surface)); }
.table tbody tr:last-child td { border-bottom-color: transparent; }
.table tfoot td { font-weight: 700; padding: 11px 14px; border-top: 1px solid var(--line); border-bottom: 0; background: color-mix(in srgb, var(--sunken) 50%, var(--surface)); }
.table th.num { text-align: right; }
.table .sort::after { content: " ↓"; color: var(--accent); }
.table a { font-weight: 600; }
.table td.faint a { color: var(--ink-3); }

/* a table printed on paper: no fills, tighter cells */
.paper .table th, .paper .table td { border-color: #d6d0c6; background: none; color: inherit; padding: 6px 8px; }

/* matrix: a grid of small inputs, sizes across and colours down */
.matrix th, .matrix td { text-align: center; padding: 5px 6px; } .matrix td:first-child, .matrix th:first-child { text-align: left; padding-left: 12px; }
.matrix .input { width: 54px; text-align: center; padding: 0 4px; height: 30px; }

/* reports: rows that drill down, a pivot with heat, and a share-of-total column */
.drill td:first-child { padding-left: calc(12px + var(--lvl, 0) * 22px); }
.drill [data-toggle] { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 600; text-align: left; }
.drill [data-toggle]:hover { background: var(--sunken); }
.drill [data-toggle] .i { color: var(--ink-3); transition: transform var(--t-fast); }
.drill [data-toggle][aria-expanded="true"] .i { transform: rotate(90deg); }
.drill [data-toggle] small { font-weight: 500; color: var(--ink-3); }
.drill tr.lvl0 td { font-weight: 600; }
.drill tr.leaf td { background: color-mix(in srgb, var(--sunken) 45%, var(--surface)); }
.pivot td.heat0 { background: var(--neg-soft); } .pivot td.heat1 { background: color-mix(in srgb, var(--pos-soft) 45%, transparent); }
.pivot td.heat2 { background: color-mix(in srgb, var(--pos-soft) 75%, transparent); } .pivot td.heat3 { background: var(--pos-soft); font-weight: 700; }
.pivot td:not(:first-child) { cursor: pointer; } .pivot td:not(:first-child):hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.sharecol { width: 150px; white-space: nowrap; } th.sharecol { text-align: left; }
.share { display: inline-block; width: 84px; height: 6px; margin-right: 8px; border-radius: 6px; background: var(--sunken); vertical-align: middle; overflow: hidden; }
.share i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.drill tr:not(.lvl0) .share i { background: var(--c2); }
.pct { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* entry: a table whose cells are inputs, for voucher lines */
.table.entry th { padding: 9px 8px; } .table.entry th:first-child { padding-left: 14px; }
.table.entry td { padding: 4px 4px; } .table.entry td:first-child { padding-left: 14px; color: var(--ink-3); width: 34px; }
.table.entry .input { border-color: transparent; background: none; height: 30px; padding: 0 8px; box-shadow: none; }
.table.entry .input:hover { border-color: var(--line-2); } .table.entry .input:focus { background: var(--surface); border-color: var(--accent); }
.table.entry td.num { padding-right: 14px; font-weight: 600; }
.table.entry tfoot td { padding: 10px 8px; } .table.entry tfoot td.num { padding-right: 14px; }

/* rowlink: the first cell's link covers the whole row */
.table.rowlink tbody tr { position: relative; } .table.rowlink td:first-child a::after { content: ""; position: absolute; inset: 0; }
.table.rowlink tbody tr:has(a):hover { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); cursor: pointer; }

/* A table marked .fold turns each row into a small card when its box is narrow.
   ambar.js copies the column headings onto the cells as data-label. */
@container (max-width: 560px) {
  .table.fold thead { display: none; }
  .table.fold tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table.fold td, .table.fold.entry td, .table.fold.entry td:first-child { display: grid; gap: 2px; align-content: start; padding: 0; border: 0; width: auto; text-align: left; white-space: normal; color: inherit; min-width: 0; }
  .table.fold td::before { content: attr(data-label); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
  .table.fold td[data-label=""]::before { display: none; }
  .table.fold td.num { text-align: left; }
  /* kept as it was: an entry table's number cells hold their right padding when folded */
  .table.entry td.num { padding-right: 14px; }
  .table.fold td.lead { grid-column: 1 / -1; font-weight: 600; }
  .table.fold td.tail { grid-column: 1 / -1; justify-items: end; }
  .table.fold td[data-label="#"], .table.fold.entry td[data-label="#"]:first-child { display: none; }
  .table.fold.entry .input { border-color: var(--line-2); background: var(--surface); height: var(--h); }
  .table.fold tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 10px 12px; background: color-mix(in srgb, var(--sunken) 50%, var(--surface)); border-top: 1px solid var(--line-2); }
  .table.fold tfoot td { padding: 0; border: 0; background: none; } .table.fold tfoot td:empty { display: none; }
  .sharecol { display: none; }
}


/* ---------- 9. Display parts ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.stat { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.stat b { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hero b { font-size: 38px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.dl dt { color: var(--ink-3); } .dl dd { font-weight: 550; }
.person { display: flex; align-items: center; gap: 10px; } .person small { display: block; color: var(--ink-3); font-size: 12px; }
.bar { height: 6px; border-radius: 6px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; width: calc(var(--v) * 1%); background: var(--accent); border-radius: 6px; }
.sample-run .bar { max-width: 320px; margin: 6px 0 4px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 28px 16px; text-align: center; color: var(--ink-2); }
.empty .i { width: 28px; height: 28px; color: var(--ink-3); }
.sk { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--sunken) 25%, var(--line) 37%, var(--sunken) 63%) 0 0 / 400% 100%; animation: sk 1.4s ease infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }

.timeline { display: grid; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-3); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; } .timeline li:last-child { padding-bottom: 0; }
.timeline li.on::before { border-color: var(--accent); background: var(--accent); }
.timeline small { display: block; color: var(--ink-3); font-size: 12px; }

.list > li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.list .grow { min-width: 0; overflow-wrap: anywhere; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal > b { font-size: 11px; color: var(--ink-3); text-align: center; padding: 4px 0; font-weight: 600; }
.cal > button { aspect-ratio: 1; border: 0; border-radius: var(--r); background: none; cursor: pointer; font-variant-numeric: tabular-nums; }
.cal > button:hover { background: var(--sunken); }
.cal > button.today { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 700; }
.cal > button.on { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal.big { gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal.big > b { background: var(--sunken); border-bottom: 1px solid var(--line); }
.cal.big > div { min-width: 0; min-height: 68px; padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink-3); background: var(--surface); overflow: hidden; }
.cal.big > div:nth-child(7n) { border-right: 0; }
.cal.big > div.today { color: var(--accent); font-weight: 700; }
.cal.big .ev { display: block; margin-top: 3px; padding: 1px 5px; border-radius: 3px; background: var(--info-soft); color: var(--info); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal.big .ev.neg { background: var(--neg-soft); color: var(--neg); } .cal.big .ev.pos { background: var(--pos-soft); color: var(--pos); }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.board > section { background: var(--sunken); border-radius: var(--r-lg); padding: 8px; display: grid; gap: 8px; align-content: start; }
.board h4 { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 4px; }
.board article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; box-shadow: var(--shadow-1); display: grid; gap: 4px; }


/* ---------- 10. Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.bars > div { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 4px; justify-items: center; align-content: end; height: 100%; font-size: 11px; color: var(--ink-3); }
.bars i { display: block; width: 100%; height: calc(var(--v) * 1%); min-height: 2px; background: var(--c2); border-radius: 3px 3px 0 0; align-self: end; }
.bars .hi i { background: var(--c1); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.donut { width: 120px; height: 120px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c1) 0 42%, var(--c2) 0 68%, var(--c3) 0 87%, var(--c4) 0);
  mask: radial-gradient(circle, transparent 37%, #000 38%); -webkit-mask: radial-gradient(circle, transparent 37%, #000 38%); }
.legend { display: grid; gap: 5px; font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend li::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--k); }
.legend b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.stackbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.stackbar i { display: block; width: calc(var(--v) * 1%); background: var(--k); }
.rank li { position: relative; display: flex; justify-content: space-between; padding: 6px 8px; margin-bottom: 3px; border-radius: 4px; isolation: isolate; }
.rank li::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 1%); background: var(--accent-soft); border-radius: 4px; z-index: -1; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--sunken); }
.heat i:nth-child(3n) { background: color-mix(in srgb, var(--c1) 22%, var(--sunken)); }
.heat i:nth-child(5n) { background: color-mix(in srgb, var(--c1) 50%, var(--sunken)); }
.heat i:nth-child(7n) { background: var(--sunken); }
.heat i:nth-child(11n), .heat i:nth-child(13n) { background: var(--c1); }


/* ---------- 11. Layout parts ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.acc { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.acc + .acc { margin-top: -1px; border-radius: 0; }
.acc summary { padding: 10px 12px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.acc summary::after { content: "+"; color: var(--ink-3); } .acc[open] summary::after { content: "−"; }
.acc > div { padding: 0 12px 12px; color: var(--ink-2); }
.steps { display: flex; gap: 6px; counter-reset: s; }
.steps li { flex: 1; counter-increment: s; padding-top: 8px; border-top: 3px solid var(--line-2); font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.steps li::before { content: counter(s) ". "; }
.steps li.done { border-color: var(--ink); color: var(--ink); } .steps li.now { border-color: var(--accent); color: var(--accent); }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.crumbs a { color: var(--ink-2); } .crumbs b { color: var(--ink); font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar h3 { margin-right: auto; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager .btn[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tree details { padding-left: 14px; } .tree > details { padding-left: 0; }
.tree summary, .tree .leaf { display: flex; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 4px; cursor: pointer; list-style: none; }
.tree summary::before { content: "▸"; color: var(--ink-3); font-size: 11px; width: 10px; } .tree details[open] > summary::before { content: "▾"; }
.tree .leaf { padding-left: 30px; } .tree summary:hover, .tree .leaf:hover { background: var(--sunken); }
.tree small { margin-left: auto; color: var(--ink-3); }
/* a named area of a screen layout, drawn as a dashed box in the catalogue */
.area { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 22px 10px 10px; position: relative; min-height: 54px; }
.area::before { content: attr(data-area); position: absolute; top: 4px; left: 8px; font: 10.5px var(--mono); color: var(--accent); }

/* dialog, drawer and the command palette */
dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(20 18 16 / .45); }
dialog > form { display: grid; gap: 12px; padding: 18px; }
dialog.wide { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; border-radius: 0; width: min(380px, 100vw); }
dialog.palette { margin-top: 12vh; width: min(520px, calc(100vw - 32px)); border-radius: 16px; overflow: hidden; }
dialog.palette > form { padding: 0; gap: 0; }
dialog.palette .input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; height: 46px; box-shadow: none; font-size: 15px; }
.palette .none { padding: 14px 16px 18px; color: var(--ink-3); }
.cmds { padding: 6px; } .cmds li { display: flex; align-items: center; gap: 10px; padding: 0; border-radius: var(--r); cursor: pointer; }
.cmds li:hover, .cmds li.on { background: var(--sunken); } .cmds .kbd { margin-left: auto; }
.cmds .t-caps { padding: 8px 10px 4px; cursor: default; background: none !important; }
.cmds a { display: flex; align-items: center; gap: 10px; flex: 1; padding: 9px 10px; color: var(--ink); font-weight: 550; } .cmds a:hover { text-decoration: none; }
.cmds a .i { color: var(--ink-3); } .cmds a small { margin-left: auto; color: var(--ink-3); font-weight: 500; }

.menu { position: relative; display: inline-block; }
.menu > ul { position: absolute; z-index: 5; top: calc(100% + 4px); right: 0; min-width: 190px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.menu:not([open]) > ul { display: none; }
.menu summary { list-style: none; } .menu summary::-webkit-details-marker { display: none; }
.menu li a { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 7px; color: var(--ink); }
.menu li a:hover { background: var(--sunken); text-decoration: none; } .menu li.sep { border-top: 1px solid var(--line); margin: 4px 0; }
.menu li a.neg { color: var(--neg); }


/* ---------- 12. Feedback ---------- */
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); font-weight: 550; }
.toast .btn { margin-left: auto; background: none; color: inherit; border-color: color-mix(in srgb, var(--paper) 35%, transparent); box-shadow: none; }
/* kept as it was: on hover and press the button falls back to the plain button look */
.toast .btn:hover { background: color-mix(in srgb, var(--sunken) 70%, var(--surface)); border-color: color-mix(in srgb, var(--ink-3) 55%, var(--line-2)); }
.toast .btn:active { box-shadow: inset 0 1px 2px rgb(26 23 20 / .1); }
.toast .i { color: var(--pos); } .toast.neg .i { color: var(--neg); }
.toasts { position: fixed; z-index: var(--z-toast); left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); }
.toasts .toast { animation: rise var(--t) ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; z-index: var(--z-menu); bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 4px 8px; border-radius: 4px; background: var(--ink); color: var(--paper); font: 500 12px var(--font); white-space: nowrap; pointer-events: none; }
.pop { position: relative; display: inline-block; }
.pop > summary { list-style: none; } .pop > summary::-webkit-details-marker { display: none; }
.pop > div { position: absolute; z-index: var(--z-menu); top: calc(100% + 6px); left: 0; width: min(280px, 80vw); padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.spin { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }


/* ---------- 13. Voucher parts ---------- */
.party { display: grid; gap: 8px; }
.party-hit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; row-gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.party-hit > div { min-width: 0; overflow-wrap: anywhere; }
.party-hit > div:not(.bal):not(.ph) { flex: 1 1 150px; }
.party-hit .bal { margin-left: auto; text-align: right; flex-basis: auto; white-space: nowrap; }
.totals { display: grid; gap: 4px; margin-left: auto; width: min(100%, 300px); }
.totals div { display: flex; justify-content: space-between; gap: 20px; font-variant-numeric: tabular-nums; }
.totals .grand { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.totals small { color: var(--ink-3); text-align: right; }

/* state: where a voucher stands, as a row of pills joined by short lines */
.state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.state ol { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.state ol li { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.state ol li + li { margin-left: 14px; position: relative; }
/* the joining line is the ::after; the ::before that used to draw it is kept switched off */
.state ol li + li::before { content: ""; width: 22px; height: 1px; background: var(--line-2); display: none; }
.state ol li + li::after { content: ""; position: absolute; left: -13px; top: 50%; width: 8px; height: 1px; background: var(--line-2); }
.state ol li.done { color: var(--ink); }
.state ol li.now { background: var(--pos-soft); color: var(--pos); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pos) 18%, transparent); }
.state ol li:not(.done):not(.now) { box-shadow: inset 0 0 0 1px var(--line); }

.itemcard { display: flex; gap: 12px; }
.itemcard .ph { width: 76px; height: 96px; flex: none; border-radius: var(--r); background: repeating-linear-gradient(135deg, var(--accent-soft) 0 6px, var(--sunken) 6px 12px); }
.scanline { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 40%, var(--surface)); color: var(--ink-3); font-size: 12.5px; }
.scanline > [data-scan] { flex: 0 1 260px; min-width: 0; }
/* chain: the documents a voucher came from and led to */
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chain > a, .chain > span.step { display: grid; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); }
.chain > a:hover { border-color: var(--accent); text-decoration: none; } .chain small { color: var(--ink-3); font-size: 11.5px; }
.chain > .i { color: var(--ink-3); } .chain .here { border-color: var(--accent); background: var(--accent-soft); }


/* ---------- 14. Stock, accounts and print parts ----------
   Things that end up on paper keep fixed black on white in both themes. */
.barcode { height: 34px; background: repeating-linear-gradient(90deg, #000 0 2px, #fff 2px 3px, #000 3px 4px, #fff 4px 7px, #000 7px 10px, #fff 10px 11px, #000 11px 12px, #fff 12px 14px); }
.qr { width: 84px; height: 84px; flex: none; border: 6px solid #fff; outline: 1px solid var(--line-2);
  background: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 12px 12px, #fff; image-rendering: pixelated; }
.label-tag { width: 190px; padding: 8px 10px; background: #fff; color: #000; border: 1px solid var(--line-2); border-radius: 4px; display: grid; gap: 3px; font-size: 11px; line-height: 1.25; box-shadow: var(--shadow-1); }
.label-tag b { font-size: 12.5px; } .label-tag .mrp { font-size: 15px; font-weight: 800; } .label-tag .mono { text-align: center; letter-spacing: .12em; }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; padding: 10px; background: #fff; border: 1px solid var(--line-2); }
.label-sheet .label-tag { width: auto; box-shadow: none; border-style: dashed; }
.diffv { font-weight: 700; }
/* placeholder for a picture; .shot is a screenshot */
.ph { background: repeating-linear-gradient(135deg, var(--accent-soft) 0 6px, var(--sunken) 6px 12px); border-radius: var(--r); }
.ph.shot { background: repeating-linear-gradient(45deg, var(--info-soft) 0 6px, var(--sunken) 6px 12px); }
.paper { background: #fff; color: #1c1917; border: 1px solid var(--line-2); box-shadow: var(--shadow-2); padding: 28px; max-width: 720px; font-size: 12.5px; }
.paper .faint { color: #8c867e; }
.receipt { width: min(100%, 250px); margin: auto; padding: 14px 12px; background: #fff; color: #000; font: 11.5px/1.45 var(--mono); border: 1px solid var(--line-2); box-shadow: var(--shadow-2); }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; } .receipt .row { gap: 4px; } .receipt .c { text-align: center; }
.cheque { background: #fff; color: #000; border: 1px solid var(--line-2); padding: 14px 16px; display: grid; gap: 12px; font-size: 12.5px; max-width: 560px; box-shadow: var(--shadow-1); }
.cheque .u { border-bottom: 1px solid #000; flex: 1; padding: 0 6px 2px; min-width: 0; } .cheque .box { border: 1px solid #000; padding: 4px 10px; font-weight: 700; white-space: nowrap; }
.cheque .date { letter-spacing: .5em; font-family: var(--mono); border: 1px solid #000; padding: 2px 6px; }
.diff { font: 12px/1.6 var(--mono); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; background: var(--surface); }
.diff div { padding: 0 10px; white-space: pre; } .diff .add { background: var(--pos-soft); color: var(--pos); } .diff .del { background: var(--neg-soft); color: var(--neg); } .diff .ctx { color: var(--ink-3); }
pre.diff { margin: 0; padding: 8px 10px; white-space: pre; }


/* ---------- 15. Navigation and action parts ---------- */
.fkeys { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; border-radius: var(--r); background: var(--ink); color: var(--paper); font-size: 12.5px; }
.fkeys .kbd { background: none; color: inherit; border-color: color-mix(in srgb, var(--paper) 40%, transparent); margin-right: 5px; }
.fab { width: 54px; height: 54px; flex: none; padding: 0; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-2); display: grid; place-items: center; cursor: pointer; }
.fab .i { width: 24px; height: 24px; }
.actionbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); }
.actionbar .grow b { font-size: 18px; font-variant-numeric: tabular-nums; }
/* master and detail side by side */
.md { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.md > ul { border-right: 1px solid var(--line); } .md > ul li { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.md > ul li.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } .md > div { padding: 14px; }
.navdemo { width: min(100%, 230px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 12px 8px; display: grid; gap: 2px; }
.navdemo a { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r); color: var(--ink-2); font-weight: 550; }
.navdemo a:hover { background: var(--sunken); text-decoration: none; } .navdemo a.on { background: var(--accent-soft); color: var(--accent); }
.navdemo .tag { margin-left: auto; } .navdemo .t-caps { padding: 10px 8px 4px; }
.rail { width: 60px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 8px 6px; display: grid; gap: 4px; justify-items: center; }
.rail a { display: grid; justify-items: center; gap: 2px; width: 100%; padding: 7px 0; border-radius: var(--r); color: var(--ink-2); font-size: 10.5px; font-weight: 600; }
.rail a.on { background: var(--accent-soft); color: var(--accent); } .rail a:hover { text-decoration: none; background: var(--sunken); } .rail .i { width: 20px; height: 20px; }
/* the nav rail sample sits in a small screen frame, not beside loose text */
.raildemo { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper); }
.raildemo .rail { align-content: start; } .raildemo .stack { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tiles a { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 12.5px; text-align: center; }
.tiles a:hover { border-color: var(--accent); text-decoration: none; } .tiles .i { width: 22px; height: 22px; color: var(--accent); }
.relbadge { position: relative; } .relbadge .tag.count { position: absolute; top: -6px; right: -6px; height: 16px; min-width: 16px; padding: 0 4px; font-size: 10px; }


/* ---------- 16. AI parts ---------- */
.ai-box { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); }
.ai-turn { max-width: 88%; padding: 10px 14px; border-radius: 16px 16px 16px 5px; background: var(--sunken); }
.ai-turn.me { margin-left: auto; border-radius: 16px 16px 5px 16px; background: var(--ink); color: var(--paper); }
.ai-turn mark { background: var(--warn-soft); color: inherit; padding: 0 3px; border-radius: 3px; }
.caret { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--ink); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.wave { display: flex; align-items: center; gap: 3px; height: 34px; }
.wave i { flex: 1; max-width: 4px; border-radius: 2px; background: var(--accent); height: 30%; animation: wave 1.1s ease-in-out infinite; }
.wave i:nth-child(3n) { animation-delay: -.3s; } .wave i:nth-child(4n) { animation-delay: -.6s; } .wave i:nth-child(5n) { animation-delay: -.9s; }
@keyframes wave { 50% { height: 95%; } }

/* bill scan: the bill on the left stays in view while the long draft scrolls */
.scan { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
.scan > :first-child { position: sticky; top: 16px; }
.scan-page { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-1); background: #fff; color: #26221e; padding: 6% 7%; overflow: hidden; }
.scan-page i { position: absolute; border-radius: 3px; border: 1.5px solid var(--pos); background: color-mix(in srgb, var(--pos) 10%, transparent); }
.scan-page i.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.scan-page i.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 35%, transparent); }
/* the scanned bill reads like a bill; fields the model read are washed green, doubtful ones amber */
.bill { display: grid; gap: 7px; align-content: start; height: 100%; font: 500 7px/1.5 var(--mono); }
.bill b { font-weight: 700; font-size: 7.5px; } .bill .r { text-align: right; }
.bill-top { display: flex; justify-content: space-between; gap: 8px; }
.bill table { border-collapse: collapse; width: 100%; } .bill th { text-align: left; border-bottom: 1px solid #26221e; padding: 2px 2px; font-weight: 700; }
.bill td { padding: 2.5px 2px; border-bottom: 1px dotted #c9c2b8; } .bill th:nth-child(n+3), .bill td:nth-child(n+3) { text-align: right; }
.bill-tot { justify-self: end; text-align: right; }
.bill .hl { padding: 2px 4px; margin: -2px -4px; border-radius: 3px; }
.bill .hl.ok { background: color-mix(in srgb, var(--pos) 12%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pos) 55%, transparent); }
.bill tr.ok td { background: color-mix(in srgb, var(--pos) 12%, #fff); box-shadow: none; }
.bill .hl.warn { background: color-mix(in srgb, var(--warn) 20%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 70%, transparent); }
.bill tr.warn td { background: color-mix(in srgb, var(--warn) 20%, #fff); box-shadow: inset 0 1px 0 var(--warn), inset 0 -1px 0 var(--warn); }
.pagethumb { width: 38px; height: 50px; flex: none; border-radius: 4px; border: 1px solid var(--line-2); cursor: pointer;
  background: repeating-linear-gradient(#fff 0 5px, #e9e4dc 5px 6px); background-clip: content-box; padding: 5px 4px; background-color: #fff; }
.pagethumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ask page: one question box, then a thread of questions and answers */
.askpage { max-width: 760px; margin: 0 auto; display: grid; gap: 18px; padding-top: clamp(0px, 6vh, 56px); }
.askhead { display: grid; justify-items: center; gap: 8px; text-align: center; margin-bottom: 6px; }
.askhead h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.askhead p { color: var(--ink-2); font-size: 15px; max-width: 52ch; }
.askmark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: var(--on-accent);
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 82%, white), var(--accent)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgb(255 255 255 / .25); }
.askmark .i { width: 22px; height: 22px; }
.askmark.sm { width: 24px; height: 24px; border-radius: 8px; box-shadow: none; } .askmark.sm .i { width: 14px; height: 14px; }

.composer { display: flex; align-items: center; gap: 6px; padding: 7px 7px 7px 18px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface);
  box-shadow: 0 1px 2px rgb(26 23 20 / .05), 0 14px 32px -18px rgb(26 23 20 / .22);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent), 0 14px 32px -18px rgb(26 23 20 / .22); }
.composer input { flex: 1; min-width: 0; height: 42px; border: 0; outline: 0; background: none; font-size: 16px; color: var(--ink); }
.composer input::placeholder { color: var(--ink-3); }
.send { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; cursor: pointer; color: var(--paper);
  background: linear-gradient(color-mix(in srgb, var(--ink) 84%, var(--paper)), var(--ink)); box-shadow: 0 1px 2px rgb(26 23 20 / .3), inset 0 1px 0 rgb(255 255 255 / .14);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.send .i { width: 19px; height: 19px; stroke-width: 2.1; }
.send:hover { transform: translateY(-1px); } .send:active { transform: none; }
.send:disabled { opacity: .28; cursor: default; transform: none; }
.send.ghost { background: none; box-shadow: none; color: var(--ink-3); } .send.ghost:hover { background: var(--sunken); color: var(--ink); transform: none; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pills button { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 550; cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.pills button:hover { border-color: var(--ink-3); color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow-1); }

.thread { display: grid; gap: 26px; margin-top: 14px; }
.qa { display: grid; gap: 12px; animation: rise var(--t) var(--ease); }
.ask-q { justify-self: end; max-width: 85%; padding: 10px 15px; border-radius: 18px 18px 5px 18px; background: var(--ink); color: var(--paper); font-size: 15px; }
.ans { display: grid; gap: 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; background: var(--surface); box-shadow: var(--shadow-card); }
.ans-head { display: flex; align-items: center; gap: 8px; font-size: 13px; } .ans-head .faint { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.ans-text { font-size: 15.5px; line-height: 1.62; white-space: pre-wrap; } .ans-text:empty { display: none; }
.ans-wait { display: none; gap: 9px; } .qa.loading .ans-wait { display: grid; }
.ans-wait .t-small { margin-top: 4px; }
/* "show the work": the queries behind an answer, folded away */
.work { border-top: 1px solid var(--line); padding-top: 10px; }
.work summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.work summary::-webkit-details-marker { display: none; } .work summary:hover { color: var(--ink); }
.work summary .i { width: 14px; height: 14px; transition: transform var(--t-fast) var(--ease); } .work[open] summary .i { transform: rotate(90deg); }
.step { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; font-size: 12px; color: var(--ink-2); background: color-mix(in srgb, var(--sunken) 50%, var(--surface)); border-bottom: 1px solid var(--line); }
.step pre { margin: 0; padding: 10px 12px; font: 11.5px/1.6 var(--mono); color: var(--ink-2); overflow-x: auto; white-space: pre; }
.step pre.neg { color: var(--neg); }


/* ---------- 17. App parts ----------
   A phone frame for the app samples. Frames are one height, so app parts line up in a row. */
.phone { width: min(100%, 320px); height: 460px; margin: auto; border: 8px solid var(--ink); border-radius: 30px; background: var(--paper); overflow: hidden; display: flex; flex-direction: column; --h: 44px; font-size: 15px; }
.phone .scr { padding: 12px; display: flex; flex-direction: column; gap: 10px; align-content: start; flex: 1; min-height: 0; overflow-y: auto; }
.phone .scr > * { flex: none; }
.appbar { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 700; }
.appbar .btn { box-shadow: none; }
.tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; color: var(--ink-3); font-size: 11px; font-weight: 600; }
.tabbar a.on { color: var(--accent); } .tabbar a:hover { text-decoration: none; } .tabbar .i { width: 22px; height: 22px; }
.camera { position: relative; aspect-ratio: 4 / 3; background: #111; border-radius: var(--r-lg); display: grid; place-items: center; color: #fff; overflow: hidden; }
.camera::before { content: ""; width: 68%; height: 44%; border: 2px solid #fff; border-radius: 10px; box-shadow: 0 0 0 999px rgb(0 0 0 / .45); }
.camera::after { content: ""; position: absolute; left: 18%; right: 18%; height: 2px; background: var(--red); box-shadow: 0 0 8px var(--red); }
.camera span { position: absolute; bottom: 8px; font-size: 12px; opacity: .85; }
.phone .camera { aspect-ratio: auto; flex: 1 1 150px; min-height: 150px; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.numpad button { height: 48px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); font: 600 18px var(--font); cursor: pointer; }
.numpad button:active { background: var(--sunken); } .numpad .go { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.phone .numpad { margin-top: auto; } .phone .numpad button { height: 52px; }
.padout { font: 700 26px var(--font); text-align: right; padding: 6px 10px; border-radius: var(--r); background: var(--sunken); font-variant-numeric: tabular-nums; min-height: 46px; }
.pins { display: flex; justify-content: center; gap: 12px; padding: 8px 0; }
.pins i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-3); } .pins i.on { background: var(--ink); border-color: var(--ink); }
.sheetwrap { background: rgb(20 18 16 / .45); padding-top: 70px; flex: 1; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 14px 16px; display: grid; gap: 10px; }
.sheet::before { content: ""; width: 38px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 4px; }
.shutter { width: 58px; height: 58px; border-radius: 50%; border: 4px solid var(--surface); outline: 2px solid var(--ink); background: var(--ink); margin: auto; cursor: pointer; }
.phone .btn.lg, .phone .shutter { margin-top: auto; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 3px; } .thumbs > * { outline-offset: 0; } .thumbs .ph { width: 52px; height: 52px; flex: none; }
.touchlist > li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.touchlist > li:last-child { border-bottom: 0; } .touchlist .i:last-child { color: var(--ink-3); }
.touchlist .grow { min-width: 0; overflow-wrap: anywhere; }


/* ---------- 18. Store parts ----------
   Store parts take the org's accent, not Ambar's. */
.store { --accent: #7a1f3d; --accent-soft: #f6e9ee; --on-accent: #fff; }
:root[data-theme="dark"] .store { --accent: #e58aa6; --accent-soft: #3a1622; --on-accent: #23060f; }
.storebar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.storebar .brand { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.storebar nav { display: flex; gap: 14px; flex-wrap: wrap; } .storebar nav a { color: var(--ink-2); font-weight: 550; }
.hero-b { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; align-items: center; padding: 22px; border-radius: var(--r-lg); background: var(--accent-soft); }
.hero-b .ph { min-height: 150px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 170px), 1fr)); gap: 12px; }
.pcard { display: grid; gap: 6px; color: var(--ink); } .pcard:hover { text-decoration: none; } .pcard .ph { aspect-ratio: 3 / 4; }
.pcard s, .price s { color: var(--ink-3); font-weight: 400; }
.cattiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(46%, 130px), 1fr)); gap: 10px; }
.cattiles a { position: relative; aspect-ratio: 1; display: grid; align-items: end; padding: 10px; border-radius: var(--r-lg); color: var(--ink); font-weight: 700; overflow: hidden; isolation: isolate; }
.cattiles a::before { content: ""; position: absolute; inset: 0; z-index: -1; }
.cartline { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; } .cartline .ph { width: 64px; height: 84px; flex: none; }
.sfoot { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(46%, 150px), 1fr)); gap: 16px; padding: 18px; border-radius: var(--r-lg); background: var(--sunken); font-size: 13px; }
.sfoot a { display: block; color: var(--ink-2); padding: 2px 0; }


/* ---------- 19. Shell and catalogue pages ----------
   The two-column shell shared by the catalogue and the app: a side menu and a main column.
   On phones the side menu goes off-canvas (see Responsive). */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.side { --side-bg: color-mix(in srgb, var(--surface) 55%, var(--paper)); position: sticky; top: 0; height: 100dvh; overflow: auto; padding: 22px 12px; border-right: 1px solid var(--line); background: var(--side-bg); display: flex; flex-direction: column; gap: 16px; }
.side .logo { height: 20px; width: auto; display: block; margin: 2px 10px 6px; }
.side > .filter, .side > .logo, .side > a { flex: none; }
.side .org { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 2px 10px 4px; color: var(--ink-3); } .side .org:hover { text-decoration: none; }
.side .org .logo { margin: 0; } .side .org small { font-size: 11.5px; font-weight: 550; white-space: nowrap; }
/* the "jump to" button that opens the command palette */
.jump { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 8px 0 10px; flex: none; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink-3); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-1); transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.jump:hover { border-color: var(--ink-3); color: var(--ink-2); } .jump span:first-of-type { margin-right: auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; justify-content: flex-start; gap: 9px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.side nav a:hover { background: color-mix(in srgb, var(--sunken) 80%, transparent); text-decoration: none; color: var(--ink); }
/* active item in the side menu: a raised chip, no edge bar */
.side nav a.on { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.side nav a .i { color: var(--ink-3); transition: color var(--t-fast) var(--ease); } .side nav a small { margin-left: auto; }
.side nav a.on .i, .side nav a:hover .i { color: var(--accent); }
.side nav small { color: var(--ink-3); font-size: 11px; font-weight: 500; text-transform: none; }
.side .t-caps { padding: 0 10px; }
.side .foot { margin-top: auto; padding: 0 4px; display: grid; gap: 10px; justify-items: start; } .side .foot nav { width: 100%; }
/* the store being worked in, under the shop's name */
.store-pick { display: flex; align-items: center; gap: 6px; margin: -8px 2px 0; padding: 0 8px; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); }
.store-pick .i { color: var(--accent); flex: none; }
.store-pick select { flex: 1; min-width: 0; border: 0; box-shadow: none; background-color: transparent; padding-left: 0; font-weight: 600; }
/* who is using it: pinned to the bottom of the menu, its own menu opening upward */
.side .me { position: sticky; bottom: -22px; margin: auto -12px -22px; padding: 10px 12px 14px; background: var(--side-bg); border-top: 1px solid var(--line); z-index: 2; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; transition: background var(--t-fast) var(--ease); }
.me-card:hover, .menu[open] > .me-card { background: color-mix(in srgb, var(--sunken) 80%, transparent); }
.me-card > .i { margin-left: auto; color: var(--ink-3); transform: rotate(180deg); transition: transform var(--t) var(--ease); }
.menu[open] > .me-card > .i { transform: none; }
.me-who { display: grid; min-width: 0; line-height: 1.25; }
.me-who b, .me-who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-who b { font-size: 13.5px; font-weight: 650; }
.me-who small { font-size: 11.5px; color: var(--ink-3); text-transform: capitalize; }
.menu.up { display: block; }
.menu.up > ul { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; }
.me-shop { display: grid; padding: 6px 10px 4px; line-height: 1.3; } .me-shop small { color: var(--ink-3); font-size: 11px; }
.menu li button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.menu li button:hover { background: var(--sunken); } .menu li button.neg { color: var(--neg); }

/* padding here is the fallback only: desk, tablet and phone each set their own under Responsive */
.main { padding: 36px clamp(16px, 4vw, 48px) 80px; max-width: 1180px; width: 100%; }
.main > header { margin-bottom: 28px; display: grid; gap: 6px; max-width: 62ch; }
.main > header .muted { font-size: 15px; }

/* phone top bar and the scrim behind the off-canvas menu; both are inert on wider screens */
.mbar { display: none; position: sticky; top: 0; z-index: var(--z-sticky); align-items: center; gap: 6px; height: 52px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.mbar .logo { height: 17px; display: block; } .mbar .btn { box-shadow: none; } .mbar .i { width: 22px; height: 22px; }
.scrim { position: fixed; inset: 0; z-index: calc(var(--z-dialog) - 1); background: rgb(20 18 16 / .45); opacity: 0; pointer-events: none; transition: opacity var(--t) ease; }

/* catalogue: a section per group, and a card per part with its sample and its markup */
.doc { margin-top: 44px; scroll-margin-top: 20px; }
.doc > h2 { margin-bottom: 4px; font-size: 20px; } .doc > p { color: var(--ink-2); margin-bottom: 16px; max-width: 70ch; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; align-items: stretch; }
.part { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; }
.part.wide { grid-column: 1 / -1; }
.part > header { align-items: baseline; padding: 12px 16px; }
.part > header small { font-weight: 400; color: var(--ink-3); display: block; }
.part > header code { font: 11.5px var(--mono); color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; flex: none; }
.part > .body { min-width: 0; }
.part > footer { display: flex; gap: 8px; align-items: flex-start; }
.part > footer pre { margin: 0; flex: 1; min-width: 0; font: 11.5px/1.5 var(--mono); color: var(--ink-3); white-space: pre-wrap; word-break: break-word; }
.part .pills { justify-content: flex-start; }

/* design system page: swatches, type and spacing specimens, the resizable demo box */
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.sw { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); font-size: 12px; }
.sw i { display: block; height: 52px; background: var(--k); border-bottom: 1px solid var(--line); }
.sw span { display: block; padding: 6px 8px; } .sw code { display: block; font: 11px var(--mono); color: var(--ink-3); }
.spec { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; align-items: center; }
.spec > code { font: 11.5px var(--mono); color: var(--ink-3); }
.space i { display: block; height: 14px; width: var(--w); background: var(--accent); border-radius: 2px; }
.resize { resize: horizontal; overflow: auto; max-width: 100%; min-width: 260px; padding: 2px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.shellbox { display: grid; gap: 4px; height: 150px; padding: 6px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--sunken); font: 10.5px var(--mono); color: var(--ink-3); }
.shellbox i { display: grid; place-items: center; border-radius: 3px; background: var(--surface); border: 1px solid var(--line); font-style: normal; }
.shellbox i.a { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.do { border-left: 3px solid var(--pos); padding-left: 10px; } .dont { border-left: 3px solid var(--neg); padding-left: 10px; color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--neg); }


/* ---------- 20. App screens ----------
   Page head, list bar and form bar, and a screen drawn from a module schema. */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; max-width: var(--page); margin-bottom: 18px; }
.pagehead h1 { font-size: 27px; font-weight: 750; letter-spacing: -.028em; line-height: 1.15; }
.pagehead .sub { display: block; margin-top: 3px; font: 12.5px var(--mono); color: var(--ink-3); }
.pagehead .back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 4px -4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pagehead .back:hover { color: var(--accent); text-decoration: none; } .pagehead .back .i { width: 14px; height: 14px; }
.main > .toolbar { max-width: var(--page); }
.main > .toolbar h1 { font-size: 26px; letter-spacing: -.025em; line-height: 1.15; margin-top: 2px; }
.main > .toolbar .faint.mono { font-size: 12.5px; }
.listbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; max-width: var(--page); margin-bottom: 12px; }
.statetabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--sunken); overflow-x: auto; max-width: 100%; }
.statetabs a { display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 7px; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.statetabs a:hover { color: var(--ink); text-decoration: none; }
.statetabs a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.statetabs small { font-size: 11px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; } .statetabs a.on small { color: var(--accent); }
.listsearch { width: min(100%, 260px); }
.formbar { position: sticky; bottom: 16px; z-index: var(--z-sticky); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: var(--page); margin-top: 16px; padding: 10px 12px 10px 18px;
  border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-2); }
.formbar .grow { display: grid; } .formbar .grow b { font-size: 19px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* A screen drawn from a module schema. Each area sizes its parts by its own room. */
.screen { display: grid; gap: 16px; max-width: var(--page); }
.sarea { display: grid; gap: 16px; min-width: 0; }
.sarea-header { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); }
.sarea-header > .party { grid-column: 1 / -1; }
.sarea-header .party-hit { background: color-mix(in srgb, var(--sunken) 45%, var(--surface)); border-color: var(--line); border-radius: 10px; padding: 10px 12px; }
.sarea-totals { justify-items: end; }
.sarea-totals .totals { width: min(100%, 360px); margin: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); gap: 6px; }
/* A voucher with lines is a bill: on a desk it runs wide, with the totals held beside the lines, as at a counter. */
@media (min-width: 1200px) {
  .screen:has(.sarea-lines) { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .screen:has(.sarea-lines) > .sarea { grid-column: 1; }
  .screen:has(.sarea-lines) > .sarea-totals { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 16px; justify-items: stretch; }
  .screen:has(.sarea-lines) > .sarea-totals .totals { width: 100%; }
}
/* On a phone the scan box comes first and takes the whole row; there is no F2 to press. */
@media (max-width: 640px) {
  [data-lines]:has([data-scan]) { display: flex; flex-direction: column; }
  [data-lines] .scanline:has([data-scan]) { order: -1; flex-wrap: wrap; border-top: 0; border-bottom: 1px solid var(--line); }
  .scanline > [data-scan] { flex: 1 1 100%; } .scanline .kbd, [data-tender] .kbd { display: none; }
}
/* tender: one row per mode, amount, then Rest */
.sarea-totals > [data-tender] { width: min(100%, 360px); }
@media (min-width: 1200px) { .screen:has(.sarea-lines) > .sarea-totals > [data-tender] { width: 100%; } }
.tender-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.tender-row .mode { font-weight: 600; font-size: 13px; } .tender-row > b { grid-column: 2 / -1; text-align: right; }
.itemcard.scanned { padding: 12px 14px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }


/* ---------- 21. Responsive ----------
   Three sizes: phone under 640, tablet 640 to 1100, desk above.
   Parts answer to their own box (container queries); only the shell answers to the window.
   The .fold table rules live with the tables in section 8. */

/* parts in a narrow box */
@container (max-width: 560px) {
  .md { grid-template-columns: 1fr; } .md > ul { border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; } .md > ul li { border-bottom: 0; white-space: nowrap; }
  .md > ul li.on { box-shadow: inset 0 -3px 0 var(--accent); }
  .cols.two-one { grid-template-columns: 1fr; }
  .steps { flex-direction: column; } .steps li { border-top: 0; border-left: 3px solid var(--line-2); padding: 2px 0 2px 10px; }
  .state ol { flex-basis: 100%; }
  .dl { grid-template-columns: 1fr; gap: 0; } .dl dd { margin-bottom: 8px; }
  .toolbar h3 { flex-basis: 100%; } .toolbar .affix { flex: 1; width: auto !important; }
  /* the big calendar keeps its grid; events shrink to dots */
  .cal.big > div { min-height: 46px; padding: 3px; text-align: center; }
  .cal.big > b { font-size: 10px; }
  .cal.big .ev { font-size: 0; height: 6px; width: 6px; padding: 0; border-radius: 50%; margin: 3px auto 0; background: currentColor; }
}
@container (max-width: 720px) { .scan { grid-template-columns: 1fr; } .scan > :first-child { position: static; } .scan-page { max-width: 260px; } }

/* Touch screens: bigger targets, and 16px text in inputs so iOS does not zoom the page. */
@media (pointer: coarse) {
  .input, select.input, textarea.input { font-size: 16px; }
  .btn.sm { height: 36px; padding: 0 12px; } .btn.icon.sm { width: 36px; }
  .chip span { height: 38px; padding: 0 14px; } .seg span { padding: 9px 14px; }
  .check input { width: 22px; height: 22px; } .switch input { width: 44px; height: 26px; }
  .switch input::after { width: 22px; height: 22px; } .switch input:checked::after { transform: translateX(18px); }
  .table.entry .input { height: 40px; } .tabs button { padding: 12px 14px; }
  .acc summary, .menu li a, .cmds li, .tree summary, .tree .leaf { min-height: 44px; align-items: center; }
  .swatches span { width: 36px; height: 36px; } .stars label .i { width: 32px; height: 32px; }
  [data-tip]:hover::after { display: none; }
}

/* Desk and up */
@media (min-width: 1101px) { .main { padding: 44px 56px 96px; } }
@media (min-width: 761px) { .card > .body { padding: 16px; } }

/* Tablet */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 184px minmax(0, 1fr); }
  .main { padding: 28px 24px 64px; }
}

/* Phone */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  /* the sidebar becomes an off-canvas menu, opened by the hamburger in the top bar */
  header.mbar { display: flex; }
  .mbar { box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
  .side .filter { flex: none; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: var(--z-dialog); width: min(290px, 86vw); height: 100dvh; padding: 18px 12px; background: var(--surface); transform: translateX(-102%); visibility: hidden;
    transition: transform var(--t) ease, visibility var(--t); box-shadow: var(--shadow-2); overscroll-behavior: contain; }
  .nav-open .side { transform: none; visibility: visible; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-open body { overflow: hidden; }
  .side nav a { padding: 11px 12px; font-size: 15px; }
  .main { padding: 20px 14px 56px; }
  .t-display { font-size: 27px; } .doc { margin-top: 32px; scroll-margin-top: 64px; }
  .part > header { flex-wrap: wrap; } .card.pad { padding: 12px; } .card > .body { padding: 12px; }
  .spec { grid-template-columns: 1fr; gap: 2px 0; } .spec > code { margin-top: 8px; }
  .paper { padding: 14px; } .hero b { font-size: 30px; }
  dialog.drawer { width: 100vw; } .row.wrap-s { flex-wrap: wrap; }
}


/* ---------- 22. Motion preferences ----------
   Pages cross-fade on navigation. People who ask for less motion get none of the loops,
   slides or lifts. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .sk, .caret, .wave i, .qa, .toasts .toast { animation: none; }
  .spin { animation-duration: 2s; }
  .side, .scrim { transition: none; }
  .send:hover, .pills button:hover { transform: none; }
}

/* Barcode tags drawn from data: the bars are an SVG, and printing shows the tags alone. */
.barcode-svg { display: block; width: 100%; height: 34px; background: #fff; }
@media print {
  .printing-labels body * { visibility: hidden; }
  .printing-labels .labels, .printing-labels .labels * { visibility: visible; }
  .printing-labels .labels { position: absolute; inset: 0 auto auto 0; }
}

/* The period bar above a report: presets on the left, a from-to on the right. */
.period { gap: 8px; flex-wrap: wrap; }
.period .input { width: auto; min-width: 0; flex: 1 1 130px; max-width: 170px; }

/* ---------- Home and the shell's quick starts ---------- */
.newsale { width: 100%; justify-content: center; margin: 2px 0 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
@media (max-width: 640px) { .tiles { grid-template-columns: 1fr 1fr; gap: 8px; } .tile { padding: 10px 12px; } .tile b { font-size: 17px; } }
.tile { display: grid; gap: 4px; padding: 14px 16px; color: var(--ink); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile b { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile small { color: var(--ink-3); font-size: 12px; }
.tile.warn b { color: var(--warn, var(--accent)); }
.starts { display: flex; flex-wrap: wrap; gap: 8px; }
/* the keys a form answers to */
.keys { display: flex; flex-wrap: wrap; gap: 6px 14px; max-width: var(--page); margin: -8px 0 14px; font-size: 12.5px; color: var(--ink-3); }
.keys > span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 640px) { .keys { display: none; } }
/* the reports index: one card per module */
.reportindex { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); align-items: start; }
.reportindex nav { display: grid; gap: 2px; padding: 8px; }
.reportindex nav a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reportindex nav a:hover { background: var(--sunken); text-decoration: none; } .reportindex nav a .i { color: var(--accent); }

/* ---------- A printed bill: its own page, A4 or an 80 mm till roll ---------- */
.billpage { background: var(--sunken); padding: 16px; }
.billbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 794px; margin: 0 auto 14px; }
.billbar .btn.primary { margin-left: auto; }
.invoice { position: relative; display: grid; gap: 14px; max-width: 794px; margin: 0 auto; padding: 32px 36px; font-size: 12.5px; line-height: 1.5; }
.invoice .seller { font-size: 15px; } .invoice .doc { text-align: right; } .invoice .doc .t-head { font-size: 18px; letter-spacing: -.01em; }
.invoice .parties { padding: 10px 0; border-block: 1px solid #d6d0c6; }
.invoice .table { width: 100%; } .invoice .table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b655d; }
.invoice .sums { gap: 18px; align-items: flex-start; } .invoice .taxes { width: auto; flex: 1 1 320px; }
.invoice .totals { margin-left: auto; min-width: 240px; display: grid; gap: 4px; }
.invoice .totals > div { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.invoice .totals .grand { padding-top: 6px; border-top: 1px solid #1c1917; font-weight: 700; font-size: 14px; }
.invoice .details { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.invoice footer { gap: 16px; align-items: flex-end; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid #d6d0c6; border-radius: 0; background: none; box-shadow: none; } .invoice .terms { max-width: 60%; } .invoice .sign { text-align: right; }
.stamp { color: #b42318; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.invoice .stamp { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 2px 10px; border: 2px solid #b42318; border-radius: 4px; font-size: 11px; }
.roll .receipt { width: 302px; } /* 80 mm */
@media print {
  @page { margin: 12mm; }
  .no-print, .billbar, .side, .mbar, .scrim, .formbar { display: none !important; }
  .billpage { background: #fff; padding: 0; }
  .invoice, .receipt { box-shadow: none; border: 0; max-width: none; margin: 0; padding: 0; }
  .shell { display: block; } .main { padding: 0; }
}
@media print { .roll { width: 80mm; } }
.dayclose { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.dayclose > .tiles { grid-column: 1 / -1; }
.dayclose .card > header b { margin-left: auto; }

/* the base builder's code editor (static/editor.js) */
.code-editor { height: min(72vh, 760px); border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
/* on a phone: the bill scrolls inside its paper, and page buttons wrap */
.pagehead > .row { flex-wrap: wrap; }
@media (max-width: 640px) { .billpage { padding: 8px; } .invoice { padding: 16px; overflow-x: auto; } .pagehead > .row .input[type="date"] { width: 150px; } }

/* the pages of a long list */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.pager > span { margin-right: auto; }

/* history and the audit log: one change a line, field by field */
.history { max-width: var(--page); margin-top: 16px; }
.history ol { display: grid; gap: 0; padding: 0 16px; }
.history .entry { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.history .entry:last-child { border-bottom: 0; }
.history .changes { display: grid; gap: 2px; margin-top: 4px; padding-left: 2px; font-size: 12.5px; }
.history .changes del { color: var(--ink-3); }

/* an attached file or photo on a form */
.filebox { display: grid; gap: 6px; } .filebox a { display: inline-flex; align-items: center; gap: 6px; }
.filebox .thumb { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); }

/* the place part: three pickers in a row; Tom Select dressed as our inputs */
.place { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 12px; grid-column: 1 / -1; }

/* where a store is */
.geo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 12px; grid-column: 1 / -1; align-items: end; }
.geo > .row { grid-column: 1 / -1; flex-wrap: wrap; }
[data-files] .body > a { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- The phone apps (/m): big targets, one column, a bar on top ---------- */
.mobile { min-height: 100dvh; background: var(--paper, var(--sunken)); padding-bottom: env(safe-area-inset-bottom); }
.m-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.m-bar .logo { height: 18px; } .m-title { flex: 1; font-size: 15px; } .m-who { margin-left: auto; }
.m-main { padding: 14px; max-width: 1100px; margin: 0 auto; }
.m-wait { color: var(--ink-3); }
.m-card { display: block; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); }
.m-card h1 { font-size: 22px; margin-bottom: 4px; }
.m-big { min-height: 48px; font-size: 17px; }
.mobile .btn { min-height: 44px; }
.mobile .btn.sm { min-height: 36px; }
.m-apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.m-app { display: grid; gap: 4px; color: var(--ink); } .m-app:hover { text-decoration: none; border-color: var(--accent); }
.m-scan { display: flex; gap: 8px; } .m-scan input { flex: 1; min-width: 0; }
.m-camera { position: fixed; inset: 0; z-index: 100; background: #000; display: grid; place-items: center; }
.m-camera video { width: 100%; height: 100%; object-fit: cover; }
.m-camera .m-aim { position: absolute; width: 70%; height: 22%; border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .45); }
.m-camera .btn { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); }
.m-photo { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: var(--r); background: var(--sunken); overflow: hidden; }
.m-photo img { width: 100%; height: 100%; object-fit: cover; }
.m-file { position: relative; }
.m-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.m-page { margin: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.m-page img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #fff; display: block; }
.m-page figcaption { display: flex; align-items: center; gap: 4px; padding: 4px 8px; font-size: 12.5px; } .m-page figcaption .btn:first-of-type { margin-left: auto; }
.m-addpage { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 186px; text-align: center; cursor: pointer; border-style: dashed; }
.m-addpage:only-child { grid-column: 1 / -1; } /* no pages yet: the full width */
.m-addpage .i { width: 28px; height: 28px; color: var(--accent); }
.m-actions { display: grid; gap: 10px; }
.m-list { display: grid; gap: 8px; }
.m-row { display: grid; gap: 2px; width: 100%; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.m-row:active { border-color: var(--accent); }
.m-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--sunken); }
.m-tabs label { flex: 1; text-align: center; padding: 10px; border-radius: 9px; font-weight: 600; cursor: pointer; }
.m-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.m-tabs label:has(input:checked) { background: var(--surface); box-shadow: var(--shadow-1); }
.m-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-line { display: grid; grid-template-columns: 1fr 70px 90px; gap: 6px; margin-bottom: 6px; } .m-line small { grid-column: 1 / -1; }
.m-pos { display: grid; gap: 14px; }
@media (min-width: 900px) { .m-pos { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .m-pos > .m-card { position: sticky; top: 70px; } }
.m-cart { display: grid; gap: 6px; } .m-cart.back .m-cartline { border-style: dashed; }
.m-cartline { display: grid; grid-template-columns: minmax(0, 1fr) auto 90px auto; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.m-cartline > div:first-child { display: grid; min-width: 0; } .m-cartline b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-qty { display: flex; align-items: center; gap: 6px; }
.m-sums { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.m-sums .m-due { font-size: 20px; font-weight: 750; }
.m-pay { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px; }
.m-done { text-align: center; justify-items: center; max-width: 420px; margin: 8vh auto 0; }
.m-spin { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: m-spin 0.8s linear infinite; }
@keyframes m-spin { to { transform: rotate(360deg); } }
.m-toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%); max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--surface); font-weight: 600; transition: transform 0.2s ease; z-index: 200; }
.m-toast.show { transform: translate(-50%, 0); } .m-toast.neg { background: var(--neg, #b42318); color: #fff; }
.m-card > .btn, .m-card > a.btn, .m-done > .btn { width: 100%; }
.m-toast:not(.show) { visibility: hidden; }
/* .m-card is display: block for plain cards; a card that is also a stack keeps the stack's grid and gaps */
.m-card.stack { display: grid; }
/* one column of reading width on a wide screen; POS keeps the full width for its two columns */
.mobile:not([data-kind="pos"]) .m-main { max-width: 640px; }
.m-narrow { max-width: 520px; width: 100%; margin-inline: auto; }
.m-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.m-pays { display: grid; gap: 8px; }
.m-line.head { margin-bottom: 0; font-size: 12px; color: var(--ink-3); } .m-line.head span:not(:first-child) { text-align: right; padding-right: 10px; }
.m-more { justify-self: start; }
/* a page before signing in (Bare): the form alone, in the middle, no menu */
.bare { display: grid; align-content: start; gap: 20px; width: min(100% - 32px, 420px); margin: 0 auto; padding: 12vh 0 48px; }
.bare-logo { justify-self: center; } .bare-logo .logo { height: 26px; }
.bare-head { display: grid; gap: 4px; text-align: center; margin-bottom: 6px; } .bare-head h1 { font-size: 22px; letter-spacing: -.02em; }
.m-steps { display: grid; gap: 6px; padding-left: 20px; margin: 0; list-style: decimal; }
/* Pickers: Tom Select (static/picker.js, and the place part). Tom Select loads
   its own stylesheet after this one, so these rules name one class more than
   its own to win. It copies the box's classes onto its wrapper, so the wrapper
   is an .input too, and must not draw a second box around the picker's own. */
.ts-wrapper.input { height: auto; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; }
.ts-wrapper.input .ts-control, .ts-wrapper.input.single .ts-control, .ts-wrapper.input.single.input-active .ts-control {
  display: flex; align-items: center; min-height: var(--h); padding: 0 30px 0 10px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); background-image: none; color: var(--ink); box-shadow: none; font: inherit; cursor: text; }
.ts-wrapper.input.focus .ts-control { border-color: var(--accent); box-shadow: var(--ring); }
.ts-wrapper.input .ts-control > input, .ts-wrapper.input .ts-control > .item { color: var(--ink); font: inherit; }
.ts-wrapper.input .ts-control > input::placeholder { color: var(--ink-3); }
.ts-wrapper.input.single .ts-control::after { right: 12px; border-top-color: var(--ink-3); }
.ts-wrapper.input.single.dropdown-active .ts-control::after { border-bottom-color: var(--ink-3); }
:is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) { margin-top: 4px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); z-index: 200; font-size: 14px; overflow: hidden; }
:is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) .option { padding: 8px 12px; color: var(--ink); }
:is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) .option.active { background: var(--accent-soft); color: var(--ink); }
:is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) .highlight { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; }
:is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) .create, :is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) .no-results, :is(body > .ts-dropdown, .ts-wrapper > .ts-dropdown) .spinner { color: var(--ink-3); padding: 8px 12px; }
/* inside an affix (the party picker), the affix is the box */
.affix > .ts-wrapper { flex: 1; min-width: 0; }
.affix .ts-wrapper.input .ts-control, .affix .ts-wrapper.input.focus .ts-control { min-height: calc(var(--h) - 2px); border: 0; border-radius: 0; background: none; box-shadow: none; }
/* on a line of the grid, a picker is as quiet as the boxes beside it until used */
.table.entry .ts-wrapper.input .ts-control { min-height: 30px; border-color: transparent; background: none; padding-left: 8px; }
.table.entry .ts-wrapper.input .ts-control:hover { border-color: var(--line-2); }
.table.entry .ts-wrapper.input.focus .ts-control { background: var(--surface); border-color: var(--accent); }
.table.entry .ts-wrapper.input.single .ts-control::after { display: none; }
@container (max-width: 560px) { .table.fold.entry .ts-wrapper.input .ts-control { min-height: var(--h); border-color: var(--line-2); background: var(--surface); } }
/* GSTIN: Fetch is the box's own end */
.affix > button.suf { color: var(--ink-2); font-weight: 600; }
/* the line grid: a number or a code is never cut short; the grid scrolls sideways first */
.table.entry td > .input.num { min-width: 76px; } .table.entry td > .input.mono { min-width: 84px; }
.table.entry td > .input[data-qty], .table.entry td > .input[data-disc] { min-width: 52px; }
.ts-wrapper.input .ts-control { flex-wrap: nowrap; overflow: hidden; } .ts-wrapper.input .ts-control > .item { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* File boxes: the browser's own "Choose file" button, drawn as one of ours */
.input[type="file"] { display: flex; align-items: center; height: auto; min-height: var(--h); padding: 4px 10px 4px 4px; color: var(--ink-3); font-size: 13px; cursor: pointer; }
.input[type="file"]::file-selector-button { height: calc(var(--h) - 10px); margin-right: 10px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: calc(var(--r) - 2px);
  background: var(--sunken); color: var(--ink); font: 600 13px/1 var(--sans, inherit); cursor: pointer; transition: background var(--t-fast) var(--ease); }
.input[type="file"]:hover::file-selector-button { background: color-mix(in srgb, var(--sunken) 60%, var(--line)); }
/* The procurement planner: small photos beside each item, and the vendors' photos as cards */
/* The procurement planner: a card per supplier, then one supplier's designs and photos as tiles */
.input.sm { height: 30px; padding: 0 8px; font-size: 13px; }
.plan-suppliers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.plan-sup { display: grid; overflow: hidden; color: inherit; transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.plan-sup:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
.plan-sup.warn { border-style: dashed; }
.plan-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; aspect-ratio: 4 / 1.4; background: var(--sunken); }
.plan-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plan-thumbs-none { grid-column: 1 / -1; display: grid; place-items: center; color: var(--ink-3); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
@media (max-width: 520px) { .plan-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .plan-facts dt { font-size: 9.5px; } }
.plan-card { display: grid; gap: 8px; align-content: start; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.plan-card.picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-img { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: var(--r); overflow: hidden; background: var(--sunken); }
.plan-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plan-noimg { height: 100%; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--ink-3); }
.plan-flag { position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 650; background: var(--neg); color: #fff; }
.plan-info { display: grid; gap: 2px; min-width: 0; } .plan-info b { font-size: 14px; line-height: 1.3; }
.plan-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0 2px; }
.plan-facts div { padding: 4px 6px; border-radius: 7px; background: var(--sunken); }
.plan-facts dt { font-size: 10.5px; color: var(--ink-3); } .plan-facts dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.plan-said { margin: 0; white-space: pre-line; }
.plan-read { display: flex; gap: 6px; align-items: flex-start; margin: 0; padding: 6px 8px; border-radius: 7px; background: var(--accent-soft); }
.plan-read svg { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--accent); }
.stepper { display: grid; grid-template-columns: auto 1fr auto; gap: 4px; align-items: center; }
.stepper .input { width: 100%; min-width: 0; height: 34px; text-align: center; font-weight: 650; }
.plan-bar { position: sticky; bottom: 12px; z-index: var(--z-sticky); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow-2); font-weight: 600; }
