/*
  Direct Service Transportation — component styles (step 7), built only on tokens.css.
  Class names follow the approved board (docs/step6) so screens can be compared one to one. Logical properties throughout, so the
  same rules serve Arabic RTL (default) and English LTR; the few direction-dependent effects are flipped under [dir="ltr"].
*/
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); }
body {
  color: var(--text); font-family: var(--font-ar); font-size: var(--fs); line-height: var(--lh);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html[lang="en"] body { font-family: var(--font-en); }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: var(--fw-semibold); }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
/* Links inside running text are underlined, not told apart by colour alone (WCAG 1.4.1); menus, tabs and button links keep their own look. */
:is(p, li, dd, td, .help, .muted, .banner, .foot, .kv, .empty) a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -40px; z-index: var(--z-toast); background: var(--surface); padding: var(--sp-3) var(--sp-5); border: 1px solid var(--primary); border-radius: var(--r); }
.skip-link:focus { top: 8px; }

/* ---- numbers, codes, dates: one isolated left-to-right run (owner fix 1, DT-65) */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
bdi.num { display: inline; }
.muted { color: var(--muted); }
.kbd {
  font-family: var(--font-en); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r);
  padding: 0 4px; color: var(--muted); background: var(--surface); direction: ltr; unicode-bidi: isolate; white-space: nowrap;
}

/* ---- icons */
svg.ic { width: var(--ic); height: var(--ic); flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[dir="ltr"] svg.ic.flip { transform: scaleX(-1); }

/* ============================================================ shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; min-height: 0; }
.provider .side { background: var(--side-bg-provider); }
.side :focus-visible { outline-color: var(--side-strong); }
.side .brand { display: flex; align-items: center; gap: var(--sp-4); color: var(--side-strong); font-weight: var(--fw-semibold); padding: var(--sp-6) var(--sp-7); padding-inline-end: var(--sp-4); border-bottom: 1px solid var(--side-line); }
.side .brand .lbl { flex: 1; min-width: 0; }
.side .collapse { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none; border: 0; border-radius: var(--r); background: none; color: var(--side-group); cursor: pointer; }
.side .collapse:hover { background: var(--side-press); color: var(--side-strong); }
.side .brand img { filter: brightness(0) invert(1); width: 22px; height: auto; }
.side nav { overflow-y: auto; padding: var(--sp-3) var(--sp-4); flex: 1; scrollbar-width: thin; scrollbar-color: var(--side-scroll) transparent; }
.side .g, .side .it {
  display: flex; align-items: center; gap: var(--sp-4); width: 100%; border: 0; background: none; text-align: start; cursor: pointer;
  border-radius: var(--r); font-size: 13px; text-decoration: none;
}
.side .g { padding: var(--sp-3) var(--sp-4); color: var(--side-group); }
.side .g .ch { margin-inline-start: auto; --ic: 14px; opacity: .7; }
.side .g.open { color: var(--side-strong); }
.side .sec.has-cur > .g { color: var(--side-strong); }
/* Entries (DT-235): their own icon, one size for all, indented under the section; labelled parts of long sections (DT-238) */
.side .it { padding: 3px var(--sp-4); padding-inline-start: 20px; color: var(--side-text); }
.side .it svg.ic { --ic: 15px; opacity: .75; }
.side .it:hover svg.ic, .side .it.cur svg.ic { opacity: 1; }
.side .part { font-size: 11px; color: var(--side-foot); padding: var(--sp-4) var(--sp-4) var(--sp-1); padding-inline-start: 20px; }
.side .fly .ft { display: none; }
.side .g:hover, .side .it:hover { background: var(--side-hover); text-decoration: none; }
.side .g.cur, .side .it.cur { background: var(--side-current); color: var(--side-strong); box-shadow: inset -3px 0 0 var(--side-mark); }
[dir="ltr"] .side .g.cur, [dir="ltr"] .side .it.cur { box-shadow: inset 3px 0 0 var(--side-mark); }
.side .foot { border-top: 1px solid var(--side-line); padding: var(--sp-4) var(--sp-7); font-size: 12px; color: var(--side-foot); }
/* Collapsed side menu (DT-236): an icon rail; a section shows its name when pointed at or focused, and its entries on hover or with Enter.
   Tablets and desktops only — on phones the menu is a drawer and keeps its full width. */
@media (min-width: 761px) {
  .shell:has(> .side.mini) { grid-template-columns: var(--side-w-mini) minmax(0, 1fr); }
  .side.mini .brand { flex-direction: column; padding: var(--sp-6) 0; }
  .side.mini .lbl { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .side.mini nav { padding-inline: var(--sp-3); }
  .side.mini .g { justify-content: center; padding: var(--sp-4) 0; }
  .side.mini .g .ch, .side.mini .foot { display: none; }
  .side.mini .sec.has-cur > .g { background: var(--side-current); box-shadow: inset -3px 0 0 var(--side-mark); }
  [dir="ltr"] .side.mini .sec.has-cur > .g { box-shadow: inset 3px 0 0 var(--side-mark); }
  .side.mini .fly {
    position: fixed; z-index: 45; inset-inline-start: calc(var(--side-w-mini) - var(--sp-3) - 2px); min-width: 220px; max-width: 300px;
    max-height: calc(100vh - 16px); overflow-y: auto; padding: var(--sp-2); background: var(--side-bg); border: 1px solid var(--side-line);
    border-radius: var(--r); box-shadow: var(--shadow-dialog); scrollbar-width: thin; visibility: hidden; opacity: 0; transition: opacity .12s, visibility .12s;
  }
  .provider .side.mini .fly { background: var(--side-bg-provider); }
  .side.mini .sec:hover > .fly, .side.mini .sec:focus-within > .fly, .side.mini .sec.flown > .fly { visibility: visible; opacity: 1; }
  .side.mini .sec:focus-within:not(:hover):not(.flown) > .fly .pt { display: none; }
  .side.mini .sec.hush:not(.flown) > .fly { visibility: hidden; opacity: 0; transition: none; }   /* dismissed with Escape (DT-242) */
  .side.mini .fly .ft { display: block; color: var(--side-strong); font-size: 13px; font-weight: var(--fw-semibold); padding: var(--sp-3) var(--sp-4); }
  .side.mini .fly:not(.tip) .ft { border-bottom: 1px solid var(--side-line); margin-bottom: var(--sp-2); }
  .side.mini .fly.tip { min-width: 0; white-space: nowrap; padding: 0; }
  .side.mini .fly .it, .side.mini .fly .part { padding-inline-start: var(--sp-4); }
}
@media (min-width: 761px) and (prefers-reduced-motion: reduce) { .side.mini .fly { transition: none; } }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-7); flex: none; }
.cmdk {
  display: flex; align-items: center; gap: var(--sp-4); height: 32px; width: var(--cmdk-w); min-width: 0; margin-inline-start: auto; border: 1px solid var(--border-control);
  border-radius: var(--r); padding: 0 var(--sp-5); color: var(--muted); font-size: var(--fs-md); background: var(--surface-filter); cursor: text; text-align: start;
}
.cmdk .kbd { margin-inline-start: auto; flex: none; }
/* Session 13 (DT-973): a crowded top bar (several companies with a long name, the trial notice and "Choose a plan" at 1280 px) squeezes the
   search box down to its icon — its text and its key hint are then clipped inside the box, never drawn over the bell. */
.cmdk { overflow: hidden; }
.cmdk > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* one line; ellipsis when the bar is narrow */
.bell { position: relative; }
.bell .dot {
  position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--err-fill); color: var(--on-primary);
  font-size: 10px; font-family: var(--font-en); display: grid; place-items: center; padding: 0 3px;
}
.content { flex: 1; min-height: 0; overflow: auto; padding: var(--sp-6) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-5); position: relative; }
.content.fixed { overflow: hidden; }
.menu {
  position: absolute; z-index: var(--z-dropdown); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-dropdown); min-width: 220px; padding: var(--sp-2) 0; font-size: var(--fs-md); top: calc(100% + 4px); inset-inline-end: 0;
}
.menu [role="menuitem"], .menu [role="menuitemradio"] {
  display: flex; align-items: center; gap: var(--sp-4); width: 100%; padding: var(--sp-3) var(--sp-6); border: 0; background: none; text-align: start; cursor: pointer; color: var(--text);
}
.menu [role="menuitem"]:hover, .menu [role="menuitemradio"]:hover { background: var(--surface-filter); }
.menu [aria-checked="true"] { background: var(--tint); font-weight: var(--fw-semibold); }
.menu [role^="menuitem"]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-2) 0; }
.menu .mh { padding: var(--sp-2) var(--sp-6); font-size: var(--fs-sm); color: var(--muted); }
.anchor { position: relative; display: inline-flex; }

/* ============================================================ page header */
.ph { display: flex; align-items: flex-end; gap: var(--sp-5); flex: none; }
.ph .t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ph h1 { font-size: var(--fs-title); font-weight: var(--fw-semibold); display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.crumbs { font-size: var(--fs-sm); color: var(--muted); display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.crumbs ol { display: contents; list-style: none; }
.crumbs li + li::before { content: "›"; margin-inline-end: var(--sp-2); }
.ph .act { margin-inline-start: auto; display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: flex-end; }

/* ============================================================ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-3); height: var(--ctl); padding: 0 11px; border-radius: var(--r);
  border: 1px solid var(--border-control); background: var(--surface); color: var(--text); font-size: var(--fs-md); font-weight: var(--fw-medium);
  white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-filter); text-decoration: none; }
.btn.pri { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--on-primary); }
.btn.pri:hover { background: var(--primary-hover); }
.btn.pri .kbd { background: transparent; color: var(--on-primary); border-color: currentColor; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--tint); }
.btn.danger { border-color: var(--danger-line); color: var(--err); }
.btn.dangerpri { background: var(--err-fill); border-color: var(--err-fill); color: var(--on-primary); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 26px; padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.btn.icon-only { padding: 0 var(--sp-3); }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ boxes and layout */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); min-width: 0; }
/* A table card wraps its content in .box-x (DT-234): its own header row keeps the header style. */
.box > .bh, .box > .box-x > .bh { display: flex; align-items: center; gap: var(--sp-4); padding: 7px var(--sp-6); border-bottom: 1px solid var(--border); font-weight: var(--fw-semibold); }
.box > .bh h2 { font-size: inherit; font-weight: inherit; }
.box > .bh .a, .box > .box-x > .bh .a { margin-inline-start: auto; display: flex; gap: var(--sp-3); font-weight: var(--fw-regular); }
.pad { padding: var(--sp-6) var(--sp-7); }
.fill { flex: 1; min-height: 0; overflow: auto; }
/* DT-247: cards that flow down the page at their own height — dashboards and list-plus-panel pages. The page (.content) is the only
   scroller: no area of its own that scrolls, no height that cuts a card off (a .fill grid there got what was left under the figures). */
.flow { flex: none; min-height: auto; overflow: visible; }
.flow .fill { flex: none; }
/* DT-234: the body of a table card scrolls sideways inside the card; a list-plus-panel page (.cols.lp) stacks the panel under the lists when narrow. */
.box-x { overflow-x: auto; max-width: 100%; }
.row { display: flex; gap: var(--sp-5); min-height: 0; }
.cols { display: grid; gap: var(--sp-5); min-height: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-5); min-height: 0; }
/* A group of fields never shrinks below its content (inside a scrolling form it would be squeezed until its rows overlap, SCR-74). */
fieldset.stack, .stack > fieldset { flex-shrink: 0; }
/* A scrolling column (form side panels, owner feedback 13 Oct 2026, SCR-52): its rows keep their height and the column scrolls, instead of being squeezed until they overlap. */
.stack.scrolls { overflow: auto; }
.stack.scrolls > * { flex-shrink: 0; }
/* Owner review of 12 Nov 2026: a card of the page's own flow keeps its height. Squeezed to the height of the screen it let its last rows
   spill out below its border, cut off by the bottom edge (Transportation settings: "Finish data migration"). The page scrolls and its
   bottom spacing follows the card; only a .fill card (or a column that scrolls by itself) takes what is left of the screen.
   The layouts wrap the page in .page-body (display: contents — it keeps the page's state apart per address), so the page's cards are
   that element's children. */
:is(.content, .content > .page-body) > .box:not(.fill):not(.scrolls), :is(.content, .content > .page-body) > .stack > .box:not(.fill):not(.scrolls) { flex-shrink: 0; }

/* ============================================================ badges / status tags (icon + text, never colour alone — UX-05) */
.badge { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); padding: 1px 7px; border-radius: var(--r); white-space: nowrap; line-height: 1.6; }
.badge svg.ic { --ic: 13px; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-info { background: var(--info-bg); color: var(--info); }
/* Owner decision on DT-641: the tenant's plan trial, once, in the top bar */
.top .plan-trial { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 4px 10px; border-radius: 999px; background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); font-size: 12px; white-space: nowrap; text-decoration: none; flex: none; }
a.plan-trial:hover { text-decoration: underline; }
.top .plan-choose { flex: none; white-space: nowrap; }   /* DT-649 owner decision: the Owner's "Choose a plan" next to the trial notice */
.b-mute { background: var(--surface-mute); color: var(--muted); }
.b-pri { background: var(--tint); color: var(--on-tint); }
.tags { display: inline-flex; gap: var(--sp-2); flex-wrap: nowrap; }

/* ============================================================ saved views (from C) and tabs */
.views { display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); flex: none; flex-wrap: wrap; }
.views [role="tab"], .views .add {
  padding: var(--sp-3) var(--sp-6); font-size: 13px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; cursor: pointer; background: none;
}
.views [aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: var(--fw-semibold); }
.views .add { color: var(--primary); display: inline-flex; gap: var(--sp-2); align-items: center; }
.views .tools { margin-inline-start: auto; display: flex; gap: var(--sp-3); align-items: center; padding-bottom: 5px; }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); padding: 0 var(--sp-4); flex: none; flex-wrap: wrap; }
.tabs [role="tab"] {
  padding: 7px var(--sp-5); color: var(--muted); font-size: var(--fs-md); border: 0; background: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; cursor: pointer;
}
.tabs [aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary); font-weight: var(--fw-semibold); }

/* ============================================================ data grid */
.gridwrap { display: flex; flex-direction: column; overflow: hidden; }
.gridwrap > .fill:focus-visible { outline-offset: -2px; }
table.grid { border-collapse: collapse; width: 100%; background: var(--surface); }
table.grid caption { text-align: start; }
table.grid th {
  position: sticky; top: 0; z-index: var(--z-sticky); background: var(--surface-head); color: var(--muted); font-weight: var(--fw-medium);
  font-size: var(--fs-sm); text-align: start; padding: 0 9px; height: var(--row); border-bottom: 1px solid var(--border); white-space: nowrap;
}
/* Owner decision of 12 Nov 2026 (the font): the Arabic face is a little wider than the former one, and Latin words inside Arabic text are
   Inter now — the trips list grew about 25 px and its last column was cut at 1366. Arabic tables keep 7 px beside each cell instead of 9. */
html[lang="ar"] table.grid th, html[lang="ar"] table.grid td { padding-inline: 7px; }
table.grid th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: var(--sp-2); align-items: center; }
table.grid th button.sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
table.grid th .s { --ic: 12px; color: var(--primary); }
table.grid td { padding: 0 9px; height: var(--row); border-bottom: 1px solid var(--border); white-space: nowrap; font-size: var(--fs-md); }
table.grid td.n, table.grid th.n { text-align: end; }
table.grid td.wrap { white-space: normal; }
table.grid td.clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
table.grid tbody tr.click { cursor: pointer; }
table.grid tbody tr:hover td { background: var(--surface-filter); }
table.grid tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
table.grid tr.sel td { background: var(--tint); }
table.grid tr.live td { background: var(--live-row); transition: background var(--dur-live) var(--ease); }
table.grid tr.void td { color: var(--muted); }
table.grid tr.grp td { background: var(--surface-group); font-weight: var(--fw-semibold); }
/* Journal entry form and view (DT-255): the automatic tax lines, read-only, under the entered lines. */
table.je-lines tr.auto td, table.grid tr.auto td { background: var(--surface-group); color: var(--muted); }
table.je-lines tr.auto td .num, table.grid tr.auto td .num { color: var(--text); }
table.je-lines td { vertical-align: middle; }
/* RPT-23 (DT-262): what each figure means. */
.rec-help { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-5); margin: 0; font-size: var(--fs-sm); }
.rec-help dt { font-weight: var(--fw-semibold); }
.rec-help dd { margin: 0; color: var(--muted); }
/* Budget grid (DT-265): every account at once; header, first column and totals stay in view; it scrolls inside its card. */
.bud-tools { flex: none; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); align-items: flex-end; }
/* DT-268: the filters line up at the top whatever help text one of them shows under it (it no longer pushes its field up). */
.bud-tools.bud-filters { align-items: flex-start; }
.bud-count { margin-inline-start: auto; font-size: var(--fs-sm); align-self: center; }
.bud-filters .bud-count { align-self: flex-start; margin-top: 30px; }
.bud-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 var(--sp-1); }
/* The P&L is as tall as its rows up to most of the window, also below filters (the page scrolls to it); it scrolls inside with its
   header, first column and totals in view. */
.pl-box { display: flex; flex-direction: column; flex: 0 0 auto; max-height: max(360px, calc(100vh - 210px)); overflow: hidden; }
/* DT-268: the budget grid takes the height left under the cards above it (they keep their full height: no strip that scrolls, no gap),
   at least 360px — then the page (the only page scrollbar) scrolls to it; the grid itself scrolls inside with header, first column and
   totals in view, and an empty filter result shows its message in the same place. */
.bud-box { display: flex; flex-direction: column; flex: 1 0 0; min-height: 360px; overflow: hidden; }
.bud-scroll, .pl-scroll { overflow: auto; flex: 1 1 auto; min-height: 0; }
table.bud-grid, table.pl-grid { width: max-content; min-width: 100%; }
table.bud-grid tbody th, table.bud-grid tfoot th, table.pl-grid tbody th, table.pl-grid tfoot th {
  top: auto; color: var(--text); font-size: var(--fs-md); font-weight: var(--fw-regular); background: var(--surface);
}
table.bud-grid .bud-first, table.pl-grid .pl-first { position: sticky; inset-inline-start: 0; z-index: 2; border-inline-end: 1px solid var(--border); text-align: start; }
table.bud-grid .bud-first { min-width: 280px; max-width: 340px; }
table.bud-grid thead th.bud-first, table.pl-grid thead th.pl-first { z-index: 3; background: var(--surface-head); color: var(--muted); font-size: var(--fs-sm); }
table.bud-grid tr.grp th, table.pl-grid tr.grp th { background: var(--surface-group); font-weight: var(--fw-semibold); }
table.bud-grid tr.sel th { background: var(--tint); }
/* Three sticky total rows of exactly 34px (no borders of their own, so nothing scrolls through between them). */
table.bud-grid tfoot tr.bud-foot > * { position: sticky; bottom: 0; height: 34px; border-top: 0; border-bottom: 0; background: var(--surface-foot); font-weight: var(--fw-semibold); }
table.bud-grid tfoot tr.bud-foot.f2 > * { box-shadow: inset 0 1px 0 var(--line-strong); }
table.bud-grid tfoot tr.bud-foot.f1 > * { bottom: 34px; }
table.bud-grid tfoot tr.bud-foot.f2 > * { bottom: 68px; }
table.bud-grid tfoot tr.bud-foot > th { z-index: 3; }
.bud-acc { display: inline-flex; align-items: center; gap: 6px; max-width: 330px; }
.bud-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.bud-grid td.bud-c { padding: 2px 3px; min-width: 104px; }
.bud-in { height: 30px; text-align: end; }
.bud-in[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
table.bud-grid td.bud-tot { min-width: 120px; font-weight: var(--fw-semibold); }
/* Profit and loss (DT-266): sections, group totals, gross and net profit; amounts open the account statement. */
table.pl-grid .pl-first { min-width: 300px; }
table.pl-grid td.n { min-width: 112px; }
table.pl-grid tr.pl-sec th { background: var(--surface-head); color: var(--primary); font-weight: var(--fw-semibold); font-size: var(--fs-md); }
table.pl-grid tr.pl-gtot > *, table.pl-grid tr.pl-stot > * { font-weight: var(--fw-semibold); border-top: 1px solid var(--line-strong); }
table.pl-grid tr.pl-stot > * { background: var(--surface-foot); }
table.pl-grid tr.pl-key > * { font-weight: var(--fw-bold); background: var(--tint); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
table.pl-grid tfoot tr.pl-key > * { position: sticky; bottom: 0; }
table.pl-grid tfoot tr.pl-key > th { z-index: 3; }
table.pl-grid td.pl-tot { font-weight: var(--fw-semibold); }
.pl-amt { all: unset; cursor: pointer; border-radius: var(--r); padding: 2px 4px; margin-inline-end: -4px; color: var(--primary); }
.pl-amt:hover { text-decoration: underline; background: var(--surface-filter); }
.pl-amt:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Trial balance tree (revision 6): indented names with an expand / collapse button on parent rows. */
.tb-name { display: inline-flex; align-items: center; gap: 4px; }
.tb-toggle { all: unset; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none; border-radius: var(--r); cursor: pointer; color: var(--muted); }
button.tb-toggle:hover { background: var(--surface-filter); color: var(--text); }
button.tb-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Account statement of several accounts (revision 6): a heading per account, chosen-account chips, the grand total. */
.stmt-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stmt-title { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.stmt-chip { display: inline-flex; align-items: center; gap: 2px; padding-inline-start: var(--sp-3); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-sm); }
.stmt-grand { display: flex; flex-wrap: wrap; gap: var(--sp-6); align-items: baseline; margin-top: var(--sp-4); flex: none; }
table.grid tfoot td { font-weight: var(--fw-semibold); background: var(--surface-foot); border-top: 1px solid var(--line-strong); position: sticky; bottom: 0; }
table.grid tr.flt td { background: var(--surface-filter); height: 32px; padding: 0 var(--sp-2); position: sticky; top: var(--row); z-index: var(--z-sticky); }
table.grid tr.flt .input { height: 24px; font-size: 12px; padding: 0 var(--sp-3); width: 100%; }
table.grid input[type="checkbox"] { margin: 0; accent-color: var(--primary); }
.tree td.lvl1 { padding-inline-start: 24px; } .tree td.lvl2 { padding-inline-start: 44px; } .tree td.lvl3 { padding-inline-start: 64px; } .tree td.lvl4 { padding-inline-start: 84px; }
.tree .tw { --ic: 13px; color: var(--muted); vertical-align: middle; }
.tbl-foot { display: flex; align-items: center; gap: var(--sp-5); padding: var(--sp-3) var(--sp-5); font-size: var(--fs-sm); color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); flex: none; flex-wrap: wrap; }
.tbl-foot .pg { margin-inline-start: auto; display: flex; gap: var(--sp-2); align-items: center; }
.tbl-foot select { height: 24px; font-size: 12px; border: 1px solid var(--border-input); border-radius: var(--r); background: var(--surface); }

/* ============================================================ forms */
.fg { display: grid; gap: var(--sp-5) var(--sp-7); }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label, .field > .lbl { font-size: var(--fs-sm); color: var(--muted); font-weight: var(--fw-medium); }
.field .req { color: var(--err); font-weight: var(--fw-semibold); }
.input {
  height: var(--ctl); border: 1px solid var(--border-input); border-radius: var(--r); background: var(--surface); padding: 0 9px;
  font-size: var(--fs-md); min-width: 0; width: 100%; color: var(--text);
}
.input::placeholder { color: var(--placeholder); }
/* transparent outline stays visible in Windows high-contrast (forced colours), where box-shadow is removed */
.input:focus, .input:focus-within, .input.focus { outline: 2px solid transparent; outline-offset: 0; border-color: var(--primary); box-shadow: 0 0 0 2px var(--focus-ring); }
.input.num, input.input[inputmode="decimal"], input.input[inputmode="numeric"] { text-align: end; font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; }
[dir="rtl"] input.input.num, [dir="rtl"] input.input[inputmode="decimal"], [dir="rtl"] input.input[inputmode="numeric"] { text-align: left; }
.input.bad, .input[aria-invalid="true"] { border-color: var(--err); background: var(--err-input); }
.input[readonly], .input.ro { background: var(--surface-sunk); color: var(--muted); }
.input[disabled] { background: var(--surface-sunk); color: var(--muted); cursor: not-allowed; }
textarea.input { height: auto; min-height: 56px; padding-top: var(--sp-3); resize: vertical; line-height: var(--lh); }
select.input { padding-inline-end: 4px; }
.adorn { position: relative; display: flex; align-items: center; }
.adorn .input { padding-inline-end: 28px; }
.adorn .end { position: absolute; inset-inline-end: 8px; color: var(--muted); pointer-events: none; display: inline-flex; }
.adorn .start { position: absolute; inset-inline-start: 8px; color: var(--muted); pointer-events: none; display: inline-flex; }
.adorn .start ~ .input { padding-inline-start: 30px; }
/* units (طن, JOD) sit at the inline start; numbers are aligned to the inline end of the reading direction's numbers (left in RTL) */
.adorn .unit { position: absolute; inset-inline-start: 9px; color: var(--muted); font-size: var(--fs-sm); pointer-events: none; }
/* number inputs are always direction:ltr, so their padding is physical: room for the unit on the right in RTL, on the left in LTR */
[dir="rtl"] .adorn.has-unit .input { padding-right: 44px; padding-left: 9px; }
[dir="ltr"] .adorn.has-unit .input { padding-left: 44px; padding-right: 9px; }
[dir="rtl"] .adorn.has-pick .input { padding-right: 32px; }
[dir="ltr"] .adorn.has-pick .input { padding-left: 32px; }
.adorn .pick { position: absolute; inset-inline-start: 3px; height: calc(var(--ctl) - 8px); width: 26px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: var(--r); }
.adorn .pick:hover { background: var(--tint); color: var(--primary); }
.adorn .native { position: absolute; inset-inline-end: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.help { font-size: 12px; color: var(--muted); }
.help.err { color: var(--err); display: flex; gap: var(--sp-2); align-items: center; }
.help.err svg.ic { --ic: 13px; }
/* DT-208: password rules under a password field, ticked while typing. */
.pwrules { margin-top: calc(var(--sp-2) * -1); }
.pwrules ul { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px var(--sp-4); font-size: 12px; color: var(--muted); }
.pwrules li { display: flex; align-items: center; gap: 4px; }
.pwrules li svg.ic { --ic: 12px; opacity: .3; }
.pwrules li.met { color: var(--ok); }
.pwrules li.met svg.ic { opacity: 1; }
.src { font-size: var(--fs-xs); color: var(--primary); display: inline-flex; gap: var(--sp-2); align-items: center; }
.src svg.ic { --ic: 12px; }
.chk { display: inline-flex; align-items: center; gap: var(--sp-4); font-size: var(--fs-md); cursor: pointer; }
.chk input { accent-color: var(--primary); margin: 0; width: 15px; height: 15px; }
table.grid tr.flt .input { border-color: var(--border-control); }
.switch { display: flex; gap: var(--sp-5); align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--border); }
.switch:last-child { border-bottom: 0; }
.toggle { width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--border-input); position: relative; flex: none; border: 0; padding: 0; cursor: pointer; }
.toggle::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--on-primary); transition: inset-inline-start var(--dur-fast) var(--ease); }
.toggle[aria-checked="true"] { background: var(--primary-fill); }
.toggle[aria-checked="true"]::after { inset-inline-start: 16px; }
.toggle[disabled] { opacity: .5; cursor: not-allowed; }
.errsum { border: 1px solid var(--err-line); background: var(--err-bg); color: var(--err); border-radius: var(--r); padding: var(--sp-4) var(--sp-6); font-size: var(--fs-md); flex: none; }
.errsum ul { margin: var(--sp-2) 0 0; padding-inline-start: 18px; }
.errsum a { color: var(--err); text-decoration: underline; }
.ln { display: flex; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-2) 0; font-size: var(--fs-md); }
.ln.tot { border-top: 1px solid var(--border); margin-top: var(--sp-2); padding-top: 7px; font-weight: var(--fw-semibold); }
.ln.big { font-size: var(--fs-lg); }
.formbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: flex-end; flex: none; min-width: 0; }
/* DT-232: a bar of secondary actions starts at the start edge; every bar wraps instead of spilling out of its card. */
.formbar.start { justify-content: flex-start; }
.formbar .btn { max-width: 100%; }

/* ---- combo box (searchable selection with full names — owner fix 4) */
.combo { position: relative; }
.combo .input { padding-inline-end: 28px; text-overflow: ellipsis; }
.combo.open .input, .combo .input:focus { position: relative; z-index: var(--z-input-expanded); }
.combo.wide .input:focus { width: max-content; min-width: 100%; max-width: 340px; }
.ddlist {
  position: absolute; z-index: var(--z-dropdown); top: calc(100% + 2px); inset-inline-start: 0; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow-dropdown); min-width: max(100%, 300px); max-height: 280px; overflow-y: auto; font-size: var(--fs-md);
  margin: 0; padding: 0; list-style: none;
}
.ddlist [role="option"] { display: flex; justify-content: space-between; gap: var(--sp-7); padding: var(--sp-3) var(--sp-5); white-space: nowrap; cursor: pointer; }
.ddlist [role="option"][aria-selected="true"], .ddlist [role="option"].on { background: var(--tint); }
.ddlist small { color: var(--muted); font-size: 12px; }
.ddlist .none { padding: var(--sp-3) var(--sp-5); color: var(--muted); }

/* ============================================================ banners, toasts, dialogs, panels */
.banner { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-6); font-size: var(--fs-md); border-radius: var(--r); flex: none; }
/* The message takes the banner's whole width and wraps inside it; the icon stays at its first line (owner feedback 13 Oct 2026). */
.banner > .ic { flex: none; align-self: flex-start; margin-block-start: 3px; }
.banner > .t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.banner .a { margin-inline-start: auto; display: flex; gap: var(--sp-3); flex: none; }
/* An earlier result kept on screen after a refused run: dimmed and not interactive, under a "not up to date" banner. */
.stale { opacity: .4; filter: grayscale(1); }
.banner ul.refunds { margin: 4px 0 0; padding-inline-start: 18px; }
/* Field order arrows (SCR-75, DT-186): a narrow column of two icon buttons. */
th.ord, td.ord { width: 72px; white-space: nowrap; text-align: center; }
.ord-btns { display: inline-flex; gap: 2px; }
.banner ul.refunds li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
details.refunded > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); }
details.refunded ul.refunds { margin: 4px 0 0; padding-inline-start: 18px; font-size: var(--fs-sm); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.banner.err { background: var(--err-bg); color: var(--err); border: 1px solid var(--err-line); }
.banner.info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); }
.banner.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.banner.lock { background: var(--surface-mute); color: var(--text); border: 1px solid var(--line-strong); }
.toasts { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--sp-3); align-items: center; }
[dir="ltr"] .toasts { transform: translateX(-50%); }
.toast { background: var(--toast-bg); color: var(--toast-text); border-radius: var(--r-lg); padding: 9px var(--sp-7); display: flex; gap: var(--sp-5); align-items: center; font-size: var(--fs-md); box-shadow: var(--shadow-toast); }
.toast.err { background: var(--err-fill); }
.toast a, .toast button.link { color: var(--toast-link); text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 0; }
.toast .x { background: none; border: 0; color: var(--toast-text); cursor: pointer; opacity: .8; display: inline-flex; padding: 0; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-scrim); display: grid; place-items: center; }
.dialog { background: var(--surface); border-radius: var(--r-lg); width: var(--dialog-w); max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); box-shadow: var(--shadow-dialog); display: flex; flex-direction: column; }
.dialog.wide { width: 720px; }
.dialog .dh { padding: var(--sp-6) var(--sp-8); border-bottom: 1px solid var(--border); font-weight: var(--fw-semibold); font-size: var(--fs-lg); display: flex; gap: var(--sp-4); align-items: center; }
.dialog .dh h2 { font-size: inherit; }
.dialog .dh .x { margin-inline-start: auto; }
.dialog .db { padding: var(--sp-7) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-5); font-size: var(--fs-md); overflow: auto; }
/* The body scrolls; its blocks keep their height (a .stack child has min-height 0 and would otherwise be squeezed until its rows overlap). */
.dialog .db > * { flex-shrink: 0; }
/* Role editor permissions (SCR-76): groups of rows — checkbox, description, key — scrolling inside the dialog. */
.perm-list { max-height: min(52vh, 460px); overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r); padding: 0 var(--sp-6); }
.perm-list:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus-ring); }
.perm-group { border: 0; margin: 0; padding: var(--sp-5) 0 var(--sp-3); min-width: 0; }
.perm-group + .perm-group { border-top: 1px solid var(--border); }
/* Revision 8 §5: the role editor by system; each system's name heads its groups. */
.perm-system + .perm-system { border-top: 2px solid var(--border); }
.perm-system-title { margin: 0; padding: var(--sp-5) 0 0; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--muted); }
.perm-group > legend { float: inline-start; width: 100%; padding: 0 0 var(--sp-2); font-weight: var(--fw-semibold); font-size: var(--fs-md); color: var(--text); }
.perm-row { clear: both; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--sp-4); align-items: start; padding: var(--sp-3) 0; cursor: pointer; line-height: var(--lh); }
.perm-row input { margin: 3px 0 0; accent-color: var(--primary); }
.perm-row:has(input:disabled) { cursor: default; }
.perm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.perm-key { align-self: flex-start; font-size: var(--fs-xs); color: var(--muted); }
.dialog .df { padding: var(--sp-5) var(--sp-8); border-top: 1px solid var(--border); display: flex; gap: var(--sp-4); justify-content: flex-end; }
.panel-side {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: var(--panel-w); max-width: 100vw; background: var(--surface); border-inline-start: 1px solid var(--line-strong);
  box-shadow: var(--shadow-panel); z-index: var(--z-panel); display: flex; flex-direction: column;
}
[dir="ltr"] .panel-side { box-shadow: var(--shadow-panel-ltr); }
.panel-side .bh { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5) var(--sp-7); border-bottom: 1px solid var(--border); font-weight: var(--fw-semibold); }
.panel-side .bh .x { margin-inline-start: auto; }
.panel-side .pb { flex: 1; overflow: auto; padding: var(--sp-5) var(--sp-7); }

/* ============================================================ figures, key-values, history */
.figs { display: grid; }
.figs > div { padding: var(--sp-4) var(--sp-6); border-inline-start: 1px solid var(--border); }
.figs > div:first-child { border-inline-start: 0; }
.figs .k { display: block; font-size: 12px; color: var(--muted); }
.figs .v { font-size: var(--fs-fig); font-weight: var(--fw-semibold); display: block; }
.figs small { display: block; font-size: var(--fs-xs); color: var(--muted); }
.kv { display: grid; gap: var(--sp-4) 18px; margin: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; }
.hist { margin: 0; padding: 0; list-style: none; }
.hist > li { display: grid; grid-template-columns: auto 1fr; gap: 1px var(--sp-5); padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.hist > li::before { content: ""; grid-row: span 2; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; }
.hist > li.v::before { background: var(--err); }
.hist .w { color: var(--muted); font-size: var(--fs-sm); }
/* Notifications panel (DT-189): one block per notification across the panel's width — title, message, date; long codes wrap, never scroll sideways. */
.notes-bar { display: flex; justify-content: flex-end; margin-bottom: var(--sp-3); }
.notes { margin: 0; padding: 0; list-style: none; min-width: 0; }
.notes > .note { position: relative; padding: var(--sp-4) 0; padding-inline-start: var(--sp-6); border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
.notes > .note::before { content: ""; position: absolute; inset-inline-start: 2px; top: calc(var(--sp-4) + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.notes > .note.unread::before { background: var(--primary); }
.notes > .note.v.unread::before { background: var(--err); }
.note-open { display: block; width: 100%; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; white-space: normal; }
.note-open:hover .note-t { text-decoration: underline; }
.note-open:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--r); }
.note-t { display: block; font-size: 13px; font-weight: var(--fw-medium); }
.note.unread .note-t { font-weight: var(--fw-bold); }
.note-m { display: block; margin-top: 2px; font-size: 13px; color: var(--text); }
.note-w { display: block; margin-top: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }
.note-dt { margin-top: var(--sp-2); padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.note-dt:hover { text-decoration: underline; }
.note-x { margin-top: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); background: var(--surface-sunk); font-family: var(--font-en); font-size: var(--fs-sm); white-space: pre-wrap; text-align: left; unicode-bidi: isolate; }
.note-p { margin-top: var(--sp-2); color: var(--err); font-size: var(--fs-sm); }
.chg { font-family: var(--font-en); font-size: var(--fs-sm); direction: ltr; unicode-bidi: isolate; }
/* Readable audit event (DT-188): sentence, reason, "label: old ← new" in the page's direction, journal lines. */
.ev { min-width: 0; }
.ev-t { line-height: 1.55; overflow-wrap: anywhere; }
.ev-t a { font-weight: var(--fw-semibold); }
.ev-r { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; overflow-wrap: anywhere; }
.ev-c { margin: 3px 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.ev-c li { padding: 1px 0; overflow-wrap: anywhere; }
.ev-c .lbl { color: var(--muted); }
.ev-c .arr { color: var(--muted); white-space: pre; }
.ev-lines { margin-top: 6px; border-collapse: collapse; font-size: var(--fs-sm); max-width: 100%; }
.ev-lines th { font-weight: var(--fw-semibold); color: var(--muted); }
.ev-lines th, .ev-lines td { padding: 2px var(--sp-5); border-bottom: 1px solid var(--border); text-align: start; }
.ev-lines .n { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tech { font-family: var(--font-en); font-size: var(--fs-xs); direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; color: var(--muted); }

/* ============================================================ states */
.sk { background: linear-gradient(90deg, var(--skeleton-a) 0, var(--skeleton-b) 40%, var(--skeleton-a) 80%); background-size: 300% 100%; animation: sk var(--dur-skeleton) linear infinite; border-radius: var(--r); }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skrow { display: grid; gap: var(--sp-7); padding: 9px var(--sp-6); border-bottom: 1px solid var(--border); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); text-align: center; padding: 40px var(--sp-10); flex: 1; }
.empty .ei { width: 52px; height: 52px; border-radius: 50%; background: var(--tint); color: var(--primary); display: grid; place-items: center; }
.empty .ei svg.ic { --ic: 24px; }
.empty h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.empty p { color: var(--muted); max-width: 52ch; }
.empty .acts { display: flex; gap: var(--sp-4); margin-top: var(--sp-3); }
.errstate .ei { background: var(--err-bg); color: var(--err); }

/* ============================================================ misc */
.bar { height: 8px; background: var(--surface-mute); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-3); height: 26px; padding: 0 var(--sp-5); border: 1px solid var(--border-control); border-radius: var(--r); font-size: var(--fs-sm); background: var(--surface); cursor: pointer; }
.chip[aria-pressed="true"], .chip[aria-current="page"], .chip.on { background: var(--tint); border-color: var(--primary); color: var(--on-tint); font-weight: var(--fw-semibold); }
.steps { margin: 0; padding: 0; list-style: none; }
.step { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--sp-5); align-items: center; padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border); }
.step .si { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-mute); color: var(--muted); }
.step.done .si { background: var(--ok-bg); color: var(--ok); }
.step.cur .si { background: var(--tint); color: var(--primary); }
.stamp { position: absolute; top: 120px; inset-inline-start: 180px; transform: rotate(-18deg); font-family: var(--font-en); font-weight: var(--fw-bold); font-size: 72px; letter-spacing: .08em; color: var(--stamp); border: 6px solid var(--stamp); padding: 0 18px; pointer-events: none; }
.lockbar { display: flex; align-items: center; gap: var(--sp-4); }

/* ---- account pages (sign-in, sign-up …) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth .brandside { background: var(--brand-panel); color: var(--brand-panel-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .brandside img { filter: brightness(0) invert(1); width: 44px; }
.auth .formside { display: grid; place-items: center; padding: 32px; }
/* Trips quick entry (SCR-10): one row on wide screens, two rows when the window is narrower, never squeezed pick lists.
   Children in order: receipt, date, driver, customer, loading, unloading, material, loaded, unloaded, price, rate, save. */
.qe-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; padding: 8px 10px; background: var(--surface-foot); border-bottom: 1px solid var(--border); }
.qe-row > * { flex: 1 1 150px; min-width: 0; }
.qe-row > :nth-child(1) { flex: 0 0 124px; }
.qe-row > :nth-child(2) { flex: 0 0 148px; }
.qe-row > :nth-child(3) { flex: 1 1 200px; }
.qe-row > :nth-child(n+8) { flex: 0 0 100px; }
.qe-row > :last-child { flex: 0 0 auto; }
.qe-row .field > label, .qe-row .field > .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Help pages (D-18): a readable column of text. */
.helpdoc, .hd-index, .hd-lead { max-width: 760px; line-height: var(--lh); }
.helpdoc { display: flex; flex-direction: column; gap: var(--sp-6); font-size: var(--fs-md); }
.helpdoc p { margin: 0; }
.helpdoc h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin: 0 0 var(--sp-3); }
.helpdoc ol, .helpdoc ul { margin: 0; padding-inline-start: 1.5em; display: flex; flex-direction: column; gap: var(--sp-3); }
.hd-links { list-style: none; padding: 0 !important; flex-direction: row !important; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6) !important; }
.hd-ref { font-size: var(--fs-sm); }
.hd-index { margin: 0; padding-inline-start: 1.5em; display: flex; flex-direction: column; gap: var(--sp-5); font-size: var(--fs-md); }
.hd-index li > a { font-weight: var(--fw-semibold); }
.hd-index li > span { display: block; }
.auth .card { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: var(--sp-7); }
/* Sign-up product choice (Stage 5 session 10, O-5): one card per product, the whole card is the radio's label. */
.choice-cards { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.choice-cards > legend { padding: 0; margin-bottom: var(--sp-3); font-size: var(--fs-sm); color: var(--muted); }
.choice-card { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; min-width: 0; }
.choice-card:hover { border-color: var(--line-strong); }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--tint); box-shadow: inset 0 0 0 1px var(--primary); }
.choice-card:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--focus-ring); }
.choice-card input { accent-color: var(--primary); margin: 3px 0 0; width: 15px; height: 15px; flex-shrink: 0; }
/* A Coming soon system (task of 17 Nov 2026): greyed (the read-only surface), dashed, not a control. */
.choice-card.is-soon { cursor: default; background: var(--surface-sunk); border-style: dashed; }
.choice-card.is-soon:hover { border-color: var(--border); }
.choice-card.is-soon .cc-title { color: var(--muted); }
.cc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-title { font-weight: var(--fw-semibold); font-size: var(--fs-md); overflow-wrap: anywhere; }
.cc-text { font-size: var(--fs-sm); color: var(--muted); line-height: var(--lh); }
/* Two-step set-up (SCR-05): the QR code's SVG (fixed pixel size from the renderer) is scaled into its box. */
.tfa-setup { display: flex; flex-direction: column; gap: var(--sp-4); font-size: var(--fs-md); line-height: var(--lh); }
.tfa-setup p { margin: 0; }
.tfa-qr { align-self: center; width: 176px; height: 176px; padding: 8px; box-sizing: border-box; background: var(--doc-bg); border: 1px solid var(--border); border-radius: var(--r); }
.tfa-qr svg { display: block; width: 100%; height: 100%; }
/* DT-210: recovery codes list and the "use a recovery code instead" link of the profile's two-step dialogs. */
.tfa-codes { list-style: none; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; background: var(--page); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px; font-size: 15px; letter-spacing: .04em; }
.linkbtn { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.linkbtn:focus-visible { box-shadow: 0 0 0 3px var(--focus-ring); outline: none; border-radius: 2px; }
.tfa-key { align-self: center; max-width: 100%; text-align: center; background: var(--page); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-3) var(--sp-5); letter-spacing: .06em; overflow-wrap: anywhere; }

/* ---- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sk, .btn .spin { animation: none; }
  .toggle::after, table.grid tr.live td { transition: none; }
}

/* ---- smaller screens (UX-14): desktop ≥ 1280 px is the target; tablets keep the full menu, narrower; phones open it as a drawer */
.menu-toggle { display: none; }
@media (max-width: 1599px) {
  .cols.lp { grid-template-columns: minmax(0, 1fr) !important; grid-auto-rows: max-content; }
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: 200px minmax(0, 1fr); }
  .side .foot { display: none; }
  .cmdk { width: auto; flex: 1; }
  .auth { grid-template-columns: minmax(0, 1fr); }   /* Stage 5 session 10: the column may shrink below the 380 px card (phones) */
  .auth .brandside { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell > .side { display: none; }
  .side .collapse { display: none; }
  .side.mini .sec:not(.flown) > .fly { display: none; }
  .shell.menu-open > .side { display: flex; position: fixed; inset-block: 0; inset-inline-start: 0; width: min(280px, 85vw); z-index: 40; overflow-y: auto; box-shadow: var(--shadow-pop); }
  .menu-toggle { display: inline-flex; }
  .top { flex-wrap: wrap; }
  /* Stage 5 session 11 (375 px check): the wrapped top bar grows instead of spilling over the page; the search takes its own row */
  .top { height: auto; min-height: var(--top-h); padding: 6px 16px; row-gap: 6px; }
  .top .cmdk { order: 10; flex: 1 1 100%; width: auto; min-width: 0; margin-inline-start: 0; }
  .top .cmdk .kbd { display: none; }   /* no keyboard shortcut hint on a phone */
  .top .plan-trial { white-space: normal; flex: 0 1 auto; min-width: 0; }
  /* A page header's actions (e.g. the accounting dashboard's month and year) go under the title instead of over it */
  .ph { flex-wrap: wrap; align-items: flex-start; }
  .ph .t { flex: 1 1 100%; }
  .ph .act { margin-inline-start: 0; justify-content: flex-start; }
  .content { padding-inline: 16px; }
  .cols { grid-template-columns: minmax(0, 1fr) !important; }
  .fg { grid-template-columns: minmax(0, 1fr) !important; }
  /* Found by the font visual check (12 Nov 2026) — older than the font, these screens had not been checked at phone width:
     a field that spans two columns added a second column to the one-column form, and the fields lay over each other (the new-trip form) … */
  .fg > * { grid-column: 1 / -1 !important; }
  /* … and a page of two columns that fill the screen (an invoice, a trip form: .cols.fill) squeezed its stacked columns into the height
     of the screen, the cards cut off and over each other. On a phone such a page flows at its own height and the page scrolls. */
  .cols.fill { flex: none; min-height: auto !important; overflow: visible; grid-auto-rows: max-content; }
  .cols.fill > * { min-height: auto !important; }
  .cols.fill .fill { flex: none; }
  /* Found by the P-9 visual check (12 Nov 2026): a strip of key figures (the dashboard's eight) keeps two per row on a phone
     instead of squeezing all into one row, where the labels and the amounts ran over each other */
  .figs { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .figs > div { border-inline-start: 0; border-block-start: 1px solid var(--border); }
  .figs > div:nth-child(even) { border-inline-start: 1px solid var(--border); }
  .figs > div:nth-child(-n+2) { border-block-start: 0; }
  .main, .content { overflow-x: hidden; }
  .gridwrap { overflow-x: auto; }
  .auth .formside { padding: 24px 16px; grid-template-columns: minmax(0, 1fr); }
  .auth .fg > * { grid-column: 1 / -1 !important; }   /* a field spanning two columns no longer adds a second column on a phone */   /* Stage 5 session 10: account pages fit a 375 px phone (they were 444 px wide) */
}
/* Touch screens (UX-25): every control at least 44 px high and small buttons at least 44 px wide */
@media (pointer: coarse) {
  .btn, .input, select.input, .chip, .side .it, .side .g { min-height: 44px; }
  .btn.sm { height: auto; min-height: 44px; min-width: 44px; }
  .side .collapse { width: 44px; height: 44px; }
  .adorn .pick { width: 44px; }
}
@media print {
  .side, .top, .toasts { display: none; }
  /* The unlogged on-screen preview is never what the browser prints (FR-058): printing goes through the Print button. */
  .print-preview { visibility: hidden; }
  .shell { display: block; height: auto; }
  /* Wide grids print whole (no inner scroll, no sticky cells); the filters and tools are not printed. */
  .bud-scroll, .pl-scroll, .bud-box, .pl-box { overflow: visible; max-height: none; }
  table.bud-grid .bud-first, table.pl-grid .pl-first, table.grid th, table.grid tfoot td, table.bud-grid tfoot tr.bud-foot > *, table.pl-grid tfoot tr.pl-key > * { position: static; }
  .bud-tools, .pl-filters { display: none; }
}
.w100 { width: 100%; }
.w120 { width: 120px; } .w160 { width: 160px; } .w200 { width: 200px; } .w220 { width: 220px; }
/* Budget vs Actual (revision 6 part B): favourable / unfavourable variances; the badge text beside them says it too (colour is never alone). */
.var-good { color: var(--ok); }
.var-bad { color: var(--err); }
/* Accounting dashboard (revision 6 part B): small bar charts in HTML (they follow the page direction), reminders and quick links. */
.ch-rev { background: var(--primary); }
.ch-exp { background: var(--chart-amber); }
.ch-ok { background: var(--ok); } .ch-warn { background: var(--chart-amber); } .ch-err { background: var(--err); }
.ch-legend { display: flex; gap: var(--sp-4); font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--sp-2); }
.ch-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }
.ch-trend { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 170px; }
.ch-col { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.ch-bars { flex: 1; display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; }
.ch-bars i { display: block; width: 42%; max-width: 16px; border-radius: 2px 2px 0 0; }
.ch-lbl { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.ch-hbars { margin: 0; display: grid; gap: 8px; }
.ch-hrow { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--sp-3); align-items: center; }
.ch-hrow dt { font-size: var(--fs-sm); color: var(--muted); }
.ch-hrow dd { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; }
.ch-track { display: block; height: 10px; background: var(--surface-mute); border-radius: 5px; overflow: hidden; }
.ch-track i { display: block; height: 100%; }
.rem-list { list-style: none; margin: 0; padding: 0; }
.rem-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.rem-list li:first-child { border-top: 0; }
/* DT-228: a reminder's items (carried driver balances) under its text. */
.rem-list .rem-items { grid-column: 2 / -1; margin: 0; padding-inline-start: var(--sp-4); list-style: disc; }
.rem-list .rem-items li { display: list-item; padding: 0; border-top: 0; overflow-wrap: anywhere; }
.quick-links { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; }
/* Reports (DT-248): the open report is marked in the list (tint, bar on the start side, bold) and named above its filters; under 1,100 px
   the list stacks above the report and both flow with the page. */
.cols.rp { grid-template-columns: 260px minmax(0, 1fr); }
.rep-nav { overflow: auto; }
.rep-list { list-style: none; margin: 0; padding: 6px; }
.rep-list .btn { width: 100%; justify-content: flex-start; text-align: start; height: auto; min-height: var(--ctl); padding: 6px 8px; white-space: normal; }
.rep-code { color: var(--muted); }
.rep-list .btn[aria-current="page"] { background: var(--tint); color: var(--on-tint); font-weight: var(--fw-semibold); box-shadow: inset -3px 0 0 var(--primary); }
[dir="ltr"] .rep-list .btn[aria-current="page"] { box-shadow: inset 3px 0 0 var(--primary); }
.rep-list .btn[aria-current="page"] .rep-code { color: inherit; }
/* System email (DT-250): the status as label · value rows. */
.sem-kv { grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; }
.sem-kv dd { overflow-wrap: anywhere; }
.rep-head { flex: none; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rep-head h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
@media (forced-colors: active) { .rep-list .btn[aria-current="page"] { outline: 2px solid CanvasText; outline-offset: -2px; } }
@media (max-width: 1100px) {
  .cols.rp { grid-template-columns: minmax(0, 1fr); flex: none; overflow: visible; }
  .rep-nav { overflow: visible; }
}

/* Stage 5 session 11 (design f.7): a product's trial / ended badge under its first menu group, and "More systems" entries' trial length */
.side .nb { display: block; font-size: 11px; font-weight: var(--fw-regular); color: var(--side-foot); line-height: 1.4; white-space: normal; }
.side .nb.ended { color: var(--side-strong); opacity: .85; }
.side .it .nb { display: inline; margin-inline-start: var(--sp-2); }   /* DT-648: an entry's "Ended — view only" */
.side .g .lbl { min-width: 0; }
.side .fly .ft .nb { font-weight: var(--fw-regular); }
/* Revision 8 session 9: the system switcher (top bar) and the system picker (/systems) */
.menu a[role="menuitem"] { text-decoration: none; }
.menu .nb { display: block; font-size: 11px; font-weight: var(--fw-regular); color: var(--muted); line-height: 1.4; }
.top .sys-switch { flex: none; }
.systems { min-height: 100vh; display: flex; flex-direction: column; background: var(--page); }
.sys-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-4) var(--sp-8); background: var(--surface); border-bottom: 1px solid var(--border); }
.sys-head .who { display: flex; flex-direction: column; min-width: 0; }
.sys-head .who span { font-size: var(--fs-sm); }
.sys-main { width: min(100%, 860px); margin: 0 auto; padding: var(--sp-12) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-6); }
.sys-main h1 { font-size: var(--fs-title); }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--sp-5); }
.sys-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); min-height: 160px; padding: var(--sp-7); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); min-width: 0; }
.sys-card:hover, .sys-card:focus-within { border-color: var(--primary); }
.sys-card .ei { width: 44px; height: 44px; border-radius: 50%; background: var(--tint); color: var(--primary); display: grid; place-items: center; }
.sys-card .ei svg.ic { --ic: 22px; }
.sys-card b { font-size: var(--fs-lg); }
.sys-card .go { margin-top: auto; }
.sys-remember { align-self: flex-start; }
.sys-more { border-top: 1px solid var(--border); padding-top: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.sys-more h2 { font-size: var(--fs-md); }
.notes-filter { display: flex; flex-wrap: wrap; gap: var(--sp-3); padding-bottom: var(--sp-4); }
@media (max-width: 760px) {
  .sys-head { padding: var(--sp-4) var(--sp-5); }
  .sys-main { padding: var(--sp-8) var(--sp-5); }
  .top .sys-switch > span:not(.sr-only) { display: none; }   /* a phone's top bar: the system's icon only (its name is the button's label) */
}
/* Tenant → Subscription: one card per system (Stage 5 session 11) */
.system-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--sp-5); }
/* Owner review of 12 Nov 2026: Subscription — "Users and systems": a table, and at phone width a small card per user. */
.user-cards { display: none; list-style: none; margin: 0; padding: var(--sp-5); gap: var(--sp-4); }
.user-cards a.user-card { display: flex; flex-direction: column; gap: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4) var(--sp-5); color: inherit; text-decoration: none; background: var(--surface); }
.user-cards a.user-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.user-card .uc-row { display: flex; justify-content: space-between; gap: var(--sp-5); }
table.grid.users-systems th .help { font-weight: var(--fw-regular); margin-inline-start: var(--sp-2); }
@media (max-width: 760px) {
  table.grid.users-systems { display: none; }
  .user-cards { display: grid; }
}
.system-card { display: flex; flex-direction: column; gap: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-5); min-width: 0; background: var(--surface); }
/* Phones (Stage 5 session 11 visual check, 375 px): a banner's actions (e.g. the contact details) go under its text instead of squeezing it */
@media (max-width: 760px) {
  .banner { flex-wrap: wrap; }
  .banner > .t { flex-basis: calc(100% - 40px); }
  .banner .a { flex: 1 1 100%; flex-wrap: wrap; margin-inline-start: 0; min-width: 0; }
}

/* Revision 8 §8.1: the user form — one row per system (seat switch with its seats, role picker); one column at phone width. */
.user-form-block { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); flex-shrink: 0; }
.user-form-block > legend { font-weight: var(--fw-semibold); padding: 0; margin-bottom: var(--sp-2); }
.user-form-system { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3) var(--sp-6); align-items: start; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); }
.user-form-system > .field { margin: 0; min-width: 0; }
.user-form-system .user-form-note { grid-column: 1 / -1; margin: 0; }
.user-form-checks { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-8); }
.user-form-checks > .field { margin: 0; }
.user-form-company { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-6); align-items: start; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); }
.user-form-company > h4 { grid-column: 1 / -1; margin: 0; font-size: 1em; font-weight: var(--fw-semibold); }
.user-form-company > .field { margin: 0; min-width: 0; }
@media (max-width: 760px) {
  .user-form-system { grid-template-columns: minmax(0, 1fr); }
}

/* Owner review of 8 Nov 2026: a table that keeps dates on one line and turns into label + value rows on a phone (Console → Tenant). */
.tbl .nw { white-space: nowrap; }
@media (max-width: 760px) {
  .tbl-cards thead { display: none; }   /* each value carries its label (td::before) */
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: auto; }
  .tbl-cards tr { padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
  .tbl-cards td { display: flex; justify-content: space-between; gap: var(--sp-5); padding: 2px 0; border: 0; text-align: start; white-space: normal; }
  .tbl-cards td:empty { display: none; }
  .tbl-cards td::before { content: attr(data-label); color: var(--muted); flex: none; }
}

/* Session 13 (DT-976), the 375 px pass over every screen: a list's tools (search box, Excel / CSV / PDF) take their own row under the
   tabs and wrap; the search box shrinks instead of pushing the last button off the page. */
@media (max-width: 760px) {
  .views .tools { margin-inline-start: 0; flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
  .views .tools > .adorn { flex: 1 1 140px; width: auto !important; min-width: 0; }
  /* The page flows on a phone: no part of a page is squeezed into the height of the screen — a list's table under its filters shrank
     to nothing (trips, invoices, journal entries), a form's cards were pressed over its button row (trips import). Every part keeps
     its own height and the page itself scrolls. */
  :is(.content, .content > .page-body) > * { flex-shrink: 0; }
  :is(.content, .content > .page-body) > .fill { flex: none; }
  .content.fixed { overflow-y: auto; }
  /* The setup checklist: a step's badge and buttons go under its name and wrap. */
  .step { grid-template-columns: 28px minmax(0, 1fr); }
  .step > :last-child:not(:first-child) { grid-column: 1 / -1; flex-wrap: wrap; }
  /* Label + value blocks: two per row, and a long number breaks instead of running over its neighbour (a driver's page). */
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .kv dd { overflow-wrap: anywhere; min-width: 0; }
  /* A wide table scrolls sideways inside its own card. Its hidden labels (a caption, a column title for screen readers) are placed
     from that card — placed from the page, a label in the last column lay 500 px past the phone's edge and made the page itself
     wider than the screen (the entry forms' line tables). A summary table that sits directly in a card gets the same sideways scroll. */
  .tbl-wrap, .box-x, .gridwrap, .gridwrap > .fill { position: relative; }
  :is(.box, .pad):has(> table.grid) { overflow-x: auto; position: relative; }
  /* A card's header: its tools (a test address box and its button — the console's system email) go under the title and shrink. */
  .box > .bh, .box > .box-x > .bh { flex-wrap: wrap; }
  .box > .bh .a, .box > .box-x > .bh .a { flex-wrap: wrap; min-width: 0; max-width: 100%; }
  .box > .bh .a .input { min-width: 0; max-width: 100%; flex: 1 1 140px; }
  /* A label + value block that holds a text button (the reconciliation report's "entries" link): one value per row, so the link stays on one line. */
  .kv:has(.linkbtn) { grid-template-columns: minmax(0, 1fr) !important; }
}
