/* Retail POS: DeepTech UX rules (docs/UX-RULES.md). Colour roles only, 4 px spacing grid, one type scale,
   nested radius, two shadows, one flat accent. Light 7:30 am – 7:29 pm, dark otherwise (or the user's choice). */
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(vendor/fonts/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url(vendor/fonts/barlow-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Plex Mono'; font-weight: 500; font-display: swap; src: url(vendor/fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --bg: #f3f4f1; --surface: #ffffff; --surface2: #eceee9; --text: #1a2220; --muted: #4f5b57; --line: #d6dbd7; --field-line: #7d8a85;
  --accent: #0a7259; --accent-hover: #08604b; --accent-ink: #ffffff; --accent-soft: #dcefe8;
  --good: #1b7537; --warn: #8a5300; --bad: #b0261c; --bad-soft: #fbe5e2; --warn-soft: #fbefd9; --good-soft: #e1f2e5;
  --sk: #e3e6e2; --sk-hi: #f1f3f0; --scrim: rgba(17, 24, 22, .55);
  --sh-s: 0 2px 8px rgba(16, 24, 22, .12); --sh-l: 0 16px 48px rgba(16, 24, 22, .24);
  --r-s: 8px; --r-m: 12px; --r-l: 16px;
  --f: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --t12: 12px; --t13: 13px; --t16: 16px; --t20: 20px; --t28: 28px; --t48: 48px;
  color-scheme: light;
}
:root[data-theme=dark] {
  --bg: #0e1312; --surface: #161d1b; --surface2: #1e2724; --text: #e7eeeb; --muted: #a2b0ab; --line: #2b3633; --field-line: #66766f;
  --accent: #39c9a0; --accent-hover: #5ad8b4; --accent-ink: #04241b; --accent-soft: #163a30;
  --good: #57c784; --warn: #e8a640; --bad: #f2786c; --bad-soft: #3a1d1a; --warn-soft: #3a2b12; --good-soft: #15301f;
  --sk: #1f2826; --sk-hi: #2a3532; --scrim: rgba(0, 0, 0, .66);
  --sh-s: 0 2px 8px rgba(0, 0, 0, .45); --sh-l: 0 16px 48px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: clip; }
body { font: 400 var(--t16)/1.45 var(--f); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; touch-action: manipulation; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; }
h1 { font-size: var(--t28); } h2 { font-size: var(--t20); } h3 { font-size: var(--t16); }
p { margin: 0 0 8px; }
a { color: var(--accent); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: var(--t13); }
.tiny { font-size: var(--t12); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hide { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* buttons: 44 px tap area, one solid primary per screen, loading keeps width, disabled says why */
button, .btn { font: 700 var(--t16)/1 var(--f); min-height: 44px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--field-line); background: var(--surface); color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, border-color .15s, transform .08s; position: relative; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--text); background: var(--surface2); }
button:active, .btn:active { transform: scale(.97); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; color: var(--text); }
button.ghost:hover { background: var(--surface2); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-soft); }
button.small { min-height: 36px; padding: 0 12px; font-size: var(--t13); }
button:disabled, button[aria-disabled=true] { opacity: .5; cursor: not-allowed; transform: none; }
button.busy { color: transparent !important; pointer-events: none; }
button.busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--field-line); border-top-color: var(--text); animation: spin .7s linear infinite; }
button.primary.busy::after { border-color: rgba(255, 255, 255, .45); border-top-color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.why { font-size: var(--t13); color: var(--muted); margin-top: 4px; }
@media (pointer: coarse) { button.small { min-height: 44px; } }
.iconbtn { width: 44px; padding: 0; }

/* fields with floating labels */
.field { position: relative; display: block; margin: 0; }
.field input, .field select, .field textarea { width: 100%; font: 400 var(--t16)/1.3 var(--f); color: var(--text); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r-s);
  padding: 22px 12px 8px; min-height: 52px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 80px; resize: vertical; }
.field select { padding-top: 22px; appearance: auto; }
.field > span { position: absolute; left: 13px; top: 16px; font-size: var(--t16); color: var(--muted); pointer-events: none; transition: all .15s ease; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field input:focus + span, .field input:not(:placeholder-shown) + span, .field select + span, .field textarea:focus + span, .field textarea:not(:placeholder-shown) + span { top: 6px; font-size: var(--t12); }
.field input::placeholder, .field textarea::placeholder { color: transparent; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.check { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
input.plain, select.plain { font: 400 var(--t16) var(--f); color: var(--text); background: var(--surface); border: 1px solid var(--field-line); border-radius: var(--r-s); min-height: 44px; padding: 0 12px; }
input.plain:focus, select.plain:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* layout */
#app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 8px; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail .brand { display: flex; gap: 8px; align-items: center; padding: 8px 8px 16px; }
.brand .mark { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.brand b { display: block; font-size: var(--t16); line-height: 1.1; }
.brand small { color: var(--muted); font-size: var(--t12); }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; --mo-ind: var(--accent-soft); }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r-s); color: var(--text); text-decoration: none; font-weight: 400; position: relative; z-index: 1; transition: background .15s; }
.nav a:hover { background: var(--surface2); }
.nav a.on { background: var(--accent-soft); font-weight: 700; }
.nav a svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .badge { margin-left: auto; }
.rail .foot { margin-top: auto; padding: 8px; font-size: var(--t12); color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
main { min-width: 0; padding: 24px 32px 96px; }
.topbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { flex: 1; min-width: 200px; }
.who { display: flex; align-items: center; gap: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--t13); color: #fff; flex: none; }
.demo-tag { display: inline-block; text-align: center; background: var(--text); color: var(--bg); font-size: var(--t12); font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: normal; }
.phonebar { display: none; }
/* side menu groups: an accordion; the panel grows and pushes the rest down, the arrow turns 180° */
.navg + .navg { margin-top: 4px; }
.navh { width: 100%; justify-content: space-between; min-height: 36px; padding: 0 12px; border: 0; background: none; font-size: var(--t12); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.navh:hover { background: none; color: var(--text); border: 0; }
.navh svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; transition: transform .25s ease; transform: rotate(-90deg); }
.navg.open .navh svg { transform: rotate(0deg); }
.navi { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.navi > div { overflow: hidden; display: flex; flex-direction: column; gap: 2px; }
.navg.open .navi { grid-template-rows: 1fr; }
.nav a { border-left: 3px solid transparent; }
.nav a.on { border-left-color: var(--accent); }
.burger { display: grid; gap: 4px; width: 20px; }
.burger i { display: block; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s ease, opacity .2s; }
body.menu-open .burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.menu-open .burger i:nth-child(2) { opacity: 0; }
body.menu-open .burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  /* push, don't cover: the menu comes in beside the page, the page slides right and shrinks to 86 % */
  .rail { display: flex; position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 80; transform: translateX(-100%); transition: transform .32s cubic-bezier(.2,.8,.2,1); visibility: hidden; border-right: 0; }
  body.menu-open .rail { transform: none; visibility: visible; }
  main, .phonebar { transition: transform .32s cubic-bezier(.2,.8,.2,1), border-radius .32s; transform-origin: 0 50%; }
  body.menu-open main { transform: translateX(260px) scale(.86); border-radius: var(--r-l); overflow: hidden; height: 100vh; pointer-events: none; box-shadow: var(--sh-l); background: var(--bg); }
  body.menu-open .phonebar { transform: translateX(260px) scale(.86); }
  body.menu-open { overflow: hidden; background: var(--surface); }
  body.menu-open .helpfab, body.menu-open .paybar { display: none; }
  .phonebar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .phonebar b { flex: 1; opacity: 0; transition: opacity .1s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 16px 12px 96px; }
  .topbar h1 { font-size: var(--t28); }
}

/* cards & tiles: 1 px border, no shadow */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; }
.card.tight { padding: 8px; }
.card h2, .card h3 { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.hero { display: grid; grid-template-columns: minmax(260px, 1.4fr) 1fr; gap: 16px; }
.g3f { grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; }
@media (max-width: 600px) { .g3f { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } }
.big { font-size: var(--t48); font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mid { font-size: var(--t28); font-weight: 700; font-variant-numeric: tabular-nums; }
.lbl { font-size: var(--t13); color: var(--muted); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.spark { width: 100%; height: 64px; display: block; margin-top: 12px; }
.spark path.l { fill: none; stroke: var(--accent); stroke-width: 2; }
.spark path.a { fill: var(--accent-soft); stroke: none; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars div { flex: 1; background: var(--field-line); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; transition: background .15s; }
.bars div.today { background: var(--accent); }
.bars div:hover { background: var(--text); }
.barlbl { display: flex; gap: 4px; font-size: var(--t12); color: var(--muted); margin-top: 4px; }
.barlbl span { flex: 1; text-align: center; overflow: hidden; }
.dot { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t13); font-weight: 700; }
.dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot.good { color: var(--good); } .dot.warn { color: var(--warn); } .dot.bad { color: var(--bad); } .dot.idle { color: var(--muted); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--bad); color: #fff; font-size: var(--t12); font-weight: 700; }
:root[data-theme=dark] .badge { color: #2a0906; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: var(--t12); font-weight: 700; background: var(--surface2); color: var(--text); border: 1px solid var(--line); }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.attn a { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 12px; border-radius: var(--r-s); text-decoration: none; color: var(--text); border: 1px solid var(--line); }
.attn a:hover { border-color: var(--text); }
.attn a + a { margin-top: 8px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t16); }
.tbl th { text-align: left; font-size: var(--t13); color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); cursor: pointer; white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; transition: background .12s; }
.tbl tr.click:hover td { background: var(--surface2); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; font-weight: 400; color: var(--muted); padding: 0 12px; white-space: nowrap; }
.tabs button:hover { color: var(--text); background: none; }
.tabs button.on { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field-line); background: var(--surface); font-weight: 400; white-space: nowrap; flex: none; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }
@media (pointer: coarse) { .chip { min-height: 44px; } }

/* skeletons: shimmer left to right, same size as the content */
.sk { background: linear-gradient(90deg, var(--sk) 0%, var(--sk) 40%, var(--sk-hi) 50%, var(--sk) 60%, var(--sk) 100%); background-size: 300% 100%; animation: shim 1.3s linear infinite; border-radius: 6px; color: transparent !important; }
@keyframes shim { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skline { height: 16px; margin: 8px 0; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); z-index: 200; width: 0; opacity: 0; transition: width .2s ease-out, opacity .3s; }

/* till */
.till { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.till > section { min-width: 0; }
.paybar { display: none; }
@media (max-width: 1150px) { .till { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 800px) { .till { grid-template-columns: minmax(0, 1fr); } .basket { position: static !important; max-height: none; } .prods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paybar { display: flex; position: fixed; left: 12px; right: 72px; bottom: 12px; z-index: 44; min-height: 52px; justify-content: space-between; box-shadow: var(--sh-s); } }
.scan { display: flex; gap: 8px; margin-bottom: 12px; }
.scan input { flex: 1; }
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.prod { text-align: left; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px; min-height: 104px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); font-weight: 400; }
.prod:hover { border-color: var(--text); background: var(--surface); }
.prod b { font-size: var(--t16); line-height: 1.2; }
.prod .p { margin-top: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.prod .q { font-size: var(--t12); color: var(--muted); }
.prod .q.out { color: var(--bad); font-weight: 700; }
.prod .deal { font-size: var(--t12); color: var(--accent); font-weight: 700; }
:root[data-theme=dark] .prod .deal { color: var(--accent); }
.basket { position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 32px); padding: 0; overflow: hidden; }
.basket .head { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.blines { overflow-y: auto; flex: 1; padding: 4px 8px; min-height: 120px; }
.bline { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px; border-radius: var(--r-s); cursor: pointer; transition: background .12s; }
.bline:hover { background: var(--surface2); }
.bline .nm { font-weight: 700; }
.bline .sub { font-size: var(--t13); color: var(--muted); }
.bline .deal { font-size: var(--t13); color: var(--accent); }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { min-height: 36px; width: 36px; padding: 0; font-size: var(--t20); }
@media (pointer: coarse) { .qty button { min-height: 44px; width: 44px; } }
.qty span { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals { padding: 12px 16px; border-top: 1px solid var(--line); }
.totals .tr { display: flex; justify-content: space-between; font-size: var(--t16); padding: 2px 0; font-variant-numeric: tabular-nums; }
.totals .tr.disc { color: var(--accent); }
.totals .tr.grand { font-size: var(--t28); font-weight: 700; padding-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.member { display: flex; gap: 8px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); min-height: 52px; }

/* dialogs: dim the page behind, one thing to look at */
dialog { border: 0; padding: 0; border-radius: var(--r-l); background: var(--surface); color: var(--text); box-shadow: var(--sh-l); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog.wide { width: min(880px, calc(100vw - 24px)); }
dialog::backdrop { background: var(--scrim); }
dialog .dh { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px 24px; }
dialog .dh h2 { flex: 1; }
dialog .db { padding: 8px 24px 16px; overflow-y: auto; max-height: calc(100vh - 200px); }
dialog .df { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 24px 24px; flex-wrap: wrap; }
@media (max-width: 600px) { dialog .db { padding: 8px 16px 16px; } dialog .df { padding: 12px 16px 16px; } dialog .df button { flex: 1; } }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 16px auto 0; }
.pinpad button { min-height: 60px; font-size: var(--t28); font-weight: 400; }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
.pindots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--field-line); transition: background .1s, transform .1s; }
.pindots i.on { background: var(--text); border-color: var(--text); transform: scale(1.1); }
.pindots.ok i { background: var(--good); border-color: var(--good); }
.err { color: var(--bad); font-size: var(--t13); min-height: 20px; font-weight: 700; }
.note { background: var(--surface2); border-radius: var(--r-s); padding: 12px; font-size: var(--t13); }
.steps { display: flex; align-items: center; gap: 0; margin: 4px 0 16px; }
.steps span { display: flex; align-items: center; gap: 8px; font-size: var(--t13); color: var(--muted); white-space: nowrap; }
.steps span b { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--field-line); display: grid; place-items: center; font-size: var(--t12); }
.steps span.on { color: var(--text); font-weight: 700; } .steps span.on b, .steps span.done b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps i { flex: 1; height: 2px; background: var(--line); margin: 0 8px; min-width: 16px; position: relative; overflow: hidden; }
.steps i.done::after { content: ''; position: absolute; inset: 0; background: var(--accent); animation: fill .4s ease forwards; }
@keyframes fill { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.methods button { min-height: 64px; flex-direction: column; gap: 4px; font-weight: 400; }
.methods button.on { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 700; }
.cashq { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; }
.paybig { text-align: center; padding: 8px 0 16px; }
.receipt { font-family: var(--mono); font-size: var(--t13); background: #fff; color: #111; padding: 16px; border-radius: var(--r-s); border: 1px dashed var(--field-line); max-width: 340px; margin: 0 auto; line-height: 1.5; }
.receipt .c { text-align: center; } .receipt .tr span:last-child { white-space: nowrap; } .receipt .tr { display: flex; justify-content: space-between; gap: 8px; } .receipt hr { border: 0; border-top: 1px dashed #888; margin: 8px 0; }
.receipt .b { font-weight: 700; font-size: 1.15em; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: var(--r-m); box-shadow: var(--sh-l); z-index: 300; font-weight: 700; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--sh-s); padding: 4px; z-index: 90; min-width: 200px; }
.menu button { width: 100%; justify-content: flex-start; border: 0; font-weight: 400; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--sh-s); z-index: 20; max-height: 280px; overflow-y: auto; padding: 4px; }
.sugg button { width: 100%; justify-content: space-between; border: 0; font-weight: 400; text-align: left; }
.helpfab { position: fixed; right: 16px; bottom: 16px; z-index: 45; width: 48px; height: 48px; border-radius: 50%; font-size: var(--t20); box-shadow: var(--sh-s); }
body:has(dialog[open]) .helpfab { display: none; }
.vchips { display: flex; flex-wrap: wrap; gap: 8px; }
.vchips button { min-width: 64px; flex-direction: column; gap: 0; min-height: 56px; font-weight: 400; }
.vchips button small { font-size: var(--t12); color: var(--muted); }
.vchips button.on { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 700; }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px 64px; }
.signin .box { width: min(920px, 100%); }
.biz { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 24px 0; }
.biz button { flex-direction: column; align-items: flex-start; text-align: left; min-height: 120px; padding: 16px; gap: 8px; font-weight: 400; border-radius: var(--r-l); border-color: var(--line); }
.biz button:hover { border-color: var(--text); }
.biz button.on { border: 2px solid var(--accent); background: var(--accent-soft); }
.biz button b { font-size: var(--t20); }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.names button { justify-content: flex-start; gap: 12px; min-height: 56px; font-weight: 400; text-align: left; }
.names button small { display: block; color: var(--muted); font-size: var(--t12); }

@media print {
  body * { visibility: hidden; }
  .printme, .printme * { visibility: visible; }
  .printme { position: absolute; left: 0; top: 0; width: 72mm; border: 0 !important; padding: 0 !important; color: #000; background: #fff; }
  .printpage, .printpage * { visibility: visible; }
  .printpage { position: absolute; left: 0; top: 0; width: 100%; }
}

/* copy button: morph, don't swap */
button.copy { min-height: 32px; padding: 0 8px; gap: 4px; font-size: var(--t12); font-weight: 700; color: var(--muted); transition: padding .25s ease, color .2s, background .2s; }
button.copy svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button.copy .cl { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .25s ease; }
button.copy:hover .cl, button.copy:focus-visible .cl, button.copy.done .cl { max-width: 72px; }
button.copy.done { color: var(--good); padding: 0 12px; }
@media (pointer: coarse) { button.copy { min-height: 44px; } }

/* joined steps for the document chain: the line fills, then the next step lights up */
.chain { display: flex; align-items: center; margin: 0 0 16px; overflow-x: auto; }
.chain a, .chain span.st { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t13); color: var(--muted); white-space: nowrap; text-decoration: none; padding: 4px 0; min-height: 36px; }
.chain b { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; border: 2px solid var(--field-line); display: grid; place-items: center; font-size: var(--t12); color: var(--text); background: var(--surface); }
.chain .done b { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chain .here { color: var(--text); font-weight: 700; }
.chain .here b { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chain .void b { border-style: dashed; }
.chain i { flex: 1; min-width: 24px; height: 2px; background: var(--line); margin: 0 8px; position: relative; overflow: hidden; }
.chain i.done::after { content: ''; position: absolute; inset: 0; background: var(--accent); transform-origin: left; animation: fill .4s ease both; }
.chain i.done:nth-of-type(2)::after { animation-delay: .4s; } .chain i.done:nth-of-type(3)::after { animation-delay: .8s; }

/* A4 documents: a real sheet on screen, the only thing printed */
.a4wrap { background: var(--surface2); border-radius: var(--r-m); padding: 16px; overflow: auto; }
.a4 { background: #fff; color: #1a1a1a; width: 210mm; max-width: 100%; min-height: 270mm; margin: 0 auto; padding: 14mm 14mm 12mm; font: 400 10.5pt/1.45 var(--f); box-shadow: var(--sh-s); display: flex; flex-direction: column; }
.a4 .lh { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 12px; border-bottom: 2px solid #1a1a1a; }
.a4 .co b { font-size: 15pt; display: block; letter-spacing: -.01em; }
.a4 .co div { font-size: 9pt; color: #3d3d3d; }
.a4 .mark2 { width: 42px; height: 42px; border-radius: 8px; background: #1a1a1a; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16pt; flex: none; }
.a4 .ttl { text-align: right; }
.a4 .ttl h2 { font-size: 20pt; letter-spacing: .06em; margin: 0; }
.a4 .ttl .ms { font-size: 9pt; color: #555; letter-spacing: .1em; text-transform: uppercase; }
.a4 .meta { display: grid; grid-template-columns: auto auto; gap: 2px 12px; justify-content: end; margin-top: 8px; font-size: 9.5pt; }
.a4 .meta span:nth-child(odd) { color: #555; }
.a4 .meta .mono { font-size: 9.5pt; }
.a4 .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 16px 0; }
.a4 .parties h4 { font-size: 8pt; letter-spacing: .12em; text-transform: uppercase; color: #555; margin: 0 0 4px; }
.a4 .parties div { font-size: 9.5pt; white-space: pre-line; }
.a4 table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.a4 th { text-align: left; font-size: 8pt; letter-spacing: .08em; text-transform: uppercase; color: #3d3d3d; border-top: 1px solid #1a1a1a; border-bottom: 1px solid #1a1a1a; padding: 6px 4px; }
.a4 td { padding: 6px 4px; border-bottom: 1px solid #ddd; vertical-align: top; }
.a4 .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.a4 .tot { margin-left: auto; width: 46%; margin-top: 8px; font-size: 10pt; }
.a4 .tot div { display: flex; justify-content: space-between; padding: 3px 4px; font-variant-numeric: tabular-nums; }
.a4 .tot .g { border-top: 2px solid #1a1a1a; border-bottom: 2px solid #1a1a1a; font-weight: 700; font-size: 12pt; margin-top: 4px; padding: 6px 4px; }
.a4 .words { font-size: 9pt; font-style: italic; margin-top: 8px; }
.a4 .terms { margin-top: 16px; font-size: 8.5pt; color: #3d3d3d; white-space: pre-line; }
.a4 .terms h4 { font-size: 8pt; letter-spacing: .1em; text-transform: uppercase; color: #1a1a1a; margin: 8px 0 2px; }
.a4 .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: auto; padding-top: 40px; font-size: 9pt; }
.a4 .sign div { border-top: 1px solid #1a1a1a; padding-top: 4px; }
.a4 .stamp { display: inline-block; border: 2px solid #b0261c; color: #b0261c; font-weight: 700; letter-spacing: .14em; padding: 2px 10px; transform: rotate(-4deg); margin-top: 8px; }
.a4 .stamp.paid { border-color: #1b7537; color: #1b7537; }
.a4 .foot { font-size: 8pt; color: #555; text-align: center; margin-top: 12px; }
@media (max-width: 700px) { .a4 { padding: 16px; font-size: 9pt; min-height: 0; } .a4 .parties { grid-template-columns: 1fr; } .a4 .tot { width: 100%; } }

/* charts: thin marks, rounded data ends, recessive grid, a tooltip on hover */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text, .chart text.ax { fill: var(--muted); font-size: 12px; font-family: var(--f); }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.prev { stroke: var(--field-line); stroke-dasharray: 4 4; }
.chart .ln.cur { stroke: var(--accent); }
.chart .area { fill: var(--accent-soft); }
.chart .xh { stroke: var(--text); stroke-width: 1; opacity: 0; }
.chart .dotm { fill: var(--accent); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.chart.hover .xh, .chart.hover .dotm { opacity: 1; }
.tip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-s); box-shadow: var(--sh-s); padding: 8px 12px; font-size: var(--t13); white-space: nowrap; z-index: 5; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.tip.on { opacity: 1; transform: none; }
.tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: var(--t13); color: var(--text); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 16px; height: 3px; border-radius: 2px; background: var(--c); }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--field-line) 0 4px, transparent 4px 8px); }
.heat { display: grid; grid-template-columns: 40px repeat(16, minmax(0, 1fr)); gap: 2px; font-size: var(--t12); color: var(--muted); }
.heat span { display: grid; place-items: center; }
.heat .c { aspect-ratio: 1.4; border-radius: 3px; background: color-mix(in srgb, var(--accent) var(--v), var(--surface2)); cursor: default; position: relative; }
.heat .c:hover { outline: 2px solid var(--text); outline-offset: 1px; z-index: 1; }
.hbar { display: grid; grid-template-columns: minmax(120px, 38%) 1fr auto; gap: 8px 12px; align-items: center; font-size: var(--t13); }
.hbar .t { height: 12px; background: var(--surface2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .t div { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.hbar .v { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.spark2 { width: 120px; height: 28px; display: block; }
.spark2 path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* report index cards, books tables */
.rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rcard { text-align: left; align-items: flex-start; flex-direction: column; gap: 4px; padding: 16px; min-height: 96px; border-radius: var(--r-l); border-color: var(--line); font-weight: 400; }
.rcard b { font-size: var(--t16); }
.rcard span { color: var(--muted); font-size: var(--t13); line-height: 1.35; }
.rcard:hover { border-color: var(--text); background: var(--surface); }
.books td.code, .books .code { font-family: var(--mono); font-size: var(--t13); color: var(--muted); width: 64px; }
.books tr.sec td { font-weight: 700; padding-top: 16px; border-bottom: 1px solid var(--text); }
.books tr.sub td { font-weight: 700; background: var(--surface2); }
.books tr.grand td { font-weight: 700; font-size: var(--t20); border-top: 2px solid var(--text); border-bottom: 3px double var(--text); }
.books td.ind { padding-left: 24px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-content: start; }
.tiles .card { padding: 12px 16px; }
.tiles .v { font-size: var(--t20); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jlines input.plain, .jlines select.plain { width: 100%; }
.diff-ok { color: var(--good); } .diff-bad { color: var(--bad); }
.dz { border: 2px dashed var(--field-line); border-radius: var(--r-m); padding: 16px; text-align: center; color: var(--muted); }
tr.tot td { font-weight: 700; border-top: 2px solid var(--text); }
.seg { display: inline-flex; border: 1px solid var(--field-line); border-radius: var(--r-s); overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 40px; font-weight: 400; }
.seg button + button { border-left: 1px solid var(--field-line); }
.seg button.on { background: var(--text); color: var(--bg); font-weight: 700; }
@media (pointer: coarse) { .seg button { min-height: 44px; } }

@media print {
  body.print-a4 * { visibility: hidden !important; }
  body.print-a4 .a4, body.print-a4 .a4 * { visibility: visible !important; }
  body.print-a4 .a4 { position: absolute; left: 0; top: 0; width: 100%; min-height: 0; padding: 0; box-shadow: none; margin: 0; }
  body.print-a4 dialog { position: static; box-shadow: none; max-height: none; overflow: visible; }
  body.print-a4 dialog .db { max-height: none; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .steps i.done::after, .chain i.done::after { animation: none; } }
