:root {
  /* Colours from the NexFix logo (UX-86): its near-black for actions and the menu bar, its red as the brand accent,
     its neutral greys for surfaces and text. Red is never the action colour: it already means errors, required
     fields and negative amounts, and white on the logo red is only 3.7 : 1. */
  /* Softer than paper white (UX-87): a light grey page, cards just off white — less glare over a long day. */
  --bg: #ececee;
  --surface: #fbfbfc;
  --surface-2: #f4f4f6;
  --border: #e1e1e6;
  --border-strong: #cfcfd6;
  --text: #18181b;
  --text-2: #3f3f46; /* labels, table headings, read-only values: clearly readable (10.4 : 1), quieter than data (UX-81) */
  --muted: #52525b; /* side notes only (7.7 : 1) */
  --primary: #18181b; /* buttons, focus, selection: white on it is 17.7 : 1 */
  --link: var(--primary); /* --primary as text or a line: links, tabs, focus and selection outlines (a brand may need it lighter in dark) */
  --primary-hover: #3f3f46;
  --primary-soft: #e8e8ec;
  --on-primary: #ffffff; /* text on a primary button */
  --on-primary-2: #d4d4d8;
  --focus-ring: rgba(24, 24, 27, 0.14);
  --row-hover: #f1f1f4;
  --row-section: #e9e9ed;
  --cell-edit: #fffbe6; /* the grid cell being typed in */
  --brand: #73d1ca; /* the website's brand green (ADR-071): accents only, on the dark chrome (was gold, before that the Ktuulz red) */
  --ink: #0d0d0f; /* the logo's background */
  --chrome: #111013; /* the dark band across the top: menu bar */
  --chrome-2: #1a191c; /* and toolbar (UX-87) */
  --sidebar: var(--chrome);
  --sidebar-text: #d4d4d8;
  --sidebar-active: #73d1ca;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --danger-line: #f1b8b1;
  --danger-solid: #b42318;
  --danger-solid-hover: #93190f;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --warn-line: #f0d58a;
  --ok: #1a7f37;
  --ok-soft: #e6f4ea;
  --ok-line: #b6dfc0;
  --chart-bar: #71717a; /* OBS-09: 4.6 : 1 on the cards; today's bar is the text colour */
  --info-soft: #e8f0fb;
  --info-text: #1f5fa8;
  --radius: 6px;
  --font: 'Segoe UI', Tahoma, 'Geeza Pro', 'Noto Sans Arabic', system-ui, sans-serif;
  --num: 'Segoe UI', Tahoma, system-ui, sans-serif;
  color-scheme: light;
}

/* Colours that were written into the rules below (THM-01), as tokens with exactly the values they had, so a brand
   file (brand-equipmart.css) can change them by overriding variables only. The same in light and dark: the dark band
   across the top, the first screens and WhatsApp's green looked the same in both before. Printouts (the print rules,
   .doc-print, .dp-*, the A4 sheet .dv-sheet) keep their own fixed colours: they never follow a brand or a theme
   (THM-05). Shadows, masks and the video's black stay as written. */
:root {
  --on-danger: #fff;
  --on-brand: #fff;
  --backdrop: rgba(13, 13, 15, 0.5);
  --veil: rgba(255, 255, 255, 0.75); /* over a photo while something is dropped on it */
  --veil-strong: rgba(255, 255, 255, 0.9);
  --tag-bg: rgba(24, 24, 27, 0.75); /* the "main photo" tag */
  --tag-text: #fff;
  --switch-knob: #fff;
  --logo-chip: #fff; /* behind the shop's own logo in the menu bar */
  --pp-paper: #525659; /* print preview: around the page */
  --pp-paper-text: #e5e7eb;
  --dv-backdrop: #3b3f45; /* the document viewer around its A4 sheet */
  --dv-keys-bg: #2e3237;
  --dv-keys-text: #c9ced6;
  /* the menu bar and toolbar */
  --chrome-strong: #fff;
  --chrome-muted: #a1a1aa;
  --chrome-line: rgba(255, 255, 255, 0.12);
  --chrome-hover: rgba(255, 255, 255, 0.10);
  --chrome-hover-2: rgba(255, 255, 255, 0.08);
  --chrome-focus: rgba(255, 255, 255, 0.75);
  --chrome-field: rgba(255, 255, 255, 0.06);
  --chrome-field-hover: rgba(255, 255, 255, 0.3);
  --chrome-btn-line: rgba(255, 255, 255, 0.16);
  --chrome-primary: #fafafa;
  --chrome-primary-hover: #e4e4e7;
  --chrome-on-primary: #0d0d0f;
  --chrome-warn-line: rgba(251, 191, 36, 0.55);
  --chrome-warn-bg: rgba(251, 191, 36, 0.14);
  --chrome-warn-text: #fde68a;
  --chrome-bad-line: rgba(248, 113, 113, 0.6);
  --chrome-bad-bg: rgba(248, 113, 113, 0.16);
  --chrome-bad-text: #fecaca;
  --chrome-ok: #4ade80;
  --toolbar-text: #e4e4e7;
  --toolbar-line: rgba(0, 0, 0, 0.5);
  /* the first screens (sign-in, licence key, set-up) */
  --first-bg: radial-gradient(1100px 720px at 28% 38%, rgba(115, 209, 202, 0.11), transparent 60%), radial-gradient(900px 600px at 92% 100%, rgba(115, 209, 202, 0.06), transparent 60%), linear-gradient(160deg, #161315 0%, #0d0d0f 62%, #0b0b0d 100%);
  --center-bg: radial-gradient(1000px 640px at 30% 35%, rgba(115, 209, 202, 0.10), transparent 60%), linear-gradient(160deg, #161315 0%, #0d0d0f 70%);
  --first-text: #e4e4e7;
  --first-text-2: #d4d4d8;
  --first-strong: #fafafa;
  --first-muted: #8e8e94;
  --first-muted-2: #a1a1aa;
  --wordmark: #a6a6ab;
  --wordmark-k: #fafafa;
  --wordmark-t: #73d1ca; /* brand green (ADR-071) */
  --wordmark-fix: #73d1ca; /* brand green (ADR-071) */
  --logo-t: #73d1ca; /* brand green (ADR-071) */
  --blueprint-grid: rgba(255, 255, 255, 0.05);
  --blueprint-line: rgba(255, 255, 255, 0.11);
  /* WhatsApp's own green (UX-84) */
  --wa: #25d366;
  --wa-hover: #1ebe5b;
  --wa-text: #128c4a;
  --wa-underline: rgba(37, 211, 102, 0.4);
  --on-wa: #fff;
  --code: var(--num); /* part numbers and codes in pickers and lists */
}

/* Dark mode (UX-87), chosen in the user menu (theme.ts). Screen only: printing and PDFs keep the light tokens. */
@media screen {
  :root[data-theme='dark'] {
    --bg: #0d0d0f;
    --surface: #161518;
    --surface-2: #1d1c20;
    --border: #2a292e;
    --border-strong: #3b3a40;
    --text: #ececee;
    --text-2: #c4c4c9; /* 10.6 : 1 on the cards */
    --muted: #a1a1aa; /* 7.0 : 1 */
    --primary: #f4f4f5; /* light buttons on the dark */
    --primary-hover: #d4d4d8;
    --primary-soft: #2a292e;
    --on-primary: #0d0d0f;
    --on-primary-2: #3f3f46;
    --focus-ring: rgba(244, 244, 245, 0.16);
    --row-hover: #1f1e23;
    --row-section: #222125;
    --cell-edit: #2a2410;
    --chrome: #0a0a0b;
    --chrome-2: #131215;
    --danger: #f87171;
    --danger-soft: #2a1414;
    --danger-line: #5c2622;
    --danger-solid: #dc2626;
    --danger-solid-hover: #b91c1c;
    --warn: #fbbf24;
    --warn-soft: #2a210c;
    --warn-line: #5a4613;
    --ok: #4ade80;
    --ok-soft: #0f2417;
    --ok-line: #1f4d2e;
    --chart-bar: #71717a; /* 3.9 : 1 on the dark cards */
    --info-soft: #13202f;
    --info-text: #93c5fd;
    color-scheme: dark; /* scrollbars, date pickers and drop-down lists follow */
  }
  :root[data-theme='dark'] .form-side .auth-card, :root[data-theme='dark'] .auth-card { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 28px 70px rgba(0, 0, 0, 0.6); }
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
a { color: var(--link); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.muted { color: var(--muted); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; text-align: end; white-space: nowrap; }
.neg { color: var(--danger); }
.pos { color: var(--ok); font-weight: 600; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }

/* ---- shell layout */
.app-root { display: flex; flex-direction: column; height: 100%; }
.app-root > :not(.shell) { flex: none; }
.shell { display: flex; flex-direction: column; height: 100%; flex: 1; min-height: 0; }
.content { flex: 1; overflow: auto; padding: 20px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }

/* ---- surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.span-2 { grid-column: span 2; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.tile button.linklike { margin-top: 6px; }

/* ---- forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; color: var(--text-2); }
.input, .select, .textarea {
  height: 32px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); outline: none; min-width: 0; width: 100%;
}
.textarea { height: auto; padding: 7px 9px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--link); box-shadow: 0 0 0 3px var(--focus-ring); }
.input[readonly] { background: var(--surface-2); }
.input.num { text-align: end; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.filters .field { width: 170px; }
.filters .field.wide { width: 280px; }

/* ---- buttons */
.btn {
  height: 32px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn.danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--on-danger); }
.btn.danger-solid:hover:not(:disabled) { background: var(--danger-solid-hover); }
.kbd { font: 11px var(--num); padding: 1px 5px; margin-inline-start: 6px; border: 1px solid currentColor; border-radius: 4px; opacity: 0.7; direction: ltr; unicode-bidi: isolate; }
.confirm-backdrop { z-index: 60; }
.modal.confirm { width: min(460px, 92vw); }
.btn.small { height: 26px; padding: 0 9px; font-size: 13px; }
/* Links are underlined (light line, dark on hover): their colour is close to the text's, so colour alone would not tell them apart. */
.linklike { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.linklike:hover { text-decoration-color: currentColor; }

/* ---- tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
table.data th { background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-2); position: sticky; top: 0; z-index: 1; }
table.data tbody tr:hover { background: var(--row-hover); }
table.data tr.clickable { cursor: pointer; }
/* virtual.tsx: the empty rows standing in for rows not drawn */
table.data tr.v-gap td { padding: 0; border: 0; }
table.data tbody tr.v-gap:hover { background: none; }
table.data tbody tr.hl { background: var(--primary-soft); }
table.data tr.selected { background: var(--primary-soft); }
table.data tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
table.data tr.subtotal td { font-weight: 600; background: var(--surface-2); }
table.data tr.section td { font-weight: 700; background: var(--row-section); }
table.data td.indent-1 { padding-inline-start: 26px; }
table.data td.indent-2 { padding-inline-start: 44px; }
table.data th.num, table.data td.num { text-align: end; }

/* ---- voucher grid */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); }
table.grid th { background: var(--surface-2); font-size: 13px; color: var(--text-2); font-weight: 600; padding: 6px 6px; border: 1px solid var(--border); text-align: start; }
table.grid td { border: 1px solid var(--border); padding: 0; height: 32px; }
table.grid td input, table.grid td select { width: 100%; height: 31px; border: 0; padding: 0 7px; background: transparent; outline: none; }
table.grid td input:focus, table.grid td select:focus { background: var(--cell-edit); box-shadow: inset 0 0 0 2px var(--link); }
table.grid td.ro { background: var(--surface-2); padding: 0 7px; color: var(--text-2); font-size: 13px; }
table.grid td.idx { text-align: center; color: var(--muted); width: 36px; font-size: 12px; }
table.grid tfoot td { padding: 6px 7px; font-weight: 600; background: var(--surface-2); }

/* ---- badges & alerts */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.audited { background: var(--info-soft); color: var(--info-text); }
.badge.posted { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled { background: var(--row-section); color: var(--muted); text-decoration: line-through; }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.alert { padding: 10px 12px; border-radius: var(--radius); border: 1px solid; }
.alert.error { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.toast { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 100; min-width: 280px; max-width: min(640px, 90vw); text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 10px; }
[dir='rtl'] .toast { transform: translateX(50%); }

/* ---- modal */
.backdrop { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 50; }
.modal { background: var(--surface); border-radius: 8px; width: min(640px, 92vw); max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.modal.wide { width: min(900px, 94vw); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
/* Print preview (UX-93): the page as it prints on the left, the printer on the right. */
.backdrop:has(> .modal.pp) { padding-top: 3vh; }
.modal.pp { width: min(1200px, 96vw); height: 92vh; max-height: 92vh; }
.modal.pp .modal-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; display: flex; }
.pp-paper { flex: 1; min-width: 0; display: flex; background: var(--pp-paper); }
.pp-paper iframe { flex: 1; width: 100%; height: 100%; border: 0; }
.pp-wait { margin: auto; padding: 24px; color: var(--pp-paper-text); text-align: center; }
.pp-side { width: 280px; flex: none; padding: 16px 18px; border-inline-start: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.pp-side .select, .pp-side .input { width: 100%; }
.pp-gap { flex: 1; }
/* The part screen (UX-97): the summary's name line and figures, and the totals strip of its Sales / Purchases tabs. */
.part-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.part-name { font-size: 18px; font-weight: 600; }
.part-title { align-items: center; }
/* Settings → Backups (UX-124): one line per kind of backup, its state at a glance; starting over apart, in red. */
.bk-lines { display: grid; gap: 10px; }
.bk-line { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bk-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.bk-ok .bk-mark { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }
.bk-warn .bk-mark { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.bk-bad .bk-mark { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); }
.bk-off .bk-mark { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.bk-bad { border-color: var(--danger-line); }
.bk-text { color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.danger-zone { border-color: var(--danger-line); }
.danger-zone > h2 { color: var(--danger); }
.part-actions { margin-inline-start: auto; display: inline-flex; flex-wrap: wrap; gap: 8px; }
/* Photos of items (PHO-01, PHO-03): the main photo at the start of the part's name line, the viewer, list thumbnails. */
.part-photo { position: relative; width: 56px; height: 56px; flex: none; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.part-photo img { width: 100%; height: 100%; object-fit: cover; }
.part-photo:hover { border-color: var(--border-strong); }
.part-photo.add { border-style: dashed; flex-direction: column; color: var(--text-2); font-size: 18px; line-height: 1; gap: 2px; }
.part-photo.add small { font-size: 11px; }
.part-photo-count { position: absolute; inset-inline-end: 2px; bottom: 2px; background: var(--primary); color: var(--on-primary); border-radius: 8px; padding: 0 5px; font-size: 11px; }
.photo-stage { position: relative; min-height: 240px; height: min(46vh, 520px); display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.photo-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.photo-empty { text-align: center; padding: 24px; line-height: 1.8; }
.photo-busy { position: absolute; inset: auto 0 0 0; padding: 8px; text-align: center; background: var(--veil-strong); color: var(--text-2); }
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-pick { position: relative; width: 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); cursor: pointer; }
.photo-pick.on { border-color: var(--link); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-main-tag { position: absolute; inset: auto 0 0 0; background: var(--tag-bg); color: var(--tag-text); font-size: 10px; text-align: center; }
.photo-loading, .photo-missing { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); background: var(--surface-2); }
.part-thumb { width: 24px; height: 24px; margin-block: -4px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); vertical-align: middle; flex: none; }
span.part-thumb { display: inline-flex; }
.thumb-btn { padding: 0; border: 0; background: none; cursor: zoom-in; line-height: 0; vertical-align: middle; border-radius: 4px; }
.thumb-btn:hover .part-thumb, .thumb-btn:focus-visible .part-thumb { outline: 2px solid var(--link); outline-offset: 1px; }
.photo-drop { border-radius: var(--radius); }
.photo-drop.over .photo-stage { border: 2px dashed var(--link); background: var(--primary-soft); }
.photo-drop-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--text); background: var(--veil); pointer-events: none; }
/* UX-126: a parts list file dragged over a quotation, and the Paste lines dialog */
.quote-drop { position: relative; border-radius: var(--radius); }
.quote-drop.over { outline: 2px dashed var(--link); outline-offset: 4px; }
.quote-drop-note { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--text); background: var(--primary-soft); opacity: 0.94; pointer-events: none; border-radius: var(--radius); }
.paste-lines { border-radius: var(--radius); }
.paste-lines.over { outline: 2px dashed var(--link); outline-offset: 4px; background: var(--primary-soft); }
.paste-lines-text { font-family: var(--code); min-height: 160px; resize: vertical; }
.paste-lines-review { max-height: 52vh; }
.paste-lines-review td { vertical-align: top; }
.paste-lines-review .input { min-width: 0; width: 100%; }
.pl-code { font-family: var(--code); }
.chip.static { cursor: default; }
.modal-foot .chip { align-self: center; }
.head-chip { font-size: 12px; font-weight: 500; vertical-align: middle; margin-inline-start: 12px; }
.stat-strip, .hist-strip { display: flex; flex-wrap: wrap; gap: 10px 32px; }
.stat-strip > div, .hist-strip > div { display: flex; flex-direction: column; gap: 2px; min-width: 70px; }
.stat-strip span, .hist-strip span { font-size: 12px; color: var(--muted); }
.stat-strip strong, .hist-strip strong { font-size: 17px; }
.stat-strip .big strong { font-size: 30px; line-height: 1.1; }
.stat-strip .num, .hist-strip .num { text-align: start; }
/* UX-101: a price that can be changed on the spot; parts to sell instead */
/* The part's summary in groups (product owner 2026-10-18: "UI/UX is little confusing"): each with a small heading,
   a line between them; every figure the same size, the last activity quieter. */
.sum-groups { display: flex; flex-wrap: wrap; gap: 14px 0; }
.sum-group { padding-inline: 24px; border-inline-start: 1px solid var(--border); }
.sum-group:first-child { padding-inline-start: 0; border-inline-start: 0; }
.sum-group h4 { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sum-group .stat-strip { gap: 8px 24px; }
.sum-group .stat-strip strong, .sum-group .stat-strip strong .num, .sum-group .price-btn .num { font-size: 17px; font-weight: 700; }
.sum-group .stat-strip .big strong { font-size: 30px; }
.sum-group.quiet .stat-strip strong { font-size: 15px; font-weight: 500; }
.info-mark { cursor: help; font-size: 12px; color: var(--muted); }
.info-mark:hover { color: var(--link); }
.price-stat .price-btn { display: inline-flex; align-items: baseline; gap: 6px; background: none; border: 0; padding: 0 4px; margin-inline-start: -4px; border-radius: 4px;
  font: inherit; color: inherit; cursor: pointer; text-align: start; }
.price-stat .price-btn .edit-mark { font-size: 13px; color: var(--muted); opacity: .55; }
.price-stat .price-btn:hover { background: var(--row-hover); }
.price-stat .price-btn:hover .edit-mark { opacity: 1; color: var(--link); }
.copy-btn { margin-inline-start: 10px; padding: 2px 7px; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--muted); font-size: 15px; line-height: 1.2; cursor: pointer; vertical-align: middle; }
.copy-btn:hover { border-color: var(--border); color: var(--text, inherit); background: var(--row-hover); }
.price-stat .price-input { width: 110px; padding: 2px 6px; font-size: 16px; font-weight: 700; }
.price-stat small { font-size: 11px; max-width: 200px; }
.alt-instead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-top: 10px; border-top: 1px solid var(--border); }
button.alt-chip { cursor: pointer; font: inherit; color: inherit; }
button.alt-chip:hover { border-color: var(--link); }
.ov-chip small.pos { color: var(--ok); }
.ov-chip small.neg { color: var(--danger); }
/* The part's Overview (UX-97): numbers and units as chips beside a short list of details; nothing empty takes space. */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 40px; }
.ov-grid h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: none; }
.ov-grid section > h3:not(:first-child) { margin-top: 18px; }
.ov-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-chip { display: inline-flex; align-items: baseline; gap: 8px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.ov-chip bdi { font-weight: 600; }
.ov-chip small { color: var(--muted); font-size: 11px; }
.kv { margin: 0; display: grid; gap: 6px; }
.kv > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
@media (max-width: 760px) { .ov-grid { grid-template-columns: 1fr; } }
.grid-2 > .card + .card { margin-top: 0; } /* side by side: the second card is not below the first */
.period-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.period-row .presets { padding-bottom: 0; align-items: center; }
/* A part's bin location next to its name (UX-94): in the part picker and on document lines. */
.loc-tag { display: inline-block; margin-inline-start: 8px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---- account picker */
.picker { position: relative; }
.picker-list { position: absolute; z-index: 30; inset-inline-start: 0; top: 100%; width: 420px; max-height: 300px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.picker-item { padding: 6px 10px; cursor: pointer; display: flex; gap: 10px; }
.picker-item .code { color: var(--muted); font-family: var(--code); min-width: 60px; }
.picker-item.hl, .picker-item:hover { background: var(--primary-soft); }
.picker-list.item-list { width: min(760px, 92vw); max-height: 360px; }
.picker-head { display: flex; gap: 10px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.item-list .num { min-width: 60px; text-align: end; font-variant-numeric: tabular-nums; }
.item-list .money { min-width: 84px; }
.item-list .code { min-width: 130px; }
.picker-empty { padding: 10px 12px; color: var(--muted); }

/* ---- tree */
.tree-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.tree-row:hover { background: var(--row-hover); }
.tree-row.lvl-0 { font-weight: 700; background: var(--row-section); }
.tree-row.lvl-1 { font-weight: 600; padding-inline-start: 28px; }
.tree-row.lvl-2 { padding-inline-start: 50px; }
.tree-row .toggle { width: 18px; background: none; border: 0; cursor: pointer; color: var(--muted); }
.tree-row .code { font-family: var(--code); color: var(--muted); min-width: 70px; }

/* ---- login / setup */
.center-page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--center-bg); }
.auth-card { background: var(--surface); border-radius: 10px; padding: 28px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.auth-card.wide { width: min(640px, 100%); }
.auth-card h1 { margin-bottom: 4px; }
.choice { border: 1px solid var(--border-strong); border-radius: 8px; padding: 14px; cursor: pointer; text-align: start; background: var(--surface); width: 100%; }
.choice.selected { border-color: var(--link); box-shadow: 0 0 0 2px var(--primary-soft); }
.choice strong { display: block; margin-bottom: 2px; }

/* ---- printing */
.print-head { display: none; }
@media print {
  @page {
    size: A4; margin: 12mm;
    /* Page number on every printout, in the bottom margin: "1 / 2". */
    @bottom-center { content: counter(page) " / " counter(pages); font-size: 8pt; color: #6b7280; }
  }
  /* White to the paper's edge: the page margins show the root's background, and in dark mode (or on the window's dark
     start-up colour) they came out as a black frame around the invoice. */
  html, body { background: #fff !important; color-scheme: light; }
  body { font-size: 11px; }
  .menubar, .toolbar, .busy-bar, .no-print, .filters, .page-head .btn, .crumbs { display: none !important; } /* .crumbs: the "Sales invoices ›" trail printed above the invoice */
  .shell { display: block; }
  .app-root { display: block; height: auto; }
  .content { padding: 0; overflow: visible; }
  .print-head { display: block; text-align: center; margin-bottom: 10px; }
  .print-head .company { font-size: 15px; font-weight: 700; }
  .print-head .title { font-size: 14px; font-weight: 600; margin-top: 2px; }
  .print-head .sub { color: #555; }
  .card, .table-wrap { border: 0; padding: 0; }
  table.data th { position: static; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data th, table.data td { padding: 4px 6px; }
  table.data tr { break-inside: avoid; }
}

.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .screen-only { display: none !important; }
}
.voucher-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.voucher-meta strong { color: var(--text); font-weight: 600; }
.totals-bar { display: flex; gap: 24px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-top: 0; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.totals-bar .ok { color: var(--ok); font-weight: 600; }
.totals-bar .bad { color: var(--danger); font-weight: 600; }
.sign-row { display: flex; justify-content: space-between; margin-top: 40px; }

/* ---- printed trade documents */
.doc-print { font-size: 11px; }
.doc-print .doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #333; padding-bottom: 8px; margin-bottom: 8px; }
.doc-print .doc-head .co { font-size: 15px; font-weight: 700; }
.doc-print .doc-title { text-align: center; font-size: 15px; font-weight: 700; margin: 6px 0; }
.doc-print .doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; margin-bottom: 8px; }
.doc-print table { width: 100%; border-collapse: collapse; }
.doc-print th, .doc-print td { border: 1px solid #999; padding: 3px 5px; }
.doc-print th { background: #eee; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-print .totals { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; align-items: flex-start; }
.doc-print .totals table { width: 320px; }
.doc-print .words { margin-top: 6px; }

.page-head > .select, .page-head > .input { width: 240px; }

/* Company logo on printouts (Settings → logo) */
.co-logo { max-height: 64px; max-width: 200px; object-fit: contain; }
.print-head .co-logo { display: block; margin: 0 auto 4px; }
.doc-print .doc-head .grow { flex: 1; }
.logo-preview { max-height: 80px; max-width: 240px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; background: #fff; }
.input.unmatched { border-color: var(--warn); }

/* "+" inside customer/supplier pickers: create one without leaving the document */
.picker.with-add .input { padding-inline-end: 34px; }
.picker-add { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--link); font-size: 17px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.picker-add:hover { background: var(--primary-soft); }
.picker-add-row { color: var(--link); font-weight: 600; border-top: 1px solid var(--border); }
table.data tr.total-row td { background: var(--surface-2); border-top: 1px solid var(--border-strong); }

/* Field-level problems (server refusals and instant checks) */
.field.invalid .input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger-soft); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 3px; }
.alert-list { margin: 6px 0 0; padding-inline-start: 20px; }
.alert-list li { margin: 2px 0; }
/* Clear errors on every form: a red cell in a line grid, the row's problems under it, invalid inputs outside a Field. */
table.grid td.invalid { box-shadow: inset 0 0 0 2px var(--danger); background: var(--danger-soft); }
table.grid tr.row-error td { height: auto; padding: 3px 8px; border-top: 0; color: var(--danger); font-size: 12.5px; background: var(--danger-soft); }
.input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger-soft); }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.crash { max-width: 640px; margin: 60px auto; }
.log-detail { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 12px; max-height: 260px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 6px; }
/* ---- owner control (H8): alerts bell, before/after lists, dashboard */
.bell { position: relative; }
.bell-btn { position: relative; }
.bell-btn.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.bell-btn.bad { border-color: var(--danger-line); background: var(--danger-soft); }
.bell-count { margin-inline-start: 4px; font-weight: 700; }
.bell-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 40; width: 420px; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.bell-head { padding: 10px 12px; font-weight: 600; border-bottom: 1px solid var(--border); }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-bottom: 1px solid var(--border); border-inline-start: 3px solid var(--warn); }
.bell-item.error { border-inline-start-color: var(--danger); }
.alerts-banner { display: flex; align-items: center; gap: 10px; border-radius: 0; border-width: 0 0 1px; padding: 6px 20px; }
.changes { margin: 0; padding-inline-start: 16px; }
.changes li { margin: 1px 0; }
.chg-del { color: var(--muted); }
.chg-add { font-weight: 600; }
.pager { justify-content: center; }
.dash-lines { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin-top: 8px; font-size: 13px; }
.dash-lines > span:nth-child(odd) { color: var(--muted); }
.dash-bar rect { fill: var(--link); }
/* ---- H8 gaps & polish: reprint mark, stock alerts, receivables per branch */
.copy-mark { text-align: center; font-weight: 700; font-size: 13px; margin: 0 auto 6px; padding: 1px 10px; border: 1.5px solid #333; width: fit-content; }
.stock-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { background: var(--primary-soft); }
.chip.neg { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.small-note { font-size: 12.5px; }
/* UX-125: the posted time under a date — its own line, wraps at the space so the column keeps the date's width */
.time-at { display: block; font-size: 12px; line-height: 1.25; white-space: normal; }
.cc-problem { margin-top: 2px; }
/* A minus sign alone decides nothing in an input: "-5" showed as "5-" in Arabic. Number inputs are always left to right. */
input.num { unicode-bidi: isolate; direction: ltr; }

/* ---- taking payment (UX-08) */
.btn.big { height: 40px; padding: 0 18px; font-size: 15px; }
.input.big { font-size: 22px; padding: 8px 12px; height: auto; }
.pay-total, .pay-change { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.pay-total strong { font-size: 26px; }
.pay-change { background: var(--ok-soft); border-color: var(--ok-line); }
.pay-change strong { font-size: 26px; color: var(--ok); }
.pay-change.neg { background: var(--danger-soft); border-color: var(--danger-line); }
.pay-change.neg strong { color: var(--danger); }
.pay-methods { flex-wrap: wrap; }
.pay-methods .btn { flex: 1; justify-content: center; }

/* ---- line hints (UX-10, UX-14) */
.last-price { display: block; width: 100%; border: 0; background: none; padding: 0 7px 2px; font: 11.5px var(--font); color: var(--link); text-align: end; cursor: pointer; white-space: nowrap; }
.last-price:hover { text-decoration: underline; }
table.grid tr.row-warn td { background: var(--warn-soft); color: var(--warn); font-size: 12.5px; padding: 3px 8px; }
.cust-strip { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 6px 10px; margin-top: 6px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.cust-strip.over { background: var(--danger-soft); border-color: var(--danger-line); }
table.grid td.ro.neg { color: var(--danger); font-weight: 600; }

/* ---- find your way (UX-30 … UX-38) */
.crumbs { font-size: 13px; color: var(--muted); margin: -6px 0 6px; }
.busy-bar { height: 2px; background: transparent; position: relative; overflow: hidden; }
.busy-bar.on::after { content: ''; position: absolute; inset-block: 0; width: 30%; background: var(--primary); animation: busy 1.1s ease-in-out infinite; }
@keyframes busy { from { inset-inline-start: -30%; } to { inset-inline-start: 100%; } }
@media (prefers-reduced-motion: reduce) { .busy-bar.on::after { animation: none; width: 100%; opacity: 0.6; } }
.palette-backdrop { z-index: 55; padding-top: 10vh; }
.palette { width: min(720px, 94vw); background: var(--surface); border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,0.3); display: flex; flex-direction: column; overflow: hidden; }
.palette > .input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 17px; padding: 14px 16px; }
.palette-list { max-height: 60vh; overflow: auto; padding: 6px 0; }
.palette-group { padding: 8px 16px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.palette-item { display: flex; gap: 12px; align-items: baseline; padding: 7px 16px; cursor: pointer; }
.palette-item.hl { background: var(--primary-soft); }
.palette-foot { padding: 6px 16px; font-size: 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
/* Long tables keep their headings and totals in view (UX-34). */
@media screen {
  .table-wrap { max-height: calc(100vh - 242px); }
  table.data tfoot td { position: sticky; bottom: 0; background: var(--surface-2); box-shadow: 0 -1px 0 var(--border); }
}
/* Where the keyboard is, always visible (UX-38, UX-43). */
:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
tr.clickable:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; background: var(--primary-soft); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible, table.grid td input:focus-visible, table.grid td select:focus-visible, .palette > .input:focus-visible { outline: none; }
.tile-action { text-align: start; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.tile-action:hover { border-color: var(--link); }
.tile-action .value { font-size: 20px; font-weight: 700; }
.tile-action.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.tile-action.primary .label { color: var(--on-primary-2); }
.tile .value.warn { color: var(--warn); }
.setup-list ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 18px; }
.setup-list li { display: flex; gap: 8px; align-items: baseline; }
.setup-list li.done { color: var(--muted); text-decoration: line-through; }
.user-menu { position: relative; }
.user-menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 40; min-width: 200px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 4px; display: flex; flex-direction: column; }
.user-menu-list button { background: none; border: 0; text-align: start; padding: 8px 10px; border-radius: 4px; font: inherit; cursor: pointer; }
.user-menu-list button:hover { background: var(--surface-2); }
.user-menu-list a[role="menuitem"] { color: inherit; text-decoration: none; text-align: start; padding: 8px 10px; border-radius: 4px; }
.user-menu-list a[role="menuitem"]:hover { background: var(--surface-2); }
.user-menu-list button.danger { color: var(--danger); }
.user-menu-list .menu-label { font-size: 12px; color: var(--muted); padding: 8px 10px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.user-menu-list .menu-group { display: flex; flex-direction: column; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 4px; }
.user-menu-list button[role='menuitemradio'] { display: flex; align-items: center; gap: 8px; }
.user-menu-list .tick { width: 14px; display: inline-block; text-align: center; }
.read-only-bar { border-radius: 0; margin: 0; text-align: center; font-weight: 600; }
.presets { display: flex; gap: 6px; align-items: end; flex-wrap: wrap; padding-bottom: 6px; }
.badge.old { background: var(--row-section); color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font: inherit; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--link); border-bottom-color: var(--link); font-weight: 600; }
/* Part numbers and codes read left to right but line up with their (right-aligned) headings in Arabic (UX-49). */
[dir='rtl'] table td[dir='ltr']:not(.num), [dir='rtl'] table th[dir='ltr']:not(.num) { text-align: right !important; }
.hijri-line { display: flex; gap: 8px; align-items: center; font-size: 12.5px; flex-wrap: wrap; }
.hijri-input { height: 26px; width: 120px; font-size: 12.5px; }
table.grid tr.row-note td { background: var(--info-soft); font-size: 12.5px; padding: 4px 8px; }

/* Shared layout helpers instead of one-off inline styles (UX-43). */
.start { text-align: start; }
.end { text-align: end; }
.center { text-align: center; }
.m0 { margin: 0; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.self-end { align-self: end; }
.self-center { align-self: center; }
.span-all { grid-column: 1 / -1; }
.justify-start { justify-content: flex-start; }
.form-actions { margin-top: 14px; justify-content: flex-end; }
.page-narrow { max-width: 900px; }
.tab-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 6px; border-radius: 999px; background: var(--danger-solid); color: var(--on-danger); font-size: 11px; line-height: 18px; text-align: center; }

/* ---- the menu bar and toolbar across the top (UX-80) */
.menubar { display: flex; align-items: stretch; gap: 2px; height: 44px; padding: 0 10px; background: var(--sidebar); color: var(--sidebar-text); flex: none; position: relative; z-index: 40; }
.mb-brand { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; padding-inline-start: 16px; border-inline-start: 1px solid var(--chrome-line); white-space: nowrap; }
.mb-names { display: flex; flex-direction: column; line-height: 1.15; }
.mb-company { color: var(--chrome-strong); font-weight: 700; font-size: 16px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.mb-by { color: var(--chrome-muted); font-size: 11px; letter-spacing: 0.02em; }
.mb-item { position: relative; display: flex; }
.mb-btn { background: none; border: 0; color: inherit; padding: 0 12px; margin: 7px 0; font-size: 14px; white-space: nowrap; border-radius: 4px; cursor: pointer; }
.mb-btn:hover, .mb-item.open .mb-btn { background: var(--chrome-hover); color: var(--chrome-strong); }
.mb-btn.here { color: var(--chrome-strong); box-shadow: inset 0 -2px 0 var(--sidebar-active); }
.mb-btn:focus-visible { outline: 2px solid var(--chrome-focus); outline-offset: -2px; }
.mb-more { font-size: 17px; padding: 0 14px; }
.mb-drop { position: absolute; top: 100%; inset-inline-start: 0; min-width: 240px; max-height: calc(100vh - 60px); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 0 0 8px 8px; box-shadow: 0 12px 28px rgba(0,0,0,0.18); padding: 6px; }
.mb-drop-end { inset-inline-start: auto; inset-inline-end: 0; }
.mb-drop button { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 7px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; color: inherit; }
.mb-drop button:hover, .mb-drop button:focus-visible { background: var(--primary-soft); outline: none; }
.mb-drop button.cur { background: var(--primary); color: var(--on-primary); }
.mb-group { font-size: 12px; color: var(--muted); padding: 8px 10px 3px; }
.mb-group:not(:first-child) { border-top: 1px solid var(--border); margin-top: 4px; }
.mb-group.mb-section { font-weight: 600; color: var(--text); }
.toolbar { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; background: var(--chrome-2); color: var(--toolbar-text); border-bottom: 1px solid var(--toolbar-line); flex: none; }
/* The toolbar is part of the dark band across the top (UX-87): light text, quiet outlines, the main action light. */
.toolbar .tb-arrow { color: var(--chrome-muted); }
.toolbar .tb-arrow:hover { background: var(--chrome-hover-2); color: var(--chrome-strong); }
.toolbar .topbar-search { background: var(--chrome-field); border-color: var(--chrome-line); color: var(--chrome-muted); }
.toolbar .topbar-search:hover { border-color: var(--chrome-field-hover); }
:is(.toolbar > .btn, .toolbar > .bell > .btn, .toolbar > .user-menu > .btn) { background: transparent; border-color: var(--chrome-btn-line); color: var(--toolbar-text); }
:is(.toolbar > .btn, .toolbar > .bell > .btn, .toolbar > .user-menu > .btn):hover:not(:disabled) { background: var(--chrome-hover-2); }
.toolbar > .btn.primary { background: var(--chrome-primary); border-color: var(--chrome-primary); color: var(--chrome-on-primary); }
.toolbar > .btn.primary:hover:not(:disabled) { background: var(--chrome-primary-hover); }
.toolbar > .bell > .bell-btn.warn { border-color: var(--chrome-warn-line); background: var(--chrome-warn-bg); color: var(--chrome-warn-text); }
.toolbar > .bell > .bell-btn.bad { border-color: var(--chrome-bad-line); background: var(--chrome-bad-bg); color: var(--chrome-bad-text); }
.toolbar .conn-dot { border-color: var(--chrome-ok); }
.toolbar .conn-dot.server { background: var(--chrome-ok); }
.toolbar :focus-visible { outline-color: var(--chrome-focus); }
.toolbar .user-menu-list, .toolbar .bell-list { color: var(--text); }
.tb-arrows { display: flex; gap: 2px; }
.tb-arrow { width: 30px; height: 30px; border: 0; background: none; border-radius: 4px; color: var(--muted); font-size: 16px; cursor: pointer; }
.tb-arrow:hover { background: var(--surface-2); color: var(--text); }
.toolbar .topbar-search { flex: 1; max-width: 560px; margin: 0 auto; border-radius: 8px; }
.tb-new { white-space: nowrap; font-weight: 600; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ok); flex: none; }
.conn-dot.server { background: var(--ok); }
.shell > .content { flex: 1; min-height: 0; }
.topbar-search { display: flex; align-items: center; gap: 8px; min-width: 240px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); font: inherit; font-size: 13.5px; cursor: text; text-align: start; }
.topbar-search:hover { border-color: var(--link); }
.topbar-search .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Locked fields (a posted document, no rights to change) are read, not faded: dark text on a light grey box (UX-81). */
.input:disabled, .select:disabled, .textarea:disabled { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; background: var(--surface-2); border-color: var(--border); }
table.grid td input:disabled, table.grid td select:disabled { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; }
.input[readonly] { color: var(--text); }
.input:disabled::placeholder, .input::placeholder { color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 0.85; }

/* Required fields: a red * after the label (UX-82); not on a locked field, where nothing can be typed. */
.req { color: var(--danger); font-weight: 700; margin-inline-start: 3px; }
.field:has(:disabled) .req, .field:has([readonly]) .req { display: none; }

/* ---- first screens (UX-83): the whole window is the logo's dark background (UX-86) — brand on one side, the form
   floating on a white card on the other; on a narrow window only the form, still on the dark. */
.first-screen { position: relative; overflow: hidden; min-height: 100%; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; color: var(--first-text);
  background: var(--first-bg); }
/* The drawing fades out towards the form so nothing busy sits behind the shop's name. */
.first-screen > .blueprint { -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 34%, rgba(0, 0, 0, 0.18) 56%, rgba(0, 0, 0, 0.06) 100%); mask-image: linear-gradient(90deg, #000 0%, #000 34%, rgba(0, 0, 0, 0.18) 56%, rgba(0, 0, 0, 0.06) 100%); }
/* Mirrored in Arabic, so the drawing (and its fade) stays on the brand side. */
[dir='rtl'] .first-screen > .blueprint { transform: scaleX(-1); }
.brand-panel { position: relative; z-index: 1; padding: 40px 48px; display: flex; flex-direction: column; }
.blueprint { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.brand-top, .brand-body, .brand-foot { position: relative; }
.brand-top { display: flex; align-items: center; gap: 12px; }
/* The logo's wordmark (ADR-069, ADR-071): "Nex" light, "Fix" in the brand green. */
.wordmark { font-size: 26px; font-weight: 600; letter-spacing: 0.02em; color: var(--wordmark-k); }
.wordmark .wm-nex { color: var(--wordmark-k); }
.wordmark .wm-fix { color: var(--wordmark-fix); }
.logo-mark { border-radius: 22%; flex: none; display: block; }
.brand-body { margin-top: auto; margin-bottom: auto; max-width: 460px; }
.brand-tagline { font-size: 30px; line-height: 1.3; font-weight: 700; color: var(--first-strong); margin: 0 0 24px; letter-spacing: -0.01em; }
.brand-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; font-size: 15px; color: var(--first-text-2); }
.brand-lines li { display: flex; gap: 12px; align-items: baseline; }
.brand-lines li span { color: var(--brand); font-weight: 700; }
.brand-foot { font-size: 12px; color: var(--first-muted); }
.form-side { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.form-box { width: min(440px, 100%); }
.form-box.wide { width: min(640px, 100%); }
.form-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.form-company { font-size: 24px; font-weight: 700; color: var(--first-strong); line-height: 1.2; }
.form-by { font-size: 12.5px; color: var(--first-muted-2); margin-top: 2px; }
/* The card: white, lifted off the dark, with the logo's red along the top. */
.form-side .auth-card { width: 100%; color: var(--text); border: 0; border-top: 3px solid var(--brand); border-radius: 12px; padding: 28px 30px 26px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.30), 0 28px 70px rgba(0, 0, 0, 0.50); }
.form-side .auth-card.wide { width: 100%; }
.form-side .auth-card .btn.primary { height: 40px; font-weight: 600; justify-content: center; }
.form-side .auth-card .input, .form-side .auth-card .select { height: 38px; }
.first-screen .wa-line { color: var(--first-muted-2); margin-top: 18px; }
.first-screen .wa-line .wa-open { color: var(--wa); text-decoration-color: var(--wa-underline); }
@media (max-width: 900px) {
  .first-screen { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .first-screen > .blueprint { -webkit-mask-image: none; mask-image: none; opacity: 0.5; }
}

/* ---- support on WhatsApp (UX-84) */
.wa-float { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 45; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.wa-fab { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--wa); color: var(--on-wa); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.22); }
.wa-fab:hover { background: var(--wa-hover); }
.wa-card { width: 300px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,0.20); padding: 14px; text-align: start; }
.wa-card-head { display: flex; gap: 10px; align-items: center; }
.wa-badge { width: 36px; height: 36px; border-radius: 50%; background: var(--wa); color: var(--on-wa); display: grid; place-items: center; flex: none; }
.wa-title { font-weight: 700; }
.wa-sub { font-size: 12.5px; color: var(--muted); }
.wa-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.wa-number { font: 700 24px var(--num); letter-spacing: 0.02em; margin: 14px 0 12px; text-align: center; }
.wa-actions { display: flex; gap: 8px; }
.wa-actions .btn { flex: 1; justify-content: center; }
.btn.wa-go { background: var(--wa); border-color: var(--wa); color: var(--on-wa); }
.btn.wa-go:hover { background: var(--wa-hover); }
.wa-line { position: relative; margin-top: 14px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.wa-line .wa-open { display: inline-flex; align-items: center; gap: 4px; color: var(--wa-text); font-weight: 600; }
.wa-line-card { position: absolute; top: calc(100% + 8px); z-index: 30; }
.wa-menu-icon { color: var(--wa); margin-inline-end: 6px; vertical-align: -2px; }

/* ---- user guide (DOC-02) */
.guide-top { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.guide-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); }
.guide-chapters h2 { margin-bottom: 6px; }
.guide-chapters button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 0;
  border-inline-start: 3px solid transparent; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; border-radius: 0 4px 4px 0; }
[dir='rtl'] .guide-chapters button { border-radius: 4px 0 0 4px; }
.guide-chapters button:hover { background: var(--row-hover); }
.guide-chapters button.cur { background: var(--primary-soft); border-inline-start-color: var(--brand); font-weight: 600; }
.guide-cn { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin-inline-end: 8px; border-radius: 6px;
  background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; }
.guide-f1 { font-size: 12.5px; margin: 10px 0 0; }
.guide-chapter + .guide-chapter { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; }
.guide-ch-title { font-size: 17px; display: flex; align-items: center; margin: 4px 0 6px; }
.guide-step { margin: 14px 0 0; }
.guide-step h4 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; font-size: 14.5px; }
.guide-sn { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; }
.guide-play { margin-inline-start: auto; font-weight: 400; font-size: 13px; }
.guide-step p { margin: 0 0 6px; }
.guide-step img { display: block; width: 100%; max-width: 980px; margin: 6px 0 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.guide-step img.guide-paper { max-width: 420px; background: #fff; }
.guide-tip { background: var(--surface-2); border-inline-start: 3px solid var(--brand); padding: 8px 12px; border-radius: 4px; color: var(--text-2); }
.guide-card { display: flex; align-items: center; gap: 12px; border-inline-start: 3px solid var(--brand); }
.watch-how { white-space: nowrap; font-size: 13.5px; }
@media (max-width: 1100px) { .guide-top { grid-template-columns: 1fr; } }

/* ---- professional printouts (UX-90, docPrint.tsx): invoice, credit/debit note, quotation. Always light, A4. */
.doc-print.dp { --dp-fs: 1; --dp-ink: #1c2430; --dp-muted: #5b6573; --dp-line: #d9dee5; --dp-soft: #f3f5f8; color: var(--dp-ink); font-size: calc(10.5px * var(--dp-fs)); line-height: 1.35; }
/* UX-128: Settings → Printing → Text size; every size on the page is a multiple of --dp-fs, the layout stays as it is. */
.doc-print.dp.dp-fs-small { --dp-fs: 0.9; }
.doc-print.dp.dp-fs-large { --dp-fs: 1.15; }
.doc-print.dp.dp-fs-xlarge { --dp-fs: 1.3; }
.doc-print.dp * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.dp > :not(.dp-watermark):not(.dp-foot) { position: relative; z-index: 1; }
/* Fixed: Chromium prints it on every page, centred, behind the content. */
.dp-watermark { position: fixed; top: 50%; left: 50%; width: 62%; max-width: 440px; max-height: 60%; object-fit: contain; transform: translate(-50%, -50%); opacity: 0.07; z-index: 0; pointer-events: none; }
.dp-part-photo { display: flex; align-items: center; gap: 6px; } /* PHO-03: the part's photo on a printed quotation */
.dp-part-photo > img, .dp-part-photo > span.photo-loading, .dp-part-photo > span.photo-missing { width: 40px; height: 40px; flex: none; object-fit: cover; border-radius: 3px; }
.dp-part-photo > span.photo-loading, .dp-part-photo > span.photo-missing { visibility: hidden; }
.dp-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; padding-bottom: 10px; border-bottom: 3px solid var(--dp-ink); }
.dp-co { min-width: 0; }
.dp-co-ar { text-align: right; }
.dp-name { font-size: calc(15px * var(--dp-fs)); font-weight: 800; letter-spacing: 0.2px; }
.dp-line { color: var(--dp-muted); font-size: calc(10px * var(--dp-fs)); }
.dp-logo img { display: block; max-height: 72px; max-width: 190px; object-fit: contain; }
.dp-title { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 10px 0 8px; padding: 7px 12px; background: var(--dp-ink); color: #fff; border-radius: 4px; font-size: calc(14px * var(--dp-fs)); font-weight: 700; }
.dp-title .dp-title-ar { text-align: right; }
.dp-title .dp-title-en { text-align: left; }
.dp-title .dp-no { font-size: calc(13px * var(--dp-fs)); padding: 1px 10px; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 3px; }
.dp .copy-mark { border-color: var(--dp-ink); font-size: calc(13px * var(--dp-fs)); }
.dp .bi { display: inline-flex; flex-direction: column; line-height: 1.1; }
/* UX-132: the Arabic line and the English line under it start at the same edge (they stretched before, so a short Arabic
   word sat at the right of a longer English one); right-aligned in number columns. */
.dp .bi { align-items: flex-start; }
.dp .num .bi { align-items: flex-end; }
.dp .bi-en { font-size: calc(8.5px * var(--dp-fs)); font-weight: 500; color: var(--dp-muted); }
.dp-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.dp-box { border: 1px solid var(--dp-line); border-radius: 4px; overflow: hidden; }
.dp-box h4 { margin: 0; padding: 4px 8px; background: var(--dp-soft); border-bottom: 1px solid var(--dp-line); font-size: calc(10.5px * var(--dp-fs)); }
.doc-print.dp .dp-box table { width: 100%; border-collapse: collapse; }
.doc-print.dp .dp-box th, .doc-print.dp .dp-box td { border: 0; background: transparent; padding: 3px 8px; vertical-align: top; text-align: start; }
/* UX-132: the label column as wide as its longest label, on one line ("الرقم الضريبي للعميل" wrapped at 38 %). */
.doc-print.dp .dp-box th { width: 1%; white-space: nowrap; padding-inline-end: 18px; font-weight: 600; color: var(--dp-muted); }
.doc-print.dp .dp-box td { font-weight: 600; }
.doc-print.dp table.dp-lines { width: 100%; border-collapse: collapse; }
.doc-print.dp .dp-lines th { background: var(--dp-ink); color: #fff; border: 0; padding: 5px 6px; font-weight: 600; text-align: start; vertical-align: bottom; }
.doc-print.dp .dp-lines th .bi-en { color: rgba(255, 255, 255, 0.72); }
.doc-print.dp .dp-lines td { border: 0; border-bottom: 1px solid var(--dp-line); padding: 4px 6px; vertical-align: top; }
.doc-print.dp .dp-lines tbody tr:nth-child(even) td { background: rgba(243, 245, 248, 0.7); }
.doc-print.dp .dp-lines .num { text-align: end; white-space: nowrap; }
.dp-lines tr { break-inside: avoid; }
.dp-sub { font-size: calc(9px * var(--dp-fs)); color: var(--dp-muted); }
.dp-totals { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 10px; break-inside: avoid; }
.dp-side { display: flex; gap: 12px; align-items: flex-start; }
.doc-print.dp table.dp-sum { width: calc(300px * var(--dp-fs)); border-collapse: collapse; border: 1px solid var(--dp-line); }
.doc-print.dp .dp-sum th, .doc-print.dp .dp-sum td { border: 0; border-bottom: 1px solid var(--dp-line); background: transparent; padding: 4px 8px; text-align: start; }
.doc-print.dp .dp-sum td { text-align: end; font-weight: 600; white-space: nowrap; }
.doc-print.dp .dp-sum tr.grand th, .doc-print.dp .dp-sum tr.grand td { background: var(--dp-ink); color: #fff; font-size: calc(12px * var(--dp-fs)); font-weight: 800; }
.doc-print.dp .dp-sum tr.grand .bi-en { color: rgba(255, 255, 255, 0.72); }
.dp-cur { font-size: calc(8.5px * var(--dp-fs)); font-weight: 500; opacity: 0.75; }
.dp-words { margin-top: 8px; padding: 6px 10px; border: 1px dashed var(--dp-line); border-radius: 4px; background: rgba(243, 245, 248, 0.6); font-weight: 600; break-inside: avoid; }
/* UX-128: Settings → Printing → Text size: the choice and a sample at that size. */
.fs-choice { align-items: center; flex-wrap: wrap; gap: 6px; }
.fs-sample { margin-inline-start: 10px; padding: 4px 10px; border: 1px dashed var(--border-strong); border-radius: 4px; background: #fff; color: #1c2430; }
/* UX-129: the shop's bank account, one line in the footer (wraps between items, never inside an IBAN). */
.dp-foot-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px 14px; color: var(--dp-ink); font-size: calc(9.5px * var(--dp-fs)); }
.dp-foot-bank-item { white-space: nowrap; }
.dp-foot-bank-label { color: var(--dp-muted); }
.dp-foot-bank bdi, .dp-foot-bank-item > span:last-child { font-weight: 700; }
.dp-mono { font-variant-numeric: tabular-nums; letter-spacing: 0.3px; white-space: nowrap; } /* an IBAN or account number on one line */
.dp-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 34px; break-inside: avoid; }
.dp-sig { min-width: 200px; text-align: center; }
.dp-sig-line { min-height: 16px; border-bottom: 1px solid #9aa3ae; margin-bottom: 4px; font-weight: 600; }
.doc-print.dp table.dp-page { width: 100%; border-collapse: collapse; }
.doc-print.dp table.dp-page > tbody > tr > td, .doc-print.dp table.dp-page > tfoot > tr > td { border: 0; padding: 0; background: transparent; }
.dp-foot-space { height: 29mm; }
/* Fixed: printed at the bottom of every page, inside the page margins. z-index above the watermark. */
.dp-foot { position: fixed; bottom: 0; left: 0; right: 0; height: 26mm; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding-top: 5px; border-top: 1.5px solid var(--dp-ink); text-align: center; color: var(--dp-muted); background: #fff; z-index: 1; }
.dp-foot-text { color: var(--dp-ink); font-size: calc(9.5px * var(--dp-fs)); }
.dp-foot-text div { text-align: center; }
.dp-thanks { font-size: calc(9px * var(--dp-fs)); letter-spacing: 0.2px; }
.dp-note { margin-top: 6px; }
/* The shop's own logo at the end of the menu bar (UX-90): on a light chip, any logo colour reads on the dark bar. */
.mb-logo { display: inline-flex; align-items: center; justify-content: center; height: 30px; max-width: 96px; padding: 2px 6px; background: var(--logo-chip); border-radius: 6px; }
.mb-logo img { max-height: 26px; max-width: 84px; object-fit: contain; display: block; }

/* UX-104: an on/off switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch.disabled { opacity: .6; cursor: default; }
/* The hidden box stays on the switch: inside the line table, inputs get the cell's full width, and an invisible
   box covering the cell turned the switch off when the cost box beside it was clicked. */
.switch input[type='checkbox'], table.grid .switch input[type='checkbox'] { position: absolute; inset-inline-start: 0; top: 0; opacity: 0; width: 1px !important; min-width: 0; height: 1px; margin: 0; padding: 0; pointer-events: none; }
.switch-track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--border-strong); transition: background .15s; }
.switch-track::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--switch-knob); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: inset-inline-start .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { inset-inline-start: 18px; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--link); outline-offset: 2px; }

/* The cashier's screen (UX-108): the find box beside the heading, the total large, the chosen row marked. */
.cashier-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cashier-head h2 { margin: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
.cashier-find { width: 360px; max-width: 100%; font-size: 16px; padding: 8px 12px; }
.cashier-table td { vertical-align: middle; }
.cashier-parts { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cashier-part bdi { font-weight: 600; }
.nowrap { white-space: nowrap; }
.cashier-table .cashier-total { font-size: 18px; font-weight: 700; }
.cashier-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 12px; text-align: center; }
.cashier-empty strong { font-size: 16px; }

/* A line bought from another shop (UX-110): a switch, then what was paid per piece. */
.outside-cell { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 250px; }
.outside-cost { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.outside-cost .input, table.grid .outside-cost input.input { width: 90px; height: 28px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface, #fff); color: var(--text, inherit); font-size: 14px; }
table.grid .outside-cost input.input:focus { border-color: var(--link); outline: none; }
.outside-ro { white-space: nowrap; }

/* One box for the customer (UX-112): a typed name says it is not from the list; the printed name is one click away. */
.picker-tag { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 12px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--muted); background: var(--surface-2); pointer-events: none; }
.picker.with-add .picker-tag { inset-inline-end: 48px; }
.picker-walkin { color: var(--link); }
.label-note { color: var(--muted); font-weight: 400; margin-inline-start: 4px; }

/* The Active switch at the top of a record (UX-113): in a dialog's title bar, or the page head. */
.modal-head-extra { margin-inline-start: auto; margin-inline-end: 12px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 500; }
.modal-head:has(.modal-head-extra) h2 { flex: 1; }
.active-switch .switch > span:last-child { font-weight: 600; color: var(--ok); }
.active-switch.off .switch > span:last-child { color: var(--danger); }

/* UX-115: a line's part name opens a quick look */
.part-peek { color: inherit; text-decoration-color: var(--border); text-align: start; }
.part-peek:hover { color: var(--link); }
/* The quick look with the part's tabs: nearly the whole window, its body scrolls. */
.modal.peek { width: min(1240px, 96vw); height: 88vh; max-height: 88vh; }
.modal.peek .modal-body { overflow: auto; }

/* UX-116: a document's cost and profit beside its totals, quieter than the totals themselves. */
.totals-profit { padding-inline-end: 16px; margin-inline-end: 4px; border-inline-end: 1px solid var(--border); color: var(--muted); }
.totals-profit strong { color: var(--text, inherit); }
.totals-profit strong.pos { color: var(--ok); }
.totals-profit strong.neg { color: var(--danger); }
/* UX-116: a quotation printed with cost and profit says, at the top, that it is not for the customer. */
.dp-internal { margin: 0 0 8px; padding: 6px 10px; border: 2px solid #b42318; border-radius: 4px; color: #b42318; font-weight: 700; text-align: center; font-size: calc(13px * var(--dp-fs, 1)); }

/* UX-120: paid partly by card, the rest in cash */
.pay-split { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.pay-cash-part { display: flex; flex-direction: column; align-items: end; gap: 2px; padding-bottom: 6px; }
.pay-cash-part span { font-size: 12px; color: var(--muted); }
.pay-cash-part strong { font-size: 22px; }
.pay-split-link { align-self: start; font-size: 14px; }


/* Owner dashboard (OBS-09): headline figures with a comparison, one list of what to act on, 30 days of sales. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dash .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.dash .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; text-align: start; font: inherit; color: inherit; }
.dash .kpi-link { cursor: pointer; }
.dash .kpi-link:hover { border-color: var(--border-strong); background: var(--row-hover); }
.dash .kpi .label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.dash .kpi .value { font-size: 28px; font-weight: 700; line-height: 1.15; }
.dash .kpi-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--muted); }
.dash .delta { font-size: 13px; font-weight: 600; }
.dash .delta.up { color: var(--ok); }
.dash .delta.down { color: var(--danger); }
.dash .delta .muted { font-weight: 400; }
.dash-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
.dash-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.dash-two > .card + .card, .dash-three > .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .dash-two { grid-template-columns: minmax(0, 1fr); } }
.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.attn li { display: flex; gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 6px; }
.attn li.bad { background: var(--danger-soft); }
.attn li:hover { background: var(--row-hover); }
.attn li.bad:hover { background: var(--danger-soft); }
.attn-icon { flex: none; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.attn li.bad .attn-icon { background: var(--danger); color: var(--surface); }
.attn li.warn .attn-icon { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.attn .chip.static { margin-inline-start: 4px; }
.all-clear { color: var(--ok); font-weight: 600; padding: 8px 0; }
.chart-card { position: relative; }
.chart-sub { font-size: 12.5px; margin: -6px 0 8px; }
.chart { position: relative; }
.chart svg { width: 100%; height: 160px; display: block; overflow: visible; }
.chart-bar { fill: var(--chart-bar); }
.chart-bar.today { fill: var(--text); }
.chart-bar.hover { fill: var(--text-2); }
.chart-hit { fill: transparent; cursor: default; outline: none; }
.chart-base { stroke: var(--border-strong); stroke-width: 1; }
.chart-avg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.chart-axis .today-label { color: var(--text); font-weight: 600; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; pointer-events: none; box-shadow: 0 6px 16px rgba(0,0,0,0.12); white-space: nowrap; z-index: 2; }
table.data.compact td { padding: 6px 8px; }
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.status-pill { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; color: inherit; }
button.status-pill { cursor: pointer; }
.status-pill .pill-icon { font-weight: 700; }
.status-pill.ok .pill-icon { color: var(--ok); }
.status-pill.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.status-pill.warn .pill-icon { color: var(--warn); }
.status-pill.bad { border-color: var(--danger-line); background: var(--danger-soft); }
.status-pill.bad .pill-icon { color: var(--danger); }

/* Parts from the parts catalogue (the parts hub), under a search that found none of the shop's own. */
.catalogue-head { border-top: 1px solid var(--border); }
.catalogue-add { margin-inline-start: auto; color: var(--link); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
/* INV-HUB-07: the machine pinned to a document, and machine rows in the part search */
.machine-chip { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 13px; max-width: 100%; }
.machine-chip-name { font-weight: 600; }
.machine-chip-clear { padding: 0 6px; }
.machine-serial-input { height: 24px; width: 150px; padding: 0 6px; font-size: 13px; }
.machine-item .grow { white-space: normal; }
.machine-note { font-size: 12.5px; padding-top: 6px; padding-bottom: 6px; }
.palette-machine { padding: 6px 16px 0; }
.palette-machine .machine-chip { margin-bottom: 0; }
.catalogue-block { margin-top: 12px; }
.catalogue-link { margin-inline-start: 8px; font-size: 12.5px; white-space: nowrap; }
.catalogue-links { display: inline-flex; gap: 8px; align-items: baseline; margin-inline-start: 8px; flex-wrap: wrap; }
.catalogue-links .catalogue-link { margin-inline-start: 0; }

/* The parts catalogue panel (INV-HUB-05): the full width under the menu bar, over the toolbar (product owner
   2026-10-27: "it should open full width..so everything is properly shown"; the toolbar "should also hide when
   equippart open"); the desktop app shows the catalogue page in its body. Below dialogs (z-index 50), which hide the
   page while they are open. */
.catalogue-panel { position: fixed; top: 44px; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; flex-direction: column; background: var(--surface); }
.catalogue-panel-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.catalogue-panel-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalogue-panel-body { flex: 1; min-height: 0; background: #fff; }
/* MP-17/MP-18: the EquipMart panel's own notes under its bar, and NexFix's cover while its page wakes up or cannot load. */
.catalogue-panel-note { margin: 0; border-radius: 0; border-left: 0; border-right: 0; padding: 6px 12px; font-size: 13px; }
.catalogue-panel-cover { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: var(--text); background: var(--surface); }
.catalogue-panel-cover p { margin: 0; font-size: 15px; max-width: 460px; }
.panel-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: panel-spin 0.9s linear infinite; }
@keyframes panel-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .panel-spinner { animation-duration: 3s; } }
.loc-tag.warn-tag { border-color: var(--warn, #d97706); color: var(--warn, #b45309); }

/* ---- a quotation or invoice full screen from its list (UX-127, docViewer.tsx): the printed page on an A4 sheet.
   Above the menu bar and the catalogue panel (45), below dialogs (50) — the print preview opens over it. */
.dv { position: fixed; inset: 0; z-index: 48; display: flex; flex-direction: column; background: var(--dv-backdrop); outline: none; }
.dv-bar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; flex-wrap: wrap; }
.dv-what { flex: 1; min-width: 200px; }
.dv-title { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.dv-meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-nav, .dv-zoom, .dv-actions { display: flex; align-items: center; gap: 6px; }
.dv-count { min-width: 64px; text-align: center; font-size: 13px; color: var(--text-2); }
.dv-pct { min-width: 58px; }
.dv-pct.on { border-color: var(--link); }
.dv-close { font-size: 15px; }
/* The eye at the end of a list row (UX-127). */
.dv-eye { display: inline-flex; align-items: center; justify-content: center; padding: 3px 8px; color: var(--text-2); }
.dv-eye:hover { color: var(--text); }
.dv-tools { display: flex; align-items: center; gap: 18px; padding: 6px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex: none; flex-wrap: wrap; font-size: 13px; }
.dv-scroll { flex: 1; min-height: 0; overflow: auto; padding: 24px 32px 40px; }
.dv-sheet { position: relative; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 12mm; box-sizing: border-box; background: #fff; color: #1c2430; color-scheme: light;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45); transition: opacity 0.12s; }
.dv-sheet.loading { opacity: 0.55; }
.dv-sheet .print-only { display: block; }
/* On paper these repeat on every page (fixed); on the sheet they sit on it: the logo in the middle, the footer at its foot. */
.dv-sheet .dp-watermark { position: absolute; }
.dv-sheet .dp-foot { position: absolute; left: 12mm; right: 12mm; bottom: 12mm; }
.dv-blank { padding: 60px 20px; text-align: center; color: #5b6573; }
.dv-blank strong { display: block; font-size: 16px; color: #1c2430; margin-bottom: 6px; }
.dv-note { max-width: 560px; margin: 40px auto; }
.dv-keys { flex: none; text-align: center; padding: 4px; font-size: 12px; background: var(--dv-keys-bg); color: var(--dv-keys-text); }
@media print {
  /* Printed from the viewer: the sheet only, as the document's own screen prints it. */
  html.dv-open body > :not(.dv) { display: none !important; }
  html.dv-open .dv { position: static; display: block; background: none; }
  html.dv-open .dv-scroll { overflow: visible; padding: 0; }
  html.dv-open .dv-sheet { width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none; zoom: 1 !important; opacity: 1; }
  html.dv-open .dv-sheet .dp-watermark { position: fixed; }
  html.dv-open .dv-sheet .dp-foot { position: fixed; left: 0; right: 0; bottom: 0; }
}

/* Custom fields (SAL-CF-01): a line field's cell takes input like the grid's own cells; the list's "More fields" panel. */
table.grid td.ro:has(> .cf-cell) { padding: 0; background: var(--surface); color: var(--text); }
.cf-cell { display: flex; align-items: center; height: 100%; min-width: 90px; }
.cf-cell .switch { padding: 0 7px; }
.cf-list { position: relative; }
.cf-list-panel { position: absolute; z-index: 20; inset-inline-end: 0; top: calc(100% + 4px); min-width: 460px; max-height: 60vh; overflow: auto; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12); }
.cf-list-panel table.data td { vertical-align: middle; }
.cf-list-panel .input, .cf-list-panel .select { width: 180px; }
.cf-defs td { vertical-align: middle; }
.cf-preview { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 12px; }
.cf-choice-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.stack > .card.cf-card { margin-top: 0; } /* in a page's stack the gap already parts it from the card above */

/* WEB-13: the opening screen (arriving from the NexFix account) — calm, centred, the shop's look; no form. */
.opening-screen { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); color: var(--text); }
.opening-box { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.opening-box h1 { margin: 6px 0 0; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.opening-box p { margin: 0; }
.opening-box .btn { min-width: 220px; }
.opening-error { color: var(--danger); line-height: 1.6; }
.opening-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: opening-spin 0.9s linear infinite; }
@keyframes opening-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .opening-spinner { animation: none; } }

/* WEB-13: the trial's quiet line under the menu (urgent in its last days: the warn alert instead). */
.trial-line { padding: 6px 16px; font-size: 13px; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border); }
.trial-line a { color: var(--link); font-weight: 600; }
.setup-list .why { display: block; font-size: 12px; color: var(--muted); text-decoration: none; }

/* Forms pass (MT-40 track B): collapsed "More details" sections (moreDetails.tsx), on the fields' start edge. */
.more-details { border-top: 1px solid var(--border); padding-top: 8px; }
.more-details-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0; border: 0; background: none; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; text-align: start; }
.more-details-caret { display: inline-block; width: 1em; color: var(--text-2); }
.more-details-hint { margin-inline-start: calc(1em + 8px); margin-top: -4px; }
.more-details-body { padding-top: 8px; }
.more-details-body[hidden] { display: none; }
.quick-fields.quick-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 860px; }
.more-details + .more-details-follow { margin-top: 8px; }
.card > .more-details { margin-top: 12px; }
.quick-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; max-width: 640px; }
@media (max-width: 640px) { .quick-fields, .quick-fields.quick-3 { grid-template-columns: 1fr; } }
