/* ============================================================
   LegalOS — Design System
   Tokens · Themes · Components · Motion
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Brand — Bayut green */
  --brand-500: #0d7a3f;
  --brand-600: #063d24;
  --brand-400: #27a96d;
  --accent-500: #0891b2;
  --accent-600: #0e7490;

  /* Semantic */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #1d6cb0;
  --info-bg: #e3f0fb;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Type */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  --z-topbar: 40;
  --z-sidebar: 30;
  --z-overlay: 90;
  --z-modal: 100;
  --z-toast: 120;

  /* WIDE ENOUGH FOR THE LONGEST FAMILY NAME.
     At 244px "Commercial & Risk Mitigation" lost its last word to an ellipsis
     and "Compliance & Licences" lost its last letters — three of the six
     families could not be read without hovering. The names are the product's
     own and shortening them in the rail would mean the navigation and the page
     header called the same thing two things, so the column takes the 24px. */
  --sidebar-w: 268px;
  --topbar-h: 60px;

  /* ---------- Layout scale (one product, one rhythm) ----------
     Every page used to set its own padding, every card its own inset and every
     register its own row height, so two screens side by side read as two
     products. These are the shared values; a component that needs a different
     one is a decision, not an accident. */
  --page-pad-x: 30px;     /* page gutter, desktop */
  --page-pad-t: 26px;
  --page-pad-b: 60px;
  --section-gap: 22px;    /* vertical space between page sections */
  --card-pad: 18px;       /* card inset */
  --card-r: var(--r-lg);  /* card radius */
  --row-h: 54px;          /* register row height */
  --head-h: 40px;         /* register header row height */
  --field-h: 36px;        /* input / select / filter control height */
  --btn-h: 36px;          /* button height */
  --badge-h: 22px;        /* pill / badge height */
  --kpi-h: 112px;         /* compact KPI tile height */

  color-scheme: light;
}

/* ---------- Light theme ---------- */
:root, :root[data-theme="light"] {
  --bg: #f4f8f5;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #edf5ef;
  --surface-3: #e3efe7;
  --sidebar-bg: #063d24;
  --sidebar-fg: #c6ddd2;   /* nav text; clears 4.5:1 on every sidebar surface including its hover and active washes */
  --sidebar-fg-dim: #b4cbbf;   /* was #6f957f (2.8:1); also clears the .workspace and hover white washes */
  --sidebar-active: #0c5836;
  --border: #d3e3d8;
  --border-strong: #bfd6c6;
  --text: #14261c;
  --text-2: #4c655a;
  --text-3: #5b6d64;   /* was #7c9488 — 2.76:1 on the page background, below AA */
  /* TEXT variants of the status colours.
     The fill colours below stay as they are: they are the product's palette, and
     as a background with white text they are already fine. But used as TEXT on
     their own tinted chip they fell between 2.7:1 and 4.1:1. These are the same
     hues darkened until they clear 4.5:1 on BOTH the chip and the page. */
  --danger-text: #c92323;
  --warning-text: #a55a05;
  --success-text: #11803a;
  --risk-critical-text: #c92323;
  --risk-high-text: #bd470a;
  --risk-medium-text: #956603;
  --risk-low-text: #11803a;
  --brand: var(--brand-500);
  --brand-soft: #e7f3ec;
  --brand-soft-2: #d3ecdd;
  --accent-soft: #e0f1f5;
  --shadow-xs: 0 1px 2px rgba(6, 61, 36, 0.05);
  --shadow-sm: 0 1px 3px rgba(6, 61, 36, 0.08), 0 1px 2px rgba(6, 61, 36, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(6, 61, 36, 0.10), 0 2px 6px -2px rgba(6, 61, 36, 0.06);
  --shadow-lg: 0 16px 40px -8px rgba(6, 61, 36, 0.16), 0 6px 14px -6px rgba(6, 61, 36, 0.10);
  --shadow-pop: 0 24px 60px -12px rgba(6, 61, 36, 0.24);
  --glass: rgba(255, 255, 255, 0.74);

  /* Data-viz categorical slots — order green → blue → orange → violet → magenta.
     Validated against this surface (#ffffff): worst adjacent CVD ΔE 17.3,
     normal-vision ΔE 19.5, all in the lightness band, chroma floor and 3:1
     contrast. The slot ORDER is the colourblind-safety mechanism: never reorder,
     never add a sixth hue — the tail folds into --viz-other. */
  --viz-1: #0d7a3f;
  --viz-2: #1d6cb0;
  --viz-3: #ea580c;
  --viz-4: #6d28d9;
  --viz-5: #db2777;
  --viz-other: #8a9a91;
  --viz-grid: #e6efe9;
  --viz-axis: #cfe0d5;
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1613;
  --bg-elev: #121d18;
  --surface: #16221c;
  --surface-2: #1b2a23;
  --surface-3: #223029;
  --sidebar-bg: #08130e;
  --sidebar-fg: #a6c2b3;
  --sidebar-fg-dim: #93ac9f;   /* dark theme, same reason */
  --sidebar-active: #123a28;
  --border: #263a30;
  --border-strong: #33473c;
  --text: #e4ece7;
  --text-2: #93a89d;
  --text-3: #86988e;   /* lightened for the dark surfaces, same reason */
  --danger-text: #e55c5c;
  --warning-text: #d97706;
  --success-text: #1fa751;
  --risk-critical-text: #e55c5c;
  --risk-high-text: #f08040;
  --risk-medium-text: #d8b23a;
  --risk-low-text: #1fa751;
  --brand: #2fae72;
  --brand-soft: #10271b;
  --brand-soft-2: #16351f;
  --accent-soft: #0c2a31;
  --success-bg: #0f2e1c;
  --warning-bg: #33260a;
  --danger-bg: #37161a;
  --info-bg: #0b2437;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 18px -4px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 48px -10px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 24px 64px -12px rgba(0, 0, 0, 0.8);
  --glass: rgba(18, 29, 24, 0.72);

  /* Dark steps are SELECTED for the dark surface (#16221c), not a flip of the
     light values: same five hues re-stepped into the dark lightness band
     (L 0.48–0.67). Validated: worst adjacent CVD ΔE 15.9, normal-vision 19.3,
     contrast ≥ 3:1. */
  --viz-1: #2fae72;
  --viz-2: #4f9ae0;
  --viz-3: #e26a12;
  --viz-4: #8b6ef0;
  --viz-5: #e04a8c;
  --viz-other: #7d8f85;
  --viz-grid: #223029;
  --viz-axis: #33473c;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body, #root { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
ul { list-style: none; padding: 0; }
svg { display: block; }
::selection { background: color-mix(in srgb, var(--brand) 24%, transparent); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---------- Boot ---------- */
.boot {
  height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: var(--bg); color: var(--text-2);
}
.boot--error { color: var(--text-2); }
.boot__mark { animation: pop .5s ease; }
.boot__spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
.boot__text { font-size: 13px; letter-spacing: .01em; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden;
  /* The whole shell is driven by one variable, so animating the track width
     slides the sidebar and the page together instead of the content snapping. */
  transition: grid-template-columns .28s cubic-bezier(.4, 0, .2, 1);
}
.app.app--collapsed { --sidebar-w: 72px; }

/* Sidebar */
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; height: 100vh;
  border-right: 1px solid rgba(255,255,255,.05); z-index: var(--z-sidebar);
  overflow: hidden;
  transition: width .28s cubic-bezier(.4, 0, .2, 1);
}
/* Labels ease out with the track rather than vanishing a frame early. */
.nav__item span, .sidebar__brand-text, .sidebar__user-meta, .workspace__meta {
  transition: opacity .18s ease;
}
.app--collapsed .sidebar__footrow { flex-direction: column-reverse; gap: 8px; }
.app--collapsed .sidebar__footrow > *:first-child { flex: none; width: 100%; }
.app--collapsed .sidebar__rail svg { transform: rotate(180deg); }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--topbar-h); }
.sidebar__brand-logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.sidebar__brand-name { font-weight: 700; color: #fff; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.sidebar__brand-sub { font-size: 10.5px; color: var(--sidebar-fg-dim); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.workspace {
  margin: 4px 12px 8px; padding: 8px 10px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.04); display: flex; align-items: center; gap: 9px; cursor: pointer;
  transition: background .14s;
}
.workspace:hover { background: rgba(255,255,255,.08); }
.workspace__logo { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg,#0b6835,#046b83);   /* both ends now clear 4.5:1 under white text */ display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:11px; flex:none;}
.workspace__meta { min-width: 0; flex: 1; }
.workspace__name { color: #fff; font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace__type { color: var(--sidebar-fg-dim); font-size: 10.5px; }

/* THE RAIL ENDS WHERE THE FOOTER BEGINS.
   Nine rows in a 768px column left 222px of nothing between Administration and
   the user chip — a third of the navigation reading as unfinished. The rows
   keep their own metrics; the space between the daily surfaces and the module
   families is where it goes, which is also the one place a separation actually
   means something. */
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; display: flex; flex-direction: column; }
/* One gap that means something: between the daily surfaces and the module
   families. Everything else keeps the row rhythm. */
.nav > .nav__section--bare { flex: 0 0 auto; }
.nav > .nav__section--bare:nth-of-type(2) { margin-top: 10px; }
.nav__section { margin-top: 14px; }
.nav__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--sidebar-fg-dim); padding: 6px 10px; font-weight: 600; }
/* A group header IS a nav row that happens to open a group, so it takes the
   same metrics as .nav__item — 13px, same padding, same radius, same hover —
   and its chevron sits in the icon slot so headers and rows share one left
   edge. The old 10px dim uppercase label was legible as a caption but read as
   disabled next to real rows. */
.nav__label--toggle {
  display: flex;
  /* Group names you chose are longer than the sidebar ("Commercial & Risk
     Mitigation"), and truncating one is worse than letting it take a second
     line — so it wraps, and the chevron stays pinned to the first line. */
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sidebar-fg);
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  transition: background .13s, color .13s;
}
.nav__label--toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
/* Leading icon: same slot and size as a nav row's icon, so headers and rows
   share one left edge. Only the trailing chevron rotates. */
.nav__label--toggle > svg:first-child { flex: none; opacity: .85; }
.nav__chev {
  flex: none; margin-left: 4px; opacity: .6;
  transform: rotate(-90deg);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
}
.nav__label--toggle.is-open .nav__chev { transform: rotate(0deg); }
.nav__label--toggle.is-open { color: #fff; }
.nav__label--toggle.is-open > svg:first-child { opacity: 1; }
/* Open group: the header is the parent of the rows below it, so mark it and
   inset the children rather than leaving two flat lists. */
.nav__label--toggle.is-open { color: #fff; }
.nav__label-text { flex: 1; min-width: 0; }
.nav__label--toggle .nav__badge { margin-left: 6px; flex: none; align-self: flex-start; margin-top: 1px; }
.nav__items { margin-left: 11px; padding-left: 16px; border-left: 1px solid rgba(255,255,255,.09); }
.nav__items .nav__item.active::before { left: -17px; }
.nav__section { margin-top: 2px; }
.nav__section--bare { margin-top: 2px; }
/* ONE LINE PER ROW. A nav column whose rows are different heights reads as
   broken, and "Commercial & Risk Mitigation" fits the rail at every width the
   product supports. If a longer label ever arrives it ends in an ellipsis with
   the full name on the row's tooltip — which the row already carries. */
.nav__item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--sidebar-fg); font-weight: 500; font-size: 13px; cursor: pointer; position: relative;
  transition: background .13s, color .13s; text-align: left; white-space: nowrap;
}
.nav__item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav__item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav__item.active { background: var(--sidebar-active); color: #fff; }
.nav__item.active::before { content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; background: var(--brand-400); }
.nav__item svg { flex: none; opacity: .9; }
/* THE COUNT NEVER WRAPS. With the row allowed to wrap, "194" broke into "19"
   over "4" inside a red circle — a number rendered as two numbers. It is a
   fixed, single-line pill that takes the width it needs and lets the label
   give way instead. */
.nav__badge {
  margin-left: auto; flex: none; white-space: nowrap;
  background: rgba(255,255,255,.12); color:#fff; font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; line-height: 1.6;
}
.nav__badge--alert { background: var(--danger); }
/* ---- Rail (collapsed sidebar) ----------------------------------------
   72px of icons. Group headers are dropped entirely rather than shown
   unreadable, and the sidebar renders every permitted row flat, so collapsing
   never hides a destination. Labels survive as tooltips. */
.app--collapsed .nav__label, .app--collapsed .nav__badge,
.app--collapsed .sidebar__brand-text, .app--collapsed .workspace__meta,
.app--collapsed .sidebar__user-meta,
.app--collapsed .nav__item span { display: none; }
.app--collapsed .nav__item { justify-content: center; padding: 9px 0; gap: 0; }
.app--collapsed .nav { padding: 6px 10px 16px; }
.app--collapsed .nav__section--rail { margin-top: 2px; }
/* One separator, between the standalone rows and the groups — not one per
   group, which just made stripes. */
.app--collapsed .nav__section--railbare + .nav__section--rail { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.app--collapsed .nav__item { position: relative; border-radius: 9px; }
/* Badge counts do not fit a 72px rail; a dot says "needs attention" instead. */
.nav__dot {
  position: absolute; top: 6px; right: 14px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-400); box-shadow: 0 0 0 2px var(--sidebar-bg);
}
.nav__dot--alert { background: var(--danger); }
.app--collapsed .nav__section--rail .nav__item { margin: 2px 0; }
.app--collapsed .nav__items { margin-left: 0; padding-left: 0; border-left: 0; }
.app--collapsed .sidebar__brand { padding: 16px 0; justify-content: center; }
.app--collapsed .workspace { justify-content: center; padding-left: 0; padding-right: 0; }
.app--collapsed .workspace > svg { display: none; }
.app--collapsed .sidebar__user { justify-content: center; }
.app--collapsed .sidebar__rail { position: static; margin: 0; }
.app--collapsed .nav__item.active::before { left: -10px; }

/* The rail toggle lives in the brand row; the close button is drawer-only. */
/* The collapse control lives at the BOTTOM, out of the brand row: it is a
   preference you set once, not something to trip over next to the logo. */
/* Bottom bar: identity on the left, collapse on the right. Collapsing is a
   preference you set once, so it sits out of the way rather than beside the
   logo. In the rail the two stack, toggle above avatar. */
.sidebar__footrow { display: flex; align-items: center; gap: 6px; }
.sidebar__footrow > *:first-child { flex: 1; min-width: 0; }
.sidebar__rail {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: transparent; color: var(--sidebar-fg-dim);
  transition: background .16s ease, color .16s ease;
}
.sidebar__rail:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__rail svg { flex: none; transition: transform .28s cubic-bezier(.4,0,.2,1); }
.sidebar__close {
  margin-left: auto; flex: none; display: none; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 0; border-radius: 7px; cursor: pointer;
  background: rgba(255,255,255,.07); color: var(--sidebar-fg);
  transition: background .13s, color .13s;
}
.sidebar__close:hover { background: rgba(255,255,255,.16); color: #fff; }
.topbar__menu {
  display: none; flex: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: -6px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.topbar__menu:hover { background: var(--surface-2); color: var(--text); }
.app__scrim { display: none; }

/* ---- Narrow screens: the sidebar becomes a drawer -------------------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w-open, 268px);
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  /* A rail makes no sense in a drawer — always open it at full width. */
  .app--collapsed { --sidebar-w: 0px; }
  .app--collapsed .sidebar__brand-text, .app--collapsed .workspace__meta,
  .app--collapsed .sidebar__user-meta, .app--collapsed .nav__item span,
  .app--collapsed .nav__label, .app--collapsed .nav__badge { display: revert; }
  .app--collapsed .nav__item { justify-content: flex-start; padding: 8px 10px; gap: 11px; }
  /* Above the topbar, or the drawer's own brand row (and its close button)
     sits underneath it and cannot be seen or clicked. */
  .sidebar { z-index: calc(var(--z-topbar) + 2); }
  .app--drawer .sidebar { transform: translateX(0); }
  .app--drawer .app__scrim {
    display: block; position: fixed; inset: 0; z-index: calc(var(--z-topbar) + 1);
    background: rgba(4, 20, 12, .5); backdrop-filter: blur(2px);
  }
  .sidebar__rail { display: none; }
  .sidebar__close { display: inline-flex; }
  .topbar__menu { display: inline-flex; }
  .page { padding: 20px 18px 56px; }
}
@media (max-width: 640px) {
  .page { padding: 16px 12px 48px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar__crumbs { font-size: 12px; }
}
/* Action rows are flex and were pushing past the content box on a phone (the
   page header's buttons, and the executive header's three). Let them wrap and
   the header stacks instead of overflowing. */
.pagehead, .pagehead__actions, .exec__actions { flex-wrap: wrap; }
.pagehead__actions, .exec__actions { min-width: 0; }
@media (max-width: 760px) {
  .pagehead { gap: 12px; }
  .pagehead__actions, .exec__actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .app, .sidebar, .sidebar__rail svg,
  .nav__item span, .sidebar__brand-text, .sidebar__user-meta, .workspace__meta { transition: none; }
}

.sidebar__foot { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.sidebar__user:hover { background: rgba(255,255,255,.06); }
.sidebar__user-meta { min-width:0; flex:1; }
.sidebar__user-name { color:#fff; font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.sidebar__user-role { color: var(--sidebar-fg-dim); font-size:11px;}

/* Main column */
.main { display: flex; flex-direction: column; height: 100vh; overflow: hidden; min-width: 0; }

/* Topbar */
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: var(--glass); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border); z-index: var(--z-topbar);
}
.topbar__crumbs { display: flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 13px; font-weight: 500; }
.topbar__crumbs b { color: var(--text); font-weight: 600; }
.topbar__spacer { flex: 1; }
.searchbtn {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; min-width: 260px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-3);
  font-size: 13px; transition: border-color .14s, box-shadow .14s;
}
.searchbtn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.searchbtn kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px; padding: 2px 6px; border-radius: 5px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-3);
}
.iconbtn {
  width: 36px; height: 36px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  color: var(--text-2); position: relative; transition: background .14s, color .14s;
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); }
.iconbtn__dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.content { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.page { padding: var(--page-pad-t) var(--page-pad-x) var(--page-pad-b); max-width: 1560px; margin: 0 auto; }
.page--wide { max-width: none; }

/* Legal Workspace hub: the two sub-tabs (Current Work / Legal Requests) that
   sit above the merged surface. Full-width bar so it reads as part of the page
   chrome, like the top bar. */
.wshub__tabs {
  display: flex; gap: 2px; padding: 14px var(--page-pad-x) 0;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.wshub__tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 12px; margin-bottom: -1px;
  border: none; background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 650; color: var(--text-2);
  border-bottom: 2.5px solid transparent; transition: color .12s, border-color .12s;
}
.wshub__tab:hover { color: var(--text); }
.wshub__tab.on { color: var(--brand); border-bottom-color: var(--brand); }
/* The hosted page keeps its own layout; just tighten the gap under the tabs. */
.wshub__body .page { padding-top: 20px; }

/* FAMILY TABS — the module family's destinations, at the top of every page in
   it. The rail carries one row per family; this is where its registers live,
   so the siblings of the page you are on are always on screen. Same chrome as
   the workspace hub bar: full-bleed, one rule under it, and the page's own
   padding starts below. It scrolls sideways rather than wrapping, because a
   ten-register family must not push the page down two lines. */
.famtabs {
  display: flex; align-items: stretch; gap: 2px;
  padding: 10px var(--page-pad-x) 0; background: var(--surface); position: relative;
  border-bottom: 1px solid var(--border);
}
/* THE STRIP is the scroller, not the .tabs inside it: the arrows measure and
   move this element, and the fade mask has to sit on the thing that scrolls. */
.famtabs__strip { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.famtabs__strip::-webkit-scrollbar { display: none; }
.famtabs .tabs { gap: 2px; overflow-x: visible; border-bottom: none; }
.famtabs .tab { padding: 9px 14px 11px; font-size: 13.5px; font-weight: 650; margin-bottom: 0; }
.famtabs + .page { padding-top: 20px; }
/* The arrows sit ON the strip's own line and keep their width when idle, so the
   tabs do not shift sideways as you scroll them. Disabled rather than removed,
   for the same reason. */
.famtabs__arrow {
  flex: none; width: 30px; height: 30px; align-self: center; margin-bottom: 8px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  color: var(--text-2); border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .12s, background .12s, opacity .12s, border-color .12s;
}
.famtabs__arrow:hover { background: var(--surface-3); color: var(--text); border-color: var(--brand); }
/* Dimmed, not removed: a control that vanishes moves everything beside it, and
   the pair is also what tells you the row can be scrolled at all. */
.famtabs__arrow.is-off { opacity: .34; pointer-events: none; }
/* A soft edge where the row continues: the tabs fade out under the arrow
   instead of being cut mid-word, which is what tells you there is more. */
.famtabs--l .famtabs__strip { mask-image: linear-gradient(to right, transparent 0, #000 22px); }
.famtabs--r .famtabs__strip { mask-image: linear-gradient(to left, transparent 0, #000 22px); }
.famtabs--l.famtabs--r .famtabs__strip {
  mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}
@media (max-width: 720px) { .famtabs__arrow { display: none; } }

/* Page header */
.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: var(--section-gap); }
.pagehead__main { min-width: 0; }
.pagehead__title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 0; line-height: 1.25; }
.pagehead__sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.pagehead__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

/* ============================================================
   PRIMITIVES
   ============================================================ */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--btn-h); padding: 0 14px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px;
  border: 1px solid transparent; white-space: nowrap; transition: all .14s ease; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--brand-600); box-shadow: var(--shadow-sm); }
.btn--accent { background: var(--accent-500); color:#fff; }
.btn--accent:hover { background: var(--accent-600); }
.btn--ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn--soft { background: var(--surface-3); color: var(--text); }
.btn--soft:hover { background: var(--border); }
.btn--danger { background: var(--danger); color:#fff;}
.btn--danger:hover { filter: brightness(.94); }
.btn--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn--lg { height: 42px; padding: 0 20px; font-size: 14px; }
.btn--icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--gradient { background: linear-gradient(135deg, var(--brand-500), var(--accent-500)); color:#fff; }
.btn--gradient:hover { filter: brightness(1.05); box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--brand) 50%, transparent); }

/* Card */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-r);
  box-shadow: var(--shadow-xs); transition: box-shadow .16s, border-color .16s, transform .16s;
}
.card--hover:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-2px); }
.card--pad { padding: var(--card-pad); }
.card__head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card__title { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; }
.card__sub { color: var(--text-3); font-size: 12px; }
.card__body { padding: var(--card-pad); }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--border); }
.card__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Metric card */
.metric { position: relative; overflow: hidden; }
.metric__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.metric__icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.metric__label { color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.metric__value { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; line-height: 1; }
.metric__foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 12px; padding: 1px 7px; border-radius: 999px; }
.trend--up { color: var(--success-text); background: var(--success-bg); }
.trend--down { color: var(--danger-text); background: var(--danger-bg); }
.trend--flat { color: var(--text-2); background: var(--surface-3); }

/* Grid helpers */
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
@media (max-width: 1200px){ .grid--4 { grid-template-columns: repeat(2,1fr);} .grid--3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 820px){ .grid--4,.grid--3,.grid--2 { grid-template-columns: 1fr;} }

/* Pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: var(--badge-h); padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--gray { background: var(--surface-3); color: var(--text-2); }
.pill--blue { background: var(--info-bg); color: var(--info); }
.pill--green { background: var(--success-bg); color: #15803d; }
.pill--amber { background: var(--warning-bg); color: #b45309; }
.pill--red { background: var(--danger-bg); color: #b91c1c; }
.pill--purple { background: var(--accent-soft); color: var(--accent-600); }
.pill--indigo { background: #eef2ff; color: #4338ca; }
:root[data-theme="dark"] .pill--green { color: #4ade80; }
:root[data-theme="dark"] .pill--amber { color: #fbbf24; }
:root[data-theme="dark"] .pill--red { color: #f87171; }
:root[data-theme="dark"] .pill--indigo { background:#1c2140; color:#a5b4fc;}
:root[data-theme="dark"] .pill--blue { background:#0b2437; color:#7ab8e8; }
.pill--orange { background: #fff0e6; color: #c2410c; }
:root[data-theme="dark"] .pill--orange { background:#3a1f0c; color:#fb923c; }

/* Risk badge */
.risk { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 11.5px; padding: 2px 9px; border-radius: 6px; }
.risk__bar { width: 4px; height: 12px; border-radius: 2px; background: currentColor; }
.risk--critical { color: var(--risk-critical-text); background: var(--danger-bg); }
.risk--high { color: var(--risk-high-text); background: var(--warning-bg); }
.risk--medium { color: var(--risk-medium-text); background: #fef9c3; }
.risk--low { color: var(--risk-low-text); background: var(--success-bg); }
:root[data-theme="dark"] .risk--medium { background:#2e2a0c; color:#eab308;}

/* Priority */
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.prio svg { width: 13px; height: 13px; }
.prio--urgent { color: var(--danger-text); }
.prio--high { color: var(--warning-text); }
.prio--med { color: var(--brand); }
.prio--low { color: var(--text-3); }

/* Avatars */
.avatar { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 650; color: #fff; flex: none; background: var(--brand); font-size: 12px; overflow: hidden; }
.avatar--sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar--md { width: 32px; height: 32px; font-size: 12px; }
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Tables */
/* A table must fit its container, not force the reader to drag. Cells wrap and
   long unbroken strings break, so a column cannot blow the layout out; a hard
   max-width stops one verbose cell dominating. Horizontal scroll stays as a last
   resort, and the shadow on the right edge makes it discoverable when it happens
   instead of silently hiding a column. */
.tablewrap {
  overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface);
  max-width: 100%;
  background-image: linear-gradient(to right, var(--surface) 30%, transparent),
                    linear-gradient(to left, var(--surface) 30%, transparent),
                    linear-gradient(to right, rgba(0,0,0,.10), transparent 12px),
                    linear-gradient(to left, rgba(0,0,0,.10), transparent 12px);
  background-position: left center, right center, left center, right center;
  background-repeat: no-repeat;
  background-size: 28px 100%, 28px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}
.table { table-layout: auto; }
.table tbody td {
  white-space: normal; overflow-wrap: break-word; word-break: normal;
  max-width: 200px; min-width: 0; line-height: 1.32;
}
/* ONE ROW HEIGHT ACROSS EVERY REGISTER. Rows were sized by whatever their
   tallest cell happened to contain, so the contract book, the case book and
   the licence register all scanned at different rhythms. A minimum, not a
   fixed height: a two-line cell still gets its second line. */
.table tbody tr { min-height: var(--row-h); }
.table tbody td { height: var(--row-h); }
.table thead th { height: var(--head-h); }
/* Secondary lines inside a cell are context, not headlines: one line, clipped.
   These were the widest thing in several columns ("New · Vendor MSA · Amazon
   Web Services" forced its column to ~200px on its own). */
.table td .tiny, .table td .muted, .table td .cell-sub {
  display: block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Category-style stacks of pills read fine side by side and save a line. */
.table td .pill + .pill { margin-left: 4px; }
/* Atomic values must never be split across lines. */
.table td .pill, .table td .status, .table td .cell-mono,
.table td time, .table td .tiny { white-space: nowrap; }
.table td .cell-strong { overflow-wrap: break-word; }
/* Long contract-type labels truncate inside their pill instead of overflowing
   into the next column (the Commercial Contract Tracker). */
.tracktype { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* A REGISTER HAS TO FIT A 1366 LAPTOP (§89).
   The base cell cap is 200px, so eight columns can ask for 1,600px on a screen
   that has about 1,060 to give. Below 1500 the cap comes down; the whole value
   stays in the cell's tooltip (see .clip), so nothing is lost — it is clipped,
   not dropped. */
@media (max-width: 1500px) {
  .table tbody td { max-width: 150px; }
  .table thead th { max-width: 110px; }
}
@media (max-width: 1024px) {
  .table { font-size: 12.5px; }
  .table thead th { padding: 9px 11px; }
  .table tbody td { padding: 10px 11px; max-width: 160px; }
}
@media (max-width: 640px) {
  .table { font-size: 12px; }
  .table thead th { padding: 8px 9px; }
  .table tbody td { padding: 9px 9px; max-width: 180px; }
}
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table thead th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--text-2);
  font-size: 11px; letter-spacing: .03em; text-transform: uppercase; padding: 9px 10px; border-bottom: 1px solid var(--border); z-index: 1;
  /* Headers were nowrap, so a two-word label like "COMPANY / ENTITY" set the
     column's minimum width and the table could never shrink to its data.
     Letting the label wrap costs one header line and buys real width. */
  white-space: normal; line-height: 1.25; max-width: 130px; vertical-align: bottom;
}
/* A sortable header is a button, so it says so to a screen reader and takes
   the keyboard. It inherits the header's own type rather than the browser's
   button defaults, so turning a column sortable does not change how it looks
   until you point at it. */
.thsort {
  appearance: none; background: none; border: 0; padding: 0; margin: 0; width: 100%;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
  text-align: inherit; cursor: pointer; line-height: inherit;
}
.thsort:hover { color: var(--brand); }
.thsort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.table thead th[aria-sort="ascending"] .thsort,
.table thead th[aria-sort="descending"] .thsort { color: var(--brand); }
[style*="text-align:right"] > .thsort { text-align: right; }

.table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .cell-strong { font-weight: 600; color: var(--text); }
.table .cell-mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

/* Table density: chrome inside a cell is scaled down with the cell, otherwise
   pills and avatars keep the row tall no matter how little padding is left. */
.table td .pill { height: 19px; padding: 0 7px; font-size: 10.5px; }
.table td .avatar, .table td .avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.table td .tiny, .table td .muted { font-size: 10.5px; line-height: 1.25; }
.table td .cell-mono { font-size: 11px; }
.table td > .row { gap: 7px; }
.rowlink { cursor: pointer; }
/* A cell that filters is a control, so it has to look and behave like one —
   without inheriting button chrome inside a dense grid. */
.cellbtn {
  border: 0; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left; border-radius: 6px;
  transition: opacity .12s, background .12s;
}
.cellbtn:hover { opacity: .78; }
.cellbtn--text:hover { background: var(--surface-2); text-decoration: underline; text-underline-offset: 2px; }
.cellbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* A number or a form code that opens the documents behind it. It reads as a
   link because it behaves as one — a count styled as plain text that turns out
   to be clickable is a control nobody finds. */
.linkish {
  appearance: none; background: none; border: 0; padding: 1px 3px; margin: 0;
  font: inherit; color: var(--brand); font-weight: 600; cursor: pointer;
  border-radius: 4px; text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent);
}
.linkish:hover { background: var(--brand-soft); text-decoration-color: var(--brand); }
.linkish:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* The dd/mm/yyyy date field. The text box is the field; the native date input
   is kept only so its calendar can be opened, and is parked out of sight
   because a native date input always renders in the browser's own locale. */
.dateinput { position: relative; display: block; }
.dateinput .input { width: 100%; padding-right: 36px; }
.dateinput__picker {
  position: absolute; width: 1px; height: 1px; right: 8px; bottom: 0;
  opacity: 0; pointer-events: none; border: 0; padding: 0; margin: 0;
}
.dateinput__btn {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border-radius: 6px;
  background: none; border: 0; cursor: pointer; color: var(--text-3);
}
.dateinput__btn:hover { background: var(--surface-2); color: var(--text); }
.dateinput__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dateinput--off .dateinput__btn { cursor: not-allowed; opacity: .5; }

/* The provenance strip in the document viewer: what this document is, whose it
   is, and where in Drive it came from — wrapping rather than truncating,
   because a source path that is cut off proves nothing. */
.doclb__prov {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  padding: 7px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); color: var(--text-2);
  word-break: break-word;
}
.doclb__prov .pill { flex: none; }
.rowactions { opacity: 0; transition: opacity .12s; }
.table tbody tr:hover .rowactions { opacity: 1; }

/* Tabs */
.tabs { display: flex; align-items: center; gap: 3px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 13px; font-size: 13px; font-weight: 550; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .13s; display:flex; align-items:center; gap:7px; white-space:nowrap; cursor:pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab .count { background: var(--surface-3); color: var(--text-2); font-size: 11px; padding: 0 6px; border-radius: 999px; font-weight: 600; }
.tab.active .count { background: var(--brand-soft); color: var(--brand-600); }

/* Pill variant: rounded filter buttons that WRAP to a second line instead of
   crushing long labels. Used for the contract category row (many long names). */
.tabs--pills { flex-wrap: wrap; border-bottom: none; gap: 8px; }
.tabs--pills .tab {
  padding: 7px 14px; margin-bottom: 0; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text-2);
  font-weight: 600; transition: color .12s, border-color .12s, background .12s;
}
.tabs--pills .tab:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); background: var(--surface-2); }
.tabs--pills .tab.active {
  color: var(--brand-600); background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 45%, transparent); border-bottom-color: color-mix(in srgb, var(--brand) 45%, transparent);
}
.tabs--pills .tab .count { background: var(--surface-3); }
.tabs--pills .tab.active .count { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); color: var(--brand-600); }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: var(--r-sm); gap: 2px; }
.segmented button { padding: 5px 11px; border-radius: var(--r-xs); font-size: 12.5px; font-weight: 600; color: var(--text-2); display:flex; align-items:center; gap:6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* Inputs */
.input, .textarea, .select {
  width: 100%; height: var(--field-h); padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px; transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field__hint { font-size: 11.5px; color: var(--text-3); }
.inputgroup { position: relative; }
.inputgroup svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.inputgroup .input { padding-left: 34px; }

.toggle { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .16s; flex:none;}
.toggle.on { background: var(--brand); }
.toggle::after { content:""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .16s; box-shadow: var(--shadow-xs);}
.toggle.on::after { transform: translateX(16px); }

.chip { display:inline-flex; align-items:center; gap:6px; height:30px; padding: 0 11px; border-radius: var(--r-sm); border:1px solid var(--border); background: var(--surface); font-size:12.5px; font-weight:550; color: var(--text-2); }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand-600); }

/* Dropdown / menu */
.menu { min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 6px; }
.menu__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--text); cursor: pointer; }
.menu__item:hover { background: var(--surface-3); }
.menu__item.danger { color: var(--danger-text); }
.menu__sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu__label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 6px 10px 2px; font-weight: 600; }

/* Overlay + modal */
.overlay { position: fixed; inset: 0; background: rgba(9,13,22,.5); backdrop-filter: blur(3px); z-index: var(--z-overlay); display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; animation: fade .16s ease; }
.modal { width: 560px; max-width: calc(100vw - 40px); max-height: 80vh; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column; animation: rise .2s cubic-bezier(.16,1,.3,1); }
.modal__head { padding: 18px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.modal__title { font-size: 16px; font-weight: 700; }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* Command palette */
.cmdk { width: 640px; max-width: calc(100vw - 40px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.cmdk__input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmdk__input input { border: none; background: none; font-size: 15px; width: 100%; }
.cmdk__input input:focus { outline: none; }
.cmdk__list { max-height: 380px; overflow-y: auto; padding: 8px; }
.cmdk__group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 10px 10px 4px; font-weight: 600; }
.cmdk__item { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px; }
.cmdk__item.active, .cmdk__item:hover { background: var(--brand-soft); color: var(--brand-600); }
.cmdk__item .k { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.cmdk__ico { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex:none;}
.cmdk__item.active .cmdk__ico { background: var(--surface); color: var(--brand); }

/* Kanban */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { width: 300px; flex: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kcol__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; position: sticky; top: 0; }
.kcol__title { font-weight: 650; font-size: 13px; }
.kcol__count { background: var(--surface-3); color: var(--text-2); font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.kcol__list { padding: 4px 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px; box-shadow: var(--shadow-xs); cursor: grab; transition: box-shadow .14s, transform .14s, border-color .14s; }
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.kcard__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kcard__id { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.kcard { min-width: 0; }
.kcard__title { font-weight: 600; font-size: 13.5px; line-height: 1.35; margin-bottom: 10px; overflow-wrap: anywhere; word-break: break-word; }
/* long unbroken strings (ids, pasted text, AI summaries) must wrap inside the
   card, never leak out of it */
.kcard .row span.tiny, .kcard .kcard__meta { min-width: 0; overflow-wrap: anywhere; }
.sheet__title, .cell-strong, .pagehead__title { overflow-wrap: anywhere; word-break: break-word; }
.kcard__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kcard__foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border); }
.kcol__dot { width: 9px; height: 9px; border-radius: 50%; }

/* Timeline / activity */
.timeline { position: relative; padding-left: 8px; }
.tl__item { position: relative; padding: 0 0 20px 26px; }
.tl__item::before { content:""; position: absolute; left: 5px; top: 2px; width: 2px; bottom: -4px; background: var(--border); }
.tl__item:last-child::before { display: none; }
.tl__dot { position: absolute; left: 0; top: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); z-index: 1; }
.tl__dot--green { border-color: var(--success); }
.tl__dot--amber { border-color: var(--warning); }
.tl__dot--red { border-color: var(--danger); }
.tl__dot--gray { border-color: var(--text-3); }
.tl__title { font-size: 13px; font-weight: 550; }
.tl__meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.feed__item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed__item:last-child { border-bottom: none; }
.feed__text { font-size: 13px; line-height: 1.5; }
.feed__text b { font-weight: 600; }
.feed__time { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 9px; flex: none; }
.step__dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-3); border: 2px solid var(--border); }
.step--done .step__dot { background: var(--success); color: #fff; border-color: var(--success); }
.step--active .step__dot { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step__label { font-size: 12.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.step--active .step__label { color: var(--text); font-weight: 650; }
.step__line { width: 34px; height: 2px; background: var(--border); margin: 0 6px; flex: none; }
.step--done + .step .step__line, .step--done .step__line { background: var(--success); }

/* Approval card */
.approval { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.approval--pending { border-left: 3px solid var(--warning); }
.approval--approved { border-left: 3px solid var(--success); }
.approval--rejected { border-left: 3px solid var(--danger); }

/* AI insight card */
.ai-card { position: relative; border-radius: var(--r-lg); padding: 1px; background: linear-gradient(135deg, color-mix(in srgb,var(--brand) 60%, transparent), color-mix(in srgb,var(--accent-500) 60%, transparent)); }
.ai-card__inner { background: var(--surface); border-radius: calc(var(--r-lg) - 1px); padding: 16px; height: 100%; }
.ai-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--accent-600); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; text-transform: uppercase; }
:root[data-theme="dark"] .ai-badge { color: #a5b4fc; }
.ai-glow { background: linear-gradient(135deg, #e7f3ec, #e0f1f5); }
:root[data-theme="dark"] .ai-glow { background: linear-gradient(135deg,#10271b,#0c2a31); }

/* Comment thread */
.comment { display: flex; gap: 11px; padding: 12px 0; }
.comment__body { flex: 1; }
.comment__head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.comment__author { font-weight: 600; font-size: 13px; }
.comment__time { font-size: 11.5px; color: var(--text-3); }
.comment__text { font-size: 13px; line-height: 1.55; color: var(--text); }
.comment__bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 10px 12px; }

/* Doc / clause viewer */
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 34px 44px; font-size: 13.5px; line-height: 1.75; color: var(--text); }
.doc h3 { font-size: 14px; font-weight: 700; margin: 22px 0 8px; }
.doc p { margin-bottom: 12px; color: var(--text-2); }
.doc .clause-hl { background: color-mix(in srgb, var(--warning) 22%, transparent); border-radius: 3px; padding: 1px 2px; cursor: pointer; }
.doc .clause-risk { background: color-mix(in srgb, var(--danger) 18%, transparent); border-bottom: 2px solid var(--danger); cursor: pointer; }

/* Progress */
.progress { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress__fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width .5s cubic-bezier(.16,1,.3,1); }
.progress__fill--green { background: var(--success); }
.progress__fill--amber { background: var(--warning); }
.progress__fill--red { background: var(--danger); }

/* Skeleton */
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* Notifications panel */
.notif { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.notif:hover { background: var(--surface-2); }
.notif--unread { background: var(--brand-soft); }
.notif--unread:hover { background: var(--brand-soft-2); }
.notif__ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.notif__text { font-size: 13px; line-height: 1.45; }
.notif__time { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* Drawer (right panel) */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); z-index: var(--z-modal); display: flex; flex-direction: column; animation: slidein .22s cubic-bezier(.16,1,.3,1); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* AI copilot dock */
/* THE ASSISTANT BUBBLE STEPS OUT OF THE WAY.
   It sits at --z-toast (120), above --z-modal (100), so it floated over the
   bottom-right corner of every drawer and modal — which is exactly where their
   primary action lives. The Edit button on the cost drawer was half-covered by
   it. A toast genuinely should outrank a modal, so demoting the z-index is the
   wrong fix; the bubble simply has nothing to offer while a dialog is open, so
   it hides until the dialog closes. */
body:has(.drawer) .copilot-fab,
body:has(.overlay) .copilot-fab { opacity: 0; pointer-events: none; }

.copilot-fab { position: fixed; right: 26px; bottom: 26px; z-index: var(--z-toast); width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-500), var(--accent-500)); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); transition: transform .16s; }
.copilot-fab:hover { transform: scale(1.06) translateY(-2px); }
.copilot-panel { position: fixed; right: 22px; bottom: 92px; width: 388px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 130px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); z-index: var(--z-toast); display: flex; flex-direction: column; overflow: hidden; animation: rise .2s cubic-bezier(.16,1,.3,1); }

/* Chat */
.chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 90%; }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }
.msg__bubble { padding: 10px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.msg--ai .msg__bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg--user .msg__bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat__input { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: flex-end; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.suggest button { font-size: 12px; padding: 7px 11px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-weight: 550; }
.suggest button:hover { border-color: var(--brand); color: var(--brand); }

/* Heatmap */
.heat { display: grid; gap: 4px; }
.heat__cell { aspect-ratio: 1.6; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }

/* Misc */
.divider { height: 1px; background: var(--border); }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.mono { font-family: var(--mono); }
.tiny { font-size: 11.5px; }
.strong { font-weight: 650; }
.center { display:flex; align-items:center; justify-content:center; }
.wrap { flex-wrap: wrap; }
.clickable { cursor: pointer; }
.hoverline:hover { text-decoration: underline; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty svg { margin: 0 auto 14px; opacity: .6; }
.dot-sep::before { content: "·"; margin: 0 7px; color: var(--text-3); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); }
.fade-in { animation: fade .3s ease; }
.rise-in { animation: rise .3s cubic-bezier(.16,1,.3,1); }

.stat-inline { display:flex; align-items:baseline; gap:6px; }
.stat-inline b { font-size: 18px; font-weight: 700; }

.tag-dot { width:8px; height:8px; border-radius:50%; flex:none; }

.banner { display:flex; align-items:center; gap:12px; padding:13px 16px; border-radius: var(--r-md); font-size:13px; }
.banner--info { background: var(--info-bg); color:#0369a1; }
.banner--warn { background: var(--warning-bg); color:#b45309; }
:root[data-theme="dark"] .banner--info { color:#7dd3fc;} :root[data-theme="dark"] .banner--warn{color:#fbbf24;}

@media (max-width: 900px){
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); width: 244px; }
  .page { padding: 18px 16px 60px; }
}

/* ============================================================
   SPRINT 3 — Master Filter Bar · WorkflowSpine · Tracker · Repository
   Every colour comes from the theme tokens, so light and dark both hold.
   ============================================================ */

/* ---- tagchip (company tags, drive / physical-record chips) ---- */
.tagchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 11.5px; font-weight: 550;
  text-decoration: none; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; font-family: inherit;
  transition: border-color .14s, color .14s, background .14s;
}
.tagchip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.tagchip svg { flex: none; }

/* ---- Master Filter Bar ---- */
.fbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.fbar__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fbar__chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fbar__clear { font-size: 11.5px; font-weight: 650; color: var(--brand); background: none; border: 0; cursor: pointer; padding: 3px 4px; font-family: inherit; }
.fbar__clear:hover { text-decoration: underline; }

.fbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 550;
  cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: border-color .14s, color .14s, background .14s;
}
.fbtn:hover { border-color: var(--border-strong); color: var(--text); }
.fbtn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.fbtn__n {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-full);
  background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.fpop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 10px; animation: rise .16s cubic-bezier(.16,1,.3,1);
}
.fpop__list { display: flex; flex-direction: column; gap: 1px; max-height: 260px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.fpop__lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 6px; }
.fopt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border-radius: var(--r-xs); border: 0;
  background: none; color: var(--text); font-size: 12.5px; text-align: left;
  cursor: pointer; font-family: inherit;
}
.fopt:hover { background: var(--surface-2); }
.fopt.active { background: var(--brand-soft); color: var(--brand-600); font-weight: 600; }
:root[data-theme="dark"] .fopt.active { color: var(--brand); }
.fopt__box {
  width: 15px; height: 15px; flex: none; border-radius: 4px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.fopt.active .fopt__box { background: var(--brand); border-color: var(--brand); }
.fopt__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fopt__n { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.fchip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 5px 4px 10px; border-radius: var(--r-full);
  background: var(--brand-soft); border: 1px solid var(--brand);
  color: var(--brand-600); font-size: 11.5px; font-weight: 600; max-width: 250px;
}
:root[data-theme="dark"] .fchip { color: var(--brand); }
.fchip__x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; border: 0;
  background: transparent; color: inherit; cursor: pointer; flex: none;
}
.fchip__x:hover { background: color-mix(in srgb, var(--brand) 22%, transparent); }

/* ---- TAT verdict pill ---- */
.tatpill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.tatpill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tatpill--green { background: var(--success-bg); color: var(--success-text); }
.tatpill--amber { background: var(--warning-bg); color: var(--warning-text); }
.tatpill--red   { background: var(--danger-bg);  color: var(--danger-text); }

/* ---- WorkflowSpine ---- */
.spine { display: flex; flex-direction: column; gap: 14px; }
.spine__head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.spine__title { font-size: 21px; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.spine__grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
.spine__desc { overflow-wrap: anywhere; word-break: break-word;
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
  padding: 11px 13px; background: var(--surface-2);
  border-radius: var(--r-sm); border-left: 3px solid var(--brand);
}
.facechip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 11px; font-weight: 650;
  font-family: var(--mono); cursor: pointer;
}
.facechip:hover { border-color: var(--brand); color: var(--brand); }

.zonenav {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow-xs);
}
.zonenav__b {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r-sm); border: 0;
  background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .14s, color .14s;
}
.zonenav__b:hover { background: var(--surface-2); color: var(--text); }
.zonenav__b.active { background: var(--brand-soft); color: var(--brand-600); }
:root[data-theme="dark"] .zonenav__b.active { color: var(--brand); }
.zonenav__n {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: var(--surface-3); color: var(--text-2);
  font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.zonenav__b.active .zonenav__n { background: var(--brand); color: #fff; }

.zone { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; scroll-margin-top: 62px; }
.zone__head {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.zone__n { width: 24px; height: 24px; border-radius: var(--r-xs); flex: none; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.zone__ico { width: 28px; height: 28px; border-radius: var(--r-sm); flex: none; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.zone__title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; text-transform: uppercase; }
.zone__sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.zone__body { padding: 16px 18px 18px; }

.kvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px 16px; }
.kv { min-width: 0; }
.kv__l { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.kv__v { font-size: 12.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

.docrow, .artrow, .relrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.docrow:hover, .artrow.clickable:hover, .relrow.clickable:hover { border-color: var(--brand); background: var(--brand-soft); }
.artrow { padding: 8px 10px; }
.artrow--planned { background: transparent; border-style: dashed; opacity: .72; }
.artrow--planned:hover { border-color: var(--border-strong); background: transparent; }
.relrow { padding: 7px 8px; background: transparent; border-color: transparent; }
.relrow.clickable:hover { border-color: var(--border); }
.relgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; align-items: start; }

.tatstrip {
  display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 14px;
}
.tatstrip--warn { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 34%, transparent); }
.tatstrip--bad  { background: var(--danger-bg);  border-color: color-mix(in srgb, var(--danger) 34%, transparent); }
.tatstrip__main { flex: 1; min-width: 260px; }
.tatstrip__blame { flex: none; min-width: 190px; padding-left: 16px; border-left: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }

.rail { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.rail__stage {
  flex: 1 0 138px; min-width: 138px; text-align: left; cursor: pointer;
  padding: 10px 11px 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-family: inherit; color: var(--text); position: relative; overflow: hidden;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.rail__stage:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.rail__stage.sel { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.rail__stage--pending { opacity: .62; }
.rail__stage--blocked { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.rail__bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.rail__top { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.rail__ico { width: 22px; height: 22px; border-radius: var(--r-xs); flex: none; background: var(--surface-3); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.rail__here { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 2px 6px; border-radius: var(--r-full); white-space: nowrap; }
.rail__stage--blocked .rail__here { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.rail__name { font-size: 12.5px; font-weight: 650; line-height: 1.3; }
.rail__meta { font-size: 11px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.crit { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.crit__l { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 5px; }
.crit__t { font-size: 12px; line-height: 1.5; color: var(--text-2); }
.crit--in  { border-left: 3px solid var(--info); }
.crit--out { border-left: 3px solid var(--success); }

.dest { display: grid; grid-template-columns: repeat(auto-fit, minmax(216px, 1fr)); gap: 12px; }
.dest__card { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); }
.dest__card--empty { border-style: dashed; opacity: .75; }
.dest__ico { width: 32px; height: 32px; border-radius: var(--r-sm); flex: none; display: flex; align-items: center; justify-content: center; }
.dest__l { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 3px; }
.dest__v { font-size: 13px; font-weight: 650; color: var(--brand); background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; text-align: left; text-decoration: none; }
.dest__v.muted { color: var(--text-3); cursor: default; }
a.dest__v:hover, button.dest__v:hover { text-decoration: underline; }

/* ---- drill-down browse (entity -> contract type -> records) ---- */
.drill { display: flex; flex-direction: column; gap: 6px; }
.drill__node {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; color: var(--text); text-align: left;
  transition: border-color .14s, background .14s;
}
.drill__node:hover, .drill__node.open { border-color: var(--brand); background: var(--brand-soft); }
.drill__kids { margin: 4px 0 8px 22px; padding-left: 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 5px; }
.drill__n { font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--surface-3); padding: 2px 8px; border-radius: var(--r-full); font-variant-numeric: tabular-nums; flex: none; }

/* ---- dense tracker table + inline quick-edit ---- */
/* A dense table used to be nowrap everywhere, which meant each column was as
   wide as its longest single line and the whole grid ran ~200px past its card
   no matter how the padding was tuned. Cells wrap now, capped, so the table
   fits its container; atomic values inside a cell keep their own nowrap. */
/* `.dense` tightens the CELLS. It used to set the HEADER's font size too,
   which made the one table it wraps — the Legal Workspace worklist — print its
   column headings at 12px while every other register in the product prints
   them at 11px. A reader moving between modules should not be able to tell
   which screen they are on from the chrome. */
.dense .table th, .dense .table td {
  padding: 8px 10px;
  white-space: normal; overflow-wrap: break-word; line-height: 1.3;
}
.dense .table td { font-size: 12px; }
.dense .table th { max-width: 120px; vertical-align: bottom; }
.dense .table td { max-width: 150px; }
.dense .table td.wrapcell { white-space: normal; min-width: 150px; }
.table td.wrapcell { min-width: 150px; }
.qedit {
  width: 100%; min-width: 72px; padding: 4px 7px; font-size: 12px;
  border: 1px solid transparent; border-radius: var(--r-xs);
  background: transparent; color: var(--text); font-family: inherit;
}
.qedit:hover { border-color: var(--border); background: var(--surface-2); }
.qedit:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent); }

/* ---- lens bar (working views over one dataset) ---- */
.lens { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); flex-wrap: wrap; }
.lens button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: var(--r-sm); border: 0;
  background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .14s, color .14s;
}
.lens button:hover { color: var(--text); background: var(--surface); }
.lens button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }

/* ---- per-individual pipelines ---- */
.pipe { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 14px; align-items: start; }
.loadbar { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.loadbar > div { height: 100%; border-radius: var(--r-full); transition: width .5s cubic-bezier(.16,1,.3,1); }

/* On time vs late, as one bar per person. Three segments, each sized by its own
   count, so the proportions are readable without reading the numbers — and the
   "no dates on file" segment is visibly neither, rather than being folded into
   the green where it would flatter the desk. */
.otbar { display: flex; height: 8px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-3); }
.otbar > span { display: block; min-width: 3px; }
.otbar__on { background: var(--success); }
.otbar__late { background: var(--danger); }
.otbar__unk { background: repeating-linear-gradient(135deg, var(--border) 0 4px, var(--surface-3) 4px 8px); }

/* ---- intake -> OCR -> extraction pipeline ---- */
.pipeline { display: flex; gap: 8px; flex-wrap: wrap; }
.pstep { flex: 1 0 148px; padding: 11px 12px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 9px; align-items: flex-start; }
.pstep--done { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-bg); }
.pstep--active { border-color: var(--brand); background: var(--brand-soft); }
.pstep__n { width: 20px; height: 20px; border-radius: 50%; flex: none; background: var(--surface-3); color: var(--text-2); font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pstep--done .pstep__n { background: var(--success); color: #fff; }
.pstep--active .pstep__n { background: var(--brand); color: #fff; }
.ocrbox {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  padding: 13px 15px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); max-height: 250px; overflow-y: auto; white-space: pre-wrap;
}

@media (max-width: 1100px) { .spine__grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .tatstrip__blame { padding-left: 0; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); padding-top: 10px; }
  .zonenav { position: static; }
}

/* ============================================================
   SPRINT 4 — Requester Portal (its own shell) + the shared chat bridge.
   Same tokens as LegalOS, so the portal reads as the same product family.
   ============================================================ */

/* ---- portal shell ---- */
.pshell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.ptop {
  display: flex; align-items: center; gap: 12px;
  height: 62px; padding: 0 22px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: var(--z-topbar);
}
.ptop__brand { display: flex; align-items: center; gap: 11px; cursor: pointer; min-width: 0; }
.ptop__logo {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: none;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  color: #fff; font-size: 13px; font-weight: 750;
  display: inline-flex; align-items: center; justify-content: center;
}
.ptop__name { display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.ptop__sub { display: block; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.ptop__nav { display: flex; gap: 4px; margin-left: 18px; }
.ptop__link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: var(--r-sm); border: 0;
  background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .14s, color .14s;
}
.ptop__link:hover { background: var(--surface-2); color: var(--text); }
.ptop__link.active { background: var(--brand-soft); color: var(--brand-600); }
:root[data-theme="dark"] .ptop__link.active { color: var(--brand); }
.pbadge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.ptop__me {
  display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px;
  border-radius: var(--r-full); border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-family: inherit; color: var(--text);
}
.ptop__me:hover { border-color: var(--border-strong); }
.ptop__me-meta { display: block; min-width: 0; text-align: left; }
.ptop__me-name { display: block; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.ptop__me-sub { display: block; font-size: 10.5px; color: var(--text-3); white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

.pmain { flex: 1; min-height: 0; }
.ppage { max-width: 1280px; margin: 0 auto; padding: 26px 22px 60px; }
.pfoot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 22px; border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ---- login ---- */
.plogin { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); position: relative; }
.plogin__theme { position: absolute; top: 20px; right: 20px; }
.plogin__card {
  width: 100%; max-width: 470px; padding: 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.plogin__brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.plogin__logo {
  width: 44px; height: 44px; border-radius: var(--r-md); flex: none;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  color: #fff; font-size: 16px; font-weight: 750;
  display: inline-flex; align-items: center; justify-content: center;
}
.plogin__name { font-size: 17px; font-weight: 750; letter-spacing: -.015em; }
.plogin__tag { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.plogin__foot { margin-top: 20px; text-align: center; }

/* ---- wizard ---- */
.pwiz { max-width: 860px; margin: 0 auto; }
.pwiz__head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pwiz__title { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.pwiz__q { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.pwiz__hint { font-size: 12.5px; color: var(--text-3); margin-top: 4px; line-height: 1.5; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 10px; }

.popt {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 14px 15px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; color: var(--text); text-align: left;
  transition: border-color .14s, background .14s, transform .14s;
}
.popt:hover { border-color: var(--brand); transform: translateY(-1px); }
.popt--on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.popt--off { opacity: .5; cursor: not-allowed; }
.popt--off:hover { border-color: var(--border); transform: none; }
.popt__ico {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: none;
  background: var(--surface-3); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.popt--on .popt__ico { background: var(--brand); color: #fff; }
.popt__title { display: block; font-size: 13.5px; font-weight: 650; line-height: 1.3; }
.popt__sub { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.45; }

.pconfirm {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 18px;
  padding: 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
}

/* ---- requester request detail ---- */
.pask {
  padding: 16px 18px; border-radius: var(--r-md); margin-bottom: 16px;
  background: var(--warning-bg);
  border: 1px solid color-mix(in srgb, var(--warning) 38%, transparent);
}
.pstatus {
  display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap;
  padding: 15px 17px; border-radius: var(--r-md);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  color: var(--text);
}
.pstatus--late { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }

.ptrack { display: flex; flex-direction: column; gap: 2px; }
.ptrack__row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; position: relative; }
.ptrack__row::before {
  content: ""; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px;
  background: var(--border);
}
.ptrack__row:first-child::before { top: 50%; }
.ptrack__row:last-child::before { bottom: 50%; }
.ptrack__row--done::before { background: var(--success); }
.ptrack__dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-3);
  border: 2px solid var(--surface);
  font-size: 11px; font-weight: 700;
}
.ptrack__row--done .ptrack__dot { background: var(--success); color: #fff; }
.ptrack__row--active .ptrack__dot, .ptrack__row--blocked .ptrack__dot { background: var(--brand); color: #fff; }
.ptrack__row--blocked .ptrack__dot { background: var(--danger); }
.ptrack__row--pending { opacity: .68; }
.ptrack__label { font-size: 13px; }
.ptrack__pulse {
  width: 9px; height: 9px; border-radius: 50%; background: #fff;
  animation: ppulse 1.6s ease-in-out infinite;
}
@keyframes ppulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.7); } }

.pflag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 7px; border-radius: var(--r-full);
  font-size: 10.5px; font-weight: 700;
}
.pflag--warn { background: var(--warning-bg); color: var(--warning-text); }
.pflag--new { background: var(--danger-bg); color: var(--danger-text); }

/* ---- the shared chat bridge (both apps) ---- */
.chatpanel { display: flex; flex-direction: column; gap: 10px; }
.chatpanel__scroll {
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; padding: 4px 2px;
}
.chatpanel__input { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }
.cmsg { display: flex; gap: 9px; max-width: 82%; }
.cmsg--mine { align-self: flex-end; flex-direction: row-reverse; }
.cmsg__body { min-width: 0; }
.cmsg__head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.cmsg--mine .cmsg__head { justify-content: flex-end; }
.cmsg__who { font-size: 12px; font-weight: 650; }
.cmsg__time { font-size: 10.5px; color: var(--text-3); }
.cmsg__bubble {
  padding: 10px 13px; border-radius: 14px;
  font-size: 13px; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--border);
  border-top-left-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.cmsg--mine .cmsg__bubble {
  background: var(--brand); color: #fff; border-color: transparent;
  border-top-left-radius: 14px; border-top-right-radius: 4px;
}

/* ---- admin: company x contract-type matrix ---- */
.matrix { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.matrix table { border-collapse: collapse; width: 100%; font-size: 12px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 8px 10px; text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; }
.matrix thead th { background: var(--surface-2); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); white-space: nowrap; vertical-align: bottom; }
.matrix tbody tr:hover td { background: var(--surface-2); }
.matrix tbody tr:hover td:first-child { background: var(--surface-2); }
.mcell {
  width: 22px; height: 22px; border-radius: 5px; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  transition: background .12s, border-color .12s;
}
.mcell:hover { border-color: var(--brand); }
.mcell.on { background: var(--brand); border-color: var(--brand); }

@media (max-width: 760px) {
  .ptop { padding: 0 14px; gap: 8px; }
  .ptop__nav { margin-left: 6px; }
  .ptop__link span { display: none; }
  .ptop__me-meta { display: none; }
  .ppage { padding: 18px 14px 50px; }
  .cmsg { max-width: 94%; }
}

/* ============================================================
   SPRINT 5 — Executive Overview · Flow Map · Guided Tour · Brief
   Board-grade: one accent, a strict type scale, generous whitespace,
   restrained bold. Screenshot and print friendly.
   ============================================================ */

/* ---- shared exec chrome ---- */
.execpage, .flowpage { max-width: 1240px; margin: 0 auto; }
.exec__head { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.exec__actions { display: flex; gap: 8px; flex-wrap: wrap; flex: none; padding-top: 4px; }
.exec__h2 { font-size: 15px; font-weight: 700; letter-spacing: -.012em; margin: 0; color: var(--text); }
.exec__sub { font-size: 12.5px; line-height: 1.6; color: var(--text-3); margin: 5px 0 0; max-width: 56ch; }
.exec__section { margin-bottom: 26px; }
.exec__sechead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.exec__ico {
  width: 28px; height: 28px; border-radius: var(--r-sm); flex: none;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- hero metrics ---- */
.exec__heroes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 14px; margin-bottom: 30px;
}
.hero {
  position: relative; padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.hero--link { cursor: pointer; }
.hero--link:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.hero--link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hero__top { display: flex; align-items: center; gap: 8px; }
.hero__ico {
  width: 24px; height: 24px; border-radius: var(--r-xs); flex: none;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
}
.hero__label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: -.005em; }
.hero__figure { display: flex; align-items: baseline; gap: 6px; }
/* Proportional figures on a display-size number; tabular only where digits align. */
.hero__value { font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.hero__unit { font-size: 14px; font-weight: 600; color: var(--text-3); }
.hero__foot { display: flex; align-items: flex-end; gap: 10px; min-height: 30px; }
.hero__sowhat { font-size: 11.5px; line-height: 1.45; color: var(--text-3); max-width: 30ch; }
.hero__spark { position: absolute; right: 14px; bottom: 12px; opacity: .5; pointer-events: none; }

/* ---- department tiles ---- */
.exec__tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.etile {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 15px 16px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; font-family: inherit; color: var(--text);
  transition: border-color .14s, background .14s;
}
.etile:hover { border-color: var(--brand); background: var(--brand-soft); }
.etile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.etile__ico {
  width: 24px; height: 24px; border-radius: var(--r-xs); margin-bottom: 6px;
  background: var(--surface-3); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.etile--good .etile__ico { background: var(--success-bg); color: var(--success-text); }
.etile--warn .etile__ico { background: var(--warning-bg); color: var(--warning-text); }
.etile__value { font-size: 23px; font-weight: 700; letter-spacing: -.022em; line-height: 1.1; }
.etile__label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.etile__sowhat { font-size: 11px; color: var(--text-3); line-height: 1.4; }

/* Aging tiles: one card per horizon, four colour-coded buckets inside it, each
   bucket a drill-down. Colour carries urgency, the number carries the load. */
/* Half-width now, so the donut and its legend do not stretch apart. */
.exec__split .donut, .exec__split svg.donut { max-width: 100%; }
.exec__aging {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.agetile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px 13px 11px; min-width: 0; }
.agetile__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.agetile__ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.agetile__label { font-size: 13.5px; font-weight: 650; color: var(--text); }
.agetile__sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.agetile__buckets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.agebkt {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid transparent; font: inherit;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.agebkt:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.agebkt:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.agebkt__n { font-size: 19px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.agebkt__cap { font-size: 10px; font-weight: 600; letter-spacing: .02em; opacity: .85; }
.agebkt--over { background: var(--danger-bg); color: var(--danger-text); }
.agebkt--d30  { background: var(--warning-bg); color: var(--warning-text); }
.agebkt--d60  { background: var(--brand-soft); color: var(--brand-600); }
.agebkt--d90  { background: var(--surface-2); color: var(--text-2); }
:root[data-theme="dark"] .agebkt--d60 { color: var(--brand); }
@media (max-width: 620px) { .agetile__buckets { grid-template-columns: repeat(2, 1fr); } }

/* Dashboard band headings — quiet uppercase labels that group the page. */
.dashband { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; }
.dashband::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dashband__t { font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }

/* The Director's dashboard runs dense — same components, less air. */
.page--dash .card--pad { padding: 14px; }
.page--dash .exec__aging { margin-bottom: 12px; gap: 10px; }
.page--dash .exec__split { margin-bottom: 12px; gap: 12px; }
/* Dense + ALIGNED: every tile in a row is a column-flex with the footline
   pinned, so values sit on one shared line no matter how the label wraps, and
   the page trims its outer air. */
.page--dash { padding: 16px 22px 40px; max-width: none; }
.page--dash .pagehead { margin-bottom: 12px; }
.page--dash .hero { display: flex; flex-direction: column; padding: 12px 14px 10px; min-height: 118px; }
.page--dash .hero__top { min-height: 30px; align-items: flex-start; }
.page--dash .hero__figure { margin-top: auto; }
.page--dash .hero__value { font-size: 27px; }
.page--dash .hero__foot { min-height: 31px; margin-top: 4px; align-items: flex-start; }
.page--dash .hero__sowhat { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.page--dash .hero__sowhat { max-width: none; line-height: 1.35; }
.page--dash .metric { display: flex; flex-direction: column; min-height: 108px; padding: 12px 14px 10px; }
.page--dash .metric__value { margin-top: auto; font-size: 24px; }
.page--dash .metric__top { min-height: 40px; align-items: flex-start; }
.page--dash .metric__foot { margin-top: 4px; min-height: 16px; }
.page--dash .grid { gap: 10px; }
.page--dash .grid--kpi { gap: 10px; }
.page--dash .agetile .agetile__head { margin-bottom: 8px; }
.page--dash .dashband { margin: 14px 0 8px; }
.page--dash .exec__note { margin-top: 12px; }

/* Five heroes and five ops cards must share one row each — the 240px minimum
   made the fifth tile wrap into a mostly-empty second row. */
.page--dash .exec__heroes { margin-bottom: 12px; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.page--dash .grid--4 { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.page--dash .feed__item { padding: 7px 9px; }
.page--dash .orgnode__head { padding: 9px 12px; }
.page--dash .orgnode__body { padding: 10px 12px; }
.page--dash .agetile { padding: 11px 12px 9px; }

/* Filter popover polish — uniform control heights, tidy preset chips. */
.fpop .select, .fpop .input { height: 32px; font-size: 12.5px; }
.fpop .chip { height: 26px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }
.fpop .field { gap: 5px; }
.fpop .field__label { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.fpop__lbl { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 7px; }

/* Sortable table headers */
.th--sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th--sort:hover { color: var(--brand-600); }

/* Module-family hub tiles */
.ghub__tile { text-align: left; border: 1px solid var(--border); cursor: pointer; font: inherit; color: inherit; display: block; width: 100%; }

/* Document lightbox — only the document, arrows to move through the set. */
.doclb {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center;
  justify-content: center; gap: 14px; background: rgba(8, 20, 14, .72);
  backdrop-filter: blur(3px); padding: 24px;
}
.doclb__panel {
  width: min(1160px, 100%); height: min(92vh, 100%); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45); overflow: hidden; min-width: 0;
}
.doclb__bar {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); flex: none;
}
.doclb__name {
  font-size: 12.5px; font-weight: 650; color: var(--text); min-width: 0; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doclb__search { flex: none; width: 240px; }
.doclb__search .input { height: 30px; font-size: 12px; padding-left: 30px; }
.doclb__hits { padding: 7px 14px; border-bottom: 1px solid var(--border); background: var(--brand-soft); color: var(--text-2); flex: none; }
/* Litigation analytics: Stage donut (~38%) beside Type bars (~62%), top-aligned */
.litcharts { display: grid; grid-template-columns: minmax(300px, 38%) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.litcharts > * { min-width: 0; }
@media (max-width: 900px) { .litcharts { grid-template-columns: 1fr; } }

/* Record 360 — full-screen record page (not a half drawer) */
.r360 { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; animation: r360in .16s ease; }
@keyframes r360in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.r360__bar { display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.r360__stepper { padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; overflow-x: auto; }
.r360__tabs { display: flex; gap: 4px; padding: 6px 22px 0; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; overflow-x: auto; }
.r360__body { flex: 1; overflow: auto; padding: 24px 22px 60px; }
.r360__inner { max-width: 1100px; margin: 0 auto; }
@media (max-width: 720px) { .r360__body { padding: 16px; } .r360__inner .grid { grid-template-columns: 1fr !important; } }
.doclb__frame { flex: 1; width: 100%; border: 0; background: #fff; }
.xlsxsheet table { border-collapse: collapse; font-size: 12px; background: var(--surface); }
.xlsxsheet td, .xlsxsheet th { border: 1px solid var(--border); padding: 4px 8px; white-space: nowrap; color: var(--text); }
.xlsxsheet tr:first-child td { background: var(--surface-2); font-weight: 600; }
.doclb__arrow {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: flex;
  align-items: center; justify-content: center; box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  transition: transform .12s, background .12s;
}
.doclb__arrow:hover:not(:disabled) { background: var(--brand-soft); transform: scale(1.06); }
.doclb__arrow:disabled { opacity: .3; cursor: default; }
@media (max-width: 900px) {
  .doclb { padding: 8px; gap: 8px; }
  .doclb__search { display: none; }
}

/* The Director's hierarchy: organisation -> team -> desk / owner -> work item.
   Each level opens in place, so drilling never leaves the executive context. */
.orgnode { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.orgnode__head {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 14px;
  border: 0; background: transparent; cursor: pointer; font: inherit; color: inherit;
  transition: background .13s;
}
.orgnode__head:hover { background: var(--surface-2); }
.orgnode__head.is-open { background: var(--surface-2); }
.orgnode__chev { flex: none; opacity: .55; transform: rotate(-90deg); transition: transform .18s ease; }
.orgnode__head.is-open .orgnode__chev { transform: rotate(0deg); }
.orgnode__ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center;
  justify-content: center; background: var(--brand-soft); color: var(--brand);
}
.orgnode__name { font-size: 13.5px; font-weight: 650; color: var(--text); }
.orgnode__sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.orgnode__nums { display: flex; gap: 14px; flex: none; }
.orgnode__n { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.orgnode__n b { color: var(--text); font-size: 13px; }
.orgnode__body { border-top: 1px solid var(--border); padding: 14px; background: var(--surface-2); }
.orgnode__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; }
.orgrow {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px;
  border: 0; border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  font: inherit; color: inherit; text-align: left; transition: background .12s;
}
.orgrow:hover { background: var(--brand-soft); }
.orgrow.is-open { background: var(--brand-soft); }
.orgrow__name { font-size: 12.5px; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orgnode__work { margin: 4px 0 8px 22px; padding-left: 12px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.orgwork {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; font: inherit; color: inherit;
  transition: background .12s;
}
.orgwork:hover { background: var(--surface); }
@media (max-width: 900px) {
  .orgnode__cols { grid-template-columns: 1fr; }
  .orgnode__nums { display: none; }
}

.exec__split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 26px; align-items: start; }

/* ---- the board note ---- */
.exec__note {
  padding: 22px 24px; border-radius: var(--r-lg);
  background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 22px;
}
.exec__noteHead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.exec__prose { max-width: 78ch; }
.exec__prose p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.72; color: var(--text-2); }
.exec__prose p:last-child { margin-bottom: 0; }
.exec__foot { padding-top: 18px; border-top: 1px solid var(--border); max-width: 78ch; }

/* ---- viz bits ---- */
.rankbar { display: flex; flex-direction: column; gap: 5px; }
.rankbar--link { cursor: pointer; }
.rankbar__head { display: flex; align-items: baseline; gap: 10px; }
.rankbar__label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.rankbar--link:hover .rankbar__label { color: var(--brand); }
.rankbar__value { font-size: 12.5px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.rankbar__track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.rankbar__fill { height: 100%; border-radius: 4px; transition: width .5s cubic-bezier(.16,1,.3,1), opacity .14s; }
.donut__value { font-size: 24px; font-weight: 700; letter-spacing: -.022em; color: var(--text); }
.viz__legend { font-size: 12px; font-weight: 550; color: var(--text-2); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz__legendval { font-size: 12px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; flex: none; }
.viz__legendpct { font-size: 11.5px; color: var(--text-3); flex: none; width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.viz__twin {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start;
  background: none; border: 0; padding: 2px 0; cursor: pointer; font-family: inherit;
  font-size: 11.5px; font-weight: 600; color: var(--brand);
}
.viz__twin:hover { text-decoration: underline; }
.viz__table { width: 100%; border-collapse: collapse; font-size: 12px; }
.viz__table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.viz__table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.viz__table tr:last-child td { border-bottom: 0; }

/* ---- the journey ---- */
.journey {
  display: flex; align-items: stretch; gap: 2px; overflow-x: auto;
  padding: 4px 2px 12px; margin-bottom: 18px; scrollbar-width: thin;
}
.journey__link { display: flex; align-items: center; color: var(--text-3); flex: none; opacity: .5; }
.jnode {
  flex: 1 0 132px; min-width: 132px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  padding: 13px 13px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  font-family: inherit; color: var(--text);
  transition: border-color .14s, background .14s, transform .14s;
}
.jnode:hover { border-color: var(--brand); transform: translateY(-2px); }
.jnode--sel { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.jnode--quiet { opacity: .68; }
.jnode__ico {
  width: 24px; height: 24px; border-radius: var(--r-xs); margin-bottom: 6px;
  background: var(--surface-3); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.jnode--sel .jnode__ico { background: var(--brand); color: #fff; }
.jnode__count { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.jnode__label { font-size: 12px; font-weight: 650; line-height: 1.3; }
.jnode__unit { font-size: 10.5px; color: var(--text-3); line-height: 1.35; }
.jnode__who {
  align-self: flex-start; margin-top: 7px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--r-full);
}
.jnode__who--amber  { background: var(--warning-bg); color: var(--warning); }
.jnode__who--blue   { background: var(--brand-soft); color: var(--brand); }
.jnode__who--purple { background: var(--accent-soft); color: var(--accent-500); }
.jnode__who--indigo { background: #eef2ff; color: #4338ca; }
:root[data-theme="dark"] .jnode__who--indigo { background: #1c2140; color: #a5b4fc; }
.jnode__who--green  { background: var(--success-bg); color: var(--success); }

.jdetail { margin-bottom: 26px; }
.jdetail__ico {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: none;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
}
.jio { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.jio__cell { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.jio__l { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 6px; }
.jio__t { font-size: 12.5px; line-height: 1.55; color: var(--text-2); }

/* ---- before / after ---- */
.ba { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.ba__card { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.ba__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ba__ico { width: 28px; height: 28px; border-radius: var(--r-sm); flex: none; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.ba__t { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
.ba__row { padding: 11px 0; }
.ba__row + .ba__row { border-top: 1px solid var(--border); }
.ba__row p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--text-2); }
.ba__row--before p { color: var(--text-3); }
.ba__tag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-3); }
.ba__tag--on { background: var(--success-bg); color: var(--success); }

/* ---- the two apps ---- */
.twoapp { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.twoapp__box { padding: 17px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.twoapp__box--legal { border-color: color-mix(in srgb, var(--brand) 34%, transparent); background: var(--brand-soft); }
.twoapp__head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.twoapp__sub { font-size: 11px; color: var(--text-3); margin: 3px 0 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.twoapp__list { margin: 0; padding-left: 17px; }
.twoapp__list li { font-size: 12.5px; line-height: 1.65; color: var(--text-2); }
.twoapp__link {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 12px;
  font-size: 12px; font-weight: 650; color: var(--brand);
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; text-decoration: none;
}
.twoapp__link:hover { text-decoration: underline; }
.twoapp__bridge { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 92px; }
.twoapp__wire { width: 2px; flex: 1; min-height: 24px; background: linear-gradient(180deg, transparent, var(--brand), transparent); }
.twoapp__chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--r-full);
  background: var(--brand); color: #fff;
}
.twoapp__foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---- guided tour ---- */
.tour { position: fixed; inset: 0; z-index: var(--z-toast); pointer-events: none; }
.tour__scrim { position: absolute; inset: 0; background: rgba(6, 24, 16, .58); pointer-events: auto; }
.tour__spot {
  position: absolute; border-radius: var(--r-md); pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(6, 24, 16, .58), 0 0 0 2px var(--brand);
  transition: top .3s cubic-bezier(.16,1,.3,1), left .3s cubic-bezier(.16,1,.3,1), width .3s, height .3s;
}
:root[data-theme="dark"] .tour__spot { box-shadow: 0 0 0 9999px rgba(0, 0, 0, .68), 0 0 0 2px var(--brand); }
:root[data-theme="dark"] .tour__scrim { background: rgba(0, 0, 0, .68); }
.tour__card {
  position: absolute; pointer-events: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: 16px 18px 14px; animation: rise .2s cubic-bezier(.16,1,.3,1);
}
.tour__top { display: flex; align-items: center; margin-bottom: 8px; }
.tour__step { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.tour__x { width: 26px; height: 26px; border-radius: var(--r-xs); border: 0; background: none; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tour__x:hover { background: var(--surface-2); color: var(--text); }
.tour__title { font-size: 15.5px; font-weight: 700; letter-spacing: -.015em; margin-bottom: 6px; }
.tour__caption { margin: 0; font-size: 13px; line-height: 1.62; color: var(--text-2); }
.tour__aside { display: flex; gap: 7px; align-items: flex-start; margin-top: 10px; padding: 9px 11px; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand-600); font-size: 11.5px; line-height: 1.5; }
:root[data-theme="dark"] .tour__aside { color: var(--brand); }
.tour__bar { display: flex; gap: 4px; margin: 14px 0 12px; }
.tour__pip { height: 3px; flex: 1; border-radius: 2px; background: var(--surface-3); transition: background .2s; }
.tour__pip.done { background: color-mix(in srgb, var(--brand) 45%, transparent); }
.tour__pip.on { background: var(--brand); }
.tour__foot { display: flex; align-items: center; gap: 8px; }
.tour__skip { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.tour__skip:hover { color: var(--text); text-decoration: underline; }
.tour__hint { margin-top: 9px; font-size: 10.5px; color: var(--text-3); }
.tourbtn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 32px; padding: 0 11px; border-radius: var(--r-full);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  color: var(--brand-600); font-size: 12px; font-weight: 650;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s;
}
:root[data-theme="dark"] .tourbtn { color: var(--brand); }
.tourbtn:hover { background: var(--brand-soft-2); border-color: var(--brand); }

/* ---- the printable brief ---- */
.brief { max-width: 900px; margin: 0 auto; }
.brief__chrome { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.brief__sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 34px 38px 30px;
}
.brief__head { display: flex; align-items: flex-start; gap: 20px; padding-bottom: 16px; border-bottom: 2px solid var(--text); margin-bottom: 18px; }
.brief__kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.brief__title { font-size: 24px; font-weight: 700; letter-spacing: -.022em; margin: 0; line-height: 1.2; }
.brief__asof { font-size: 11px; color: var(--text-3); flex: none; padding-top: 18px; white-space: nowrap; }
.brief__lede { font-size: 13.5px; line-height: 1.7; color: var(--text-2); margin: 0 0 20px; max-width: 74ch; }
.brief__h2 { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }
.brief__metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.brief__metric { min-width: 0; }
.brief__mv { font-size: 21px; font-weight: 700; letter-spacing: -.022em; line-height: 1.15; }
.brief__ml { font-size: 11.5px; font-weight: 650; color: var(--text-2); margin-top: 3px; }
.brief__ms { font-size: 10.5px; color: var(--text-3); line-height: 1.4; margin-top: 2px; }
.brief__flow { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px 16px; }
.brief__flow li { display: grid; grid-template-columns: 20px 1fr; grid-template-rows: auto auto; gap: 0 8px; align-items: baseline; }
.brief__step { grid-row: span 2; width: 19px; height: 19px; border-radius: 50%; border: 1px solid var(--text-3); color: var(--text-2); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.brief__stept { font-size: 12.5px; font-weight: 650; }
.brief__stepd { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.brief__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 20px; }
.brief__list { margin: 0; padding-left: 16px; }
.brief__list li { font-size: 12px; line-height: 1.6; color: var(--text-2); margin-bottom: 5px; }
.brief__prose p { margin: 0 0 8px; font-size: 12px; line-height: 1.65; color: var(--text-2); }
.brief__foot { padding-top: 14px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--text-3); line-height: 1.5; }

/* ---- print: the brief on one page, monochrome safe ---- */
@media print {
  .sidebar, .topbar, .copilot-fab, .copilot-panel, .tourbtn, .tour, .noprint { display: none !important; }
  .app { display: block !important; }
  .main, .content { overflow: visible !important; height: auto !important; }
  .content { padding: 0 !important; }
  .page { padding: 0 !important; max-width: none !important; }
  html, body { background: #fff !important; }
  * { color: #000 !important; box-shadow: none !important; }
  .brief__sheet { border: 0 !important; padding: 0 !important; background: #fff !important; page-break-inside: avoid; }
  .brief__head { border-bottom: 2px solid #000 !important; }
  .brief__metrics { border-color: #666 !important; }
  .brief__step { border-color: #000 !important; }
  .viz__table th, .viz__table td, .brief__foot, .ba__row + .ba__row { border-color: #999 !important; }
  .brief__sheet section { page-break-inside: avoid; }
  /* Compress the type scale so the sheet lands on one page. */
  .brief__title { font-size: 20px; }
  .brief__lede { font-size: 11.5px; margin-bottom: 14px; }
  .brief__metrics { padding: 11px 0; margin-bottom: 14px; }
  .brief__mv { font-size: 17px; }
  .brief__flow { gap: 6px 14px; margin-bottom: 14px; }
  .brief__cols { gap: 18px; margin-bottom: 14px; }
  .brief__list li, .brief__prose p { font-size: 10.5px; line-height: 1.5; }
  @page { margin: 14mm; }
}

@media (max-width: 1240px) { .exec__tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1040px) {
  .exec__split { grid-template-columns: 1fr; }
  .brief__metrics { grid-template-columns: repeat(2, 1fr); }
  .brief__flow { grid-template-columns: repeat(2, 1fr); }
  .twoapp { grid-template-columns: 1fr; }
  .twoapp__bridge { flex-direction: row; min-width: 0; width: 100%; }
  .twoapp__wire { width: auto; height: 2px; min-height: 0; flex: 1; background: linear-gradient(90deg, transparent, var(--brand), transparent); }
}
@media (max-width: 700px) {
  .exec__tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tourbtn__t { display: none; }
  .brief__cols, .brief__flow, .brief__metrics { grid-template-columns: 1fr; }
  .brief__sheet { padding: 22px 20px; }
}

/* ============================================================
   SPRINT 6 — the org architecture: team modules, My Tasks, Raise
   Request, cost analysis, master data admin. Both themes ride the
   existing tokens; nothing below hard-codes a colour that the theme
   does not own.
   ============================================================ */

/* page header (module surfaces) */
.page__head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page__title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 0; }
.page__sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; max-width: 760px; }
.page__head > :first-child { margin-right: auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input--sm { height: 30px; padding: 0 9px; font-size: 12.5px; width: auto; }
.table--tight th, .table--tight td { padding: 7px 10px; font-size: 12.5px; }

/* TAT chip — Running / Paused / Overdue / Closed */
.tatchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.tatchip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tatchip--running { background: var(--success-bg); color: var(--success); }
.tatchip--paused { background: var(--brand-soft); color: var(--brand-600); }
.tatchip--overdue { background: var(--danger-bg); color: var(--danger); }
.tatchip--closed { background: var(--surface-2); color: var(--text-3); }

/* KPI strip */
/* StatStrip KPI cards — one system with the module-register KPIs below. */
.statkpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.statkpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 13px 16px;
  border-left-width: 3px; box-shadow: var(--shadow-xs);
  min-width: 0;
}
.statkpi__n {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 21px; font-weight: 750; letter-spacing: -0.02em; color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.statkpi__l { font-size: 11.5px; color: var(--text-2); margin-top: 3px; line-height: 1.3; }
.statkpi--blue { border-left-color: var(--brand); }
.statkpi--green { border-left-color: var(--success); }
.statkpi--amber { border-left-color: var(--warning); }
.statkpi--red { border-left-color: var(--danger); }
.statkpi--purple { border-left-color: var(--accent-500); }
.statkpi--gray { border-left-color: var(--border-strong); }
/* clickable KPI cards double as view filters */
.statkpi--click { cursor: pointer; transition: box-shadow .14s, transform .14s, border-color .14s, background .14s; }
.statkpi--click:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); border-color: var(--border-strong); }
.statkpi--on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.statkpi--on .statkpi__l { color: var(--brand-600); font-weight: 600; }
/* A stat that is also a way in has to look like one. */
.statkpi--link { cursor: pointer; transition: border-color .13s, box-shadow .13s, transform .13s; }
.statkpi--link:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.statkpi--link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 768px) { .statkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.modkpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.modkpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; border-left-width: 3px; }
.modkpi__n { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; color: var(--text); }
.modkpi__l { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.modkpi--blue { border-left-color: var(--brand); }
.modkpi--red { border-left-color: var(--danger); }
.modkpi--amber { border-left-color: var(--warning); }
.modkpi--green { border-left-color: var(--success); }
.modkpi--gray { border-left-color: var(--border-2); }

/* register toolbar */
.modtoolbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.modtoolbar__search { display: flex; align-items: center; gap: 7px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 10px; height: 32px; flex: 1; min-width: 180px; color: var(--text-3); }
.modtoolbar__search input { border: 0; background: transparent; outline: 0; font-size: 13px; width: 100%; color: var(--text); }
.modreport { padding: 16px; margin-bottom: 16px; }

/* access panel (row-level security explainer) */
.access-card { max-width: 560px; margin: 60px auto; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 34px 36px; }
.access-card__ico { width: 46px; height: 46px; border-radius: 14px; background: var(--warning-bg); color: var(--warning); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.access-card h3 { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.01em; }
.access-card p { color: var(--text-2); font-size: 13.5px; line-height: 1.55; margin: 0 0 18px; }

/* workflow rail */
.modrail { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 2px; }
.modrail__step { flex: 1; min-width: 96px; text-align: center; position: relative; padding: 0 6px; }
.modrail__step::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--border); }
.modrail__step:first-child::before { display: none; }
.modrail__dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--border-2); color: var(--text-3); font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; position: relative; z-index: 1; }
.modrail__step.done .modrail__dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.modrail__step.done::before { background: var(--brand); }
.modrail__step.current .modrail__dot { background: var(--surface); border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.modrail__step.current::before { background: var(--brand); }
.modrail__label { font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.25; }
.modrail__step.current .modrail__label { color: var(--text); }
.modrail__meta { font-size: 10.5px; color: var(--text-3); margin-top: 2px; }

/* warnings + hold banner */
.modwarn { display: flex; align-items: center; gap: 8px; background: var(--danger-bg); color: var(--danger); font-size: 12.5px; font-weight: 600; border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 10px; }
.modwarn--soft { background: var(--warning-bg); color: var(--warning); }
.modhold-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--brand-soft); color: var(--brand-600); font-size: 12.5px; border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 12px; }
.modhold-banner .btn { margin-left: auto; }

/* TAT breakdown */
.tatgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tatgrid__n { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; color: var(--text); }
.tatgrid__l { font-size: 11.5px; color: var(--text-2); margin-top: 1px; }

/* holds list */
.modholdrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 6px; color: var(--text-2); }
.modholdrow--open { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-600); }

/* field groups */
.modmeta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; padding: 16px; margin-bottom: 14px; }
.modfields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
.modfield__label { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.modfield__value { font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.modfield__value--long { white-space: pre-wrap; }
.modfield--long { grid-column: 1 / -1; }
.modfield__src { font-size: 9.5px !important; padding: 1px 6px !important; }
.modnote { display: flex; align-items: flex-start; gap: 9px; background: var(--warning-bg); color: var(--warning); border-radius: var(--r-sm); padding: 10px 13px; font-size: 12.5px; line-height: 1.5; margin-bottom: 14px; }
.modcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 14px; }
.modcols > .card { margin: 0; }
.page > .card, .page .modcols { margin-bottom: 14px; }
.modeditgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }

/* auto-response */
.modresponse { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 16px; font-size: 12.5px; font-family: inherit; white-space: pre-wrap; line-height: 1.6; color: var(--text); max-height: 300px; overflow-y: auto; }

/* activity */
.modactivity { max-height: 340px; overflow-y: auto; }
.modactivity__row { display: flex; gap: 10px; padding: 6px 0; }
.modactivity__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); margin-top: 6px; flex: none; }

/* raise flow */
.raisedots { display: flex; gap: 22px; margin-bottom: 18px; flex-wrap: wrap; }
.raisedots__item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.raisedots__n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--border-2); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.raisedots__item.done { color: var(--brand-600); }
.raisedots__item.done .raisedots__n { background: var(--brand); border-color: var(--brand); color: #fff; }
.raisedots__item.current { color: var(--text); }
.raisedots__item.current .raisedots__n { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.raiseteams { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.raiseteam { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; cursor: pointer; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.raiseteam:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.raiseteam.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.raiseteam__ico { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.raiseteam__ico--red { background: var(--danger-bg); color: var(--danger); }
.raiseteam__ico--blue { background: var(--brand-soft); color: var(--brand-600); }
.raiseteam__ico--amber { background: var(--warning-bg); color: var(--warning); }
.raiseteam__name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.raiseteam__fns { font-size: 12px; color: var(--text-2); line-height: 1.5; min-height: 36px; }
.raiseteam__go { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; color: var(--brand-600); margin-top: 12px; }
.raisemods { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.raisemod { display: flex; align-items: center; gap: 11px; border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; transition: border-color 0.15s; color: var(--text-2); }
.raisemod:hover, .raisemod.active { border-color: var(--brand); color: var(--text); }
.raisemod__name { font-size: 13.5px; font-weight: 650; color: var(--text); }
.raisesep { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); border-top: 1px solid var(--border); margin: 18px 0 12px; padding-top: 14px; }
.raisefiles { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.raisefile { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; font-size: 12px; padding: 3px 9px; }
.raisefile button { display: inline-flex; color: var(--text-3); }
.raisedone { text-align: center; padding: 40px 30px; }
.raisedone__ico { width: 52px; height: 52px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.raisedone h3 { margin: 0 0 8px; font-size: 17px; }
.raisedone p { color: var(--text-2); font-size: 13.5px; max-width: 460px; margin: 0 auto 18px; line-height: 1.55; }

/* costs */
.costmeters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.costcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.costcols > .card { margin: 0; }

/* master data admin */
.mdrow { gap: 8px; padding: 4px 0; }
.mdrow .input { flex: 1; }

/* responsive */
@media (max-width: 1100px) {
  .modkpis, .tatgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modfields, .modmeta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modcols, .costcols { grid-template-columns: 1fr; }
  .costmeters { grid-template-columns: 1fr; }
  .raiseteams { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .modfields, .modmeta, .modeditgrid { grid-template-columns: 1fr; }
  .modkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modrail__step { min-width: 84px; }
}

/* ============================================================
   SPRINT 7 — operational completeness: two-column detail, comments,
   attachments, people rail, stage strips, quick actions, toasts.
   ============================================================ */

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 10px 15px; font-size: 13px; font-weight: 600; color: var(--text); animation: toastin 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2); max-width: 380px; }
.toast--success { border-left: 3px solid var(--success); }
.toast--success svg { color: var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--error svg { color: var(--danger); }
.toast--info { border-left: 3px solid var(--brand); }
.toast--info svg { color: var(--brand); }
@keyframes toastin { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }

/* topbar quick-create */
.newbtn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: var(--r-sm); background: var(--brand); color: #fff; font-size: 13px; font-weight: 650; transition: filter 0.15s; }
.newbtn:hover { filter: brightness(1.08); }

/* two-column detail */
/* R1.0 Module 1 — assisted triage */
.triage { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.triage__queue { display: flex; flex-direction: column; gap: 8px; }
.tqrow { text-align: left; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 10px 12px; cursor: pointer; transition: border-color .13s, background .13s; display: flex; flex-direction: column; gap: 4px; }
.tqrow:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tqrow.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tqrow__title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tsec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.trow { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 4px 0; font-size: 13px; }
.trow__l { color: var(--text-3); font-size: 12px; }
.trow__v { color: var(--text); min-width: 0; }
.tctx { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; white-space: pre-wrap; }
.tprop { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); border-radius: var(--r-md); padding: 14px 16px; }
.tprop__k { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 3px; }
.tprop__v { font-size: 14px; font-weight: 600; color: var(--text); }
.tflag { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; line-height: 1.4; padding: 8px 10px; border-radius: var(--r-sm); margin-bottom: 6px; }
.tflag--red { background: var(--danger-bg); color: var(--danger-text); }
.tflag--amber { background: var(--warning-bg); color: var(--warning-text); }
.tsim { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 5px; cursor: pointer; transition: border-color .12s; }
.tsim:hover { border-color: var(--brand); }
@media (max-width: 980px) { .triage { grid-template-columns: 1fr; } }

.moddetail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.moddetail__main { min-width: 0; }
.moddetail__main > .card { margin-bottom: 14px; }
.moddetail__rail { position: sticky; top: 12px; min-width: 0; }
.moddetail__rail > .card { margin-bottom: 14px; }
.tatgrid--rail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }

/* people & routing */
.modpeople__row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.modpeople__row .input--sm { max-width: 138px; }
.modpeople__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
.modpeople__drive { display: flex; align-items: center; gap: 8px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--border); }

/* attachments */
.modatt { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 6px; }
.modatt__ico { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-600); display: flex; align-items: center; justify-content: center; flex: none; }

/* comments */
.modcomment { display: flex; gap: 10px; padding: 8px 0; }
.modcomment__body { flex: 1; min-width: 0; }
.modcomment__who { font-size: 12.5px; font-weight: 700; }
.modcomment__text { font-size: 13px; line-height: 1.5; margin-top: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 8px 12px; white-space: pre-wrap; }
.modcomment--mine .modcomment__text { background: var(--brand-soft); border-color: transparent; }
.modcomment--internal .modcomment__text { border-style: dashed; background: var(--warning-bg); }
.modcomments__input { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }

/* quick actions */
.quickaction { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; margin-bottom: 7px; font-size: 12.5px; font-weight: 650; color: var(--text); background: var(--surface); transition: border-color 0.15s, background 0.15s; cursor: pointer; }
.quickaction:hover { border-color: var(--brand); background: var(--brand-soft); }
.quickaction svg:first-child { color: var(--brand-600); flex: none; }

/* stage pipeline strip */
.stagestrip { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; }
.stagestrip__cell { flex: 1; min-width: 92px; padding: 10px 8px 9px; text-align: center; border-right: 1px solid var(--border); background: transparent; cursor: pointer; transition: background 0.12s; position: relative; }
.stagestrip__cell:last-child { border-right: 0; }
.stagestrip__cell:hover { background: var(--surface-2); }
.stagestrip__cell.active { background: var(--brand-soft); box-shadow: inset 0 -2px 0 var(--brand); }
.stagestrip__cell.empty { opacity: 0.45; }
.stagestrip__n { display: block; font-size: 16px; font-weight: 750; color: var(--text); letter-spacing: -0.01em; }
.stagestrip__n.overdue { color: var(--danger); }
.stagestrip__label { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-3); margin-top: 1px; line-height: 1.25; }

/* entity quick-add */
.entityadd { width: 34px; height: 34px; flex: none; border: 1px dashed var(--border-2); border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--text-3); cursor: pointer; transition: all 0.15s; }
.entityadd:hover { border-color: var(--brand); color: var(--brand-600); background: var(--brand-soft); }
.rolechips { display: flex; flex-wrap: wrap; gap: 6px; }
.rolechip { border: 1px solid var(--border); border-radius: 99px; padding: 4px 11px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface); cursor: pointer; transition: all 0.12s; }
.rolechip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* my tasks focus line + urgency rail */
.focusline { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, var(--danger-bg), var(--surface)); border: 1px solid var(--border); border-left: 3px solid var(--danger); border-radius: var(--r-md); padding: 11px 15px; margin-bottom: 14px; font-size: 13px; }
.focusline svg:first-child { color: var(--danger); }
.urgrow td:first-child { position: relative; }
.urgrow td:first-child::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; }
.urgrow--overdue td:first-child::before { background: var(--danger); }
.urgrow--paused td:first-child::before { background: var(--brand); }
.urgrow--running td:first-child::before { background: var(--success); opacity: 0.4; }

/* responsive */
@media (max-width: 1200px) {
  .moddetail { grid-template-columns: 1fr; }
  .moddetail__rail { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .moddetail__rail > .card { margin: 0; }
}
@media (max-width: 760px) {
  .moddetail__rail { grid-template-columns: 1fr; }
  .newbtn span { display: none; }
  .stagestrip__cell { min-width: 76px; }
}

/* ============================================================
   SPRINT 8 — SECP Filings: per-entity board, status chips, links.
   ============================================================ */
.filingsboard { padding-bottom: 8px; }
.fbe { display: flex; gap: 14px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--border); }
.fbe:first-of-type { border-top: 0; }
.fbe--active { background: var(--brand-soft); margin: 0 -18px; padding: 9px 18px; border-radius: var(--r-sm); }
.fbe__entity { display: flex; align-items: center; gap: 8px; min-width: 220px; flex: none; font-size: 13px; font-weight: 650; color: var(--text); cursor: pointer; padding: 3px 0; text-align: left; }
.fbe__entity:hover span:first-of-type { text-decoration: underline; text-underline-offset: 3px; }
.fbe__entity svg { color: var(--text-3); }
.fbe__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.fbechip { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 4px 11px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: border-color 0.12s, transform 0.12s; }
.fbechip:hover { transform: translateY(-1px); }
.fbechip__dot { width: 7px; height: 7px; border-radius: 99px; flex: none; }
.fbechip--red { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.fbechip--red .fbechip__dot { background: var(--danger); }
.fbechip--amber { border-color: color-mix(in srgb, var(--warning) 50%, var(--border)); }
.fbechip--amber .fbechip__dot { background: var(--warning); }
.fbechip--green .fbechip__dot { background: var(--success); }
.fbechip--gray .fbechip__dot { background: var(--text-3); }
.fbechip--ghost { border-style: dashed; color: var(--text-3); cursor: default; }
.reclink { display: inline-flex; align-items: center; gap: 5px; color: var(--brand-600); font-weight: 600; cursor: pointer; }
.reclink:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) { .fbe { flex-direction: column; gap: 6px; } .fbe__entity { min-width: 0; } }

/* ============================================================
   PREMIUM POLISH PASS
   One radius scale · a real modal · a solid topbar · consistent
   form chrome · aligned numerals · themed scrollbars.
   Bayut/Zameen green untouched; the surfaces around it get the
   finish. Token-driven, so light and dark inherit together.
   ============================================================ */

/* 1. Balanced edges — one proportionate radius scale, applied by token
   so every component shifts together: controls 10 · chips/menu 12 ·
   cards 14 · modals 18. */
:root {
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 18px;
  /* Solid enough that content can never read through the bar. */
  --glass: rgba(255, 255, 255, 0.9);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23739184' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --shadow-modal:
    0 0 0 1px color-mix(in srgb, var(--brand) 5%, transparent),
    0 8px 20px -8px rgba(6, 40, 22, 0.18),
    0 32px 80px -16px rgba(6, 40, 22, 0.3);
}
:root[data-theme="dark"] {
  --glass: rgba(18, 29, 24, 0.92);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23879e92' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --shadow-modal:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 8px 24px -8px rgba(0, 0, 0, 0.55),
    0 32px 80px -16px rgba(0, 0, 0, 0.75);
}

::selection { background: color-mix(in srgb, var(--brand) 24%, transparent); }

/* 2. Topbar — solid fallback first, glass only where it actually works,
   and nothing wraps or bleeds at any width. */
.topbar { background: var(--surface); gap: 12px; }
@supports (backdrop-filter: blur(1px)) {
  .topbar { background: var(--glass); backdrop-filter: saturate(160%) blur(16px); }
}
.topbar__crumbs { min-width: 0; flex-shrink: 1; overflow: hidden; white-space: nowrap; }
.topbar__crumbs > * { overflow: hidden; text-overflow: ellipsis; }
.searchbtn { white-space: nowrap; overflow: hidden; min-width: 0; flex-shrink: 1; border-radius: var(--r-sm); }
.searchbtn span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) {
  .searchbtn { width: 38px; flex: none; padding: 0; justify-content: center; }
  .searchbtn span, .searchbtn kbd { display: none; }
  .topbar { padding: 0 14px; }
}
@media (max-width: 900px) {
  .tourbtn span, .newbtn span { display: none; }
}

/* 3. The modal — deep dim, soft blur, layered shadow, branded icon
   plate, breathing room, and scroll that stays inside it. */
.overlay {
  background: rgba(5, 24, 14, 0.45);
  backdrop-filter: blur(7px) saturate(120%);
  padding: 8vh 20px 20px;
  overscroll-behavior: contain;
}
.modal {
  border-radius: var(--r-xl);
  border: 1px solid color-mix(in srgb, var(--brand) 10%, var(--border));
  box-shadow: var(--shadow-modal);
  animation: modalrise 0.26s cubic-bezier(0.2, 1.1, 0.3, 1);
}
@keyframes modalrise { from { opacity: 0; transform: translateY(18px) scale(0.965); } }
.modal__head {
  padding: 18px 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
}
.modal__head .cmdk__ico {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand-600);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 14%, transparent);
}
:root[data-theme="dark"] .modal__head .cmdk__ico { color: var(--brand); }
.modal__title { font-size: 16px; font-weight: 750; letter-spacing: -0.014em; }
.modal__head .iconbtn { width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--text-3); }
.modal__head .iconbtn:hover { background: var(--surface-3); color: var(--text); }
.modal__body { padding: 20px 22px 22px; overscroll-behavior: contain; }
.modal__foot {
  padding: 14px 22px;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
  border-top: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
}

/* 4. Form chrome — one select across every browser, honest states. */
select.input, .select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
  text-overflow: ellipsis;
}
select.input.input--sm { background-position: right 7px center; padding-right: 26px; }
.input, .textarea, .select { border-radius: var(--r-sm); }
.input:hover:not(:focus), .textarea:hover:not(:focus), select.input:hover:not(:focus) { border-color: var(--border-strong); }
.field__label { letter-spacing: 0.01em; }

/* 5. Buttons — quiet depth; visible keyboard focus. */
.btn { border-radius: var(--r-sm); }
.btn--sm { border-radius: var(--r-xs); }
.btn--primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #ffffff), var(--brand));
  box-shadow: 0 1px 2px rgba(6, 61, 36, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn--primary:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 94%, #ffffff), color-mix(in srgb, var(--brand) 88%, #063d24));
  box-shadow: 0 3px 10px -2px rgba(6, 61, 36, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(6, 61, 36, 0.2); }
.newbtn {
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #ffffff), var(--brand));
  box-shadow: 0 1px 2px rgba(6, 61, 36, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.newbtn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px -2px rgba(6, 61, 36, 0.32); filter: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}

/* 6. Data reads like data — digits align in every table, KPI and clock. */
.table td, .modkpi__n, .tatgrid__n, .stagestrip__n, .hero__value, .mono {
  font-variant-numeric: tabular-nums;
}

/* 7. Cards, tables, menus — crisper hierarchy without heaviness. */
.card { border-radius: var(--r-lg); }
.table thead th { font-size: 10.5px; letter-spacing: 0.07em; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr.clickable:hover { background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface)); }
.modkpi, .quickaction, .modatt { border-radius: var(--r-md); }
.access-card { border-radius: var(--r-lg); }
.menu { border-radius: var(--r-md); box-shadow: 0 12px 40px -8px rgba(6, 40, 22, 0.25), 0 0 0 1px color-mix(in srgb, var(--border) 60%, transparent); }
/* The stage strip hugs its card's own corners instead of poking past them. */
.stagestrip { border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; }

/* 8. Scrollbars — thin, rounded, theme-aware. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-3) 55%, transparent); border: 2px solid transparent; background-clip: padding-box; }

/* 9. Detail pages — consistent rhythm between the two columns. */
.moddetail { gap: 18px; }
.moddetail__main > .card, .moddetail__rail > .card { margin-bottom: 16px; }
.page__title { letter-spacing: -0.022em; text-wrap: balance; }

/* 10. Motion respects the reader. */
@media (prefers-reduced-motion: reduce) {
  .modal, .toast, .overlay { animation: none; }
  .btn--primary:hover, .newbtn:hover, .fbechip:hover, .card--hover:hover { transform: none; }
  * { scroll-behavior: auto !important; }
}

/* ============================================================
   DISTINCTION PASS — the changes you can see from across the room.
   Depth: a real canvas under floating cards. Hierarchy: branded
   panel anatomy. Weight: the workflow rail, KPIs and sidebar carry
   their importance. Token-driven; light and dark move together.
   ============================================================ */

/* 1. Canvas ↔ surface depth — cards float instead of outlining. */
:root {
  --bg: #eaf1ec;
  --border: #dee9e2;
  --shadow-card: 0 1px 2px rgba(16, 38, 26, 0.05), 0 6px 22px -10px rgba(16, 38, 26, 0.12);
}
:root[data-theme="dark"] {
  --bg: #0a100d;
  --border: #24362c;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -12px rgba(0, 0, 0, 0.55);
}
.card { box-shadow: var(--shadow-card); border-color: color-mix(in srgb, var(--border) 85%, transparent); }
.topbar { box-shadow: 0 6px 22px -16px rgba(16, 38, 26, 0.35); }
:root[data-theme="dark"] .topbar { box-shadow: 0 6px 22px -14px rgba(0, 0, 0, 0.7); }

/* 2. Panel anatomy — every section opens with a branded tick-bar title. */
.panel__title {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13.5px; font-weight: 750; letter-spacing: -0.008em; color: var(--text);
}
.panel__title::before {
  content: ""; width: 3.5px; height: 15px; border-radius: 99px; flex: none;
  background: linear-gradient(180deg, var(--brand-400), var(--brand));
}

/* 3. Page rhythm — titles with presence, air between sections. */
.page { padding: 28px 34px 76px; }
.page__title { font-size: 24px; font-weight: 780; letter-spacing: -0.026em; }
.moddetail { gap: 20px; }

/* 4. The workflow rail carries the story — weightier dots, a live current step. */
.modrail__step::before { top: 13px; height: 3px; border-radius: 2px; }
.modrail__dot { width: 27px; height: 27px; border-width: 2px; font-size: 11.5px; margin-bottom: 8px; }
.modrail__step.done .modrail__dot {
  background: linear-gradient(135deg, var(--brand-400), var(--brand));
  border-color: transparent;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--brand) 45%, transparent);
}
.modrail__step.current .modrail__dot {
  background: var(--surface); border-color: var(--brand); color: var(--brand-600);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 13%, transparent);
}
:root[data-theme="dark"] .modrail__step.current .modrail__dot { color: var(--brand); }
.modrail__step.current .modrail__label { color: var(--text); font-weight: 750; }

/* 5. KPI tiles read like instruments — big numerals on a tonal wash. */
.modkpi { padding: 15px 18px; }
.modkpi__n { font-size: 27px; font-weight: 800; letter-spacing: -0.03em; }
.modkpi__l { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-top: 3px; }
.modkpi--blue { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 7%, var(--surface)), var(--surface) 60%); }
.modkpi--red { background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 8%, var(--surface)), var(--surface) 60%); }
.modkpi--amber { background: linear-gradient(135deg, color-mix(in srgb, var(--warning) 9%, var(--surface)), var(--surface) 60%); }
.modkpi--gray { background: linear-gradient(135deg, color-mix(in srgb, var(--text-3) 7%, var(--surface)), var(--surface) 60%); }
.modkpi--red .modkpi__n { color: var(--danger); }
.modkpi--amber .modkpi__n { color: var(--warning); }

/* 6. Sidebar — a lit surface, not a flat wall; the active item owns its row. */
.sidebar { background: linear-gradient(180deg, #085031 0%, var(--sidebar-bg) 38%, #042a19 100%); }
:root[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #0d1f15, var(--sidebar-bg) 42%, #050e09); }
.nav__item.active {
  background: linear-gradient(90deg, #0e6b41, var(--sidebar-active));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 2px 10px -3px rgba(0, 0, 0, 0.4);
  font-weight: 600;
}

/* 7. Data furniture — decisive header rule, numbers that stand up. */
.table thead th { border-bottom: 1px solid var(--border-strong); }
.stagestrip__n { font-size: 17px; }

/* 8. Group separators in forms — micro-caps with a rule line. */
.raisesep {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); margin: 18px 0 12px;
}
.raisesep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   THE INSTRUMENT RAIL — the TAT card takes the color of its
   verdict; people rows get structure; empty states get form.
   ============================================================ */
.modtat { border: none; color: #edf7f1; }
.modtat--running { background: linear-gradient(150deg, #0b5132, #063d24 55%, #052e1c); }
.modtat--paused { background: linear-gradient(150deg, #14425c, #0d3049 55%, #0a2537); }
.modtat--overdue { background: linear-gradient(150deg, #8a2020, #641616 55%, #4c1010); }
.modtat--closed { background: linear-gradient(150deg, #37473f, #273730 60%, #1d2b24); }
.modtat .panel__title { color: rgba(255, 255, 255, 0.92); }
.modtat .panel__title::before { background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5)); }
.modtat__hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.modtat__big { font-size: 46px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.modtat__big i { font-style: normal; font-size: 24px; font-weight: 700; opacity: 0.75; margin-left: 1px; }
.modtat__of { font-size: 12.5px; color: rgba(255, 255, 255, 0.68); }
.modtat__of b { color: #fff; font-weight: 750; }
.modtat__bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); margin: 12px 0 14px; overflow: hidden; }
.modtat__bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.7)); }
.modtat--overdue .modtat__bar i { background: linear-gradient(90deg, #ffc4bd, #ff8a7d); }
.modtat .tatgrid { margin-top: 2px; }
.modtat .tatgrid__n { color: #fff; }
.modtat .tatgrid__l { color: rgba(255, 255, 255, 0.62); }
.modtat .modtat__saved { color: #8df0bb; }
.modtat--overdue .modtat__saved { color: #ffd9d4; }
.modtat__stage { font-size: 11.5px; color: rgba(255, 255, 255, 0.66); margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
/* the status chip sits on a dark card — give it a glass treatment there */
.modtat .tatchip { background: rgba(255, 255, 255, 0.14); color: #fff; border: 1px solid rgba(255, 255, 255, 0.18); }

/* people & routing — structured rows */
.modpeople__row { padding: 8px 0; }
.modpeople__row + .modpeople__row { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.modpeople__row .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--brand) 30%, transparent); }

/* empty states with form — a place, not an apology */
.emptyhint {
  display: flex; align-items: center; gap: 9px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 12.5px; color: var(--text-3);
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}
.emptyhint svg { flex: none; opacity: 0.7; }

/* ============================================================
   THE ALIGNMENT FIX — module cards were rendering with ZERO
   padding: content sat 1px from the frame, and the title tick-bar
   faked an indent that nothing else shared. Every content card now
   breathes, and the tick-bar hangs in the padding gutter so all
   text shares ONE left axis.
   ============================================================ */
.card:has(.panel__title),
.moddetail__main > .card,
.moddetail__rail > .card,
.page > .card:not(.card--pad) {
  padding: 16px 18px;
}
.panel__title { position: relative; }
.panel__title::before {
  position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3.5px; height: 14px;
}

/* the turnaround instrument, rebalanced: one axis, no repetition */
.modtat__subtitle { font-size: 11px; color: rgba(255, 255, 255, 0.55); margin-bottom: 12px; }
.modtat__status {
  font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 4px 11px; border-radius: 99px; color: #fff;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.16);
}
.modtat__hero { margin-bottom: 2px; }
.modtat .tatgrid { gap: 14px 12px; }

/* people & routing, rebalanced */
.modpeople__row .avatar { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--brand) 22%, transparent); }
.modpeople__row .tiny { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modpeople__meta { align-items: start; }
.modpeople__meta .input--sm { margin-top: 3px; }

/* ============================================================
   CONNECTIVE TISSUE — every reference is a doorway.
   ============================================================ */
/* cross-references: quiet until offered, brand on approach */
.xref { color: inherit; cursor: pointer; border-bottom: 1px dashed color-mix(in srgb, var(--text-3) 40%, transparent); transition: color 0.12s, border-color 0.12s; }
.xref:hover { color: var(--brand-600); border-bottom-color: var(--brand); }
:root[data-theme="dark"] .xref:hover { color: var(--brand); }
.modtat .xref { color: inherit; }

/* KPI cards. The base card is NOT interactive — no module KPI in the app
   carries an action, and the pointer cursor plus the lift on hover promised one
   that does not exist. The affordance now belongs to `.modkpi--link`, so a card
   only invites a click when something happens. */
.modkpi { transition: box-shadow 0.14s, transform 0.14s, border-color 0.14s; user-select: none; }
.modkpi--link { cursor: pointer; }
.modkpi--link:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); border-color: var(--border-strong); }
.modkpi--active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent), var(--shadow-card); }
.modkpi--active.modkpi--red { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--danger) 55%, transparent), var(--shadow-card); }
.modkpi--active.modkpi--amber { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warning) 60%, transparent), var(--shadow-card); }

/* ghost calendar chips are editable calendar entries */
.fbechip--ghost { cursor: pointer; }
.fbechip--ghost:hover { border-color: var(--brand); color: var(--brand-600); transform: translateY(-1px); }

/* My Requests — requester tracking cards, built from the app's design tokens. */
.mreqgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mreq {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 15px 16px 14px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
/* status-tinted accent rail down the left edge */
.mreq::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--mreq-accent, var(--brand));
  opacity: .9;
}
.mreq:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.mreq__top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.mreq__id { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; color: var(--text-3); }
.mreq__title {
  font-weight: 650; font-size: 14.5px; line-height: 1.34; color: var(--text);
  letter-spacing: -.01em; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mreq__what {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: var(--r-full); margin-bottom: 14px;
}
.mreq__what svg { color: var(--text-3); flex: none; }
.mreq__prog { margin-bottom: 13px; }
.mreq__proghead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mreq__stage { font-size: 12px; font-weight: 600; color: var(--text-2); }
.mreq__pct { font-size: 11px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mreq__foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 12px; border-top: 1px solid var(--border);
}

/* My Requests drawer — the full requester-safe pipeline */
.rphead { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; }
.rpipe { display: flex; flex-direction: column; }
.rpipe__step { display: flex; gap: 12px; }
.rpipe__rail { display: flex; flex-direction: column; align-items: center; flex: none; width: 22px; }
.rpipe__dot {
  width: 20px; height: 20px; border-radius: var(--r-full); flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border-strong); background: var(--surface); color: #fff;
  transition: background .16s, border-color .16s;
}
.rpipe__line { flex: 1; width: 2px; min-height: 20px; background: var(--border); margin: 3px 0; }
.rpipe__body { padding-bottom: 16px; min-width: 0; flex: 1; padding-top: 1px; }
/* The connector is brand-coloured up to where the request has got to, so the
   track reads as progress rather than as a list of bullets. */
.rpipe__step--done .rpipe__line, .rpipe__step--current .rpipe__line--before { background: var(--brand); }
.rpipe__step--current .rpipe__name { color: var(--brand-600); }
.rpipe__here {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-600);
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.rpipe__step:last-child .rpipe__body { padding-bottom: 0; }
.rpipe__row { display: flex; align-items: center; gap: 8px; }
.rpipe__name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.rpipe__sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.35; }
.rpipe__at { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rpipe__here {
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft); border-radius: var(--r-full); padding: 2px 8px;
}
/* done: filled green with a check */
.rpipe__step--done .rpipe__dot { background: var(--success); border-color: var(--success); }
.rpipe__step--done .rpipe__line { background: var(--success); }
.rpipe__step--done .rpipe__name { color: var(--text-2); }
/* current: brand ring with a filled core */
.rpipe__step--current .rpipe__dot { border-color: var(--brand); background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.rpipe__step--current .rpipe__name { color: var(--text); font-weight: 700; }
/* upcoming: hollow, muted */
.rpipe__step--upcoming .rpipe__dot { background: var(--surface); border-color: var(--border-strong); }
.rpipe__step--upcoming .rpipe__name { color: var(--text-3); font-weight: 500; }
.rpipe__step--upcoming .rpipe__sub { color: var(--text-3); opacity: .7; }

/* Horizontal pipeline: the nine stages read left-to-right as a journey. Each
   step is a fixed-width column so the dots line up on one axis; the track
   scrolls inside itself rather than crushing the labels. */
.rpipe--h {
  /* The base .rpipe is a column; this must say row explicitly or it inherits it. */
  display: flex; flex-direction: row; align-items: flex-start; gap: 0;
  overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin;
}
.rpipe--h .rpipe__step { flex: 1 0 118px; min-width: 118px; display: block; text-align: center; }
.rpipe--h .rpipe__rail {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: 26px; margin-bottom: 9px;
}
.rpipe--h .rpipe__line {
  /* The base rule is a vertical 2px rail (width:2px; flex:1). Both have to be
     unset here or the connector renders as a tick instead of a line. */
  position: absolute; top: 50%; left: 50%; right: -50%; width: auto; height: 2px; min-height: 0; flex: none;
  transform: translateY(-50%); margin: 0;
  background: var(--border); z-index: 0;
}
.rpipe--h .rpipe__line--before { left: -50%; right: 50%; }
.rpipe--h .rpipe__dot { position: relative; z-index: 1; margin: 0; }
.rpipe--h .rpipe__step--done .rpipe__line,
.rpipe--h .rpipe__step--current .rpipe__line--before { background: var(--brand); }
.rpipe--h .rpipe__body { padding: 0 6px; }
.rpipe--h .rpipe__name { display: block; font-size: 12.5px; font-weight: 600; }
.rpipe--h .rpipe__sub { font-size: 10.5px; line-height: 1.3; margin-top: 3px; }
.rpipe--h .rpipe__at { font-size: 10.5px; margin-top: 4px; }
.rpipe--h .rpipe__here { display: inline-block; margin-top: 4px; }

/* Card view carries the same facts as the table, so switching view never costs
   you information. */
.mreq__facts {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 10px;
  margin: 10px 0 2px; font-size: 11.5px;
}
.mreq__fl { color: var(--text-3); white-space: nowrap; }
.mreq__fv { color: var(--text-2); font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* My Requests — full-screen detail sheet */
.sheet {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 3vh 3vw;
  background: color-mix(in srgb, var(--brand-600) 42%, transparent);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: sheetIn .16s ease;
}
@keyframes sheetIn { from { opacity: 0; } to { opacity: 1; } }
.sheet__panel {
  width: min(1140px, 96vw); max-height: 94vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop); overflow: hidden; animation: sheetPop .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheetPop { from { transform: translateY(10px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__bar {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.sheet__body { overflow-y: auto; padding: 22px 24px 26px; }
.sheet__hero { padding-bottom: 20px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.sheet__title { font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; color: var(--text); }
.sheet__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 34px; }
@media (max-width: 860px) { .sheet__grid { grid-template-columns: 1fr; gap: 24px; } }
.sheet__facts { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.sheet__fact { display: flex; align-items: baseline; gap: 14px; padding: 10px 13px; background: var(--surface); }
.sheet__fl { font-size: 12px; color: var(--text-3); flex: none; width: 150px; }
.sheet__fv { font-size: 13px; font-weight: 600; color: var(--text); min-width: 0; overflow-wrap: anywhere; }

/* Module 3 — provenance badges (label + icon, never colour alone) */
.srcbadge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: var(--r-full); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.srcbadge[data-kind="library"] { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.srcbadge[data-kind="generated"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-500) 40%, transparent); color: var(--accent-500); border-style: dashed; }
.srcbadge[data-kind="user-edited"] { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: var(--warning); }
.srcbadge[data-kind="user-provided"] { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand-600); }
.srcbadge[data-kind="missing"] { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }

/* Jurisdiction banner (Phase 26 Rule 6) — always prominent */
.jurbadge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
  padding: 3px 10px; border-radius: var(--r-full);
  background: var(--brand-soft-2); color: var(--brand-600);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
}

/* Draft workspace: structure | document | intelligence */
.draft3 { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .draft3 { grid-template-columns: 1fr; } }
.draft3__nav {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: none; cursor: pointer; text-align: left;
}
.draft3__nav:hover { background: var(--surface-2); }
.draft3__nav.active { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---------------- Login / credential picker ---------------- */
.login {
  min-height: 100vh; overflow-y: auto;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--brand-soft-2), transparent 60%),
    radial-gradient(700px 400px at 110% 10%, var(--accent-soft), transparent 55%),
    var(--surface-2);
}
/* Centred single-panel (portal door). */
.login--center { display: flex; justify-content: center; padding: 40px 20px; }
.login--center .login__panel { width: min(880px, 100%); }

/* Split: branded hero on the left, sign-in card on the right. */
.login--split { display: grid; grid-template-columns: 1.05fr 1fr; }
.login__hero {
  position: relative; overflow: hidden; color: #fff;
  padding: 44px 48px; display: flex; flex-direction: column;
  /* Darkened so WHITE text clears 4.5:1 against every stop, not just the
     darkest one. The lightest stop was #4bbf46 — 2.38:1 under white. */
  background:
    radial-gradient(120% 90% at 8% 0%, #1d7a35 0%, transparent 55%),
    radial-gradient(130% 120% at 100% 100%, #0b5f2d 0%, transparent 60%),
    linear-gradient(155deg, #1a7a31 0%, #146e33 55%, #0f5b2e 100%);
}
/* Faint house-mark watermark bottom-right. */
.login__hero::after {
  content: ""; position: absolute; right: -70px; bottom: -80px;
  width: 360px; height: 360px; opacity: .16; pointer-events: none;
  mix-blend-mode: soft-light;
  background: url("zameen-logo.png") center/contain no-repeat;
}
.login__hero-top { display: flex; align-items: center; gap: 13px; }
.login__hero-name { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.login__hero-sub { font-size: 12px; opacity: .82; margin-top: 1px; }
.login__hero-mid { margin-top: auto; margin-bottom: auto; padding: 32px 0; position: relative; z-index: 1; }
.login__hero-head { font-size: 30px; line-height: 1.18; font-weight: 800; letter-spacing: -0.03em; max-width: 12ch; margin: 0 0 26px; }
.login__hero-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 15px; }
.login__feat { display: flex; gap: 13px; align-items: flex-start; max-width: 400px; }
.login__feat-ic {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: #fff;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22);
}
.login__feat-t { font-size: 14px; font-weight: 700; }
.login__feat-d { font-size: 12px; opacity: .82; margin-top: 2px; line-height: 1.45; }
.login__hero-foot { display: flex; align-items: center; gap: 7px; font-size: 11.5px; opacity: .8; position: relative; z-index: 1; }

.login__main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login--split .login__panel {
  width: 100%; max-width: 430px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 34px 34px 26px;
}
.login__mobrand { display: none; margin-bottom: 18px; }
.login__welcome { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); margin-bottom: 2px; }

.login__brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.login__brand--sm { margin-bottom: 0; }
.zmark { display: block; object-fit: contain; border-radius: 22%; }
.login__brand .zmark { border-radius: 11px; box-shadow: var(--shadow-md); flex: none; }
.login__hero-badge { border-radius: 11px; flex: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.30), 0 8px 20px rgba(0,0,0,.22); }
.login__name { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.login__sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.login__lead { font-size: 13px; color: var(--text-2); margin: 10px 0 22px; max-width: 560px; line-height: 1.5; }

/* Collapse the hero on narrow screens; show a compact brand above the form. */
@media (max-width: 860px) {
  .login--split { grid-template-columns: 1fr; }
  .login__hero { display: none; }
  .login__mobrand { display: block; }
  .login--split .login__panel { max-width: 460px; }
}
.login__group { margin-bottom: 22px; }
.login__label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin-bottom: 10px;
}
.login__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.login__card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); cursor: pointer;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.login__card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.login__card.busy { border-color: var(--brand); background: var(--brand-soft); }
.login__meta { flex: 1; min-width: 0; }
.login__who { font-size: 13.5px; font-weight: 700; color: var(--text); }
.login__view { font-size: 11.5px; font-weight: 600; color: var(--brand); margin-top: 1px; }
.login__role { font-size: 11px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.login__go { color: var(--text-3); flex: none; }
.login__card:hover .login__go { color: var(--brand); }
.login__foot {
  display: flex; align-items: center; gap: 7px; margin-top: 8px;
  font-size: 11.5px; color: var(--text-3);
}

/* ---- credential sign-in form ---- */
.login__tabs { display: flex; gap: 6px; margin: 18px 0 0; border-bottom: 1px solid var(--border); }
.login__tab {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 8px 12px 9px; margin-bottom: -1px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-3);
  border-bottom: 2px solid transparent;
}
.login__tab:hover { color: var(--text); }
.login__tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.login__tabnote {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px;
}
.login__form { max-width: 400px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.login__field { display: block; }
.login__flabel {
  display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 5px;
}
.login__input {
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px;
  font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.login__input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.login__pwwrap { position: relative; }
.login__pwwrap .login__input { padding-right: 56px; }
.login__pwtoggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 700; color: var(--text-3); padding: 4px 6px;
}
.login__pwtoggle:hover { color: var(--brand); }
.login__submit { height: 38px; font-size: 13.5px; justify-content: center; }
.login__err, .login__notice {
  display: flex; align-items: center; gap: 7px; max-width: 400px;
  font-size: 12.5px; border-radius: 8px; padding: 9px 12px; margin-bottom: 14px;
}
.login__err { color: var(--red-fg, #b42318); background: var(--red-soft, #fef3f2); border: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.login__notice { color: var(--amber-fg, #b54708); background: var(--amber-soft, #fffaeb); border: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
/* Legal door → requester portal. A business requester lands on the legal
   sign-in more often than not; this is their way across. */
.login__alt { display: flex; align-items: center; gap: 11px; max-width: 400px; margin: 4px 0 16px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: inherit; text-decoration: none;
  transition: border-color .15s, background .15s, transform .15s; }
.login__alt:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.login__alt-ic { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand); }
.login__alt-tx { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.login__alt-tx b { font-size: 12.5px; font-weight: 650; }
.login__alt-tx span { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.login__policy { font-size: 11.5px; color: var(--text-3); max-width: 400px; line-height: 1.5; margin-bottom: 16px; }

/* ---------- small screens: in-page grids collapse ----------
   Several pages set `grid-template-columns` INLINE to build a body+rail split
   (Users & Access is 1fr 420px, Data Health is 1fr 1fr). An inline style beats
   the .grid--2/3/4 class rules above, so those layouts could not collapse and
   ran off the side of a phone. Below the tablet breakpoint every in-page grid
   becomes a single column; tables keep their own horizontal scroller. */
@media (max-width: 820px) {
  .page .grid { grid-template-columns: 1fr !important; }
  .page .grid[style*="sticky"] > * { position: static !important; }
}

/* ---------- phone: keep the topbar's right-hand controls reachable ----------
   At 390px the crumbs + search + New + Tour + theme + notifications + avatar
   do not fit on one row, and the overflow pushed the USER MENU 78px off the
   right edge of the screen — unreachable, with no horizontal page scroll to
   get to it. Drop the wide optional controls on a phone and let the crumbs
   shrink; identity, notifications and navigation stay. */
@media (max-width: 640px) {
  .topbar .searchbtn span,
  .topbar .newbtn span { display: none; }
  .topbar .searchbtn,
  .topbar .newbtn { padding-left: 9px; padding-right: 9px; }
  .topbar .tourbtn { display: none; }
  .topbar__crumbs { flex: 0 1 auto; min-width: 0; }
}
@media (max-width: 420px) {
  /* Last resort on the narrowest phones: the theme toggle is a preference, the
     user menu is not. */
  .topbar .searchbtn { display: none; }
}

/* A toggle on a surface with no engine behind it: visibly inert. */
.toggle--disabled { opacity: .45; cursor: not-allowed; }

/* ---------- keyboard focus, application-wide ----------
   Every interactive surface needs a visible focus indicator, or the app is
   unusable without a mouse. :focus-visible means pointer users never see a ring
   they did not ask for, while keyboard users always do. One rule, one colour,
   so focus looks the same everywhere. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible,
[role="tab"]:focus-visible,
.tab:focus-visible,
.chip:focus-visible,
.clickable:focus-visible,
.rowlink:focus-visible,
.statkpi:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}
/* A focused table row outlines inside its own bounds — an offset ring on a <tr>
   is clipped by the table and reads as a broken border. */
tr.rowlink:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Respect the OS setting rather than animating regardless. */
@media (prefers-reduced-motion: reduce) {
  .fade-in, .card--hover { animation: none !important; transition: none !important; }
}

/* ============================================================================
   REGISTER DESIGN SYSTEM
   One visual language for every operational table in LegalOS: register tabs,
   the filter toolbar, filter dropdowns, active chips and the result count.
   Cases, Legal Notices, Licences, Loans, Resolutions and Properties all render
   through these classes, which is what stops each module inventing its own.
   ========================================================================== */

/* Visually hidden, still read by assistive tech. Used for the labels on
   search inputs whose visible affordance is a magnifier icon. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- register tabs -------------------------------------------------------- */
.regtabs {
  display: flex; gap: 4px; align-items: stretch; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin: 4px 0 16px;
}
.regtab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  cursor: pointer; border-radius: var(--r-sm) var(--r-sm) 0 0; white-space: nowrap;
}
.regtab:hover { color: var(--text); background: var(--surface-2); }
.regtab__n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 19px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.regtab--on { color: var(--brand-600); border-bottom-color: var(--brand); background: none; }
.regtab--on .regtab__n { background: var(--brand); color: #fff; }

/* ---- toolbar -------------------------------------------------------------- */
.regbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px;
}
.regbar__search {
  display: flex; align-items: center; gap: 8px; height: var(--field-h); padding: 0 10px;
  min-width: 260px; flex: 0 1 300px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
  color: var(--text-3);
}
.regbar__search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.regbar__input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  font-family: inherit; font-size: 13px; color: var(--text);
}
.regbar__input::-webkit-search-cancel-button { cursor: pointer; }
.regcount {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 4px;
}

/* ---- filter buttons + panels --------------------------------------------- */
.fltwrap { position: relative; display: inline-flex; }
.fltbtn {
  /* --field-h, like every other control on the same row. These were 34px and
     everything beside them 36px, so a register toolbar was two pixels out of
     alignment along its whole length. */
  display: inline-flex; align-items: center; gap: 6px; height: var(--field-h); padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
  font-family: inherit; font-size: 12.5px; font-weight: 550; color: var(--text-2);
  cursor: pointer; white-space: nowrap;
}
.fltbtn:hover { border-color: var(--border-strong); color: var(--text); }
.fltbtn--on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand-600); }
.fltbtn__n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-full);
  background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
}
.fltpanel {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: var(--z-overlay);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); overflow: hidden;
}
.fltpanel__search { padding: 8px; border-bottom: 1px solid var(--border); }
.fltpanel__list { max-height: 304px; overflow-y: auto; padding: 4px; }
.fltpanel__foot { border-top: 1px solid var(--border); padding: 6px; }
.fltopt {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px;
  border-radius: var(--r-sm); font-size: 12.5px; color: var(--text); cursor: pointer;
}
.fltopt:hover { background: var(--surface-2); }
.fltopt input { accent-color: var(--brand); width: 14px; height: 14px; flex: none; cursor: pointer; }
.fltopt--locked { opacity: .65; cursor: default; }
.fltopt__l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fltopt__c {
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none;
  display: inline-flex; align-items: center;
}
.fltopts { display: flex; flex-direction: column; gap: 1px; }
.fltview {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: none;
  border-radius: var(--r-sm); font-family: inherit; font-size: 12.5px; color: var(--text); cursor: pointer;
}
.fltview:hover { background: var(--surface-2); }
.fltview--on { background: var(--brand-soft); color: var(--brand-600); font-weight: 600; }
.fldlabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 700; margin-bottom: 6px;
}

/* ---- active filter chips -------------------------------------------------- */
.fltchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.fltchip {
  display: inline-flex; align-items: center; gap: 5px; height: 25px; padding: 0 4px 0 9px;
  border-radius: var(--r-full); background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  font-size: 11.5px; color: var(--brand-600); max-width: 300px;
}
.fltchip__k { font-weight: 700; opacity: .72; }
.fltchip__v { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fltchip__x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border: 0; border-radius: var(--r-full);
  background: none; color: inherit; font-size: 10px; cursor: pointer; opacity: .7; flex: none;
}
.fltchip__x:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); opacity: 1; }
.fltchips__clear {
  border: 0; background: none; font-family: inherit; font-size: 11.5px; font-weight: 650;
  color: var(--text-2); text-decoration: underline; cursor: pointer; padding: 3px 5px;
}
.fltchips__clear:hover { color: var(--brand-600); }

/* ---- compact summary strip above a register ------------------------------- */
.regsum { display: flex; flex-wrap: wrap; gap: 20px; padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.regsum__i { display: flex; flex-direction: column; gap: 1px; }
.regsum__v { font-size: 16px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.regsum__l { font-size: 11px; color: var(--text-3); font-weight: 600; }
button.regsum__i { border: 0; background: none; font-family: inherit; text-align: left; cursor: pointer; padding: 0; border-radius: var(--r-xs); }
button.regsum__i:hover .regsum__v { color: var(--brand-600); }

/* ---- tablet / mobile ------------------------------------------------------ */
@media (max-width: 900px) {
  .regbar__search { flex: 1 1 100%; min-width: 0; }
  .regcount { width: 100%; padding-left: 0; }
}
@media (max-width: 640px) {
  .regtabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .regtab { padding: 9px 11px; font-size: 13px; }
  /* Touch targets stay at 34px; the panel becomes a sheet so a filter list is
     never a 260px popover squeezed against the screen edge. */
  .fltpanel { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto !important; max-height: 62vh; }
  .fltpanel__list { max-height: 44vh; }
}

/* Drill-down cell: a badge inside a row that narrows the register instead of
   opening the row. A real <button> so it is tab-reachable and announces its
   pressed state; stopPropagation keeps it from also triggering the row link. */
.drillcell {
  display: inline-flex; align-items: center; border: 0; background: none;
  padding: 1px 2px; margin: -1px -2px; border-radius: var(--r-sm);
  font: inherit; color: inherit; cursor: pointer; text-align: left; max-width: 100%;
}
.drillcell:hover { background: var(--surface-3); }
.drillcell--on { box-shadow: inset 0 0 0 1.5px var(--brand); }

/* Inline text button that reads as a link but is a real <button>. */
.linkbtn { background: none; border: 0; padding: 2px 0; font-family: inherit;
  color: var(--brand); font-weight: 600; text-align: left; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* Overview cards that open a register. Real buttons, so they are tab-reachable
   and announce themselves — they were clickable <div>s with no keyboard path. */
.ovcard { display: block; width: 100%; text-align: left; font-family: inherit; cursor: pointer; }
.alertrow { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
  font-family: inherit; font-size: 13px; color: var(--danger); cursor: pointer; text-align: left; }
.alertrow:hover { border-color: var(--danger); background: var(--danger-bg); }
.alertrow--warn { color: var(--warning-text); }
.alertrow--warn:hover { border-color: var(--warning); background: var(--warning-bg); }

/* ---------------------------------------------------------------------------
   Button resets for controls that used to be clickable <div>s.
   The markup changed so a keyboard can reach them; the appearance must not.
   ------------------------------------------------------------------------- */
/* NOTE: no `color: inherit` here. These resets are appended after the component
   rules, so inheriting colour silently overrode explicit ones — it took the
   white off `.nav__item.active`, leaving the current page's nav label at 4.25:1
   instead of 6.6:1. Each component keeps its own colour. */
.nav__item, .tab, .menu__item, .th__sortbtn, .ovcard, .regsum__i, .alertrow, .linkbtn {
  font: inherit; -webkit-appearance: none; appearance: none;
}
button.nav__item, button.tab, button.menu__item {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
}
button.tab { width: auto; }
.tabs--pills button.tab { width: auto; }
.th__sortbtn {
  display: inline-flex; align-items: center; gap: 4px; width: 100%;
  border: 0; background: none; padding: 0; cursor: pointer;
  font-weight: inherit; font-size: inherit; letter-spacing: inherit;
  text-transform: inherit; color: inherit; text-align: inherit;
}
th[style*="text-align:right"] .th__sortbtn, th[style*="text-align: right"] .th__sortbtn { justify-content: flex-end; }
th[style*="text-align:center"] .th__sortbtn, th[style*="text-align: center"] .th__sortbtn { justify-content: center; }
.th--sort { cursor: default; }        /* the button inside owns the pointer */
.th--sort .th__sortbtn { cursor: pointer; }
/* The Dropdown trigger is a button wrapping whatever the caller passed, so it
   must add no box of its own. */
.ddtrigger { display: block; width: 100%; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: inherit; cursor: pointer; }
.crumbbtn { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
/* Cards and feed rows that ARE a single action are buttons now; strip the UA
   button box so they still look like the card/row they replaced. */
button.cardbtn, button.feed__item {
  width: 100%; text-align: left; font: inherit; color: inherit;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
button.cardbtn { display: block; }
button.feed__item { border-left: 0; border-right: 0; }
/* A card that is clickable for convenience but holds its own controls keeps a
   real button on its title, so a keyboard user has the same primary action
   without nesting one interactive element inside another. */
.cardtitlebtn { display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.cardtitlebtn:hover { color: var(--brand-600); }
/* Chart legend rows and bars are the keyboard-accessible equivalent of the
   graphic beside them, so they must not look like form buttons. */
.chartlegend, .chartbar {
  width: 100%; border: 0; background: none; font: inherit; color: inherit;
  text-align: left; cursor: pointer;
}
.chartlegend { display: flex; align-items: center; }
.chartbar { display: block; }
/* .iconbtn / .btn used as Dropdown trigger CONTENT (the Dropdown supplies the
   real button), so they render as the same box without being controls. */
span.iconbtn, span.btn { display: inline-flex; align-items: center; justify-content: center; }
button.statkpi { font: inherit; color: inherit; text-align: left; border-width: 1px; cursor: pointer; }
button.rowbtn { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }

/* ---- saved views ---------------------------------------------------------- */
.fltpanel__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 700; padding: 6px 10px 3px; }
.svrow { display: flex; align-items: center; gap: 2px; border-radius: var(--r-sm); }
.svrow:hover { background: var(--surface-2); }
.svrow__apply { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 7px 9px; font: inherit; font-size: 12.5px;
  color: var(--text); text-align: left; cursor: pointer; }
.svrow__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svrow__menu { position: relative; flex: none; }
.iconbtn--sm { width: 26px; height: 26px; }
.svmenu { position: absolute; right: 0; top: calc(100% + 2px); z-index: calc(var(--z-overlay) + 1); min-width: 210px; }
.svmenu .menu__item { width: 100%; text-align: left; border: 0; background: none; font: inherit; cursor: pointer; }
.svmenu .menu__item:disabled { opacity: .45; cursor: default; }
/* <main> replaced a <div> for the routed content; it must lay out identically
   and must not paint a focus ring when it is focused programmatically. */
main.content { display: block; }
main.content:focus { outline: none; }

/* ---- compliance overview ------------------------------------------------- */
/* The overview is a SUMMARY: one card per module, then a list of what actually
   needs doing. The per-module KPI breakdowns live in each module's own tab, so
   repeating them here would just rebuild the long scroll the register tabs were
   introduced to replace. Tokens only — no literal colours. */
.ovmods { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.ovmod { display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font-family: inherit; text-align: left; cursor: pointer;
  transition: border-color .12s ease, background .12s ease; }
.ovmod:hover { border-color: var(--brand); background: var(--surface-2); }
.ovmod:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ovmod__h { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.ovmod__t { font-size: 12px; font-weight: 700; }
.ovmod__v { font-size: 27px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.ovmod__n { font-size: 11px; color: var(--text-3); font-weight: 600; }
.ovmod__a { margin-top: 6px; }

@media (max-width: 640px) {
  .ovmods { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .ovmod__v { font-size: 23px; }
}

/* ---- compliance overview: compact module cards --------------------------- */
/* A card is a summary and a doorway, so it is a FIXED height: the grid must not
   stretch it, and content must not grow it. Anything that would make a card
   taller belongs in the sections below the grid, not inside the card. */
.cmods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
  align-items: start; }
/* Fixed rows, so a card with an alert chip and a card without are the same
   height without anything having to reserve space by guessing. The "Open"
   affordance is the chevron in the header, not a fifth row: the whole card is
   the button, and a row that only said "Open" cost 20px on every card. */
.cmod { display: grid; grid-template-rows: 18px auto 16px 22px;
  height: 140px; padding: 16px; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
  font-family: inherit; text-align: left; cursor: pointer; overflow: hidden;
  transition: border-color .12s ease, background .12s ease; }
.cmod:hover { border-color: var(--brand); background: var(--surface-2); }
.cmod:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cmod__h { display: flex; align-items: center; gap: 7px; color: var(--text-2); min-width: 0; }
.cmod__t { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmod__h .spacer { flex: 1; }
.cmod__v { display: flex; align-items: baseline; gap: 7px; min-width: 0;
  font-size: 28px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.05; }
/* The unit matters most on the one card whose honest headline is 0: "0" alone
   reads as an empty module, "0 recorded filings" reads as a fact. */
.cmod__u { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmod__s { font-size: 12px; color: var(--text-3); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmod__a { display: flex; align-items: center; min-width: 0; }
.cmod__chip { display: inline-flex; align-items: center; max-width: 100%; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 700; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--warning-bg); color: var(--warning-text); }
.cmod__chip--red { background: var(--danger-bg); color: var(--danger-text); }
.cmod__chip--calm { background: var(--surface-2); color: var(--text-3); cursor: default; }
.cmod__chip:hover { filter: brightness(0.96); }
.cmod__chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 1100px) { .cmods { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .cmods { grid-template-columns: 1fr; }
  .cmod { height: 126px; gap: 6px; }
  .cmod__v { font-size: 25px; }
}

/* ---- compliance overview: bands ------------------------------------------
   The Overview is four bands, not six stacked dashboards. A band is a heading
   and one surface; it is never a <Section> card wrapping more cards, which is
   what made the old page read as nested boxes and run to four screens.
   -------------------------------------------------------------------------- */
.page--cov { padding: 28px 30px 40px; display: flex; flex-direction: column; gap: 22px; }
/* PageHead and the card grid bring their own bottom margin; the flex gap owns
   the rhythm here, so they must not add to it. */
.page--cov > .pagehead, .page--cov > .cmods { margin-bottom: 0; }
/* The page's own responsive gutters, which .page--cov would otherwise override
   at every width and leave a phone with 30px of margin either side. */
@media (max-width: 900px) { .page--cov { padding: 20px 18px 36px; gap: 20px; } }
@media (max-width: 640px) { .page--cov { padding: 16px 14px 32px; gap: 18px; } }
.cov__sec { min-width: 0; }
.cov__hd { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; min-width: 0; }
.cov__hdsub { font-size: 11.5px; color: var(--text-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.cov__hd .spacer { flex: 1; }

/* Needs attention gets the room, because it is the one band that is a to-do
   list. Upcoming deadlines is a glance, so it takes the narrower column. */
.cov__split { display: grid; grid-template-columns: 65fr 35fr; gap: 16px; align-items: start; }
.cov__split--even { grid-template-columns: 60fr 40fr; }
@media (max-width: 1000px) { .cov__split, .cov__split--even { grid-template-columns: 1fr; gap: 20px; } }

.cov__panel { border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden; }
.cov__panel--calm { padding: 14px 16px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
/* Rows are separated by a hairline, not by their own borders and gaps: one
   surface with dividers instead of a stack of little cards. */
.cov__row { display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 14px; border: 0; border-top: 1px solid var(--border);
  background: none; font-family: inherit; font-size: 12.5px; color: var(--text);
  text-align: left; cursor: pointer; }
.cov__row:first-child { border-top: 0; }
.cov__row:hover { background: var(--surface-2); }
.cov__row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.cov__row[disabled] { cursor: default; }
.cov__row[disabled]:hover { background: none; }
.cov__dot { width: 7px; height: 7px; border-radius: 99px; flex: none; background: var(--text-3); }
.cov__dot--red { background: var(--danger); }
.cov__dot--amber { background: var(--warning); }
.cov__n { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 26px; }
.cov__row--red .cov__n { color: var(--danger-text); }
.cov__row--amber .cov__n { color: var(--warning-text); }
.cov__lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov__act { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov__subj { color: var(--text-2); }
.cov__when { flex: none; }

/* ---- compliance overview: health micro-cards -----------------------------
   A health card answers "how much of this book needs me today". It deliberately
   does NOT carry the book's total: the module card two bands up owns that, and
   printing every total twice was most of the old page's length.
   -------------------------------------------------------------------------- */
.chealth { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
/* THE CARD IS SIZED BY WHAT IS IN IT.
   The rows were fixed (16px / auto / 4px / 22px) and the height pinned at
   116px, which was right for one big percentage and a progress bar. It now
   holds a row of named states, and the fixed grid clipped them straight
   through the issue chips underneath — two lines of text overlapping. Three
   content rows, auto-sized, with a minimum rather than a fixed height. */
.hcard { display: grid; grid-template-rows: auto auto auto; gap: 8px; align-content: start;
  min-height: 116px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.hcard--red { border-color: color-mix(in srgb, var(--danger) 34%, var(--border)); }
.hcard--amber { border-color: color-mix(in srgb, var(--warning) 38%, var(--border)); }
.hcard__h { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  padding: 0; border: 0; background: none; font-family: inherit;
  color: var(--text-2); cursor: pointer; text-align: left; }
.hcard__h:hover { color: var(--brand); }
.hcard__h:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-xs); }
.hcard__t { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcard__h .spacer { flex: 1; }
.hcard__v { display: flex; align-items: baseline; gap: 4px; font-size: 24px; font-weight: 700;
  color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.hcard__v--none { font-size: 15px; color: var(--text-2); }
.hcard__pc { font-size: 14px; font-weight: 700; color: var(--text-2); }
.hcard__cap { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-left: 3px; }
.hcard__bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hcard__fill { display: block; height: 100%; border-radius: 99px; background: var(--success); }
.hcard--amber .hcard__fill { background: var(--warning); }
.hcard--red .hcard__fill { background: var(--danger); }
.hcard__i { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.hcard__calm { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.hcard__chip { flex: 0 1 auto; min-width: 0; padding: 2px 8px; border: 0; border-radius: 999px;
  font-family: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--surface-2); color: var(--text-2); }
.hcard__chip--red { background: var(--danger-bg); color: var(--danger-text); }
.hcard__chip--amber { background: var(--warning-bg); color: var(--warning-text); }
.hcard__chip:hover { filter: brightness(0.96); }
.hcard__chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 1100px) { .chealth { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .chealth { grid-template-columns: 1fr; } .hcard { height: 108px; padding: 14px 16px; } }

/* ---- compliance overview: compact insight -------------------------------- */
/* The insight sits beside the activity trail and must not outweigh it. */
.ai-card--compact { height: auto; min-height: 112px; max-height: 140px; overflow: hidden; }
.ai-card--compact .ai-card__inner { padding: 13px 15px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cov__inst { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.cov__insb { font-size: 12px; color: var(--text-3); line-height: 1.45; overflow: hidden;
  flex: none;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
/* Stacked below 1000px, so the card sizes to its text rather than to a fixed
   desktop height -- but still capped, because a phone must not give four
   paragraphs of insight more room than the activity trail above it. */
@media (max-width: 1000px) { .ai-card--compact { min-height: 104px; max-height: 158px; } }

/* ---- group hub tile figures ---------------------------------------------- */
/* A tile states the size of its register and what needs attention. The figure
   comes from the same API the register uses, so a hub number and a register
   count cannot disagree. */
.ghub__n { font-size: 26px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 8px; }
.ghub__sub { font-size: 11px; font-weight: 600; color: var(--text-3); margin-top: 2px; }
.ghub__ok { font-size: 11px; color: var(--text-3); margin-top: 8px; }

/* ---- compliance: one document, full page --------------------------------
   The same renderers the contract viewer uses, given a page instead of a
   lightbox, so a document is an address you can send someone.
   ------------------------------------------------------------------------- */
.docpage { border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden; }
.docpage__frame { width: 100%; height: calc(100vh - 340px); min-height: 420px;
  border: 0; display: block; background: var(--surface-2); }
.docpage__img { overflow: auto; display: flex; align-items: flex-start;
  justify-content: center; padding: 20px; }
.docpage__img img { max-width: 100%; height: auto; border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.docpage__none { display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; text-align: center; padding: 24px;
  color: var(--text-3); font-size: 13px; }
/* The docx/xlsx renderers are shared with the contract lightbox and size
   themselves with .doclb__frame, so inside a page they take the page height. */
.docpage .doclb__frame { height: calc(100vh - 340px); min-height: 420px; }
@media (max-width: 900px) {
  .docpage__frame, .docpage .doclb__frame { height: calc(100vh - 300px); min-height: 340px; }
}

/* ---------- Picker (searchable option menu) ----------
   The menu is position:fixed so `.modal{overflow:hidden}` and
   `.modal__body{overflow-y:auto}` cannot clip it. z-index sits above
   --z-modal because the picker is always opened from inside one. */
.picker { position: relative; }
.picker__control { position: relative; display: flex; align-items: center; }
.picker__control .input { width: 100%; padding-right: 52px; }
.picker__caret, .picker__clear {
  position: absolute; border: 0; background: transparent; cursor: pointer;
  color: var(--text-dim); font-size: 14px; line-height: 1; padding: 4px 6px; border-radius: var(--r-sm);
}
.picker__caret { right: 6px; font-size: 11px; }
.picker__clear { right: 26px; font-size: 16px; }
.picker__caret:hover, .picker__clear:hover { background: var(--surface-2); color: var(--text); }
.picker__caret:disabled { opacity: .4; cursor: default; }
.picker__foot { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.picker__foot--err { color: var(--danger); }
.picker__retry {
  border: 1px solid var(--danger); background: transparent; color: var(--danger);
  font-size: 11px; border-radius: var(--r-sm); padding: 0 6px; margin-left: 6px; cursor: pointer;
}
.picker__menu {
  position: fixed; z-index: calc(var(--z-modal) + 5);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  overflow-y: auto; overscroll-behavior: contain; padding: 4px;
}
.picker__opt {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
}
.picker__opt.is-active { background: var(--brand-soft); }
.picker__opt.is-chosen { font-weight: 600; }
.picker__opt--new { color: var(--brand); font-style: italic; }
.picker__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__meta { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.picker__n {
  font-size: 10px; color: var(--text-dim); background: var(--surface-2);
  border-radius: 999px; padding: 1px 6px; white-space: nowrap;
}
.picker__none { padding: 10px; font-size: 12px; color: var(--text-dim); }
/* On a phone the menu is full-bleed rather than pinned to a narrow field. */
@media (max-width: 480px) {
  .picker__menu { left: 8px !important; width: calc(100vw - 16px) !important; }
  .picker__opt { padding: 10px 10px; font-size: 14px; }
}

/* ------------------------------------------------- CONTRACT REQUEST FORMS */
/* The wizard, the repeatable grid and the document rows. Compact fields in a
   responsive two-column grid, collapsing to one on a phone; a stepper that
   wraps rather than scrolls; and a sticky action bar so Previous / Next /
   Submit are reachable without scrolling back up a long section. */
.crfsteps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.crfstep {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border-radius: 999px; cursor: pointer; background: var(--surface);
  border: 1px solid var(--border); font-size: 12.5px; font-weight: 500;
  color: var(--text-2); line-height: 1.2;
}
.crfstep:hover { background: var(--surface-2); color: var(--text); }
.crfstep:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.crfstep--on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.crfstep--bad { border-color: var(--danger); }
.crfstep__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2);
}
.crfstep--on .crfstep__n { background: var(--brand); color: #fff; }
.crfstep__b {
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--danger); color: #fff;
}

.crf__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.crf__f { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.crf__f--bad .input, .crf__f--bad .dateinput .input { border-color: var(--danger); }
.crf__req { color: var(--danger); font-weight: 700; }
.crf__err { font-size: 11.5px; color: var(--danger-text); }
.crf__dev {
  font-size: 11px; color: var(--warning-text); display: flex; align-items: center; gap: 4px;
}
.crf__sub { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.crf__save { font-size: 11.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.crf__save--ok { color: var(--success); }
.crf__save--bad { color: var(--danger-text); }

.crfgrid { display: flex; flex-direction: column; gap: 10px; }
.crfgrid__row {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; background: var(--surface);
}
.crfgrid__n {
  flex: none; width: 22px; height: 22px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-2); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.crfgrid__cells { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; }
.crfgrid--compact .crfgrid__cells { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.crfgrid__del {
  flex: none; width: 26px; height: 26px; border-radius: 6px; border: 0; cursor: pointer;
  background: none; color: var(--text-3);
}
.crfgrid__del:hover { background: var(--danger-bg); color: var(--danger-text); }
.crfgrid__del:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.crfbar {
  position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; margin-top: 16px; background: var(--surface);
  border-top: 1px solid var(--border); border-radius: var(--r-sm) var(--r-sm) 0 0;
  box-shadow: 0 -4px 14px rgba(0,0,0,.05); z-index: 5;
}
.crfjump {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer; padding: 5px 2px;
  font-size: 12px; color: var(--danger-text);
}
.crfjump:hover { text-decoration: underline; }
.crfjump:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.crfdev { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); }
.crfdoc { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--border); }
.crfdoc__row { display: flex; gap: 8px; align-items: center; padding: 3px 0; flex-wrap: wrap; }
.crfview { width: 100%; height: 68vh; border: 0; display: block; background: var(--surface-2); }
.crfpick {
  display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer;
}
.crfpick:hover { background: var(--surface-2); }
.crfpick--on { border-color: var(--brand); background: var(--brand-soft); }
.crfpick:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.crfrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); }
.crfrow__n {
  flex: none; width: 18px; height: 18px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-2); font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.crfrow__c { font-size: 12px; }

@media (max-width: 880px) {
  .crf__grid, .crfgrid__cells { grid-template-columns: 1fr; }
  .crfgrid__row { flex-wrap: wrap; }
  .crfbar { flex-wrap: wrap; }
}
.crfmine {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; min-width: 116px;
}
.crfmine:hover { background: var(--surface-2); }
.crfmine:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.crfmine--act { border-color: var(--danger); background: var(--danger-bg); }
.crfmine__v { font-size: 19px; font-weight: 700; line-height: 1.1; }
.crfmine__l { font-size: 12px; font-weight: 600; color: var(--text-2); }

/* ------------------------------------ CONTRACT REQUESTS — the workspace -- */
/* The register was a database export: eight equal cards mostly reading zero,
   every filter on screen at once, and fourteen columns that needed a sideways
   scrollbar before saying anything. These rules are the other half of that
   rewrite -- compact summary cards whose number and label do not collide, one
   filter row, and a seven-column table that fits a laptop. */

/* THE SAME KPI CARD AS EVERY OTHER MODULE (§81).
   These were a bespoke tile — tighter padding, a smaller radius, no accent —
   sitting where every other register in the product shows a .statkpi. Side by
   side, Contract Requests looked a release behind the rest of the app. Same
   geometry, same accent, same figure and label sizes; what stays bespoke is
   the behaviour, because these cards are toggles and carry a pressed state
   that the plain KPI does not. */
.crfsum {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 0 0 18px;
}
.crfcard {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  min-width: 0; padding: 13px 16px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 3px; border-left-color: var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-xs);
  transition: background .12s, border-color .12s, box-shadow .14s, transform .14s;
}
.crfcard:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.crfcard:hover { background: var(--surface-2); }
.crfcard:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.crfcard--on { border-color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); }
.crfcard--act { border-left-color: var(--danger); }
.crfcard--zero { opacity: .62; }
.crfcard--zero:hover { opacity: 1; }
/* The old cards rendered "1Drafts" because the number and the label were inline
   siblings with no box of their own. */
.crfcard__v { display: block; font-size: 21px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.crfcard__l { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.3; margin-top: 2px; }
.crfcard--on .crfcard__v, .crfcard--on .crfcard__l { color: var(--brand-600); }

.crftabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.crftab {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.crftab:hover { color: var(--text); }
.crftab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.crftab--on { color: var(--brand-600); font-weight: 600; border-bottom-color: var(--brand); }
.crftab__n {
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
}
.crftab--on .crftab__n { background: var(--brand); color: #fff; }

.crfbar2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.crfsearch { position: relative; display: flex; align-items: center; gap: 7px;
  flex: 1 1 300px; min-width: 240px; padding-left: 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-3); }
.crfsearch .input { border: 0; background: none; padding-left: 0; flex: 1; min-width: 0; }
.crfsearch .input:focus { box-shadow: none; }
.crfsearch:focus-within { border-color: var(--brand); }
.crfsel { width: auto; min-width: 118px; max-width: 190px; }
.crfmf { display: flex; flex-direction: column; gap: 4px; }

/* SEVEN COLUMNS, and no default sideways scroll on a laptop. Widths are set so
   the identity column keeps its reference on one line. */
.crftable { width: 100%; overflow-x: auto; }
.crfreg { table-layout: fixed; width: 100%; min-width: 0; }
.crfreg th, .crfreg td { vertical-align: top; padding: 10px 12px; }
.crfreg th:nth-child(1), .crfreg td:nth-child(1) { width: 196px; }
.crfreg th:nth-child(2), .crfreg td:nth-child(2) { width: auto; }
.crfreg th:nth-child(3), .crfreg td:nth-child(3) { width: 120px; }
.crfreg th:nth-child(4), .crfreg td:nth-child(4) { width: 172px; }
.crfreg th:nth-child(5), .crfreg td:nth-child(5) { width: 148px; }
.crfreg th:nth-child(6), .crfreg td:nth-child(6) { width: 132px; }
.crfreg th:nth-child(7), .crfreg td:nth-child(7) { width: 86px; text-align: right; }
.crfreg tbody tr { min-height: 56px; }
.crfreg__sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.crfreg tbody tr:hover .crfreg__sticky { background: var(--surface-2); }
.crfreg thead .crfreg__sticky { background: var(--surface-2); }
/* The reference never wraps over three lines again. */
.crfref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crfopen { font-size: 12px; font-weight: 600; color: var(--brand-600); white-space: nowrap; }

.crfcards { display: none; }
.crfcardrow {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.crfcardrow:hover { background: var(--surface-2); }
.crfcardrow:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.crfcardrow .crfopen { display: inline-block; margin-top: 8px; }

@media (max-width: 860px) {
  .crftable { display: none; }
  .crfcards { display: block; }
  .crfsel { max-width: none; flex: 1 1 140px; }
}

/* The request stepper and the message thread. */
.crfstepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.crfstep2 {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 12px; color: var(--text-2);
}
.crfstep2__dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-3); flex: none;
}
.crfstep2__l { font-weight: 600; }
.crfstep2__n { color: var(--text-3); font-size: 11px; }
.crfstep2--done { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.crfstep2--done .crfstep2__dot { background: var(--success); color: #fff; }
.crfstep2--on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-600); }
.crfstep2--on .crfstep2__dot { background: var(--brand); color: #fff; }
.crfstep2--skip { opacity: .7; }
.crfstep2--back { border-color: var(--danger); background: var(--danger-bg); color: var(--danger-text); }
.crfstep2--back .crfstep2__dot { background: var(--danger); color: #fff; }
.crfmsg { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.crfmsg--legal { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }

/* ============================================================
   THE LEGAL CALENDAR
   One grid, used by the global calendar and the litigation cause list, so a
   hearing looks the same wherever you meet it.
   ============================================================ */
.calsplit { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
/* THE DAY YOU PICKED STAYS ON SCREEN. The grid is a full month tall; without
   this, clicking a day near the bottom of it scrolled its list out of view and
   you had to scroll back up to read what you had just asked for. */
.calsplit > :last-child { position: sticky; top: 8px; max-height: calc(100vh - 128px); overflow-y: auto; }
@media (max-width: 1100px) { .calsplit > :last-child { position: static; max-height: none; overflow: visible; } }
@media (max-width: 1100px) { .calsplit { grid-template-columns: 1fr; } }

.calnav { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.calnav__b {
  height: var(--field-h); min-width: 34px; padding: 0 10px; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .12s;
}
.calnav__b + .calnav__b { border-left: 1px solid var(--border); }
.calnav__b--wide { padding: 0 14px; }
.calnav__b:hover { background: var(--surface-3); color: var(--text); }
.calnav__b--on { background: var(--brand-soft); color: var(--brand); }

/* Jump to a month or a day. The selects are native, so they open on click and
   are keyboard- and screen-reader-operable for free; the "Go to" box is the
   same dd/mm/yyyy control the forms use, with its calendar button. Sized down
   to sit on the toolbar line beside the period label. */
.caljump { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.caljump__sel { width: auto; min-width: 116px; height: 32px; padding: 0 28px 0 10px; font-size: 12.5px; font-weight: 600; }
.caljump__sel--y { min-width: 82px; }
.caljump__go { display: inline-flex; width: 150px; }
.caljump__go .input { height: 32px; font-size: 12.5px; }

.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-r); overflow: hidden; }
.cal__dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal__dowc { padding: 8px 10px; font-size: 11.5px; font-weight: 650; color: var(--text-2); letter-spacing: .02em; }
/* A DAY IS ONE SEVENTH OF THE WEEK, WHATEVER IS IN IT.
   `repeat(7, 1fr)` has a min-content floor, so one case called "Muhammad Waseem
   etc Vs. P.O Sindh through Deputy Commissioner (Suit for specific
   performance)" — a nowrap pill — pushed its column to the width of the title
   and the entry ran across Tuesday, Wednesday and Thursday. The names read as
   if they belonged to days they have nothing to do with. minmax(0, 1fr) lets
   the column be narrower than its content, which is what makes the ellipsis on
   .cal__evt actually take effect; the full title is on the pill's tooltip and
   in the day's list beside the grid. */
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__day {
  min-width: 0; min-height: 104px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface); padding: 6px 7px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  font: inherit; transition: background .12s;
}
.cal__grid--week .cal__day { min-height: 260px; }
.cal__day:nth-child(7n) { border-right: none; }
.cal__day:hover { background: var(--surface-2); }
.cal__day--out { background: var(--bg); }
.cal__day--out .cal__n { color: var(--text-3); }
.cal__day--today .cal__n { background: var(--brand); color: #fff; }
.cal__day--sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cal__n {
  width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 650; color: var(--text); flex: none;
}
.cal__evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal__ev {
  display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; overflow: hidden;
  font-size: 11px; font-weight: 550; padding: 2px 5px; border-radius: 5px; line-height: 1.3;
}
.cal__ev > svg { flex: none; }
.cal__evt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__ev--red { background: var(--danger-bg); color: var(--danger-text); }
.cal__ev--amber { background: var(--warning-bg); color: var(--warning-text); }
.cal__ev--blue { background: var(--info-bg); color: var(--info); }
.cal__ev--green { background: var(--success-bg); color: var(--success-text); }
.cal__more { font-size: 10.5px; color: var(--text-3); padding-left: 5px; }

.callegend {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 600; color: var(--text-2); transition: opacity .12s, background .12s;
}
.callegend__n { font-variant-numeric: tabular-nums; color: var(--text-3); }
.callegend--red { color: var(--danger-text); background: var(--danger-bg); border-color: transparent; }
.callegend--amber { color: var(--warning-text); background: var(--warning-bg); border-color: transparent; }
.callegend--blue { color: var(--info); background: var(--info-bg); border-color: transparent; }
.callegend--green { color: var(--success-text); background: var(--success-bg); border-color: transparent; }
.callegend--off { opacity: .42; }

.calpip {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.calpip--red { background: var(--danger-bg); color: var(--danger-text); }
.calpip--amber { background: var(--warning-bg); color: var(--warning-text); }
.calpip--blue { background: var(--info-bg); color: var(--info); }
.calpip--green { background: var(--success-bg); color: var(--success-text); }

/* ============================================================
   GO TO TOP
   A long register is 1,300 rows; getting back to the filter bar should not be
   a scroll. Sits above the content, left of the floating assistant button so
   the two never overlap.
   ============================================================ */
.gotop {
  position: fixed; right: 84px; bottom: 26px; z-index: 60;
  height: 38px; padding: 0 14px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: opacity .16s, transform .16s, background .12s, color .12s;
}
.gotop:hover { background: var(--surface-3); color: var(--text); }
.gotop[hidden] { display: none; }
@media (max-width: 720px) { .gotop { right: 16px; bottom: 76px; } }

/* Matter aging buckets — a clickable histogram in list form, because the
   question is "how many, and open them", not "draw me a curve". */
.agebuckets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
@media (max-width: 1100px) { .agebuckets { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .agebuckets { grid-template-columns: repeat(2, 1fr); } }
.agebucket {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 12px 13px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; font: inherit; text-align: left;
  transition: border-color .12s, background .12s;
}
.agebucket:hover { background: var(--surface-2); border-color: var(--border-strong); }
.agebucket__n { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.agebucket__l { font-size: 12px; font-weight: 600; color: var(--text-2); }
.agebucket__s { font-size: 11px; color: var(--text-3); }

/* Dashboard analytics tabs (Overall / Revenue / Spend / Team). */
.dashtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.dashtab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px 11px; margin-bottom: -1px;
  border: none; background: none; cursor: pointer; font: inherit;
  font-size: 13.5px; font-weight: 650; color: var(--text-2);
  border-bottom: 2.5px solid transparent; transition: color .12s, border-color .12s;
}
.dashtab:hover { color: var(--text); }
.dashtab.on { color: var(--brand); border-bottom-color: var(--brand); }

/* A figure the source cannot support, stated as a sentence rather than a zero. */
.notevidenced {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2);
}
.notevidenced > svg { flex: none; margin-top: 1px; color: var(--text-3); }

/* A named state with a count, used for compliance position and legal cost
   categories. Colour carries the same meaning as everywhere else, and the
   label carries it too — never colour alone (§90). */
.staterow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font: inherit; text-align: left;
  transition: background .12s, border-color .12s;
}
.staterow:hover { background: var(--surface-2); border-color: var(--border-strong); }
.staterow__l { font-size: 13px; font-weight: 650; color: var(--text); flex: none; }
.staterow__s { font-size: 11.5px; color: var(--text-3); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staterow__n { font-size: 14px; font-weight: 700; color: var(--text); flex: none; font-variant-numeric: tabular-nums; }
.statedot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.statedot--green { background: var(--success); }
.statedot--amber { background: var(--warning); }
.statedot--red { background: var(--danger); }
.statedot--blue { background: var(--info); }
.statedot--gray { background: var(--text-3); }

/* ============================================================
   CONTRACT REQUEST — one scrollable workspace with a sticky section rail.
   Replaces the seven-step wizard: a contract request is a picture of a deal
   being assembled, not a checkout flow, and the person filling it in moves
   back and forth constantly.
   ============================================================ */
.crfwork { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .crfwork { grid-template-columns: 1fr; } }

.crfrail {
  position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-r);
  padding: 8px; box-shadow: var(--shadow-xs);
}
@media (max-width: 960px) {
  .crfrail { position: static; flex-direction: row; flex-wrap: wrap; }
}
.crfrailitem {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); border: none; background: none;
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2);
  text-align: left; transition: background .12s, color .12s;
}
.crfrailitem:hover { background: var(--surface-2); color: var(--text); }
.crfrailitem--on { background: var(--brand-soft); color: var(--brand); }
.crfrailitem--bad { color: var(--danger-text); }
.crfrailitem__l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crfrailitem__b {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Compliance position: the four states, each a count you can open (§55).
   Replaces the "% clear" bar — a ratio of a register is not a rating. */
.hstates { display: flex; flex-wrap: wrap; gap: 6px; }
.hstate {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 6px 9px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--surface-2); cursor: pointer; font: inherit; text-align: left;
  transition: filter .12s;
}
.hstate:hover { filter: brightness(.97); }
.hstate--flat { cursor: default; }
.hstate__n { font-size: 16px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hstate__l { font-size: 10.5px; font-weight: 600; opacity: .85; white-space: nowrap; }
.hstate--green { background: var(--success-bg); color: var(--success-text); }
.hstate--amber { background: var(--warning-bg); color: var(--warning-text); }
.hstate--red { background: var(--danger-bg); color: var(--danger-text); }
.hstate--blue { background: var(--info-bg); color: var(--info); }
.hstate--gray { background: var(--surface-3); color: var(--text-2); }

/* ============================================================
   THE FIRST COLUMN STAYS PUT (§7)
   A register wider than the screen is readable only if you can still see WHICH
   ROW you are on while you scroll across it. The Commercial Contract Tracker
   mirrors its source workbook column for column and is meant to — it is the
   one register in the product that deliberately does not fit — so its
   identifier column is pinned instead of being hidden.
   ============================================================ */
.tablewrap--pin .table thead th:first-child,
.tablewrap--pin .table tbody td:first-child {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}
.tablewrap--pin .table thead th:first-child { z-index: 3; background: var(--surface-2); }
.tablewrap--pin .table tbody tr:hover td:first-child { background: var(--surface-2); }

/* A value that is longer than its column: clipped here, whole in the tooltip.
   Used where the source's own names (registered company names, landlords) are
   long enough to push a register past the screen on their own. */
.table .clip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* An action inside a toast (Undo after a removal). Deliberately understated —
   it is a second chance, not a call to action. */
.toast--action { padding-right: 6px; }
.toast__action {
  margin-left: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 600 12px/1 var(--font);
  letter-spacing: 0.02em;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  flex: none;
}
.toast__action:hover { background: var(--surface-2); border-color: var(--border-strong); }
.toast__action:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Removing one line of a form grid (§102). Quiet until you reach for it —
   a permanent red button beside every row reads as a warning, not a control. */
.iconbtn--danger { color: var(--text-3); }
.iconbtn--danger:hover { color: var(--danger); background: var(--danger-soft, rgba(239, 68, 68, 0.1)); }
.iconbtn--danger:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }

/* The selection bar (§101). Present only while a selection exists, so the
   register is not permanently topped by a control for something nobody did. */
.bulkbar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 10px;
  border: 1px solid var(--brand); border-radius: 9px;
  background: var(--brand-soft, rgba(37, 99, 235, 0.07));
  color: var(--text);
}
.bulkbar .spacer { flex: 1 1 auto; }
.chk { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }

/* SIGN IN WITH GOOGLE — the second door, kept quieter than the first.
   A divider, the Google button at its own rendered width, and one line saying
   who may use it, so a requester learns why it refuses them before they try. */
.login__or {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px; color: var(--text-3);
  font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
}
.login__or::before, .login__or::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--border);
}
/* Google's own button is rendered for real but never seen: GSI will not render
   into a node with no box, so it is clipped to nothing rather than hidden. */
.login__gproxy { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* OUR button, sized and shaped like the Sign in control directly above it, so
   the two read as one stack rather than a form with something bolted under it. */
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: 600 14px/1 var(--font);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.gbtn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--brand); }
.gbtn:active:not(:disabled) { transform: translateY(1px); }
.gbtn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.gbtn:disabled { opacity: .5; cursor: not-allowed; }
.gbtn__mark { display: inline-flex; flex: none; }
.gbtn__label { letter-spacing: .01em; }
.login__ghint {
  margin-top: 8px; text-align: center;
  font-size: 11.5px; color: var(--text-3); line-height: 1.5;
}

/* ---- Drafting the contract from an approved template ------------------- */
/* Two columns: the library on the left, what this request can fill on the
   right. Below ~820px they stack, because the coverage list is the part worth
   reading and it should not be squeezed into a gutter. */
.draftgrid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .draftgrid { grid-template-columns: 1fr; } }

.tplbox { max-height: 340px; overflow: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px); background: var(--surface, #fff); }
.tplhead { padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .04em; font-size: 10px; }
.tplrow { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px;
  background: none; border: 0; border-top: 1px solid var(--border); cursor: pointer;
  text-align: left; font: inherit; font-size: 12px; color: var(--text); }
.tplrow:first-of-type { border-top: 0; }
.tplrow:hover { background: var(--hover, rgba(0,0,0,.04)); }
.tplrow--on { background: var(--accent-soft, rgba(37,99,235,.10)); font-weight: 600; }
.tplrow__n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cvbar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 5px; }
.cvbar__on { height: 100%; background: var(--accent, #2563eb); }

.cvlist { max-height: 320px; overflow: auto; }
.cvrow { display: flex; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.cvrow__l { flex: 0 0 42%; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-muted); }
.cvrow__v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Regulatory fees ---------------------------------------------------- */
/* The only new class the cost work introduces. A register cell that is BOTH a
   figure and a button does not exist elsewhere in the product, so it is built
   here — from tokens, inheriting the row's own type scale, with the focus ring
   the rest of the product uses. Everything else in the cost UI reuses Metric,
   .table, Pill and Empty rather than restyling them. */
.feecell {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--text); border-radius: var(--r-xs);
}
.feecell__a { font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.feecell:hover .feecell__a { color: var(--brand); text-decoration: underline; }
.feecell:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* A fee the source proves was paid without stating the amount. It is text, not
   a control — there is no payment record behind it to open. */
.feecell--noted { cursor: default; }

/* The shared cost form's paired fields. Same two-column rhythm the module
   editors already use, on the product's own spacing token — no new geometry. */
.costform__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 640px) { .costform__row { grid-template-columns: 1fr; } }

/* ======================================================= FEES & COSTS ======
   The first version gave one figure a 180px-tall card and left the rest of the
   screen empty. Everything below is built from the existing tokens — no new
   colour, radius, shadow, spacing step or font size is introduced here. */

/* FOUR FIGURES IN THE SPACE THE OLD ONE GAVE TO ONE.
   A thin semantic accent on the left edge instead of a flooded panel, so paid
   and pending read at a glance without the page becoming a traffic light. */
.cost-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3);
}
.cost-strip--5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .cost-strip, .cost-strip--5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .cost-strip, .cost-strip--5 { grid-template-columns: 1fr; } }

.cost-tile {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) calc(var(--sp-3) + 3px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); text-align: left; min-width: 0;
}
.cost-tile::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--border-strong);
}
.cost-tile--brand::before  { background: var(--brand); }
.cost-tile--green::before  { background: var(--success); }
.cost-tile--amber::before  { background: var(--warning); }
.cost-tile--indigo::before { background: var(--info); }
.cost-tile__label { font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--text-3); }
.cost-tile__value { font-size: 19px; font-weight: 700; letter-spacing: -0.01em;
  line-height: 1.2; font-variant-numeric: tabular-nums; }
.cost-tile__foot  { font-size: 11.5px; color: var(--text-3); }
.cost-tile__none  { color: var(--text-3); font-weight: 500; }
.cost-tile__multi { font-size: 15px; font-variant-numeric: tabular-nums; }
.cost-tile--btn { cursor: pointer; }
.cost-tile--btn:hover { border-color: var(--border-strong); }
.cost-tile--btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* PROVENANCE IN A LINE AND A HALF, not half a screen. */
.cost-source {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.cost-source__icon { flex: none; width: 26px; height: 26px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2); }
.cost-source__body { min-width: 0; flex: 1; }
.cost-source__head { font-size: 11.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .02em; color: var(--text-3); margin-bottom: 2px; }
.cost-source__text { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

/* The ledger table: the product's own row rhythm, with the columns a cost
   needs and the ones a phone cannot usefully show dropped rather than crushed. */
.table--cost .cost-amt { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.table--cost .cost-ref { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.table--cost .cost-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 12.5px; line-height: 1.45; max-width: 280px;
}
.cost-col-act { width: 52px; }

/* THE ROW MENU HAS TO ESCAPE THE TABLE.
   `.tablewrap` sets `overflow-x: auto`, and CSS will not let one axis scroll
   while the other stays visible — the Y axis becomes `auto` too, so a menu
   opening below the last row is clipped by the table's own box.

   This was NOT what made the three-dot control look dead — that was the menu
   opening past the bottom of the viewport, now fixed in Dropdown, which flips
   itself when there is no room. This rule stands on its own merits: the cost
   table fits without horizontal scrolling from 900px up (four columns drop
   below that), so above that width the wrapper has nothing to gain by
   clipping. Below it the wrapper still scrolls and the actions are reached by
   tapping the row, which opens the detail drawer with the same actions. */
@media (min-width: 900px) {
  .tablewrap:has(.table--cost) { overflow: visible; }
}
.cost-nev { font-size: 12px; color: var(--text-3); }
.cost-nev--warn { color: var(--warning-text); }
.cost-evlink { display: inline-flex; align-items: center; gap: 5px; max-width: 160px;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--brand);
  font: inherit; font-size: 12px; }
.cost-evlink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-evlink:hover span { text-decoration: underline; }
.cost-row--archived td { opacity: .62; }

@media (max-width: 900px) {
  .table--cost .cost-col-ref, .table--cost .cost-col-ev, .table--cost .cost-col-by { display: none; }
  .table--cost .cost-desc { max-width: 180px; -webkit-line-clamp: 1; }
}
@media (max-width: 560px) { .table--cost .cost-col-desc { display: none; } }

/* ONE COMPACT EMPTY STATE. The product's own Empty is right for a whole page
   and far too tall inside a card that is itself the answer. */
.cost-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-5) var(--sp-3); text-align: center;
}
.cost-empty__icon { width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-3); }
.cost-empty__t { font-size: 13.5px; font-weight: 650; }
.cost-empty__s { font-size: 12.5px; color: var(--text-3); max-width: 420px; }

/* The detail drawer. */
.cost-detail__head { display: flex; align-items: center; gap: var(--sp-3); }
.cost-detail__amt { font-size: 24px; font-weight: 750; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; }
.cost-kvs { display: flex; flex-direction: column; gap: var(--sp-2); }
.cost-kv { display: grid; grid-template-columns: 136px 1fr; gap: var(--sp-3); align-items: baseline; }
.cost-kv__k { font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; color: var(--text-3); }
.cost-kv__v { font-size: 12.5px; color: var(--text); word-break: break-word; }
.cost-ev { display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 7px var(--sp-2); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; text-align: left; }
.cost-ev--static { cursor: default; }
.cost-ev:hover { border-color: var(--border-strong); }
.cost-audit { display: flex; flex-direction: column; gap: 1px;
  padding-left: var(--sp-3); border-left: 2px solid var(--border); }
.cost-audit__act { font-size: 12.5px; font-weight: 600; text-transform: capitalize; }

/* The form: sections rather than one long column, and a financial control that
   reads as money rather than as a bare number box. */
.cost-ctx { display: flex; gap: var(--sp-5); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3); background: var(--surface-2);
  border-radius: var(--r-sm); }
.cost-ctx__k { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; color: var(--text-3); }
.cost-ctx__v { font-size: 12.5px; font-weight: 600; }
.cost-fs { display: flex; flex-direction: column; gap: var(--sp-3); }
.cost-fs__legend { font-size: 11.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .02em; color: var(--text-3);
  padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.cost-amtin { display: flex; align-items: stretch; }
.cost-amtin__cur { display: flex; align-items: center; padding: 0 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-right: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.cost-amtin__in { border-radius: 0 var(--r-sm) var(--r-sm) 0 !important;
  text-align: right; font-variant-numeric: tabular-nums; }
.cost-amtin--bad .cost-amtin__in { border-color: var(--danger); }
.cost-upload { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.cost-upload__btn { display: inline-flex; align-items: center; gap: 7px;
  height: var(--btn-h); padding: 0 var(--sp-3); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 12.5px; font-weight: 550; }
.cost-upload__btn:hover { border-color: var(--border-strong); }
.cost-upload__btn input { display: none; }




/* The fee summary sits on the product's KPI grid, so it lines up with every
   other metric row rather than inventing a finance layout. */
.costgrid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
/* Figures right-align, in the product's tables as everywhere else. */
.table td.num, .table th.num { text-align: right; }

/* pass 3, W1: Original Workbook Viewer (src/workbook.js). The sheet itself is
   drawn on white paper with its own colours, as the original file has it, in
   both themes; the chrome around it uses the app's tokens. */
.wbv { display: flex; flex-direction: column; min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.doclb__panel .wbv { border: 0; border-radius: 0; flex: 1; min-height: 0; }
.wbv__state { flex: 1; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--text-2); font-size: 13px; }
.wbv__bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex: none; flex-wrap: wrap; }
.wbv__addr { flex: none; }
.wbv__addr .input { width: 190px; height: 28px; font-size: 12px; padding: 0 8px; }
.wbv__fx { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--surface); overflow: hidden; }
.wbv__fxlabel { font-style: italic; font-weight: 700; color: var(--text-3); font-size: 12px; flex: none; }
.wbv__fxtext { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.wbv__info { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 5px 12px; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text-2); flex: none; max-height: 72px; overflow: auto; }
.wbv__grid { position: relative; flex: 1; min-height: 160px; overflow: hidden; background: #ffffff; }
.wbv__corner, .wbv__top, .wbv__left, .wbv__body { position: absolute; }
.wbv__corner { left: 0; top: 0; z-index: 3; background: #ffffff; overflow: hidden; }
.wbv__top { top: 0; right: 0; overflow: hidden; z-index: 2; background: #ffffff; }
.wbv__left { left: 0; bottom: 0; overflow: hidden; z-index: 2; background: #ffffff; }
.wbv__body { right: 0; bottom: 0; overflow: auto; outline: none; }
.wbv__body:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.wbv__sheet { color: #000000; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 12.5px; }
.wbv__ch, .wbv__rh { position: absolute; display: flex; align-items: center; justify-content: center; background: #f1f3f2; color: #3c4a43; font-size: 11px; border-right: 1px solid #d4d9d6; border-bottom: 1px solid #d4d9d6; box-sizing: border-box; overflow: hidden; user-select: none; }
.wbv__ch { top: 0; height: 22px; }
.wbv__rh { left: 0; width: 54px; }
.wbv__ch--on, .wbv__rh--on { background: #dfeee5; color: #063d24; font-weight: 700; }
.wbv__ch--hidden, .wbv__rh--hidden { background: repeating-linear-gradient(45deg, #e6e9e7, #e6e9e7 3px, #f6f7f6 3px, #f6f7f6 6px); }
.wbv__rh--hl { background: #fff2b3; color: #4a3b00; font-weight: 700; }
.wbv__c { position: absolute; display: flex; box-sizing: border-box; padding: 0 3px; overflow: hidden; white-space: nowrap; border-right: 1px solid #e3e6e4; border-bottom: 1px solid #e3e6e4; line-height: 1.25; cursor: cell; }
.wbv__t { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wbv__c--sel { outline: 2px solid #0d7a3f; outline-offset: -2px; z-index: 1; }
.wbv__c--hl { box-shadow: inset 0 0 0 9999px rgba(255, 214, 0, .22); }
.wbv__c--hidden { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.05), rgba(0,0,0,.05) 3px, transparent 3px, transparent 6px); }
.wbv__a { color: #0563c1; text-decoration: underline; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: inherit; text-align: inherit; }
.wbv__cm { position: absolute; top: 0; right: 0; width: 0; height: 0; border-top: 6px solid #d1262b; border-left: 6px solid transparent; }
.wbv__tabs { display: flex; gap: 2px; padding: 4px 8px 0; border-top: 1px solid var(--border); background: var(--surface-2); overflow-x: auto; flex: none; }
.wbv__tab { flex: none; border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-3); color: var(--text-2); font: inherit; font-size: 12px; padding: 4px 11px; cursor: pointer; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.wbv__tab--on { background: var(--surface); color: var(--text); font-weight: 650; }
.wbv__tab--hidden { font-style: italic; }
.wbv__tabtag { margin-left: 6px; font-size: 10px; color: var(--text-3); font-style: normal; }
.wbv__foot { display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; padding: 6px 12px; border-top: 1px solid var(--border); background: var(--surface); flex: none; }
.wbv__ver { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.wbv__notes { padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); display: flex; flex-direction: column; gap: 4px; flex: none; }
.wbv__warn { display: flex; gap: 6px; align-items: center; padding: 5px 12px; border-top: 1px solid var(--border); background: var(--warning-bg); color: var(--warning-text); flex: none; }
.wbv-ref { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.wbv-ref:hover { color: var(--brand-600); }
.btn--on { background: var(--brand-soft); color: var(--brand-600); }
@media (max-width: 720px) { .wbv__addr .input { width: 130px; } .wbv__ver { display: none; } }
