/* FINORA console: the FINORA design system in one stylesheet, no framework (docs/DESIGN_SYSTEM.md).
   Layers, top to bottom: the typefaces; the brand tokens exactly as FINORA gives them (--finora-*); the system
   tokens built on them (colour roles, type scale, spacing, radii, elevation) for light and dark; then the
   components (shell and navigation, buttons, forms, cards, KPIs, tables, badges, alerts, dialogs, menus, charts)
   and the screens, which use only the tokens. Where a brand colour is too light for small text on its
   background it is used for marks, lines and fills, and a deeper step of the same hue carries the text
   (test/palette.test.ts checks every text pair against WCAG AA, 4.5:1). */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("/fonts/manrope-latin.woff2?v=2e5deb48d830") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/inter-latin.woff2?v=2e5deb48d830") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/plex-arabic-400.woff2?v=2e5deb48d830") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600 700; font-display: swap; src: url("/fonts/plex-arabic-600.woff2?v=2e5deb48d830") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
:root {
  /* FINORA Brand */
  --finora-navy: #0B2545;
  --finora-teal: #0D9488;
  --finora-light-teal: #A7E0D7;
  --finora-stone: #E5E7EB;
  --finora-gold: #D4AF37;

  /* Backgrounds */
  --finora-bg: #FFFFFF;
  --finora-bg-soft: #F8FAFC;
  --finora-bg-muted: #F1F5F9;

  /* Text */
  --finora-text-primary: #0B2545;
  --finora-text-secondary: #64748B;
  --finora-text-muted: #94A3B8;
  --finora-text-inverse: #FFFFFF;

  /* Borders */
  --finora-border: #E5E7EB;
  --finora-border-active: #0D9488;

  /* Status */
  --finora-success: #0D9488;
  --finora-warning: #D97706;
  --finora-danger: #DC2626;
  --finora-info: #2563EB;

  /* Interactive */
  --finora-primary: #0B2545;
  --finora-primary-hover: #071B34;

  --finora-secondary: #0D9488;
  --finora-secondary-hover: #0B7F75;

  --finora-focus: #A7E0D7;

  /* Radius */
  --finora-radius-sm: 6px;
  --finora-radius-md: 10px;
  --finora-radius-lg: 14px;
  --finora-radius-xl: 20px;

  /* Shadows */
  --finora-shadow-sm: 0 1px 3px rgba(11, 37, 69, 0.08);
  --finora-shadow-md: 0 8px 24px rgba(11, 37, 69, 0.10);
  --finora-shadow-lg: 0 20px 50px rgba(11, 37, 69, 0.14);

  /* System tokens, light. Colour roles first. */
  --build: '2e5deb48d830'; /* stamped by the server; app.js checks the styles match the script (web.ts) */
  --bg: var(--finora-bg-soft);          /* the workspace */
  --surface: var(--finora-bg);          /* cards, tables, panels */
  --surface-2: var(--finora-bg-muted);  /* table heads, quiet fills */
  --surface-3: #E2E8F0;
  --row-hover: var(--finora-bg-soft);
  --border: var(--finora-border);
  --border-strong: #CBD5E1;
  --text: var(--finora-text-primary);
  --heading: var(--finora-navy);
  --muted: #5B6B80;            /* --finora-text-secondary one step deeper: 4.5:1 also on --surface-2 (table headings) */
  --faint: var(--finora-text-muted);
  --primary: var(--finora-primary);
  --primary-hover: var(--finora-primary-hover);
  --on-primary: var(--finora-text-inverse);
  --secondary: #0F766E;        /* teal actions: --finora-secondary is 3.7:1 under white text, so buttons use its deeper step */
  --secondary-hover: #0B5F59;
  --on-secondary: var(--finora-text-inverse);
  --brand: var(--finora-teal);  /* marks and lines: the open tab, focused fields, progress, selected rows */
  --accent: #0F766E;           /* teal for text (links, the open page, icons) */
  --accent-hover: #0B5F59;
  --accent-soft: #E7F5F2;      /* the subtle light-teal background of selected things */
  --accent-line: var(--finora-light-teal);
  --on-accent: var(--finora-text-inverse);
  --focus: var(--finora-focus);
  --gold: var(--finora-gold);  /* sparingly: premium, milestones, exceptional KPI highlights, executive indicators */
  --gold-text: #8A6D12;        /* gold for text and marks on white (4.5:1) */
  --gold-soft: #FBF6E4;
  --sand: var(--gold);         /* older name of --gold, kept for the screens that use it */
  --sand-hover: #DDBD55;
  --sand-mark: #9A7A1C;
  --on-sand: var(--finora-navy);
  --sand-soft: var(--gold-soft);
  --coral: var(--finora-danger);
  --danger: #B91C1C;           /* --finora-danger for fills (toasts, counts); this step for text on --danger-soft */
  --danger-fill: var(--finora-danger);
  --danger-soft: #FEF2F2;
  --negative: #B91C1C;         /* negative amounts: a quiet red, never a fill */
  --warn: #B45309;             /* --finora-warning is 3.2:1 on white, so warning text uses its deeper step */
  --warn-soft: #FFF7EB;
  --ok: var(--accent);         /* FINORA's success is its teal */
  --ok-fill: var(--accent);
  --ok-soft: var(--accent-soft);
  --info: #1D4ED8;
  --info-soft: #EFF6FF;
  /* The navy title bar and main menu. */
  --bar-1: var(--finora-navy);
  --bar-2: var(--finora-navy);
  --bar-deep: var(--finora-primary-hover);
  --bar-line: rgb(255 255 255 / 8%);
  --bar-text: var(--finora-text-inverse);
  --bar-muted: rgb(255 255 255 / 70%);
  --bar-hover: rgb(255 255 255 / 7%);
  --bar-field: rgb(255 255 255 / 8%);
  --bar-active: var(--finora-light-teal);   /* the open tab's text on navy (10:1) */
  --bar-active-bg: rgb(13 148 136 / 22%);    /* subtle teal behind the open tab */
  --avatar-bg: var(--finora-light-teal);
  --on-avatar: var(--finora-navy);
  /* Elevation: subtle. */
  --shadow: var(--finora-shadow-sm);
  --shadow-lift: var(--finora-shadow-md);
  --shadow-lg: var(--finora-shadow-lg);
  /* Shape. */
  --radius-xs: var(--finora-radius-sm);
  --radius-s: 8px;
  --radius: 12px;
  --radius-l: var(--finora-radius-lg);
  --radius-xl: var(--finora-radius-xl);
  /* Type: Manrope for titles, headings and headline figures; Inter for everything else. */
  --font-display: "Manrope", "Inter", "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Inter", "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --sans: var(--font-ui);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: 11.5px; --fs-s: 12.5px; --fs-m: 13.5px; --fs-l: 15px; --fs-xl: 18px; --fs-2xl: 24px; --fs-kpi: 26px; --fs-hero: 30px;
  /* Spacing, on a 4 px grid. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --head-h: 108px;
  /* Charts (in this order): navy, teal, light teal, neutral; gold only for what genuinely matters. */
  --series-1: var(--finora-navy);
  --series-2: var(--finora-teal);
  --series-3: var(--finora-light-teal);
  --series-4: #CBD5E1;
  --series-gold: var(--finora-gold);
}
/* Dark (when the device asks for it): FINORA navy as the night, teal and gold lifted to read on it. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07111F;
    --surface: #0C1A2E;
    --surface-2: #112339;
    --surface-3: #18304C;
    --row-hover: #112339;
    --border: #1E3350;
    --border-strong: #2B4466;
    --text: #E2E8F0;
    --heading: #F8FAFC;
    --muted: #94A3B8;
    --faint: #7487A0;
    --primary: #5ECFC0;
    --primary-hover: #84DDD1;
    --on-primary: #04221F;
    --secondary: #2DD4BF;
    --secondary-hover: #5EEAD4;
    --on-secondary: #04221F;
    --brand: #5ECFC0;
    --accent: #5ECFC0;
    --accent-hover: #84DDD1;
    --accent-soft: #0E3038;
    --accent-line: #1E6B66;
    --on-accent: #04221F;
    --focus: rgb(94 207 192 / 35%);
    --gold: #E0BF52;
    --gold-text: #E0BF52;
    --gold-soft: #2E2812;
    --sand-hover: #E9CD72;
    --sand-mark: #E0BF52;
    --on-sand: #0B2545;
    --coral: #F87171;
    --danger: #F87171;
    --danger-fill: #DC2626;
    --danger-soft: #35161B;
    --negative: #FCA5A5;
    --warn: #FBBF24;
    --warn-soft: #33260E;
    --ok: #5ECFC0;
    --ok-fill: #0B7F75;
    --ok-soft: #0E3038;
    --info: #93B4FF;
    --info-soft: #152846;
    --bar-1: #061224;
    --bar-2: #061224;
    --bar-deep: #040C18;
    --shadow: 0 1px 3px rgb(0 0 0 / 35%);
    --shadow-lift: 0 8px 24px rgb(0 0 0 / 40%);
    --shadow-lg: 0 20px 50px rgb(0 0 0 / 50%);
    --series-1: #7FA6DB;
    --series-2: #2DD4BF;
    --series-3: #A7E0D7;
    --series-4: #64748B;
    --series-gold: #E0BF52;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font-ui); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--heading); }
h1 { font: 700 var(--fs-2xl)/1.2 var(--font-display); letter-spacing: -.02em; }
h2 { font: 700 var(--fs-l)/1.3 var(--font-display); letter-spacing: -.01em; }
h3 { font: 600 14px/1.3 var(--font-ui); }
/* Every figure lines up: tabular numerals everywhere numbers are compared. */
.num, td.num, .value, .amount, input.num, .kpi .value, .big-number, .mini-figures dd { font-variant-numeric: tabular-nums lining-nums; }
.neg { color: var(--negative); }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.strong { font-weight: 650; }
.pad-top { padding-top: 10px; }
.gap-s { gap: 10px; }
.mb-s { margin-bottom: 6px; }
.ml-s { margin-inline-start: 6px; }
.mt-s { margin-top: 6px; }
.self-end { align-self: end; }
.self-center { align-self: center; }
.grid.checks { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.width-auto { width: auto; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Sign-in: FINORA's navy, a quiet teal composition, and a clean white panel. */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--surface); }
.signin-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-8); padding: 48px 56px; color: #fff;
  background: var(--finora-navy); }
.signin-brand::before { content: ''; position: absolute; inset: auto -12% -30% 28%; height: 78%; background: linear-gradient(115deg, transparent 0 34%, rgb(13 148 136 / 26%) 34% 52%, transparent 52% 58%, rgb(13 148 136 / 14%) 58% 76%, transparent 76%); transform: skewY(-12deg); pointer-events: none; }
.signin-brand > * { position: relative; }
.signin-brand img { display: block; width: 260px; max-width: 100%; height: auto; }
.signin-claim { display: grid; gap: var(--sp-4); max-width: 30rem; }
.signin-claim h2 { color: #fff; font: 700 40px/1.1 var(--font-display); letter-spacing: -.03em; }
.signin-claim p { color: rgb(255 255 255 / 76%); font-size: var(--fs-l); line-height: 1.6; }
.signin-points { display: grid; gap: 10px; margin: var(--sp-2) 0 0; padding: 0; list-style: none; color: rgb(255 255 255 / 82%); font-size: var(--fs-m); }
.signin-points li { display: flex; gap: 10px; align-items: center; }
.signin-points li::before { content: ''; width: 18px; height: 2px; background: var(--finora-teal); flex: none; }
.signin-legal { color: rgb(255 255 255 / 55%); font-size: var(--fs-s); }
.signin-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.signin-card { width: 100%; max-width: 380px; display: grid; gap: var(--sp-5); }
.signin-card h1 { font-size: 26px; }
.signin-mobile-logo { display: none; }
.signin-mobile-logo img { width: 190px; height: auto; display: block; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 30px; height: 30px; }
.signin-card .foot { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .signin { grid-template-columns: 1fr; }
  .signin-brand { display: none; }
  .signin-panel { place-items: start center; padding-top: 48px; }
  .signin-mobile-logo { display: block; }
}
@media (prefers-color-scheme: dark) { .signin, .signin-panel { background: var(--bg); } }

/* Shell: the navy title bar and main menu across the top, then the white workspace. */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.head { position: sticky; top: 0; z-index: 15; }
.appbar { display: flex; align-items: center; gap: var(--sp-3); height: 60px; padding: 0 20px 0 16px; color: var(--bar-text); background: var(--bar-1); border-bottom: 1px solid var(--bar-line); }
.appbar .spacer { flex: 1; }
.appbar .brand { color: var(--bar-text); padding-block: 4px; padding-inline: 4px 8px; border-radius: var(--radius-s); min-width: 0; gap: 14px; }
.appbar .brand:hover { text-decoration: none; background: var(--bar-hover); }
.appbar .brand img.brand-logo { width: auto; height: 26px; display: block; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; padding-inline-start: 14px; border-inline-start: 1px solid rgb(255 255 255 / 16%); }
.appbar .org { font-size: var(--fs-s); font-weight: 500; color: var(--bar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.signin-tagline { margin: 0; font-weight: 600; color: var(--heading); }
.appbar .btn.new-btn { background: var(--secondary); border-color: var(--secondary); color: var(--on-secondary); }
.appbar .btn.new-btn:hover { background: var(--secondary-hover); border-color: var(--secondary-hover); }
.appbar .new-btn svg.icon { width: 16px; height: 16px; stroke-width: 2.4; }
.le-pick { display: flex; align-items: center; gap: 6px; color: var(--bar-muted); font-size: var(--fs-s); }
.le-pick select { background: var(--bar-field); color: var(--bar-text); border-color: rgb(255 255 255 / 14%); max-width: 280px; min-height: 34px; }
.le-pick select:hover { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 22%); }
.le-pick select option { color: #0B2545; background: #fff; }
.le-pick select:focus { border-color: var(--finora-teal); box-shadow: 0 0 0 3px rgb(167 224 215 / 35%); }
.user-menu > summary.user-chip { list-style: none; display: flex; align-items: center; gap: 8px; padding-block: 4px; padding-inline: 4px 8px; border-radius: 999px; cursor: pointer; color: var(--bar-text); }
.user-menu > summary.user-chip:hover, .user-menu[open] > summary.user-chip { background: var(--bar-hover); }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--avatar-bg); color: var(--on-avatar); }
.user-name { font-weight: 600; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .chev { width: 14px; height: 14px; opacity: .8; }
.appbar .menu-pop { color: var(--text); }
.menu-item svg.icon { color: var(--accent); }

/* The main menu, on navy: a tab per area, each opening a drop-down of groups; the quick jump on the right (docs/CONSOLE.md, "The main menu"). */
.mainmenu { position: relative; display: flex; align-items: stretch; gap: 10px; background: var(--bar-1); border-bottom: 1px solid var(--bar-deep); box-shadow: 0 1px 2px rgb(11 37 69 / 12%); padding: 0 16px 0 10px; height: 48px; }
.mm-row { flex: 1; min-width: 0; display: flex; align-items: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.mm-row::-webkit-scrollbar { display: none; }
.mm-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; margin: 7px 0; padding: 0 11px; min-height: 0; color: var(--bar-muted); font: 500 13px/1 var(--font-ui); white-space: nowrap; border: 0; border-radius: var(--radius-s); background: none; cursor: pointer; }
.mm-tab::after { content: ''; position: absolute; inset-inline-start: 11px; inset-inline-end: 11px; bottom: -7px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.mm-tab:hover, .mm-tab[aria-expanded=true] { color: var(--bar-text); text-decoration: none; background: var(--bar-hover); }
.mm-tab.active { color: var(--bar-active); background: var(--bar-active-bg); font-weight: 600; }
.mm-tab.active::after { background: var(--finora-teal); }
.mm-tab[aria-expanded=true]::after { background: var(--finora-light-teal); }
.mm-tab:focus-visible { outline: 2px solid var(--finora-light-teal); outline-offset: -2px; }
.mm-tab svg.icon { width: 16px; height: 16px; }
.mm-tab svg.mm-chev { width: 12px; height: 12px; opacity: .55; transition: transform .15s; }
.mm-tab[aria-expanded=true] svg.mm-chev { transform: rotate(180deg); }
.mm-tab .count { font-size: 11px; background: var(--danger-fill); color: #fff; border-radius: 999px; padding: 0 6px; font-weight: 700; line-height: 17px; }
.mm-tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--finora-gold); }
.mm-drop { position: absolute; z-index: 35; top: 100%; inset-inline-start: 0; inset-inline-end: 0; max-height: calc(100vh - var(--head-h) - 16px); overflow-y: auto;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lift); padding: 18px 28px 24px; animation: drop-in .12s ease-out; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-3px); } }
.mm-drop .launch-grid { max-width: 1360px; }

/* An area's groups (in the drop-down, and as the page #/menu/<area>). */
.launch { display: grid; gap: 14px; }
.launch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1320px; }
.launch-open { font-weight: 600; }
.launch .page-head h1 { display: flex; align-items: center; gap: 10px; }
svg.launch-ico { width: 26px; height: 26px; color: var(--accent); }
.launch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 28px; align-items: start; }
.launch.as-page .launch-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px 26px; }
.lgroup { min-width: 0; display: grid; gap: 6px; align-content: start; }
.lgroup-head { display: flex; align-items: center; gap: 9px; font: 700 14px/1.3 var(--font-display); color: var(--heading); }
.lgroup-ico { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent); flex: none; }
.lgroup-ico svg.icon { width: 17px; height: 17px; }
.lgroup-list { list-style: none; margin: 0 0 0 37px; padding: 0; display: grid; gap: 0; }
.lgroup-list > li.more { display: none; }
.lgroup-list.all > li.more { display: flex; }
.lrow { position: relative; display: flex; align-items: center; min-width: 0; }
.lrow .ln { flex: 1; min-width: 0; display: flex; padding-block: 3px; padding-inline: 6px 26px; margin-inline-start: -6px; border-radius: var(--radius-xs); color: var(--text); font-size: 13.5px; }
.lrow .ln-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .ln:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.lrow .ln:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lrow .ln.here { color: var(--accent); font-weight: 600; }
.lrow .fav { position: absolute; inset-inline-end: 0; top: 50%; transform: translateY(-50%); min-height: 0; height: 22px; width: 22px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13px; line-height: 1; opacity: 0; border-radius: var(--radius-xs); }
.lrow:hover .fav, .lrow .fav:focus-visible, .lrow .fav.on { opacity: 1; }
.lrow .fav.on { color: var(--sand-mark); }
.lrow .fav:hover { background: var(--surface-2); color: var(--accent); }
@media (hover: none) { .lrow .fav { opacity: .55; } }
.lgroup-more { margin-inline-start: 37px; display: flex; gap: 12px; flex-wrap: wrap; }
.lgroup-empty { margin-inline-start: 37px; }
@media (max-width: 1180px) { .launch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .launch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; } }
@media (max-width: 560px) { .launch-grid { grid-template-columns: minmax(0, 1fr); } .launch.as-page .launch-grid { padding: 16px; } }

/* The quick jump: a page or report by its name or code. */
.qj { position: relative; align-self: center; display: flex; align-items: center; gap: 4px; flex: none; }
.qj-field { position: relative; display: flex; align-items: center; }
.qj-field svg.qj-ico { position: absolute; inset-inline-start: 10px; width: 15px; height: 15px; color: var(--bar-muted); pointer-events: none; }
.qj-input { width: 200px; min-height: 32px; font-size: 13px; padding-block: 4px; padding-inline: 32px 10px; border-radius: var(--radius-s); background: var(--bar-field); color: var(--bar-text); border-color: rgb(255 255 255 / 12%); transition: width .15s; }
.qj-input::placeholder { color: rgb(255 255 255 / 60%); }
.qj-input:hover { border-color: rgb(255 255 255 / 22%); }
.qj-input:focus { width: 300px; border-color: var(--finora-teal); box-shadow: 0 0 0 3px rgb(167 224 215 / 30%); }
.qj-go { min-height: 32px; width: 32px; padding: 0; display: grid; place-items: center; border-radius: var(--radius-s); background: var(--secondary); border-color: var(--secondary); color: var(--on-secondary); }
.qj-go:hover { background: var(--secondary-hover); border-color: var(--secondary-hover); }
.qj-go svg.icon { width: 16px; height: 16px; stroke-width: 2.2; }
.qj-list { position: absolute; z-index: 40; top: calc(100% + 6px); inset-inline-end: 0; width: min(440px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lift); }
.qj-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-s); cursor: pointer; }
.qj-opt.sel { background: var(--accent-soft); }
.qj-opt svg.qj-oico { width: 17px; height: 17px; color: var(--accent); }
.qj-otext { flex: 1; min-width: 0; display: grid; }
.qj-otitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qj-owhere { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qj-code { font: 600 11.5px var(--mono); color: var(--muted); background: var(--surface-2); border-radius: var(--radius-xs); padding: 2px 6px; }
.qj-none { padding: 8px 10px; }

.main { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.content { padding: 28px 32px 56px; display: grid; gap: var(--sp-5); max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 4px; }
.page-head .sub { color: var(--muted); margin-top: 6px; font-size: var(--fs-m); }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

@media (max-width: 1440px) { .mm-tab svg.mm-chev { display: none; } }
@media (max-width: 1100px) {
  .user-name, .user-chip .chev { display: none; }
  .le-pick select { max-width: 200px; }
}
@media (max-width: 860px) {
  :root { --head-h: 102px; }
  .appbar { height: 54px; padding: 0 10px 0 6px; gap: 8px; }
  .appbar .org, .brand-text { display: none; }
  .new-label { display: none; }
  .appbar .btn.new-btn { padding: 0 10px; }
  .le-pick > svg.icon { display: none; }
  .le-pick select { max-width: 150px; }
  .mainmenu { padding: 0 6px 0 4px; gap: 6px; }
  .mm-tab { padding: 0 10px; }
  .mm-drop { padding: 12px 16px 18px; }
  /* The quick jump folds to its magnifier, and opens across the bar. */
  .qj-input { width: 36px; padding: 4px 0 4px 34px; cursor: pointer; }
  .qj-input::placeholder { color: transparent; }
  .qj:not(.open) .qj-go { display: none; }
  .qj.open { position: absolute; inset-inline-start: 6px; inset-inline-end: 6px; top: 6px; z-index: 36; background: var(--bar-1); padding: 0 2px; }
  .qj.open .qj-field { flex: 1; }
  .qj.open .qj-input, .qj.open .qj-input:focus { width: 100%; cursor: text; padding-inline-end: 10px; }
  .qj.open .qj-input::placeholder { color: rgb(255 255 255 / 60%); }
  .qj-list { width: 100%; }
  .content { padding: 16px 16px 40px; }
}
@media (max-width: 480px) {
  .brand-text { display: none; }
  .appbar .brand img.brand-logo { height: 22px; }
  .mm-tab .mm-label { display: none; }
  .mm-tab.active .mm-label, .mm-tab[aria-expanded=true] .mm-label { display: inline; }
}

/* Cards and grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.card > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; min-height: 52px; }
.card > .card-body { padding: 18px; display: grid; gap: 14px; }
.card.flush > .card-body { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tile { padding: 16px 18px; display: grid; gap: 4px; color: inherit; }
a.tile { transition: border-color .15s, background .15s; }
a.tile:hover { text-decoration: none; border-color: var(--border-strong); background: var(--row-hover); }
.tile .label { color: var(--muted); font-size: var(--fs-s); font-weight: 500; }
.tile .value { font: 700 var(--fs-kpi)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--heading); }
.tile .hint { font-size: 12px; color: var(--muted); }

/* Forms */
label.field { display: grid; gap: 6px; font-size: var(--fs-s); color: var(--muted); font-weight: 500; }
label.field > span.req::after { content: " *"; color: var(--danger); }
.field .help { font-weight: 400; font-size: 12px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 7px 10px; min-height: 36px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input.num { text-align: end; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label.field { min-width: 150px; }

button, .btn { font: inherit; font-weight: 600; font-size: 13px; letter-spacing: .005em; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: var(--radius-s); padding: 7px 15px; min-height: 36px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.secondary, .btn.secondary { background: var(--secondary); border-color: var(--secondary); color: var(--on-secondary); }
button.secondary:hover, .btn.secondary:hover { background: var(--secondary-hover); border-color: var(--secondary-hover); }
button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
button.danger:hover { background: var(--danger-soft); }
button.ghost { border-color: transparent; background: transparent; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); font-weight: 500; }
button.small { padding: 3px 9px; min-height: 26px; font-size: 12px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.full { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: top; }
td { background: var(--surface); }
th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; z-index: 1; border-bottom-color: var(--border-strong); }
table:not(.inv-lines) > tbody > tr:hover > td { background: var(--row-hover); }
table:not(.inv-lines) > tbody > tr.sel > td { background: var(--accent-soft); }
td.num, th.num { text-align: end; white-space: nowrap; }
tbody tr.click { cursor: pointer; }

tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
tr:last-child td { border-bottom: 0; }
tfoot tr td { border-top: 1px solid var(--border); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.lines td { padding: 6px 8px; }
.lines input, .lines select { min-height: 30px; padding: 5px 8px; }

/* Badges and notes */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; line-height: 18px; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.gold, .badge.premium { background: var(--gold-soft); color: var(--gold-text); border-color: transparent; }
.badge.DRAFT { background: var(--surface-2); color: var(--muted); }
.badge.SUBMITTED, .badge.PENDING { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.APPROVED, .badge.CLOSED { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.POSTED, .badge.OPEN, .badge.VERIFIED, .badge.ACTIVE, .badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.LOCKED, .badge.DISABLED, .badge.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.note { border-radius: var(--radius-s); padding-block: 11px; padding-inline: 16px 14px; border: 1px solid var(--border); background: var(--surface-2); display: grid; gap: 4px; box-shadow: inset 3px 0 0 var(--border-strong); font-size: var(--fs-m); }
.note.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); box-shadow: inset 3px 0 0 var(--brand); }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); box-shadow: inset 3px 0 0 #D97706; }
.note.bad { background: var(--danger-soft); border-color: transparent; color: var(--danger); box-shadow: inset 3px 0 0 var(--danger-fill); }
.note.info { background: var(--info-soft); border-color: transparent; color: var(--info); box-shadow: inset 3px 0 0 #2563EB; }
.note ul { margin: 4px 0 0; padding-inline-start: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 999px; padding-block: 1px; padding-inline: 9px 4px; font-size: 12px; background: var(--surface-2); }
.chip button { min-height: 0; padding: 0 5px; border: 0; background: none; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.secret { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--accent); border-radius: var(--radius-xs); padding: 10px 12px; overflow-wrap: anywhere; }

/* Setup steps */
.steps { display: grid; gap: 12px; counter-reset: step; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; }
.step .dot { counter-increment: step; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.step .dot::before { content: counter(step); }
.step.done .dot { background: var(--ok-fill); border-color: var(--ok-fill); color: #fff; }
.step.done .dot::before { content: "✓"; }
.step.current .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 4px var(--accent-soft); }
.tree { display: grid; gap: 4px; font-size: 13px; }
.tree .le { font-weight: 600; }
.tree .prop { padding-inline-start: 16px; }
.tree .dept { padding-inline-start: 32px; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--brand); }
.tabs a { border-bottom-width: 2px; }

/* API explorer */
.explorer { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.ops { max-height: 72vh; overflow-y: auto; }
.op { display: flex; gap: 8px; align-items: baseline; padding: 6px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12.5px; }
.op:hover { background: var(--surface-2); }
.op.active { background: var(--accent-soft); }
.verb { font-family: var(--mono); font-size: 11px; font-weight: 700; min-width: 50px; }
.verb.get { color: var(--info); }
.verb.post { color: var(--ok); }
.verb.put, .verb.patch { color: var(--warn); }
.verb.delete { color: var(--danger); }
pre.response { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 12px; overflow: auto; max-height: 60vh; font-family: var(--mono); font-size: 12px; }
@media (max-width: 960px) { .explorer { grid-template-columns: 1fr; } }

/* Dialog and toasts */
dialog { border: 1px solid var(--border); border-radius: var(--radius-l); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(7 27 52 / 50%); }
dialog form { padding: 20px; display: grid; gap: 14px; }
#toasts { position: fixed; inset-inline-end: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--finora-navy); color: #fff; border-radius: var(--radius-s); padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; animation: rise .18s ease-out; }
.toast.bad { background: var(--danger-fill); color: #fff; }
.toast.ok { background: var(--ok-fill); color: #fff; }
/* A newer FINORA is out (app.js, "Versions"). */
.update-bar { position: fixed; inset-inline-start: 16px; inset-inline-end: 16px; bottom: 16px; margin: 0 auto; width: fit-content; z-index: 60; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-block: 10px; padding-inline: 16px 12px; border-radius: var(--radius); background: var(--bar-2); color: #fff; box-shadow: var(--shadow); font-size: 13.5px; animation: rise .18s ease-out; }
.update-bar .ghost { color: #fff; border-color: rgb(255 255 255 / 35%); }
.update-bar .ghost:hover { background: rgb(255 255 255 / 12%); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 28px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Receipts and expenses */
.badge.warn, .badge.NEW { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.ISSUED, .badge.USED { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.REJECTED { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.DISCARDED, .badge.RETIRED { background: var(--surface-2); color: var(--muted); }
.dropzone { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
button.big { font-size: 16px; padding: 14px 22px; min-width: min(100%, 340px); }
.split { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.receipt-image { max-width: 100%; max-height: 70vh; border-radius: var(--radius-s); border: 1px solid var(--border); justify-self: start; }

/* Receipt capture (docs/RECEIPT_CAPTURE.md): QR reader, phone links, the phone page */
.badge.ACTIVE, .badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.small-head { font-size: 13px; font-weight: 650; color: var(--heading); margin: 8px 0 0; }
.break { overflow-wrap: anywhere; word-break: break-all; }
.ok-mark { color: var(--ok); font-weight: 700; margin-inline-end: 6px; }
.bad-mark { color: var(--danger); font-weight: 700; margin-inline-end: 6px; }
.phone-qr { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.qr-img { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: var(--radius-s); border: 1px solid var(--border); flex: none; }
.phone-qr > .grid { flex: 1 1 220px; }
.arrivals { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.qr-scan { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: grid; grid-template-rows: auto 1fr auto; }
.qr-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.qr-top strong { flex: 1; font-size: 16px; }
.qr-top button.ghost { color: #fff; border-color: rgb(255 255 255 / 40%); }
.qr-top button[aria-pressed="true"] { background: #fff; color: #000; }
.qr-view { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.qr-video { width: 100%; height: 100%; object-fit: cover; }
.qr-frame { position: absolute; width: min(68vw, 68vh, 340px); aspect-ratio: 1; border-radius: 18px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 45%); border: 3px solid rgb(255 255 255 / 85%); pointer-events: none; }
.qr-nocam { display: grid; gap: 16px; justify-items: center; text-align: center; padding: 24px; max-width: 420px; }
.qr-foot { background: var(--surface); color: var(--text); padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); max-height: 40vh; overflow-y: auto; display: grid; gap: 6px; }
.qr-status { margin: 0; font-weight: 600; }
.qr-status.ok { color: var(--ok); }
.qr-status.warn { color: var(--warn); }
.qr-status.bad { color: var(--danger); }
.qr-sent { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.qr-sent .spinner { margin-inline-end: 6px; }
.phone { max-width: 520px; margin: 0 auto; padding: 12px 16px 32px; display: grid; gap: 16px; min-height: 100vh; align-content: start; }
.phone-head { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 17px; color: var(--heading); }
.phone h1 { font-size: 20px; margin: 0 0 6px; }
.phone-who { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; }
.phone-who > div { display: grid; }
.phone-actions { display: grid; gap: 10px; }
.phone-actions button.big { width: 100%; min-height: 56px; }
.phone-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.phone-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--surface); }
.phone-list .right { text-align: end; }
.outbox { display: grid; gap: 8px; }
.outbox:empty { display: none; }
.phone-foot { display: grid; gap: 6px; justify-items: center; text-align: center; margin-top: 8px; }
.big-number { font: 700 var(--fs-kpi)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--heading); }
.bad-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.bar { height: 10px; min-width: 80px; border-radius: 5px; background: var(--surface-2); position: relative; overflow: hidden; }
.bar::after { content: ""; position: absolute; inset-block: 0; inset-inline: 0 auto; width: var(--w, 0%); background: var(--brand); border-radius: 5px; }

/* The printable tax invoice */
.invoice-sheet { position: relative; background: #fff; color: #111; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: grid; gap: 18px; box-shadow: var(--shadow); overflow: hidden; }
.invoice-sheet .muted { color: #555; }
.invoice-sheet .ar { display: block; font-size: .92em; }
.invoice-sheet .watermark { position: absolute; inset: 40% 0 auto; text-align: center; font-size: 34px; font-weight: 800; color: rgb(180 35 24 / 14%); transform: rotate(-12deg); pointer-events: none; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 14px; }
.inv-seller { font-size: 18px; font-weight: 700; }
.inv-title { text-align: end; font-size: 20px; font-weight: 700; }
.inv-meta { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.inv-buyer { border: 1px solid #ddd; border-radius: var(--radius-s); padding: 12px; display: grid; gap: 2px; }
.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th, .inv-lines td { border-bottom: 1px solid #ddd; padding: 6px 8px; vertical-align: top; color: #111; background: #fff; }
.inv-lines th { font-size: 11.5px; text-align: start; }
.inv-lines th.num, .inv-lines td.num { text-align: end; }
.inv-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.invoice-sheet .qr { width: 150px; height: 150px; }
.invoice-sheet .qr.placeholder { display: grid; place-items: center; border: 1px dashed #bbb; border-radius: var(--radius-s); padding: 10px; text-align: center; }
.inv-totals .kv { grid-template-columns: 1fr; min-width: 300px; }
.inv-totals .kv div { grid-template-columns: 1fr auto; align-items: baseline; }
.inv-totals .kv dd { text-align: end; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .inv-meta { grid-template-columns: 1fr; } .invoice-sheet { padding: 16px; }
  /* Nine columns on a phone: tighter cells; the table scrolls sideways for the rest. */
  .inv-lines th, .inv-lines td { padding: 4px 5px; font-size: 12px; }
}

@media print {
  body { background: #fff; }
  .head, #toasts, .content > :not(.invoice-sheet, .report-print) { display: none !important; }
  .no-print, .report-print .seg, .report-print .filters { display: none !important; }
  .report-print .card { break-inside: avoid-page; box-shadow: none; }
  .pack-report { break-before: page; }
  .shell, .main { display: block; }
  .content { padding: 0; max-width: none; }
  .invoice-sheet { border: 0; box-shadow: none; padding: 0; }
}

/* Filling in a journal entry from a file */
.import { display: grid; gap: 12px; margin-bottom: 18px; }
.import-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px;
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); }
.import-bar.over { border-color: var(--accent); background: var(--accent-soft); }
.import-result { display: grid; gap: 10px; }
.import-result:empty { display: none; }
.import-bar.drop { padding: 22px 18px; margin: 4px 0 12px; }
.import-result .card { margin: 0; }
ul.reasons { margin: 0; padding-inline-start: 18px; }
ul.reasons li + li { margin-top: 2px; }
.empty-start { display: grid; justify-items: center; gap: 6px; color: var(--text); }
.empty-start p { margin: 0 0 8px; max-width: 52ch; }
.empty-start .actions { justify-content: center; flex-wrap: wrap; }
table.lines tr.flag td { background: var(--warn-soft); }
table.lines tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
/* Department rules (docs/DEPARTMENT_RULES.md): needed on P&L lines, never on balance sheet lines. */
table.lines select.dept-needed { border-color: var(--warn); background: var(--warn-soft); }
table.lines select.dept-never { opacity: .45; cursor: not-allowed; }

/* ---- Home dashboard ---------------------------------------------------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; grid-auto-flow: row dense; align-items: start; }
.dash > .widget.xl, .dash > .empty.xl { grid-column: span 12; }
.dash > .widget.l { grid-column: span 8; }
.dash > .widget.m { grid-column: span 6; }
.dash > .widget.s { grid-column: span 4; }
@media (max-width: 1180px) { .dash > .widget.l, .dash > .widget.m { grid-column: span 12; } .dash > .widget.s { grid-column: span 6; } }
@media (max-width: 720px) { .dash > .widget.s { grid-column: span 12; } }
.widget { min-width: 0; }
.widget-body > *, .widget-body .grid, .widget-body .grid > * { min-width: 0; }
.widget-head { cursor: grab; }
.widget-head:active { cursor: grabbing; }
.widget-head h2 { user-select: none; }
.widget-body { display: grid; gap: 12px; padding: 16px 18px; min-width: 0; }
.widget.dragging { opacity: .5; }
.widget.drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.dash-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dash-filters select:not(.width-auto) { max-width: 100%; min-width: 0; flex: 1 1 260px; }
.page-head .actions { flex-wrap: wrap; }

.btn.small { padding: 3px 9px; min-height: 26px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; z-index: 40; top: calc(100% + 6px); inset-inline-start: 0; min-width: 230px; padding: 6px; display: grid; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lift); }
.menu-pop.right, .page-head .menu-pop { inset-inline-start: auto; inset-inline-end: 0; }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.menu-item { justify-content: flex-start; border: 0; background: none; font-weight: 500; width: 100%; text-align: start; gap: 10px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent-soft); color: var(--heading); }
.menu-note { padding: 6px 10px; }

.seg { display: inline-flex; justify-self: end; border: 1px solid var(--border); border-radius: var(--radius-xs); overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.widget-head button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile.kpi, .tile.small-tile { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.tile.kpi .value { font-size: 22px; }
.work { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.tile.small-tile .value { font-size: 20px; }
.headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.headline .value { font: 700 var(--fs-kpi)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--heading); }
.neg { color: var(--negative); }

/* Charts (web/charts.js) */
.chart { position: relative; width: 100%; min-width: 0; }
.chart-svg { display: block; max-width: 100%; overflow: visible; font: 11px var(--sans); }
.chart-svg .axis text { fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-svg .axis .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis .zero { stroke: var(--muted); stroke-width: 1; }
.chart-svg .bar.s1, .chart-svg .area.s1 { fill: var(--series-1); }
.chart-svg .bar.s2 { fill: var(--series-2); }
.chart-svg .bar.s3 { fill: var(--series-3); }
.chart-svg .bar.s4 { fill: var(--series-4); }
.chart-svg .area.s1 { fill-opacity: .12; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.s1 { stroke: var(--series-1); } .chart-svg .line.s2 { stroke: var(--series-2); }
.chart-svg .line.s3 { stroke: var(--series-3); } .chart-svg .line.s4 { stroke: var(--series-4); }
.chart-svg .line.dashed { stroke-dasharray: 5 4; }
.chart-svg .dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .dot.s1 { fill: var(--series-1); } .chart-svg .dot.s2 { fill: var(--series-2); }
.chart-svg .dot.s3 { fill: var(--series-3); } .chart-svg .dot.s4 { fill: var(--series-4); }
.chart-svg .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .hit { fill: transparent; outline: none; }
.chart-svg .hit.click { cursor: pointer; }
.chart-svg .hit:focus-visible { stroke: var(--accent); stroke-width: 1.5; }
.chart-svg.focus .group:not(.on) { opacity: .35; }
.chart-svg .group { transition: opacity .12s; }
.chart-tip { position: absolute; left: 0; top: 0; transform: translate(var(--x, 0), var(--y, 0)); pointer-events: none; z-index: 5;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-s); box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12px; display: grid; gap: 3px; min-width: 150px; }
.chart-tip .row { display: flex; align-items: center; gap: 6px; }
.chart-tip .row:first-child .k { font-weight: 650; }
.chart-tip .v { margin-inline-start: auto; font-variant-numeric: tabular-nums; font-weight: 600; padding-inline-start: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.s1 { background: var(--series-1); } .swatch.s2 { background: var(--series-2); }
.swatch.s3 { background: var(--series-3); } .swatch.s4 { background: var(--series-4); }
.legend .swatch.dashed { height: 3px; border-radius: 2px; width: 14px; }
.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "bar bar"; gap: 4px 12px; }
.bar-label { grid-area: label; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { grid-area: value; font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.bar-track { grid-area: bar; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: var(--w, 0); border-radius: 0 4px 4px 0; }
.bar-fill.s1 { background: var(--series-1); } .bar-fill.s2 { background: var(--series-2); }
.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; width: 100%; }
.meter-track { flex: 1; height: 6px; min-width: 40px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter-fill { display: block; height: 100%; width: var(--w, 0); border-radius: 0 3px 3px 0; }
.meter-fill.ok { background: var(--ok); } .meter-fill.warn { background: var(--warn); } .meter-fill.bad { background: var(--danger); }
.meter-label { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 44px; text-align: end; color: var(--text); }
.meter-label.bad { color: var(--danger); font-weight: 650; } .meter-label.warn { color: var(--warn); }

.activity, .functions, .link-list { list-style: none; margin: 0; padding: 0; display: grid; }
.activity li { padding: 9px 0; border-bottom: 1px solid var(--border); display: grid; gap: 2px; }
.activity li:last-child, .link-list li:last-child { border-bottom: 0; }
.act-title a, .act-title span:first-child { font-weight: 600; }
.act-detail { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-verb { font-weight: 600; color: var(--text); }
.act-verb.posted, .act-verb.issued, .act-verb.approved { color: var(--ok); }
.act-verb.deleted, .act-verb.rejected { color: var(--danger); }
.functions { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.functions a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); color: var(--text); font-weight: 500; }
.functions a:hover { border-color: var(--accent); text-decoration: none; background: var(--surface-2); }
.functions .star { color: var(--warn); }
.link-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.link-list li.with-remove { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.link-list li.with-remove .muted { grid-column: 1 / -1; }

/* An example in an empty box must not look like a value that was typed. */
::placeholder { color: var(--muted); opacity: .7; font-style: italic; }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft); }

/* Items catalogue: the department › major group › group › subgroup › category tree beside the item list */
.item-layout { display: grid; gap: 16px; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .item-layout { grid-template-columns: minmax(0, 1fr); } }
.item-tree { display: grid; gap: 12px; font-size: 13px; }
.item-tree ul { list-style: none; margin: 0; padding: 0; }
.item-tree ul ul { padding-inline-start: 14px; border-inline-start: 1px solid var(--border); margin-inline-start: 6px; }
.item-dept { display: block; font-weight: 650; color: var(--text); padding: 2px 6px; border-radius: var(--radius-xs); }
.item-node { display: flex; gap: 6px; align-items: baseline; padding: 2px 6px; border-radius: var(--radius-xs); color: var(--text); }
.item-node:hover, .item-dept:hover { background: var(--surface-2); text-decoration: none; }
.item-node.on, .item-dept.on { background: var(--accent-soft); color: var(--accent); }
.item-node.off { opacity: .55; }
.item-node.lvl-1 { font-weight: 600; }
.item-node .count { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.item-path { display: inline-block; min-width: 180px; }
table.lines input[data-kind=item] { min-width: 120px; }

/* ---- Reports: the menu, the library, report pages, packs ----------------- */
.report-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 640px) { .report-columns { grid-template-columns: 1fr; } }
.report-list li .badge { margin-inline-start: 6px; }
.report-list li .chips { margin-top: 4px; }
.report-kpis { margin-bottom: 16px; }
.hint.up-good { color: var(--ok); }
.hint.up-bad { color: var(--danger); }
table.report-table td:first-child { padding-inline-start: calc(12px + var(--indent, 0px)); }
table.report-table td.neg { color: var(--negative); }
table.report-table tr.col-groups th.grp { text-align: center; border-bottom: 2px solid var(--accent); color: var(--accent); }
table.report-table tr.col-groups th.grp.empty { border-bottom: 0; }
table.report-table tr.r-heading td { font-weight: 700; color: var(--accent); background: var(--accent-soft); }
table.report-table tr.r-subtotal td { font-weight: 600; }
table.report-table tr.r-total td { font-weight: 650; border-top: 1px solid var(--text); }
table.report-table tr.r-grand td { font-weight: 750; border-top: 1px solid var(--text); border-bottom: 3px double var(--text); }
.pad { padding: 8px 14px; margin: 0; }
.pack-contents { columns: 2 260px; margin: 0; padding-inline-start: 20px; }
.pack-contents li { break-inside: avoid; }
.pack-report { margin-top: 24px; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.mini { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; align-content: start; }
.mini-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mini-head a { font-weight: 600; }
.mini-figures { margin: 0; display: grid; gap: 3px; }
.mini-figures > div { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.mini-figures dt { color: var(--muted); }
.mini-figures dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }
.mini-note.warn { color: var(--warn); }
.mini-note.bad { color: var(--danger); }
.library-find { width: min(480px, 100%); }

/* Home: who chose it, notifications, today (docs/DASHBOARD.md). */
.dash-hint { margin: -6px 0 12px; }
.widget-head.fixed { cursor: default; }
.menu-sizes { display: flex; align-items: center; gap: 4px; padding: 4px 8px; }
.menu-sizes .muted { margin-inline-end: 4px; }
.menu-sizes button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.notices { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notice { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.notice-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.notice.bad .notice-icon { background: var(--danger-soft); color: var(--danger); }
.notice.warn .notice-icon { background: var(--warn-soft); color: var(--warn); }
.notice.info .notice-icon { background: var(--info-soft); color: var(--info); }
.notice-text { min-width: 0; }
.notice-tone { font-weight: 600; }
.notice-amount { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.today { display: grid; gap: 2px; }
.today strong { font-size: 16px; }

/* Choose the Home dashboard. */
.dash-setup { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .dash-setup { grid-template-columns: minmax(0, 1fr); } }
.dash-setup input[type="search"] { width: 100%; margin-bottom: 12px; }
.picker { display: grid; gap: 14px; max-height: 70vh; overflow: auto; padding-inline-end: 4px; }
.pick-group h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pick { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; padding: 6px 4px; border-radius: var(--radius-xs); cursor: pointer; align-items: start; }
.pick:hover { background: var(--accent-soft); }
.pick input { margin-top: 3px; }
.pick-reports { border-top: 1px solid var(--border); padding: 4px 0; }
.pick-reports summary { cursor: pointer; padding: 4px; font-weight: 600; }
.block { display: block; }
.chosen { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chosen-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.chosen-moves { display: inline-flex; gap: 4px; }
@media (max-width: 560px) { .chosen-row { grid-template-columns: minmax(0, 1fr); } }
.dash.preview { gap: 8px; }
.preview-box { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 2px; min-height: 56px; background: var(--surface); }
.preview-box.xl { min-height: 64px; }
.preview-box.unavailable { opacity: .55; }
.dash.preview > .preview-box.xl { grid-column: span 12; }
.dash.preview > .preview-box.l { grid-column: span 8; }
.dash.preview > .preview-box.m { grid-column: span 6; }
.dash.preview > .preview-box.s { grid-column: span 4; }
.seg a[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.seg a { border: 0; border-radius: 0; }
a.menu-item { display: flex; padding: 7px 10px; border-radius: var(--radius-xs); color: inherit; text-decoration: none; }

/* Update the chart from a sheet: the ready charts side by side. */
.tpl-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tpl { display: grid; gap: 6px; align-content: start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.tpl p { margin: 0; }
details > summary { cursor: pointer; }
details ul { margin: 6px 0 0; padding-inline-start: 18px; max-height: 260px; overflow: auto; }
.dept-l1 { padding-inline-start: 18px; } .dept-l2 { padding-inline-start: 36px; } .dept-l3 { padding-inline-start: 54px; } .dept-l4 { padding-inline-start: 72px; }

/* The asset register (docs/ASSETS.md). */
.badge.FULLY_DEPRECIATED, .badge.COMPLETED { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.NOT_CAPITALISED, .badge.PLANNED { background: var(--surface-2); color: var(--muted); }
.badge.DISPOSED, .badge.CANCELLED { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

/* Acting on many entries at once (approvals inbox, journal entries). */
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px dashed var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
.bulk-bar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
th input[type=checkbox], td input[type=checkbox] { width: 16px; height: 16px; margin: 0; cursor: pointer; }

/* Approval rules and the roles editor. */
.rule-options { display: grid; gap: 8px; }
.rule-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s); cursor: pointer; }
.rule-option > input[type=radio] { flex: none; width: 17px; height: 17px; margin: 2px 0 0; }
.rule-option > span { flex: 1; min-width: 0; }
.rule-option input[type=number] { display: inline-block; width: 130px; min-height: 30px; padding: 3px 8px; margin: 0 4px; text-align: end; font-variant-numeric: tabular-nums; }
.rule-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rule-option .muted { display: block; margin-top: 2px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; max-height: 52vh; overflow: auto; padding: 2px; }
.perm-grid .check { align-items: flex-start; }
.perm-grid .check small { display: block; color: var(--muted); font-weight: 400; }

/* KPI components: the financial position on the dashboard (app.js wPosition, docs/DESIGN_SYSTEM.md "KPIs"). */
.fp-hero { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.fp-figure { display: grid; gap: 4px; align-content: start; padding: 16px 18px; color: inherit; background: var(--surface); }
.fp-figure + .fp-figure { border-inline-start: 1px solid var(--border); }
a.fp-figure:hover { text-decoration: none; background: var(--row-hover); }
.fp-label { font-size: var(--fs-s); font-weight: 500; color: var(--muted); }
.fp-value { font: 700 var(--fs-kpi)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--heading); font-variant-numeric: tabular-nums lining-nums; }
.fp-figure.lead .fp-value { font-size: var(--fs-hero); }
.fp-value.neg { color: var(--negative); }
.fp-sub { font-size: 12px; color: var(--muted); }
.fp-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.fp-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 10px; align-content: start; background: var(--surface); }
.fp-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fp-panel h3 { font: 700 13.5px/1.3 var(--font-display); color: var(--heading); }
.fp-lines { margin: 0; display: grid; gap: 6px; }
.fp-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.fp-line dt { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-line dd { margin: 0; font-weight: 600; text-align: end; white-space: nowrap; }
.fp-line dd.strong { font-weight: 700; color: var(--heading); }
.fp-line:has(dd.strong) { border-top: 1px solid var(--border); padding-top: 6px; }
.warn-text { color: var(--warn); }
.fp-budget { display: grid; gap: 10px; }
.fp-bva { display: grid; gap: 4px; }
.fp-bva-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.fp-track { position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); }
.fp-fill { position: absolute; inset-block: 0; inset-inline: 0 auto; width: var(--w, 0%); border-radius: 3px; background: var(--series-1); }
.fp-target { position: absolute; top: -3px; bottom: -3px; inset-inline-start: 80%; width: 2px; background: var(--brand); }
@media (prefers-color-scheme: dark) { .fp-fill { background: var(--series-2); } }
@media (max-width: 1180px) {
  .fp-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fp-figure:nth-child(4) { border-inline-start: 0; }
  .fp-figure:nth-child(n+4) { border-top: 1px solid var(--border); }
  .fp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .fp-hero, .fp-grid { grid-template-columns: minmax(0, 1fr); }
  .fp-figure + .fp-figure { border-inline-start: 0; border-top: 1px solid var(--border); }
  .fp-figure.lead .fp-value { font-size: var(--fs-kpi); }
}
@media (max-width: 1280px) {
  .fp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .fp-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fp-figure + .fp-figure { border-inline-start: 0; }
  .fp-figure { border-top: 1px solid var(--border); }
  .fp-figure.lead { grid-column: 1 / -1; border-top: 0; }
  .fp-figure:nth-child(odd):not(.lead) { border-inline-start: 1px solid var(--border); }
  .fp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .fp-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------------------
   Arabic, right to left (docs/ARABIC.md, "The page in Arabic"). The layout above
   is written in logical properties (inline start and end), so it mirrors by
   itself under <html dir="rtl">; what follows is what does not: the typeface
   order, the coloured stripe on notes, arrows that point the way to go, and
   figures, codes and references, which always read left to right inside the
   Arabic line.
   --------------------------------------------------------------------------- */
:root[lang=ar] {
  --font-display: "IBM Plex Sans Arabic", "Manrope", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-ui: "IBM Plex Sans Arabic", "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
:root[lang=ar] body { font-feature-settings: normal; line-height: 1.6; }
/* Arabic letters are never spaced apart or set in capitals. */
:root[lang=ar] h1, :root[lang=ar] h2, :root[lang=ar] .eyebrow, :root[lang=ar] .kpi-label, :root[lang=ar] th { letter-spacing: 0; text-transform: none; }
[dir=rtl] .note { box-shadow: inset -3px 0 0 var(--border-strong); }
[dir=rtl] .note.ok { box-shadow: inset -3px 0 0 var(--brand); }
[dir=rtl] .note.warn { box-shadow: inset -3px 0 0 #D97706; }
[dir=rtl] .note.bad { box-shadow: inset -3px 0 0 var(--danger-fill); }
[dir=rtl] .note.info { box-shadow: inset -3px 0 0 #2563EB; }
[dir=rtl] table.lines tr.flag td:first-child { box-shadow: inset -3px 0 0 var(--warn); }
/* Icons that point the way (forward, back, open in a side panel) turn round. */
[dir=rtl] svg.icon.flip { transform: scaleX(-1); }
/* Figures, codes, references, IBANs, e-mail addresses and dates keep their left-to-right order inside Arabic text. */
[dir=rtl] td.num, [dir=rtl] th.num, [dir=rtl] .mono, [dir=rtl] code, [dir=rtl] .bar-value, [dir=rtl] .meter-label,
[dir=rtl] .mini-figures dd, [dir=rtl] .fp-line dd, [dir=rtl] .kpi .value, [dir=rtl] .big-number, [dir=rtl] .amount, [dir=rtl] .notice-amount, [dir=rtl] .chart-tip .v { unicode-bidi: isolate; direction: ltr; }
[dir=rtl] td.num, [dir=rtl] th.num { text-align: left; }
[dir=rtl] input.num, [dir=rtl] input[type=email], [dir=rtl] input[type=url], [dir=rtl] input[inputmode=decimal], [dir=rtl] input[inputmode=numeric],
[dir=rtl] input[name=code], [dir=rtl] input[name$=Code], [dir=rtl] input[name=iban], [dir=rtl] input[name=vatNumber], [dir=rtl] input[name=crNumber] { direction: ltr; text-align: right; }
[dir=rtl] input[type=date] { direction: ltr; text-align: right; }
/* The English name box stays left to right; the Arabic one is always right to left (both directions show both). */
input[name=nameAr], textarea[name=nameAr], input[name$=Ar] { direction: rtl; }
[dir=rtl] input[name=nameEn] { direction: ltr; text-align: right; }
/* Charts are drawn left to right (time runs that way in both languages); their legends follow the page. */
[dir=rtl] svg.chart, [dir=rtl] .chart-svg { direction: ltr; }
.lang-switch { gap: 6px; }
.lang-switch[lang=ar] span { font-family: "IBM Plex Sans Arabic", var(--font-ui); font-weight: 600; }
.appbar .lang-switch { color: var(--bar-text); border-color: rgb(255 255 255 / 16%); }
.appbar .lang-switch:hover { background: rgb(255 255 255 / 8%); }
.signin-lang { display: flex; justify-content: flex-end; }

/* Report choices (docs/REPORTS.md, "Core reports and add-ons") */
.section-title { font-size: var(--fs-xl); margin-block: 18px 8px; }
.choice-list > li.choice { display: grid; gap: 4px; }
.choice-list > li.choice:last-child { border-bottom: 0; }
.choice-list .check { font-weight: 600; }
