/* PATH4AIPOCUS dashboard
   One bold element: the ultrasound fan on the hero and sign-in. Everything else stays quiet. */

:root {
  color-scheme: light;
  --bg: #f1f5f4;
  --surface: #ffffff;
  --ink: #0f2a2e;
  --ink-2: #425558;
  --muted: #5f7275;
  --line: #dce4e2;
  --tint: #eaf1ef;
  --rail: #0b2326;
  --rail-ink: #e6f0ee;
  --rail-muted: #8fb0ac;
  --phosphor: #6fd6bd;
  --focus: #1c5cab;
  --good: #0d7a4a;
  --down: #b0441a;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --seq-100: #cde2fb; --seq-300: #6da7ec; --seq-450: #2a78d6; --seq-600: #184f95;
  --bar: #2a78d6;
  --bar-dim: #b7d3f6;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --dark: 1; }
}
:root[data-theme="dark"],
:root:not([data-theme="light"]) .dark-probe { }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #091214; --surface: #111f21; --ink: #e6f0ee; --ink-2: #b4c7c4; --muted: #8aa09d;
    --line: #223634; --tint: #172a2b; --rail: #061a1c; --focus: #86b6ef;
    --good: #4cc38a; --down: #f0875f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --bar: #3987e5; --bar-dim: #184f95;
    --seq-100: #104281; --seq-300: #1c5cab; --seq-450: #2a78d6; --seq-600: #86b6ef;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #091214; --surface: #111f21; --ink: #e6f0ee; --ink-2: #b4c7c4; --muted: #8aa09d;
  --line: #223634; --tint: #172a2b; --rail: #061a1c; --focus: #86b6ef;
  --good: #4cc38a; --down: #f0875f;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --bar: #3987e5; --bar-dim: #184f95;
  --seq-100: #104281; --seq-300: #1c5cab; --seq-450: #2a78d6; --seq-600: #86b6ef;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 20px 0 8px; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; margin-top: 24px; }
.num { text-align: right; }
.end { text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Shell ───────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--rail); color: var(--rail-ink); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 24px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px 28px; font-weight: 600; letter-spacing: .01em; font-size: 14px; }
.brand b { color: var(--phosphor); font-weight: 700; }
.brand-mark { width: 26px; height: 26px; color: var(--phosphor); flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--rail-muted); font-weight: 500; }
.nav a:hover { color: var(--rail-ink); background: rgba(255,255,255,.06); }
.nav a.on { color: var(--rail-ink); background: rgba(111,214,189,.14); box-shadow: inset 2px 0 0 var(--phosphor); }
.rail-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.who { display: flex; flex-direction: column; margin-bottom: 12px; min-width: 0; }
.who-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 13px; color: var(--rail-muted); }
.rail-actions { display: flex; gap: 16px; }
.ghost { background: none; border: 0; padding: 0; color: var(--rail-muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ghost:hover { color: var(--rail-ink); }
.main { min-width: 0; }

/* ── Filter bar ──────────────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px;
  padding: 20px 32px; border-bottom: 1px solid var(--line);
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-right: 8px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.filters label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.custom { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
select, input[type=date], input[type=email], input[type=search], textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
select { padding-right: 28px; }
textarea { width: 100%; resize: vertical; }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.fresh { font-size: 13px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  min-height: 38px; padding: 8px 14px; border-radius: 8px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
}
.btn:hover { border-color: var(--muted); }
.btn.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.wide { width: 100%; }
.ghost-btn { background: transparent; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 140px; }
.menu-list a { display: block; padding: 8px 12px; border-radius: 6px; text-decoration: none; }
.menu-list a:hover { background: var(--tint); }

.content { padding: 32px; display: flex; flex-direction: column; gap: 24px; max-width: 1480px; }

/* ── Hero (the one bold element) ─────────────────────── */
.hero {
  position: relative; overflow: hidden; border-radius: 20px;
  background: var(--rail); color: var(--rail-ink); padding: 44px 48px; min-height: 220px;
}
.fan { position: absolute; top: 0; right: 0; width: 64%; height: 100%; color: var(--phosphor); opacity: .7; pointer-events: none; }
.hero-main { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px 64px; align-items: flex-end; }
.hero-label { font-size: 15px; color: var(--rail-muted); }
.hero-value { font-size: clamp(56px, 8vw, 96px); line-height: 1; font-weight: 700; letter-spacing: -0.04em; margin: 8px 0 10px; }
.hero-sub { color: var(--rail-muted); max-width: 46ch; }
.hero-delta { display: inline-block; margin-top: 12px; color: var(--phosphor); font-weight: 600; }
.hero-delta.down { color: #f6a07e; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px 40px; }
.hero-stat dt { color: var(--rail-muted); font-size: 13px; }
.hero-stat dd { margin: 2px 0 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.hero-stat small { display: block; font-size: 13px; font-weight: 400; color: var(--rail-muted); letter-spacing: 0; }

/* ── Tiles ───────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.tile-title { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.tile-value { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.tile-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 8px; min-height: 28px; }
.delta { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--down); }
.delta small { font-weight: 400; color: var(--muted); }
.spark { width: 80px; height: 28px; flex: none; max-width: 100%; }
.spark path { fill: none; stroke: var(--bar); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }

/* ── Panels ──────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.chart { width: 100%; height: 280px; }
.chart.tall { height: 340px; }
.link { font-size: 14px; color: var(--focus); }
.tabs { display: flex; flex-wrap: wrap; max-width: 100%; gap: 4px; background: var(--tint); padding: 3px; border-radius: 9px; }
.tabs button { font: inherit; font-size: 13px; font-weight: 500; border: 0; background: none; color: var(--ink-2); padding: 6px 9px; white-space: nowrap; border-radius: 7px; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.empty { color: var(--muted); padding: 24px 0; max-width: 52ch; }
.skeleton { background: var(--tint); border-radius: 12px; width: 100%; }

/* ── Rankings ────────────────────────────────────────── */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px 48px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rank li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(80px, 1fr) 72px; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { display: block; color: var(--muted); font-size: 13px; }
.rank-track { height: 8px; background: var(--tint); border-radius: 4px; overflow: hidden; }
.rank-fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
.rank-val { text-align: right; font-weight: 600; }

/* ── Tables ──────────────────────────────────────────── */
.scroll { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th.num { text-align: right; }
.grid th button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; font-weight: inherit; }
.grid th button:hover { color: var(--ink); }
.grid th[aria-sort] button { color: var(--ink); }
.grid td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid td.wrap { max-width: 36ch; }
.grid tbody tr.click { cursor: pointer; }
.grid tbody tr.click:hover td { background: var(--tint); }
.grid.compact td, .grid.compact th { padding: 8px 12px; }
.grid .name { font-weight: 600; }
.grid .name small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.dot.ok { background: var(--good); }
.dot.stale { background: var(--s4); border-radius: 2px; transform: rotate(45deg); }
.dot.bad, .dot.never { background: var(--down); border-radius: 1px; }
.search { width: min(320px, 100%); }
.matrix td { position: relative; }
.matrix td.heat { background: linear-gradient(to left, var(--tint) var(--w, 0%), transparent var(--w, 0%)); }
.inline { display: inline-flex; gap: 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

/* ── States ──────────────────────────────────────────── */
.state-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.state-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.state-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.state-card h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.state-hero { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.state-hero small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 6px; }
.state-spark { width: 100%; height: 48px; }
.state-spark path.l { fill: none; stroke: var(--bar); stroke-width: 1.75; }
.state-spark path.a { fill: var(--bar); opacity: .12; stroke: none; }
.state-list { margin: 0; display: grid; gap: 6px; }
.state-list div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.state-list dt { color: var(--ink-2); }
.state-list dd { margin: 0; font-weight: 600; }
.coverage { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }

/* ── Quality ─────────────────────────────────────────── */
.form-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.form-card h2 { text-transform: none; display: flex; align-items: center; justify-content: space-between; }
.form-card .big { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; }
.form-card p { color: var(--muted); font-size: 13px; }
.form-card p.big { color: var(--ink); font-size: 30px; }
.form-card .err { color: var(--down); margin-top: 8px; }
.ok-line { display: flex; align-items: center; color: var(--ink-2); padding: 8px 0; }

/* ── Drawer ──────────────────────────────────────────── */
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100%); z-index: 40;
  background: var(--surface); border-left: 1px solid var(--line); padding: 28px; overflow-y: auto;
  transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .22s ease; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.drawer h2 { font-size: 20px; }
.scrim { position: fixed; inset: 0; background: rgba(5, 20, 22, .45); z-index: 30; }
.mini-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.mini { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mini span { display: block; font-size: 13px; color: var(--muted); }
.mini b { font-size: 24px; letter-spacing: -0.02em; }

/* ── Sign-in and message pages ───────────────────────── */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.gate.single { grid-template-columns: 1fr; place-items: center; padding: 24px; }
.gate-art { position: relative; background: var(--rail); color: var(--phosphor); overflow: hidden; display: flex; align-items: flex-end; padding: 56px; }
.gate-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.gate-line { position: relative; color: var(--rail-ink); font-size: 26px; line-height: 1.25; letter-spacing: -0.01em; max-width: 20ch; font-weight: 500; }
.gate-form { align-self: center; justify-self: center; width: min(420px, 100% - 48px); display: grid; gap: 16px; padding: 48px 0; }
.gate.single .gate-form { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 40px; width: min(480px, 100%); }
.gate-form h1 { font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; }
.lede { color: var(--ink-2); }
.notice { background: var(--tint); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.dev { display: grid; gap: 12px; margin-top: 16px; padding-top: 24px; border-top: 1px solid var(--line); }
.dev label, .gate-form form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.gate-form form { display: grid; gap: 12px; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .rank { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; }
  .brand { padding: 0; }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; }
  .nav a.on { box-shadow: none; }
  .rail-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .who { display: none; }
  .bar { position: static; padding: 16px; }
  .bar-end { margin-left: 0; width: 100%; }
  .content { padding: 16px; }
  .hero { padding: 28px 24px; }
  .two { grid-template-columns: 1fr; }
  .gate { grid-template-columns: 1fr; }
  .gate-art { min-height: 200px; padding: 28px; }
  .gate-line { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer.open { transition: none; }
}
