/* Compass — design system.
   Wayfinding, not dashboard: high-contrast ink on paper, one accent per track,
   and typography tight enough that a dense map still reads. */

:root {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --surface-2: #F0F0EE;
  --ink: #16181D;
  --ink-2: #4A4F58;
  --ink-3: #7C838F;
  --line: #E0E1DE;
  --line-strong: #C9CBC7;
  --accent: #1B6BC9;
  --accent-soft: #E8F0FB;

  --risk-low: #1F9D55;
  --risk-moderate: #D99100;
  --risk-high: #E2622C;
  --risk-very-high: #CE2B37;

  --track-demo: #2196F3;

  --grid: rgba(22, 24, 29, .05);
  --grid-strong: rgba(22, 24, 29, .10);
  --band: rgba(22, 24, 29, .022);

  --shadow-sm: 0 1px 2px rgba(16, 18, 22, .06), 0 2px 8px rgba(16, 18, 22, .05);
  --shadow-lg: 0 2px 6px rgba(16, 18, 22, .07), 0 20px 48px rgba(16, 18, 22, .16);

  --radius: 10px;
  --radius-lg: 16px;
  --topbar-h: 58px;

  --sans: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0F1115;
  --surface: #171A20;
  --surface-2: #1E2229;
  --ink: #ECEEF1;
  --ink-2: #AEB5BF;
  --ink-3: #7A828E;
  --line: #272C34;
  --line-strong: #39404A;
  --accent: #5AA9F8;
  --accent-soft: #17263A;

  --risk-low: #3BC47B;
  --risk-moderate: #E8B33C;
  --risk-high: #F2854B;
  --risk-very-high: #F2545B;

  --grid: rgba(236, 238, 241, .05);
  --grid-strong: rgba(236, 238, 241, .10);
  --band: rgba(236, 238, 241, .02);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .4), 0 24px 56px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

/* A class rule carrying `display` outranks the UA stylesheet's
   `[hidden] { display: none }`, so `.onboarding { display: grid }` would keep a
   hidden element in the layout. Everything here toggles visibility via the
   hidden attribute, so make it win. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -.015em; }

/* ============================ Onboarding ============================ */

.onboarding {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1100px 520px at 15% -10%, var(--accent-soft), transparent 62%),
    var(--bg);
}
.onboarding-inner { width: 100%; max-width: 620px; }

.brand { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 34px; }
.brand-mark { width: 46px; height: 46px; flex: none; color: var(--accent); margin-top: 2px; }
.brand h1 { font-size: 30px; letter-spacing: -.03em; }
.tagline { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; max-width: 46ch; }

.start-form { display: flex; flex-direction: column; gap: 14px; }
.field-row { display: flex; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.field-narrow { flex: 0 1 232px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.field-label em { font-style: normal; color: var(--ink-3); font-weight: 500; }
.char-count { float: right; font-family: var(--mono); font-size: 11px; }
.char-count[data-warm="true"] { color: var(--risk-moderate); }

.field input {
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 12px 14px; outline: none; width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }

.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: -2px; }
.examples-label { font-size: 12px; color: var(--ink-3); margin-right: 2px; }
.example-chip {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 100px; padding: 5px 11px; font-size: 12.5px; color: var(--ink-2);
  transition: all .14s;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.primary-btn {
  margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--radius);
  padding: 13px 22px; font-weight: 620; font-size: 15px;
  transition: transform .12s, opacity .14s;
}
.primary-btn:hover { opacity: .9; }
.primary-btn:active { transform: translateY(1px); }
.primary-btn[disabled] { opacity: .55; cursor: progress; }
.btn-arrow { width: 15px; height: 15px; }

.form-note { margin: 0; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.form-error {
  margin: 0; padding: 10px 13px; font-size: 13.5px;
  background: color-mix(in srgb, var(--risk-very-high) 12%, transparent);
  color: var(--risk-very-high); border-radius: var(--radius);
}
.onboarding-foot { margin-top: 28px; text-align: center; }
.link-btn {
  background: none; border: none; color: var(--ink-3);
  font-size: 12.5px; text-decoration: underline; text-underline-offset: 3px; padding: 4px;
}
.link-btn:hover { color: var(--accent); }

.pw-hint { font-size: 11.5px; color: var(--ink-3); }
.pw-hint[data-level="weak"] { color: var(--risk-high); }
.pw-hint[data-level="ok"] { color: var(--risk-moderate); }
.pw-hint[data-level="strong"] { color: var(--risk-low); }

/* Legal pages share the onboarding shell */
.legal-page { max-width: 640px; }
.legal-page h1 { font-size: 27px; margin: 14px 0 2px; }
.legal-page h2 { font-size: 16px; margin: 22px 0 8px; }
.legal-page p, .legal-page li { font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.legal-page ul { padding-left: 20px; }
.legal-page a { color: var(--accent); }
.legal-updated { font-size: 12px; color: var(--ink-3); }

.verify-banner {
  background: color-mix(in srgb, var(--risk-moderate) 14%, var(--surface));
  border-bottom: 1px solid var(--line);
  padding: 7px 16px; font-size: 12.5px; color: var(--ink-2); text-align: center;
}
.verify-banner .link-btn { color: var(--accent); font-size: 12.5px; }

.danger-zone { border-color: color-mix(in srgb, var(--risk-very-high) 40%, var(--line-strong)) !important; }
.danger-zone summary { color: var(--risk-very-high) !important; }

/* ============================== Shell ============================== */

.app { height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  z-index: 40;
}
.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 6px 8px; border-radius: 8px;
  font-weight: 660; letter-spacing: -.02em; color: var(--accent);
}
.topbar-brand svg { width: 22px; height: 22px; }
.topbar-brand:hover { background: var(--surface-2); }
.brand-tag {
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  letter-spacing: .01em; margin-left: 2px; padding-top: 3px;
}
@media (max-width: 1080px) { .brand-tag { display: none; } }

.position-chip {
  display: flex; align-items: center; gap: 9px;
  margin-left: 4px; padding: 5px 13px 5px 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 100px; min-width: 0;
}
.pulse {
  width: 8px; height: 8px; flex: none; border-radius: 50%;
  background: var(--risk-low); box-shadow: 0 0 0 0 color-mix(in srgb, var(--risk-low) 60%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--risk-low) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.position-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.position-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.position-text span { font-size: 11.5px; color: var(--ink-3); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 7px 12px; font-size: 13.5px; font-weight: 550;
  transition: all .13s;
}
.ghost-btn svg { width: 12px; height: 12px; }
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; font-size: 15px; line-height: 1;
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.badge {
  background: var(--accent); color: #fff; border-radius: 100px;
  padding: 1px 6px; font-size: 11px; font-weight: 660; min-width: 18px; text-align: center;
}

.stage { flex: 1; position: relative; overflow: hidden; }

/* ============================== Legend ============================== */

.legend {
  position: absolute; top: 14px; left: 14px; z-index: 25;
  width: 244px; max-height: calc(100% - 28px); overflow: auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.legend-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; padding: 12px 14px;
  font-size: 12.5px; font-weight: 680; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2);
}
.legend-toggle svg { width: 12px; height: 12px; transition: transform .18s; }
.legend[data-collapsed="true"] .legend-toggle svg { transform: rotate(-90deg); }
.legend[data-collapsed="true"] .legend-body { display: none; }
.legend-body { padding: 0 14px 14px; }

.encoding { margin: 0 0 12px; display: flex; flex-direction: column; gap: 5px; }
.encoding > div { display: flex; gap: 8px; align-items: baseline; }
.encoding dt {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--ink); min-width: 58px; flex: none;
}
.encoding dd { margin: 0; font-size: 12.5px; color: var(--ink-2); }

.risk-key {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-2);
  padding: 9px 0 11px; border-top: 1px solid var(--line);
}
.risk-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 5px; }
.risk-dot:first-child { margin-left: 0; }
.risk-dot[data-band="low"] { background: var(--risk-low); }
.risk-dot[data-band="moderate"] { background: var(--risk-moderate); }
.risk-dot[data-band="high"] { background: var(--risk-high); }
.risk-dot[data-band="very-high"] { background: var(--risk-very-high); }

.interchange-key {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 11.5px; color: var(--ink-2); line-height: 1.42;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.interchange-key svg { width: 26px; height: 26px; flex: none; margin-top: -2px; }

.lines { display: flex; flex-direction: column; gap: 1px; padding-top: 8px; border-top: 1px solid var(--line); }
.line-item {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 6px; border-radius: 6px; font-size: 12.5px; color: var(--ink-2);
  background: none; border: none; width: 100%; text-align: left;
}
.line-item:hover { background: var(--surface-2); color: var(--ink); }
.line-item[data-dim="true"] { opacity: .38; }
.line-item[data-faded="true"] { opacity: .45; }
.line-more { color: var(--accent); font-weight: 570; }
.line-more:hover { background: var(--accent-soft); }
.line-swatch { width: 15px; height: 4px; border-radius: 2px; flex: none; }
.line-count { margin-left: auto; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.pivot-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.pivot-toggle input { accent-color: var(--accent); }

/* =============================== Map =============================== */

.map-wrap { position: absolute; inset: 0; overflow: hidden; cursor: grab; }
.map-wrap.dragging { cursor: grabbing; }
.map { width: 100%; height: 100%; display: block; touch-action: none; }

.map-controls {
  position: absolute; right: 14px; bottom: 14px; z-index: 20;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.map-controls .icon-btn { box-shadow: var(--shadow-sm); }

/* Timeline-detail switcher: how much time the first gridline covers. */
.tzoom {
  display: flex; gap: 1px; padding: 2px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow-sm); margin-bottom: 4px;
}
.tzoom button {
  background: none; border: none; border-radius: 6px;
  padding: 4px 9px; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.tzoom button:hover { color: var(--ink); }
.tzoom button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.map-empty {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 16px; text-align: center;
  box-shadow: var(--shadow-sm); max-width: 380px;
}
.map-empty p { margin: 0; font-size: 13.5px; font-weight: 560; }
.map-empty span { font-size: 12px; color: var(--ink-3); }

/* SVG internals */
.axis-label { font-size: 10.5px; fill: var(--ink-3); font-family: var(--mono); }
.axis-label-strong { font-size: 11px; fill: var(--ink-2); font-weight: 600; font-family: var(--mono); }
.grid-line { stroke: var(--grid); stroke-width: 1; }
.grid-line-strong { stroke: var(--grid-strong); stroke-width: 1; }
.band-rect { fill: var(--band); }

.edge { fill: none; stroke-linecap: round; stroke-linejoin: round; transition: opacity .18s; }
.edge-pivot { stroke-dasharray: 1 7; }
.edge-halo { stroke: var(--bg); stroke-linecap: round; stroke-linejoin: round; fill: none; }

.station { cursor: pointer; }
.station .station-hit { cursor: pointer; }

/* Floating hint that follows the pointer over stations and via-markers. */
.map-tooltip {
  position: absolute; z-index: 35; pointer-events: none;
  background: var(--ink); color: var(--bg);
  font-size: 11.5px; font-weight: 550; line-height: 1.3;
  padding: 5px 9px; border-radius: 7px; max-width: 260px;
  box-shadow: var(--shadow-sm); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.via-marker { pointer-events: all; }
.station-core { transition: r .16s ease, stroke-width .16s ease; }
.station-label {
  font-size: 11.5px; font-weight: 560; fill: var(--ink);
  paint-order: stroke; stroke: var(--bg); stroke-width: 3.5px; stroke-linejoin: round;
  pointer-events: none;
}
.station-sub {
  font-size: 10px; fill: var(--ink-3); font-family: var(--mono);
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round;
  pointer-events: none;
}
/* Hover must not move geometry under the pointer -- a size change re-tests
   hit targets mid-hover and the cursor flickers. Stroke thickening only. */
.station:hover .station-core { stroke-width: 5.5; }
.station[data-dim="true"] { opacity: .16; }
.station[data-dim="true"] .station-hit { pointer-events: none; }
.edge[data-dim="true"] { opacity: .07; }

.you-are-here-ring {
  fill: none; stroke: var(--accent); stroke-width: 2.5; opacity: .85;
}
.you-are-here-pin { fill: var(--accent); }
.you-are-here-text {
  font-size: 10px; font-weight: 700; fill: var(--accent);
  letter-spacing: .08em; text-transform: uppercase;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px;
}

/* ============================== Drawer ============================== */

.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(456px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow-y: auto; overscroll-behavior: contain;
  animation: slide-in .22s cubic-bezier(.22, .61, .36, 1);
}
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } }

.drawer-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 17px; line-height: 1; display: grid; place-items: center;
}
.drawer-close:hover { border-color: var(--accent); color: var(--accent); }
.drawer-content { padding: 20px 22px 40px; }

.drawer-head { margin-bottom: 16px; padding-right: 36px; }
.track-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 660; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 7px;
}
.track-tag i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.drawer-head h2 { font-size: 21px; letter-spacing: -.025em; line-height: 1.2; }
.drawer-head .summary { margin: 8px 0 0; color: var(--ink-2); font-size: 13.5px; }

.tabs { display: flex; gap: 2px; margin: 16px 0 16px; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; padding: 8px 11px 9px;
  font-size: 13px; font-weight: 570; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.section { margin-bottom: 22px; }
.section-title {
  font-size: 11px; font-weight: 680; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 9px;
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 13px;
}
.stat-label { font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.stat-value { font-size: 18px; font-weight: 660; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* pay ribbon */
.pay-ribbon { margin-top: 10px; }
.pay-track {
  position: relative; height: 8px; border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2), var(--line-strong));
  margin: 20px 0 6px;
}
.pay-fill { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); opacity: .28; }
.pay-marker { position: absolute; top: -4px; width: 3px; height: 16px; border-radius: 2px; background: var(--accent); }
.pay-marker::after {
  content: attr(data-label); position: absolute; top: -17px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 640; color: var(--accent); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pay-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.source-note { font-size: 11px; color: var(--ink-3); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.source-badge {
  border: 1px solid var(--line-strong); border-radius: 100px;
  padding: 1px 7px; font-size: 10px; font-weight: 620; text-transform: uppercase; letter-spacing: .04em;
}
.source-badge[data-measured="false"] { color: var(--risk-moderate); border-color: color-mix(in srgb, var(--risk-moderate) 45%, transparent); }
.source-badge[data-measured="true"] { color: var(--risk-low); border-color: color-mix(in srgb, var(--risk-low) 45%, transparent); }

.trend-row {
  display: flex; gap: 12px; align-items: center;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
.trend-row svg { flex: none; }
.trend-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.trend-note strong { color: var(--ink-2); }

/* rows */
.row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 13.5px; font-weight: 570; }
.row-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.row-value { font-size: 13px; font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  display: inline-block; font-size: 10.5px; font-weight: 640;
  padding: 2px 7px; border-radius: 100px; letter-spacing: .02em;
}
.pill[data-kind="required"] { background: color-mix(in srgb, var(--risk-very-high) 13%, transparent); color: var(--risk-very-high); }
.pill[data-kind="usual"] { background: color-mix(in srgb, var(--risk-moderate) 15%, transparent); color: var(--risk-moderate); }
.pill[data-kind="edge"] { background: var(--surface-2); color: var(--ink-3); }
.pill[data-kind="advance"] { background: color-mix(in srgb, var(--risk-low) 14%, transparent); color: var(--risk-low); }
.pill[data-kind="pivot"] { background: var(--accent-soft); color: var(--accent); }
.pill[data-kind="lateral"], .pill[data-kind="entry"] { background: var(--surface-2); color: var(--ink-2); }
.pill[data-conf="thin"] { background: color-mix(in srgb, var(--risk-high) 13%, transparent); color: var(--risk-high); }

.route-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 10px 0; text-align: left;
}
.route-btn:last-of-type { border-bottom: none; }
.route-btn:hover .row-title { color: var(--accent); }
.route-arrow { color: var(--ink-3); font-size: 15px; }
.route-btn:hover .route-arrow { color: var(--accent); }

/* exposure */
.exposure-head { display: flex; align-items: center; gap: 15px; margin-bottom: 14px; }
.exposure-dial { position: relative; width: 78px; height: 78px; flex: none; }
.exposure-dial svg { transform: rotate(-90deg); }
.exposure-dial-value {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 20px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.exposure-blurb { flex: 1; }
.exposure-band { font-size: 12px; font-weight: 680; text-transform: uppercase; letter-spacing: .05em; }
.exposure-band[data-band="low"] { color: var(--risk-low); }
.exposure-band[data-band="moderate"] { color: var(--risk-moderate); }
.exposure-band[data-band="high"] { color: var(--risk-high); }
.exposure-band[data-band="very-high"] { color: var(--risk-very-high); }
.exposure-blurb p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }

.task-bar { margin-bottom: 9px; }
.task-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 4px; }
.task-bar-head span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; flex: none; }
.task-meter { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: flex; }
.task-meter i { display: block; height: 100%; }
.task-note { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.guidance { border-left: 2.5px solid var(--line-strong); padding: 2px 0 2px 12px; margin-bottom: 13px; }
.guidance[data-kind="lean-in"] { border-color: var(--risk-low); }
.guidance[data-kind="at-risk"] { border-color: var(--risk-high); }
.guidance-kind { font-size: 10.5px; font-weight: 680; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.guidance-task { font-size: 13px; font-weight: 570; margin: 2px 0 3px; }
.guidance-advice { font-size: 12.5px; color: var(--ink-2); }

.callout {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 11px 13px; font-size: 12.5px; color: var(--ink-2); margin-top: 12px;
}
.callout strong { color: var(--ink); }

.cta-row { display: flex; gap: 9px; margin-top: 18px; }
.cta-row button { flex: 1; }
.solid-btn {
  background: var(--ink); color: var(--bg); border: none;
  border-radius: var(--radius); padding: 11px 16px; font-weight: 600; font-size: 13.5px;
}
.solid-btn:hover { opacity: .9; }
.outline-btn {
  background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: var(--radius); padding: 11px 16px; font-weight: 570; font-size: 13.5px;
}
.outline-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============================== Modal ============================== */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 12, 16, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 22px;
  animation: fade .16s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(720px, 100%); max-height: min(86vh, 900px); overflow-y: auto;
  animation: rise .2s cubic-bezier(.22, .61, .36, 1);
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.modal-close {
  position: absolute; top: 13px; right: 13px; z-index: 2;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 17px;
  display: grid; place-items: center;
}
.modal-content { padding: 24px 26px 28px; }
.modal-content h3 { font-size: 19px; letter-spacing: -.02em; padding-right: 34px; }
.modal-sub { color: var(--ink-2); font-size: 13.5px; margin: 6px 0 18px; }

/* journey / simulation */
.journey { position: relative; padding-left: 26px; margin: 4px 0 18px; }
.journey::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px;
  width: 2.5px; background: var(--line-strong); border-radius: 2px;
}
.leg { position: relative; padding: 0 0 20px; }
.leg:last-child { padding-bottom: 4px; }
.leg::before {
  content: ""; position: absolute; left: -23px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--line-strong);
}
.leg[data-terminal="true"]::before { background: var(--accent); border-color: var(--accent); }
.leg-title { font-size: 14px; font-weight: 600; }
.leg-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }

.branch-group { margin-bottom: 20px; }
.branch-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 3px; }
.branch-head h4 { font-size: 14.5px; }
.branch-blurb { font-size: 12px; color: var(--ink-3); margin: 0 0 8px; }
.branch-option {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 13px; margin-bottom: 6px; text-align: left;
  transition: all .13s;
}
.branch-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.branch-option .row-main { min-width: 0; }
.delta { font-size: 12px; font-weight: 640; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta[data-sign="up"] { color: var(--risk-low); }
.delta[data-sign="down"] { color: var(--risk-high); }

/* past-role capture */
.history-add {
  margin-bottom: 14px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); padding: 9px 13px;
}
.history-add summary {
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; font-weight: 550;
}
.history-add summary:hover { color: var(--accent); }
.history-add[open] { border-style: solid; }

/* diary */
.diary-entry {
  display: flex; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.diary-entry:last-child { border-bottom: none; }
.diary-date {
  flex: none; width: 84px; font-size: 11.5px; color: var(--ink-3);
  font-family: var(--mono); padding-top: 2px;
}
.diary-body { flex: 1; min-width: 0; }
.diary-headline { font-size: 13.5px; }
.diary-headline strong { font-weight: 620; }
.diary-note {
  margin: 6px 0 0; font-size: 13px; color: var(--ink-2);
  background: var(--surface-2); border-radius: 8px; padding: 9px 11px;
  white-space: pre-wrap; word-break: break-word;
}
.diverged-tag {
  display: inline-block; margin-top: 5px; font-size: 11px;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 100px; padding: 2px 9px;
}

/* forms in modal */
.modal-form { display: flex; flex-direction: column; gap: 13px; }
.modal-form textarea {
  font: inherit; background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 11px 13px; resize: vertical; min-height: 88px; outline: none; width: 100%;
}
.modal-form textarea:focus, .modal-form input:focus, .modal-form select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft);
}
.modal-form input, .modal-form select {
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 11px 13px; outline: none; width: 100%;
}
.role-picker { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.role-option {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 9px 13px; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.role-option:last-child { border-bottom: none; }
.role-option:hover, .role-option[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.role-option small { display: block; color: var(--ink-3); font-size: 11.5px; }
.role-option:hover small { color: inherit; opacity: .8; }

/* search list / outreach */
.search-item {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; margin-bottom: 8px;
}
.search-item-head { display: flex; align-items: baseline; gap: 9px; }
.search-item-head h5 { margin: 0; font-size: 13.5px; font-weight: 600; flex: 1; }
.search-count { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.search-detail { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 0; }
.search-link {
  display: inline-block; margin-top: 7px; font-size: 12.5px;
  color: var(--accent); text-decoration: none; font-weight: 560;
}
.search-link:hover { text-decoration: underline; }

.template { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.template-head {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.template-head h5 { margin: 0; font-size: 12.5px; font-weight: 640; flex: 1; }
.template-limit { font-size: 11px; color: var(--ink-3); }
.template-body {
  margin: 0; padding: 11px 12px; font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; font-family: inherit; color: var(--ink-2);
}
.copy-btn {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 3px 9px; font-size: 11.5px; font-weight: 560;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.checklist { margin: 0; padding: 0; list-style: none; }
.checklist li {
  position: relative; padding: 0 0 7px 20px; font-size: 12.5px; color: var(--ink-2);
}
.checklist li::before {
  content: ""; position: absolute; left: 4px; top: 7px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3);
}

.disclaimer {
  font-size: 11.5px; color: var(--ink-3); font-style: italic;
  border-top: 1px solid var(--line); padding-top: 11px; margin-top: 14px;
}

/* provenance table */
.prov-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.prov-table th, .prov-table td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.prov-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 620; }
.prov-table td:last-child, .prov-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: var(--bg);
  border-radius: 100px; padding: 9px 18px; font-size: 13px; font-weight: 550;
  box-shadow: var(--shadow-lg); animation: rise .2s;
}

.empty-note { font-size: 12.5px; color: var(--ink-3); font-style: italic; padding: 6px 0; }

/* ============================ Responsive ============================ */

@media (max-width: 900px) {
  .legend { width: 210px; }
  .drawer { width: 100%; }
  .field-row { flex-direction: column; }
  .field-narrow { flex: 1 1 auto; }
  .position-chip { display: none; }
}
@media (max-width: 620px) {
  .legend { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; max-height: 46%; }
  .map-controls { bottom: auto; top: 12px; right: 12px; flex-direction: row; }
  .stat-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
