:root {
  /* ==================================================================
     THEME — "Ink & Slate", black & white surfaces
     Page/card backgrounds, borders and body text are strict grayscale
     (black on white) so the chrome of the app reads as a case file, not
     a brand. A deep, deliberately muted navy-slate is the primary accent
     (buttons, active states, highlighted values) instead of gold — kept
     serious rather than celebratory. Crimson is reserved for
     contradictions/alerts, verdigris for verified/OK, steel blue for
     neutral secondary categories — plus the chart series (--c1..--c6).
     Icons, badges, chips, stat tiles and charts should keep using these
     accent tokens unchanged; only the grayscale surface/text tokens
     above were touched.
     ================================================================== */

  /* ---- surfaces: pure black & white — page/card backgrounds and text
     are grayscale only; brass/crimson/verdigris/steel/chart colors below
     are left untouched so icons, badges, chips and charts keep their
     original color. ---- */
  --ink: #ffffff;
  --ink-deep: #f2f2f2;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --line: #e2e2e2;
  --line-soft: #ececec;

  /* ---- card accent (evidence tags, chips) — kept neutral gray ---- */
  --paper: #f4f4f4;
  --paper-ink: #111111;

  /* ---- text: black on white ---- */
  --text: #111111;
  --text-muted: #5c5c5c;
  --text-faint: #8a8a8a;

  /* ---- accents ---- */
  --brass: #2c3e50;
  --brass-dim: #44586c;
  --brass-deep: #16212b;
  --brass-glow: rgba(44, 62, 80, 0.16);
  --crimson: #e2574f;
  --crimson-glow: rgba(226, 87, 79, 0.18);
  --verdigris: #18a862;
  --steel: #3b82f6;
  --amber: #b7791f;
  --amber-glow: rgba(183, 121, 31, 0.14);
  --on-accent: #ffffff;

  /* ---- chart series (used by both CSS and app.js) ---- */
  --c1: #2c3e50;
  --c2: #3b82f6;
  --c3: #18a862;
  --c4: #8b5cf6;
  --c5: #e2574f;
  --c6: #64748b;

  /* ---- legacy aliases: older rules still reference these names ---- */
  --teal: var(--brass);
  --teal-dim: var(--brass-dim);
  --teal-glow: var(--brass-glow);
  --thread: var(--crimson);
  --thread-glow: var(--crimson-glow);
  --ok: var(--verdigris);
  --info: var(--steel);

  --radius: 12px;
  --radius-sm: 5px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.12);

  --display: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(0, 0, 0, 0.03), transparent 44%),
    radial-gradient(circle at 92% 6%, rgba(0, 0, 0, 0.025), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 30%);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}



/* A thin letterhead ribbon at the very top of the page — blue fading into
   indigo, echoing an official case-file cover sheet in the new palette. */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 500;
  background: linear-gradient(90deg, var(--brass-deep) 0%, var(--brass) 28%, var(--brass-dim) 46%, var(--brass) 64%, var(--crimson) 100%);
}

::selection { background: var(--teal-glow); color: var(--text); }
button, input, select, textarea { font-family: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--teal-dim); outline-offset: 2px; border-radius: 3px;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 20px; border: 2.5px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: var(--teal-dim); }
* { scrollbar-color: var(--line) var(--ink); scrollbar-width: thin; }

/* A small utility for calling out a key phrase or number inline — used
   sparingly for the one or two things on a page that most deserve the
   reader's eye first. */
em.hl, .hl {
  font-style: normal; font-weight: 700; color: var(--teal);
  font-family: var(--display);
}
img { max-width: 100%; display: block; }

/* ==================================================================
   VIEW SWITCHING  (the actual bug lived here — do not reintroduce an
   ID rule like `#view-login { display: block; }`. Visibility must be
   controlled ONLY through the .view / .view.active class pair below,
   or any view with higher CSS specificity will render permanently
   regardless of what showView() does in app.js.)
   ================================================================== */

.view { display: none; min-height: 100vh; }
.view.active { display: block; animation: view-in 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.placeholder { color: var(--text-faint); font-style: italic; }
.err { color: var(--thread); font-size: 13px; margin-top: 8px; }

/* ---------------- buttons ---------------- */

.primary-btn, .ghost-btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.primary-btn { background: linear-gradient(180deg, var(--brass-dim), var(--brass)); color: var(--on-accent); border: 1px solid var(--brass-dim); box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 6px 18px rgba(44,62,80,0.28); }
.primary-btn:hover { background: linear-gradient(180deg, #56728a, var(--brass-dim)); transform: translateY(-1px); box-shadow: 0 3px 6px rgba(0,0,0,0.32), 0 12px 26px rgba(44,62,80,0.36); }
.primary-btn:active { transform: translateY(0) scale(0.98); box-shadow: 0 1px 2px rgba(2,6,20,0.15); }
.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.primary-btn.full { width: 100%; margin-top: 6px; }

.ghost-btn { background: transparent; color: var(--text-muted); border: 1px solid var(--line); width: 100%; }
.ghost-btn:hover { color: var(--steel); border-color: var(--steel); background: rgba(86,120,171,0.08); }
.ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ghost-btn.small { width: auto; padding: 8px 16px; font-size: 12px; }
.ghost-btn svg { transition: color 0.15s ease; }

/* ==================================================================
   LANDING VIEW
   ================================================================== */

.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 48px; max-width: 1240px; margin: 0 auto;
}
.landing-nav-links { display: flex; align-items: center; gap: 28px; }
.landing-nav-links a { font-size: 13.5px; color: var(--text-muted); text-decoration: none; }
.landing-nav-links a:hover { color: var(--text); }
.landing-nav .primary-btn { width: auto; padding: 9px 18px; }

.landing-hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
  max-width: 1240px; margin: 0 auto; padding: 20px 48px 48px;
}
.landing-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); border: 1px solid var(--teal-dim);
  background: var(--teal-glow); padding: 6px 12px; border-radius: 20px; margin-bottom: 16px;
}
.landing-eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.landing-hero h1 {
  font-family: var(--display); font-weight: 600; font-size: 40px; line-height: 1.14; letter-spacing: -0.01em;
  margin: 0 0 16px; color: var(--text);
}
.landing-hero h1 em { color: var(--teal); font-style: normal; }
.landing-lede { font-size: 15px; line-height: 1.6; color: var(--text-muted); max-width: 480px; margin: 0 0 24px; }
.landing-cta-row { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.landing-cta-row .primary-btn { width: auto; padding: 13px 26px; font-size: 14px; }
.landing-cta-row .text-link { font-size: 13.5px; color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.landing-cta-row .text-link:hover { color: var(--text); }

.landing-trust { display: flex; flex-wrap: wrap; gap: 22px; }
.landing-trust-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-faint); }
.landing-trust-item svg { width: 15px; height: 15px; color: var(--teal-dim); flex-shrink: 0; }

.landing-process {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 22px;
  padding-top: 18px; border-top: 1px solid var(--line-soft);
}
.lp-step {
  display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
}
.lp-step svg { width: 13px; height: 13px; color: var(--teal-dim); flex-shrink: 0; stroke-width: 1.8; }
.lp-arrow { display: flex; align-items: center; opacity: 0.4; }
.lp-arrow svg { width: 11px; height: 11px; color: var(--text-faint); }

/* -- evidence-board hero illustration -- */
.evidence-board {
  position: relative; height: 380px; border-radius: 18px; overflow: visible;
}
.evidence-board .board-bg {
  position: absolute; inset: 0; border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden;
  background-color: var(--panel);
  background-image:
    linear-gradient(160deg, rgba(4,9,22,0.88) 10%, rgba(4,9,22,0.55) 55%, rgba(4,9,22,0.85) 100%),
    url("https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&w=1200&q=70");
  background-size: cover; background-position: center; filter: grayscale(0.55) saturate(1.05) contrast(1.08) brightness(0.75);
}
.ev-card {
  position: absolute; width: 168px; background: var(--paper); color: var(--paper-ink);
  border-radius: 3px; box-shadow: 0 14px 30px rgba(2,6,20,0.28); padding: 14px 14px 16px;
}
.ev-card .ev-tag {
  position: absolute; top: -9px; left: 12px; background: var(--thread); color: #f8fafc;
  font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 2px;
}
.ev-card .ev-title { font-family: var(--display); font-size: 14px; font-weight: 600; margin: 8px 0 8px; }
.ev-card .ev-line { height: 6px; border-radius: 2px; background: rgba(2,6,20,0.15); margin-bottom: 6px; }
.ev-card .ev-line:nth-child(3) { width: 78%; }
.ev-card .ev-pin { position: absolute; top: -7px; right: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); border: 2px solid var(--panel); }

.ev-card.c1 { top: 26px; left: 8px; transform: rotate(-4deg); }
.ev-card.c2 { top: 64px; right: 6px; transform: rotate(3deg); width: 150px; }
.ev-card.c3 { bottom: 96px; left: 54px; transform: rotate(2deg); }
.ev-card.c4 { bottom: 24px; right: 30px; transform: rotate(-3deg); width: 150px; }

.evidence-board svg.thread-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.thread-lines path { fill: none; stroke: var(--thread); stroke-width: 1.6; stroke-dasharray: 5 5; opacity: 0.75; }
.thread-lines circle { fill: var(--thread); }

@media (max-width: 980px) {
  .landing-hero { grid-template-columns: 1fr; padding: 20px 24px 60px; }
  .evidence-board { height: 320px; order: -1; }
  .landing-nav { padding: 18px 22px; }
}

.landing-strip {
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}
.landing-strip-inner {
  max-width: 1240px; margin: 0 auto; padding: 16px 48px; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.strip-stat { display: flex; align-items: center; gap: 12px; }
.strip-stat svg { width: 20px; height: 20px; color: var(--teal); flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.strip-stat-label { font-size: 12.5px; color: var(--text-muted); line-height: 1.35; }
.strip-stat-label strong { display: block; color: var(--text); font-size: 13.5px; }

.landing-section { max-width: 1240px; margin: 0 auto; padding: 56px 48px; }
.landing-section.compact { padding: 44px 48px; }
.landing-section-head { max-width: 560px; margin: 0 0 28px; }
.landing-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--thread); margin-bottom: 8px; }
.landing-section-head h2 { font-family: var(--display); font-size: 27px; font-weight: 600; margin: 0 0 10px; line-height: 1.2; }
.landing-section-head p { color: var(--text-muted); font-size: 14px; line-height: 1.55; margin: 0; }

.steps-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; }
.step-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; position: relative; }
.step-card .step-index { font-family: var(--display); font-size: 26px; color: var(--line); font-weight: 600; line-height: 1; margin-bottom: 10px; }
.step-card h3 { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.step-card p { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.step-card .step-icon { width: 26px; height: 26px; padding: 6px; border-radius: 7px; background: var(--teal-glow); color: var(--teal); margin-bottom: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.feature-card:hover { border-color: var(--teal-dim); transform: translateY(-3px); box-shadow: 0 10px 22px rgba(2,6,20,0.12); }
.feature-card svg { width: 19px; height: 19px; color: var(--teal); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 10px; }
.feature-card h3 { font-family: var(--display); font-size: 14.5px; font-weight: 600; margin: 0 0 5px; }
.feature-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 0; }

.photo-band {
  position: relative; max-width: 1240px; margin: 0 auto; padding: 0 48px;
}
.photo-band-inner {
  position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  min-height: 190px; display: flex; align-items: flex-end;
  background-color: var(--panel);
  background-image:
    linear-gradient(0deg, rgba(4,9,22,0.92) 0%, rgba(4,9,22,0.35) 55%, rgba(4,9,22,0.08) 100%),
    url("https://images.unsplash.com/photo-1758873268745-dd2cf0d677b5?auto=format&fit=crop&w=1600&q=70");
  background-size: cover; background-position: center; filter: grayscale(0.55) saturate(1.05) contrast(1.08) brightness(0.75);
}
.photo-band-caption { padding: 22px 28px; max-width: 560px; }
.photo-band-caption .landing-kicker { margin-bottom: 6px; }
.photo-band-caption h3 { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 0 0 6px; color: #f8f6ee; }
.photo-band-caption p { font-size: 13px; color: #cfc9b8; line-height: 1.5; margin: 0; }
@media (max-width: 900px) {
  .photo-band { padding: 0 24px; }
  .photo-band-inner { min-height: 170px; }
}

.landing-cta-band {
  background-color: var(--panel);
  background-image:
    linear-gradient(135deg, rgba(4,9,22,0.93) 0%, rgba(4,9,22,0.82) 55%, rgba(4,9,22,0.93) 100%),
    url("https://images.unsplash.com/photo-1589994965851-a8f479c573a9?auto=format&fit=crop&w=1600&q=70");
  background-size: cover; background-position: center; filter: grayscale(0.55) saturate(1.05) contrast(1.08) brightness(0.75);
  border-top: 1px solid var(--line-soft);
}
.landing-cta-band-inner {
  max-width: 900px; margin: 0 auto; padding: 44px 48px; text-align: center;
}
.landing-cta-band h2 { font-family: var(--display); font-size: 26px; margin: 0 0 10px; color: #f8f6ee; }
.landing-cta-band p { color: #cfc9b8; font-size: 14px; margin: 0 0 22px; }
.landing-cta-band .primary-btn { width: auto; padding: 13px 30px; font-size: 14px; }

.landing-footer {
  padding: 18px 48px; display: flex; justify-content: space-between; color: var(--text-faint); font-size: 12px;
  max-width: 1240px; margin: 0 auto;
}

@media (max-width: 900px) {
  .landing-strip-inner { grid-template-columns: repeat(2, 1fr); }
  .steps-row { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-section { padding: 40px 24px; }
  .landing-section.compact { padding: 32px 24px; }
}
@media (max-width: 560px) {
  .steps-row, .feature-grid, .landing-strip-inner { grid-template-columns: 1fr; }
}

/* ==================================================================
   LOGIN VIEW
   (No display rule on the #view-login ID — visibility comes only
   from the shared .view / .view.active rules above.)
   ================================================================== */

.login-page { display: flex; min-height: 100vh; }

.login-hero {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 60px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--panel) 0%, var(--ink) 65%);
  border-right: 1px solid var(--line-soft);
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 15%, rgba(59,109,240,0.07), transparent 50%),
              radial-gradient(circle at 85% 85%, rgba(239,68,68,0.05), transparent 45%);
  pointer-events: none;
}
.login-hero-inner { max-width: 380px; position: relative; z-index: 1; }
.login-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-faint); text-decoration: none; margin-bottom: 30px; cursor: pointer; }
.login-back:hover { color: var(--text-muted); }
.hero-illustration { width: 56px; height: 56px; color: var(--teal); margin-bottom: 24px; }
.login-hero h2 { font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.3; margin: 0 0 14px; color: var(--text); }
.hero-lede { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin: 0 0 30px; }
.hero-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 17px; }
.hero-features li { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
.hf-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--teal-dim); margin-top: 1px; }

.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 36px;
  text-align: center;
}
.case-mark-glyph.big {
  font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--on-accent);
  width: 62px; height: 62px; border-radius: 50%; padding: 15px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
  background: radial-gradient(circle at 30% 26%, var(--brass-dim) 0%, var(--brass) 54%, var(--brass-deep) 100%);
  box-shadow:
    0 3px 8px rgba(2,6,20,0.35),
    0 10px 22px rgba(59,109,240,0.28),
    inset 0 1px 1px rgba(255,255,255,0.28),
    inset 0 -3px 6px rgba(0,0,0,0.25);
}
.login-card h1 { font-family: var(--display); font-size: 23px; font-weight: 600; margin: 0 0 4px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 26px; }
#login-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }
#login-form label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
#login-form input {
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 14px;
}
#login-form input:focus { outline: none; border-color: var(--teal-dim); }

.demo-creds { margin-top: 26px; border-top: 1px solid var(--line-soft); padding-top: 16px; text-align: left; }
.demo-creds-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 8px; }
.demo-creds table { width: 100%; font-family: var(--mono); font-size: 11px; color: var(--text-muted); border-collapse: collapse; }
.demo-creds td { padding: 5px 4px; }
.demo-creds td:last-child { text-align: right; color: var(--teal-dim); }
.demo-cred-row { cursor: pointer; border-radius: 4px; transition: background 0.12s ease; }
.demo-cred-row:hover { background: var(--teal-glow); }
.demo-cred-row:hover td:first-child { color: var(--text); }
.demo-creds-note { font-size: 10.5px; color: var(--text-faint); margin: 10px 0 0; line-height: 1.45; }

@media (max-width: 860px) {
  .login-hero { display: none; }
}

/* ---------------- my cases ---------------- */

.cases-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 40px; border-bottom: 1px solid var(--line-soft); background: var(--panel);
}
.cases-content { padding: 40px; max-width: 1100px; margin: 0 auto; }

.cases-actions { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.case-search-input {
  flex: 1; min-width: 220px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text); font-size: 13.5px;
  transition: border-color 0.12s ease;
}
.case-search-input:focus { outline: none; border-color: var(--teal-dim); }
.case-search-input::placeholder { color: var(--text-faint); }

.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.case-tile-skeleton {
  height: 148px; border-radius: var(--radius); background: linear-gradient(100deg, var(--panel) 40%, var(--panel-raised) 50%, var(--panel) 60%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--line);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.case-tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.case-tile:hover { border-color: var(--teal-dim); transform: translateY(-3px); box-shadow: 0 10px 24px rgba(2,6,20,0.18); }
.case-tile-top { display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px; }
.case-tile-id { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.priority-pill { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; letter-spacing: 0.03em; }
.priority-high { background: var(--thread-glow); color: var(--thread); }
.priority-medium { background: var(--teal-glow); color: var(--teal); }
.priority-low { background: rgba(34,197,94,0.20); color: var(--ok); }
.case-tile-title { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.case-tile-type { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.case-tile-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 10px; }

/* ---------------- modal ---------------- */

.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(4,9,22,0.74);
  align-items: center; justify-content: center; z-index: 100;
}
.modal-backdrop.active { display: flex; animation: modal-fade 0.18s ease; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; width: 420px; max-height: 82vh; overflow-y: auto;
  animation: modal-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-card.wide { width: 620px; }
.modal-card h2 { font-family: var(--display); font-weight: 600; margin: 0 0 18px; }
#new-case-form { display: flex; flex-direction: column; gap: 14px; }
#new-case-form label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
#new-case-form input, #new-case-form select, #new-case-form textarea {
  background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 11px; color: var(--text); font-size: 13.5px; resize: vertical;
  transition: border-color 0.12s ease;
}
#new-case-form input:focus, #new-case-form select:focus, #new-case-form textarea:focus {
  outline: none; border-color: var(--teal-dim);
}
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions .ghost-btn, .modal-actions .primary-btn { width: auto; }

/* ---------------- toasts ---------------- */

.toast-stack {
  position: fixed; bottom: 22px; right: 22px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  background: var(--panel-raised); border: 1px solid var(--line); border-left: 3px solid var(--info);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13px; color: var(--text);
  box-shadow: 0 10px 30px rgba(2,6,20,0.22); max-width: 340px; line-height: 1.4;
  animation: toast-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.toast-success { border-left-color: var(--ok); }
.toast.toast-error { border-left-color: var(--thread); }
.toast.toast-leaving { animation: toast-out 0.18s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ---------------- spinner / loading states ---------------- */

.spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--teal);
  animation: spin 0.7s linear infinite; flex-shrink: 0; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-line { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-style: italic; font-size: 13.5px; padding: 4px 0; }

/* ---------------- empty states ---------------- */

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-faint); }
.graph-detail .empty-state { padding: 28px 16px; }
.empty-state svg { width: 34px; height: 34px; color: var(--text-faint); opacity: 0.6; margin-bottom: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.empty-state-title { font-family: var(--display); font-size: 16px; color: var(--text-muted); margin-bottom: 6px; }
.empty-state-sub { font-size: 12.5px; max-width: 320px; margin: 0 auto; line-height: 1.5; }


/* ---------------- sidebar / folder tabs ---------------- */

.app { display: flex; min-height: 100vh; }

.folder-nav {
  width: 240px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.case-mark { display: flex; align-items: center; gap: 12px; padding: 24px 20px; border-bottom: 1px solid var(--line-soft); }
.case-mark.clickable { cursor: pointer; }
.case-mark-glyph {
  font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--on-accent);
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; padding: 8px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 26%, var(--brass-dim) 0%, var(--brass) 54%, var(--brass-deep) 100%);
  box-shadow: 0 2px 5px rgba(2,6,20,0.3), inset 0 1px 1px rgba(255,255,255,0.25), inset 0 -2px 4px rgba(0,0,0,0.22);
}
.case-mark-title { font-size: 11px; letter-spacing: 0.12em; color: var(--text-muted); font-weight: 600; }
.case-mark-id { font-family: var(--mono); font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.tabs { display: flex; flex-direction: column; padding: 16px 0; flex: 1; overflow-y: auto; }
.nav-group-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 20px 6px; font-weight: 600;
}
.nav-group-label:first-child { padding-top: 4px; }
.tab {
  display: flex; align-items: flex-start; gap: 10px; background: transparent; border: none;
  border-left: 2px solid transparent; color: var(--text-muted); text-align: left; padding: 9px 20px;
  font-size: 13.5px; cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
}
.tab:hover { background: var(--panel-raised); color: var(--text); }
.tab.active { color: var(--teal); background: var(--teal-glow); border-left-color: var(--teal); }
.tab-num { font-family: var(--mono); font-size: 10px; color: var(--text-faint); width: 16px; margin-top: 1px; }
.tab.active .tab-num { color: var(--teal-dim); }
.tab-icon { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; }
.tab.active .tab-icon { opacity: 1; }
/* Give every section its own accent so the nav reads as colorful at rest,
   not just when a tab is active. */
.tab[data-tab="dashboard"] .tab-icon { color: var(--brass); }
.tab[data-tab="documents"] .tab-icon { color: var(--steel); }
.tab[data-tab="intelligence"] .tab-icon { color: #8b5cf6; }
.tab[data-tab="contradictions"] .tab-icon { color: var(--crimson); }
.tab[data-tab="timeline"] .tab-icon { color: var(--steel); }
.tab[data-tab="graph"] .tab-icon { color: var(--verdigris); }
.tab[data-tab="similar"] .tab-icon { color: #8b5cf6; }
.tab[data-tab="report"] .tab-icon { color: var(--brass-deep); }
.tab[data-tab="audit"] .tab-icon { color: var(--text-faint); }
.tab.active .tab-icon { color: var(--teal) !important; }
.tab-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tab-title { font-weight: 600; color: var(--text); line-height: 1.3; }
.tab.active .tab-title { color: var(--teal); }
.tab-desc { font-size: 10.5px; color: var(--text-faint); line-height: 1.3; }
.tab.active .tab-desc { color: var(--teal-dim); }

.nav-footer { padding: 14px 16px 18px; border-top: 1px solid var(--line-soft); }
.whoami-badge { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; font-family: var(--mono); }

.whoami-pill {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius);
  background: var(--panel-raised); border: 1px solid var(--line-soft); margin-bottom: 10px;
}
.whoami-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--on-accent);
  background: radial-gradient(circle at 30% 26%, var(--brass-dim) 0%, var(--brass) 54%, var(--brass-deep) 100%);
}
.whoami-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.whoami-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.whoami-role { font-size: 10.5px; color: var(--text-faint); text-transform: capitalize; }
.nav-footer-actions { display: flex; }
.nav-footer-actions .ghost-btn { width: 100%; }

/* ---------------- persistent case context header ---------------- */

.case-context-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 16px 0 18px; margin-bottom: 24px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--ink); z-index: 20;
}
.ccb-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ccb-title-row h2 { font-family: var(--display); font-weight: 600; font-size: 19px; margin: 0; }
.ccb-id { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.ccb-pill { font-size: 10px; font-weight: 600; letter-spacing: 0.03em; padding: 2px 9px; border-radius: 10px; text-transform: capitalize; }
.ccb-status.status-active { background: rgba(34,197,94,0.20); color: var(--ok); }
.ccb-status.status-under-review { background: var(--teal-glow); color: var(--teal); }
.ccb-status.status-closed { background: var(--panel-raised); color: var(--text-faint); }
.ccb-priority.priority-high { background: var(--thread-glow); color: var(--thread); }
.ccb-priority.priority-medium { background: var(--teal-glow); color: var(--teal); }
.ccb-priority.priority-low { background: rgba(34,197,94,0.20); color: var(--ok); }
.ccb-stats { display: flex; gap: 22px; }
.ccb-stat { display: flex; flex-direction: column; align-items: flex-end; }
.ccb-stat-num { font-family: var(--display); font-weight: 700; font-size: 17px; line-height: 1.1; }
.ccb-stat-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.ccb-stat-warn .ccb-stat-num { color: var(--thread); }
@media (max-width: 700px) {
  .case-context-bar { position: static; }
  .ccb-stats { gap: 14px; }
}

/* ---------------- content ---------------- */

.content { flex: 1; padding: 36px 44px 80px; max-width: 1560px; }
.panel { display: none; }
.panel.active { display: block; animation: panel-in 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.panel-head { margin-bottom: 28px; }
.panel-head h1 { font-family: var(--display); font-weight: 600; font-size: 27px; margin: 0 0 6px; letter-spacing: -0.005em; position: relative; padding-left: 15px; }
.panel-head h1::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, var(--teal) 0%, var(--thread) 100%);
}
.sub { color: var(--text-muted); font-size: 14px; margin: 0; }
.section-label {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.08em; margin: 26px 0 12px; font-weight: 400;
}

/* ---------------- dashboard ---------------- */

.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.dash-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 20px 0 26px; }
.dash-custom-report { margin-left: auto; }

.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.insight-card {
  background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(2,6,20,0.06), 0 6px 16px rgba(2,6,20,0.05);
}
.insight-card h3 { font-family: var(--display); font-size: 16px; font-weight: 600; margin: 0 0 3px; }
.insight-card .sub { font-size: 12px; margin-bottom: 16px; }
.insight-card .ghost-btn.full { margin-top: auto; }

.donut-row { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.donut { width: 108px; height: 108px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.donut::before { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--panel-raised); }
.donut-hole { position: relative; text-align: center; z-index: 1; }
.donut-hole strong { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--text); }
.donut-hole span { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--text-muted); flex: 1; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; justify-content: space-between; }
.donut-legend .legend-key { display: flex; align-items: center; gap: 8px; }
.donut-legend .legend-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-legend .legend-count { font-family: var(--mono); color: var(--text); font-weight: 600; }

.relationship-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; flex: 1; }
.relationship-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-muted); }
.relationship-row .rel-bar { width: 22px; height: 4px; border-radius: 2px; flex-shrink: 0; }
.relationship-row .rel-label { flex: 1; }
.relationship-row .rel-count { font-family: var(--mono); color: var(--text); font-weight: 600; }

/* Case Security is the security foundation of the case — given the full
   width of the row so it reads as a header strip above the other insight
   cards, not just one card among equals. */
.security-card {
  grid-column: 1 / -1; border-color: var(--line);
  flex-direction: row; align-items: center; flex-wrap: wrap; gap: 22px;
}
.security-card .sec-head { flex: 0 0 230px; }
.security-card .sec-head h3 { margin-bottom: 4px; }
.security-card .sec-head .sub { margin-bottom: 0; }
.security-card .sec-body { flex: 1 1 420px; min-width: 260px; display: flex; flex-direction: column; gap: 12px; }
.security-card-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.security-card-foot .ledger-status-badge { margin-bottom: 0; }
.security-card-foot .ghost-btn { width: auto; margin-top: 0; }
@media (max-width: 720px) {
  .security-card { flex-direction: column; align-items: stretch; }
  .security-card .sec-head { flex: none; }
}

/* Checklist replaces the old bare metric grid — each row states a check,
   its real value, and a pass/attention/violation tone in one glance. */
.sec-checklist { display: flex; flex-wrap: wrap; gap: 10px; }
.sec-check {
  display: flex; align-items: center; gap: 9px; flex: 1 1 165px; min-width: 165px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 9px 12px;
  background: var(--panel); color: var(--text-faint);
}
.sec-check-icon { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.sec-check.ok { color: var(--ok); }
.sec-check.warn { color: var(--amber); }
.sec-check.alert { color: var(--crimson); }
.sec-check-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sec-check-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.sec-check-value { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text); }

.ledger-status-badge {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 12px;
  background: rgba(24,168,98,0.12); border: 1px solid rgba(24,168,98,0.3); color: var(--ok);
}
.ledger-status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.ledger-status-badge.pending { background: var(--line-soft); border-color: var(--line); color: var(--text-muted); }
.ledger-status-badge.pending::before { background: var(--text-faint); }
.ledger-status-badge.violation { background: var(--crimson-glow); border-color: var(--crimson); color: var(--crimson); }

.gauge-wrap { text-align: center; margin-bottom: 18px; }
.gauge-svg { width: 100%; max-width: 190px; height: auto; }

.activity-chart-wrap { margin-bottom: 18px; flex: 1; }
.activity-svg { width: 100%; height: auto; display: block; }
.activity-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-faint); margin-top: 6px; font-family: var(--mono); }
.activity-axis span:nth-child(2) { color: var(--text-muted); font-family: var(--sans); }

.vault-type-chart { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.vault-type-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-raised); font-size: 12px; color: var(--text-muted);
}
.vault-type-pill .pill-swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.vault-type-pill .pill-count { font-family: var(--mono); font-weight: 600; color: var(--text); }
.gauge-label strong { display: block; font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--ok); margin-top: -30px; }
.gauge-label span { font-size: 12px; color: var(--text-muted); }
.gauge-note {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 12px;
  background: rgba(34,197,94,0.20); border: 1px solid rgba(34,197,94,0.32); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--ok); text-align: left;
}
.gauge-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.ai-summary-bar {
  display: flex; align-items: center; gap: 14px; background: var(--panel-raised); border: 1px solid var(--teal-dim);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 8px; flex-wrap: wrap;
}
.ai-summary-bar > svg { color: var(--teal); flex-shrink: 0; }
.ai-summary-text { flex: 1; min-width: 200px; }
.ai-summary-text strong { display: block; font-family: var(--display); font-size: 13.5px; margin-bottom: 2px; }
.ai-summary-text p { margin: 0; font-size: 12.5px; color: var(--text-muted); }

.reviewer-tip {
  display: flex; align-items: center; gap: 14px; background: var(--panel-raised); border: 1px dashed var(--thread);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; font-size: 13px; color: var(--text-muted); line-height: 1.5;
}
.reviewer-tip svg { width: 20px; height: 20px; color: var(--thread); flex-shrink: 0; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-action {
  display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.qa-icon, .quick-action svg { width: 16px !important; height: 16px !important; color: var(--teal); fill: none !important; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.quick-action:hover { border-color: var(--teal-dim); background: var(--panel-raised); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(2,6,20,0.14); }
.quick-action:active { transform: translateY(0) scale(0.98); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.stat-tile {
  background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 1px 2px rgba(2,6,20,0.06), 0 6px 16px rgba(2,6,20,0.05);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(2,6,20,0.08), 0 10px 22px rgba(2,6,20,0.09); }
.stat-icon-box {
  width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; background: var(--teal-glow);
}
.stat-tile:hover { border-color: var(--teal-dim); transform: translateY(-2px); }
.stat-icon { width: 19px; height: 19px; color: var(--teal-dim); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-num { font-family: var(--display); font-weight: 700; font-size: 30px; color: var(--teal); }
.stat-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }
.stat-caption { font-size: 11px; color: var(--text-muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.stat-tile.tone-gold .stat-icon, .stat-tile.tone-gold .stat-num { color: var(--teal); }
.stat-tile.tone-gold .stat-icon-box { background: var(--teal-glow); }
.stat-tile.tone-gold-dim .stat-icon, .stat-tile.tone-gold-dim .stat-num { color: var(--teal-dim); }
.stat-tile.tone-gold-dim .stat-icon-box { background: rgba(246,207,110,0.34); }
.stat-tile.tone-info .stat-icon, .stat-tile.tone-info .stat-num { color: var(--info); }
.stat-tile.tone-info .stat-icon-box { background: rgba(139,127,214,0.22); }
.stat-tile.tone-ok .stat-icon, .stat-tile.tone-ok .stat-num { color: var(--ok); }
.stat-tile.tone-ok .stat-icon-box { background: rgba(34,197,94,0.20); }
.stat-tile.tone-rose .stat-icon, .stat-tile.tone-rose .stat-num { color: var(--thread); }
.stat-tile.tone-rose .stat-icon-box { background: var(--thread-glow); }
.activity-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.activity-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-faint); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.activity-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); white-space: nowrap; min-width: 150px; }
.activity-user { color: var(--teal); font-weight: 600; }

/* ---------------- dropzone ---------------- */

.dropzone {
  display: block; border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; margin-bottom: 20px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--teal-dim); background: var(--teal-glow); }
.dropzone-inner { display: flex; align-items: center; gap: 16px; }
.dropzone-glyph { font-size: 22px; color: var(--teal); font-family: var(--display); }
.muted { color: var(--text-faint); font-size: 12px; margin-top: 3px; }

#upload-status { margin-bottom: 8px; font-size: 13px; color: var(--text-muted); }
#processing-pipeline { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); margin-bottom: 16px; line-height: 1.9; }
#processing-pipeline .step-done::before { content: "✓ "; color: var(--ok); }

.vault-controls { display: flex; gap: 10px; margin-bottom: 18px; }
.vault-controls input, .vault-controls select {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; color: var(--text); font-size: 13px;
}
.vault-controls input { flex: 1; }

/* ---------------- exhibit cards ---------------- */

.exhibit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.exhibit-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px 16px; cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease;
}
.exhibit-card:hover { border-color: var(--teal-dim); transform: translateY(-2px); }
.exhibit-tag {
  position: absolute; top: -10px; left: 14px; background: var(--thread); color: #f8fafc;
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 2px; transform: rotate(-2deg); box-shadow: 0 2px 4px rgba(2,6,20,0.22);
}
.exhibit-name { font-family: var(--display); font-weight: 600; font-size: 16px; margin: 14px 0 4px; word-break: break-word; }
.exhibit-type { display: inline-block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.exhibit-summary { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 12px; }
.exhibit-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.exhibit-meta { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
.remove-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 12px; }
.remove-btn:hover { color: var(--thread); }

.file-badge {
  position: absolute; top: 14px; right: 14px; font-family: var(--mono); font-size: 9.5px;
  font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 7px;
  border-radius: 4px; background: var(--panel-raised); color: var(--text-faint); border: 1px solid var(--line);
}
.file-badge-pdf { color: var(--thread); border-color: var(--thread-glow); background: var(--thread-glow); }
.file-badge-md, .file-badge-txt { color: var(--teal); border-color: var(--teal-glow); background: var(--teal-glow); }

/* doc detail modal content */
.doc-hash { font-family: var(--mono); font-size: 11px; color: var(--teal-dim); word-break: break-all; }

.ledger-chain {
  display: flex; flex-direction: column; gap: 0; margin-top: 12px;
  border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden;
}
.ledger-node {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line-soft);
}
.ledger-node:last-child { border-bottom: none; }
.ledger-node-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.ledger-node-value { font-size: 12.5px; color: var(--text); text-align: right; }
.ledger-node-value.mono { font-family: var(--mono); font-size: 11px; word-break: break-all; }
.ledger-node.ledger-status-node { background: var(--panel-raised); }
.ledger-node.ledger-status-node .ledger-node-value { font-weight: 600; }
.ledger-node.ledger-status-node .ledger-node-value.ok { color: var(--ok); }
.ledger-node.ledger-status-node .ledger-node-value.violation { color: var(--crimson); }
.ledger-node.ledger-status-node .ledger-node-value.pending { color: var(--text-muted); }
.ledger-note { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; margin-top: 8px; }

.custody-chain { position: relative; padding-left: 22px; margin-top: 14px; }
.custody-chain::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.custody-item { position: relative; padding-bottom: 16px; font-size: 12.5px; }
.custody-item::before { content: ""; position: absolute; left: -19px; top: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); border: 2px solid var(--teal); }
.custody-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }

/* ---------------- generic card / prose ---------------- */

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; }
.prose { font-size: 14.5px; line-height: 1.7; color: var(--text); }
.prose p { margin: 0 0 14px; }
.prose h1, .prose h2, .prose h3 { font-family: var(--display); font-weight: 600; color: var(--teal); margin: 22px 0 10px; }
.prose h1:first-child, .prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-raised); padding: 1px 5px; border-radius: 2px; }

/* ---------------- timeline ---------------- */

.timeline-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.timeline-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.timeline-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.timeline-select {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 30px 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6242' stroke-width='2'%3E%3Cpath d='M5 8l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 13px;
}
.timeline-select:focus { outline: none; border-color: var(--teal-dim); }
.timeline-toolbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.timeline-hint { font-size: 12px; color: var(--text-faint); }
.view-toggle { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.view-toggle-btn { background: transparent; border: none; padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); border-radius: 3px; cursor: pointer; transition: background 0.12s ease, color 0.12s ease; }
.view-toggle-btn.active { background: var(--panel-raised); color: var(--teal); box-shadow: 0 1px 3px rgba(2,6,20,0.15); }

.timeline-list { position: relative; padding-left: 46px; }
.timeline-list::before { content: ""; position: absolute; left: 17px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline-item {
  position: relative; padding: 16px 18px; margin-bottom: 14px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.timeline-item:hover { border-color: var(--teal-dim); transform: translateX(2px); box-shadow: 0 4px 14px rgba(2,6,20,0.12); }
.timeline-marker {
  position: absolute; left: -46px; top: 14px; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(2,6,20,0.25), inset 0 1px 1px rgba(255,255,255,0.25);
}
.timeline-marker svg { width: 16px; height: 16px; color: #fdf8ec; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.timeline-row { display: flex; align-items: flex-start; gap: 16px; }
.timeline-date-badge { flex-shrink: 0; width: 54px; text-align: center; }
.timeline-date-year { font-size: 10px; color: var(--text-faint); font-family: var(--mono); }
.timeline-date-day { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--teal); line-height: 1.1; }
.timeline-date-month { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.timeline-body-text { flex: 1; min-width: 0; }
.timeline-desc { font-size: 14px; color: var(--text); margin-bottom: 8px; line-height: 1.5; }
.timeline-source-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-source { font-size: 11px; color: var(--text-faint); display: inline-flex; align-items: center; gap: 5px; }
.timeline-source svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.evidence-pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; background: var(--teal-glow); color: var(--teal); border: 1px solid var(--teal-dim);
}
.evidence-pill svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; }
.gap-marker { margin: -6px 0 14px 46px; padding: 4px 12px; border-left: 2px dashed var(--line); font-size: 11.5px; color: var(--text-faint); font-style: italic; }

.timeline-list.is-list-view { padding-left: 28px; }
.timeline-list.is-list-view::before { left: 8px; }
.timeline-list.is-list-view .timeline-item { padding: 0 0 22px; margin-bottom: 0; background: none; border: none; }
.timeline-list.is-list-view .timeline-item:hover { transform: none; box-shadow: none; }
.timeline-list.is-list-view .timeline-marker { display: none; }
.timeline-list.is-list-view .timeline-row { display: block; }
.timeline-list.is-list-view .timeline-date-badge { display: none; }
.timeline-list.is-list-view .timeline-item::before {
  content: ""; position: absolute; left: -22px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--teal);
}
.timeline-list.is-list-view .timeline-date-inline { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--teal); margin-bottom: 4px; }
.timeline-date-inline { display: none; }
@media (max-width: 700px) {
  .timeline-list { padding-left: 0; }
  .timeline-list::before { display: none; }
  .timeline-marker { position: static; margin-bottom: 10px; }
  .timeline-row { flex-direction: column; }
}

/* ---------------- graph ---------------- */

.graph-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.graph-hint { font-size: 11.5px; color: var(--text-faint); margin-bottom: 10px; }
.graph-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; user-select: none; }
.graph-toggle input { accent-color: var(--teal); cursor: pointer; width: 14px; height: 14px; }

.graph-layout { display: flex; gap: 16px; align-items: flex-start; }
.graph-canvas {
  flex: 1; min-width: 0; height: 560px; border-radius: var(--radius); position: relative;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(2,6,20,0.06), 0 6px 16px rgba(2,6,20,0.05);
  background-color: var(--panel-raised);
  background-image: radial-gradient(rgba(110,98,66,0.16) 1.4px, transparent 1.5px);
  background-size: 22px 22px;
}
#graph-table-wrap { flex: 1; min-width: 0; max-height: 560px; overflow: auto; }

.graph-detail {
  width: 300px; flex-shrink: 0; background: var(--panel-raised); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 20px; height: 560px; overflow-y: auto;
  box-shadow: 0 1px 2px rgba(2,6,20,0.06), 0 6px 16px rgba(2,6,20,0.05);
}
.graph-detail .placeholder { font-size: 13px; }
.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.detail-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(2,6,20,0.2); }
.detail-name { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--text); }
.detail-type { font-size: 11.5px; color: var(--text-faint); text-transform: capitalize; }
.detail-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin: 18px 0 8px; font-weight: 600; }
.detail-about { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }
.rel-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.rel-line:last-child { border-bottom: none; }
.rel-line .rel-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rel-line .rel-verb { color: var(--text-muted); }
.rel-line .rel-target { color: var(--teal); font-weight: 600; cursor: pointer; margin-left: auto; text-align: right; }
.rel-line .rel-target:hover { text-decoration: underline; }
.evidence-line { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 0; color: var(--text-muted); }
.evidence-line svg { width: 13px; height: 13px; color: var(--text-faint); fill: none; stroke: currentColor; stroke-width: 1.8; flex-shrink: 0; }

.legend-icon { width: 15px; height: 15px; border-radius: 50%; display: inline-block; vertical-align: middle; box-shadow: 0 0 0 1px rgba(2,6,20,0.3); }
.graph-legend { display: flex; gap: 18px; margin-top: 12px; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; }
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1px rgba(2,6,20,0.3); }
.legend-line { width: 16px; height: 2px; display: inline-block; border-radius: 1px; }

.graph-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.graph-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-raised); }
.graph-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: var(--text); vertical-align: top; }
.graph-table tr:hover td { background: var(--teal-glow); }
.graph-table .rel-chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }

@media (max-width: 900px) {
  .graph-layout { flex-direction: column; }
  .graph-detail { width: 100%; height: auto; max-height: 320px; }
}

/* ---------------- similar cases / arguments ---------------- */

.similar-card, .argument-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.similar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.similar-title { font-family: var(--display); font-weight: 600; font-size: 16px; }
.similarity-pill { font-family: var(--mono); font-size: 11px; color: var(--teal); border: 1px solid var(--teal-dim); padding: 2px 9px; border-radius: 10px; }
.similar-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.similar-tag { font-size: 10.5px; background: var(--panel-raised); color: var(--text-muted); padding: 2px 8px; border-radius: 10px; }
.similar-note { font-size: 12.5px; color: var(--text-faint); font-style: italic; margin-top: 8px; }

.argument-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--teal-dim); margin-bottom: 4px; }
.argument-text { font-size: 14px; margin-bottom: 10px; }
.counter-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 4px; margin-top: 10px; }
.evidence-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.evidence-chip { font-family: var(--mono); font-size: 10.5px; background: var(--teal-glow); color: var(--teal-dim); padding: 2px 8px; border-radius: 2px; }

/* ---------------- case intelligence sub-tabs ---------------- */

.intel-subtabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 14px; flex-wrap: wrap; }
.subtab-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line); color: var(--text-muted); padding: 8px 16px; border-radius: 16px; font-size: 12.5px; cursor: pointer; font-family: var(--sans, inherit); }
.subtab-btn:hover { color: var(--text); }
.subtab-btn.active { background: var(--teal-glow); border-color: var(--teal-dim); color: var(--teal); }
.subtab-icon { width: 13px; height: 13px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.intel-subpanel { display: none; }
.intel-subpanel.active { display: block; animation: panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------------- chat ---------------- */

.chat-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.chat-modes { display: flex; gap: 6px; }
.mode-btn { background: var(--panel); border: 1px solid var(--line); color: var(--text-muted); padding: 6px 14px; border-radius: 14px; font-size: 12px; cursor: pointer; }
.mode-btn.active { background: var(--teal-glow); border-color: var(--teal-dim); color: var(--teal); }
#chat-lang { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); padding: 6px 10px; font-size: 12px; }

.chat-window {
  height: 420px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 14px;
}
.chat-msg { max-width: 78%; padding: 9px 14px 11px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.55; }
.chat-msg.user { align-self: flex-end; background: var(--teal-glow); border: 1px solid var(--teal-dim); }
.chat-msg.assistant { align-self: flex-start; background: var(--panel-raised); border: 1px solid var(--line); }
.chat-msg-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.chat-msg-role { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; color: var(--text-faint); }
.chat-msg.user .chat-msg-role { color: var(--teal-dim); }
.chat-msg-time { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
.chat-msg-body { color: var(--text); white-space: pre-wrap; }

.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint);
  animation: typing-bounce 1.1s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-form { display: flex; gap: 10px; }
.chat-form input {
  flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text); font-size: 14px;
}
.chat-form input:focus { outline: none; border-color: var(--teal-dim); }
.chat-form button[type="submit"] { background: linear-gradient(180deg, var(--brass-dim), var(--brass)); color: var(--on-accent); border: none; border-radius: var(--radius-sm); padding: 0 20px; font-weight: 600; cursor: pointer; font-size: 13px; }
#mic-btn { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 16px; cursor: pointer; padding: 0 14px; }
#mic-btn.recording { background: var(--thread-glow); border-color: var(--thread); }

/* ---------------- report ---------------- */

.report-actions { display: flex; gap: 10px; margin-bottom: 20px; }
.report-actions .ghost-btn, .report-actions .primary-btn { width: auto; }

/* ---------------- audit ---------------- */

.audit-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.audit-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.audit-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
.audit-table td.time { font-family: var(--mono); font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.audit-table td.user { color: var(--teal); font-weight: 600; }
.audit-table td.action { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .folder-nav { width: 100%; height: auto; position: relative; }
  .tab-desc { display: none; }
  .content { padding: 24px; }
  .cases-content { padding: 24px; }
  .vault-controls { flex-direction: column; }
  .chat-controls { flex-direction: column; align-items: stretch; gap: 10px; }
  .chat-msg { max-width: 92%; }
  .contradiction-pair { grid-template-columns: 1fr; }
  .contradiction-vs { padding-top: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* focus visibility (keyboard nav) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
.perspectives-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.perspectives-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.perspective-card {
  background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px; border-left: 3px solid var(--teal-dim);
  box-shadow: 0 1px 2px rgba(2,6,20,0.06), 0 6px 16px rgba(2,6,20,0.05);
}
.perspective-card.stance-primary { border-left-color: var(--teal); }
.perspective-card.stance-alternative_suspect { border-left-color: var(--thread); }
.perspective-card.stance-innocent_explanation { border-left-color: var(--ok); }
.perspective-card.stance-gap_in_evidence { border-left-color: var(--info); }
.perspective-stance-tag {
  display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  padding: 3px 8px; border-radius: 3px; margin-bottom: 10px; background: var(--teal-glow); color: var(--teal);
}
.perspective-card.stance-alternative_suspect .perspective-stance-tag { background: var(--thread-glow); color: var(--thread); }
.perspective-card.stance-innocent_explanation .perspective-stance-tag { background: rgba(34,197,94,0.20); color: var(--ok); }
.perspective-card.stance-gap_in_evidence .perspective-stance-tag { background: rgba(139,127,214,0.22); color: var(--info); }
.perspective-card h4 { font-family: var(--display); font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.perspective-card .perspective-summary { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin: 0 0 12px; }
.perspective-card ul { margin: 0 0 12px; padding-left: 18px; font-size: 12.5px; color: var(--text); line-height: 1.6; }
.perspective-caveat {
  display: flex; gap: 7px; align-items: flex-start; font-size: 11.5px; color: var(--text-faint);
  padding-top: 10px; border-top: 1px solid var(--line-soft); font-style: italic;
}

/* ==================================================================
   ADDED IN THE VISUAL PASS
   Page hero art, reusable chart primitives, and the Contradictions
   page (promoted out of Case Intelligence into its own feature).
   ================================================================== */

/* ---------------- panel hero banners ----------------
   Each workspace page gets an illustrated header band so pages are
   recognisable at a glance instead of being a wall of identical
   headings. Art is inline SVG — nothing is loaded over the network,
   and no photographic imagery is used inside the case workspace so
   nothing can be mistaken for real evidence. */

.page-hero {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 26px; margin-bottom: 22px; overflow: hidden;
  background:
    radial-gradient(circle at 88% 20%, var(--hero-glow, var(--brass-glow)), transparent 62%),
    linear-gradient(135deg, var(--panel-raised) 0%, var(--panel) 62%);
}
.page-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(25, 19, 7, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 19, 7, 0.035) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(105deg, transparent 38%, #000 100%);
  -webkit-mask-image: linear-gradient(105deg, transparent 38%, #000 100%);
}
.page-hero::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--hero-accent, var(--brass)), transparent);
}
.page-hero-copy { position: relative; z-index: 1; min-width: 0; }
.page-hero-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--hero-accent, var(--brass));
  border: 1px solid color-mix(in srgb, var(--hero-accent, var(--brass)) 42%, transparent);
  background: var(--hero-glow, var(--brass-glow));
  padding: 4px 10px; border-radius: 20px; margin-bottom: 11px;
}
.page-hero-kicker svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-hero h1 { font-family: var(--display); font-size: 25px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.015em; }
.page-hero .sub { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin: 0; max-width: 62ch; }
.page-hero-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.page-hero-actions .ghost-btn, .page-hero-actions .primary-btn { width: auto; }
.page-hero-art { position: relative; z-index: 1; width: 188px; flex-shrink: 0; opacity: 0.95; }
.page-hero-art svg { width: 100%; height: auto; display: block; }
@media (max-width: 1080px) { .page-hero-art { display: none; } .page-hero { grid-template-columns: 1fr; } }

/* ---------------- reusable chart primitives ---------------- */

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-bottom: 22px; }
.chart-grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.chart-card {
  background: linear-gradient(170deg, var(--panel-raised) 0%, var(--panel) 68%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px; position: relative; overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.chart-card:hover { border-color: var(--line); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.chart-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-card-head h3 { font-family: var(--display); font-size: 14px; font-weight: 650; margin: 0 0 3px; letter-spacing: -0.005em; }
.chart-card-head .sub { font-size: 11.5px; color: var(--text-faint); margin: 0; line-height: 1.45; }
.chart-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
  background: var(--brass-glow); color: var(--brass); border: 1px solid color-mix(in srgb, var(--brass) 34%, transparent);
}
.chart-badge.alert { background: var(--crimson-glow); color: var(--crimson); border-color: color-mix(in srgb, var(--crimson) 36%, transparent); }
.chart-badge.ok { background: color-mix(in srgb, var(--verdigris) 14%, transparent); color: var(--verdigris); border-color: color-mix(in srgb, var(--verdigris) 34%, transparent); }

/* horizontal bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 34%) 1fr auto; gap: 10px; align-items: center; }
.bar-row-label { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; border-radius: 20px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; transform-origin: left; animation: bar-in 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes bar-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-row-value { font-family: var(--mono); font-size: 11.5px; color: var(--text); min-width: 30px; text-align: right; }

/* column / histogram chart */
.col-chart { display: flex; align-items: flex-end; gap: 4px; height: 108px; padding-top: 6px; }
.col-item { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.col-bar {
  width: 100%; max-width: 30px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--brass-dim), var(--brass));
  min-height: 3px; transform-origin: bottom; animation: col-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: default;
}
.col-bar.muted { background: linear-gradient(180deg, var(--line), var(--line-soft)); }
.col-bar.alert { background: linear-gradient(180deg, #f08078, var(--crimson)); }
@keyframes col-in { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.col-label { font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chart-footnote { font-size: 11.5px; color: var(--text-faint); margin: 12px 0 0; display: flex; justify-content: space-between; gap: 10px; }

/* radial score ring */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring-svg { width: 104px; height: 104px; flex-shrink: 0; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line-soft); stroke-width: 9; }
.ring-value { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.ring-center { display: flex; flex-direction: column; }
.ring-center strong { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.05; }
.ring-center span { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.ring-center .ring-note { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }

/* small inline legend */
.chip-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 14px; }
.chip-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); }
.chip-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ==================================================================
   CONTRADICTIONS — now a standalone feature, not an Intelligence tab
   ================================================================== */

.contra-page { --hero-accent: var(--crimson); --hero-glow: var(--crimson-glow); }

.contra-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.contra-stat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  background: linear-gradient(170deg, var(--panel-raised), var(--panel));
}
.contra-stat-num { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.1; }
.contra-stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.contra-stat.sev-high .contra-stat-num { color: var(--crimson); }
.contra-stat.sev-med .contra-stat-num { color: var(--brass); }
.contra-stat.sev-low .contra-stat-num { color: var(--steel); }

.contra-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.contra-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.contra-chip {
  font-size: 12px; padding: 7px 14px; border-radius: 20px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--text-muted);
  transition: all 0.15s ease;
}
.contra-chip:hover { color: var(--text); border-color: var(--text-faint); }
.contra-chip.active { background: var(--crimson-glow); border-color: var(--crimson); color: var(--crimson); font-weight: 600; }
.contra-count-hint { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }

/* upgraded contradiction card — severity-coded, with a confidence meter */
.contradiction-card {
  background: linear-gradient(170deg, var(--panel-raised) 0%, var(--panel) 70%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sev, var(--crimson));
  border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 14px; position: relative; overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.contradiction-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.contradiction-card.sev-high { --sev: var(--crimson); }
.contradiction-card.sev-med { --sev: var(--brass); }
.contradiction-card.sev-low { --sev: var(--steel); }
.contradiction-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.contra-top-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conflict-type-pill {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  background: color-mix(in srgb, var(--sev, var(--crimson)) 16%, transparent);
  color: var(--sev, var(--crimson));
  border: 1px solid color-mix(in srgb, var(--sev, var(--crimson)) 36%, transparent);
  padding: 3px 9px; border-radius: 10px;
}
.severity-pill {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); border: 1px solid var(--line); padding: 3px 9px; border-radius: 10px;
}
.confidence-meter { display: flex; align-items: center; gap: 8px; }
.confidence-meter .cm-track { width: 66px; height: 5px; border-radius: 20px; background: var(--line-soft); overflow: hidden; }
.confidence-meter .cm-fill { height: 100%; border-radius: 20px; background: var(--sev, var(--crimson)); }
.confidence-pill { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); }

.contradiction-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.contradiction-claim {
  font-size: 13.5px; line-height: 1.55; background: var(--ink);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 14px;
}
.contradiction-claim .src { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); }
.contra-src-link {
  display: flex; align-items: center; gap: 5px; width: 100%; text-align: left;
  background: none; border: none; margin-top: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); cursor: pointer;
}
.contra-src-link:hover { color: var(--teal); }
.contra-src-link svg { width: 10px; height: 10px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; }
.contradiction-vs {
  align-self: center; color: var(--sev, var(--crimson)); font-family: var(--mono); font-size: 10.5px;
  font-weight: 600; letter-spacing: 0.08em;
  border: 1px solid color-mix(in srgb, var(--sev, var(--crimson)) 40%, transparent);
  background: color-mix(in srgb, var(--sev, var(--crimson)) 12%, transparent);
  border-radius: 20px; padding: 5px 9px; white-space: nowrap;
}
.contradiction-explain { font-size: 13px; color: var(--text-muted); line-height: 1.6; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.contra-src-label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint);
  display: block; margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line);
}
.contra-verify-note {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--amber); background: var(--amber-glow); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  border-radius: 20px; padding: 6px 12px;
}
.contra-verify-note svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.no-contradictions {
  display: flex; align-items: center; gap: 12px; color: var(--verdigris); font-size: 14px;
  background: color-mix(in srgb, var(--verdigris) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--verdigris) 28%, transparent);
  border-radius: var(--radius); padding: 18px 20px;
}
.no-contradictions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

@media (max-width: 760px) {
  .contradiction-pair { grid-template-columns: 1fr; }
  .contradiction-vs { justify-self: start; }
}

/* ---------------- similar cases: score bars ---------------- */
.similar-score { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.similar-score .ss-track { flex: 1; height: 7px; border-radius: 20px; background: var(--line-soft); overflow: hidden; }
.similar-score .ss-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--brass), var(--brass-dim)); }
.similar-score .ss-val { font-family: var(--mono); font-size: 11.5px; color: var(--brass); }

/* ---------------- document vault: type chart ---------------- */
.vault-type-chart { margin: 20px 0 8px; }

/* ---------------- graph page: top entities ---------------- */
.graph-side-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-top: 22px; }

/* ---------------- audit page chart ---------------- */
.audit-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-bottom: 22px; }

/* ---------------- landing: illustrated analysis band ---------------- */
.landing-showcase { max-width: 1240px; margin: 0 auto; padding: 12px 48px 0; }
.landing-showcase-inner {
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: linear-gradient(140deg, var(--panel-raised) 0%, var(--panel) 60%, var(--ink) 100%);
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 0; align-items: center;
}
.landing-showcase-copy { padding: 30px 34px; }
.landing-showcase-copy h3 { font-family: var(--display); font-size: 21px; font-weight: 650; margin: 8px 0 8px; }
.landing-showcase-copy p { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0 0 16px; }
.showcase-metrics { display: flex; gap: 22px; flex-wrap: wrap; }
.showcase-metric strong { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--brass); }
.showcase-metric span { font-size: 11.5px; color: var(--text-faint); }
.landing-showcase-art { padding: 22px 26px 22px 0; }
.landing-showcase-art svg { width: 100%; height: auto; display: block; }
@media (max-width: 900px) {
  .landing-showcase { padding: 12px 24px 0; }
  .landing-showcase-inner { grid-template-columns: 1fr; }
  .landing-showcase-art { padding: 0 22px 22px; }
}

/* ---------------- card / tile polish pass ---------------- */
.stat-tile, .insight-card, .exhibit-card, .similar-card, .argument-card, .case-tile {
  background: linear-gradient(170deg, var(--panel-raised) 0%, var(--panel) 68%);
}
.stat-tile { transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease; }
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.section-label::after {
  content: ""; display: block; width: 34px; height: 2px; margin-top: 7px; border-radius: 2px;
  background: linear-gradient(90deg, var(--brass), transparent);
}

/* ---------------- sidebar: live contradiction count badge ---------------- */
.tab-count {
  margin-left: auto; align-self: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  min-width: 20px; padding: 2px 7px; border-radius: 20px; text-align: center;
  opacity: 0; transition: opacity 0.2s ease;
}
.tab-count.on {
  opacity: 1; background: var(--crimson-glow); color: var(--crimson);
  border: 1px solid color-mix(in srgb, var(--crimson) 38%, transparent);
}
