/* TajerOS — the bound ledger (redesign B, docs/design/redesign-preview.html).
   A deep green cover holds the menu; the work is a cream sheet laid on it and scrolls inside it.
   Colour carries meaning only: green = money in / done / the main series, brass = waiting, red = late.
   Headings in Amiri, text and figures in IBM Plex Sans Arabic (both self-hosted, both print cleanly).
   RULE: logical properties only (inline-start/end, block-start/end). Never left/right: the same CSS serves RTL (ar, ckb) and LTR (en). */
/* Theme: every colour is light-dark(light, dark). color-scheme picks the side:
   "light dark" follows the OS (data-theme="system"); the switcher forces one with data-theme="light" | "dark". */

/* ---- Fonts (SIL OFL 1.1, from Fontsource; licences in /fonts) ---- */
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url("fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 700; src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url("fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url("fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url("fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 700; src: url("fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Amiri"; font-style: normal; font-display: swap; font-weight: 400; src: url("fonts/amiri-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; font-style: normal; font-display: swap; font-weight: 700; src: url("fonts/amiri-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Amiri"; font-style: normal; font-display: swap; font-weight: 400; src: url("fonts/amiri-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Amiri"; font-style: normal; font-display: swap; font-weight: 700; src: url("fonts/amiri-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light dark;
  /* The cover (menu frame) and the sheet (the page). */
  --cover: light-dark(#12382C, #08160F); --cover-2: light-dark(#0B2A20, #050F0B);
  --cover-ink: light-dark(#F2EBD9, #E9E2CF); --cover-ink-2: light-dark(#B8CABF, #9DB2A6); --cover-ink-3: light-dark(#9DB6A8, #7E9789);
  --gold: light-dark(#F0D49A, #E6C88A); --gold-soft: rgba(240, 212, 154, .14);
  --bg: light-dark(#F8F4EA, #1C1F1B); --surface: light-dark(#FFFDF8, #242822);
  --surface-2: light-dark(#F2ECDF, #2C3029); --surface-3: light-dark(#E8E0CF, #353930);
  --ink: light-dark(#1C1B18, #ECE6D8); --ink-2: light-dark(#3F3A31, #CBC3B2); --ink-3: light-dark(#5F584B, #A59D8C);
  --line: light-dark(#E6DFD1, #31352E); --line-strong: light-dark(#BDB3A0, #585D52); --edge: light-dark(#D9D1C1, #3B4037);
  --brand: light-dark(#0E5A44, #79C4A0); --brand-2: light-dark(#0A4434, #95D3B5);
  --brand-ink: light-dark(#FFFFFF, #0B1C16); --brand-soft: light-dark(#E3EEE8, #1F3A2E);
  --action: light-dark(#12382C, #2C7559); --action-2: light-dark(#0B2A20, #348566); --action-ink: light-dark(#FFFFFF, #F6F0E2);
  --brass: light-dark(#8A5A10, #E2B866); --brass-bar: light-dark(#C9A45C, #C9A25A); --brass-edge: light-dark(#C9A45C, #7A6033); --brass-soft: light-dark(#F5EBD6, #352B1B);
  --ok: light-dark(#17663F, #6CC495); --ok-soft: light-dark(#DDF1E5, #1B3226);
  --bad: light-dark(#A3261B, #EF8174); --bad-soft: light-dark(#F7E3DF, #3A201C);
  /* One spacing scale, used everywhere: 4 · 8 · 16 · 24 · 32 · 48 */
  --s0: 4px; --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px;
  --f-body: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --f-head: "Amiri", "Noto Naskh Arabic", "Times New Roman", serif;
  --r: 8px; --r-lg: 10px; --r-sheet: 16px; --side: 272px; --gap: 12px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* One control height for inputs, selects and buttons, so a filter row lines up. */
  --control: 44px;
  /* The select chevron, drawn in the text colour of each theme (a data: image, allowed by img-src). */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233F3A31' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23CBC3B2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); } }
:root[data-theme="dark"] { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23CBC3B2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 var(--s2); font-family: var(--f-head); font-weight: 700; line-height: 1.35; text-wrap: balance; }
h1 { font-size: 34px; }
h1:focus { outline: none; }
h2 { font-size: 22px; margin-block-start: var(--s1); }
h3 { font-size: 19px; }
/* Figures: the text face with fixed-width digits, so amounts line up in columns (no monospace face). */
.mono { font-family: var(--f-body); font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
/* Machine identifiers (hashes, record ids, order codes, JSON): a fixed-width face, so a different code never moves the layout. */
.ident { font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; font-size: .92em; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); } .text-bad { color: var(--bad); }
.small { font-size: 14px; } .sub-line { display: block; font-size: 14px; white-space: nowrap; } .tiny { font-size: 13px; } .big { font-size: 30px; font-weight: 700; line-height: 1.2; }
.center { text-align: center; }

/* ---- Scrollbars, part of the design ---- */
::-webkit-scrollbar { inline-size: 12px; block-size: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) { html { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; } }

/* ---- Shell: the cover holds the menu, the sheet holds the page; only the sheet scrolls ---- */
body:has(> .shell), body:has(.shell) { background: var(--cover); }
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); block-size: 100vh; block-size: 100dvh; overflow: hidden; }
.side { background: transparent; color: var(--cover-ink); padding: var(--s3) var(--s2) var(--s2); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.side::-webkit-scrollbar { inline-size: 8px; }
.side::-webkit-scrollbar-thumb { background: transparent; border: 2px solid transparent; background-clip: padding-box; }
.side:hover::-webkit-scrollbar-thumb { background: rgba(240, 212, 154, .35); background-clip: padding-box; }
.side::-webkit-scrollbar-thumb:hover { background: rgba(240, 212, 154, .6); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) { .side { scrollbar-width: thin; scrollbar-color: transparent transparent; } .side:hover { scrollbar-color: rgba(240, 212, 154, .4) transparent; } }
.brand { display: flex; align-items: center; gap: var(--s2); font-family: var(--f-head); font-weight: 700; font-size: 24px; line-height: 1.2; padding-inline: var(--s1); }
.side .brand { color: var(--cover-ink); padding-block-end: var(--s3); }
.brand-mark { display: inline-grid; place-items: center; inline-size: 36px; block-size: 36px; flex: none; }
.brand-mark svg { display: block; inline-size: 100%; block-size: 100%; }
.brand small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 13px; color: var(--cover-ink-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: var(--s2); min-block-size: 40px; padding-inline: var(--s2); border-radius: var(--r); color: var(--cover-ink); text-decoration: none; font-size: 16px; transition: background-color 120ms ease, color 120ms ease; }
.nav a svg { flex: none; inline-size: 18px; block-size: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--cover-ink-2); }
@media (hover: hover) and (pointer: fine) { .nav a:not(.active):hover { background: rgba(242, 235, 217, .07); } }
.nav a.active { background: rgba(242, 235, 217, .12); color: var(--gold); font-weight: 600; }
.nav a.active svg { color: var(--gold); }
.nav a:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.nav-group { margin-block-start: var(--s3); padding: 0 var(--s2) var(--s1); font-size: 14px; font-weight: 600; color: var(--cover-ink-3); }
.side-foot { margin-block-start: auto; padding-block-start: var(--s2); border-block-start: 1px solid rgba(242, 235, 217, .14); display: flex; flex-direction: column; gap: var(--s2); }
/* Who is signed in: initial, name, company code, sign-out; inset like the menu links above it. */
.account { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding-inline: var(--s1); }
.avatar { display: grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 50%; background: var(--gold); color: var(--cover); font-family: var(--f-body); font-weight: 600; font-size: 16px; line-height: 1; }
.who { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; line-height: 1.3; }
.who strong { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who > span { font-size: 13px; color: var(--cover-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .ident { font-size: 13px; color: var(--cover-ink-2); letter-spacing: .06em; }
.account form { margin: 0; }
.icon-btn { display: grid; place-items: center; inline-size: 36px; block-size: 36px; padding: 0; border: 0; border-radius: var(--r); background: transparent; color: var(--cover-ink-2); cursor: pointer; transition: transform 160ms var(--ease-out), background-color 120ms ease, color 120ms ease; }
.icon-btn svg { inline-size: 18px; block-size: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.94); }
.icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 0; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: rgba(242, 235, 217, .08); color: var(--gold); } }
/* Language and theme: two quiet segmented controls, each a full row of equal parts. */
.side .prefs { flex-direction: column; align-items: stretch; gap: var(--s1); }
.side .langs, .side .themes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border-radius: var(--r); background: rgba(242, 235, 217, .06); }
.side .langs button, .side .themes button { inline-size: 100%; min-block-size: 32px; border-radius: 6px; }
.side .langs form, .side .themes form { display: contents; }
.side .langs button, .side .themes button { color: var(--cover-ink-2); }
.side .langs button.current, .side .themes button.current { background: rgba(242, 235, 217, .12); color: var(--gold); }
@media (hover: hover) and (pointer: fine) { .side .langs button:not(.current):hover, .side .themes button:not(.current):hover { background: rgba(242, 235, 217, .07); } }
.main { min-inline-size: 0; margin-block: var(--gap); margin-inline-end: var(--gap); background: var(--bg); border-radius: var(--r-sheet); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.main::-webkit-scrollbar { inline-size: 14px; }
.main::-webkit-scrollbar-track { margin-block: var(--s2); }
.main::-webkit-scrollbar-thumb { background: light-dark(#D9C9A3, #4A4E44); border: 4px solid transparent; background-clip: padding-box; }
.main::-webkit-scrollbar-thumb:hover { background: light-dark(#B8994F, #6E7365); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) { .main { scrollbar-width: thin; scrollbar-color: light-dark(#D9C9A3, #4A4E44) transparent; } }
.topbar { display: none; }
/* The page column is capped for readable rows and centred in the sheet, so wide screens get even margins, not a gap on one side. */
.page { padding: var(--s4) var(--s5) var(--s5); max-inline-size: 1440px; margin-inline: auto; }

.prefs { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.langs, .themes { display: flex; gap: var(--s0); }
.langs form, .themes form { margin: 0; }
.langs button, .themes button { font: inherit; cursor: pointer; background: none; border: 0; padding: var(--s0) var(--s1); border-radius: var(--r); color: var(--ink-2); font-size: 14px; min-block-size: 36px; transition: background-color 120ms ease, color 120ms ease; }
.themes button { min-inline-size: 36px; font-size: 16px; line-height: 1; }
@media (hover: hover) and (pointer: fine) { .langs button:hover, .themes button:hover { background: var(--surface-2); } }
.langs button.current, .themes button.current { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* ---- Auth pages: the ledger opened flat. The form is one page, the green cover the other. ---- */
.auth { min-block-size: 100vh; min-block-size: 100dvh; display: grid; grid-template-columns: minmax(420px, 1fr) minmax(0, 1.15fr); gap: var(--gap); padding: var(--gap); background: var(--cover); }
.auth-sheet { background: var(--bg); border-radius: var(--r-sheet); display: flex; flex-direction: column; padding: var(--s4) var(--s5); min-inline-size: 0; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.auth-top .brand { padding: 0; color: var(--ink); font-size: 26px; }
.auth-card { inline-size: 100%; max-inline-size: 460px; margin: auto; padding-block: var(--s5); }
.auth-card h1 { font-size: 40px; margin-block-end: var(--s1); }
.auth-card .form { gap: var(--s3); margin-block-start: var(--s3); }
.auth-card .btn-primary { min-block-size: 52px; font-size: 17px; }
.auth-card input:not([type=checkbox]):not([type=radio]) { --control: 52px; font-size: 17px; }
.auth-card > p.center { margin-block-start: var(--s3); }
.auth-foot { font-size: 14px; color: var(--ink-3); }
.auth-cover { color: var(--cover-ink); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s4); padding: var(--s5) var(--s5) var(--s4); overflow: hidden; }
.auth-cover h2 { font-size: 44px; line-height: 1.3; color: var(--cover-ink); max-inline-size: 22ch; margin: 0; }
.auth-cover .sub { font-size: 18px; color: var(--cover-ink-2); max-inline-size: 42ch; margin: var(--s2) 0 0; line-height: 1.7; }
.auth-points { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2) var(--s4); max-inline-size: 580px; }
.auth-points li { font-size: 16px; color: var(--cover-ink); padding-block-start: var(--s2); border-block-start: 1px solid rgba(242, 235, 217, .18); }
.auth-points li b { display: block; font-family: var(--f-head); font-size: 20px; color: var(--gold); }
/* The product's own artefact: a receipt with its verify code, laid slightly turned on the cover. */
.auth-receipt { align-self: flex-start; inline-size: 300px; background: #FFFDF8; color: #1C1B18; border-radius: 6px; padding: var(--s3); transform: rotate(-3deg); box-shadow: 0 18px 40px rgba(0, 0, 0, .28); }
.auth-receipt .r-head { display: flex; justify-content: space-between; align-items: baseline; border-block-end: 3px double #1C1B18; padding-block-end: var(--s1); margin-block-end: var(--s2); }
.auth-receipt .r-head b { font-family: var(--f-head); font-size: 20px; }
.auth-receipt dl { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s2); font-size: 14px; }
.auth-receipt dt { color: #5F584B; margin: 0; } .auth-receipt dd { font-weight: 600; text-align: end; }
.auth-receipt .amt { font-size: 26px; font-weight: 700; text-align: end; margin: var(--s2) 0 var(--s1); font-variant-numeric: tabular-nums; }
.auth-receipt .verify { display: flex; justify-content: space-between; align-items: center; border-block-start: 1px dashed #BDB3A0; padding-block-start: var(--s1); font-size: 13px; color: #5F584B; }
.auth-receipt .verify span { font-weight: 700; color: #0E5A44; letter-spacing: .08em; font-size: 15px; }
.auth-cover .cover-foot { font-size: 14px; color: var(--cover-ink-3); }

/* ---- Building blocks ---- */
.card { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-lg); padding: var(--s3); margin-block-end: var(--s3); }
.card > :first-child { margin-block-start: 0; }
.card > :last-child { margin-block-end: 0; }
/* A section heading inside a form gets air above it, so it reads with the fields below, not above. */
.card > h2:not(:first-child), .form > h2:not(:first-child) { margin-block-start: var(--s4); }
.cards + .btn, .table-scroll + .btn, .table + .btn { margin-block-start: var(--s2); }
/* In a form: "add line" hugs the lines it adds to; the form's own actions stand apart below. */
.form > .cards + .btn, .form > .table-scroll + .btn, .form > .table + .btn { margin-block-start: calc(var(--s1) * -1); }
.form > .row:last-child { margin-block-start: var(--s2); }
.card-brand { border-inline-start: 4px solid var(--brand); }
.kpi { display: flex; flex-direction: column; gap: var(--s0); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-block-end: var(--s3); flex-wrap: wrap; }
.toolbar h1 { margin: 0; }
.row { display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center; }
/* Filter and action rows: fields sit on one baseline (labelled or not), at their natural width unless told to grow. */
form.row, .row.card { align-items: flex-end; gap: var(--s2); }
@media (min-width: 761px) {
  form.row > select, .row.card > select:not(.grow), form.row > input:not(.grow), form.row > .field:not(.grow) > input, form.row > .field:not(.grow) > select { inline-size: auto; }
  form.row > .field:not(.grow) { flex: 0 0 auto; }
}
form.row > .check { min-block-size: var(--control); }
form.row > .field > span.small, .row.card > .field > span.small { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: var(--s2); }
.form { display: flex; flex-direction: column; gap: var(--s2); }
/* The form's gap already spaces the heading from what follows; its own margin would double it. */
.form > h2 { margin-block-end: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s3); align-items: start; }
.field { display: flex; flex-direction: column; gap: var(--s1); border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-weight: 600; font-size: 15px; }
.field small { font-size: 14px; }
.check { display: flex; align-items: center; gap: var(--s1); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: var(--s1) var(--s2); min-block-size: var(--control); inline-size: 100%; transition: border-color 150ms ease, box-shadow 150ms ease;
}
/* Single-line fields are exactly one control tall (date and month pickers otherwise grow by a couple of pixels). */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select:not([multiple]) { block-size: var(--control); line-height: 1.25; padding-block: 0; }
/* The same chevron on every select, on the reading-end side, with room kept for it. */
select:not([multiple]) { appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-size: 12px 8px; background-position: right var(--s2) center; padding-inline-end: calc(var(--s2) * 2 + 12px); cursor: pointer; }
[dir="rtl"] select:not([multiple]) { background-position: left var(--s2) center; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox] { inline-size: 1.2rem; block-size: 1.2rem; accent-color: var(--brand); }
.invalid { border-color: var(--bad) !important; }
.validation-message { color: var(--bad); font-size: 14px; }

.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); min-block-size: var(--control); padding: 0 var(--s3); border-radius: var(--r); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--action); color: var(--action-ink); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-danger { background: var(--bad); color: light-dark(#FFFFFF, #1C1F1B); }
/* Provider console (Phase 9.6): the merchant shell with its own label, so staff never mistake it for a company. */
.console-tag { align-self: flex-start; margin: 0 var(--s1) var(--s3); padding: 2px var(--s1); border-radius: 6px; background: rgba(240, 212, 154, .14); color: var(--gold); font-size: 13px; font-weight: 600; }
.console-auth { max-inline-size: 480px; margin-inline: auto; padding-block-start: var(--s4); }
.console-qr .qr svg { display: block; inline-size: 220px; block-size: auto; margin-block: var(--s2); padding: var(--s1); background: #fff; border-radius: var(--r); }
.console-qr ol { margin: 0; padding-inline-start: 1.2em; }
.console-invites { list-style: none; margin: 0 0 var(--s2); padding: 0; display: flex; flex-direction: column; gap: var(--s1); }
.console-menu { display: none; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--action-2); }
  .btn-ghost:hover { border-color: var(--ink-2); }
}
.btn-sm { min-block-size: 36px; padding: 0 var(--s2); font-size: 14px; }
.btn-block { inline-size: 100%; }

.alert { padding: var(--s2) var(--s3); border-radius: var(--r); margin-block-end: var(--s2); }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--brass-soft); color: var(--brass); }
/* Toast (Alert): floats near the bottom where the pressed button usually is. It rises in quickly (ease-out, under
   250 ms); success fades out by itself after a few seconds, an error stays until the next action. */
.toast {
  position: fixed; inset-inline: 0; inset-block-end: var(--s4); z-index: 60; margin: 0 auto;
  inline-size: max-content; max-inline-size: min(560px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: var(--r-lg);
  font-weight: 600; box-shadow: 0 10px 30px rgba(14, 22, 18, .22), 0 2px 6px rgba(14, 22, 18, .12);
  animation: toast-in 220ms var(--ease-out) both;
}
.toast.alert-ok { background: var(--action); color: var(--action-ink); animation: toast-in 220ms var(--ease-out) both, toast-out 260ms ease-in 3.6s forwards; }
.toast.alert-bad { background: var(--bad); color: light-dark(#FFFFFF, #1C1F1B); }
.toast-icon { display: grid; place-items: center; inline-size: 22px; block-size: 22px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .22); font-size: 13px; }
/* In the app shell, centred over the page sheet rather than the whole window (the menu takes the start side). */
.shell .toast { inset-inline-start: var(--side); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.alert-ok { animation: toast-out 1ms linear 3.6s forwards; }
}
.badge { display: inline-block; padding: 0 var(--s1); border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 24px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
/* Money direction: red = owed to the company (in debt), green = the company owes (credit). Text, never colour alone. */
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--brass-soft); color: var(--brass); }
/* Suggested credit (BR-CUS-16): the amount, what is left, the verdict on this invoice, then how it was reached. */
.credit-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: start; }
.credit-advice { display: flex; flex-direction: column; gap: var(--s0); min-inline-size: 0; }
.credit-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.credit-amount { font-size: 26px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.credit-verdict { align-self: flex-start; white-space: normal; margin-block: var(--s0); }
.credit-facts { margin: var(--s1) 0 0; padding-inline-start: 1.1em; }
.credit-period { inline-size: 9rem; }
.editor-credit { grid-column: 1 / -1; border-block-start: 1px solid var(--line); padding-block-start: var(--s2); }
.badge-brass { background: var(--brass-soft); color: var(--brass); }
.badge-muted { background: var(--surface-2); color: var(--ink-2); }
.timeline { list-style: none; padding: 0; margin: 0 0 var(--s2); display: flex; flex-direction: column; }
.timeline li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1); padding-block: var(--s1); border-block-end: 1px solid var(--line); }
.timeline li:last-child { border-block-end: 0; }
/* An invoice's stages: the status column lines up, who (and why) reads next, the time sits at the end. As a card it
   keeps the card's inline padding; only the block padding is trimmed because each row has its own. */
.timeline.steps { padding: var(--s1) var(--s3); }
.timeline.steps li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; align-items: center; gap: var(--s2); padding-block: 12px; }
.tl-status { display: flex; }
.tl-who { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; }
.tl-why { font-size: 14px; color: var(--ink-2); }
.tl-when { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
/* A document without goods: what it is, then its three amounts. */
.doc-summary > p { margin: 0 0 var(--s2); color: var(--ink-2); }
.doc-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin: 0; }
.doc-totals dd { margin: 0; font-size: 22px; font-weight: 700; color: var(--ink); }
details > summary { cursor: pointer; font-weight: 600; }
dt { margin-block-start: var(--s1); color: var(--ink-2); }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.tags li { background: var(--surface-2); border-radius: 6px; padding: 0 var(--s1); font-size: 13px; }
.steps { padding-inline-start: var(--s3); margin: 0; }

/* Ledger tables: a strong rule under the header, ledger lines between rows, a double rule under totals. */
.table { inline-size: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-lg); overflow: hidden; font-size: 16px; }
.table th, .table td { padding: var(--s1) var(--s2); text-align: start; border-block-end: 1px solid var(--line); vertical-align: middle; }
.table td { block-size: 52px; }
.table th { font-weight: 600; font-size: 14px; color: var(--ink-2); border-block-end: 2px solid var(--line-strong); white-space: nowrap; }
.table tbody tr:last-child td { border-block-end: 0; }
.table tbody tr { transition: background-color 120ms ease; }
@media (hover: hover) and (pointer: fine) { .table tbody tr:hover { background: var(--surface-2); } }
.table tfoot th, .table tfoot td { background: transparent; font-weight: 700; color: var(--ink); border-block-start: 2px solid var(--line-strong); border-block-end: 3px double var(--line-strong); }
.table a { text-decoration: none; font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .table a:hover { text-decoration: underline; } }
.card .table { border: 0; border-radius: 0; background: transparent; }
.card .table th:first-child, .card .table td:first-child { padding-inline-start: 0; }
.card .table th:last-child, .card .table td:last-child { padding-inline-end: 0; }
pre { font-family: inherit; white-space: pre-wrap; word-break: break-word; margin: var(--s0) 0 0; }
.break { overflow-wrap: anywhere; }
.grow { flex: 1 1 12rem; min-inline-size: 0; }
dl { margin: 0; } dd { margin: 0; }
/* Controls inside a table row are one size smaller, buttons included, so a row keeps its rhythm. */
.table { --control: 40px; }
.table .btn, .table .btn-sm { min-block-size: var(--control); }
.gap-start { margin-inline-start: var(--s1); }
/* A lone button in a form (add line, save) keeps its own width on a desk; full-width is for phones and sign-in. */
.form > .btn:not(.btn-block) { align-self: flex-start; }
/* Invoice lines: the product name must stay readable; the other cells shrink first. */
.lines th, .lines td { padding-inline: var(--s1); }
.lines td input { min-inline-size: 5rem; }
.lines td select { min-inline-size: 7rem; }
.lines td:first-child select { min-inline-size: 13rem; }
/* Dates, numbers and amounts never break across lines (a date split at its hyphen reads as two values). */
.table td.mono, .table a.mono, .table td > .mono { white-space: nowrap; }
/* Collections and rep home: one card per customer, actions reachable by thumb (UI-6: 44px targets). */
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s2); }
.cards > .card { margin: 0; display: flex; flex-direction: column; gap: var(--s1); }
.between { justify-content: space-between; align-items: flex-start; }
.between > h2 { margin: 0; } .row.between:has(> h2) { align-items: baseline; margin-block: var(--s1); }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); }
.figures dt { margin: 0; }
/* Label and value side by side, one pair per line (contract terms). */
.pairs { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: var(--s1) var(--s3); align-content: start; }
.pairs dt { color: var(--ink-2); margin: 0; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: var(--s1); }
.segmented { display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); padding: 2px; border-radius: var(--r); }
.segmented button { font: inherit; border: 0; background: none; color: var(--ink-2); padding: 0 var(--s2); border-radius: 6px; min-block-size: calc(var(--control) - 4px); cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.segmented button:active { transform: scale(.97); }
.segmented button.current { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--edge), 0 1px 2px rgba(28, 27, 24, .08); }
/* Rep home and the phone sell form. */
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--s1); margin-block-end: var(--s3); }
.big-actions .btn { min-block-size: 60px; font-size: 17px; }
.figures-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--s3); }
.figures-card > div { display: flex; flex-direction: column; gap: var(--s0); align-items: flex-start; }
.sell-line { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem 44px; gap: var(--s1); align-items: center; }
.sell-line .btn { padding: 0; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; inline-size: 1px; block-size: 1px; }
.tabbar { display: none; }
/* Dashboard (S-42). */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-block-end: var(--s3); background: var(--line); border: 1px solid var(--edge); border-radius: var(--r-lg); overflow: hidden; }
/* The rules between tiles are the 1px gaps; a short last row stretches so no empty cell is left. */
.kpis > :last-child:nth-child(3n+1) { grid-column: 1 / -1; }
.kpis > :last-child:nth-child(3n+2) { grid-column: span 2; }
.kpis:not(.kpis-4):has(> :nth-child(4):last-child), .kpis:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Four facts about one record (the customer card): a 2×2 block, one row of equal tiles once there is room for
   eight-digit amounts on one line. */
.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1600px) { .kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis .card .badge { align-self: flex-start; }
/* A figure stays on one line; its currency is a quiet suffix, not a second line. */
.kpis .card .big { white-space: nowrap; }
.unit { font-size: 0.5em; font-weight: 600; color: var(--ink-3); }
.kpis:has(> :nth-child(4):last-child) > :last-child, .kpis:has(> :nth-child(2):last-child) > :last-child { grid-column: auto; }
.kpis .card { margin: 0; border: 0; border-radius: 0; background: var(--surface); color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: var(--s0); transition: background-color 120ms ease; }
@media (hover: hover) and (pointer: fine) { .kpis .card:hover { background: var(--surface-2); } }
.kpis .card .big { font-size: 32px; margin-block: var(--s1) var(--s0); color: var(--ink); }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s1); }
.plan-card { font: inherit; color: inherit; text-align: start; display: flex; flex-direction: column; gap: var(--s0); margin: 0; cursor: pointer; min-block-size: 44px; transition: border-color 150ms ease, transform 160ms var(--ease-out); }
.plan-card:active { transform: scale(.98); }
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.plan-card:disabled { opacity: .55; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); margin-block-end: var(--s3); }
.chip { display: inline-flex; align-items: center; gap: var(--s1); min-block-size: 40px; padding: 0 var(--s2); border-radius: var(--r); border: 1px solid var(--edge); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 15px; transition: border-color 120ms ease, transform 160ms var(--ease-out); }
.chip strong { font-size: 16px; }
.chip:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--line-strong); } }
/* Nothing waiting: the chip steps back so the ones that need a look stand out. */
.chip:not(.chip-hot) { color: var(--ink-3); }
.chip:not(.chip-hot) strong { color: var(--ink-3); font-weight: 500; }
.chip-hot { border-color: var(--brass-edge); background: var(--brass-soft); color: var(--brass); }
.chip-hot strong { color: var(--brass); }
.chart { inline-size: 100%; block-size: auto; }
.chart .axis { stroke: var(--line-strong); }
.chart-days { display: grid; grid-template-columns: repeat(14, 1fr); text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); margin-block-start: var(--s1); }
.bar-sales { fill: var(--brand); background: var(--brand); }
.bar-collections { fill: var(--brass-bar); background: var(--brass-bar); }
.swatch { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 2px; vertical-align: middle; margin-inline: var(--s1) var(--s0); }
.table .audit-id { inline-size: 10ch; }
.table-scroll { overflow-x: auto; }
.import-grid td { white-space: nowrap; } .import-grid td.problems { white-space: normal; min-inline-size: 16rem; color: var(--bad); }
.row-bad td:first-child { color: var(--bad); font-weight: 600; } .cell-bad { background: var(--bad-soft); }
.checks { list-style: none; padding: 0; margin: 0 0 var(--s2); display: flex; flex-direction: column; gap: var(--s1); }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--bad); font-weight: 600; }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s1); }
.checklist .done { color: var(--ink-3); } .checklist .done a { color: inherit; }
.qr { inline-size: min(100%, 240px); margin-block: var(--s1); background: #fff; padding: var(--s1); border-radius: var(--r); }
.qr svg { display: block; inline-size: 100%; block-size: auto; }

/* ---- Phone: the cover becomes a green band on top; the page scrolls normally; 16px inputs avoid the iOS zoom jump ---- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > :last-child, .kpis:has(> :nth-child(4):last-child) > :last-child { grid-column: auto; }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .console-menu { display: inline-flex; margin-block-end: var(--s2); }
  .toast, .shell .toast { inset-block-end: calc(76px + env(safe-area-inset-bottom)); inset-inline-start: 0; } /* above the tab bar */
  .shell { display: block; block-size: auto; overflow: visible; }
  .side { position: static; overflow: visible; padding: var(--s2); background: var(--cover); }
  .side .brand { padding-block-end: 0; font-size: 22px; }
  /* The full menu stays folded behind the "More" tab; the tab bar carries the everyday destinations (R-UI-02). */
  /* Language and theme stay in the green band; the user row and logout open with the menu. */
  /* The band is just the name; menu, account, language and theme all open behind "More". */
  .side .nav, .side .side-foot { display: none; }
  .side .side-foot { margin-block-start: var(--s2); padding-block-start: var(--s2); }
  .nav-toggle:checked ~ .side .nav { display: flex; margin-block-start: var(--s2); }
  .nav-toggle:checked ~ .side .side-foot { display: flex; }
  .side .prefs { flex-direction: row; }
  .side .langs { flex: 1 1 auto; }
  .side .themes { flex: 0 0 auto; }
  .nav a { min-block-size: 48px; }
  .main { margin: 0; border-radius: 0; overflow: visible; }
  .langs button, .themes button, .side .langs button, .side .themes button { min-block-size: 44px; min-inline-size: 44px; }
  .page { padding: var(--s3) var(--s2); padding-block-end: 6rem; }
  h1 { font-size: 26px; }
  .toolbar { gap: var(--s1) var(--s2); margin-block-end: var(--s2); }
  .card { padding: var(--s2); margin-block-end: var(--s2); }
  /* Filters: one full-width column, with From/To dates paired side by side. */
  form.row, .row.card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s1) var(--s1); align-items: end; }
  form.row > *, .row.card > * { grid-column: 1 / -1; min-inline-size: 0; }
  form.row > .field:has(input[type=date]), .row.card > .field:has(input[type=date]) { grid-column: span 1; }
  form.row > .field, .row.card > .field { display: flex; flex-direction: column; gap: 4px; }
  /* Tables keep one line per row and scroll sideways, instead of breaking names over four lines. */
  .table th, .table td { white-space: nowrap; }
  .card .table th, .card .table td { white-space: normal; }
  .table td { block-size: 48px; }
  /* Home: counters scroll as one edge-to-edge row; the empty ones step aside. */
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--s2) * -1); padding-inline: var(--s2); margin-block-end: var(--s2); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; white-space: nowrap; min-block-size: 44px; }
  .chips.queue .chip:not(.chip-hot) { display: none; }
  .kpis { margin-block-end: var(--s2); }
  .kpis .card { padding: var(--s2); }
  .kpis .card .big { font-size: 22px; margin-block: 4px 0; }
  .credit-card { grid-template-columns: minmax(0, 1fr); }
  .timeline.steps { padding-inline: var(--s2); }
  .timeline.steps li { grid-template-columns: auto minmax(0, 1fr); }
  .tl-when { grid-column: 2; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 10;
    background: var(--surface); border-block-start: 1px solid var(--line); padding-block-end: env(safe-area-inset-bottom);
  }
  .tabbar a, .tabbar label {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-block-size: 60px;
    color: var(--ink-2); text-decoration: none; font-size: 12px; cursor: pointer; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .tabbar span { font-size: 20px; line-height: 1; }
  .tabbar a.active, .nav-toggle:checked ~ .tabbar label { color: var(--brand); font-weight: 600; }
  .table { display: block; overflow-x: auto; }
  :root { --control: 48px; }
  .table { --control: 48px; }
  /* Segmented ranges stay one row and scroll sideways rather than wrapping into a block. */
  .segmented { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; inline-size: 100%; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex: 1 0 auto; padding-inline: 12px; white-space: nowrap; }
  .actions { grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); }
  .actions .btn { padding-inline: var(--s1); }
  input, select { font-size: 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .auth-cover { order: -1; padding: var(--s3) var(--s2); }
  .auth-cover h2 { font-size: 28px; }
  .auth-points, .auth-receipt, .auth-cover .cover-foot { display: none; }
  .auth-sheet { border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: var(--s3) var(--s2); }
  .auth-card { padding-block: var(--s3); }
  .auth-card h1 { font-size: 32px; }
}

/* ---- Printed documents (S-27): A4, black on white, no app chrome ---- */
/* Paper is white in every theme: color-scheme makes light-dark() pick the light side for inputs and buttons too. */
.print-page { color-scheme: light; background: #fff; color: #111; min-height: 100vh; padding: var(--s3); }
/* Above the document, never printed: which language to print in, and Print. */
.print-bar { max-inline-size: 800px; margin: 0 auto var(--s3); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s1) var(--s2); border: 1px solid #ddd; border-radius: var(--r); background: #f7f7f5; }
.print-langs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s0); }
.print-langs .muted { color: #555; margin-inline-end: var(--s1); }
.print-langs a { display: inline-flex; align-items: center; min-block-size: 40px; padding: 0 var(--s2); border-radius: var(--r); color: #222; text-decoration: none; font-size: 15px; transition: background-color 120ms ease; }
@media (hover: hover) and (pointer: fine) { .print-langs a:not(.current):hover { background: #ebebe6; } }
.print-langs a.current { background: #111; color: #fff; font-weight: 600; }
.print-doc { max-inline-size: 800px; margin-inline: auto; display: flex; flex-direction: column; gap: var(--s2); font-size: 15px; }
.print-doc h1, .print-doc h2 { color: #111; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-block-end: 3px double #111; padding-block-end: var(--s2); }
.print-head > :first-child { font-family: var(--f-head); font-size: 24px; font-weight: 700; }
.print-title { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s0); }
.print-title h1 { margin: 0; font-size: 34px; }
.print-title > strong:first-child { font-family: var(--f-head); font-size: 30px; line-height: 1.3; }
.print-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.print-meta dt { font-size: 13px; color: #444; margin: 0; }
.print-meta dd { font-weight: 600; }
.print-doc[dir="rtl"] .print-meta dd[dir="ltr"] { text-align: right; } /* numbers and phones stay LTR but line up with the RTL labels */
.print-table { inline-size: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.print-table th, .print-table td { border-block-end: 1px solid #bbb; padding: var(--s1); text-align: start; }
.print-table thead th { border-block-end: 2px solid #111; font-size: 14px; }
.print-table tfoot th, .print-table tfoot td { text-align: start; border-block-end: 1px solid #bbb; }
.print-table tfoot tr:first-child th, .print-table tfoot tr:first-child td { border-block-start: 2px solid #111; }
.print-words { font-family: var(--f-head); font-weight: 700; font-size: 19px; }
.print-clause { font-size: 17px; line-height: 2; margin: 0; }
.clauses { display: flex; flex-direction: column; gap: var(--s1); padding-inline-start: var(--s3); line-height: 1.8; }
.print-sign:has(> div:nth-child(3)) { grid-template-columns: 1fr 1fr 1fr; }
.print-sign { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-block-start: var(--s5); }
.print-sign div { border-block-start: 1px solid #111; padding-block-start: var(--s1); min-block-size: 3rem; font-size: 14px; }
@media print {
  .no-print { display: none !important; }
  .print-page { padding: 0; }
  @page { size: A4; margin: 12mm; }
}

#blazor-error-ui { display: none; position: fixed; inset-block-end: 0; inset-inline: 0; padding: var(--s2) var(--s3); background: var(--bad-soft); color: var(--bad); z-index: 1000; }
#blazor-error-ui .reload { margin-inline-start: var(--s2); }
.blazor-error-boundary { background: var(--bad-soft); color: var(--bad); padding: var(--s2); border-radius: var(--r); }

/* ---- Storefront (S-55…S-58): phone first, no circuit ---- */
.store-page { min-height: 100vh; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; }
.store-top { display: flex; justify-content: flex-end; padding: var(--s1) var(--s2); background: var(--cover); }
.store-top .langs { display: flex; gap: var(--s2); }
.store-top .langs a { color: var(--cover-ink-2); text-decoration: none; padding: var(--s0) var(--s1); border-radius: var(--r); min-block-size: 44px; display: inline-flex; align-items: center; }
.store-top .langs a.current { color: var(--gold); font-weight: 600; background: rgba(242, 235, 217, .12); }
.store-main { flex: 1; inline-size: 100%; max-inline-size: 1100px; margin-inline: auto; padding: var(--s3) var(--s2); display: flex; flex-direction: column; gap: var(--s3); }
.store-foot { text-align: center; padding: var(--s2); }
.store-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.store-head h1 { margin: 0; font-size: 36px; }
.store-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s2); }
.store-card { display: flex; flex-direction: column; gap: var(--s1); margin: 0; }
.store-card-link { display: flex; flex-direction: column; gap: var(--s0); color: inherit; text-decoration: none; }
.store-icon { font-size: 2rem; line-height: 1; }
.store-icon.big { font-size: 3rem; }
.store-product h1 { margin: 0; }
.btn.added { outline: 2px solid var(--brand); }
.hp { position: absolute; inset-inline-start: -10000px; inline-size: 1px; block-size: 1px; overflow: hidden; }
/* An element the script hides stays hidden whatever its display rule (checkout installment fields). */
[hidden] { display: none !important; }
input[type="radio"] { inline-size: 1.2rem; block-size: 1.2rem; min-block-size: 0; padding: 0; flex: none; margin: 0; accent-color: var(--brand); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.auth-card p.small { font-size: 16px; }
