/* ===========================================================================
   Design system
   ---------------------------------------------------------------------------
   One restrained palette, one type scale, one spacing scale, one radius, two
   shadows. Every component below is built from these tokens, so a change here
   changes the whole application and no page can drift into its own dialect.

   The aesthetic is deliberately quiet: this is a screen a reconciler reads for
   hours, where a number being easy to scan matters more than anything being
   eye-catching.

   September 2026 visual pass (design handoff "QIC Recon v2 maroon"): QIC brand
   maroon on the navigation rail and a full-bleed page masthead, and a flat
   "ledger sheet" body — sections divided by a 2px ink rule, tables flush to the
   page margins, no cards, no body shadows. The information architecture, the
   markup app.js builds and every class name are unchanged; only these tokens
   and rules moved.
   =========================================================================== */
:root {
  /* Neutrals — carried over from the previous version, whose blue-grey cast the
     team is used to. The interface is almost entirely these. */
  --grey-0:  #ffffff;
  --grey-25: #fbfcfe;
  --grey-50: #f4f6fa;
  --grey-100:#eef1f7;
  --grey-150:#e3e8f0;
  --grey-200:#d5dce8;
  --grey-300:#b3bcce;
  --grey-400:#8b95a8;
  --grey-500:#6b7688;
  --grey-600:#4d5768;
  --grey-700:#333d4f;
  --grey-800:#1a2233;
  --grey-900:#231844;

  /* QIC maroon: the rail, the masthead, primary buttons, links, the focus ring
     and the active tab underline. The two tints are the brand's pearl. */
  --accent-50: #F5F5FF;
  --accent-100:#EBEBFF;
  --accent-500:#74112F;
  --accent-600:#74112F;
  --accent-700:#510B21;
  /* Ink: the 2px section rule and the display numerals. */
  --ink: #231844;
  /* The lavender underline beneath a table header, from the brand palette. */
  --table-rule: #D3D3EB;

  /* Status, in the previous version's hues. Each is paired with a shape or a
     word in the markup, never colour alone — see .status. */
  --ok-50:#e6f6ee;   --ok-500:#1a8f5a;  --ok-700:#136b43;
  --warn-50:#fcf1dc; --warn-500:#b5710a; --warn-700:#8a5607;
  --bad-50:#fbe6e6;  --bad-500:#c02b2b;  --bad-700:#921f1f;
  --info-50:#eaf1fd; --info-500:#2d5bd0; --info-700:#22459c;

  /* Semantic surfaces */
  --bg: var(--grey-0);          /* the page is white, not grey (business request) */
  --surface: var(--grey-0);
  --surface-sunken: var(--grey-25);
  --border: var(--grey-150);
  --border-strong: var(--grey-200);
  --text: var(--grey-800);
  --text-secondary: var(--grey-500);
  --text-tertiary: var(--grey-400);

  /* Type. 13px base: dense enough for finance, large enough to read all day. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;

  /* Spacing — a 4px scale, used everywhere. */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 3px rgba(18, 28, 51, .08);
  --shadow-md: 0 8px 24px -6px rgba(18, 28, 51, .16), 0 6px 20px rgba(18, 28, 51, .05);

  --sidebar-width: 200px;
  --header-height: 52px;
  --focus: 0 0 0 3px rgba(116, 17, 47, .18);
}

* { box-sizing: border-box; }

/* Components below set `display`, which beats the browser's own [hidden] rule.
   Visibility here decides what a role may see and which actions exist, so it
   has to be watertight rather than depend on each component remembering. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===========================================================================
   Shell: a fixed sidebar, a slim header, a scrolling page
   =========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }

/* The rail is solid brand maroon and wordmark-first: labels only, no icons. The
   active item is inverted (white on maroon) — that inversion is the signal. */
.sidebar {
  background: var(--accent-500);
  color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--header-height);
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.brand-mark {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: var(--radius-sm);
  background: var(--accent-100);
  color: var(--accent-500);
  display: grid; place-items: center;
  font-size: var(--text-sm); font-weight: 700; letter-spacing: -.02em;
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; color: #fff; font-size: var(--text-base); font-weight: 600; }
.brand-text span { display: block; color: rgba(255,255,255,.68); font-size: var(--text-xs); }
/* An analyst in several departments switches between them here. */
.brand-switch {
  display: block; max-width: 100%;
  background: rgba(255,255,255,.10); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius-sm);
  font: inherit; font-size: var(--text-xs); padding: 1px 4px; cursor: pointer;
}
.brand-switch option { color: #111; }

/* Departments as tick boxes: on the Users page, for a new account and per row. */
.checklist { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0; }
.checklist label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); cursor: pointer; }
.checklist input { accent-color: var(--accent-500); margin: 0; }

.nav { padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  padding: 14px 10px 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: rgba(255,255,255,.58);
}
.nav-label:first-child { padding-top: 0; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 0; background: none; width: 100%; text-align: left;
  font: inherit; color: #fff;
  border-radius: 5px; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav button:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav button[aria-current="page"] { background: #fff; color: var(--accent-500); font-weight: 600; }
.nav button:focus-visible { outline-color: #fff; }
/* Kept for any markup that still carries a glyph: the design has none. */
.nav-icon { display: none; }

.sidebar-foot { padding: var(--s3); border-top: 1px solid rgba(255,255,255,.18); }
.user-chip { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); }
.avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  background: rgba(255,255,255,.10); color: #fff;
  display: grid; place-items: center; font-size: var(--text-sm); font-weight: 600;
}
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .who strong { display: block; color: #fff; font-size: var(--text-sm); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; color: rgba(255,255,255,.62); font-size: var(--text-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout { color: rgba(255,255,255,.78); }
.signout:hover:not([disabled]) { background: rgba(255,255,255,.16); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* The breadcrumb bar carries the brand maroon across the top of the page; the
   page title band below it is white. */
.header {
  height: var(--header-height);
  background: var(--accent-500);
  border-bottom: 1px solid rgba(255,255,255,.18);
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s8);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm);
  color: rgba(255,255,255,.72); min-width: 0; }
.crumbs strong { color: #fff; font-weight: 600; font-size: var(--text-base); }
.header .spacer { flex: 1; }

.page { padding: var(--s6) var(--s8) var(--s10); width: 100%; }
.page[hidden] { display: none; }

/* The page title band: full width, white, under a hairline. The maroon sits in
   the breadcrumb bar above it, so the title reads in ink on white. */
.page-head {
  display: flex; align-items: flex-end; gap: var(--s4);
  margin: calc(-1 * var(--s6)) calc(-1 * var(--s8)) 26px;
  padding: 26px var(--s8) 22px;
  background: var(--surface); color: var(--text);
  border-bottom: 1px solid var(--border);
}
.page-head h1 { font-size: 27px; letter-spacing: -.03em; line-height: 1.05; color: var(--ink); }
.page-head .sub { color: var(--text-secondary); font-size: var(--text-base); margin-top: 7px;
  max-width: 82ch; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); flex-shrink: 0; }

.section { margin-bottom: var(--s6); }
.section-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.section-head h2 { font-size: var(--text-md); }
.section-head .hint { color: var(--text-tertiary); font-size: var(--text-sm); }
.section-head .actions { margin-left: auto; }

/* minmax(0, 1fr), not 1fr: a grid track's floor is its content's width, so a
   wide table pushed its column past the page and the card beside it was cut
   off. Capped at the track, the table scrolls inside its card instead. */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); }
.grid-2 > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row.tight { gap: var(--s1); }
.row .spacer { flex: 1; }

/* ===========================================================================
   Surfaces
   =========================================================================== */
/* A "card" is now a section of one flat sheet: no border, radius or shadow.
   Its head is the strongest line on the page — a 2px ink rule — and its body
   takes its horizontal padding from the page, so a table's first column and
   its last money column align exactly with the rule above them. */
.card {
  background: var(--surface);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.card-head {
  display: flex; align-items: baseline; gap: var(--s3);
  padding: 0 0 10px;
  border-bottom: 2px solid var(--ink);
}
.card-head h3 { font-size: 15px; letter-spacing: -.015em; }
.card-head .hint { color: var(--text-tertiary); font-size: var(--text-sm); }
.card-head .actions { margin-left: auto; }
.card-body { padding: 18px 0 6px; }
.card-body.flush { padding: 0; }

/* The row above a table — search, Filters, the row count — is not a section
   head, so it carries a hairline rather than the ink rule. The pagination row
   under the table is its mirror. */
.toolbar {
  display: flex; align-items: center; gap: var(--s3);
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.toolbar .actions { margin-left: auto; }
.table-foot {
  display: flex; align-items: center; gap: var(--s3);
  padding: 14px 0; border-top: 1px solid var(--border);
}
.table-foot .actions { margin-left: auto; }
.tabs-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: 2px; }

/* The filter bar under a card head. auto-fit rather than a fixed column count,
   so the six controls reflow to whatever the window gives them without a
   breakpoint deciding it for them. */
/* ---------------------------------------------------------------- Filtering
   The panel is a strip of GROUPS, not a row of boxes: one group per question a
   reviewer asks (whose book, which currency, when, how much). A range is one
   control with two ends, so its two inputs share a single label and sit against
   each other, which is also what stops six equal-width boxes from reading as
   six unrelated decisions. */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: var(--s4) var(--s8);
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.filter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-label, .filter label {
  font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary);
  white-space: nowrap;
}
.filter .select { min-width: 120px; }
.filter-amount { flex: 1 1 300px; }

/* The dashboard's scope: which department and company the figures are for,
   chosen and then stated in words beside the choice. */
.scope-bar { border: 0; border-radius: var(--radius-card); background: var(--surface);
  gap: var(--s4) var(--s6); padding: 14px 20px;
  margin-bottom: var(--s5); align-items: flex-end; }
.scope-bar .select { min-width: 200px; }
.scope-summary { margin-left: auto; align-items: flex-end; text-align: right; }
.scope-summary strong { font-size: var(--text-base); font-weight: 600; line-height: 34px; }
@media (max-width: 720px) { .scope-summary { margin-left: 0; align-items: flex-start; text-align: left; } }

/* A range: two inputs and the dash between them read as one field. */
.range { display: flex; align-items: center; gap: 6px; }
.range .input { min-width: 0; }
.range input[type="date"] { width: 138px; }
.range input[type="number"] { width: 104px; }
.range-sep { color: var(--text-tertiary); font-size: var(--text-base); }

/* Segmented control, for a choice with two or three options. A select that
   holds three values hides two of them behind a click. */
.seg { display: inline-flex; background: var(--grey-100); border: 1px solid var(--border);
       border-radius: var(--radius); padding: 2px; gap: 2px; }
.filter .seg { background: var(--tint); border-color: transparent; }
.seg button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 5px 11px; border-radius: calc(var(--radius) - 2px);
  font: inherit; font-size: var(--text-sm); color: var(--text-secondary);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--text); font-weight: 500;
  box-shadow: 0 1px 2px rgba(18,28,51,.08);
}

/* Materiality shortcuts under the amount range. */
.presets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.presets button {
  appearance: none; cursor: pointer; font: inherit; font-size: var(--text-sm);
  padding: 3px 9px; border-radius: 999px;
  border: 1px dashed var(--grey-300); background: none; color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.presets button:hover { border-style: solid; border-color: var(--accent-500);
                        color: var(--accent-600); }
.presets button[aria-pressed="true"] {
  border-style: solid; background: var(--accent-50);
  border-color: var(--accent-500); color: var(--accent-700); font-weight: 500;
}

/* The active filters, as removable chips. This is the whole point of the
   redesign: with the panel closed, what is narrowing the list was invisible. */
.chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.chips-label {
  font-size: var(--text-sm); color: var(--text-tertiary); margin-right: 2px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--accent-50); border: 1px solid var(--accent-100);
  font-size: var(--text-sm); color: var(--accent-700);
  font-variant-numeric: tabular-nums;
}
.chip b { font-weight: 600; }
.chip button {
  appearance: none; border: 0; cursor: pointer; background: none;
  width: 18px; height: 18px; border-radius: 50%; line-height: 1;
  color: var(--accent-600); font-size: 14px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip button:hover { background: var(--accent-100); color: var(--accent-700); }
.chips .btn-ghost { margin-left: auto; }

.filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 9px; background: var(--accent-500); color: #fff;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
#btn-filters[aria-expanded="true"] {
  background: var(--accent-50); border-color: var(--accent-500); color: var(--accent-700);
}

/* The figure band: four display numerals in one row, with a single rule under
   the whole band and no dividers between them. Not tiles — a statement. */
.metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  border-bottom: 1px solid var(--border); margin-bottom: 26px;
}
.metric {
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
  padding: 0 var(--s6) 22px 0;
  min-width: 0;
}
.metric .label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-secondary);
}
.metric .value {
  margin-top: 8px;
  font-size: 33px; font-weight: 600; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; line-height: 1; color: var(--ink);
}
.metric .value .unit { font-size: var(--text-base); font-weight: 500; color: var(--text-tertiary); margin-left: 3px; }
.metric .foot { margin-top: 4px; font-size: var(--text-sm); color: var(--text-secondary); }
.metric.attention .value { color: var(--accent-500); }
/* The one figure a page is FOR. Twice the width and half again the size of its
   neighbours, so the eye lands on it before anything else in the band. */
.metric.lead { grid-column: span 2; }
.metric.lead .value { font-size: 48px; }
.metric.lead .foot { font-size: var(--text-base); margin-top: 6px; }
.metrics .skeleton { margin-top: 8px; }

/* A quiet definition list, for figures that matter but are not headline. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4) var(--s5); }
.facts div { min-width: 0; }
.facts dt { font-size: var(--text-sm); color: var(--text-secondary); }
.facts dd { margin: 3px 0 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.facts dd small { display: block; font-weight: 400; font-size: var(--text-sm);
  color: var(--text-secondary); margin-top: 1px; }
/* A link-looking button inside running text. */
.linkish { appearance: none; border: 0; background: none; padding: 0; font: inherit;
  color: var(--accent-500); cursor: pointer; text-decoration: underline; }
.linkish:hover { color: var(--accent-700); }

/* ===========================================================================
   Buttons
   =========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 var(--s3);
  font: inherit; font-size: var(--text-base); font-weight: 500;
  border-radius: var(--radius); border: 1px solid transparent;
  background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
.btn:focus-visible { box-shadow: var(--focus); outline: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent-600); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--accent-700); }
.btn-secondary { border-color: var(--border-strong); color: var(--grey-700); }
.btn-secondary:hover:not([disabled]) { background: var(--grey-50); border-color: var(--grey-300); }
.btn-ghost { color: var(--grey-600); }
.btn-ghost:hover:not([disabled]) { background: var(--grey-100); }
.btn-danger { border-color: #e8c4c2; color: var(--bad-500); background: var(--surface); }
.btn-danger:hover:not([disabled]) { background: var(--bad-50); }
.btn-sm { height: 26px; font-size: var(--text-sm); padding: 0 var(--s2); }
.btn-block { width: 100%; }

.btn .spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================================================================
   Forms
   =========================================================================== */
.field { display: block; margin-bottom: var(--s4); }
.field > .label { display: block; font-size: var(--text-sm); font-weight: 500; margin-bottom: 5px; }
.field > .help { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: 4px; }

.input, .select {
  width: 100%; height: 32px; padding: 0 var(--s3);
  font: inherit; font-size: var(--text-base); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color .12s, box-shadow .12s;
}
.input:hover, .select:hover { border-color: var(--grey-300); }
.input:focus, .select:focus { outline: none; border-color: var(--accent-500); box-shadow: var(--focus); }
.input::placeholder { color: var(--text-tertiary); }
.input[disabled] { background: var(--grey-50); color: var(--text-tertiary); }
.input-auto { width: auto; }
textarea.input { height: auto; padding: var(--s3); font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.65; resize: vertical; }

.select { appearance: none; padding-right: var(--s6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a919e' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s3) center; }

.search { position: relative; }
.search .input { padding-left: 30px; }
.search::before {
  content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-52%);
  color: var(--text-tertiary); font-size: var(--text-lg); pointer-events: none;
}

.check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-base);
  color: var(--grey-600); cursor: pointer; user-select: none; }
.check input { width: 14px; height: 14px; accent-color: var(--accent-600); cursor: pointer; }

/* A file input that looks deliberate rather than default. */
.dropzone {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4); border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-block); background: var(--surface-sunken);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent-500); background: var(--accent-50); }
/* Where a file box would be but nothing is dropped: a statement of where the
   data comes from instead. Solid, still, and its text wraps -- a note, not a
   target. */
.dropzone.static, .dropzone.static:hover {
  cursor: default; border-style: solid; border-color: var(--border-strong);
  background: var(--surface-sunken);
}
.dropzone.static .dz-text span { white-space: normal; }
.dropzone input { display: none; }
.dropzone .dz-icon { width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--radius);
  background: var(--surface); display: grid; place-items: center; color: var(--grey-500); }
.dropzone .dz-text { min-width: 0; }
.dropzone .dz-text strong { display: block; font-weight: 500; font-size: var(--text-base); }
.dropzone .dz-text span { display: block; font-size: var(--text-sm); color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone.filled { border-style: solid; border-color: var(--ok-500); background: var(--ok-50); }
.dropzone.filled .dz-icon { background: #fff; color: var(--ok-500); }

/* The upload page: two large boxes side by side across the whole page, each
   with its glyph, its bold label and the chosen file name centred. A filled
   box turns pale green. */
.dropzone-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6); }
.dropzone.big {
  flex-direction: column; justify-content: center; text-align: center;
  min-height: 200px; padding: var(--s8) var(--s6);
  border-radius: var(--radius-card); background: var(--surface-sunken);
  border-width: 1.5px;
}
.dropzone.big .dz-icon { width: 44px; height: 44px; flex: 0 0 44px; font-size: 20px;
  border-radius: var(--radius); margin-bottom: var(--s2); }
.dropzone.big .dz-text strong { font-size: var(--text-lg); font-weight: 600; }
.dropzone.big .dz-text span { font-size: var(--text-md); color: var(--text-secondary);
  white-space: normal; overflow-wrap: anywhere; margin-top: 4px; }
.dropzone.big.filled { background: var(--ok-50); border-color: #a9dcc3; }
@media (max-width: 900px) { .dropzone-grid { grid-template-columns: 1fr; } }

/* Steps, so a multi-part task shows where you are. */
.steps { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s5); }
.step { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); color: var(--text-tertiary); }
.step .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border-strong); font-size: var(--text-xs); font-weight: 600; }
.step.current { color: var(--text); font-weight: 500; }
.step.current .n { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.step.done .n { background: var(--ok-50); border-color: var(--ok-500); color: var(--ok-500); }
.step-line { flex: 0 0 24px; height: 1px; background: var(--border-strong); }

/* ===========================================================================
   Tabs (segmented, with counts)
   =========================================================================== */
/* Underline tabs on one hairline, not a pill group. */
.tabs {
  display: flex; gap: 26px; padding: 0;
  background: none; border-radius: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; max-width: 100%; width: 100%;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0;
  border: 0; background: none; border-radius: 0;
  font: inherit; font-size: 13.5px; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; transition: color .12s, box-shadow .12s;
}
.tab:hover { color: var(--text); background: none; }
.tab[aria-selected="true"] { background: none; color: var(--ink); font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent-500); }
.tab .n { font-size: var(--text-sm); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .n { color: var(--grey-600); }

/* ===========================================================================
   Tables — the heart of the application
   ---------------------------------------------------------------------------
   No vertical rules, one hairline between rows, a sticky header, and numbers
   right-aligned with tabular figures so columns of money line up on the digit.
   =========================================================================== */
.table-wrap { overflow: auto; max-width: 100%; }
/* A long list -- the 1,100 grouping names -- scrolls inside its own frame
   instead of making the page a mile long; the sticky header stays in view. */
.table-wrap.scroll { max-height: 60vh; border-bottom: 1px solid var(--border); }
.table-wrap.bordered { border-top: 1px solid var(--border); }

table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-base); }
/* Cells pad to the right only, so the first column's text and the last column's
   money align exactly with the section rule above the table. */
table.data th, table.data td { padding: 10px 18px 10px 0; text-align: left; white-space: nowrap; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data.compact th, table.data.compact td { padding: 6px 18px 6px 0; }
/* The header stays put: these tables run to 500 rows and a reader who has
   scrolled past the header is guessing which column they are reading. Its
   label colour is the secondary text, never a divider grey: 4.6:1 on white. */
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--table-rule);
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-secondary);
}
table.data thead th.num, table.data td.num { text-align: right; }
table.data tbody td { border-bottom: 1px solid var(--grey-100); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.interactive { cursor: pointer; }
table.data tbody tr.interactive:hover td { background: var(--tint); }
table.data tbody tr[aria-selected="true"] td { background: var(--tint-owed); }
table.data tbody tr:focus-visible { outline: 2px solid var(--accent-500); outline-offset: -2px; }
table.data td.shrink { width: 1%; }
/* Money lines up: same digit width, same decimal column, down the page. */
table.data td.num, table.data th.num { font-variant-numeric: tabular-nums; }
/* The insured name is the widest free text in the table and the one a reader
   scans, so it gets the slack and truncates rather than pushing the money
   column off the right edge. */
table.data td.name { max-width: 260px; overflow: hidden; text-overflow: ellipsis;
                     white-space: nowrap; }
table.data td.truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-secondary); }
/* A bank line's description or narration is shown whole: an ellipsis would hide
   the very reference the reviewer is looking for. It wraps instead of clipping,
   and the column is capped so the money columns stay on screen. */
table.data td.text-full { min-width: 240px; max-width: 520px; white-space: normal;
  overflow-wrap: anywhere; line-height: 1.35; }
/* A capped text column that wraps: long names never push the other columns
   off the screen. */
table.data td.text-wrap { max-width: 380px; white-space: normal; overflow-wrap: anywhere;
  line-height: 1.3; }
table.data.compact td.text-wrap { max-width: 340px; }
/* Row actions sit on one line and never wrap into a second. */
table.data td .actions-cell { display: inline-flex; gap: 4px; white-space: nowrap; align-items: center; }
table.data.compact .btn-sm { height: 24px; font-size: var(--text-xs); padding: 0 7px; }
table.data tfoot td { border-top: 1px solid var(--table-rule); background: var(--surface);
  font-weight: 600; font-variant-numeric: tabular-nums; }

/* A classification in a table is coloured words, not a pill: warn, info, bad
   or neutral, in the tone's darker shade so it reads on white. Pills survive
   in the drawer, in "Share open" and for role and audit badges. */
.classification { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.classification.tone-warn { color: var(--warn-700); }
.classification.tone-info { color: var(--info-700); }
.classification.tone-bad { color: var(--bad-700); }
.classification.tone-ok { color: var(--ok-700); }
.classification.tone-neutral { color: var(--text-secondary); }

/* A flagged row is marked by a bar AND a badge, never by colour alone. */
table.data tbody tr.flagged td:first-child { box-shadow: inset 2px 0 0 var(--warn-500); }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money .ccy { color: var(--text-tertiary); font-size: var(--text-sm); margin-left: 4px; }
.money.negative { color: var(--bad-500); }
.money.zero { color: var(--text-tertiary); }
.mono { font-family: var(--font-mono); font-size: var(--text-sm); }

.cell-primary { font-weight: 500; }
.cell-secondary { color: var(--text-secondary); font-size: var(--text-sm); }
.cell-stack { display: flex; flex-direction: column; line-height: 1.35; }
td.num .cell-stack { align-items: flex-end; }

/* ===========================================================================
   Status, badges
   =========================================================================== */
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: var(--text-base); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--grey-300); }
.status.ok .dot { background: var(--ok-500); }
.status.open .dot { background: var(--warn-500); }
.status.info .dot { background: var(--info-500); }
.status.muted { color: var(--text-tertiary); }
.status.muted .dot { background: var(--grey-300); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok { background: var(--ok-50); color: var(--ok-700); border-color: transparent; }
.badge-warn { background: var(--warn-50); color: var(--warn-700); border-color: transparent; }
.badge-bad { background: var(--bad-50); color: var(--bad-700); border-color: transparent; }
.badge-info { background: var(--info-50); color: var(--info-700); border-color: transparent; }
.badge-neutral { background: var(--tint); color: var(--grey-600); border-color: transparent; }

/* ===========================================================================
   Feedback: banners, toasts, empty and loading states
   =========================================================================== */
.banner {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s3) var(--s4); border-radius: var(--radius);
  border: 1px solid transparent; font-size: var(--text-base); margin-bottom: var(--s4);
}
.banner .b-icon { flex: 0 0 16px; font-weight: 700; line-height: 1.4; }
.banner-info { background: var(--info-50); color: var(--info-700); border-color: #c9dcf4; }
.banner-warn { background: var(--warn-50); color: var(--warn-700); border-color: #f0dcb6; }
.banner-bad { background: var(--bad-50); color: var(--bad-700); border-color: #eec9c7; }
.banner-ok { background: var(--ok-50); color: var(--ok-700); border-color: #cbe7da; }

.toasts { position: fixed; bottom: var(--s5); right: var(--s5); z-index: 60;
  display: flex; flex-direction: column; gap: var(--s2); max-width: 380px; }
.toast {
  display: flex; gap: var(--s3); align-items: flex-start;
  background: var(--grey-900); color: #fff;
  padding: var(--s3) var(--s4); border-radius: var(--radius);
  box-shadow: var(--shadow-md); font-size: var(--text-base);
  animation: rise .16s ease-out;
}
.toast .t-icon { flex: 0 0 auto; }
.toast.ok .t-icon { color: #6ee7b7; }
.toast.bad .t-icon { color: #fca5a5; }
.toast button { margin-left: auto; background: none; border: 0; color: var(--grey-400);
  cursor: pointer; font: inherit; padding: 0 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.empty { padding: var(--s10) var(--s5); text-align: center; }
.empty .e-icon {
  width: 40px; height: 40px; margin: 0 auto var(--s3);
  border-radius: var(--radius-lg); background: var(--grey-100);
  display: grid; place-items: center; color: var(--grey-400); font-size: var(--text-xl);
}
.empty h3 { font-size: var(--text-md); margin-bottom: 4px; }
.empty p { color: var(--text-secondary); max-width: 44ch; margin: 0 auto var(--s4); }

.skeleton { background: linear-gradient(90deg, var(--grey-100), var(--grey-50), var(--grey-100));
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
  border-radius: var(--radius-sm); height: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===========================================================================
   Drawer — where secondary detail lives, so the table can stay readable
   =========================================================================== */
.scrim { position: fixed; inset: 0; background: rgba(20, 24, 33, .32); z-index: 50;
  display: flex; justify-content: flex-end; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }

.drawer {
  width: min(720px, 96vw); height: 100%; background: var(--surface);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-md); animation: slide .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes slide { from { transform: translateX(24px); } }
/* A drawer holding a wide table: the translation-difference cases have ten
   columns, and a 720px panel showed six of them. */
.drawer.drawer-wide { width: min(1280px, 96vw); }
.drawer-body .table-wrap.scroll { max-height: none; }
.drawer-head { display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s5); border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: var(--text-lg); }
.drawer-head .sub { color: var(--text-secondary); font-size: var(--text-sm); margin-top: 2px; }
.drawer-body { padding: var(--s5); overflow-y: auto; flex: 1; }
.drawer-body .table-wrap { border: 0; background: var(--tint-soft); border-radius: var(--radius-block); }
.drawer-body table.data thead th { background: var(--tint-soft); }
.drawer-body table.data th:first-child, .drawer-body table.data td:first-child { padding-left: var(--s3); }
.drawer-body table.data th:last-child, .drawer-body table.data td:last-child { padding-right: var(--s3); }
.drawer-foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--border);
  display: flex; gap: var(--s2); background: var(--surface-sunken); }

.detail-block { margin-bottom: var(--s5); }
.detail-block > .dt {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 5px;
}
.detail-block > .dd { font-size: var(--text-base); }
.detail-block > .dd.lead { font-size: var(--text-md); }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 7px var(--s4); font-size: var(--text-base); }
.kv dt { color: var(--text-secondary); }
.kv dd { margin: 0; }

.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3);
  padding: var(--s4); background: var(--tint);
  border: 0; border-radius: var(--radius-block); margin-bottom: var(--s5); }
.totals div { min-width: 0; }
.totals dt { font-size: var(--text-sm); color: var(--text-secondary); }
.totals dd { margin: 2px 0 0; font-size: var(--text-md); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ===========================================================================
   Sign in
   =========================================================================== */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--s6);
  background: var(--bg); }
.signin-card { width: 100%; max-width: 380px; background: var(--surface);
  border: 0; border-radius: var(--radius-card);
  box-shadow: none; padding: var(--s8); }
.signin-brand { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s6); }
.signin h1 { font-size: var(--text-lg); }
.signin .sub { color: var(--text-secondary); font-size: var(--text-sm); margin-bottom: var(--s6); }
.signin-foot { margin-top: var(--s5); text-align: center; font-size: var(--text-sm); color: var(--text-tertiary); }

/* ===========================================================================
   Responsive: desktop first, but usable narrower
   =========================================================================== */
/* The rail is wordmark-only, so it never collapses to icons; it narrows. */
@media (max-width: 1100px) {
  :root { --sidebar-width: 168px; }
  .brand { padding: 0 12px; }
  .nav { padding: 14px 6px; }
  .page { padding: var(--s5) var(--s6) var(--s8); }
  .page-head { margin: calc(-1 * var(--s5)) calc(-1 * var(--s6)) var(--s5); padding: var(--s5) var(--s6); }
  .metric { padding-right: var(--s4); }
  .metric .value { font-size: 28px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; z-index: 30;
    flex-direction: row; }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; padding: var(--s1); }
  .nav-label { display: none; }
  .main { padding-bottom: 56px; }
  .page { padding: var(--s4); }
  .page-head { margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) var(--s4); padding: var(--s4); }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding-bottom: var(--s3); }
  .grid-2, .totals { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .header, .toasts { display: none; }
}

/* ---------------------------------------------------------------- Charts
 * Hand-drawn SVG: this frontend has no build step, and a charting library
 * would be the largest dependency in the project for four small pictures. The
 * shapes read the same design tokens as everything else, so a theme change
 * moves them too — which a canvas library could not do.
 *
 * Every chart carries the same figures in its <title>/aria-label, so a reader
 * who cannot see the picture is not sent to look for a table that does not
 * exist.
 */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .tick {
  fill: var(--text-tertiary); font-size: 10.5px;
  font-family: var(--font); font-variant-numeric: tabular-nums;
}
.chart .tick-label { fill: var(--text-secondary); font-size: 11px; font-family: var(--font); }
.chart .series-ok { fill: var(--ok-500); }
.chart .series-open { fill: var(--warn-500); }
.chart .series-line { fill: none; stroke: var(--accent-600); stroke-width: 2; }
.chart .series-dot { fill: var(--accent-600); }
.chart .bar { transition: opacity .12s; }
.chart .bar:hover { opacity: .82; }

/* A legend that names the colours, because colour alone is not a label. */
.chart-legend {
  display: flex; gap: var(--s4); flex-wrap: wrap;
  margin-top: var(--s2); font-size: var(--text-sm); color: var(--text-secondary);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i {
  width: 10px; height: 10px; border-radius: 2px; display: inline-block;
}

/* ===========================================================================
   Motor-claims dashboard pass (September 2026)
   ---------------------------------------------------------------------------
   From the mockup the business supplied: the brand's Graphik type; a quiet
   grey-lavender page instead of white, with the maroon kept to the rail; no
   page masthead on the dashboard; the outstanding figure as the one large
   number; panels headed by a small eyebrow over a large title; a line-and-area
   trend; turnaround bands drawn as bars; and a callout that says what the
   data cannot yet show. Written as overrides at the end so the earlier pass
   stays readable and this one can be lifted as a unit.
   =========================================================================== */
@font-face { font-family: "Graphik"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/public/fonts/Graphik-Regular.woff2") format("woff2"); }
@font-face { font-family: "Graphik"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("/static/public/fonts/Graphik-Medium.woff2") format("woff2"); }
@font-face { font-family: "Graphik"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/static/public/fonts/Graphik-Semibold.woff2") format("woff2"); }
@font-face { font-family: "Graphik"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("/static/public/fonts/Graphik-Bold.woff2") format("woff2"); }

:root {
  --font: "Graphik", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --border: #d9d6df;
  --border-strong: #c9c5d1;

  /* The app-wide standard (September 2026, at the business's request): the
     Motor Claims dashboard's colours for every page -- a lavender page, white
     borderless containers, and the tints inside them. */
  --bg: #ebebff;
  --surface: #fff;
  --tint: #f4f3f7;        --tint-hover: #ecebf1;       /* a block inside a container */
  --tint-soft: #f7f6fa;   --tint-soft-hover: #efedf3;  /* an inner group */
  --tint-owed: #f8ebef;   --tint-owed-hover: #f3e0e6;  /* what is owed; the chosen row */
  --tint-quiet: #f5f5f6;                               /* closed, agreed */
  --tint-note: #f8f2f5;                                /* an AI note */
  --tint-info: #eef2fb;
  --ink-300: #8f86a8;
  --surface-sunken: var(--tint-soft);
  --radius-card: 14px;
  --radius-block: 12px;
  --pad-card: 20px 24px;
  --gap-cards: var(--s5);
}

/* The maroon stays on the rail; the header and the page share one grey. */
.header { background: var(--bg); border-bottom: 1px solid var(--border-strong); }
.crumbs { color: var(--text-secondary); }
.crumbs strong { color: var(--ink); font-weight: 600; }
.header-context { margin-left: auto; font-size: 13px; color: var(--text-secondary);
  white-space: nowrap; }
.header-context strong { color: var(--accent-500); font-weight: 500; }
.page-head { background: transparent; border-bottom: 0; }
#page-dashboard .page-head { display: none; }
.nav button[aria-current="page"] { background: #dfdce4; color: var(--ink); }

/* Every section is a white, borderless, rounded container on the lavender page
   -- the Motor Claims dashboard's cards, as the standard for every page. */
.card { background: var(--surface); border: 0; border-radius: var(--radius-card);
  box-shadow: none; padding: var(--pad-card); }
.card-head { border-bottom: 0; padding: 0; }
.card > .card-body:first-child { padding-top: 0; }
.card > .toolbar:first-child { padding-top: 0; }
.card > .table-foot:last-child { padding-bottom: 0; }
.page > :is(.card, .panel, .grid-2) { margin-bottom: var(--gap-cards); }
.page > :is(.card, .panel):last-child { margin-bottom: 0; }
.tabs-row { margin-bottom: var(--s3); }
table thead th { background: var(--surface); }
.toolbar, .filter-bar:not(.scope-bar), .chips, .table-foot { background: transparent; }
.filter-bar, .toolbar { border-bottom-color: var(--border); }

/* The brand mark at the foot of the rail. The supplied file is maroon on
   transparent, so it is inverted to white here rather than shipping a copy. */
.sidebar-logo { display: block; height: 22px; width: auto; margin: 14px 10px 6px;
  filter: brightness(0) invert(1); opacity: .92; }

/* Figures: labels in sentence case, one very large number, the rest quieter. */
.metric .label { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); }
.metric .value { font-size: 36px; }
.metric.lead .value { font-size: 64px; letter-spacing: -.045em; line-height: .95; }
.metric.lead .value .unit { font-size: 20px; margin-left: 8px; }
.metrics { border-bottom: 1px solid var(--border-strong); }

/* Panels: an eyebrow, a large title, a sentence beneath. */
.dash-grid { display: grid; grid-template-columns: 3fr 2fr; gap: var(--s10); align-items: start; }
.panel { background: var(--surface); border: 0; border-radius: var(--radius-card);
  box-shadow: none; padding: var(--pad-card); margin-bottom: var(--gap-cards); }
.panel-head .eyebrow { font-size: 13px; color: var(--text-secondary); }
.panel-head h3 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--ink);
  margin-top: 6px; line-height: 1.15; }
.panel-head .sub { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.panel-body { margin-top: var(--s5); }
.panel .card-head { border-bottom: 0; padding-bottom: 0; }
.panel .card-head h3 { font-size: 24px; letter-spacing: -.02em; color: var(--ink); }

/* Turnaround bands as bars: label, bar, count, value. */
.bar-table { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(90px, 1fr) 56px 150px;
  column-gap: var(--s4); }
.bar-table > div { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; min-width: 0; }
.bar-table .num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.bar-track { width: 100%; height: 10px; background: var(--grey-200); border-radius: 2px;
  overflow: hidden; }
.bar-fill { height: 100%; background: var(--ink); }

/* Turnaround insurer against insurer: a bar beside the median, and one bar
   split by band for the shape of each insurer's answers. */
.tat-compare .tat-facts { margin-bottom: var(--s5); }
.inline-bar { display: flex; align-items: center; gap: var(--s3); min-width: 160px; }
.inline-bar .bar-track { flex: 1; }
.inline-bar .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack-bar { display: flex; height: 10px; width: 140px; border-radius: 2px; overflow: hidden;
  background: var(--grey-200); }
.stack-bar .seg { height: 100%; }
.seg-0 { background: var(--grey-400); }   /* before the debit note: a data fault */
.seg-1 { background: var(--ok-500); }
.seg-2 { background: var(--info-500); }
.seg-3 { background: var(--warn-500); }
.seg-4 { background: var(--bad-500); }
.stack-legend { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); margin-top: var(--s4);
  font-size: var(--text-sm); color: var(--text-secondary); }
.stack-legend span { display: inline-flex; align-items: center; gap: 6px; }
.stack-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* What the data cannot show yet, and the one thing that would change that. */
.callout { background: #dcd9e2; border-radius: 12px; padding: var(--s5) var(--s6);
  margin-top: var(--s6); }
.callout .eyebrow { font-size: 13px; color: var(--text-secondary); }
.callout p { margin: 8px 0 16px; color: var(--ink); line-height: 1.5; }

/* The trend: a line over a tinted area, with a dashed reference. */
.chart .series-area { fill: var(--accent-500); opacity: .14; }
.chart .series-line { stroke: var(--accent-500); }
.chart .series-dot { fill: var(--accent-500); }
.chart .ref-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .ref-label { fill: var(--ink); font-size: 11px; font-weight: 600; font-family: var(--font); }

/* The mockup is drawn at 1500px. Below that the figures must give before they
   collide: the display numerals scale with the viewport, the two-column body
   stacks, and the bar tables let their value column breathe. A number that
   runs into its neighbour is worse than a smaller number. */
.metric .value { font-size: clamp(24px, 2.6vw, 36px); }
.metric.lead .value { font-size: clamp(36px, 4.8vw, 64px); }
.metric .value, .metric .foot { overflow-wrap: anywhere; }
.bar-table { grid-template-columns: minmax(120px, 1fr) minmax(70px, 1fr) minmax(44px, auto) minmax(110px, auto); }
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric.lead { grid-column: span 2; }
}

/* ===========================================================================
   The assistant: a summary card at the top of a page, and the drawer it opens
   =========================================================================== */

/* The card carries the page's own figures, so it sits with the panels rather
   than shouting over them: the same white surface, one accent edge to say it
   is a different kind of thing, and a pointer to say it opens. */
.assistant-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 0;
  border-left: 3px solid var(--accent-500);
  border-radius: var(--radius-card); padding: var(--s5) var(--s6);
  margin-bottom: var(--s6); cursor: pointer; box-shadow: none;
  transition: background .15s ease;
}
.assistant-card:hover { box-shadow: none; }
.assistant-card:not(.brief-card):not(:has(.assistant-loading)):hover { background: var(--tint-soft); }
.assistant-card:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }
.assistant-top { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s2); }
.assistant-scope { font-size: var(--text-sm); color: var(--text-secondary); }
.assistant-loading { font-size: var(--text-md); color: var(--text-tertiary); }
.assistant-body { margin: 0; font-size: var(--text-md); line-height: 1.6; color: var(--ink); }
.assistant-facts { margin: 0; padding-left: var(--s5); font-size: var(--text-md);
  line-height: 1.7; color: var(--ink); }
.assistant-asks { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  margin-top: var(--s4); }
.assistant-hint { font-size: var(--text-sm); color: var(--text-tertiary); }

/* A suggested question: a button inside the card, which must not open the
   drawer twice -- the click is stopped in the handler, not here. */
.chip {
  appearance: none; border: 1px solid transparent; background: var(--tint);
  color: var(--ink); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: var(--text-sm); cursor: pointer;
}
.chip:hover { background: var(--tint-owed); border-color: transparent;
  color: var(--accent-700); }

/* The drawer. Not modal: the figures it is talking about stay readable behind
   it, which is the whole point of answering beside them rather than over them. */
.assistant-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  display: flex; flex-direction: column; z-index: 60;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.assistant-scrim { position: fixed; inset: 0; z-index: 59; background: rgba(35, 24, 68, .18); }
.assistant-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border);
}
.assistant-close { appearance: none; border: 0; background: none; cursor: pointer;
  font-size: 15px; color: var(--text-secondary); padding: 4px 8px; border-radius: var(--radius); }
.assistant-close:hover { background: var(--grey-100); color: var(--ink); }

.assistant-thread { flex: 1; overflow-y: auto; padding: var(--s5);
  display: flex; flex-direction: column; gap: var(--s4); }
.assistant-turn { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.assistant-turn.user { align-items: flex-end; }
.assistant-bubble {
  max-width: 92%; padding: 10px 14px; border-radius: 14px;
  font-size: var(--text-md); line-height: 1.6; white-space: pre-wrap;
  background: var(--grey-50); color: var(--ink); border: 1px solid var(--border);
}
.assistant-turn.user .assistant-bubble {
  background: var(--accent-500); border-color: var(--accent-500); color: #fff;
}
.assistant-typing { color: var(--text-tertiary); }
.assistant-failed { color: var(--bad-700); }

/* What the answer was looked up from, shown while it is looked up. */
.assistant-trace { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-step {
  font-size: var(--text-xs); color: var(--text-secondary);
  background: var(--grey-100); border-radius: 999px; padding: 2px 8px;
}
.assistant-verdict { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: var(--text-xs); color: var(--text-secondary); }

.assistant-ask { display: flex; gap: var(--s2); padding: var(--s4) var(--s5);
  border-top: 1px solid var(--border); }
.assistant-field {
  flex: 1; min-width: 0; height: 34px; padding: 0 var(--s3);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; font-size: var(--text-md);
}
.assistant-field:focus { outline: none; border-color: var(--accent-500);
  box-shadow: 0 0 0 3px var(--accent-100); }
.assistant-field:disabled { background: var(--grey-50); color: var(--text-tertiary); }

@media (max-width: 720px) {
  .assistant-drawer { width: 100%; }
}

/* Data faults the card must show whatever the summary says. */
.assistant-warnings { margin: var(--s4) 0 0; padding-left: var(--s5);
  font-size: var(--text-sm); line-height: 1.6; color: var(--warn-700); }
.assistant-warnings li::marker { color: var(--warn-500); }

/* A chip that is the current choice, in the follow-up filters. */
.chip-on { background: var(--accent-500); border-color: var(--accent-500); color: #fff; }
.chip-on:hover { background: var(--accent-700); border-color: var(--accent-700); color: #fff; }

/* The follow-up list and the single-insurer standing panel: both lead with
   figures at metric size, because the point of each is to be acted on rather
   than scanned past. */
.panel.follow-up .metrics, .panel.standing .metrics { margin-bottom: var(--s5); }
.panel.follow-up .assistant-asks { margin-bottom: var(--s4); }
/* Who to chase today, folded: the heading opens it. */
.follow-up-fold > summary { display: block; list-style: none; cursor: pointer; }
.follow-up-fold > summary::-webkit-details-marker { display: none; }
.follow-up-fold > summary h3::after { content: "\25BE"; display: inline-block; margin-left: 10px;
  font-size: 18px; color: var(--text-tertiary); transition: transform .15s; }
.follow-up-fold[open] > summary h3::after { transform: rotate(180deg); }
.follow-up-fold > summary:hover h3 { color: var(--accent-500); }
.panel.standing .facts { margin-top: var(--s5); padding-top: var(--s5);
  border-top: 1px solid var(--border); }

/* ===========================================================================
   Motor Claims (September 2026, at the business's request)
   ---------------------------------------------------------------------------
   Larger type, a navigation rail that folds away, and a dashboard of white
   rounded cards on the grey page instead of rules stacked on rules. Scoped to
   Motor Claims: body[data-department="motor"] is set by app.js for that
   department only, and .mdash wraps the Motor Claims dashboard alone.
   =========================================================================== */
body[data-department="motor"] {
  --text-xs: 12px; --text-sm: 13.5px; --text-base: 15px;
  --text-md: 16px; --text-lg: 18px; --text-xl: 22px;
  --sidebar-width: 220px;
}
body[data-department="motor"] .nav-label { font-size: 11.5px; }
body[data-department="motor"] .metric .label,
body[data-department="motor"] .panel-head .eyebrow,
body[data-department="motor"] .panel-head .sub,
body[data-department="motor"] .callout .eyebrow,
body[data-department="motor"] .header-context { font-size: 14.5px; }
body[data-department="motor"] .chart .tick { font-size: 12.5px; }
body[data-department="motor"] .chart .tick-label,
body[data-department="motor"] .chart .ref-label { font-size: 13px; }

/* The rail folds away from the header, giving the page the whole width. */
.nav-toggle {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 36px; height: 36px; margin-left: -10px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer;
}
.nav-toggle:hover { background: rgba(35, 24, 68, .08); }
.nav-toggle svg { width: 20px; height: 20px; }
body.nav-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
body.nav-collapsed .sidebar { visibility: hidden; overflow: hidden; }

/* The dashboard: every section its own card. */
.mdash { display: flex; flex-direction: column; gap: var(--s5); }
.mdash > .section, .mdash .section { margin-bottom: 0; }
.mcard, .mdash .panel, .mdash .callout {
  background: var(--surface); border: 0; border-radius: var(--radius-card);
  box-shadow: none; padding: 20px 24px; margin: 0; min-width: 0;
}
.mdash .dash-grid { gap: var(--s5); }
.mdash .dash-grid > div { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.mdash table thead th { background: var(--surface); }
.mdash .panel-body { margin-top: var(--s4); }
.mdash .table-foot { border-top-color: var(--border); padding-bottom: 0; }

/* Icons: small, maroon, beside the words that name them. */
.icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent-500); }
.mdash .panel-head .eyebrow { display: flex; align-items: center; gap: 8px; }
.mdash .panel-head .eyebrow .icon { width: 17px; height: 17px; }

/* Figures in cards: a label with its icon, the number, a line under it. */
.mdash-hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s5); }
.mdash-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5); }
.mcard-head { display: flex; align-items: center; gap: 8px; color: var(--text-secondary);
  font-weight: 500; }
.mcard-hint { margin-left: auto; font-weight: 400; font-size: var(--text-sm);
  color: var(--text-tertiary); text-align: right; }
.mcard-value { margin-top: 12px; font-size: clamp(24px, 2.3vw, 32px); font-weight: 600;
  letter-spacing: -.03em; line-height: 1.05; color: var(--ink);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mcard-value .unit { font-size: var(--text-base); font-weight: 500; color: var(--text-tertiary);
  margin-left: 6px; letter-spacing: 0; }
.mcard-foot { margin-top: 8px; font-size: var(--text-sm); color: var(--text-secondary); }
.mcard.tone-bad .mcard-value { color: var(--bad-500); }
.mcard.tone-warn .mcard-value { color: var(--warn-700); }
.mcard-hero { display: flex; flex-direction: column; }
.mcard-hero .mcard-value { font-size: clamp(38px, 4vw, 58px); color: var(--accent-500); margin-top: 18px; }
.mcard-hero .mcard-stat { margin-top: 18px; font-size: var(--text-md); color: var(--text); }
.mcard-hero .mcard-stat strong { color: var(--ink); font-weight: 600; font-size: var(--text-lg); }
.mcard-hero .mcard-foot { margin-top: auto; padding-top: 14px; }
.mcard-chart .chart { margin-top: 10px; }
.chart .bar.series-month { fill: var(--accent-500); }
.mcard-chart .empty { padding: var(--s6) 0; }

/* How the outstanding splits: overdue against still inside the mean TAT. */
.split { margin-top: 18px; }
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden;
  background: var(--grey-150); }
.split-bar .split-over, .split-legend i.split-over { background: var(--bad-500); }
.split-bar .split-within, .split-legend i.split-within { background: var(--grey-300); }
.split-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 10px;
  font-size: var(--text-sm); color: var(--text-secondary); }
.split-legend span { display: inline-flex; align-items: center; gap: 8px; }
.split-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }

/* The follow-up list: its band figures as small cards of their own, four
   equal, so none of them wraps onto a row by itself. */
.mdash .panel.follow-up .metrics { border-bottom: 0; gap: var(--s3); margin-bottom: var(--s4);
  grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mdash .panel.follow-up .metric.lead { grid-column: auto; }
.mdash .panel.follow-up .metric .value,
.mdash .panel.follow-up .metric.lead .value { font-size: clamp(24px, 2.4vw, 36px); }
.mdash .panel.follow-up .metric.lead .foot { font-size: var(--text-sm); }
.mdash .panel.follow-up .metric { background: var(--tint); border: 0;
  border-radius: 10px; padding: 14px 16px; }
.mdash .panel.standing .metrics { border-bottom: 0; }
.open-days { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px;
  white-space: nowrap; }
.select-sm { height: 30px; font-size: var(--text-sm); padding-top: 0; padding-bottom: 0; }

/* Loading: the page is on its way, never a blank screen. */
.loading-line { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); }
.loading-line .spinner { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent-500);
  animation: spin .8s linear infinite; }
.loading-panel .loading-line { margin-bottom: var(--s4); }
.mdash-loading .skeleton { height: 14px; }

@media (max-width: 1180px) {
  .mdash-hero { grid-template-columns: minmax(0, 1fr); }
  .mdash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .mdash-tiles { grid-template-columns: minmax(0, 1fr); }
}
/* The company picker and the assistant's summary above the Motor dashboard,
   as cards of the same kind. */
/* The yearly table fits its card at the larger type: narrower inline bars. */
.mdash .inline-bar { min-width: 110px; }

/* Outstanding by month, in HTML so its labels keep one size at any width.
   The axis and the plot share one height; each tick sits on its gridline. */
.mbars { display: grid; grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 210px auto; column-gap: 10px; margin-top: 14px; }
.mbars-axis { position: relative; grid-row: 1; grid-column: 1; min-width: 34px; }
.mbars-axis span { position: absolute; right: 0; transform: translateY(50%);
  font-size: 12px; line-height: 1; color: var(--text-tertiary);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.mbars-plot { position: relative; grid-row: 1; grid-column: 2; }
.mbars-plot > i { position: absolute; left: 0; right: 0; height: 0; }
.mbars-grid { border-top: 1px dashed var(--border); }
.mbars-base { border-top: 1px solid var(--border-strong); }
.mbars-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.mbars-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end;
  justify-content: center; min-width: 0; }
/* Flat at the base, rounded at the top. */
.mbars-bar { width: 58%; max-width: 64px; min-height: 2px; border-radius: 6px 6px 0 0;
  transition: filter .12s; }
.mbars-col:hover .mbars-bar { filter: brightness(1.15); }
.mbars-labels { grid-row: 2; grid-column: 2; display: flex; margin-top: 8px; }
.mbars-labels span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 12px;
  color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: clip; }

/* ---------------------------------------------------------------- bank summary
   The Recon sheet as the workbook lays it out: a title, the two balances, two
   banded sections of pending records with their sums. Debits negative in red,
   as on the sheet. */
.recon-sheet { width: 100%; border-collapse: collapse; }
.recon-sheet td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.recon-sheet td.date { white-space: nowrap; color: var(--text-secondary); width: 120px; }
.recon-sheet td.money { text-align: right; white-space: nowrap; width: 160px; }
.recon-sheet tr.title td { font-weight: 600; font-size: 17px; letter-spacing: -.01em; padding-top: 10px; }
.recon-sheet tr.band td { background: var(--surface-sunken); font-weight: 600; }
.recon-sheet tr.total td { font-weight: 600; border-bottom: 2px solid var(--border-strong); }
.recon-sheet tr.balance td { font-weight: 600; }
.recon-sheet tr.none td { color: var(--text-secondary); font-style: italic; }

/* The key to "Waiting on", under the outstanding list's filters. */
.status-legend { display: grid; gap: 8px; margin: 4px 0 var(--s4); padding: 12px 16px;
  background: var(--tint); border-radius: 10px; }
.status-legend-item { display: grid; grid-template-columns: minmax(170px, auto) 1fr;
  align-items: baseline; column-gap: 12px; font-size: var(--text-sm); color: var(--text-secondary); }
.status-legend-item .badge { justify-self: start; }
.status-legend-text strong { color: var(--ink); font-weight: 600; }

/* ===========================================================================
   Motor Claims dashboard, organised around the two books (September 2026)
   =========================================================================== */
.mdash-hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.qar { font-variant-numeric: tabular-nums; }

/* What moved in the last 30 days: one line under the brief. */
.mmove { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px;
  background: var(--surface); border-radius: var(--radius-card); padding: 14px 22px; }
.mmove-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.mmove-item { color: var(--text-secondary); }
.mmove-item strong { color: var(--ink); font-weight: 600; }
.mmove-value { color: var(--text-tertiary); }

/* A rule or definition, one tap away. */
.info { position: relative; display: inline-flex; vertical-align: middle; }
.info-btn { width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-secondary);
  font: italic 600 11px/1 Georgia, serif; cursor: pointer; display: inline-grid; place-items: center; }
.info-btn:hover, .info-btn[aria-expanded="true"] { border-color: var(--accent-500); color: var(--accent-500); }
.info-pop { position: absolute; z-index: 30; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: min(340px, 80vw); padding: 12px 14px; border-radius: 10px; background: var(--ink); color: #fff;
  font-size: var(--text-sm); font-weight: 400; line-height: 1.5; text-align: left; white-space: normal;
  box-shadow: 0 10px 30px rgba(35, 24, 68, .25); }

/* Where every debit note stands: the two books as a 2x2. */
.books { display: grid; grid-template-columns: 116px minmax(0, 1fr) minmax(0, 1fr); gap: 10px;
  margin-top: 16px; }
.books-one-sided { grid-template-columns: 116px minmax(0, 1fr); }
.books-col { align-self: end; padding: 0 4px; font-size: var(--text-sm); font-weight: 500;
  color: var(--text-secondary); }
.books-row { align-self: center; font-size: var(--text-sm); font-weight: 500; line-height: 1.3;
  color: var(--text-secondary); }
.books-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px;
  border: 0; border-radius: var(--radius-block); background: var(--tint); font: inherit; color: var(--text); text-align: left; }
button.books-cell { cursor: pointer; transition: background .12s; }
button.books-cell:hover { background: var(--tint-hover); }
.books-cell-title { font-weight: 600; color: var(--ink); }
.books-cell-value { font-size: clamp(22px, 2vw, 30px); font-weight: 600; letter-spacing: -.02em;
  line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.books-cell-value .unit { margin-left: 6px; font-size: var(--text-sm); font-weight: 500;
  letter-spacing: 0; color: var(--text-tertiary); }
.books-cell-count { font-size: var(--text-sm); color: var(--text-secondary); }
.books-cell-todo { margin-top: auto; padding-top: 8px; font-size: var(--text-sm); font-weight: 600;
  color: var(--accent-500); }
/* The corner with neither book: what is still owed, in maroon. */
.books-outstanding { background: var(--tint-owed); }
button.books-outstanding:hover { background: var(--tint-owed-hover); }
.books-outstanding .books-cell-title { color: var(--accent-500); }
.books-outstanding .books-cell-value { font-size: clamp(30px, 3vw, 44px); color: var(--accent-500); }
.books-outstanding .split { margin-top: 12px; }
/* The corner with both: closed, and quiet. */
.books-agreed { background: var(--tint-quiet); }
.books-agreed .books-cell-value, .books-agreed .books-cell-title { color: var(--text-secondary); }

/* The insurers: one line each, on shared scales. */
.board { display: flex; flex-direction: column; margin-top: 8px; }
.board-row { display: grid; width: 100%; padding: 10px 12px; column-gap: 18px; align-items: center;
  grid-template-columns: minmax(180px, 1.3fr) minmax(160px, 1.2fr) minmax(180px, 1.3fr) 120px;
  border: 0; border-radius: 10px; background: transparent; font: inherit; color: var(--text); text-align: left; }
button.board-row { cursor: pointer; }
button.board-row:hover { background: var(--tint); }
.board-row.is-chosen { background: var(--tint-owed); }
.board-labels { padding-bottom: 4px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-tertiary); }
.board-labels small { font-weight: 500; letter-spacing: 0; text-transform: none; }
.board-name { min-width: 0; }
.board-name strong { display: block; color: var(--ink); font-weight: 600; }
.board-name small { display: block; font-size: var(--text-xs); color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-owed, .board-tat { display: flex; align-items: center; gap: 10px; min-width: 0; }
.board-track { flex: 1; height: 8px; border-radius: 4px; background: var(--grey-150); overflow: hidden; }
.board-track i { display: block; height: 100%; border-radius: 4px; background: var(--accent-500); }
.board-owed-value { width: 64px; text-align: right; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; }
.board-tat-track { position: relative; flex: 1; height: 16px; }
.board-tat-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  border-radius: 1px; background: var(--grey-150); transform: translateY(-50%); }
.board-tat-book { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .45;
  transform: translateX(-1px); }
.board-tat-dot { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%;
  background: var(--ink); transform: translate(-50%, -50%); }
.board-tat-value { width: 72px; text-align: right; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; }
.board-coverage { margin-top: 6px; font-size: var(--text-sm); color: var(--text-secondary); }
.board-coverage strong { color: var(--ink); font-weight: 600; }

/* Who to chase: one group per insurer, opening onto its debit notes. */
.chase-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.chase-group { border-radius: var(--radius-block); background: var(--tint-soft); }
.chase-head { display: grid; width: 100%; padding: 12px 16px; gap: 14px; align-items: center;
  grid-template-columns: minmax(170px, 1.2fr) minmax(190px, 1.2fr) minmax(190px, 1.2fr) minmax(120px, .8fr) 20px;
  border: 0; border-radius: var(--radius-block); background: transparent; font: inherit; color: var(--text);
  text-align: left; cursor: pointer; }
.chase-head:hover { background: var(--tint-soft-hover); }
.chase-name { font-weight: 600; color: var(--ink); }
.chase-fig { font-variant-numeric: tabular-nums; }
.chase-fig strong { color: var(--ink); font-weight: 600; }
.chase-toggle::after { content: "\25BE"; display: inline-block; color: var(--text-tertiary); transition: transform .15s; }
.chase-group.is-open .chase-toggle::after { transform: rotate(180deg); }
.chase-group.is-open .chase-body { padding: 0 16px 14px; }
.mdash .chase-body table thead th { background: transparent; }
.over-bar { position: relative; display: inline-flex; align-items: center; min-width: 200px; height: 22px;
  padding: 0 8px; overflow: hidden; border-radius: 6px; background: var(--bad-50);
  font-size: var(--text-sm); font-weight: 600; color: var(--bad-700); }
.over-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(192, 43, 43, .18); }
.over-bar span { position: relative; }
.open-days { justify-content: flex-start; }

/* One bar split into parts, with its key. */
.share-bar { display: flex; height: 16px; overflow: hidden; border-radius: 8px; background: var(--grey-150); }
.share-bar i { display: block; height: 100%; }
.share-key { display: grid; gap: 6px; margin-top: 14px; }
.share-key-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) 70px 90px; gap: 10px;
  align-items: center; font-size: var(--text-sm); }
.share-key-row i { width: 10px; height: 10px; border-radius: 3px; }
.share-key-row .num { text-align: right; font-variant-numeric: tabular-nums; }

/* The analysis, folded away below the work. */
.mdash-more { border-radius: var(--radius-card); background: var(--surface); }
.mdash-more > summary { display: flex; align-items: center; gap: 10px; padding: 18px 24px;
  list-style: none; cursor: pointer; }
.mdash-more > summary::-webkit-details-marker { display: none; }
.mdash-more > summary::after { content: "\25BE"; margin-left: 12px; color: var(--text-tertiary); transition: transform .15s; }
.mdash-more[open] > summary::after { transform: rotate(180deg); }
.mdash-more-title { font-weight: 600; color: var(--ink); }
.mdash-more-body { display: flex; flex-direction: column; gap: var(--s5); padding: 0 24px 24px; }
.mdash-more-body .panel { background: var(--tint-soft); }
.mdash-more-body .panel table thead th { background: transparent; }

/* The assistant, as one line. */
body[data-department="motor"] #page-dashboard .assistant-card.assistant-brief { padding: 14px 22px; }
.assistant-brief-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.assistant-brief-text { color: var(--ink); }
.assistant-brief-note { font-size: var(--text-sm); color: var(--warn-700); }
.assistant-brief-more { margin-left: auto; font-size: var(--text-sm); font-weight: 600; color: var(--accent-500); }

@media (max-width: 1180px) {
  .board-row { grid-template-columns: minmax(140px, 1fr) minmax(120px, 1fr) minmax(130px, 1fr) 110px; }
  .chase-head { grid-template-columns: minmax(140px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) 20px; }
  .chase-head > .chase-fig:nth-of-type(4) { display: none; }
}

/* The hero, tightened: more room for the grid, a chart that fills its card. */
.mdash-hero { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.books { grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr); }
.books-one-sided { grid-template-columns: 92px minmax(0, 1fr); }
.mcard-chart { display: flex; flex-direction: column; }
.mcard-chart .mbars { flex: 1; grid-template-rows: minmax(210px, 1fr) auto; }
.mbars-labels span { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.mbars-labels small { font-size: 11px; color: var(--text-tertiary); }

/* Closed runs under both columns: a credit note on QIC's register closes the
   note whatever the insurer's side shows. */
.books-cell.books-wide { grid-column: span 2; }

/* The grid's figures are exact (16,080,937.02), so they need the room: below
   1600px the chart moves under the grid, and a figure scales with its cell
   rather than running out of it. */
@media (max-width: 1600px) {
  .mdash-hero { grid-template-columns: minmax(0, 1fr); }
}
.books-cell { container-type: inline-size; }
.books-cell-value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px;
  font-size: clamp(18px, 9.5cqi, 30px); }
.books-cell-value .unit { margin-left: 0; }
.books-outstanding .books-cell-value { font-size: clamp(20px, 11cqi, 44px); }

/* Awaiting our booking: each debit note beside the insurer's credit. */
.booking { display: flex; flex-direction: column; gap: 10px; }
.booking-intro { margin: 0 0 6px; color: var(--text-secondary); line-height: 1.5; }
.booking-card { border-radius: var(--radius-block); background: var(--tint-soft); padding: 12px 16px; }
.booking-line { display: grid; align-items: center; gap: 14px;
  grid-template-columns: minmax(0, 1.2fr) 16px minmax(0, 1.2fr) minmax(110px, auto) auto; }
.booking-who { display: flex; flex-direction: column; min-width: 0; }
.booking-who strong { color: var(--ink); font-weight: 600; }
.booking-arrow { color: var(--text-tertiary); }
.booking-amount { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.booking-actions { display: flex; gap: 6px; justify-content: flex-end; }
.booking-check { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--warn-50, #fff6e5);
  font-size: var(--text-sm); color: var(--warn-700); }
.booking-details { margin-top: 12px; }
.booking-compare { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: var(--surface);
  border-radius: 10px; overflow: hidden; }
.booking-compare th, .booking-compare td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--grey-150); }
.booking-compare thead th { font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-tertiary); }
.booking-compare tbody th { width: 130px; font-weight: 500; color: var(--text-secondary); }
.booking-compare tr:last-child th, .booking-compare tr:last-child td { border-bottom: 0; }
.booking-compare tr.booking-differs td { background: var(--warn-50, #fff6e5); color: var(--warn-700); font-weight: 600; }
.booking-why { margin-top: 10px; font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; }
.booking-booked { margin-top: 14px; }
.booking-booked h3 { margin: 0 0 6px; font-size: var(--text-md, 15px); color: var(--ink); }
@media (max-width: 760px) {
  .booking-line { grid-template-columns: minmax(0, 1fr) auto; }
  .booking-arrow { display: none; }
}

/* ===========================================================================
   The assistant on the Motor Claims dashboard: the brief, and AI insights
   =========================================================================== */
/* The brief: a card like every other on the page -- white, rounded, no edge. */
#page-dashboard .assistant-card.brief-card {
  border: 0; border-radius: var(--radius-card); background: var(--surface); box-shadow: none;
  padding: 22px 26px; cursor: default; }
.brief-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap; }
.brief-hello h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -.02em;
  line-height: 1.2; color: var(--accent-500); }
.brief-hello p { margin: 4px 0 0; color: var(--text-secondary); }
.brief-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brief-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm);
  color: var(--text-tertiary); }
.brief-state .spinner { width: 12px; height: 12px; }
.brief-md { margin-top: 16px; }
.brief-lead p { margin: 0; font-size: 16px; color: var(--ink); }
.brief-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.brief-section { border-radius: var(--radius-block); background: var(--tint-soft); padding: 14px 18px; }
.brief-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
  font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-secondary); }
.brief-section h3 .icon { width: 15px; height: 15px; color: var(--accent-500); }
.brief-section ul, .brief-section ol { margin: 0; }
.brief-loading .skeleton { height: 14px; margin-top: 14px; }
@media (max-width: 900px) { .brief-cols { grid-template-columns: 1fr; } }

/* Markdown, as the assistant writes it. */
.md { color: var(--ink); line-height: 1.6; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 4px 0 0; }
.md strong { font-weight: 600; color: var(--ink); }
.md code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em;
  background: var(--grey-100); padding: 1px 5px; border-radius: 4px; }
.md pre { margin: 0 0 8px; padding: 10px 12px; overflow-x: auto; border-radius: 8px; background: var(--grey-50); }
.md pre code { background: none; padding: 0; }
.md .md-h { margin: 12px 0 6px; font-size: 1em; font-weight: 600; color: var(--ink); }
.md h3.md-h { font-size: 1.06em; }
.md blockquote { margin: 0 0 8px; padding: 2px 12px; border-left: 3px solid var(--grey-200);
  color: var(--text-secondary); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.md a { color: var(--accent-500); }
.md-link { appearance: none; display: inline; border: 0; background: none; padding: 0; font: inherit;
  font-weight: 600; color: var(--accent-500); cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px; }
.md-link:hover { color: var(--accent-700); }
.md-link-arrow { display: inline-block; margin-left: 3px; text-decoration: none; }
.md-table-wrap { margin: 0 0 8px; overflow-x: auto; }
.md-table { min-width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.md-table th, .md-table td { padding: 5px 10px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: top; }
.md-table th { font-weight: 600; color: var(--text-secondary); background: var(--grey-50); }
.md-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.md-table .center { text-align: center; }
.assistant-bubble.md-bubble { white-space: normal; }
.assistant-turn.assistant .assistant-bubble.md-bubble { max-width: 100%; }

/* AI insights: a button in each panel's heading, the note folded under it. */
.insight-slot { display: inline-flex; flex: none; }
.mcard-head > .insight-slot, .card-head > .insight-slot, .mmove > .insight-slot { margin-left: auto; }
.mcard-head > .mcard-hint ~ .insight-slot, .card-head > .actions ~ .insight-slot { margin-left: 12px; }
.panel-head.has-insight { position: relative; padding-right: 150px; }
.panel-head > .insight-slot { position: absolute; top: 0; right: 0; }
.insight-toggle { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font: inherit;
  font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); white-space: nowrap;
  cursor: pointer; }
.insight-toggle:hover, .insight-toggle.is-open { border-color: var(--accent-500);
  background: var(--accent-50); color: var(--accent-500); }
.insight-spark { font-size: 12px; color: var(--accent-500); }
.insight-toggle .spinner { width: 12px; height: 12px; }
.insight-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-500); }
.insight { margin: 12px 0 6px; padding: 14px 18px; border-radius: var(--radius-block); background: var(--tint-note); }
.insight-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px;
  font-size: var(--text-xs); color: var(--text-tertiary); }
.insight-label { font-weight: 600; letter-spacing: .02em; color: var(--accent-500); }
.insight-rerun { appearance: none; border: 0; background: none; padding: 0; font: inherit;
  font-size: var(--text-xs); font-weight: 600; color: var(--accent-500); text-decoration: underline;
  cursor: pointer; }
.insight-rerun:disabled { color: var(--text-tertiary); cursor: default; }
.insight-stale { margin-bottom: 10px; padding: 6px 10px; border-radius: 8px; background: var(--warn-50);
  font-size: var(--text-sm); color: var(--warn-700); }
.insight-stale .insight-rerun { font-size: var(--text-sm); color: var(--warn-700); }
.insight-note { margin: 0; font-size: var(--text-sm); color: var(--text-secondary); }
.insight-failed { color: var(--bad-700); }
.insight-check { margin-top: 8px; }
.mmove-wrap { border-radius: var(--radius-card); background: var(--surface); }
.mmove-wrap > .insight { margin: 0 22px 14px; }
@media (max-width: 760px) {
  .panel-head.has-insight { padding-right: 0; }
  .panel-head > .insight-slot { position: static; margin-bottom: 8px; }
}

/* Part payments: the share of the Current Outstanding that is the rest of
   debit notes an insurer has paid part of, and the booking drawer's note. */
.books-partial { appearance: none; display: block; margin-top: 6px; padding: 0; border: 0;
  background: none; font: inherit; font-size: var(--text-sm); font-weight: 500; text-align: left;
  color: var(--accent-500); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.books-partial:hover { color: var(--accent-700); }
.booking-part { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--tint-info);
  font-size: var(--text-sm); color: var(--ink); }

/* ===========================================================================
   Motor Claims: words, not pills; and a dashboard that reads larger
   =========================================================================== */
/* A keyword keeps its colour and gains an icon of its own (app.js
   KEYWORD_ICONS); the pill's fill and outline go. */
body[data-department="motor"] .badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; border-radius: 0;
  background: none; font-size: var(--text-sm); font-weight: 600; line-height: 1.3; white-space: nowrap; }
body[data-department="motor"] .badge-neutral { color: var(--text-secondary); }
/* The icon is drawn in its word's own colour, not the brand maroon every
   other icon takes. */
body[data-department="motor"] .keyword-icon { width: 1.15em; height: 1.15em; flex: none;
  color: inherit; }
/* The follow-up's bands: words to click, the chosen one underlined in maroon. */
body[data-department="motor"] .assistant-asks .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0;
  border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--text-secondary); font-weight: 500; }
body[data-department="motor"] .assistant-asks .chip:hover {
  background: none; color: var(--accent-500); }
body[data-department="motor"] .assistant-asks .chip.chip-on {
  background: none; color: var(--accent-500); border-bottom-color: var(--accent-500); font-weight: 600; }
body[data-department="motor"] .assistant-asks { gap: 6px 20px; }
/* "AI insights": a word with its spark, not a pill either. */
body[data-department="motor"] .insight-toggle { height: auto; padding: 2px 0; border: 0; background: none;
  color: var(--accent-500); font-weight: 600; }
body[data-department="motor"] .insight-toggle:hover,
body[data-department="motor"] .insight-toggle.is-open { background: none; color: var(--accent-700);
  text-decoration: underline; text-underline-offset: 3px; }

/* The dashboard's own type, a size up from the rest of Motor Claims. */
body[data-department="motor"][data-page="dashboard"] {
  --text-xs: 13px; --text-sm: 15px; --text-base: 16px;
  --text-md: 17px; --text-lg: 20px; --text-xl: 24px;
}
body[data-department="motor"][data-page="dashboard"] .mcard-head { font-size: 17px; }
body[data-department="motor"][data-page="dashboard"] .panel-head .eyebrow,
body[data-department="motor"][data-page="dashboard"] .panel-head .sub { font-size: 15.5px; }

/* The brief: a larger greeting, and its two lists on the card itself. */
.brief-hello h2 { font-size: 36px; }
.brief-section { background: none; padding: 0; border-radius: 0; }
.brief-cols { gap: 16px 48px; margin-top: 18px; }
.brief-section h3 { font-size: var(--text-sm); }

/* The insurers: the board fills its width -- larger names, figures and bars. */
.mdash .board-row { padding: 14px 16px; column-gap: 28px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(220px, 1.4fr) minmax(240px, 1.5fr) 150px; }
.mdash .board-name strong { font-size: 17.5px; }
.mdash .board-name small { font-size: 13.5px; margin-top: 2px; }
.mdash .board-track { height: 12px; border-radius: 6px; }
.mdash .board-track i { border-radius: 6px; }
.mdash .board-owed-value { width: 84px; font-size: 18px; }
.mdash .board-tat-track { height: 20px; }
.mdash .board-tat-dot { width: 14px; height: 14px; }
.mdash .board-tat-value { width: 88px; font-size: 16px; }
.mdash .board-labels { font-size: 13px; }
.mdash .board-coverage { font-size: 15px; }
.mdash .board-overdue .badge { font-size: 15px; }
@media (max-width: 1180px) {
  .mdash .board-row { grid-template-columns: minmax(150px, 1fr) minmax(130px, 1fr) minmax(140px, 1fr) 120px; }
}
/* The outstanding list at the dashboard's larger type: the pending action
   reads a size down, so the list fits its card without scrolling sideways. */
body[data-department="motor"][data-page="dashboard"] #pending-claims td.text-full {
  font-size: 14px; min-width: 200px; }
body[data-department="motor"][data-page="dashboard"] #pending-claims .data th,
body[data-department="motor"][data-page="dashboard"] #pending-claims .data td {
  padding-left: 10px; padding-right: 10px; }
body[data-department="motor"][data-page="dashboard"] #pending-claims .data td:first-child {
  white-space: normal; max-width: 140px; }

/* ===========================================================================
   Motor Claims: the credit notes read from PDFs, reviewed beside their pages
   =========================================================================== */
.drawer.drawer-pdfr { width: min(1440px, 97vw); }
.drawer-pdfr .drawer-body { display: flex; flex-direction: column; padding: 16px 20px; overflow: hidden; }
.pdfr { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.pdfr-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pdfr-bar .select { min-width: 380px; max-width: 100%; }
.pdfr-summary { font-size: var(--text-sm); color: var(--text-secondary); }
.pdfr-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); }
.pdfr-tab { appearance: none; display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px;
  padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit;
  font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.pdfr-tab:hover { color: var(--accent-500); }
.pdfr-tab.is-on { border-bottom-color: var(--accent-500); color: var(--accent-500); font-weight: 600; }
.pdfr-tab-count { font-variant-numeric: tabular-nums; opacity: .8; }
.pdfr-main { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px;
  flex: 1; min-height: 0; }
.pdfr-list { min-height: 0; overflow-y: auto; padding-right: 8px; border-right: 1px solid var(--border); }
.pdfr-list:focus-visible { outline: 2px solid var(--accent-500); outline-offset: 2px; }
.pdfr-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; font: inherit;
  text-align: left; color: var(--text); cursor: pointer; }
.pdfr-row:hover { background: var(--tint); }
.pdfr-row.is-chosen { background: var(--tint-owed); }
.pdfr-row-page { font-size: var(--text-xs); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.pdfr-row-main strong { display: block; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.pdfr-row-main small, .pdfr-row-amount small { display: block; font-size: var(--text-xs); color: var(--text-tertiary); }
.pdfr-row-amount { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.pdfr-row-amount small { color: var(--info-700); }
.pdfr-detail { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; padding-right: 4px; }
.pdfr-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pdfr-detail-head h3 { margin: 0; font-size: 20px; color: var(--ink); }
.pdfr-page { flex: none; width: 100%; height: 62vh; min-height: 420px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--tint); }
.pdfr-page-none { display: grid; place-items: center; color: var(--text-secondary); }
.pdfr-block h4 { margin: 0 0 8px; font-size: var(--text-sm); font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-secondary); }
.pdfr-read { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.pdfr-read dt { color: var(--text-secondary); }
.pdfr-read dd { margin: 0; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.pdfr-reason { margin: 0; line-height: 1.5; color: var(--text-secondary); }
.pdfr-actions { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius-block); background: var(--tint-soft); }
.pdfr-candidates { display: flex; flex-direction: column; gap: 6px; }
.pdfr-candidate { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px; background: var(--surface); }
.pdfr-candidate strong, .pdfr-candidate small { display: block; }
.pdfr-candidate small { font-size: var(--text-xs); color: var(--text-tertiary); }
.pdfr-candidate-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .pdfr-main { grid-template-columns: 1fr; }
  .pdfr-list { max-height: 240px; border-right: 0; }
}
/* The review window: a debit-note value that agrees with the credit note. */
.pdfr-agrees { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ok-700); }
.pdfr-agrees-icon { width: 14px; height: 14px; color: inherit; }
.pdfr-differs { font-weight: 600; color: var(--warn-700); }

/* ===========================================================================
   Every department's dashboard reads like Motor Claims' (September 2026, at
   the business's request): a size up, keywords as coloured words with an icon
   of their own, and the chips and "AI insights" as words. Written with
   :where() so the specificity is the bare selector's: Motor Claims' own rules
   above still win on its pages.
   =========================================================================== */
:where(#page-dashboard, #page-executive) {
  --text-xs: 13px; --text-sm: 15px; --text-base: 16px;
  --text-md: 17px; --text-lg: 20px; --text-xl: 24px;
  font-size: var(--text-base);
}
:where(#page-dashboard, #page-executive) .mcard-head { font-size: 17px; }
:where(#page-dashboard, #page-executive) .panel-head .eyebrow,
:where(#page-dashboard, #page-executive) .panel-head .sub,
:where(#page-dashboard, #page-executive) .metric .label { font-size: 14.5px; }
:where(#page-dashboard, #page-executive) .badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; border-radius: 0;
  background: none; font-size: var(--text-sm); font-weight: 600; line-height: 1.3; white-space: nowrap; }
:where(#page-dashboard, #page-executive) .badge-neutral { color: var(--text-secondary); }
:where(#page-dashboard, #page-executive) .classification {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-sm); }
.keyword-icon { width: 1.15em; height: 1.15em; flex: none; color: inherit; }
:where(#page-dashboard, #page-executive) .assistant-asks .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0;
  border-bottom: 2px solid transparent; border-radius: 0; background: none;
  color: var(--text-secondary); font-weight: 500; }
:where(#page-dashboard, #page-executive) .assistant-asks .chip:hover { background: none; color: var(--accent-500); }
:where(#page-dashboard, #page-executive) .insight-toggle { height: auto; padding: 2px 0; border: 0;
  background: none; color: var(--accent-500); font-weight: 600; }
:where(#page-dashboard, #page-executive) .insight-toggle:hover,
:where(#page-dashboard, #page-executive) .insight-toggle.is-open { background: none; color: var(--accent-700);
  text-decoration: underline; text-underline-offset: 3px; }

/* A spinner wherever one is drawn: the brief's and a note's had only a size. */
.spinner { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent-500);
  animation: spin .8s linear infinite; }

/* The figures the dashboard showed before, folded: each piece a tinted block. */
.dash-more-detail .mdash-more-body .card { background: var(--tint-soft); }
.dash-more-detail .mdash-more-body .card table thead th { background: var(--tint-soft); }
.dash-more-detail .mdash-more-body .metrics { border-bottom: 0; }
.dash-more-detail .mdash-more-body .grid-2 { gap: var(--s5); }
.mdash .dash-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .mdash .dash-pair { grid-template-columns: minmax(0, 1fr); } }

/* The two-books grids of Reinsurance and Bank: wider row heads. */
.dash-ri .books, .dash-bank .books { grid-template-columns: 124px minmax(0, 1fr) minmax(0, 1fr); }
.books-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-top: 14px;
  font-size: var(--text-sm); color: var(--text-secondary); }

/* The counterparties: open on each book along one bar, maroon QIC's, grey theirs. */
.dash-ri .board-row { grid-template-columns: minmax(200px, 1.4fr) minmax(240px, 1.6fr) 110px 110px 130px; }
@media (max-width: 1180px) {
  .dash-ri .board-row { grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.2fr) 80px 80px 100px; }
}
.board-split { display: flex; }
.board-split i { flex: none; border-radius: 0; }
.board-split i.ours { background: var(--accent-500); }
.board-split i.theirs { background: var(--ink-300); }
.board-fig { font-variant-numeric: tabular-nums; color: var(--ink); }

/* A proof: lines that add up, and the check at the end. */
.proof { display: flex; flex-direction: column; margin-top: 12px; }
.proof-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 12px;
  align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); }
.proof-op { color: var(--text-tertiary); font-weight: 600; text-align: center; }
.proof-label { min-width: 0; color: var(--text); }
.proof-label small { display: block; font-size: var(--text-sm); font-weight: 400; color: var(--text-secondary); }
.proof-value { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.proof-balance .proof-label { font-weight: 600; color: var(--ink); }
.proof-balance .proof-value { font-size: clamp(17px, 1.6vw, 22px); font-weight: 600; color: var(--ink); }
.proof-balance .proof-value .negative { color: var(--bad-500); }
.proof-sub { margin: 14px 0 2px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-tertiary); }
.proof-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 14px;
  padding: 12px 16px; border-radius: var(--radius-block); background: var(--tint); }
.proof-result.is-off { background: var(--tint-owed); }
.proof-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; font-size: var(--text-sm); }
.proof-links .linkish { font-weight: 600; text-decoration: none; }
.proof-links .linkish:hover { text-decoration: underline; }

/* Kinds side by side: label, bar, count, size. */
.kind-block { margin-top: 16px; }
.kind-head { margin-bottom: 6px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-tertiary); }
.kind-block .bar-table > div { padding: 8px 0; }
.kind-block .bar-table .bar-track { height: 8px; border-radius: 4px; background: var(--grey-150); }
.kind-block .bar-table .bar-fill { border-radius: 4px; background: var(--accent-500); }

/* Thirty days in a row: thinner columns. */
.mbars-dense .mbars-bar { width: 64%; max-width: 22px; border-radius: 4px 4px 0 0; }

/* Past the pairing window: what the engine will no longer settle on its own. */
.cell-late { font-weight: 600; color: var(--accent-500); }
.mdash .banner { margin-bottom: 0; }

/* At the dashboard's larger type the folded tables read one under another,
   and the lists of items tighten like Motor Claims' outstanding list. */
.dash-more-detail .mdash-more-body .grid-2 { grid-template-columns: minmax(0, 1fr); }
#bank-attention .data th, #bank-attention .data td,
#ri-raise .data th, #ri-raise .data td { padding-left: 8px; padding-right: 8px; }
#bank-attention td.text-full { min-width: 200px; font-size: 14px; }
#ri-raise td.text-wrap { font-size: 14px; }
#bank-attention .classification, #ri-raise .classification { white-space: normal; }


/* ===========================================================================
   The Bank dashboard, in the business's layout (September 2026): the balance
   check, a search, the day's lists and its steps.
   =========================================================================== */
.balance-card { padding: 22px 26px; }
.balance-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.balance-figure { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.balance-label { font-size: var(--text-sm); color: var(--text-secondary); }
.balance-value { font-size: clamp(26px, 2.6vw, 38px); font-weight: 600; letter-spacing: -.02em;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.balance-op { font-size: 26px; color: var(--text-tertiary); }
.balance-mark { margin-left: auto; display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; background: var(--ok-50); color: var(--ok-700); }
.balance-mark .icon { width: 26px; height: 26px; color: inherit; }
.balance-mark.is-off { background: var(--bad-50); color: var(--bad-700); }
.balance-meta { margin-top: 12px; font-size: var(--text-sm); color: var(--text-secondary); }
.balance-meta .linkish { font-weight: 600; }

.bank-search { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: 12px; align-items: flex-end; }
.bank-search .select { min-width: 170px; }
.bank-search-box { flex: 0 1 380px; }
.bank-results:empty { display: none; }
.bank-warnings { margin: 10px 0 0; padding-left: 20px; color: var(--warn-700); line-height: 1.7; }

.blists { display: flex; flex-direction: column; margin-top: 8px; }
.blist { padding: 14px 0 10px; border-bottom: 1px solid var(--border); }
.blist:last-child { border-bottom: 0; }
.blist-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.blist-title { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  font-weight: 600; color: var(--ink); }
.blist-title small { font-size: var(--text-xs); font-weight: 500; letter-spacing: .03em;
  color: var(--text-tertiary); }
.blist-head .blist-figs { margin-left: auto; }
.blist-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center;
  column-gap: 12px; padding: 8px 0 8px 18px; border-top: 1px solid var(--grey-100); }
.blists > .blist-step { padding-left: 0; }
.blists > .blist-step:first-child { border-top: 0; }
.blist-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--tint); color: var(--ink); font-size: var(--text-xs); font-weight: 600; }
.blist-words { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.blist-figs { font-size: var(--text-sm); color: var(--text-secondary); font-variant-numeric: tabular-nums;
  white-space: nowrap; text-align: right; }
.blist-rules { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--text-sm);
  color: var(--text-secondary); }
.blist-rule::before { content: "· "; }
.blist-items { margin: 6px 0 0 18px; }
.blist-items > summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--accent-500);
  list-style: none; }
.blist-items > summary::-webkit-details-marker { display: none; }
.blist-items[open] > summary { margin-bottom: 8px; }
.blist-items .table-wrap { max-height: 420px; overflow: auto; }

/* Reinsurance: QIC's outstanding, one figure. */
.outstanding-one { margin-top: 16px; padding: 22px 24px; }
.outstanding-one .books-cell-value { font-size: clamp(34px, 4vw, 52px); }
.outstanding-one .books-cell-todo { align-self: flex-start; text-decoration: none; }
/* Motor: the Current Outstanding alone in its card (October 2026). */
.books-card > .outstanding-one { width: 100%; text-align: left; }

/* The Entry drawer: what was looked for on the other book, and where. */
.looked { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.looked-row { display: grid; grid-template-columns: 96px minmax(0, 160px) minmax(0, 1fr); gap: 10px;
  align-items: baseline; font-size: var(--text-sm); }
.looked-field { color: var(--text-secondary); }
.looked-value { overflow-wrap: anywhere; }
.looked-where { overflow-wrap: anywhere; color: var(--text-secondary); }

/* Motor: Received Payment Without Request -- credit notes no debit note answers. */
.unasked-card { display: flex; flex-direction: column; gap: 12px; }
.unasked-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.unasked-figure .books-cell-value { color: var(--ink); }
.unasked-insurers { display: flex; flex-wrap: wrap; gap: 8px; }
.unasked-insurer { appearance: none; display: inline-flex; align-items: baseline; gap: 10px;
  padding: 8px 14px; border: 0; border-radius: var(--radius-block); background: var(--tint-soft);
  font: inherit; color: inherit; cursor: pointer; text-align: left; }
.unasked-insurer:hover { background: var(--tint-soft-hover); }
.unasked-name { font-weight: 600; color: var(--ink); }
.unasked-value { font-variant-numeric: tabular-nums; }
.unasked-card.is-none { gap: 6px; }
