/* ============================================================
   Vigil — "Obsidian Ledger" design system
   Matches the marketing landing: deep near-black canvas, a single
   periwinkle accent (#8b80ff), Geist-Mono micro-labels, glassy
   bordered panels. Colour still earns its place — reserved for risk.
   Dark is the showcase; light stays as a calm, harmonised companion.
   ============================================================ */

:root {
  /* neutrals — cool, near-white canvas (light companion) */
  --bg:        #f6f7f9;
  --bg-2:      #eef1f5;
  --surface:   #ffffff;
  --surface-2: #f9fafb;
  --ink:       #0b0f1a;
  --ink-soft:  #3b4252;
  --muted:     #79808f;
  --line:      #e7eaef;
  --line-2:    #d8dde5;

  /* the one brand accent — periwinkle, straight from the landing */
  --brand:     #6257d8;
  --brand-ink: #5247c8;
  --brand-wash:#eeecfe;

  /* risk ramp — same hues the landing scores entries with */
  --ok:        #0f9d63;  --ok-wash:   #e7f5ef;   /* clear  — green */
  --teal:      #1f93d6;                           /* low    — blue  */
  --warn:      #6257d8;  --warn-wash: #eeecfe;   /* elevated — periwinkle */
  --crit:      #d83a2c;  --crit-wash: #fcebe9;   /* critical — red  */

  --radius:    14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 4px 6px -2px rgba(16,24,40,.05), 0 12px 28px -8px rgba(16,24,40,.12);

  --sans: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", monospace;
}

html[data-theme="dark"] {
  /* Obsidian — deep near-black, panels defined by their border not their fill */
  --bg:        #06070a;
  --bg-2:      #0a0c11;
  --surface:   #0c0e14;   /* panel — landing's rgba(12,14,20,.6) over #06070a, defined by its border */
  --surface-2: #12151c;
  --ink:       #eef1f6;
  --ink-soft:  #aab1c0;
  --muted:     #5e6675;
  --line:      rgba(255,255,255,.08);
  --line-2:    rgba(255,255,255,.15);

  --brand:     #8b80ff;
  --brand-ink: #b9b1ff;
  --brand-wash:rgba(139,128,255,.14);

  --ok:        #19b36b;  --ok-wash:  rgba(25,179,107,.13);
  --teal:      #3fb6ff;
  --warn:      #8b80ff;  --warn-wash:rgba(139,128,255,.14);
  --crit:      #ff5a4d;  --crit-wash:rgba(255,90,77,.14);

  --shadow:    0 1px 2px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 70px -22px rgba(0,0,0,.72);
}

*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg); color: var(--ink);
  line-height: 1.5; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv01";
  transition: background .35s, color .35s;
}
button { font: inherit; cursor: pointer; color: inherit; }
input, select { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.mono--sm {
  font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.eyebrow {
  display: inline-block; font-family: var(--mono);
  font-size: .64rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .22em; color: var(--brand-ink);
}
.link { color: var(--brand-ink); font-weight: 600; font-size: .85rem; }

/* ───────────── buttons ───────────── */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .9rem; font-weight: 600; padding: .62rem 1.15rem;
  border-radius: 999px; border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .2s, background .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.35); }
.btn--primary:hover { background: var(--brand-ink); box-shadow: 0 6px 16px -6px rgba(79,70,229,.55); }
.btn--ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line-2); box-shadow: var(--shadow); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn--xs { font-size: .73rem; font-weight: 600; padding: .3rem .65rem; border-radius: var(--radius-xs); }

/* ───────────── auth ───────────── */
.auth {
  min-height: 100vh; display: grid; place-items: center;
  padding: 2rem; position: relative; overflow: hidden;
}
.auth__spot {
  position: absolute; inset: -30% -10% auto 30%; height: 620px;
  background: radial-gradient(closest-side, var(--brand-wash), transparent 70%);
  opacity: .8; z-index: 0; filter: blur(8px); pointer-events: none;
}
.auth__card {
  position: relative; z-index: 1;
  width: min(404px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 2.4rem 2.2rem; box-shadow: var(--shadow-lg);
}
.auth__brand { display: flex; align-items: center; gap: .55rem; }
.auth__brand .word { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.auth__tag { margin-top: .55rem; }
.auth__tabs {
  display: flex; gap: .25rem; margin: 1.7rem 0 1.3rem;
  background: var(--bg-2); padding: .28rem; border-radius: 10px;
}
.tab {
  flex: 1; padding: .5rem; border: none; background: transparent;
  border-radius: 8px; color: var(--muted); font-size: .88rem; font-weight: 600;
  transition: background .2s, color .2s, box-shadow .2s;
}
.tab.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth__form { display: flex; flex-direction: column; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field span { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.field input {
  padding: .72rem .85rem; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .chat__form input:focus, .erp-form input:focus, .erp-form select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash); background: var(--surface);
}
.auth__form .btn { justify-content: center; margin-top: .5rem; }
.auth__err { color: var(--crit); font-size: .85rem; min-height: 1.1em; text-align: center; }
.auth__link {
  background: none; border: none; padding: 0; margin: 0 auto;
  color: var(--brand); font-size: .82rem; font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.auth__link:hover { color: var(--brand-ink); }

/* ───────────── brand mark ───────────── */
.mark {
  display: inline-grid; place-items: center;
  width: 1.5em; height: 1.5em; border-radius: 7px;
  background: var(--ink); color: var(--bg);
  font-size: .62em; font-weight: 800; line-height: 1;
  position: relative; flex: 0 0 auto;
}
.mark::after {
  content: ""; position: absolute; width: .42em; height: .42em;
  border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 .14em color-mix(in srgb, var(--surface) 30%, transparent);
}

/* ───────────── shell ───────────── */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; position: relative;
  transition: grid-template-columns .32s cubic-bezier(.22,1,.36,1); }

/* collapsible sidebar */
.shell.is-collapsed { grid-template-columns: 0 1fr; }
.shell.is-collapsed .side {
  padding-left: 0; padding-right: 0; border-right-width: 0;
  overflow: hidden; pointer-events: none;
}
.side__brand-row { display: flex; align-items: center; gap: .5rem; }
.side__brand-row .side__logo { flex: 1; min-width: 0; }
.side__collapse, .topbar__expand {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--muted); font-size: 1rem; line-height: 1;
  transition: border-color .15s, color .15s;
}
.side__collapse:hover, .topbar__expand:hover { border-color: var(--brand); color: var(--brand-ink); }
.topbar__lead { display: flex; align-items: flex-start; gap: .7rem; min-width: 0; }
.topbar__expand { display: none; width: 34px; height: 34px; font-size: 1.15rem; margin-top: .15rem; }
.shell.is-collapsed .topbar__expand { display: grid; }

/* atmosphere — periwinkle glow + film grain, straight from the landing.
   Fixed, behind content (sits over the WebGL backdrop from fx.css). */
.shell::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(58% 42% at 80% -4%, var(--brand-wash), transparent 62%),
    radial-gradient(46% 38% at -6% 104%, var(--brand-wash), transparent 60%);
}
.shell::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html[data-theme="light"] .shell::after { display: none; }
@media (prefers-reduced-motion: reduce) { .shell::after { display: none; } }

/* ───────────── sidebar ───────────── */
.side {
  border-right: 1px solid var(--line); background: var(--surface);
  padding: 1.5rem 1rem 1.2rem; display: flex; flex-direction: column; gap: 1.4rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side__brand { padding: .1rem .5rem .9rem; border-bottom: 1px solid var(--line); }
.side__logo {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em;
}
.side__tagline {
  font-family: var(--mono); font-size: .58rem;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--muted); margin-top: .45rem; padding-left: .15rem;
}

.side__nav { display: flex; flex-direction: column; gap: .15rem; }
.nav-section { display: flex; flex-direction: column; gap: .1rem; }
.nav-section + .nav-section { margin-top: .9rem; }
.nav-section__label {
  font-family: var(--mono); font-size: .56rem;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--muted); padding: .25rem .8rem .3rem;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .56rem .8rem; border: none; background: transparent;
  border-radius: var(--radius-sm); color: var(--ink-soft);
  font-size: .9rem; font-weight: 500; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--brand-wash); color: var(--brand-ink); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav-item b {
  font-size: .68rem; font-weight: 700; font-family: var(--mono);
  background: var(--crit); color: #fff;
  padding: .08rem .42rem; border-radius: 999px; min-width: 1.5em; text-align: center;
}
.nav-item.is-active b { background: var(--brand); }

.side__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.side__foot .mono--sm { color: var(--ok); display: flex; align-items: center; gap: .35rem; }
.side__foot .mono--sm::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-wash);
}
.side__foot #userEmail { font-size: .82rem; color: var(--ink-soft); margin: .35rem 0 .7rem; word-break: break-all; }
.side__logout { background: none; border: none; color: var(--muted); font-size: .82rem; padding: 0; font-weight: 500; }
.side__logout:hover { color: var(--crit); }

/* ───────────── main ───────────── */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem clamp(1.2rem, 3vw, 2.6rem);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.path { margin-bottom: .2rem; }
.topbar h1 { font-weight: 700; font-size: 1.5rem; line-height: 1.1; letter-spacing: -.02em; }
.topbar .sub { display: block; margin-top: .25rem; font-size: .82rem; color: var(--muted); }
.topbar__right { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-size: .76rem; font-weight: 700;
}
.theme-toggle {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft);
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand-ink); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.panel { padding: clamp(1.3rem, 3vw, 2.4rem); }
.loader { color: var(--muted); padding: 4rem 0; text-align: center; font-family: var(--mono); font-size: .82rem; }

/* chips / filters */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.4rem; align-items: center; }
.chip {
  font-size: .8rem; font-weight: 500; padding: .34rem .85rem; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-soft); background: var(--surface);
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips__sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 0 .35rem; }

/* ═══════════ NORTH STAR — risk hero ═══════════ */
.risk--clear    { --risk-c: var(--ok);   --risk-wash: var(--ok-wash); }
.risk--low      { --risk-c: var(--teal); --risk-wash: var(--ok-wash); }
.risk--elevated { --risk-c: var(--warn); --risk-wash: var(--warn-wash); }
.risk--critical { --risk-c: var(--crit); --risk-wash: var(--crit-wash); }

.risk-hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.risk-hero__main {
  background: var(--surface); padding: 1.7rem 1.9rem 1.6rem;
  position: relative;
}
.risk-hero__main::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--risk-c);
}
.risk-hero__score {
  display: flex; align-items: baseline; gap: .4rem; margin: .7rem 0 .2rem;
}
.risk-hero__score span {
  font-size: clamp(3.4rem, 7vw, 5rem); font-weight: 800;
  line-height: .9; letter-spacing: -.04em;
  font-feature-settings: "tnum"; color: var(--risk-c);
}
.risk-hero__score i { font-style: normal; font-size: 1.3rem; font-weight: 600; color: var(--muted); }
.risk-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: .28rem .7rem; border-radius: 999px;
  color: var(--risk-c); background: var(--risk-wash);
  border: 1px solid color-mix(in srgb, var(--risk-c) 25%, transparent);
}
.risk-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--risk-c); }
.risk--critical .risk-badge::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.meter {
  height: 7px; border-radius: 999px; background: var(--bg-2);
  margin: 1.2rem 0 .9rem; overflow: hidden; position: relative;
}
.meter__fill {
  height: 100%; border-radius: 999px; background: var(--risk-c);
  width: 0; transition: width 1s cubic-bezier(.22,1,.36,1);
}
.risk-hero__sub { font-size: .88rem; color: var(--ink-soft); }
.risk-hero__sub b { color: var(--ink); font-weight: 700; }

.risk-hero__top {
  background: var(--surface-2); border: none; text-align: left;
  padding: 1.7rem 1.8rem; display: flex; flex-direction: column; gap: .55rem;
  transition: background .15s;
}
.risk-hero__top:hover { background: var(--bg-2); }
.risk-hero__top-title {
  font-size: 1.02rem; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.risk-hero__top-meta { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); font-family: var(--mono); }
.risk-hero__top .link { margin-top: auto; }
.risk-hero__top--empty { color: var(--muted); justify-content: center; }

/* ───────────── KPI row (≤3, calm) ───────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.6rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s;
}
.stat:hover { border-color: var(--line-2); box-shadow: var(--shadow-lg); }
.stat__val { font-size: 1.95rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-feature-settings: "tnum"; color: var(--ink); }
.stat__label { font-size: .78rem; font-weight: 500; color: var(--muted); margin-top: .6rem; }
/* legacy severity accents kept for any reuse, toned down */
.stat--danger .stat__val { color: var(--crit); }
.stat--warn   .stat__val { color: var(--warn); }
.stat--ok     .stat__val { color: var(--ok); }

/* ───────────── progressive disclosure section ───────────── */
.overview-section { margin-top: 1.8rem; }
.overview-section__title,
.chart-box__title {
  display: flex; align-items: center; gap: .65rem;
  font-family: var(--mono); font-size: .64rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .13em; color: var(--muted);
  margin-bottom: 1rem;
}
.overview-section__title::after,
.chart-box__title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.chart-row { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; margin-bottom: 1rem; align-items: start; }
.chart-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow);
}
.chart-box--full { grid-column: 1 / -1; }
.chart-box canvas { width: 100% !important; height: 260px !important; }

/* ───────────── alerts ───────────── */
.alerts { display: flex; flex-direction: column; gap: .6rem; }
.alert {
  display: flex; align-items: center; gap: 1rem;
  padding: .9rem 1.1rem; border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.alert__body { flex: 1 1 auto; min-width: 0; }
.alert__score { flex: 0 0 auto; width: 52px; }
.alert__side, .alert__pick { flex: 0 0 auto; }
.alert:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.alert--high   { border-left-color: var(--crit); }
.alert--medium { border-left-color: var(--warn); }
.alert--low    { border-left-color: var(--ok); }
.alert__score span { font-family: var(--mono); font-size: 1.4rem; font-weight: 600; line-height: 1; color: var(--ink); font-feature-settings: "tnum"; }
.alert--high .alert__score span { color: var(--crit); }
.alert--medium .alert__score span { color: var(--warn); }
.alert--low .alert__score span { color: var(--ok); }
.alert__score em { display: block; font-style: normal; font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: .3rem; }
.alert__title { font-size: .94rem; font-weight: 600; }
.alert__why { font-size: .8rem; color: var(--muted); margin-top: .4rem; display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.tag {
  font-family: var(--mono); font-size: .64rem; font-weight: 500; letter-spacing: .04em;
  background: var(--bg-2); color: var(--ink-soft); padding: .16rem .5rem; border-radius: var(--radius-xs);
  border: 1px solid var(--line-2);
}
.alert__amount { font-family: var(--mono); font-size: .76rem; white-space: nowrap; color: var(--muted); }
.alert__side { display: flex; flex-direction: column; align-items: flex-end; gap: .45rem; }
.alert__actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.alert__note { font-size: .8rem; color: var(--ink-soft); font-style: italic; margin-top: .4rem; }
.alert__pick { display: flex; align-items: center; padding-right: .3rem; cursor: pointer; }
.alert__pick input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--brand); }

.status {
  font-family: var(--mono); font-size: .6rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  padding: .16rem .48rem; border-radius: var(--radius-xs); border: 1px solid var(--line-2); color: var(--muted);
}
.status--open { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.status--investigating { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.status--confirmed { border-color: color-mix(in srgb, var(--crit) 40%, transparent); color: var(--crit); background: var(--crit-wash); }
.status--dismissed { opacity: .55; text-decoration: line-through; }

/* summary cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.card { padding: 1.3rem 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card b { font-size: 2rem; font-weight: 700; display: block; line-height: 1; letter-spacing: -.03em; font-feature-settings: "tnum"; }
.card span { font-size: .8rem; color: var(--muted); display: block; margin-top: .45rem; }
.card--high b { color: var(--crit); }
.card--medium b { color: var(--warn); }
.card--low b { color: var(--ok); }

/* ───────────── table ───────────── */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .82rem 1.1rem; font-size: .88rem; }
thead th { font-family: var(--mono); font-size: .62rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
tbody tr { border-top: 1px solid var(--line); transition: background .12s; }
tbody tr:first-child { border-top: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; font-feature-settings: "tnum"; }
.pill { font-family: var(--mono); font-size: .68rem; padding: .14rem .5rem; border-radius: 999px; border: 1px solid var(--line-2); text-transform: uppercase; letter-spacing: .04em; }
.pill--debit { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 35%, transparent); background: var(--crit-wash); }
.pill--credit { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-wash); }
.row-link { cursor: pointer; }

/* ───────────── assistant ───────────── */
.chat { display: flex; flex-direction: column; height: calc(100vh - 190px); max-width: 800px; }
.chat__log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .8rem; padding: .5rem 0 1rem; }
.msg { padding: .82rem 1.05rem; border-radius: 14px; font-size: .92rem; max-width: 80%; line-height: 1.55; }
.msg--user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg--ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg--ai b { color: var(--brand-ink); }
.msg__meta { font-family: var(--mono); font-size: .62rem; color: var(--muted); margin-top: .5rem; letter-spacing: .05em; }
.chat__form { display: flex; gap: .6rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.chat__form input { flex: 1; padding: .8rem 1.05rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); }
.suggest { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.suggest button { font-size: .82rem; padding: .42rem .9rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-soft); transition: border-color .15s, color .15s; }
.suggest button:hover { border-color: var(--brand); color: var(--brand-ink); }

/* ───────────── ERP integrations ───────────── */
.erp-form { display: flex; gap: .6rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.erp-form select, .erp-form input { padding: .68rem .95rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.erp-form input { flex: 1; min-width: 220px; }
.empty-row { text-align: center; color: var(--muted); padding: 1.4rem; }

/* ───────────── empty state ───────────── */
.empty { text-align: center; padding: 4rem 1rem; }
.empty h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; letter-spacing: -.02em; }
.empty p { color: var(--muted); margin-bottom: 1.4rem; max-width: 46ch; margin-inline: auto; font-size: .92rem; }

/* ───────────── investigation cases ───────────── */
.case-bar { display: flex; justify-content: flex-end; margin: .2rem 0 .9rem; }
.case-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.case-head__actions { display: flex; gap: .5rem; }
.case-summary { margin-bottom: 1.2rem; }
.case-summary h2 { font-size: 1.3rem; font-weight: 700; margin: 0 0 .3rem; letter-spacing: -.02em; }

/* ───────────── toast ───────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; translate: -50% 0; z-index: 200;
  background: var(--ink); color: var(--bg); padding: .78rem 1.3rem; border-radius: 999px;
  font-size: .86rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ───────────── entrance ───────────── */
.panel > * { animation: rise .45s cubic-bezier(.22,1,.36,1) both; }
.panel > *:nth-child(2) { animation-delay: .05s; }
.panel > *:nth-child(3) { animation-delay: .1s; }
.panel > *:nth-child(4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ═══════════ OVERVIEW v2 — editorial hero + live-signals rail ═══════════
   Ported from the Claude Design "Vigil Dashboard" concept, wired to live
   data. Keeps the .risk--<band> hook so the WebGL backdrop still tints. */

.hero {
  position: relative; overflow: hidden; margin-bottom: 1.1rem;
  border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(1.7rem, 3vw, 2.4rem) clamp(1.7rem, 3vw, 2.6rem);
  background:
    radial-gradient(125% 150% at 100% 0%, var(--brand-wash), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero__row { display: flex; align-items: center; justify-content: space-between; gap: clamp(1.5rem, 4vw, 2.6rem); }
.hero__lede { min-width: 0; }
.hero__live { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.hero__live .pill { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.hero__live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.8s ease-in-out infinite; }
.hero h2 { font-size: clamp(2rem, 4.2vw, 2.9rem); font-weight: 800; letter-spacing: -.04em; line-height: .98; }
.hero h2 em { font-style: normal; color: var(--risk-c); }
.hero__sub { margin-top: 1.1rem; font-size: .96rem; color: var(--ink-soft); line-height: 1.55; max-width: 42ch; }
.hero__sub b { color: var(--crit); font-weight: 600; }
.hero__facts { display: flex; gap: clamp(1.4rem, 3vw, 2.2rem); margin-top: 1.6rem; }
.hero__fact .n { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; font-feature-settings: "tnum"; }
.hero__fact .n--crit { color: var(--crit); }
.hero__fact .k { font-family: var(--mono); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: .3rem; }

.hero__ring { position: relative; width: 184px; height: 184px; flex: 0 0 auto; }
.hero__ring svg { display: block; transform: rotate(-90deg); }
.hero__ring .track { stroke: var(--line); }
.hero__ring .val {
  stroke: var(--risk-c); stroke-linecap: round;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--risk-c) 55%, transparent));
  transition: stroke-dasharray 1.1s cubic-bezier(.22,1,.36,1);
}
.hero__ring .label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero__ring .label b { font-size: 3.4rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; font-feature-settings: "tnum"; }
.hero__ring .label span { font-family: var(--mono); font-size: .58rem; letter-spacing: .18em; text-transform: uppercase; color: var(--risk-c); margin-top: .35rem; }

/* two-column body: editorial stack + sticky signals rail */
.ov { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 1.1rem; align-items: start; }
.ov__main { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }

/* borderless KPI strip */
.kpi-strip { display: flex; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.kpi { flex: 1 1 0; min-width: 0; padding: 1.1rem 1.25rem; display: flex; flex-direction: column; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi__k { font-family: var(--mono); font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi__v { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; margin: .5rem 0 .35rem; font-feature-settings: "tnum"; }
.kpi__d { font-family: var(--mono); font-size: .64rem; color: var(--muted); }
.kpi__d--brand { color: var(--brand-ink); }
.kpi__d--crit { color: var(--crit); }

/* card shells (spark + entries) */
.spark-card, .entries-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: .92rem; font-weight: 600; }
.card-head .mono--sm { margin: 0; }

.spark-card { padding: 1.3rem 1.4rem 1rem; }
.spark { width: 100%; height: 188px; margin-top: 1rem; overflow: visible; display: block; }
.spark .area { fill: url(#spark-grad); }
.spark .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--brand-wash)); }

/* recent entries grid */
.entries-card { overflow: hidden; }
.entries-card .card-head { padding: 1.2rem 1.4rem .9rem; }
.entries-row { display: grid; grid-template-columns: 1.5fr 1fr .9fr .7fr; align-items: center; gap: .6rem; padding: .8rem 1.4rem; border-top: 1px solid var(--line); }
.entries-row span:nth-child(3), .entries-row span:nth-child(4) { text-align: right; }
.entries-row .v { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entries-row .r, .entries-row .a { font-family: var(--mono); font-size: .76rem; color: var(--ink-soft); }
.entries-row--head { border-top: none; padding-top: 0; padding-bottom: .7rem; }
.entries-row--head span { font-family: var(--mono); font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.entries-empty { padding: 1.6rem 1.4rem 1.9rem; text-align: center; color: var(--muted); border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 1rem; }

/* sticky live-signals rail */
.rail {
  position: sticky; top: 92px; align-self: start;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
  overflow: hidden; max-height: calc(100vh - 116px);
}
.rail__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.2rem .9rem; border-bottom: 1px solid var(--line); }
.rail__head h3 { font-size: .92rem; font-weight: 600; }
.rail__count { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-ink); }
.rail__count .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: pulse 1.8s ease-in-out infinite; }
.rail__list { flex: 1 1 auto; overflow-y: auto; }
.signal { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); transition: background .15s; }
.signal:hover { background: var(--brand-wash); }
.signal .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; margin-top: .35rem; }
.signal__b { flex: 1 1 auto; min-width: 0; }
.signal__t { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal__m { font-family: var(--mono); font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: .25rem; }
.signal__s { font-family: var(--mono); font-size: .82rem; font-weight: 600; flex: 0 0 auto; }
.rail__empty { padding: 2.2rem 1.4rem; text-align: center; color: var(--muted); font-size: .86rem; }
.rail__pin { width: 100%; text-align: left; border: none; border-top: 1px solid var(--brand); background: var(--brand-wash); padding: 1.1rem 1.2rem; transition: background .15s; }
.rail__pin:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.rail__pin h4 { font-size: 1rem; font-weight: 700; line-height: 1.3; margin: .5rem 0 .4rem; }
.rail__pin p { font-size: .8rem; color: var(--ink-soft); line-height: 1.5; }
.rail__pin .tags { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .8rem; }

/* ───────────── responsive ───────────── */
@media (max-width: 1100px) {
  .risk-hero { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
  .ov { grid-template-columns: 1fr; }
  .rail { position: static; max-height: none; }
  .hero__row { flex-direction: column-reverse; align-items: flex-start; }
}
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr; }
  .kpi-strip { flex-wrap: wrap; }
  .kpi { flex: 1 1 45%; }
  .kpi:nth-child(3) { border-left: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .8rem; }
  .side__brand { border-bottom: none; padding: 0; }
  .side__tagline { display: none; }
  .side__nav { flex-direction: row; flex-wrap: wrap; flex: 1; gap: .3rem; }
  .nav-section { flex-direction: row; align-items: center; }
  .nav-section + .nav-section { margin-top: 0; }
  .nav-section__label { display: none; }
  .side__foot { margin: 0; border: none; padding: 0; }
}
@media (max-width: 560px) {
  .alert { flex-wrap: wrap; }
  .alert__body { flex-basis: 100%; order: 3; }
  .alert__side { align-items: flex-start; }
  .alert__actions { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; } }
