@import url("/css/fonts.css");   /* IBM Plex Sans + Mono — the design system type (29/10/2026) */
/* ═══════════════════════════════════════════════════════════════════════════
   theme.css — cross-page theme glue (loaded on every themed page, LAST).

   js/theme.js sets BOTH html[data-theme] and body.theme-light|dark, so rules here
   can use either. Page token sets stay where they are (ciq.css for the admin
   pages, exco.css for EXCO); this file adds what every page needs on top:
     • --on-accent: text colour that stays readable on the accent fill in both themes
     • one :focus-visible ring for every interactive element
     • theme-safe shared components (toast, callouts, soft badges, secondary buttons)
   Values always fall back through the page's own token names, then a safe literal.
   ═══════════════════════════════════════════════════════════════════════════ */

:root                    { --on-accent: #FFFFFF; }
html[data-theme="dark"]  { --on-accent: #06201E; }   /* #2DD4BF teal is light — needs dark text */

/* ── Keyboard focus (there was no :focus-visible style on buttons anywhere) ─── */
:where(button, .btn, a, [role="button"], [role="tab"], input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--accent, var(--primary, #0B7A75));
  outline-offset: 2px;
}

/* ── Toast: was white text on var(--text) — 1.5:1 in dark mode ──────────── */
.toast {
  padding: 11px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 10px 28px rgba(0,0,0,.25);   /* layout for pages without style.css */
  background: var(--surface, #FFFFFF) !important;
  color: var(--text, #1C2526) !important;
  border: 1px solid var(--border, #E3E7EB);
  border-left: 4px solid var(--text-muted, var(--muted, #6E7781));
}
.toast.success, .toast.toast-success { border-left-color: var(--success, var(--green, #1A7F37)); }
.toast.error,   .toast.toast-error   { border-left-color: var(--danger,  var(--red,   #CF222E)); }
.toast.info,    .toast.toast-info    { border-left-color: var(--accent,  var(--blue,  #0B7A75)); }
.toast.warning, .toast.toast-warning { border-left-color: var(--warning, var(--amber, #BC4C00)); }
/* Error toasts stay until dismissed: message + a real close button (24×24 target minimum) */
.toast.toast-sticky { display: flex; align-items: flex-start; gap: 10px; }
.toast.toast-sticky .toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-x {
  flex: none; min-width: 28px; min-height: 28px; margin: -5px -6px -5px 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: var(--text-muted, #636C76); font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
}
.toast .toast-x:hover { color: var(--text, #1C2526); background: var(--surface2, rgba(0,0,0,.06)); }
.toast .toast-x:focus-visible { outline: 2px solid var(--accent, var(--primary, #0B7A75)); outline-offset: 1px; }

/* ── Callouts: replaces hard-coded pastel boxes (#f0fdf4, #fffbeb, #eff6ff …) ── */
.callout { border-radius: var(--radius-sm, 10px); padding: 10px 14px; font-size: 12.5px; color: var(--text, #1C2526); border: 1px solid transparent; }
.callout-success { background: var(--success-soft, rgba(26,127,55,.13)); border-color: var(--success-soft, rgba(26,127,55,.13)); }
.callout-warning { background: var(--warning-soft, rgba(188,76,0,.13));  border-color: var(--warning-soft, rgba(188,76,0,.13)); }
.callout-danger  { background: var(--danger-soft,  rgba(207,34,46,.13)); border-color: var(--danger-soft,  rgba(207,34,46,.13)); }
.callout-info    { background: var(--info-soft,    rgba(9,105,218,.13)); border-color: var(--info-soft,    rgba(9,105,218,.13)); }
.callout-purple  { background: var(--purple-soft,  rgba(130,80,223,.13)); border-color: var(--purple-soft, rgba(130,80,223,.13)); }
.callout-muted   { background: var(--surface2, #F6F8FA); border-color: var(--border, #E3E7EB); }

/* ── Soft badges (tint, don't fill) ─────────────────────────────────────── */
.badge-soft { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-soft.success { background: var(--success-soft, rgba(26,127,55,.13)); color: var(--success, #1A7F37); }
.badge-soft.warning { background: var(--warning-soft, rgba(188,76,0,.13));  color: var(--warning, #BC4C00); }
.badge-soft.danger  { background: var(--danger-soft,  rgba(207,34,46,.13)); color: var(--danger,  #CF222E); }
.badge-soft.info    { background: var(--info-soft,    rgba(9,105,218,.13)); color: var(--info,    #0969DA); }
.badge-soft.purple  { background: var(--purple-soft,  rgba(130,80,223,.13)); color: var(--purple, #8250DF); }
.badge-soft.muted   { background: var(--muted-soft,   rgba(110,119,129,.13)); color: var(--text-muted, var(--muted, #6E7781)); }

/* ── Modal / panel surfaces rendered by shared widgets ───────────────────── */
.theme-surface   { background: var(--surface, #FFFFFF) !important; color: var(--text, #1C2526) !important; border-color: var(--border, #E3E7EB) !important; }
.theme-surface-2 { background: var(--surface2, #F6F8FA) !important; color: var(--text, #1C2526) !important; }

/* ── Standalone pages (portal, EDC portal, procurement, pay office, contribution)
   don't load ciq.css; <html class="vq-tokens"> gives them the same token palette,
   light and dark. (Pages can still opt out with <html data-theme-lock="light">.) ── */
html.vq-tokens body, html[data-theme-lock="light"] body {
  --bg: #F6F8FA; --surface: #FFFFFF; --surface2: #F6F8FA; --border: #E3E7EB;
  --text: #1C2526; --text-mid: #424A53; --text-muted: #6E7781;
  --accent: #0B7A75; --primary: #0B7A75; --primary-hover: #0A6A66; --accent-soft: rgba(11,122,117,.10);
  --success: #1A7F37; --warning: #BC4C00; --danger: #CF222E; --info: #0969DA; --purple: #8250DF;
  --success-soft: rgba(26,127,55,.13); --warning-soft: rgba(188,76,0,.13); --danger-soft: rgba(207,34,46,.13);
  --info-soft: rgba(9,105,218,.13); --purple-soft: rgba(130,80,223,.13); --muted-soft: rgba(110,119,129,.13);
  background: var(--bg); color: var(--text);
}
html.vq-tokens[data-theme="dark"] body {
  --bg: #010409; --surface: #161B22; --surface2: #21262D; --border: #30363D;
  --text: #C9D1D9; --text-mid: #8B949E; --text-muted: #8B949E;
  --accent: #2DD4BF; --primary: #2DD4BF; --primary-hover: #5EEAD4; --accent-soft: rgba(45,212,191,.14);
  --success: #3FB950; --warning: #FB923C; --danger: #F85149; --info: #58A6FF; --purple: #A371F7;
  --success-soft: rgba(63,185,80,.15); --warning-soft: rgba(251,146,60,.15); --danger-soft: rgba(248,81,73,.15);
  --info-soft: rgba(88,166,255,.15); --purple-soft: rgba(163,113,247,.15); --muted-soft: rgba(139,148,158,.15);
}
/* Form controls on standalone pages follow the theme */
html.vq-tokens[data-theme="dark"] :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  background-color: var(--surface2); color: var(--text); border-color: var(--border);
}
html.vq-tokens[data-theme="dark"] ::placeholder { color: var(--text-muted); }

/* ── Phone layout safety net (all portals) ─────────────────────────────────────
   The main column is a flex item: without min-width:0 one wide child (a long
   banner, a topbar that won't wrap, a wide table) widens the whole page. */
.main { min-width: 0; }
@media (max-width: 760px) {
  .topbar, .app-header { flex-wrap: wrap; height: auto; min-height: 56px; row-gap: 8px; }
  .topbar-left, .topbar-right { flex-wrap: wrap; min-width: 0; }
  .topbar-right { width: 100%; justify-content: flex-start; }
  .app-header { padding-top: 8px; padding-bottom: 8px; }
  #cdc-alert-banner, #cdc-expiry-banner, .cdc-alert-banner { max-width: 100%; overflow-wrap: anywhere; }
  #cdc-alert-banner *, #cdc-expiry-banner *, .cdc-alert-banner * { flex-wrap: wrap; min-width: 0; }
  .fin-card, .stat-card, .kpi-card { min-width: 0; }
  .fin-card .fc-val, .stat-card .stat-val, .stat-card .stat-value { overflow-wrap: anywhere; }
  canvas { max-width: 100% !important; }
  .tab-nav, .tabs, .tab-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 760px) {
  .sec-actions, .sec-header, .toolbar, .filter-bar, .po-filter-bar { flex-wrap: wrap; }
  input, select, textarea { max-width: 100%; }
}
@media (max-width: 520px) {
  /* Two-column form rows written inline stack on phones (inputs can't shrink below their intrinsic width) */
  [style*="grid-template-columns:1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}
/* Hover tooltips can't be hovered on phones, and their hidden (opacity:0) boxes still widen
   the page near the right edge — don't render them on touch / narrow screens. */
@media (hover: none), (max-width: 760px) {
  [data-tooltip]::after, [data-tooltip]::before, [data-tip]::after, [data-tip]::before { display: none !important; }
}

/* ── One KPI card language across portals ──────────────────────────────────────
   Each portal grew its own card class (.stat-card, .fin-card, .kpi-card, .stat-tile).
   Keep their colour accents, but share shape and type: rounded 12px, tabular figures,
   bold values, small uppercase muted labels — the EXCO card style. */
:is(.stat-card, .fin-card, .kpi-card, .stat-tile) { border-radius: 12px; }
:is(.stat-card .stat-val, .stat-card .stat-value, .fin-card .fc-val, .kpi-card .kpi-val, .kpi-card .kpi-value, .stat-tile .stat-n) {
  font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.15;
}
:is(.stat-card .stat-lbl, .stat-card .stat-label, .fin-card .fc-lbl, .kpi-card .kpi-lbl, .kpi-card .kpi-label, .stat-tile .stat-l) {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
:is(.stat-card .stat-sub, .fin-card .fc-sub, .kpi-card .kpi-sub) { font-size: 11.5px; }

/* ── Readability floor (UI review 19/10/2026) ──────────────────────────────────
   The older pages set sizes inline (9–11px labels). Nothing below 11px anywhere;
   11px lifts to 11.5px. Small print in tables stays readable. */
[style*="font-size:7px"], [style*="font-size: 7px"], [style*="font-size:8px"], [style*="font-size: 8px"],
[style*="font-size:9px"], [style*="font-size: 9px"], [style*="font-size:9.5px"], [style*="font-size: 9.5px"],
[style*="font-size:10px"], [style*="font-size: 10px"], [style*="font-size:10.5px"], [style*="font-size: 10.5px"] { font-size: 11px !important; }
[style*="font-size:11px"], [style*="font-size: 11px"] { font-size: 11.5px !important; }
table small, td small, th small { font-size: max(11px, .85em); }

/* Money and counts line up in every table: even-width digits */
td, th { font-variant-numeric: tabular-nums; }

/* Visible keyboard focus everywhere (buttons, links, chart bars, legend items) */
:is(button, a, [role="button"], [tabindex="0"], select, input, textarea):focus-visible {
  outline: 2px solid var(--accent, #0d9488); outline-offset: 2px;
}

/* Phones: comfortable tap targets for buttons, tabs and menu items */
@media (max-width: 640px) {
  :is(.btn, button.btn, .tab-btn, .nav-item, .tab, [role="tab"]) { min-height: 40px; }
  :is(.btn-sm, .btn.btn-sm) { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 40px; font-size: 16px; } /* 16px stops phones zooming in */
}

/* ── Shared utility classes (UI review 19/10/2026) ───────────────────────────────
   The older pages' repeated inline styles moved onto these. Spacing and alignment use !important to keep
   the strength of the inline style they replace; colour and type stay overridable by scripts; 11px text keeps the readability floor (11.5px). */
.u-bb { border-bottom: 1px solid var(--border) !important; }
.u-bt { border-top: 1px solid var(--border) !important; }
html body .u-c-accent { color: var(--accent); }
html body .u-c-danger { color: var(--danger); }
html body .u-c-info { color: var(--info); }
html body .u-c-primary { color: var(--primary); }
html body .u-c-purple { color: var(--purple); }
html body .u-c-success { color: var(--success); }
html body .u-c-text { color: var(--text); }
html body .u-c-text-mid { color: var(--text-mid); }
html body .u-c-text-muted { color: var(--text-muted); }
html body .u-c-warning { color: var(--warning); }
.u-center { text-align: center !important; }
html body .u-fs11 { font-size: 11.5px; }
html body .u-fs11_5 { font-size: 11.5px; }
html body .u-fs12 { font-size: 12px; }
html body .u-fs12_5 { font-size: 12.5px; }
html body .u-fs13 { font-size: 13px; }
html body .u-fs14 { font-size: 14px; }
html body .u-fw500 { font-weight: 500; }
html body .u-fw600 { font-weight: 600; }
html body .u-fw700 { font-weight: 700; }
html body .u-fw800 { font-weight: 800; }
.u-left { text-align: left !important; }
.u-m0 { margin: 0 !important; }
.u-mb0 { margin-bottom: 0 !important; }
.u-mb10 { margin-bottom: 10px !important; }
.u-mb12 { margin-bottom: 12px !important; }
.u-mb14 { margin-bottom: 14px !important; }
.u-mb16 { margin-bottom: 16px !important; }
.u-mb20 { margin-bottom: 20px !important; }
.u-mb24 { margin-bottom: 24px !important; }
.u-mb4 { margin-bottom: 4px !important; }
.u-mb5 { margin-bottom: 5px !important; }
.u-mb6 { margin-bottom: 6px !important; }
.u-mb8 { margin-bottom: 8px !important; }
.u-mt0 { margin-top: 0 !important; }
.u-mt10 { margin-top: 10px !important; }
.u-mt12 { margin-top: 12px !important; }
.u-mt14 { margin-top: 14px !important; }
.u-mt16 { margin-top: 16px !important; }
.u-mt20 { margin-top: 20px !important; }
.u-mt24 { margin-top: 24px !important; }
.u-mt4 { margin-top: 4px !important; }
.u-mt5 { margin-top: 5px !important; }
.u-mt6 { margin-top: 6px !important; }
.u-mt8 { margin-top: 8px !important; }
.u-nowrap { white-space: nowrap !important; }
.u-p10 { padding: 10px !important; }
.u-p10x12 { padding: 10px 12px !important; }
.u-p12 { padding: 12px !important; }
.u-p16 { padding: 16px !important; }
.u-p4x8 { padding: 4px 8px !important; }
.u-p5x8 { padding: 5px 8px !important; }
.u-p6x8 { padding: 6px 8px !important; }
.u-p7x12 { padding: 7px 12px !important; }
.u-p8 { padding: 8px !important; }
.u-p8x12 { padding: 8px 12px !important; }
.u-right { text-align: right !important; }
.u-scroll-x { overflow-x: auto !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   VendorIQ design system (29/10/2026) — one look for every page.
   Typography  IBM Plex Sans for all UI, navigation and body text; IBM Plex Mono only for
               financial figures, numeric table columns and system identifiers (job references,
               IDs). Self-hosted (public/vendor/fonts, SIL OFL) — no outside font servers.
   Dark theme  deep solid black page; dark slate heroes and cards with a subtle glass; a
               professional teal for primary actions; pure white primary text; light slate
               secondary text and labels; vivid green / amber / red for states.
   Everything maps onto the token names the older stylesheets already use (style.css,
   ciq.css, exco.css, glass.css, html.vq-tokens), so every page follows without edits.
   ═══════════════════════════════════════════════════════════════════════════ */
/* Fonts, the family rule and Plex Mono for figures: css/fonts.css (imported at the top of this file) */

/* Headings: one hierarchy — heading, sub-heading, body */
html body :is(h1, .topbar-title, .page-title) { font-weight: 600; letter-spacing: -.015em; }
html body h2 { font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
html body h3 { font-weight: 600; line-height: 1.35; }
html body :is(h2, h3, .sec) small { font-weight: 400; color: var(--text-muted, #6E7781); font-size: var(--vq-fs-small); letter-spacing: 0; }

/* ── The dark theme: black, slate, teal, white ───────────────────────────── */
html[data-theme="dark"] { background: #000000; color-scheme: dark; }
html.vq-tokens[data-theme="dark"] body, html[data-theme="dark"] body, html body.theme-dark {
  --bg: #000000; --surface: #141A22; --surface2: #1C2430; --border: #2A3441; --border2: #344052;
  --vq-hero: linear-gradient(135deg, rgba(30,41,56,.94) 0%, rgba(20,26,34,.94) 60%, rgba(13,62,58,.60) 100%);
  --vq-glass: rgba(20,26,34,.74); --vq-glass-border: rgba(148,163,184,.16);
  --text: #FFFFFF; --text-mid: #CBD5E1; --text-muted: #94A3B8; --muted: #94A3B8; --muted2: #64748B;
  --accent: #14B8A6; --primary: #14B8A6; --primary-hover: #2DD4BF; --accent-soft: rgba(20,184,166,.16); --on-accent: #03201D;
  --brand-dark: #0F766E; --brand-light: #2DD4BF; --secondary: #CBD5E1; --sidebar-bg: #07090C; --sidebar-active: rgba(20,184,166,.16);
  --success: #22C55E; --warning: #F59E0B; --danger: #EF4444; --info: #38BDF8; --purple: #A78BFA;
  --green: #22C55E; --amber: #F59E0B; --red: #EF4444; --blue: #38BDF8; --cyan: #22D3EE;
  --success-soft: rgba(34,197,94,.16); --warning-soft: rgba(245,158,11,.16); --danger-soft: rgba(239,68,68,.16);
  --info-soft: rgba(56,189,248,.16); --purple-soft: rgba(167,139,250,.16); --muted-soft: rgba(148,163,184,.14);
  --green-dim: rgba(34,197,94,.16); --amber-dim: rgba(245,158,11,.16); --red-dim: rgba(239,68,68,.16); --blue-dim: rgba(56,189,248,.16);
  --cyan-dim: rgba(34,211,238,.16); --purple-dim: rgba(167,139,250,.16);
  --glass-bg: var(--vq-glass); --glass-bg-dark: var(--vq-glass); --glass-border: var(--vq-glass-border); --glass-border-dark: var(--vq-glass-border);
  --chart-grid: rgba(148,163,184,.14); --chart-tick: #94A3B8; --tip-bg: #141A22; --tip-border: #2A3441; --tip-title: #FFFFFF; --tip-body: #CBD5E1;
  --shadow: 0 1px 2px rgba(0,0,0,.6); --shadow-sm: 0 1px 2px rgba(0,0,0,.5); --shadow-lg: 0 18px 40px rgba(0,0,0,.55);
  --card-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.45);
  /* names some pages use that were never defined */
  --card-bg: var(--surface); --surface-alt: var(--surface2); --bg-secondary: var(--surface2); --border-strong: var(--border2);
  background: #000000 !important; color: #FFFFFF;
}
/* The same three names in the light theme */
:root { --card-bg: var(--surface, #FFFFFF); --surface-alt: var(--surface2, #F6F8FA); --bg-secondary: var(--surface2, #F6F8FA); }
/* Cards and panels: dark slate glass with a hair-line border */
html[data-theme="dark"] body :is(.card, .kpi, .stat-card, .fin-card, .kpi-card, .stat-tile, .tablecard, .report, .panel, .section-card, .bd-page, .bd-tile, .bd-big, .vqtr-card, .bp-slide, dialog, .modal, .modal-content, .wn-box) {
  background-color: var(--vq-glass) !important; border-color: var(--vq-glass-border) !important;
  -webkit-backdrop-filter: blur(12px) saturate(120%) !important; backdrop-filter: blur(12px) saturate(120%) !important;   /* ciq.css turns glass off with !important */
  box-shadow: 0 1px 0 rgba(255,255,255,.035) inset, 0 12px 32px rgba(0,0,0,.42);
}
html[data-theme="dark"] body :is(.bd-tile, .bd-big, .kpi, .stat-card, .kpi-card) { background-color: rgba(28,36,48,.74) !important; }
/* Heroes: the page's opening band — what it is, the period, the key figure */
.vq-hero { border-radius: 16px; padding: 22px 24px; margin-bottom: 18px; border: 1px solid var(--border, #E3E7EB);
  background: linear-gradient(135deg, var(--accent-soft, rgba(11,122,117,.10)), transparent 70%), var(--surface, #fff); }
.vq-hero h1 { margin: 0 0 4px; } .vq-hero p { margin: 0; color: var(--text-mid, #424A53); max-width: 72ch; }
html[data-theme="dark"] body :is(.vq-hero, .intro, .bd-cover) { background: var(--vq-hero) !important; color: #FFFFFF; }
html[data-theme="dark"] body :is(.vq-hero, .intro) { border: 1px solid var(--vq-glass-border) !important; border-radius: 14px; }
html[data-theme="dark"] body .intro { padding: 14px 18px; }
/* Bars, tables, inputs, buttons */
html[data-theme="dark"] body :is(.topbar, .app-header, .bv-top) { background: rgba(0,0,0,.84) !important; border-color: var(--border) !important;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
html[data-theme="dark"] body :is(.sidebar, aside.sidebar, #sidebar, .side-nav, .vq-side) { background: #07090C !important; border-color: #1C2430 !important; }
html[data-theme="dark"] body th { background: #101620 !important; color: #94A3B8 !important; border-color: var(--border) !important; }
html[data-theme="dark"] body td { border-color: rgba(148,163,184,.10) !important; }
html[data-theme="dark"] body tbody tr:hover td { background: rgba(20,184,166,.05); }
html[data-theme="dark"] body :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  background-color: #0B1017 !important; color: #FFFFFF !important; border-color: #2A3441 !important; }
html[data-theme="dark"] body :is(input, select, textarea):focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(20,184,166,.22); }
html[data-theme="dark"] body label { color: var(--text-mid); }
html[data-theme="dark"] body :is(.btn-primary, .bd-btn-p, .wn-ok) { background: #14B8A6 !important; border-color: #14B8A6 !important; color: #03201D !important; font-weight: 600; }
html[data-theme="dark"] body :is(.btn-primary, .bd-btn-p, .wn-ok):hover { background: #2DD4BF !important; border-color: #2DD4BF !important; }
html[data-theme="dark"] body :is(.btn, .bd-btn):not(.btn-primary):not(.bd-btn-p) { background-color: rgba(28,36,48,.85); border-color: #344052; color: #FFFFFF; }
html[data-theme="dark"] body :is(.muted, .kpi-s, .kpi-l, .bd-tile-l, .bd-tile-s, .hint) { color: #94A3B8 !important; }
/* State pills: vivid on dark, always with the word */
html[data-theme="dark"] body :is(.pill.t-good, .bd-ok) { background: rgba(34,197,94,.16) !important; color: #4ADE80 !important; }
html[data-theme="dark"] body :is(.pill.t-warn, .bd-check) { background: rgba(245,158,11,.16) !important; color: #FBBF24 !important; }
html[data-theme="dark"] body :is(.pill.t-bad, .bd-gap) { background: rgba(239,68,68,.16) !important; color: #F87171 !important; }
/* Safety net: light boxes written inline in older pages become slate on dark */
html[data-theme="dark"] body :is([style*="background:#fff"], [style*="background: #fff"], [style*="background:#FFF"], [style*="background:white"], [style*="background: white"],
  [style*="background:#f8fafc"], [style*="background: #f8fafc"], [style*="background:#f9fafb"], [style*="background:#f1f5f9"], [style*="background:#f3f4f6"], [style*="background:#fafafa"],
  [style*="background:#f6f8fa"], [style*="background:#F6F8FA"], [style*="background:#eef2ff"], [style*="background:#f0fdf4"], [style*="background:#fffbeb"], [style*="background:#fef2f2"], [style*="background:#ecfeff"]) {
  background: rgba(28,36,48,.74) !important; color: #FFFFFF !important; border-color: var(--vq-glass-border) !important; }
html[data-theme="dark"] body :is([style*="color:#111"], [style*="color: #111"], [style*="color:#1f2937"], [style*="color:#1C2526"], [style*="color:#1c2526"], [style*="color:#374151"], [style*="color:#0f172a"], [style*="color:#334155"], [style*="color:#000"]) { color: #FFFFFF !important; }
html[data-theme="dark"] body :is([style*="color:#6b7280"], [style*="color:#6E7781"], [style*="color:#6e7781"], [style*="color:#64748b"], [style*="color:#475569"]) { color: #94A3B8 !important; }
html[data-theme="dark"] body :is([style*="background:#E3E7EB"], [style*="background: #E3E7EB"], [style*="background:#e5e7eb"], [style*="background:#d1d5db"], [style*="background:#f5f5f5"]) { background: #2A3441 !important; }
/* ═══ Reporting kit (29/10/2026): one KPI tile, one status pill, one number column, one hero — whatever class a page
   grew. Pages keep their markup; these rules give every family the same shape and the same state colours.
   States: good = green (met, paid, OK), info = teal (on pace, confirmed, in a batch), warn = amber (behind, waiting),
   bad = red (missed, rejected), none = slate (not started, no target). Always with the word, never colour alone. ═══ */

/* Status pills */
/* (choice pills — buttons inside a .pills group, e.g. the portal's banks — keep their own look) */
html body :is(.pill:not(button):not(.pills > *), .badge-soft, .bc-pill, [class^="s-pill-"], [class*=" s-pill-"],
  .s-CAPTURED, .s-AWAITING_BANK, .s-BANK_REJECTED, .s-CONFIRMED, .s-IN_BATCH, .s-WITH_PAY_OFFICE, .s-PAID,
  .s-MET, .s-ON_PACE, .s-BEHIND, .s-MISSED, .s-NONE) {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 600;
  line-height: 1.5; white-space: nowrap; letter-spacing: .01em; border: 1px solid transparent;
}
html body :is(.pill.t-good, .s-PAID, .s-MET, .s-pill-met, .badge-soft.success) { background: var(--success-soft) !important; color: var(--success) !important; border-color: color-mix(in srgb, var(--success) 35%, transparent) !important; }
html body :is(.pill.t-info, .s-CONFIRMED, .s-IN_BATCH, .s-WITH_PAY_OFFICE, .s-ON_PACE, .s-pill-pace, .badge-soft.info) { background: var(--accent-soft) !important; color: var(--accent) !important; border-color: color-mix(in srgb, var(--accent) 35%, transparent) !important; }
html body :is(.pill.t-warn, .s-AWAITING_BANK, .s-BEHIND, .s-pill-behind, .badge-soft.warning) { background: var(--warning-soft) !important; color: var(--warning) !important; border-color: color-mix(in srgb, var(--warning) 35%, transparent) !important; }
html body :is(.pill.t-bad, .s-BANK_REJECTED, .s-MISSED, .s-pill-missed, .badge-soft.danger) { background: var(--danger-soft) !important; color: var(--danger) !important; border-color: color-mix(in srgb, var(--danger) 35%, transparent) !important; }
html body :is(.s-CAPTURED, .s-NONE, .s-pill-none, .s-pill-total, .badge-soft.muted) { background: var(--muted-soft, rgba(110,119,129,.13)) !important; color: var(--text-mid, var(--text-muted)) !important; border-color: var(--border) !important; }
/* Light theme: the state's own colour is a touch dark for small text on a tint — keep it readable */
html:not([data-theme="dark"]) body :is(.pill.t-good, .s-PAID, .s-MET, .s-pill-met) { color: #116329 !important; }
html:not([data-theme="dark"]) body :is(.pill.t-warn, .s-AWAITING_BANK, .s-BEHIND, .s-pill-behind) { color: #9A3B00 !important; }
html:not([data-theme="dark"]) body :is(.pill.t-bad, .s-BANK_REJECTED, .s-MISSED, .s-pill-missed) { color: #A40E26 !important; }

/* KPI tiles: label, figure, sub-line — the reports kit (.kpi-l/.kpi-v/.kpi-s), ViQi (.l/.v/.h), the BI kit and the board deck */
html body :is(.kpis, .bd-tiles) { gap: 12px; }
html body :is(.kpi, .bi-kpi, .bd-tile, .summary-box) { border-radius: 14px !important; padding: 14px 16px !important; min-width: 0; }
html body :is(.kpi-l, .kpi .l, .bd-tile-l, .bi-kpi-lbl, .summary-box .lbl) { font-size: 11.5px !important; font-weight: 600 !important; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted) !important; }
html body :is(.kpi-v, .kpi .v, .bd-tile-v, .bi-kpi-val) { font-family: var(--vq-mono) !important; font-size: clamp(19px, 1.9vw, 24px) !important; font-weight: 600 !important; letter-spacing: -.02em; line-height: 1.2; margin: 6px 0 2px !important; font-variant-numeric: tabular-nums; }
html body :is(.kpi-s, .kpi .h, .bd-tile-s, .bi-kpi-meta) { font-size: 12px !important; color: var(--text-muted) !important; line-height: 1.45; }
/* the tone of a tile shows as a slim edge, as on the reports kit */
html body .kpi[data-tone="good"], html body .kpi.t-good { border-left: 3px solid var(--success) !important; }
html body .kpi[data-tone="warn"], html body .kpi.t-warn { border-left: 3px solid var(--warning) !important; }
html body .kpi[data-tone="bad"], html body .kpi.t-bad { border-left: 3px solid var(--danger) !important; }

/* Number columns: right-aligned, Plex Mono, even digits — td.r (reports), td.n (ledger, ViQi), .u-right (EXCO) */
html body :is(td.n, th.n, td.u-right, th.u-right) { text-align: right; font-family: var(--vq-mono) !important; font-variant-numeric: tabular-nums; }
html body th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* Hero: the page's opening paragraph becomes a band — what the page is for */
html body main > .intro:first-child, html body .content > .intro:first-child, html body p.intro {
  border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; font-size: 13.5px; line-height: 1.6; color: var(--text-mid, var(--text));
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 65%), var(--surface);
}

/* Section headings: heading, then a quieter sub-heading */
html body h2.sec { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin: 26px 0 12px; }
html body h2.sec small { font-size: 12.5px; font-weight: 400; color: var(--text-muted); }

/* ═══ Accessibility pass (29/10/2026, WCAG 2.2 AA audit) ═══ */
/* Form fields need a visible edge (3:1 against what they sit on — 1.4.11) */
html[data-theme="dark"] body :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]) { border-color: #5B697E !important; }
html.vq-tokens:not([data-theme="dark"]) body :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]) { border-color: #818B98; }
/* Small red text needs to be a little lighter on dark slate (4.5:1) */
html[data-theme="dark"] body :is(.s-BANK_REJECTED, .s-MISSED, .s-pill-missed, .badge-soft.danger, .bd-tile-v.b) { color: #F87171 !important; }
/* Light theme: small state text darkened so it reads on its tint (4.5:1) */
html:not([data-theme="dark"]) body :is(.badge-soft.success, .bd-ok) { color: #116329 !important; }
html:not([data-theme="dark"]) body :is(.badge-soft.warning, .bd-check, .bd-lvl-high) { color: #9A3B00 !important; }
html:not([data-theme="dark"]) body :is(.badge-soft.danger, .bd-gap, .bd-lvl-critical, .bd-conf) { color: #A40E26 !important; }
html:not([data-theme="dark"]) body :is(.pill.t-info, .s-CONFIRMED, .s-IN_BATCH, .s-WITH_PAY_OFFICE, .s-ON_PACE, .s-pill-pace, .badge-soft.info) { color: #08625E !important; }
/* Light secondary text: 5:1 on the pale surface too; dark tertiary text lifted to 4.5:1 */
html.vq-tokens:not([data-theme="dark"]) body, html body.theme-light { --text-muted: #636C76; }
html[data-theme="dark"] body { --muted2: #7C8BA1; }
/* A resolved board comment stays readable */
.bd-c-done { opacity: 1 !important; } .bd-c-done .bd-c-b { color: var(--text-muted); }
/* Steps that are still locked can't be reached (they are inert in the page) */
/* Decorative markers aren't read out */
.vq-side .vq-side-out::after { content: "↗" / ""; }
details.cap-more > summary::before { content: "▸" / ""; }
details.cap-more[open] > summary::before { content: "▾" / ""; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* Skip link (injected by js/side-menu.js) */
.vq-skip { position: absolute; left: 8px; top: -60px; z-index: 2000; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--on-accent) !important; font-weight: 600; text-decoration: none; }
.vq-skip:focus { top: 8px; }
.vq-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Payroll runs in Sage (29/10/2026): VendorIQ's own payroll is read-only — the server refuses these actions (410,
   routes/payroll.ts), so their buttons are hidden. Records stay viewable. Remove this rule if LEGACY_PAYROLL=1 reopens it. */
[onclick*="approvePayslip("],
[onclick*="deleteGrade("],
[onclick*="generateIrp5("],
[onclick*="generatePayslip("],
[onclick*="issueIrp5("],
[onclick*="markPayslipPaid("],
[onclick*="openInitLeaveModal("],
[onclick*="openLeaveTransactionModal("],
[onclick*="runLeaveAccrual("],
[onclick*="runPayrollBatch("],
[onclick*="saveGrade("],
[onclick*="saveLeaveType("],
[onclick*="openGradeModal("],
[onclick*="openLeaveTypeModal("] { display: none !important; }

/* Print stays light and readable whatever the theme */
@media print {
  html[data-theme="dark"], html[data-theme="dark"] body { background: #fff !important; color: #000 !important; }
  html[data-theme="dark"] body * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: none !important; }
  html[data-theme="dark"] body { --vq-glass: #fff; --surface: #fff; --surface2: #F6F8FA; --border: #D0D7DE; --text: #000; --text-mid: #24292F; --text-muted: #57606A; --accent: #0B7A75; }
  html[data-theme="dark"] body :is(.card, .kpi, .bd-page, .bd-tile, .bd-big, .tablecard, .bd-pill, .pill, th) { background: #fff !important; color: #000 !important; border-color: #D0D7DE !important; }
}

/* Toasts sit above the ViQi side panel (.vqa 9100) and its dialogs (9200), so messages are never hidden */
#toast-container { z-index: 9300 !important; }

/* Status badge colours used by Finance / Pay Office JS (badge-success etc.) had no rule, so those badges showed no colour */
.badge.badge-success { background: var(--success-soft, rgba(26,127,55,.13)); color: var(--success); }
.badge.badge-warning { background: var(--warning-soft, rgba(188,76,0,.13)); color: var(--warning); }
.badge.badge-danger  { background: var(--danger-soft, rgba(207,34,46,.13)); color: var(--danger); }
.badge.badge-info    { background: var(--accent-soft); color: var(--accent); }
.badge.badge-secondary { background: var(--surface2); color: var(--text-muted); }

/* ── Download bar (public/js/table-export.js): PDF · Excel · CSV on every AR / AP list ── */
.vqx-bar { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vqx-bar .vqx-label { font-size: 12px; color: var(--text-muted); margin-right: 2px; }
.vqx-bar .vqx-btn { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.vqx-bar .vqx-btn:hover { border-color: var(--accent); color: var(--accent); }
.vqx-bar .vqx-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.vqx-bar .vqx-btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.vqx-row { display: flex; justify-content: flex-end; margin: 0 0 10px; }

/* ── Wide lists: scroll inside the card both ways, header row stays put, first columns frozen (VQFreeze in utils.js) ── */
.vq-scroll { overflow: auto; max-height: calc(100vh - 240px); min-height: 240px; max-width: 100%; border: 1px solid var(--border); border-radius: 10px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.vq-scroll > table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.vq-scroll > table th, .vq-scroll > table td { white-space: nowrap; }
.vq-scroll > table thead th { position: sticky; top: 0; z-index: 3; background: var(--surface2, var(--surface)); }
.vq-scroll > table .vq-frozen { position: sticky; z-index: 2; background: var(--surface); }
.vq-scroll > table thead th.vq-frozen { z-index: 4; background: var(--surface2, var(--surface)); }
.vq-scroll > table .vq-frozen-last { box-shadow: 6px 0 6px -6px rgba(0,0,0,.35); }
.vq-scroll > table td.vq-wrap { white-space: normal; min-width: 160px; max-width: 260px; }

/* ── Clean-up tokens (22/11/2026): colours that were hard-coded with no theme name yet. Each starts at the exact
   value the screens used, so nothing looks different; restyling now means changing it here once. ── */
:root {
  --on-fill: #FFFFFF;                                          /* text and icons on a coloured fill (buttons, badges, dots) */
  --success-border: #BBF7D0; --warning-border: #FDE68A; --info-border: #BFDBFE;
  --danger-border: #FCA5A5;  --accent-border: #99F6E4;  --purple-border: #C4B5FD;   /* borders of soft alert / tint boxes */
  --on-dark: #F1F5F9; --on-dark-2: #CBD5E1; --on-dark-muted: #94A3B8;               /* text on the always-dark panels (menus, heroes) */
  --success-on-dark: #4ADE80; --warning-on-dark: #FBBF24; --danger-on-dark: #FCA5A5; --accent-on-dark: #5EEAD4;
  --dark-bg: #0D1117; --dark-surface: #1E293B; --dark-surface-2: #334155;             /* the always-dark panels themselves */
}
html[data-theme="dark"] body, html body.theme-dark {
  --success-border: rgba(34,197,94,.35); --warning-border: rgba(245,158,11,.35); --info-border: rgba(56,189,248,.35);
  --danger-border: rgba(239,68,68,.35);  --accent-border: rgba(20,184,166,.35); --purple-border: rgba(167,139,250,.35);
}
