/* ══════════════════════════════════════════════════════════════════════
   CounselConnect Cases · Style 18 — "The Advisor"
   Calm private-office gravitas: warm ivory, deep charcoal, muted bronze.
   Measured serif (Lora) memo voice · modern grotesque UI (Figtree) ·
   IBM Plex Mono for case numbers, citations and dates.

   Light is the default; [data-theme="dark"] is a fully designed warm
   charcoal theme. Both themes meet WCAG AA+ for body text.
   ══════════════════════════════════════════════════════════════════════ */

/* Typefaces at the very top so shared admin/auth pages inherit them too. */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=Figtree:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ─────────────────────────── 1 · TOKENS ─────────────────────────── */
:root {
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-sans: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Palette — light */
  --bg: #F4F1EA;            /* warm ivory page */
  --bg2: #EDE9DD;           /* slightly deeper ivory wells/bands */
  --surface: #FDFCF9;       /* card white */
  --surface2: #F6F2E9;      /* well inside a card */
  --ink: #23272B;           /* deep charcoal */
  --ink2: #5E5B52;          /* mid warm grey — AA */
  --ink3: #6B6658;          /* quiet small print — AA */
  --line: #DCD8CD;          /* hairline */
  --line2: #C7BFAC;         /* stronger rule */
  --accent: #8A6D3B;        /* bronze — decorative, fills, icons */
  --accent-strong: #6E5529; /* deep bronze — hover, focus */
  --accent-ink: #745A2C;    /* bronze used as TEXT — AA on ivory/white/tint */
  --on-accent: #FFFDF6;     /* ink placed on bronze fills */
  --accent-soft: #F1E8D8;   /* bronze tint box */
  --accent-ink-soft: #6E5529; /* bronze text sitting on the tint */
  --gold: #B08D57;          /* chart/legend gold */
  --oxblood: #8F4F3C;       /* muted terracotta — legend use */

  --ok: #2F6B42;            /* success ink */
  --ok-soft: #E4ECDF;       /* success fill */
  --warn: #7C5A18;          /* caution ink (dark amber) */
  --warn-soft: #F4E7CB;     /* caution fill */
  --danger: #932F22;        /* negative ink (deep brick) */
  --danger-soft: #F7E3DE;   /* negative fill */
  --info: #36515C;          /* neutral-blue ink */
  --info-soft: #E4EBEA;     /* neutral-blue fill */
  --neutral: #5A574E;       /* neutral ink */
  --neutral-soft: #ECE8DE;  /* neutral fill */

  --focus: #6E5529;
  --shadow-sm: 0 1px 2px rgba(52, 47, 35, .05), 0 2px 6px rgba(52, 47, 35, .05);
  --shadow: 0 1px 2px rgba(52, 47, 35, .06), 0 6px 18px rgba(52, 47, 35, .07), 0 18px 44px rgba(52, 47, 35, .05);
  --radius: 10px;
  --radius-sm: 7px;
  --header-h: 118px;        /* approx height of chrome above content */

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #1B1C1E;            /* warm charcoal */
  --bg2: #151618;
  --surface: #242628;
  --surface2: #2B2D30;
  --ink: #EDEBE6;
  --ink2: #ADAA9E;
  --ink3: #9A968B;
  --line: #3A3D40;
  --line2: #4A4D52;
  --accent: #C9A96A;        /* lifted bronze */
  --accent-strong: #DCC08C;
  --accent-ink: #D9BC83;    /* bronze text — AA on charcoal */
  --on-accent: #221B0C;
  --accent-soft: #37301F;
  --accent-ink-soft: #E0C48E;
  --gold: #D9B36B;
  --oxblood: #B96A50;

  --ok: #8FBF96;
  --ok-soft: #2A352C;
  --warn: #D9B36B;
  --warn-soft: #3A3223;
  --danger: #E0968A;
  --danger-soft: #3C2A26;
  --info: #A9C7D2;
  --info-soft: #273238;
  --neutral: #CFCBBE;
  --neutral-soft: #31302C;

  --focus: #D9BC83;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 22px rgba(0, 0, 0, .3), 0 20px 48px rgba(0, 0, 0, .22);
  color-scheme: dark;
}

/* ─────────────────────── 2 · RESET + BASE ──────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
[id] { scroll-margin-top: calc(var(--header-h) + 14px); }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--ink);
  line-height: 1.28;
  font-weight: 500;
  margin: 0 0 .55em;
  text-wrap: balance;
}
h1 { font-size: 2.1rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
li { margin-bottom: .3em; }
figure { margin: 0; }
img, svg { max-width: 100%; height: auto; vertical-align: middle; }
table { border-collapse: collapse; }
hr {
  border: 0; border-top: 1px solid var(--line);
  margin: 1.6rem 0;
}
::selection { background: var(--accent-soft); color: var(--ink); }

/* Text-colour utilities used by shared fragments */
.muted { color: var(--ink2); }
.small { font-size: .89rem; }        /* 16px at 18px base — never smaller for real text */
.mono { font-family: var(--font-mono); font-size: .92em; }
.kbd {
  font-family: var(--font-mono); font-size: .78rem;
  border: 1px solid var(--line2); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 7px; background: var(--surface);
  color: var(--ink2); white-space: nowrap;
}
.divider { border: 0; border-top: 1px solid var(--line); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.help {
  font-size: .89rem; color: var(--ink2); margin: .4rem 0 0;
}

/* Links — always identifiable, underlined, bronze */
a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent-ink) 55%, transparent);
}
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }
[data-theme="dark"] a:hover { color: var(--accent-strong); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ────────────────────── 3 · ACCESSIBILITY ──────────────────────── */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--bg);
  font-weight: 700; padding: 12px 22px; border-radius: 0 0 10px 0;
  text-decoration: none;
}
.skip-link:focus { left: 0; color: var(--bg); }
.skip-link:focus-visible { outline: 3px solid var(--focus); }

/* Statuses always carry a word; icons are decorative companions */
.status-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: currentColor; margin-right: 6px; vertical-align: 1px;
}

/* ──────────────────────── 4 · LAYOUT ───────────────────────────── */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }
.wrap-narrow { max-width: 900px; margin: 0 auto; padding: 0 28px; }
.wrap-wide { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 640px) {
  .wrap, .wrap-narrow, .wrap-wide { padding: 0 18px; }
}

.page-head { padding: 52px 0 8px; }
.page-head .eyebrow { margin-bottom: 12px; }
.page-title { font-size: clamp(2.05rem, 4.2vw, 2.5rem); margin: 0 0 10px; }
.page-sub { font-size: 1.11rem; line-height: 1.7; color: var(--ink2); max-width: 72ch; margin: 0; }

/* Section rhythm */
.sec { padding: 44px 0; }
.sec-tight { padding: 26px 0; }
.sec-head { margin-bottom: 22px; }
.sec-head .title, .sec-title { font-size: 1.7rem; margin: 0 0 6px; }
.sec-lede { color: var(--ink2); font-size: 1.05rem; margin: 0; max-width: 70ch; }

/* Shared rows */
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 960px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 30px; align-items: start; }
.split-main { min-width: 0; }
.split-side { position: sticky; top: calc(var(--header-h) + 18px); }
@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .split-side { position: static; }
}

/* Toolbar / count */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 20px 0 14px;
}
.count { margin: 0; color: var(--ink2); font-size: 1rem; }
.count strong { color: var(--ink); font-weight: 700; }
.toolbar-spacer { flex: 1; }

/* Breadcrumb (in-page variant inside fragments) */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .95rem; color: var(--ink2);
}
.breadcrumb .sep { color: var(--line2); }
.crumb {
  color: var(--ink2); text-decoration: none; font-weight: 500;
}
a.crumb:hover { color: var(--accent-ink); text-decoration: underline; }
.crumb.current { color: var(--ink); font-weight: 600; text-decoration: none; }

/* ────────────────────── 5 · PUBLIC CHROME ──────────────────────── */
/* Context bar — the signature: brand · breadcrumb · account · theme */
.ctxbar {
  background: var(--bg);
  border-bottom: 2px solid var(--accent);
}
.ctx-inner {
  max-width: 1280px; margin: 0 auto; padding: 13px 28px 11px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
@media (max-width: 640px) { .ctx-inner { padding: 10px 18px 8px; gap: 12px; } }

.brand {
  display: inline-flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  display: inline-grid; place-items: center;
  color: var(--accent-strong);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 1.32rem;
  letter-spacing: .01em; line-height: 1.1; color: var(--ink);
}
.brand-sub { color: var(--accent-ink); font-style: italic; font-weight: 500; }
[data-theme="dark"] .brand-sub { color: var(--accent); }

/* Breadcrumb trail inside the context bar */
.crumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .95rem; min-width: 0;
}
.crumbs .crumb { color: var(--ink2); }
.crumbs a.crumb { color: var(--ink2); }
.crumbs a.crumb:hover { color: var(--accent-ink); }
.crumbs .crumb-sep { color: var(--line2); font-size: .8rem; }
.crumbs .crumb.current {
  color: var(--ink); font-weight: 600; max-width: 30ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 760px) { .crumbs { display: none; } }

.ctx-right {
  margin-left: auto; display: flex; align-items: center; gap: 18px;
}
.ctx-right .navlink { font-size: 1rem; }

/* Theme toggle (sun/moon) */
.icon-btn {
  display: inline-grid; place-items: center; width: 48px; height: 48px;
  border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--ink2); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--surface2); color: var(--ink); border-color: var(--line); }
.theme-toggle svg { width: 22px; height: 22px; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle[aria-pressed="true"] .icon-sun { display: none; }
.theme-toggle[aria-pressed="true"] .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Plain nav row */
.navrow { background: var(--bg); border-bottom: 1px solid var(--line); }
.nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
@media (max-width: 640px) { .nav-inner { padding: 0 18px; } }
.nav-main { display: flex; align-items: center; flex-wrap: wrap; }
.nav-personal {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 2px 0 2px 20px; margin-left: auto;
  border-left: 1px solid var(--line);
}
@media (max-width: 760px) {
  .nav-personal { margin-left: 0; border-left: 0; padding-left: 0; width: 100%; }
}
.navlink {
  display: inline-block; color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 1.02rem; line-height: 1.2;
  padding: 13px 13px 12px; min-height: 48px;
  border-bottom: 3px solid transparent;
  letter-spacing: .002em;
}
.navlink:hover { color: var(--accent-ink); border-bottom-color: var(--line2); text-decoration: none; }
.navlink.active {
  color: var(--accent-ink); border-bottom-color: var(--accent-ink);
}
[data-theme="dark"] .navlink.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-personal .navlink {
  font-size: .9rem; font-weight: 500; color: var(--ink2);
  padding: 13px 11px 12px;
}
.nav-personal .navlink:hover { color: var(--accent-ink); }
.nav-personal .navlink.active { color: var(--accent-ink); font-weight: 700; }

/* Main content area */
main#main-content, .public-main { display: block; padding-bottom: 60px; }
main#main-content > .page-head:first-child,
.public-main > .page-head:first-child { padding-top: 56px; }

/* ───────────────────────── 6 · BUTTONS ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-family: var(--font-sans); font-weight: 600; font-size: 1rem;
  line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent-ink); color: var(--on-accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }
[data-theme="dark"] .btn-primary { background: var(--accent); color: var(--on-accent); }
[data-theme="dark"] .btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn-outline {
  background: var(--surface); color: var(--ink);
  border-color: var(--line2);
}
.btn-outline:hover { border-color: var(--accent-ink); color: var(--accent-ink); background: var(--accent-soft); }
[data-theme="dark"] .btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-ghost {
  background: transparent; color: var(--ink2); border-color: transparent;
}
.btn-ghost:hover { color: var(--accent-ink); background: var(--surface2); }
[data-theme="dark"] .btn-ghost:hover { color: var(--accent); }
.btn-danger {
  background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.btn-danger:hover { background: var(--danger); color: var(--danger-soft); }
.btn-inverse { background: var(--surface); color: var(--ink); }
.btn-inverse:hover { background: var(--accent-soft); color: var(--accent-ink); }
.btn-lg { min-height: 56px; padding: 13px 30px; font-size: 1.08rem; border-radius: 12px; }
.btn-sm { min-height: 44px; padding: 7px 14px; font-size: .92rem; border-radius: 8px; }
.btn-icon { width: 48px; height: 48px; padding: 0; }
.btn-block { width: 100%; }
.btn-arrow::after { content: "→"; margin-left: 4px; }

/* Text link with trailing arrow */
.link-more {
  color: var(--accent-ink); font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px;
}
.link-more::after { content: " →"; font-weight: 600; }
.link-more:hover { color: var(--accent-strong); }
[data-theme="dark"] .link-more { color: var(--accent); }

.strong-link { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.strong-link:hover { color: var(--accent-ink); }
.row-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ────────────────── 7 · CARDS · KPI · PANELS ───────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-hover { transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.card-hover:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.chart-card { padding: 20px 22px; }
.brief-card h3 { font-size: 1.3rem; margin: 10px 0 2px; }

/* Panel + KPI vocabulary */
.panel-title { font-size: 1.45rem; margin: 0 0 6px; letter-spacing: -.005em; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi { padding: 20px 22px; }
.kpi-label, .stat-label {
  font-size: .82rem; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 600; color: var(--ink2);
}
.kpi-label { margin: 0 0 4px; }
.kpi-num {
  font-family: var(--font-mono); font-size: 2rem; font-weight: 600;
  color: var(--ink); line-height: 1.2;
}
.stat-label { margin-top: 4px; }

/* Results — memo slips and rows */
.result {
  display: block; padding: 20px 24px; text-decoration: none;
  color: var(--ink); border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: box-shadow .18s ease, border-color .18s ease;
}
a.result:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); text-decoration: none; }
.result-title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.result-title-row h3 { margin: 0; font-size: 1.35rem; }
.result-meta {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: .95rem; color: var(--ink2); margin-top: 6px;
}
.result-meta .sep { color: var(--line2); }
.result-snippet { margin: 10px 0 0; color: var(--ink2); max-width: 78ch; }
.result-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 14px;
}
.result-tags { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.result-court { display: inline-flex; }
.results { display: grid; gap: 16px; }

/* Definition-grid meta labels (dl pairs, compare cards) */
.meta-grid { display: grid; gap: 12px; margin: 0; }
.mg-item { display: grid; gap: 2px; }
.mg-label {
  font-size: .8rem; letter-spacing: .11em; text-transform: uppercase;
  font-weight: 700; color: var(--ink2); margin: 0 0 2px;
}
.mg-value { margin: 0; font-weight: 600; color: var(--ink); }

/* Avatars */
.avatar {
  display: inline-grid; place-items: center; width: 48px; height: 48px;
  border-radius: 50%; background: var(--accent-soft);
  color: var(--accent-ink-soft); font-weight: 700; font-size: 1rem;
  letter-spacing: .03em; flex: 0 0 auto;
}
.avatar-sm { width: 34px; height: 34px; font-size: .82rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-alt { background: var(--surface2); color: var(--ink2); border: 1px solid var(--line); }
.avatar-gold { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -12px; }

/* ─────────────────── 8 · BADGES · TAGS · CHIPS ─────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 650; font-size: .89rem; line-height: 1.3;
  padding: 4px 12px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent; background: var(--neutral-soft); color: var(--neutral);
}
.badge-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); border-color: var(--line); }
[data-theme="dark"] .badge { border-color: var(--line); }
.badge-outcome { font-weight: 700; }
.badge-queue { font-weight: 700; letter-spacing: .01em; }

/* Tag pills (clickable topic / case refs) */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--ink2);
  border: 1px solid var(--line2); border-radius: 999px;
  padding: 6px 13px; font-size: .92rem; font-weight: 500;
  text-decoration: none; line-height: 1.4;
}
.tag:hover {
  border-color: var(--accent-ink); color: var(--accent-ink); background: var(--accent-soft);
  text-decoration: none;
}
[data-theme="dark"] .tag:hover { border-color: var(--accent); color: var(--accent); }
a.tag { min-height: 40px; }

/* Filter / toggle chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 46px; padding: 8px 16px;
  border: 1px solid var(--line2); border-radius: 999px;
  background: var(--surface); color: var(--ink2);
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
[data-theme="dark"] .chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent-ink); border-color: var(--accent-ink);
  color: var(--on-accent);
}
.chip.active:hover { background: var(--accent-strong); color: var(--on-accent); }
[data-theme="dark"] .chip.active { background: var(--accent); color: var(--on-accent); }
[data-theme="dark"] .chip.active:hover { background: var(--accent-strong); color: var(--on-accent); }

/* ────────────────── 9 · NOTES · BANNERS · ALERTS ───────────────── */
.note, .note-warn, .note-danger {
  border-radius: var(--radius);
  padding: 16px 20px; border: 1px solid transparent;
  border-left: 4px solid currentColor;
  font-size: 1rem;
}
.note { background: var(--accent-soft); color: var(--ink); border-left-color: var(--accent-ink); }
.note-warn { background: var(--warn-soft); color: var(--ink); border-left-color: var(--warn); }
.note-danger { background: var(--danger-soft); color: var(--ink); border-left-color: var(--danger); }
.alert-banner {
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--accent-soft); padding: 14px 18px;
  display: flex; gap: 14px; align-items: center;
}
.alert-banner p { margin: 0; }
.empty { text-align: center; padding: 40px 20px; }
.empty-title { font-size: 1.25rem; margin: 0 0 6px; }
.empty-text { color: var(--ink2); margin: 0 0 16px; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* Highlights & annotations */
.hl-mark {
  background: color-mix(in srgb, var(--gold) 30%, transparent);
  padding: 1px 4px; border-radius: 4px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.annot-note { color: var(--accent-ink); font-size: .89rem; }

/* ────────────────── 10 · SEARCH + FORMS ────────────────────────── */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line2);
  border-radius: 14px; padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-sm);
}
.searchbar:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.searchbar-input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font-family: var(--font-sans); font-size: 1.08rem; color: var(--ink);
  padding: 10px 4px; min-height: 48px;
}
.searchbar-input:focus { outline: 0; }
.searchbar-input::placeholder { color: var(--ink3); }

.filterbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 16px 0;
}
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-label {
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; color: var(--ink2); white-space: nowrap;
}

/* Form controls — large, plainly labelled */
.field { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.label {
  display: block; margin-bottom: 6px; font-weight: 650;
  font-size: 1rem; color: var(--ink);
}
.input, .select, .textarea {
  width: 100%; min-height: 48px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line2); border-radius: 10px;
  font-family: var(--font-sans); font-size: 1rem; padding: 10px 14px;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent-ink); outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.textarea { min-height: 120px; line-height: 1.6; resize: vertical; }
.select { appearance: auto; }
.check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 1rem; color: var(--ink2); cursor: pointer; margin-bottom: 6px;
}
.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent-ink); }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg-item {
  border: 0; background: transparent; color: var(--ink2);
  font-family: var(--font-sans); font-weight: 600; font-size: .95rem;
  padding: 12px 16px; min-height: 46px; cursor: pointer; border-left: 1px solid var(--line);
}
.seg-item:first-child { border-left: 0; }
.seg-item:hover { color: var(--accent-ink); background: var(--surface2); }
.seg-item.active { background: var(--accent-ink); color: var(--on-accent); }
[data-theme="dark"] .seg-item.active { background: var(--accent); color: var(--on-accent); }

/* ─────────────────── 11 · TABLES · PAGER ───────────────────────── */
.tbl-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow-x: auto;
}
.tbl { width: 100%; border-collapse: collapse; min-width: 560px; }
.tbl th, .tbl td {
  text-align: left; padding: 13px 16px; vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: .97rem; line-height: 1.55;
}
.tbl th {
  font-family: var(--font-sans);
  font-size: .78rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink2); font-weight: 700; background: var(--surface2);
  border-bottom: 1px solid var(--line2);
}
.tbl td { color: var(--ink); background: var(--surface); }
.tbl tbody tr:last-child th, .tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface2); }
.tbl .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort::after { content: " ⇅"; opacity: .6; }
.status-chip { display: inline-flex; }
.row-hover { cursor: pointer; }

.pager {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 26px 0 8px;
}
.page-btn {
  display: inline-grid; place-items: center; min-width: 46px; height: 46px;
  padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--surface); color: var(--ink2);
  font-family: var(--font-sans); font-weight: 600; font-size: 1rem;
  text-decoration: none;
}
.page-btn:hover { border-color: var(--accent-ink); color: var(--accent-ink); text-decoration: none; }
[data-theme="dark"] .page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
[data-theme="dark"] .page-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.page-btn.disabled { opacity: .45; pointer-events: none; }

/* ──────────────── 12 · TABS · DETAILS · ACCORDION ──────────────── */
.tabs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding: 6px 18px 0;
}
.tab {
  display: inline-block; padding: 12px 16px 11px;
  color: var(--ink2); font-weight: 600; font-size: .98rem;
  text-decoration: none; border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--accent-ink); }
.tab.active {
  color: var(--accent-ink); border-bottom-color: var(--accent-ink);
  text-decoration: none;
}
[data-theme="dark"] .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

details.card { padding: 14px 20px; }
details.card summary {
  cursor: pointer; list-style: none; position: relative;
  font-weight: 600; padding: 4px 28px 4px 0; font-size: 1.05rem;
  color: var(--ink);
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after {
  content: "+"; position: absolute; right: 0; top: 6px;
  font-family: var(--font-mono); font-weight: 500; color: var(--accent-ink);
  font-size: 1.3rem; line-height: 1;
}
details.card[open] summary::after { content: "−"; }
details.card > :not(summary) { color: var(--ink2); }

/* ────────────────── 13 · PROGRESS · CHARTS ─────────────────────── */
.progress {
  display: block; height: 9px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--line);
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-ink), var(--accent));
  border-radius: 999px;
}
[data-theme="dark"] .progress > span { background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }

.chart-bars {
  display: flex; align-items: flex-end; gap: 7px;
  height: 190px; padding-top: 18px;
}
.chart-bars .col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 4px; height: 100%; min-width: 0;
}
.chart-bars .v { font-family: var(--font-mono); font-size: .82rem; color: var(--ink2); }
.chart-bars .lbl { font-size: .9rem; color: var(--ink3); font-weight: 600; }
.bar {
  width: 100%; min-height: 3px; border-radius: 6px 6px 0 0;
  background: var(--accent);
}
.bar.up { background: linear-gradient(180deg, var(--accent-strong), var(--accent)); }
.bar.down { background: linear-gradient(180deg, var(--gold), color-mix(in srgb, var(--gold) 60%, var(--accent))); }
.bar.neutral { background: var(--line2); }
[data-theme="dark"] .bar.up { background: linear-gradient(180deg, var(--accent-strong), var(--accent)); }
[data-theme="dark"] .bar.down { background: linear-gradient(180deg, var(--gold), var(--accent)); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--ink2); }
.legend-swatch {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  background: var(--line2); flex: 0 0 auto;
}

/* ──────────────── 14 · ADVISOR HOME (custom) ───────────────────── */
.consult { margin-top: 34px; }
.consult-inner {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface) 70%, color-mix(in srgb, var(--accent-soft) 45%, var(--surface)) 100%);
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 52px 56px 44px;
}
@media (max-width: 640px) { .consult-inner { padding: 34px 22px 28px; } }
.kicker-rule {
  font-size: .84rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-ink); font-weight: 700; margin: 0 0 14px;
}
[data-theme="dark"] .kicker-rule { color: var(--accent); }
.consult-greeting {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.6vw, 2.45rem);
  line-height: 1.25; margin: 0 0 12px; max-width: 26ch;
}
.consult-sub { color: var(--ink2); font-size: 1.12rem; max-width: 66ch; margin: 0 0 26px; }
.consult-form { display: flex; gap: 12px; flex-wrap: wrap; }
.consult-field {
  flex: 1 1 420px; display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--line2);
  border-radius: 13px; padding: 6px 8px 6px 20px; min-height: 62px;
}
.consult-field:focus-within { border-color: var(--accent-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.consult-field .search-ico { color: var(--accent-ink); flex: 0 0 auto; }
.consult-field .search-ico svg { width: 22px; height: 22px; }
.consult-input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font-family: var(--font-sans); font-size: 1.12rem; color: var(--ink);
  min-height: 48px; padding: 6px 2px;
}
.consult-input:focus { outline: 0; }
.consult-input::placeholder { color: var(--ink3); }
.consult-hint { margin: 16px 0 0; font-size: .95rem; }

/* Memo-cover pathway cards */
.path-head { margin: 46px 0 18px; }
.path-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
@media (max-width: 900px) { .path-grid { grid-template-columns: 1fr; } }
.path-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 12px; box-shadow: var(--shadow-sm);
  padding: 26px 26px 22px; text-decoration: none; color: var(--ink);
  transition: box-shadow .18s ease, transform .18s ease;
}
.path-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; border-top-color: var(--accent-strong); }
.path-kicker {
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  font-weight: 700; color: var(--ink3);
}
.path-title {
  font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600;
  color: var(--ink); line-height: 1.3;
}
.path-text { color: var(--ink2); margin: 0; }
.path-open {
  margin-top: auto; font-weight: 700; color: var(--accent-ink);
}
.path-open::after { content: " →"; }
[data-theme="dark"] .path-open { color: var(--accent); }

/* Memo slips — recent briefs */
.slip-stack { display: flex; flex-direction: column; gap: 14px; }
.slip {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--line2);
  border-radius: 10px; padding: 18px 22px; text-decoration: none; color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.slip:hover {
  border-left-color: var(--accent-ink); box-shadow: var(--shadow-sm);
  transform: translateX(2px); text-decoration: none;
}
[data-theme="dark"] .slip:hover { border-left-color: var(--accent); }
.slip-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.slip-title { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 600; }
.slip-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--ink2); font-size: .95rem; margin-top: 2px;
}
.slip-meta .sep { color: var(--line2); }
.slip-line { margin: 8px 0 0; color: var(--ink2); }

/* Outcome chips — word + icon, never colour alone */
.outcome {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: .95rem; line-height: 1.2;
  padding: 6px 13px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line2);
}
.outcome svg { width: 16px; height: 16px; flex: 0 0 auto; }
.outcome-ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.outcome-warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.outcome-neg { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.outcome-neutral { color: var(--neutral); background: var(--neutral-soft); }
[data-theme="dark"] .outcome { border-color: var(--line); }

/* Quiet three-step strip */
.steps3 {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 820px) { .steps3 { grid-template-columns: 1fr; } }
.step3 {
  border-top: 1px solid var(--line); padding-top: 18px;
}
.step3-num {
  display: block; font-family: var(--font-mono); color: var(--accent-ink);
  font-size: .95rem; font-weight: 600; letter-spacing: .04em; margin-bottom: 6px;
}
[data-theme="dark"] .step3-num { color: var(--accent); }
.step3 h3 { font-size: 1.28rem; margin-bottom: 4px; }
.step3 p { color: var(--ink2); margin: 0; }

/* Ruled tariff (plans) */
.tariff { width: 100%; }
.tariff td, .tariff th {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: top;
}
.tariff tr:last-child td { border-bottom: 0; }

/* ───────────── 15 · CASE BRIEF — THE MEMO (custom) ─────────────── */
.memo-wrap { max-width: 880px; margin: 0 auto; padding: 0 28px 30px; }
@media (max-width: 640px) { .memo-wrap { padding: 0 16px 20px; } }

.memo-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;                       /* folio sheet */
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
}
.memo-pad { padding: 46px 60px 40px; }
@media (max-width: 760px) { .memo-pad { padding: 28px 22px 24px; } }

/* Letterhead */
.memo-letterhead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--accent);
}
.memo-lh-brand { display: flex; align-items: center; gap: 10px; }
.memo-lh-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft);
  border: 1px solid var(--line); display: inline-grid; place-items: center;
  color: var(--accent-strong);
}
.memo-lh-mark svg { width: 19px; height: 19px; }
.memo-lh-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 1.08rem;
  line-height: 1.15; color: var(--ink);
}
.memo-lh-name span { display: block; font-size: .8rem; font-weight: 500; color: var(--ink2); letter-spacing: .06em; text-transform: uppercase; font-family: var(--font-sans); }
.memo-lh-ref { text-align: right; font-size: .9rem; color: var(--ink2); }
.memo-lh-ref .mono { display: block; }
.memo-lh-ref a { font-size: .9rem; }

/* Title block */
.memo-title-block { padding: 26px 0 8px; }
.memo-kicker { margin-bottom: 10px; }
.memo-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4vw, 2.45rem);
  line-height: 1.22; margin: 0 0 8px; font-weight: 600;
}
.memo-parties {
  font-family: var(--font-mono); color: var(--ink2);
  font-size: .98rem; margin: 0 0 18px;
}
.memo-lead {
  display: grid; grid-template-columns: max-content 1fr;
  column-gap: 22px; row-gap: 9px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0; margin-bottom: 20px;
}
.memo-lead dt {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--ink2); padding-top: 2px;
}
.memo-lead dd { margin: 0; font-size: 1rem; line-height: 1.55; }
.memo-lead dd.mono-line { font-family: var(--font-mono); font-size: .95rem; }
.memo-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 6px; }

/* Ruled memo sections */
.memo-section {
  padding: 30px 0 4px;
  border-top: 1px solid var(--line);
}
.memo-crosshead {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 14px;
}
.memo-crosshead .no {
  font-family: var(--font-mono); font-size: .95rem; font-weight: 600;
  color: var(--accent-ink); letter-spacing: .04em; flex: 0 0 auto;
}
[data-theme="dark"] .memo-crosshead .no { color: var(--accent); }
.memo-crosshead h2 { font-size: 1.62rem; margin: 0; font-weight: 600; }
.memo-body { padding-left: 0; }
.memo-body p, .memo-body li { max-width: 70ch; }
.memo-subhead {
  font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600;
  margin: 22px 0 8px; color: var(--ink);
}

/* The short answer callout */
.answer-box {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 12px; padding: 20px 24px; margin: 18px 0 22px;
}
.answer-box .answer-label {
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  font-weight: 700; color: var(--accent-ink-soft);
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.answer-box .answer-label svg { width: 18px; height: 18px; }
.answer-box .answer-text {
  font-family: var(--font-serif); font-size: 1.3rem; line-height: 1.5;
  font-weight: 500; color: var(--ink); margin: 0; font-style: italic;
}
[data-theme="dark"] .answer-box .answer-label { color: var(--accent-ink-soft); }

/* Indented quotable extracts with page-pin chips */
.extract {
  border-left: 3px solid var(--line2);
  background: var(--bg);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px 14px;
  margin: 16px 0;
}
.extract blockquote {
  margin: 0; color: var(--ink);
  font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.7;
}
.extract blockquote::before { content: "“"; color: var(--accent-ink); font-size: 1.6rem; line-height: 0; vertical-align: -12px; margin-right: 2px; }
.extract blockquote::after { content: "”"; color: var(--accent-ink); font-size: 1.6rem; line-height: 0; vertical-align: -6px; margin-left: 2px; }
.extract-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; font-size: .92rem; color: var(--ink2);
}
.pagepin {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: .88rem; font-weight: 600;
  color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line2));
  background: var(--accent-soft); border-radius: 999px;
  padding: 3px 12px; text-decoration: none; white-space: nowrap;
}
.pagepin svg { width: 13px; height: 13px; }
.pagepin:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }
[data-theme="dark"] .pagepin:hover { background: var(--accent); color: var(--on-accent); }

/* Timeline inside the memo */
.memo-timeline { list-style: none; margin: 6px 0 4px; padding: 0; }
.memo-timeline li {
  display: flex; gap: 18px; padding: 11px 0;
  border-bottom: 1px solid var(--line); align-items: baseline;
}
.memo-timeline li:last-child { border-bottom: 0; }
.memo-timeline .tl-date {
  font-family: var(--font-mono); font-size: .92rem; color: var(--accent-ink);
  flex: 0 0 108px; font-weight: 500;
}
[data-theme="dark"] .memo-timeline .tl-date { color: var(--accent); }
.memo-timeline .tl-ev { color: var(--ink2); }

/* Issue blocks */
.issue-block {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 24px; margin: 16px 0;
  background: var(--surface);
}
.issue-flag {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--ink3); margin-bottom: 8px;
}
.issue-q {
  font-family: var(--font-serif); font-weight: 600; font-size: 1.12rem;
  line-height: 1.5; margin: 0 0 12px; color: var(--ink);
}
.issue-holding {
  background: var(--accent-soft); border-radius: 10px; padding: 12px 16px;
  margin: 0 0 12px; font-size: .98rem;
}
.issue-holding strong { color: var(--accent-ink-soft); }
[data-theme="dark"] .issue-holding strong { color: var(--accent-ink-soft); }
.issue-holding p { margin: 0; }

/* Counsel's note */
.counsel-note {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 12px;
  padding: 16px 20px; margin: 18px 0;
}
.counsel-note .cn-label {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 700; color: var(--accent-ink-soft); margin-bottom: 6px;
}
.counsel-note .cn-label svg { width: 17px; height: 17px; }
.counsel-note p:last-child { margin-bottom: 0; }
[data-theme="dark"] .counsel-note .cn-label { color: var(--accent-ink-soft); }

/* Cite row */
.cite-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  border: 1px dashed var(--line2); border-radius: 10px;
  padding: 10px 16px; background: var(--bg);
  margin: 14px 0;
}
.cite-ref { font-family: var(--font-mono); font-size: .92rem; color: var(--ink); }
.cite-actions { display: inline-flex; gap: 8px; }

/* Verify notice */
.verify-note {
  font-style: italic; color: var(--ink2);
  border-left: 3px solid var(--line2);
  padding: 4px 0 4px 18px; margin: 26px 0 0;
}
.verify-note strong { font-style: normal; }

/* Outcome ribbon at top of sheet (status word + icon) */
.memo-outcome {
  display: inline-flex; align-items: center; gap: 9px;
  border-radius: 10px; padding: 10px 18px;
  font-weight: 700; font-size: 1.05rem; border: 1px solid var(--line2);
}
.memo-outcome svg { width: 19px; height: 19px; }

/* ─────────────── 16 · SEARCH PAGE — BRIEFING REQUEST ───────────── */
.request-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-sm);
  padding: 34px 38px 30px; margin-top: 26px;
}
@media (max-width: 640px) { .request-panel { padding: 24px 20px 20px; } }
.request-query { display: flex; gap: 12px; flex-wrap: wrap; }
.request-query .consult-field { flex: 1 1 460px; }
.request-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 18px; margin-top: 22px;
}
@media (max-width: 980px) { .request-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .request-grid { grid-template-columns: 1fr; } }
.request-grid .field { margin-bottom: 0; }
.request-grid .label { font-size: .9rem; }
.request-sort { margin-top: 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.request-sort .filter-label { margin-right: 2px; }

/* ──────────────── 17 · NOT FOUND (custom) ──────────────────────── */
.cabinet {
  min-height: 62vh; display: grid; place-items: center; padding: 40px 0;
}
.cabinet-card { max-width: 680px; text-align: center; padding: 46px 30px; }
.cabinet-mark {
  display: inline-grid; place-items: center; width: 66px; height: 66px;
  border-radius: 16px; background: var(--accent-soft);
  color: var(--accent-strong); margin-bottom: 20px;
}
.cabinet-mark svg { width: 34px; height: 34px; }
.cabinet-card h1 {
  font-size: clamp(1.9rem, 4.4vw, 2.6rem);
  font-family: var(--font-serif); margin-bottom: 10px;
}
.cabinet-card .cabinet-sub { color: var(--ink2); font-size: 1.08rem; margin-bottom: 26px; }

/* ──────────────── 18 · FOOTER ──────────────────────────────────── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--line);
  margin-top: 30px;
  font-size: .97rem;
}
.foot-inner { padding: 44px 0 30px; }
.foot-brand-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.foot-tag { max-width: 52ch; color: var(--ink2); margin: 10px 0 0; }
.foot-cols {
  display: grid; grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 26px; padding: 26px 0 10px;
}
@media (max-width: 940px) { .foot-cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .foot-cols { grid-template-columns: 1fr; } }
.foot-col h4 {
  font-size: .82rem; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; color: var(--ink2); margin: 0 0 12px;
  font-family: var(--font-sans);
}
.foot-col ul { list-style: none; margin: 0; padding: 0; }
.foot-col li { margin-bottom: 8px; }
.foot-col a { color: var(--ink2); text-decoration: none; }
.foot-col a:hover { color: var(--accent-ink); text-decoration: underline; }
[data-theme="dark"] .foot-col a:hover { color: var(--accent); }
.foot-disclaimers {
  border-top: 1px solid var(--line);
  padding: 22px 0 0; margin-top: 16px;
}
.foot-note { margin: 0 0 8px; color: var(--ink2); }
.foot-note strong { color: var(--ink); }
.foot-legal {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px;
  font-size: .92rem; color: var(--ink3);
}
.foot-legal p { margin: 0; }

/* ──────────── 19 · ADMIN CHROME (restyled, shared shell) ───────── */
body.admin {
  background: var(--bg);
}
.admin-layout {
  display: grid; grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.sidebar {
  background: var(--ink);
  color: #D9D5C8;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
[data-theme="dark"] .sidebar { background: #141517; border-right-color: var(--line); }
@media (max-width: 900px) {
  .sidebar { position: static; height: auto; }
}
.sb-brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}
.sidebar .brand-mark { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.sidebar .brand-name { color: #F4F1EA; }
.sidebar .brand-sub { color: var(--accent); font-style: italic; }
.sb-nav { flex: 1; padding: 16px 14px; }
.sb-section {
  font-size: .76rem; letter-spacing: .16em; text-transform: uppercase;
  font-weight: 700; color: #A9A294;
  margin: 18px 10px 6px;
}
.sb-link {
  display: flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 12px 16px;
  border-radius: 10px; color: #D9D5C8;
  text-decoration: none; font-weight: 600; font-size: 1.02rem;
  border: 1px solid transparent;
}
.sb-link:hover { background: rgba(255, 255, 255, .07); color: #F4F1EA; text-decoration: none; }
.sb-link.active {
  background: var(--accent); color: var(--on-accent);
}
[data-theme="dark"] .sb-link.active { background: var(--accent); color: var(--on-accent); }
.sb-label { display: block; }
.sb-badge { margin-left: auto; }
.sb-foot {
  padding: 16px 14px 18px; border-top: 1px solid rgba(255, 255, 255, .14);
}
.sb-foot .user-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px 14px;
}
.sb-foot .avatar { background: rgba(255, 255, 255, .14); color: #F4F1EA; }
.user-chip-text { color: #D9D5C8; line-height: 1.35; }
.user-chip-text small { display: block; color: #A9A294; font-size: .84rem; }
.sb-foot .sb-link { padding: 10px 12px; min-height: 46px; }
.sb-foot .sb-link:hover { background: rgba(255, 255, 255, .07); }
.sb-foot .sb-link.active { background: var(--accent); color: var(--on-accent); }

.content { min-width: 0; padding: 0 34px 40px; }
@media (max-width: 640px) { .content { padding: 0 18px 30px; } }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 26px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.topbar-title .page-title { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0; }
.topbar-title .page-sub { font-size: 1rem; margin-top: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.admin-main { max-width: 1180px; }
.admin-main > .wrap, .admin-main > .page-head { padding-left: 0; padding-right: 0; }

.admin-stat-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; margin-bottom: 24px;
}
@media (max-width: 900px) { .admin-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .admin-stat-row { grid-template-columns: 1fr; } }

/* Pipeline stepper */
.stepper {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-weight: 600; font-size: .95rem;
}
.step { display: inline-flex; align-items: center; gap: 8px; color: var(--ink3); }
.step .step-num {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--surface2); color: var(--ink2);
  font-family: var(--font-mono); font-size: .9rem; font-weight: 600;
  border: 1px solid var(--line);
}
.step.done { color: var(--ok); }
.step.done .step-num { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step.active { color: var(--ink); }
.step.active .step-num { background: var(--accent-ink); color: var(--on-accent); border-color: transparent; }
[data-theme="dark"] .step.active .step-num { background: var(--accent); color: var(--on-accent); }
.step-arrow { color: var(--line2); padding: 0 2px; }

/* Log viewer */
.log-viewer {
  background: var(--ink); color: #E6E2D6; border-radius: 12px;
  font-family: var(--font-mono); font-size: .9rem;
  padding: 18px 20px; overflow-x: auto; line-height: 1.7;
}
[data-theme="dark"] .log-viewer { background: #101113; }

/* ──────────────── 20 · AUTH PAGE (login) ───────────────────────── */
body.auth-page {
  background: var(--bg);
  min-height: 100vh;
}
.auth-theme-toggle {
  position: fixed; top: 18px; right: 18px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.auth-theme-toggle:hover { border-color: var(--accent-ink); }
.auth-main {
  min-height: 100vh; display: grid; place-items: center;
  padding: 40px 18px;
}
.login-card {
  width: 100%; max-width: 470px; margin: 0 auto;
  padding: 40px 42px 34px;
  background: var(--surface); border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 16px; box-shadow: var(--shadow);
}
@media (max-width: 520px) { .login-card { padding: 30px 22px 24px; } }
.login-logo { text-align: center; margin-bottom: 16px; }
.login-logo .brand-mark {
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--accent-soft); border: 1px solid var(--line);
  color: var(--accent-strong); display: inline-grid; place-items: center;
}
.login-logo svg { width: 34px; height: 34px; }
.auth-note {
  font-size: .95rem; color: var(--ink2); text-align: center;
  margin: 18px 0 0;
}
.auth-note a { color: var(--accent-ink); }
[data-theme="dark"] .auth-note a { color: var(--accent); }

/* ─────────────────── 21 · PROSE (rich text) ────────────────────── */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.3em; }
.prose p, .prose li { color: var(--ink); }
.quote-block {
  margin: 14px 0; padding: 4px 0 4px 22px;
  border-left: 4px solid var(--accent-ink);
  font-family: var(--font-serif); font-size: 1.22rem; line-height: 1.6;
  color: var(--ink);
}
[data-theme="dark"] .quote-block { border-left-color: var(--accent); }
.quote-block p { margin: 0 0 6px; }
.quote-meta { font-size: .9rem; color: var(--ink2); }
.passage {
  padding: 16px 20px; margin: 14px 0;
  background: var(--bg); border-radius: 10px; border: 1px solid var(--line);
}
.passage-src { font-size: .9rem; color: var(--ink2); display: block; margin-top: 8px; }

/* filelabel helper used by some shared fragments */
.filelabel {
  font-size: .76rem; letter-spacing: .15em; text-transform: uppercase;
  font-weight: 700; color: var(--ink3); margin: 0 0 8px;
}

/* Features list (price cards etc.) */
.feature-stack { display: grid; gap: 14px; }
.fli { display: flex; gap: 14px; align-items: flex-start; }
.fli-icon {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px;
  display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink-soft);
  font-family: var(--font-serif); font-weight: 600;
}
.fli-body strong { display: block; }
.fli-body span { color: var(--ink2); }
.fli-arrow { color: var(--accent-ink); font-weight: 700; }
[data-theme="dark"] .fli-arrow { color: var(--accent); }
.price-features { list-style: none; margin: 0; padding: 0; }
.price-features li { padding: 4px 0 4px 26px; position: relative; }
.price-features li::before {
  content: "—"; position: absolute; left: 2px; color: var(--accent-ink);
  font-weight: 700;
}
[data-theme="dark"] .price-features li::before { color: var(--accent); }

/* Court short-name badges etc. */
.courtline {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; font-size: .95rem;
}

/* viz placeholder safety — inline SVG networks on compare/lineage */
.viz-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 18px;
}

/* Slight preference: nested selects shown with a visible arrow are fine */
select.select { padding-right: 34px; }

/* ─────────────────── 22 · REDUCED MOTION ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
