/* accounting.css — Accounting & Inventory (/accounting/ and its pages).
   The pages are generated: see scripts/build-accounting.js.

   THE LOOK. A working window, not a web page: a dark bar across the top with the company,
   the period and the date; the screen below it, ruled like a register; and down the right
   a column of keys, each a button with its key on it. Words are IBM Plex Sans, every figure
   is in figures of one width so a column reads down; titles of statements are set in
   Source Serif 4, the face of a printed statement. One colour, an indigo ink, marks where
   you are: the chosen line of a list carries an indigo bar on its left.

   THE LAYOUT. On a wide screen the keys stand down the right of the window. On a phone
   they become a strip along its foot that scrolls sideways, forms stack into one column,
   and a line of a voucher becomes a small card. On the website the window is as tall as
   the screen allows; installed, it fills the screen. */
:root{
  color-scheme:light;
  --bg:#eceef4; --panel:#ffffff; --raised:#ffffff; --sheet:#f7f8fa;
  --ink:#141821; --ink2:#525a68; --ink3:#878e9a;
  --line:rgba(20,24,33,.10); --line2:rgba(20,24,33,.19);
  --fill:rgba(20,24,33,.04); --fill2:rgba(20,24,33,.08);
  --accent:#3640a8; --accent-soft:rgba(54,64,168,.09); --ring:rgba(54,64,168,.32);
  --primary:#3640a8; --on-primary:#ffffff;
  --top:#2f3994; --top-ink:#ffffff; --top-dim:#c5cbf2;
  --keys:#eef0f8;
  --pos:#12795a; --neg:#b42318; --neg-soft:rgba(180,35,24,.09); --warn:#8a5300; --warn-soft:rgba(196,124,0,.14);
  --shadow:0 1px 2px rgba(20,24,33,.06), 0 18px 40px -24px rgba(20,24,33,.35);
  --ui:"IBM Plex Sans","Segoe UI",system-ui,-apple-system,sans-serif;
  --serif:"Source Serif 4","Iowan Old Style","Palatino Linotype",Georgia,serif;
  --h:36px; --r:8px;
  /* the names the shared guide and related-tools styles look for */
  --cream:var(--bg); --paper:var(--panel); --inksoft:var(--ink2); --maroon:var(--accent); --gold:var(--accent); --golddeep:var(--ink2); --radius:14px;
}
/* dark, when chosen with the button in the top bar (js/theme.js); light is the default */
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0a0c11; --panel:#12151d; --raised:#191d27; --sheet:#0f121a;
  --ink:#e7e9ef; --ink2:#a2a8b5; --ink3:#6c7381;
  --line:rgba(231,233,239,.09); --line2:rgba(231,233,239,.18);
  --fill:rgba(231,233,239,.05); --fill2:rgba(231,233,239,.10);
  --accent:#a3abff; --accent-soft:rgba(163,171,255,.13); --ring:rgba(163,171,255,.35);
  --primary:#e7e9ef; --on-primary:#12151d;
  --top:#05070b; --top-ink:#e7e9ef; --top-dim:#8a91a0;
  --keys:#0e1118;
  --pos:#5fd3a6; --neg:#ff8f80; --neg-soft:rgba(255,143,128,.12); --warn:#f0b65a; --warn-soft:rgba(240,182,90,.13);
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 18px 40px -20px rgba(0,0,0,.7);
}
@media (pointer:coarse){ :root{ --h:44px; } }

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html,body{ height:100%; }
html{ -webkit-text-size-adjust:100%; }
[hidden]{ display:none !important; }
body{ font-family:var(--ui); font-size:14.5px; line-height:1.45; background:var(--bg); color:var(--ink); display:flex; flex-direction:column; min-height:100%; -webkit-font-smoothing:antialiased; }
button, input, select, textarea{ font:inherit; letter-spacing:inherit; color:inherit; }
button{ touch-action:manipulation; cursor:pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
svg{ display:block; }
kbd{ font:500 11px/1 var(--ui); padding:3px 5px; border-radius:4px; border:1px solid var(--line2); background:var(--fill); color:var(--ink2); white-space:nowrap; }
::selection{ background:var(--accent-soft); }

/* ---------- the website around the app ---------- */
header.site{ display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:8px 24px; border-bottom:1px solid var(--line); }
header.site .brand{ font-weight:700; font-size:16px; color:var(--ink); text-decoration:none; white-space:nowrap; }
header.site .brand img{ width:24px; height:24px; margin-right:8px; vertical-align:-6px; display:inline-block; border-radius:6px; }
header.site .brand span{ color:var(--ink2); }
.hdr-right{ display:flex; align-items:center; gap:14px; }
header.site .back{ font-size:14px; color:var(--ink2); text-decoration:none; }
.hdr-install{ display:inline-flex; align-items:center; gap:7px; min-height:36px; padding:0 14px 0 11px; border:none; border-radius:9px; background:var(--primary); color:var(--on-primary); font-size:14px; font-weight:600; }
.hdr-install svg{ width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
main{ width:100%; max-width:1400px; margin:0 auto; padding:16px 24px calc(48px + env(safe-area-inset-bottom)); }
h1.title{ font-family:var(--serif); font-size:38px; line-height:1.1; font-weight:600; letter-spacing:-.02em; margin:8px 2px 4px; }
.sub{ color:var(--ink2); font-size:15.5px; margin:0 2px 16px; max-width:80ch; }
.installcard{ display:flex; align-items:center; gap:14px; padding:12px 14px; margin-bottom:10px; border-radius:14px; background:var(--panel); border:1px solid var(--line); box-shadow:var(--shadow); }
.installcard img{ flex:none; width:44px; height:44px; border-radius:10px; }
.ic-text{ flex:1; min-width:0; display:flex; flex-direction:column; }
.ic-text span{ color:var(--ink2); font-size:13.5px; }
.panel{ background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:20px; margin:16px 0; }
.step-label{ font-family:var(--serif); font-size:20px; font-weight:600; margin:0 0 12px; }
.webonly-tools{ margin:12px 0 0; }
body .mh-guide{ color:var(--ink); line-height:1.6; }
body .mh-guide h2{ font-family:var(--serif); font-size:23px; font-weight:600; letter-spacing:-.012em; color:var(--ink); margin-top:28px; }
body .mh-guide p, body .mh-guide li, body .mh-guide td, body .mh-guide th{ font-size:15.5px; }
body .mh-guide a{ color:var(--accent); font-weight:500; text-decoration:none; }
body .mh-guide th{ font-size:11.5px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--ink2); }
body .mh-guide th, body .mh-guide td{ border-bottom:1px solid var(--line); }
body .mh-guide kbd{ font-size:12px; }
body .mh-guide .mh-note{ font-size:14.5px; color:var(--ink2); border-left:3px solid var(--accent); padding:2px 0 2px 14px; }
details.faq{ border-top:1px solid var(--line); }
details.faq:first-of-type{ border-top:none; }
details.faq summary{ list-style:none; cursor:pointer; font-size:16px; font-weight:500; padding:14px 28px 14px 0; position:relative; }
details.faq summary::-webkit-details-marker{ display:none; }
details.faq summary::after{ content:"+"; position:absolute; right:4px; top:11px; font-size:20px; font-weight:300; color:var(--ink2); }
details.faq[open] summary::after{ content:"−"; }
details.faq p{ color:var(--ink2); font-size:15px; line-height:1.55; padding:0 0 16px; max-width:80ch; }
.occasions{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.occasions a{ font-size:14.5px; font-weight:500; padding:8px 14px; border-radius:999px; border:1px solid var(--line2); color:var(--ink); text-decoration:none; }
.occasions a:hover{ background:var(--fill); }
.more{ font-size:14px; color:var(--ink2); line-height:1.7; }
.more a{ color:var(--accent); text-decoration:none; font-weight:500; }
footer.site{ text-align:center; color:var(--ink2); font-size:13px; padding:24px 16px 30px; margin-top:auto; }
footer.site a{ color:var(--ink); text-decoration:none; }
body .mh-related{ font-family:var(--ui); color:var(--ink); }
body .mh-related-head h2{ font-family:var(--serif); font-size:23px; font-weight:600; color:var(--ink); }
body .mh-related-head a{ color:var(--accent); font-size:14px; font-weight:500; }
body .mh-related li a{ background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:none; }
body .mh-tx b{ color:var(--ink); font-weight:600; }
body .mh-tx span{ color:var(--ink2); }

/* ---------- buttons and boxes ---------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; font-size:14px; font-weight:500; min-height:var(--h); padding:0 14px; border:1px solid var(--line2); border-radius:var(--r); background:var(--raised); color:var(--ink); text-decoration:none; white-space:nowrap; user-select:none; -webkit-user-select:none; }
.btn:hover{ background:var(--fill); }
.btn.solid{ background:var(--primary); color:var(--on-primary); border-color:transparent; font-weight:600; }
.btn.solid:hover{ opacity:.9; }
.btn.solid kbd{ background:transparent; border-color:color-mix(in srgb, var(--on-primary) 35%, transparent); color:inherit; opacity:.8; }
.btn.danger{ color:var(--neg); }
.btn.solid.danger{ background:var(--neg); color:#fff; }
.btn.sm{ font-size:13px; min-height:30px; padding:0 10px; }
.btn.big{ min-height:44px; padding:0 18px; font-size:15px; }
.btnrow{ display:flex; flex-wrap:wrap; gap:10px; }
.xbtn{ flex:none; width:28px; height:28px; border-radius:50%; border:none; background:var(--fill2); font-size:12px; font-weight:700; color:var(--ink2); line-height:1; }
.xbtn:hover{ color:var(--neg); }
.linkbtn{ border:none; background:none; color:var(--accent); font-weight:600; padding:0; text-decoration:underline; text-underline-offset:3px; }
input, select, textarea{ width:100%; min-height:var(--h); padding:6px 9px; border:1px solid var(--line2); border-radius:7px; background:var(--raised); outline:none; font-variant-numeric:tabular-nums; }
textarea{ resize:vertical; min-height:58px; line-height:1.4; }
input:focus, select:focus, textarea:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--ring); }
input[readonly]{ background:var(--fill); }
input[type=checkbox]{ width:18px; height:18px; min-height:0; accent-color:var(--accent); }
.note{ font-size:13.5px; color:var(--ink2); line-height:1.5; margin:8px 0; max-width:96ch; }
.empty{ color:var(--ink2); padding:18px 4px; }
.dim{ color:var(--ink2); }
.neg{ color:var(--neg); }
.pos{ color:var(--pos); }
.warn{ font-size:13.5px; color:var(--warn); background:var(--warn-soft); padding:9px 14px; }
.tag{ font-size:11.5px; font-weight:600; padding:2px 8px; border-radius:99px; background:var(--fill2); }
.tag.neg{ background:var(--neg-soft); color:var(--neg); }

/* ---------- the window ---------- */
.win{ display:flex; flex-direction:column; height:clamp(600px, calc(100dvh - 96px), 940px); background:var(--panel); border:1px solid var(--line2); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
.topbar{ flex:none; display:flex; align-items:stretch; gap:2px; background:var(--top); color:var(--top-ink); padding:0 6px; min-height:52px; }
.topbar button{ border:none; background:none; color:inherit; text-align:left; border-radius:8px; margin:5px 0; }
.topbar button:hover:not(:disabled){ background:rgba(255,255,255,.08); }
.topbar button:disabled{ cursor:default; opacity:.55; }
.tb-co{ flex:1; min-width:0; display:flex; align-items:center; gap:10px; padding:4px 10px; }
.tb-co img{ flex:none; border-radius:7px; }
.tb-co span{ min-width:0; display:flex; flex-direction:column; }
.tb-co b{ font-size:15px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tb-co small, .tb-cell small{ font-size:11.5px; color:var(--top-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tb-cell{ flex:none; display:flex; flex-direction:column; justify-content:center; padding:2px 14px; border-left:1px solid rgba(255,255,255,.1) !important; border-radius:0 !important; margin:8px 0 !important; }
.tb-cell b{ font-size:13.5px; font-weight:600; white-space:nowrap; font-variant-numeric:tabular-nums; }
.tb-help{ flex:none; width:40px; display:flex !important; align-items:center; justify-content:center; font-weight:700; font-size:16px; text-align:center !important; }
.tb-theme svg, .tb-full svg{ width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.tb-full .i-out, body.win-full .tb-full .i-in{ display:none; }
.tb-theme .i-sun, [data-theme="dark"] .tb-theme .i-moon{ display:none; }
[data-theme="dark"] .tb-theme .i-sun{ display:block; }
 body.win-full .tb-full .i-out{ display:block; }
.updatebar{ flex:none; display:flex; align-items:center; gap:12px; padding:7px 10px 7px 16px; background:var(--accent); color:#fff; font-size:13.5px; }
.updatebar span{ flex:1; }
.updatebar .btn{ background:#fff; color:var(--accent); border:none; }
.updatebar .xbtn{ background:rgba(255,255,255,.2); color:#fff; }
.body{ flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr) 196px; }
.screen{ position:relative; min-width:0; overflow:auto; outline:none; background:var(--panel); scroll-padding-top:60px; }
.sh{ position:sticky; top:0; z-index:5; display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:12px 18px 10px; background:color-mix(in srgb, var(--panel) 94%, transparent); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px); border-bottom:1px solid var(--line); }
.sh-t{ min-width:0; display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; }
.sh h2{ font-family:var(--serif); font-size:21px; font-weight:600; letter-spacing:-.01em; line-height:1.2; }
.sh-sub{ font-size:13px; color:var(--ink2); }
.crumbs{ display:flex; gap:6px; font-size:12px; color:var(--ink3); white-space:nowrap; overflow:hidden; }
.crumbs span::after{ content:"›"; margin-left:6px; }
.sb{ padding:14px 18px 40px; }

/* the keys down the right */
.keys{ min-height:0; overflow:auto; background:var(--keys); border-left:1px solid var(--line); padding:8px 7px; display:flex; flex-direction:column; gap:3px; scrollbar-width:thin; }
.kb{ display:grid; grid-template-columns:62px 1fr; align-items:center; gap:6px; min-height:31px; padding:3px 7px; border:1px solid transparent; border-radius:7px; background:none; text-align:left; font-size:12.5px; line-height:1.15; color:var(--ink); }
.kb:hover{ background:var(--panel); border-color:var(--line); }
.kb kbd{ justify-self:start; font-size:10.5px; background:var(--panel); }
.kb.pri{ background:var(--primary); color:var(--on-primary); }
.kb.pri kbd{ background:transparent; color:inherit; border-color:color-mix(in srgb, var(--on-primary) 35%, transparent); }
.kb.off{ opacity:.4; cursor:default; }
.ksep{ display:block; height:1px; background:var(--line); margin:5px 4px; }

/* ---------- lists and reports ---------- */
.rt{ width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
.rt th{ font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--ink2); text-align:left; padding:7px 10px; border-bottom:1px solid var(--line2); white-space:nowrap; }
.rt td{ padding:6px 10px; border-bottom:1px solid var(--line); vertical-align:top; }
.rt .num{ text-align:right; white-space:nowrap; }
.rt tr[data-open]{ cursor:pointer; }
.rt tbody tr:hover td{ background:var(--fill); }
.rt tr.sel td{ background:var(--accent-soft); }
.rt tr.sel td:first-child{ box-shadow:inset 3px 0 0 var(--accent); }
.rt tr.grp td{ font-weight:600; }
.rt tr.sub td{ color:var(--ink2); font-size:13.5px; padding-top:4px; padding-bottom:4px; }
.rt tr.sum td{ font-weight:600; border-top:1px solid var(--line2); }
.rt tr.net td{ color:var(--accent); }
.rt tr.cancelled td{ color:var(--ink3); text-decoration:line-through; }
.rt tr.none td{ color:var(--ink2); padding:22px 10px; }
.rt tfoot td{ border-top:1.5px solid var(--ink); border-bottom:3px double var(--line2); padding:8px 10px; white-space:nowrap; }
.rt tfoot tr + tr td{ border-top:none; border-bottom:1px solid var(--line); }
.rt small{ font-size:12px; }
.rt.tree tr.group td{ font-size:14px; }
.rblocks{ display:grid; gap:18px; }
.rblocks.split{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 22px; }
.rblock{ min-width:0; overflow-x:auto; }
.rb-t{ font-family:var(--serif); font-size:16px; font-weight:600; padding:4px 10px 6px; }
.kpi{ display:flex; flex-wrap:wrap; gap:10px 28px; margin:0 0 14px; font-size:14px; color:var(--ink2); }
.kpi b{ font-family:var(--serif); font-size:20px; margin-left:6px; color:var(--ink); }
.kpi b.neg{ color:var(--neg); } .kpi b.pos{ color:var(--pos); }
.ages{ display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin:0 0 14px; }
.ages div{ background:var(--sheet); border:1px solid var(--line); border-radius:9px; padding:8px 10px; display:flex; flex-direction:column; }
.ages span{ font-size:11.5px; color:var(--ink2); }
.ages b{ font-size:15px; font-variant-numeric:tabular-nums; }
.brs{ display:flex; flex-wrap:wrap; gap:8px; margin:0 0 14px; }
.brs div{ flex:1 1 200px; background:var(--sheet); border:1px solid var(--line); border-radius:9px; padding:9px 12px; display:flex; flex-direction:column; }
.brs div.tot{ border-color:var(--accent); }
.brs span{ font-size:12px; color:var(--ink2); }
.brs b{ font-size:16px; font-variant-numeric:tabular-nums; }
.bdate{ min-height:30px; padding:2px 6px; width:150px; }
.findbar{ display:flex; gap:10px; margin:0 0 12px; }
.findbar input{ flex:1; }

/* ---------- the main menu ---------- */
.gw{ display:grid; grid-template-columns:minmax(0,1fr) minmax(300px,380px); gap:22px; align-items:start; }
.gw-card{ background:var(--sheet); border:1px solid var(--line); border-radius:12px; padding:16px 18px; }
.gw-co{ display:flex; flex-direction:column; margin-bottom:12px; }
.gw-co b{ font-family:var(--serif); font-size:22px; font-weight:600; line-height:1.2; }
.gw-co span{ color:var(--ink2); font-size:13px; }
.gw-dl, .gw-figs{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px 18px; padding:12px 0; border-top:1px solid var(--line); }
.gw-dl dt, .gw-figs dt{ font-size:11.5px; color:var(--ink2); text-transform:uppercase; letter-spacing:.04em; }
.gw-dl dd{ font-weight:600; font-size:14px; }
.gw-figs dd{ font-family:var(--serif); font-size:19px; font-weight:600; font-variant-numeric:tabular-nums; }
.gw-tip{ font-size:13.5px; color:var(--ink2); border-top:1px solid var(--line); padding-top:12px; }
.gw-warn{ font-size:13.5px; color:var(--warn); background:var(--warn-soft); border-radius:8px; padding:8px 12px; margin-top:10px; }
.menu{ background:var(--panel); border:1px solid var(--line2); border-radius:12px; padding:8px 6px 10px; }
.mh{ font-size:10.5px; font-weight:600; letter-spacing:.09em; text-transform:uppercase; color:var(--ink3); padding:10px 12px 3px; }
.mi{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; width:100%; min-height:32px; padding:5px 12px; border:none; border-radius:7px; background:none; text-align:left; font-size:14.5px; }
.mi u{ text-decoration:none; color:var(--accent); font-weight:700; border-bottom:1.5px solid currentColor; }
.mi small{ font-size:12px; color:var(--ink3); }
.mi:hover{ background:var(--fill); }
.mi.sel{ background:var(--accent-soft); box-shadow:inset 3px 0 0 var(--accent); }
.s-create .menu, .s-alter .menu, .s-more .menu, .s-gst .menu, .s-data .menu, .s-regs .menu{ max-width:520px; }
.intro{ max-width:760px; padding:18px 0; }
.intro h3{ font-family:var(--serif); font-size:24px; font-weight:600; margin-bottom:8px; }
.intro p{ color:var(--ink2); margin-bottom:16px; }
.s-companies .rt{ margin-bottom:8px; }

/* ---------- forms ---------- */
.form{ max-width:1000px; }
.form fieldset{ border:none; border-top:1px solid var(--line); padding:14px 0 16px; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px 14px; align-items:end; }
.form fieldset:first-child{ border-top:none; padding-top:0; }
.form legend{ grid-column:1/-1; font-family:var(--serif); font-size:16px; font-weight:600; padding:0 0 4px; float:left; width:100%; }
.form legend small{ font-family:var(--ui); font-size:12.5px; font-weight:400; color:var(--ink2); }
.fld{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.fld > span{ font-size:12px; font-weight:500; color:var(--ink2); }
.fld > span small{ font-weight:400; color:var(--ink3); }
.fld.sm input, .fld.sm select{ min-height:32px; }
.w2{ grid-column:span 2; } .w4{ grid-column:1/-1; }
.chk{ display:flex; align-items:center; gap:9px; font-size:14px; min-height:var(--h); }
.chk small{ color:var(--ink2); }
.lbl{ display:block; font-size:12px; font-weight:500; color:var(--ink2); margin-bottom:6px; }
.brow, .crow{ display:flex; align-items:end; gap:10px; margin-bottom:8px; flex-wrap:wrap; }
.brow .fld, .crow .fld{ flex:1 1 120px; }
.brow .xbtn, .crow .xbtn{ margin-bottom:4px; }
.gdname{ flex:1 1 100%; font-size:12.5px; font-weight:600; }
.prefixes{ display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px; }
.prefixes .lbl{ grid-column:1/-1; margin:0; }
.formbtns{ display:flex; flex-wrap:wrap; gap:10px; padding:16px 0 4px; border-top:1px solid var(--line); margin-top:6px; }

/* ---------- a voucher ---------- */
.vch{ max-width:1180px; }
.vh{ display:flex; align-items:end; justify-content:space-between; gap:14px; margin-bottom:12px; }
.vh-type{ display:flex; align-items:baseline; gap:12px; }
.vh-type b{ font-family:var(--serif); font-size:20px; font-weight:600; }
.vno{ font-size:14px; color:var(--ink2); font-variant-numeric:tabular-nums; }
.vdate{ width:170px; }
.vsaved{ font-size:13.5px; background:color-mix(in srgb, var(--pos) 10%, transparent); color:var(--ink); border-radius:8px; padding:7px 12px; margin:0 0 12px; }
.vgrid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px 14px; align-items:end; margin-bottom:14px; }
.vinfo{ grid-column:span 2; font-size:12.5px; color:var(--ink2); align-self:center; padding-top:16px; font-variant-numeric:tabular-nums; }
.vmode{ grid-column:span 2; display:flex; align-items:center; gap:6px; }
.vmode small{ color:var(--ink3); font-size:11.5px; }
.chip{ border:1px solid var(--line2); background:var(--raised); border-radius:99px; font-size:12.5px; padding:4px 12px; }
.chip.on{ background:var(--primary); color:var(--on-primary); border-color:transparent; }
.vt{ width:100%; border-collapse:collapse; margin:0 0 12px; font-variant-numeric:tabular-nums; }
.vt th{ font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--ink2); text-align:left; padding:6px 6px; border-bottom:1px solid var(--line2); white-space:nowrap; }
.vt th small{ text-transform:none; letter-spacing:0; font-weight:400; color:var(--ink3); }
.vt th.num{ text-align:right; }
.vt td{ padding:3px 4px; border-bottom:1px solid var(--line); vertical-align:top; }
.vt td input, .vt td select{ min-height:32px; border-color:transparent; background:transparent; border-radius:6px; padding:4px 6px; }
.vt td input:hover{ border-color:var(--line); }
.vt td input:focus, .vt td select:focus{ background:var(--raised); border-color:var(--accent); }
.vt td.num input{ text-align:right; }
.vt td.num{ width:104px; }
.vt td.amt{ width:136px; }
.vt.vitems td.num:not(.amt){ width:96px; }
.vt td.amt input{ font-weight:600; }
.vt td.per{ color:var(--ink2); font-size:13px; padding-top:9px; width:48px; }
.vt td.x{ width:34px; text-align:center; padding-top:5px; }
.vt .instock{ display:block; font-size:11.5px; color:var(--ink3); padding:0 7px 3px; }
.vt .instock.neg{ color:var(--neg); }
.vt .per{ font-size:11.5px; color:var(--ink3); padding-left:6px; }
.vextra th{ font-weight:600; }
.vsum{ display:flex; justify-content:flex-end; margin:4px 0 14px; }
.vsum dl{ min-width:300px; font-variant-numeric:tabular-nums; }
.vsum dl > div{ display:flex; justify-content:space-between; gap:24px; padding:3px 4px; font-size:13.5px; color:var(--ink2); }
.vsum dd{ color:var(--ink); }
.vsum .tot{ border-top:1.5px solid var(--ink); margin-top:4px; padding-top:7px; font-size:16px; font-weight:700; color:var(--ink); }
.vsum .tot dd{ font-family:var(--serif); font-size:20px; }
.vsum .neg, .vsum .neg dd{ color:var(--neg); font-weight:600; }
.vnar{ margin:6px 0 4px; }
.bwrow td{ border-bottom:1px solid var(--line); padding:0 4px 8px 26px !important; }
.bw{ background:var(--sheet); border:1px solid var(--line); border-radius:9px; padding:8px 10px; }
.bw-h{ font-size:11.5px; font-weight:600; color:var(--ink2); text-transform:uppercase; letter-spacing:.04em; margin-bottom:6px; }
.bw-r{ display:grid; grid-template-columns:130px minmax(0,1fr) 150px 30px; gap:8px; align-items:center; margin-bottom:5px; }
.bw-r select, .bw-r input{ min-height:30px; padding:3px 7px; }
.bw-amt{ text-align:right; }
.bw-f{ display:flex; justify-content:space-between; gap:10px; font-size:12.5px; }
.sj2{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }

/* ---------- the pick list under a box ---------- */
.pick{ position:fixed; inset:auto; margin:0; padding:0; border:1px solid var(--line2); border-radius:10px; background:var(--raised); color:var(--ink); box-shadow:0 18px 40px -12px rgba(0,0,0,.35); overflow:auto; display:none; z-index:2147483600; }
.pick.on{ display:block; }
.pick-head{ position:sticky; top:0; font-size:10.5px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; color:var(--ink3); background:var(--raised); padding:7px 12px 5px; border-bottom:1px solid var(--line); }
.pick-row{ display:flex; justify-content:space-between; align-items:baseline; gap:12px; width:100%; min-height:30px; padding:5px 12px; border:none; background:none; text-align:left; font-size:13.5px; }
.pick-row small{ color:var(--ink3); font-size:11.5px; white-space:nowrap; }
.pick-row.on{ background:var(--accent-soft); box-shadow:inset 3px 0 0 var(--accent); }
.pick-row.new{ color:var(--accent); font-weight:600; border-top:1px solid var(--line); }
.pick-none{ padding:10px 12px; color:var(--ink2); font-size:13px; }

/* ---------- small windows ---------- */
dialog.dlg{ border:1px solid var(--line2); padding:20px 22px; width:min(calc(100vw - 24px), 440px); margin:auto; border-radius:14px; background:var(--panel); color:var(--ink); box-shadow:0 40px 90px -20px rgba(0,0,0,.5); max-height:92dvh; overflow:auto; }
dialog.dlg.wide{ width:min(calc(100vw - 24px), 820px); }
dialog.dlg::backdrop{ background:rgba(8,10,16,.5); }
.dlg h3{ font-family:var(--serif); font-size:20px; font-weight:600; margin-bottom:6px; }
.dlg-note{ font-size:13.5px; color:var(--ink2); margin-bottom:12px; }
.dlg-fields{ display:grid; gap:10px; margin-bottom:14px; }
.dlg-btns{ display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:10px; }
.dlg-btns.left{ justify-content:flex-start; }
.helpgrid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px 26px; margin:8px 0 10px; }
.helpgrid h4{ font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--ink3); margin:12px 0 4px; }
.helpgrid dl > div{ display:grid; grid-template-columns:92px 1fr; gap:8px; font-size:13px; padding:3px 0; border-bottom:1px solid var(--line); }
.about{ border-top:1px solid var(--line); padding-top:12px; margin-top:6px; font-size:13.5px; }
.about p{ margin-bottom:6px; }
.rels summary{ cursor:pointer; color:var(--accent); font-weight:500; margin-top:6px; }
.rel{ padding:8px 0; border-top:1px solid var(--line); }
.rel span{ font-size:12.5px; color:var(--ink2); margin-left:8px; }
.rel ul{ margin:4px 0 0 20px; color:var(--ink2); }
.isteps{ background:var(--sheet); border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin-bottom:8px; }
.isteps ol{ margin:6px 0 0 20px; font-size:14px; color:var(--ink2); }
.isteps.mine{ border-color:var(--accent); }
#installReady .btn{ width:100%; margin-bottom:10px; }

.toast{ position:fixed; top:auto; right:auto; margin:0; border:none; overflow:visible; left:50%; bottom:calc(22px + env(safe-area-inset-bottom)); transform:translate(-50%,14px); background:var(--primary); color:var(--on-primary); font-size:14px; font-weight:500; line-height:1.35; padding:11px 16px; border-radius:10px; box-shadow:0 14px 34px -8px rgba(0,0,0,.4); opacity:0; pointer-events:none; transition:opacity .2s, transform .25s; display:flex; gap:16px; align-items:center; max-width:calc(100vw - 32px); z-index:2147483647; }
.toast.on{ opacity:1; transform:translate(-50%,0); pointer-events:auto; }
.toast button{ border:none; background:none; color:inherit; font-weight:700; text-decoration:underline; }
#printArea{ display:none; }

/* ---------- the window alone on the whole screen (js/full.js) ---------- */
.win:fullscreen{ height:100vh; height:100dvh; min-height:0; border:none; border-radius:0; box-shadow:none; }
.win:-webkit-full-screen{ width:100%; height:100%; min-height:0; border:none; border-radius:0; box-shadow:none; }
.win::backdrop{ background:var(--bg); }
body.win-max{ overflow:hidden; }
body.win-max .win{ position:fixed; inset:0; z-index:40; height:100dvh; min-height:0; border:none; border-radius:0; box-shadow:none; }
body.win-max .topbar{ padding-top:env(safe-area-inset-top); }

/* ---------- installed: the window is the whole screen ---------- */
.is-app header.site, .is-app h1.title, .is-app .sub, .is-app .web-only, .is-app .mh-related, .is-app footer.site, .is-app .installcard{ display:none; }
.is-app main{ max-width:none; padding:0; }
.is-app .win{ height:100dvh; border:none; border-radius:0; box-shadow:none; }
.is-app .topbar{ padding-top:env(safe-area-inset-top); }
.is-app.show-guide .web-only{ display:block; margin:16px; }
.is-app.show-guide .win{ height:auto; min-height:100dvh; }

/* ---------- narrower screens ---------- */
@media(max-width:1100px){
  .gw{ grid-template-columns:1fr; }
  .gw-r{ order:-1; }
}
@media(max-width:900px){
  .body{ grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) auto; }
  .keys{ flex-direction:row; overflow-x:auto; overflow-y:hidden; border-left:none; border-top:1px solid var(--line); padding:6px 6px calc(6px + env(safe-area-inset-bottom)); gap:4px; scrollbar-width:none; }
  .keys::-webkit-scrollbar{ display:none; }
  .kb{ flex:none; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; min-height:46px; min-width:76px; padding:4px 8px; text-align:center; font-size:11.5px; border:1px solid var(--line); background:var(--panel); }
  .kb kbd{ justify-self:auto; font-size:9.5px; padding:2px 4px; }
  .ksep{ width:1px; height:auto; margin:4px 2px; }
  .rblocks.split{ grid-template-columns:1fr; gap:14px; }
  .sj2{ grid-template-columns:1fr; }
  .tb-cell small{ display:none; }
}
@media(max-width:700px){
  main{ padding:10px 10px calc(40px + env(safe-area-inset-bottom)); }
  h1.title{ font-size:28px; }
  .sub{ font-size:14.5px; }
  header.site{ padding:8px 14px; }
  .back{ display:none; }
  .win{ height:calc(100dvh - 20px); min-height:560px; border-radius:12px; }
  .topbar{ flex-wrap:wrap; padding:0 4px; }
  .tb-co{ flex:1 1 100%; }
  .tb-cell, .tb-help{ margin:0 0 4px !important; padding:2px 10px; }
  .tb-cell{ border-left:none !important; flex:1; }
  .sh{ padding:10px 12px 8px; }
  .sh h2{ font-size:18px; }
  .crumbs{ display:none; }
  .sb{ padding:12px 12px 32px; }
  .form fieldset, .vgrid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .w4, .vinfo, .vmode{ grid-column:1/-1; }
  .ages{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .helpgrid{ grid-template-columns:1fr; }
  .installcard{ flex-wrap:wrap; }
  .installcard .btn{ flex:1 1 100%; order:5; }
  /* a line of a voucher as a small card */
  .vt thead{ display:none; }
  .vt, .vt tbody{ display:block; }
  .vt tr{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:2px 6px; padding:8px 4px; border-bottom:1px solid var(--line); position:relative; }
  .vt td{ display:flex; flex-direction:column; border:none; padding:0; width:auto !important; }
  .vt td::before{ content:attr(data-label); font-size:10.5px; color:var(--ink3); padding:0 6px; }
  .vt td.c-name{ grid-column:1/-1; padding-right:34px; }
  .vt td.x{ position:absolute; right:2px; top:22px; }
  .vt td.per{ display:none; }
  .vt td input, .vt td select{ border-color:var(--line); }
  .vt.vacct tr, .vt.vextra tr, .vt.vrows tr{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .bwrow{ display:block !important; }
  .bwrow td{ padding:0 0 8px !important; }
  .bw-r{ grid-template-columns:1fr 1fr 30px; }
  .bw-r .bw-ref{ grid-column:1/-1; order:-1; }
  .vsum dl{ min-width:0; width:100%; }
  .rt td, .rt th{ padding-left:7px; padding-right:7px; }
}

/* ---------- paper ---------- */
@media print{
  @page{ size:A4; margin:10mm; }
  body > *:not(#printArea){ display:none !important; }
  html, body{ height:auto; min-height:0; background:#fff; display:block; color:#000; }
  #printArea{ display:block; font:11px/1.35 "IBM Plex Sans","Segoe UI",system-ui,sans-serif; color:#000; }
  #printArea *{ color:#000 !important; background:none !important; box-shadow:none !important; }
  .p-doc{ border:.75pt solid #000; padding:0; }
  .p-rep{ border:none; }
  .p-title{ text-align:center; border-bottom:.75pt solid #000; padding:5px; position:relative; }
  .p-title b{ font:600 15px/1.2 "Source Serif 4",Georgia,serif; letter-spacing:.04em; text-transform:uppercase; }
  .p-title small{ position:absolute; right:8px; top:7px; font-size:9px; font-style:italic; }
  .p-top{ display:grid; grid-template-columns:1.3fr 1fr; border-bottom:.75pt solid #000; }
  .p-co, .p-party{ display:flex; flex-direction:column; padding:6px 8px; }
  .p-co b{ font-size:14px; }
  .p-party{ border-bottom:.75pt solid #000; }
  .p-party small{ font-size:9px; font-style:italic; }
  .p-party b{ font-size:12.5px; }
  .p-meta{ border-left:.75pt solid #000; display:grid; grid-template-columns:1fr 1fr; }
  .p-meta > div{ padding:4px 7px; border-bottom:.5pt solid #000; }
  .p-meta > div:nth-child(odd){ border-right:.5pt solid #000; }
  .p-meta dt{ font-size:9px; }
  .p-meta dd{ font-size:11.5px; }
  .p-items, .p-tax{ width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
  .p-items th, .p-tax th{ font-size:9.5px; font-weight:600; border-bottom:.75pt solid #000; border-right:.5pt solid #000; padding:4px 5px; text-align:left; }
  .p-items td, .p-tax td{ border-right:.5pt solid #000; padding:3px 5px; vertical-align:top; }
  .p-items th:last-child, .p-items td:last-child, .p-tax th:last-child, .p-tax td:last-child{ border-right:none; }
  .p-items tbody tr:last-child td{ padding-bottom:40px; }
  .p-items tfoot td, .p-tax tfoot td{ border-top:.75pt solid #000; padding:4px 5px; }
  .p-tax{ border-top:.75pt solid #000; }
  .p-tax td{ border-bottom:.5pt solid #000; }
  .p-x td{ font-size:10.5px; }
  .num{ text-align:right; white-space:nowrap; }
  .r{ text-align:right; }
  .p-words{ padding:5px 8px; border-top:.75pt solid #000; }
  .p-nar{ padding:5px 8px; border-top:.5pt solid #000; }
  .p-foot{ display:grid; grid-template-columns:1.3fr 1fr; border-top:.75pt solid #000; min-height:90px; }
  .p-foot > div:first-child{ padding:6px 8px; }
  .p-foot p{ margin-bottom:5px; }
  .p-terms{ font-size:9.5px; }
  .p-sign{ border-left:.75pt solid #000; padding:6px 8px; display:flex; flex-direction:column; justify-content:space-between; text-align:right; }
  .p-signs{ display:flex; justify-content:space-between; padding:46px 10px 8px; }
  .p-gen{ text-align:center; font-size:9px; padding:3px; border-top:.75pt solid #000; }
  .p-doc h4{ font-size:11px; padding:6px 8px 2px; }
  .p-rhead{ text-align:center; margin-bottom:10px; display:flex; flex-direction:column; }
  .p-rhead b{ font-size:15px; }
  .p-rhead h3{ font:600 15px/1.3 "Source Serif 4",Georgia,serif; margin-top:6px; }
  .p-rep .rt{ font-size:10.5px; }
  .p-rep .rt th{ border-bottom:.75pt solid #000; padding:3px 5px; }
  .p-rep .rt td{ border-bottom:.25pt solid #999; padding:2px 5px; }
  .p-rep .rt tfoot td{ border-top:.75pt solid #000; border-bottom:none; font-weight:700; }
  .p-rep .rblocks.split{ display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
  .p-rep .kpi, .p-rep .ages, .p-rep .brs{ display:flex; gap:16px; flex-wrap:wrap; margin-bottom:8px; }
  .p-rep .note{ font-size:9.5px; }
  .p-rep tr{ break-inside:avoid; }
}
.rt tr.pad td{ border-bottom-color:transparent; height:31px; }
.rt tbody tr.pad:hover td{ background:none; }

/* ---------- "Saved" (js/ui.js saved()) ---------- */
dialog.savedlg{ width:min(calc(100vw - 24px), 420px); text-align:center; padding:26px 24px 20px; border-top:4px solid var(--pos); }
dialog.savedlg[open]{ animation:savedIn .22s cubic-bezier(.2,.8,.2,1); }
@keyframes savedIn{ from{ opacity:0; transform:translateY(8px) scale(.97); } }
.saved-tick{ width:54px; height:54px; margin:0 auto 12px; border-radius:50%; display:grid; place-items:center; background:color-mix(in srgb, var(--pos) 14%, transparent); color:var(--pos); }
.saved-tick svg{ width:30px; height:30px; fill:none; stroke:currentColor; stroke-width:2.6; stroke-linecap:round; stroke-linejoin:round; }
.savedlg h3{ font-size:21px; margin-bottom:6px; }
.saved-what{ margin-bottom:16px; }
.saved-what p{ font-size:14.5px; color:var(--ink2); font-variant-numeric:tabular-nums; }
.saved-what p:first-child{ color:var(--ink); font-weight:600; }
.saved-btns{ justify-content:center; }
.saved-btns .btn kbd{ margin-left:2px; }
/* the note at the top of the next voucher: what was saved just before */
.vsaved{ border-left:3px solid var(--pos); font-weight:500; }
.vsaved::before{ content:"✓ "; color:var(--pos); font-weight:700; }
