/* ============================================================================
   ARC — Motor Claims Management Platform
   Design system  ·  Petrol-teal + signal-amber  ·  Fraunces / IBM Plex
   ============================================================================ */

/* ---- Tokens --------------------------------------------------------------- */
:root {
  /* Brand */
  --brand:        oklch(0.46 0.078 205);   /* petrol teal */
  --brand-deep:   oklch(0.34 0.062 205);
  --brand-ink:    oklch(0.22 0.032 210);   /* near-black petrol */
  --brand-soft:   oklch(0.95 0.018 200);
  --brand-line:   oklch(0.88 0.024 205);

  --accent:       oklch(0.76 0.152 68);    /* signal amber */
  --accent-deep:  oklch(0.66 0.16 55);
  --accent-soft:  oklch(0.95 0.05 78);

  /* Neutral ramp (cool off-white, chroma ~0) */
  --bg:           oklch(0.985 0.003 220);
  --surface:      oklch(1 0 0);
  --surface-2:    oklch(0.975 0.004 220);
  --surface-3:    oklch(0.955 0.006 218);
  --line:         oklch(0.915 0.006 220);
  --line-strong:  oklch(0.86 0.008 220);

  --ink:          oklch(0.24 0.02 220);    /* body text */
  --ink-2:        oklch(0.44 0.016 220);   /* secondary */
  --ink-3:        oklch(0.58 0.014 220);   /* muted (still ≥4.5 on surface) */
  --ink-inv:      oklch(0.98 0.003 220);

  /* Status */
  --ok:      oklch(0.60 0.13 155);
  --ok-bg:   oklch(0.955 0.04 155);
  --warn:    oklch(0.70 0.15 70);
  --warn-bg: oklch(0.96 0.05 78);
  --danger:  oklch(0.58 0.19 25);
  --danger-bg: oklch(0.955 0.04 25);
  --info:    oklch(0.58 0.11 240);
  --info-bg: oklch(0.955 0.03 240);
  --litig:   oklch(0.48 0.15 320);         /* litigation purple */
  --litig-bg: oklch(0.955 0.035 320);

  /* Channel colours (activity timeline tags) */
  --ch-email:    oklch(0.55 0.12 250);
  --ch-sms:      oklch(0.58 0.13 160);
  --ch-whatsapp: oklch(0.62 0.14 150);
  --ch-call:     oklch(0.60 0.13 40);
  --ch-note:     oklch(0.55 0.02 240);
  --ch-doc:      oklch(0.55 0.13 300);
  --ch-system:   oklch(0.60 0.01 240);

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

  /* Radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 2px oklch(0.3 0.03 220 / 0.06), 0 1px 3px oklch(0.3 0.03 220 / 0.05);
  --sh-2: 0 4px 12px oklch(0.3 0.03 220 / 0.08), 0 1px 3px oklch(0.3 0.03 220 / 0.05);
  --sh-3: 0 12px 32px oklch(0.3 0.03 220 / 0.12), 0 4px 8px oklch(0.3 0.03 220 / 0.06);
  --sh-pop: 0 20px 48px oklch(0.2 0.03 220 / 0.18);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);       /* ease-out-quint */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.28s;

  /* Z-scale */
  --z-base: 1; --z-dropdown: 100; --z-sticky: 200;
  --z-backdrop: 300; --z-modal: 400; --z-toast: 500; --z-tooltip: 600;

  --sidebar-w: 248px;
  --topbar-h: 60px;
}

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); color: var(--brand-ink); }

/* ---- Type helpers --------------------------------------------------------- */
.display { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 500; letter-spacing: -0.02em; line-height: 1.02; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.eyebrow-none {}
h1,h2,h3,h4 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  --_bg: var(--brand); --_fg: var(--ink-inv); --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 18px; border-radius: var(--r-md);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd);
  font-weight: 550; font-size: 14px; letter-spacing: 0.005em; white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  box-shadow: var(--sh-1);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; }
.btn--accent { --_bg: var(--accent-deep); --_fg: oklch(0.2 0.03 60); }
.btn--ghost  { --_bg: transparent; --_fg: var(--ink); --_bd: var(--line-strong); box-shadow: none; }
.btn--ghost:hover { --_bg: var(--surface-2); box-shadow: var(--sh-1); }
.btn--dark   { --_bg: var(--brand-ink); --_fg: var(--ink-inv); }
.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--lg { padding: 14px 26px; font-size: 15px; }
.btn--block { display: flex; width: 100%; }

/* ---- Badges / status pills ------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-3); color: var(--ink-2); line-height: 1.4;
  border: 1px solid transparent; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok     { background: var(--ok-bg); color: oklch(0.42 0.12 155); }
.pill--warn   { background: var(--warn-bg); color: oklch(0.5 0.14 60); }
.pill--danger { background: var(--danger-bg); color: oklch(0.48 0.18 25); }
.pill--info   { background: var(--info-bg); color: oklch(0.46 0.11 250); }
.pill--litig  { background: var(--litig-bg); color: oklch(0.44 0.15 320); }
.pill--brand  { background: var(--brand-soft); color: var(--brand-deep); }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---- Cards / panels ------------------------------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line);
}
.panel__head h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.panel__body { padding: var(--sp-5); }

/* ---- App shell ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; align-self: start;
  background: var(--brand-ink); color: oklch(0.82 0.02 210);
  display: flex; flex-direction: column; z-index: var(--z-sticky);
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; }
.sidebar__brand .logo { width: 30px; height: 30px; }
.sidebar__brand b { font-family: var(--font-display); font-size: 19px; color: #fff; letter-spacing: -0.01em; font-weight: 600; }
.sidebar__brand span { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: oklch(0.7 0.03 205); display: block; margin-top: -2px; }
.nav-group { padding: 6px 12px; }
.nav-group__label { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: oklch(0.6 0.03 210); padding: 12px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-md);
  color: oklch(0.8 0.02 210); font-size: 13.5px; font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link svg { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-link:hover { background: oklch(0.28 0.03 210); color: #fff; }
.nav-link.is-active { background: oklch(0.3 0.045 205); color: #fff; }
.nav-link.is-active svg { opacity: 1; color: var(--accent); }
.nav-link .badge-n { margin-left: auto; background: var(--accent-deep); color: oklch(0.2 0.03 60); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-pill); }
.sidebar__foot { margin-top: auto; padding: 14px; border-top: 1px solid oklch(0.3 0.02 210); }
.userchip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); transition: background var(--dur); }
.userchip:hover { background: oklch(0.28 0.03 210); }
.userchip .avatar { width: 34px; height: 34px; }
.userchip .meta b { color: #fff; font-size: 13px; font-weight: 600; display: block; }
.userchip .meta span { font-size: 11.5px; color: oklch(0.65 0.03 205); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-6); background: oklch(1 0 0 / 0.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.topbar__title small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); letter-spacing: 0; }
.search {
  display: flex; align-items: center; gap: 9px; flex: 1; max-width: 420px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 8px 13px; color: var(--ink-3); margin-left: var(--sp-2);
}
.search input { border: none; background: none; outline: none; flex: 1; font-size: 13.5px; color: var(--ink); }
.search svg { width: 16px; height: 16px; }
.search kbd { font-family: var(--font-mono); font-size: 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--ink-3); }
.iconbtn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-md);
  color: var(--ink-2); transition: background var(--dur), color var(--dur); position: relative;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn .ping { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; background: var(--accent-deep); border-radius: 50%; border: 2px solid var(--surface); }

.content { padding: var(--sp-6); max-width: 1440px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: var(--sp-5); display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(24px, 3vw, 30px); font-weight: 550; letter-spacing: -0.02em; }
.page-head p { color: var(--ink-2); font-size: 14px; margin-top: 3px; }

/* ---- Avatar --------------------------------------------------------------- */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 650; color: #fff; letter-spacing: 0.01em; flex-shrink: 0;
  background: var(--brand); overflow: hidden;
}
.avatar.a2 { background: oklch(0.55 0.12 40); }
.avatar.a3 { background: oklch(0.5 0.12 150); }
.avatar.a4 { background: oklch(0.5 0.13 300); }
.avatar.a5 { background: oklch(0.52 0.12 250); }
.avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }

/* ---- Stat tiles ----------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-4); }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--sp-5); position: relative; overflow: hidden;
}
.stat__label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.stat__label svg { width: 15px; height: 15px; color: var(--brand); }
.stat__val { font-family: var(--font-display); font-size: 32px; font-weight: 550; letter-spacing: -0.02em; margin-top: 10px; line-height: 1; }
.stat__val small { font-size: 16px; color: var(--ink-3); font-family: var(--font-sans); }
.stat__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 10px; }
.stat__delta.up { color: oklch(0.5 0.12 155); }
.stat__delta.down { color: oklch(0.55 0.18 25); }
.stat__spark { position: absolute; right: 14px; bottom: 12px; opacity: 0.9; }

/* ---- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.data thead th {
  text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; white-space: nowrap;
}
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: background var(--dur); }
table.data tbody tr:hover { background: var(--surface-2); cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: none; }
.cell-primary { font-weight: 600; color: var(--ink); }
.cell-sub { color: var(--ink-3); font-size: 12px; }
.ref { font-family: var(--font-mono); font-size: 12.5px; color: var(--brand-deep); font-weight: 500; }

/* ---- Stage stepper (9-stage journey) -------------------------------------- */
.stepper { display: flex; align-items: stretch; overflow-x: auto; gap: 0; scrollbar-width: thin; }
.step {
  flex: 1; min-width: 108px; position: relative; padding: 14px 12px 14px 22px;
  background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.step:first-child { border-left: 1px solid var(--line); border-radius: var(--r-md) 0 0 var(--r-md); }
.step:last-child { border-right: 1px solid var(--line); border-radius: 0 var(--r-md) var(--r-md) 0; }
.step::after {
  content: ""; position: absolute; right: -11px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 20px; height: 20px; background: var(--surface-2);
  border-right: 1px solid var(--line); border-top: 1px solid var(--line); z-index: 2; border-radius: 0 5px 0 0;
}
.step:last-child::after { display: none; }
.step__n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); font-weight: 600; }
.step__name { font-size: 12px; font-weight: 600; margin-top: 2px; line-height: 1.25; color: var(--ink-2); }
.step.is-done { background: var(--brand-soft); }
.step.is-done::after { background: var(--brand-soft); border-color: var(--brand-line); }
.step.is-done .step__name { color: var(--brand-deep); }
.step.is-done .step__n { color: var(--brand); }
.step.is-current { background: var(--brand-ink); border-color: var(--brand-ink); }
.step.is-current::after { background: var(--brand-ink); border-color: var(--brand-ink); }
.step.is-current .step__name { color: #fff; }
.step.is-current .step__n { color: var(--accent); }

/* ---- Activity timeline (unified, tagged) ---------------------------------- */
.timeline { position: relative; padding-left: 8px; }
.tl-item { position: relative; padding: 0 0 var(--sp-5) 40px; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 30px; bottom: -6px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-icon {
  position: absolute; left: 0; top: 2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line);
  z-index: 1; color: var(--ch-note);
}
.tl-icon svg { width: 15px; height: 15px; }
.tl-item[data-ch="email"] .tl-icon { color: var(--ch-email); border-color: color-mix(in oklch, var(--ch-email) 40%, var(--line)); background: color-mix(in oklch, var(--ch-email) 8%, var(--surface)); }
.tl-item[data-ch="sms"] .tl-icon { color: var(--ch-sms); border-color: color-mix(in oklch, var(--ch-sms) 40%, var(--line)); background: color-mix(in oklch, var(--ch-sms) 8%, var(--surface)); }
.tl-item[data-ch="whatsapp"] .tl-icon { color: var(--ch-whatsapp); border-color: color-mix(in oklch, var(--ch-whatsapp) 40%, var(--line)); background: color-mix(in oklch, var(--ch-whatsapp) 8%, var(--surface)); }
.tl-item[data-ch="call"] .tl-icon { color: var(--ch-call); border-color: color-mix(in oklch, var(--ch-call) 40%, var(--line)); background: color-mix(in oklch, var(--ch-call) 8%, var(--surface)); }
.tl-item[data-ch="doc"] .tl-icon { color: var(--ch-doc); border-color: color-mix(in oklch, var(--ch-doc) 40%, var(--line)); background: color-mix(in oklch, var(--ch-doc) 8%, var(--surface)); }
.tl-item[data-ch="system"] .tl-icon { color: var(--ch-system); }
.tl-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tl-head b { font-size: 13.5px; font-weight: 600; }
.tl-head time { font-size: 12px; color: var(--ink-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.tl-body { margin-top: 5px; font-size: 13.5px; color: var(--ink-2); }
.tl-card {
  margin-top: 9px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; color: var(--ink-2);
}
.tl-card .subject { font-weight: 600; color: var(--ink); margin-bottom: 3px; }

/* ---- Forms ---------------------------------------------------------------- */
.field { margin-bottom: var(--sp-4); }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 10px 13px; font-size: 14px; transition: border var(--dur), box-shadow var(--dur);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 15%, transparent); }
.textarea { resize: vertical; min-height: 90px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* ---- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 11px 16px; font-size: 13.5px; font-weight: 550; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--dur), border var(--dur); white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-deep); border-bottom-color: var(--brand); }
.tab .badge-n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fadeUp 0.35s var(--ease); }

/* ---- Utilities ------------------------------------------------------------ */
.grid { display: grid; gap: var(--sp-5); }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.items-center { align-items: center; }
.gap-1 { gap: var(--sp-1);} .gap-2 { gap: var(--sp-2);} .gap-3 { gap: var(--sp-3);} .gap-4 { gap: var(--sp-4);}
.wrap { flex-wrap: wrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mt-4 { margin-top: var(--sp-4);} .mt-5 { margin-top: var(--sp-5);} .mt-6 { margin-top: var(--sp-6);}
.mb-4 { margin-bottom: var(--sp-4);} .mb-5 { margin-bottom: var(--sp-5);}
.col-span-2 { grid-column: span 2; }
.hide-mobile {}
.divider { height: 1px; background: var(--line); margin: var(--sp-4) 0; }

/* Segmented control */
.segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segment button { padding: 6px 13px; font-size: 13px; font-weight: 550; border-radius: 7px; color: var(--ink-2); transition: background var(--dur), color var(--dur); }
.segment button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* Progress bar */
.bar { height: 7px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: var(--r-pill); }
.bar > span.amber { background: var(--accent-deep); }
.bar > span.green { background: var(--ok); }
.bar > span.red { background: var(--danger); }

/* Filter bar */
.filterbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 550; color: var(--ink-2);
  transition: all var(--dur);
}
.chip:hover { border-color: var(--brand); color: var(--brand-deep); }
.chip.is-active { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.chip svg { width: 15px; height: 15px; }

/* Mobile menu button */
.menu-btn { display: none; }

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.reveal { opacity: 0; animation: fadeUp 0.6s var(--ease) forwards; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-100%);
    transition: transform var(--dur) var(--ease); box-shadow: var(--sh-pop);
  }
  .sidebar.is-open { transform: none; }
  .menu-btn { display: grid; }
  .content { padding: var(--sp-5) var(--sp-4); }
  .col-span-2 { grid-column: span 1; }
  .scrim { position: fixed; inset: 0; background: oklch(0.2 0.02 220 / 0.4); z-index: 199; opacity: 0; pointer-events: none; transition: opacity var(--dur); }
  .scrim.is-open { opacity: 1; pointer-events: auto; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 var(--sp-4); }
  .search { display: none; }
  .page-head h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; }
}

/* ============================================================================
   FINANCIAL KIT — dense, numeric, terminal-grade components
   ============================================================================ */

/* Money / numerics */
.money { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num  { font-variant-numeric: tabular-nums; }
.amt-in  { color: oklch(0.5 0.12 155); }         /* credit / money in */
.amt-out { color: oklch(0.52 0.16 25); }         /* debit / money out */
.amt-0   { color: var(--ink-3); }
.delta-up   { color: oklch(0.5 0.12 155); font-weight: 600; }
.delta-down { color: oklch(0.54 0.17 25); font-weight: 600; }
.pos { color: oklch(0.5 0.12 155); } .neg { color: oklch(0.54 0.17 25); }

/* Finance status pills (reuse hues) */
.pill--paid       { background: var(--ok-bg); color: oklch(0.42 0.12 155); }
.pill--outstanding{ background: var(--warn-bg); color: oklch(0.5 0.14 60); }
.pill--overdue    { background: var(--danger-bg); color: oklch(0.48 0.18 25); }
.pill--recovered  { background: oklch(0.95 0.03 200); color: var(--brand-deep); }
.pill--reserved   { background: var(--info-bg); color: oklch(0.46 0.11 250); }
.pill--part       { background: oklch(0.96 0.04 300); color: oklch(0.46 0.14 300); }

/* ---- Ticker bar (under topbar) -------------------------------------------- */
.tickerbar {
  position: sticky; top: var(--topbar-h); z-index: calc(var(--z-sticky) - 1);
  display: flex; align-items: stretch; gap: 0; overflow-x: auto; scrollbar-width: none;
  background: var(--brand-ink); color: #fff; border-bottom: 1px solid oklch(0.3 0.02 210);
}
.tickerbar::-webkit-scrollbar { display: none; }
.tk {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px; white-space: nowrap;
  border-right: 1px solid oklch(1 0 0 / 0.08); flex-shrink: 0;
}
.tk__lbl { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: oklch(0.68 0.02 205); }
.tk__val { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.tk__chg { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.tk__chg.up { color: oklch(0.72 0.14 155); } .tk__chg.down { color: oklch(0.72 0.15 30); }

/* ---- KPI card with sparkline ---------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-4); }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__lbl { font-size: 11.5px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.kpi__val { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__val .cur { font-size: 15px; color: var(--ink-3); vertical-align: 6px; margin-right: 1px; }
.kpi__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.kpi__chg { font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.kpi__chg.up { color: oklch(0.5 0.12 155); } .kpi__chg.down { color: oklch(0.54 0.17 25); } .kpi__chg.flat { color: var(--ink-3); }
.kpi__sub { font-size: 11.5px; color: var(--ink-3); }
.kpi .spark { height: 30px; width: 100%; margin-top: 2px; }
.kpi--accent { background: linear-gradient(160deg, var(--brand-soft), var(--surface)); border-color: var(--brand-line); }
.kpi--dark { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.kpi--dark .kpi__lbl { color: oklch(0.72 0.02 205); }
.kpi--dark .kpi__val { color: #fff; } .kpi--dark .kpi__val .cur { color: oklch(0.7 0.02 205); }

/* ---- Ledger / dense data table -------------------------------------------- */
table.data.dense thead th { padding: 8px 12px; font-size: 10.5px; }
table.data.dense tbody td { padding: 8px 12px; font-size: 13px; }
table.data .r { text-align: right; }
table.data td.r, table.data th.r { text-align: right; }
.ledger td.money, .ledger .money { font-size: 13px; }
.dr { color: oklch(0.52 0.16 25); } .cr { color: oklch(0.48 0.12 155); }
.bal { font-weight: 600; }
.row-strong td { background: var(--surface-2); font-weight: 600; }
.txn-ico { width: 26px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center; }
.txn-ico svg { width: 14px; height: 14px; }
.txn-in  { background: var(--ok-bg); color: oklch(0.45 0.12 155); }
.txn-out { background: var(--danger-bg); color: oklch(0.5 0.16 25); }
.txn-res { background: var(--info-bg); color: oklch(0.46 0.11 250); }

/* ---- Aged-debt buckets ---------------------------------------------------- */
.aged { display: flex; height: 12px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-3); }
.aged span { height: 100%; display: block; }
.aged .b0 { background: var(--ok); }
.aged .b1 { background: oklch(0.72 0.13 90); }
.aged .b2 { background: var(--accent-deep); }
.aged .b3 { background: var(--danger); }
.aged-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 14px; }
.aged-legend div { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.aged-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.aged-legend b { font-family: var(--font-mono); color: var(--ink); margin-left: 2px; }

/* ---- Meter (labelled progress with value) --------------------------------- */
.meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.meter__lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.meter__val { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; text-align: right; }
.meter .bar { grid-column: 1 / -1; }

/* ---- Donut (pure SVG helper sizing) --------------------------------------- */
.donut { display: grid; place-items: center; position: relative; }
.donut__center { position: absolute; text-align: center; }
.donut__center b { font-family: var(--font-mono); font-size: 20px; font-weight: 650; display: block; letter-spacing: -0.02em; }
.donut__center span { font-size: 11px; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 9px; }
.legend div { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend .lg-val { margin-left: auto; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Compact definition summary ------------------------------------------- */
.fin-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; }
.fin-summary > div { background: var(--surface); padding: 12px 14px; }
.fin-summary dt { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.fin-summary dd { font-family: var(--font-mono); font-size: 17px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---- Mini list feed (transactions / events) ------------------------------- */
.feed-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom: none; }
.feed-row__main { flex: 1; min-width: 0; }
.feed-row__main b { font-size: 13px; font-weight: 600; display: block; }
.feed-row__main span { font-size: 11.5px; color: var(--ink-3); }
.feed-row .money { font-size: 13.5px; font-weight: 600; }

/* ---- SLA / countdown chips ------------------------------------------------ */
.sla { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-sm); }
.sla--ok { background: var(--ok-bg); color: oklch(0.42 0.12 155); }
.sla--warn { background: var(--warn-bg); color: oklch(0.5 0.14 60); }
.sla--breach { background: var(--danger-bg); color: oklch(0.48 0.18 25); }
.sla svg { width: 12px; height: 12px; }

/* ---- Section band header (in-page) ---------------------------------------- */
.band-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.band-head h2 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.band-head .sub { font-size: 12.5px; color: var(--ink-3); }

/* Sub-nav tabs already covered by .tabs; add anchor scroll offset */
:target { scroll-margin-top: 120px; }

/* Dense content option */
.grid--dense { gap: var(--sp-4); }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--sp-5); align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
@media (max-width: 1100px){ .two-col { grid-template-columns: 1fr; } .three-col { grid-template-columns: 1fr; } }

/* Nav group scroll (sidebar now taller) */
.sidebar { overflow-y: auto; scrollbar-width: thin; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: oklch(0.35 0.02 210); border-radius: 3px; }

