/* ============================================================
   ARGUS — design tokens.  Every color lives here and ONLY here.
   No hex value appears anywhere else in this stylesheet.
   ============================================================ */
:root {
  /* --- palette (design_system_brief.md §2 / build_tasks.md 1.1) --- */
  --bg-base: #0A0E14;          /* map canvas + panel — one surface        */
  --bg-panel: #0A0E14;         /* sidebar reads as the same surface        */
  --bg-raised: #10151F;        /* toolbar / input fills, barely lifted     */
  --accent-primary: #2F7DF6;   /* "live / on / actionable" — default state */
  --accent-risk: #F5A623;      /* amber — RISK / caution                   */
  --accent-attack: #E5484D;    /* red — ATTACK / BREAK / alert             */
  --accent-clear: #3DD68C;     /* green — CLEAR verdict (revision R2)      */
  --accent-identity: #4FD1C5;  /* cyan — vessel type / identity text       */
  --text-primary: #F2F3F5;     /* titles, values, map labels              */
  --text-muted: #8B92A0;       /* field labels, captions, timestamps      */
  --zone-fill: #C9B896;        /* tan — map zone polygons                 */
  --border-blue: #2F7DF6;      /* thin map frame + panel accent edge      */
  --toggle-off: #2A2F3A;       /* inactive toggle track                   */
  --hairline: #1C2230;         /* dividers, grid lines                    */
  --on-accent: #FFFFFF;        /* text on a saturated accent fill         */
  --on-risk: #1A1206;          /* dark text on the amber fill             */

  /* speed / severity gradient — a semantic scale, 0–18 kn legend */
  --grad-0: #3FB950;   /* green  */
  --grad-1: #D9C441;   /* yellow */
  --grad-2: #E8873B;   /* orange */
  --grad-3: #E5484D;   /* red    */

  /* rgb triplets — for translucent fills only (no hex needed downstream) */
  --bg-base-rgb: 10, 14, 20;
  --accent-primary-rgb: 47, 125, 246;
  --accent-risk-rgb: 245, 166, 35;
  --accent-attack-rgb: 229, 72, 77;
  --accent-clear-rgb: 61, 214, 140;
  --text-primary-rgb: 242, 243, 245;

  /* --- typography: exactly four sizes (design_system_brief.md §3) --- */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --fs-title: 1.25rem;     /* panel title                       */
  --fs-heading: 0.8125rem; /* section heading                   */
  --fs-label: 0.75rem;     /* field label AND field value       */
  --fs-caption: 0.6875rem; /* caption / meta — smallest         */

  --w-regular: 400;
  --w-medium: 500;
  --w-semibold: 600;

  /* --- spacing rhythm --- */
  --gap-section: 22px;  /* between major panel sections */
  --gap-block: 10px;    /* within a block              */
  --gap-tight: 4px;     /* label -> its value          */
  --pad-panel: 20px;
  --sidebar-w: 380px;
  --radius-pill: 999px;
  --radius-frame: 12px;
  --radius-input: 8px;
}

/* ============================================================
   reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ============================================================
   app layout — two regions, sidebar always present
   ============================================================ */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#map-region {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--hairline);
  overflow-y: auto;
}

/* ============================================================
   top toolbar — single utilitarian row
   ============================================================ */
#toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tool-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
}
.tool-btn:hover { color: var(--text-primary); border-color: var(--toggle-off); }
.tool-btn.is-active { color: var(--accent-primary); border-color: var(--accent-primary); }

.toolbar-spacer { flex: 1; }

.toolbar-sources {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 4px;
}

/* ============================================================
   search / dropdown input — dark pill
   ============================================================ */
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
  max-width: 420px;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}
.search-input:focus-within { border-color: var(--accent-primary); }
.search-input .si-icon { font-size: 13px; opacity: 0.8; }
.search-input input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  font: inherit;
}
.search-input input::placeholder { color: var(--text-muted); }

/* ============================================================
   map frame — rounded rect, thin blue border
   ============================================================ */
.map-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border-blue);
  border-radius: var(--radius-frame);
  overflow: hidden;
  background: var(--bg-base);
}

#map { position: absolute; inset: 0; background: var(--bg-base); }

/* --- Leaflet dark-theme overrides ---------------------- */
.leaflet-container {
  background: var(--bg-base);
  font-family: var(--font-sans);
  outline: none;
}
.leaflet-tile { filter: brightness(0.62) contrast(1.12) saturate(0.85); }
.leaflet-bar,
.leaflet-bar a {
  background: var(--bg-raised);
  color: var(--text-muted);
  border-color: var(--hairline);
}
.leaflet-bar a:hover { background: var(--bg-base); color: var(--text-primary); }
.leaflet-control-attribution {
  background: rgba(var(--text-primary-rgb), 0.04) !important;
  color: var(--text-muted) !important;
  font-size: 10px;
}
.leaflet-control-attribution a { color: var(--text-muted) !important; }

/* --- map primitives (Leaflet vector paths get these classes) --- */
.cable-line { stroke: var(--accent-primary); }
.cable-line--spur { stroke: var(--accent-primary); opacity: 0.3; }
.cable-node {
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 1.5px solid var(--accent-primary);
}

/* vessel markers + labels (L.divIcon). 26px wrapper = generous hit target
   so taps between clustered bogeys resolve unambiguously (revision R2 §2). */
.vessel-marker { position: relative; width: 26px; height: 26px; }

.vessel-dot {
  position: absolute;
  left: 50%; top: 50%;
  width: 13px; height: 13px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 0 1px rgba(var(--text-primary-rgb), 0.4);
  cursor: pointer;
}
.vessel-dot--baseline    { background: var(--accent-identity); }
.vessel-dot--anomalous   { background: var(--accent-risk); }
.vessel-dot--placeholder {
  width: 9px; height: 9px;
  background: var(--accent-clear);
  border-width: 1.5px;
  box-shadow: none;
  opacity: 0.9;
}
.vessel-dot.is-selected {
  box-shadow: 0 0 0 3px var(--accent-primary), 0 0 10px 1px rgba(var(--accent-primary-rgb), 0.7);
}
.vessel-dot--placeholder.is-selected { width: 11px; height: 11px; }
.vessel-dot.is-risk {
  background: var(--accent-risk);
  box-shadow: 0 0 0 3px var(--accent-risk), 0 0 14px 2px var(--accent-risk);
}

/* radar-ping rings — "clickable" hint (blue) and RISK alert (amber) */
.vessel-ping {
  position: absolute;
  left: 50%; top: 50%;
  width: 13px; height: 13px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.vessel-ping::before,
.vessel-ping::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent-primary);
  animation: radar-ping 2.6s cubic-bezier(0, 0.3, 0.3, 1) infinite;
}
.vessel-ping::after { animation-delay: 1.3s; }
.vessel-ping--alert::before,
.vessel-ping--alert::after {
  border-width: 2px;
  border-color: var(--accent-risk);
  animation-duration: 1.7s;
}
.vessel-ping--alert::after { animation-delay: 0.85s; }
@keyframes radar-ping {
  0%   { transform: scale(1);   opacity: 0.85; }
  70%  { opacity: 0; }
  100% { transform: scale(6.5); opacity: 0; }
}

.vessel-label {
  white-space: nowrap;
  font-size: var(--fs-caption);
  font-weight: var(--w-medium);
  color: var(--text-primary);
  text-shadow: 0 1px 3px var(--bg-base), 0 0 6px var(--bg-base);
  transform: translate(14px, -8px);
  pointer-events: none;
}
.vessel-label.is-selected { font-weight: var(--w-semibold); color: var(--accent-primary); }

.track-line--baseline  { stroke: var(--accent-identity); }
.track-line--anomalous { stroke: var(--accent-risk); }

/* fault marker — red warning triangle + expanding rings (sketch: ▲!) */
.fault-marker { position: relative; width: 28px; height: 28px; }
.fault-tri {
  position: absolute;
  left: 50%; bottom: 4px;
  transform: translateX(-50%);
  font-size: 22px;
  line-height: 1;
  color: var(--accent-attack);
  text-shadow: 0 0 8px var(--bg-base), 0 0 12px var(--bg-base);
  animation: fault-pulse 1.3s ease-in-out infinite;
}
.fault-ping {
  position: absolute;
  left: 50%; bottom: 6px;
  width: 16px; height: 16px;
  transform: translateX(-50%);
  pointer-events: none;
}
.fault-ping::before,
.fault-ping::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-attack);
  animation: radar-ping 1.9s cubic-bezier(0, 0.3, 0.3, 1) infinite;
}
.fault-ping::after { animation-delay: 0.95s; }
@keyframes fault-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- overlay layer (buttons / captions above the map) --- */
#map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 16px;
  pointer-events: none;
  z-index: 500;
}
#map-overlay > * { pointer-events: auto; }
#map-overlay .overlay-bottom { margin-top: auto; }

.map-caption {
  padding: 7px 14px;
  background: rgba(var(--text-primary-rgb), 0.06);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  font-size: var(--fs-label);
  color: var(--text-primary);
  backdrop-filter: blur(3px);
}

.overlay-start {
  width: auto;
  padding: 12px 28px;
  font-size: var(--fs-heading);
}
/* Scene 1 CTA sits bottom-left, clear of the nav cluster (revision R3 §2) */
.overlay-start-wrap { margin-top: auto; align-self: flex-start; }

/* "Transmit warning to vessel" button in the Scene 3 warn-stack */
.hail-btn {
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius-input);
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
  background: var(--accent-primary);
  color: var(--on-accent);
}
.hail-btn:hover { filter: brightness(1.06); }
.hail-btn--amber {
  background: var(--accent-risk);
  color: var(--on-risk);
}

/* dedicated Next + Reset cluster — bottom-right, clear of the markers
   (revision R2 §6: no more "click the map to advance") */
#nav-cluster {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-next {
  width: auto;
  padding: 9px 16px;
  font-size: var(--fs-label);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.nav-reset {
  padding: 8px 13px;
  background: var(--bg-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  color: var(--text-muted);
  font-size: var(--fs-label);
}
.nav-reset:hover { color: var(--text-primary); border-color: var(--toggle-off); }

/* ============================================================
   REUSABLE COMPONENTS  (build_tasks.md 1.4)
   ============================================================ */

/* --- toggle switch --------------------------------------- */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  border: 0;
  font-size: var(--fs-label);
  color: var(--text-muted);
  user-select: none;
}
.toggle-switch .ts-track {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--toggle-off);
  transition: background 120ms ease;
  flex-shrink: 0;
}
.toggle-switch .ts-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform 120ms ease;
}
.toggle-switch.is-on .ts-track { background: var(--accent-primary); }
.toggle-switch.is-on .ts-thumb { transform: translateX(14px); }
.toggle-switch.is-on { color: var(--text-primary); }

/* --- tab pair ------------------------------------------- */
.tab-pair {
  display: inline-flex;
  gap: 20px;
  border-bottom: 1px solid var(--hairline);
}
.tab-pair .tab {
  padding: 8px 2px;
  font-size: var(--fs-heading);
  font-weight: var(--w-medium);
  color: var(--text-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-pair .tab.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-primary);
}

/* --- status badge -------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
  color: var(--on-accent);
  background: var(--accent-primary);
  white-space: nowrap;
}
.status-badge[data-state="risk"]   { background: var(--accent-risk); color: var(--on-risk); }
.status-badge[data-state="attack"] { background: var(--accent-attack); }
.status-badge[data-state="break"]  { background: var(--accent-attack); }

/* --- info row: icon + muted label + primary value ------ */
.info-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 10px;
  align-items: start;
  padding: var(--gap-block) 0;
}
.info-row .ir-icon {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
}
.info-row .ir-label {
  font-size: var(--fs-label);
  color: var(--text-muted);
  margin-bottom: var(--gap-tight);
}
.info-row .ir-value {
  font-size: var(--fs-label);
  font-weight: var(--w-medium);
  color: var(--text-primary);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
}
.info-grid .info-row { grid-column: auto; }

/* --- primary button ----------------------------------- */
.primary-button {
  display: block;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: var(--radius-input);
  background: var(--accent-primary);
  color: var(--on-accent);
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
}
.primary-button:hover { filter: brightness(1.08); }
.primary-button:active { filter: brightness(0.95); }

/* --- panel shell -------------------------------------- */
.panel-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-left: 2px solid var(--accent-primary);
}
.panel-shell[data-state="risk"]   { border-left-color: var(--accent-risk); }
.panel-shell[data-state="attack"] { border-left-color: var(--accent-attack); }
.panel-shell[data-state="break"]  { border-left-color: var(--accent-attack); }

.panel-shell .ps-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--pad-panel);
  padding-bottom: 10px;
}
.panel-shell .ps-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-title);
  font-weight: var(--w-semibold);
  color: var(--text-primary);
}
.panel-shell .ps-title-icon { display: inline-flex; flex-shrink: 0; }
.panel-shell .ps-title-icon svg { width: 20px; height: 20px; }
.panel-shell[data-state="risk"]   .ps-title { color: var(--accent-risk); }
.panel-shell[data-state="attack"] .ps-title { color: var(--accent-attack); }
.panel-shell[data-state="break"]  .ps-title { color: var(--accent-attack); }

.ps-close {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  border-radius: 6px;
}
.ps-close:hover { color: var(--text-primary); background: var(--bg-raised); }

/* muted identity one-liner under the header — replaces the old identity card
   that collided with the title (revision R2 §4 "also fix") */
.ps-subhead {
  padding: 0 var(--pad-panel) 6px;
  margin-top: -4px;
  font-size: var(--fs-caption);
  color: var(--text-muted);
}

.panel-shell .ps-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px var(--pad-panel) var(--pad-panel);
}

/* section heading — spacing separates, no rule line */
.section-heading {
  font-size: var(--fs-heading);
  font-weight: var(--w-semibold);
  color: var(--text-primary);
  margin: var(--gap-section) 0 var(--gap-block);
}
.section-heading:first-child { margin-top: 0; }

/* one level down — group labels inside a panel (Break panel clusters) */
.section-heading--sub {
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 18px 0 6px;
}

.caption {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.identity-type { color: var(--accent-identity); font-weight: var(--w-medium); }

/* vessel identity block at the top of a profile panel body */
.panel-identity { margin-bottom: 6px; }
.panel-identity .pi-name {
  font-size: var(--fs-heading);
  font-weight: var(--w-semibold);
  color: var(--text-primary);
}
.panel-identity .pi-sub {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  margin-top: 2px;
}
.panel-badge-row { margin: 12px 0 4px; }

/* attack-score readout — the number the operator needs first */
.attack-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 4px;
}
.attack-score .as-num {
  font-size: 2rem;
  font-weight: var(--w-semibold);
  color: var(--accent-attack);
  line-height: 1;
}
.attack-score .as-max { font-size: var(--fs-label); color: var(--text-muted); }

/* explicit "not scored" empty state (MV Nordic Ranger, Scene 5) */
.empty-state {
  padding: 18px 16px;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius-input);
  color: var(--text-muted);
  font-size: var(--fs-label);
  line-height: 1.5;
}

/* warning strip over the map (RISK threshold indicator) — sketch: "Warning signal initiated" */
.warning-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: rgba(var(--accent-risk-rgb), 0.12);
  border: 1px solid var(--accent-risk);
  color: var(--accent-risk);
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
  letter-spacing: 0.02em;
  backdrop-filter: blur(3px);
  animation: warn-pulse 1.7s ease-in-out infinite;
}
.warning-strip .ws-icon { display: inline-flex; }
.warning-strip .ws-icon svg { width: 14px; height: 14px; }
@keyframes warn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-risk-rgb), 0.5); }
  55%      { box-shadow: 0 0 0 8px rgba(var(--accent-risk-rgb), 0); }
}

/* flagged-contacts jump list + the transmit button under it */
.warn-stack { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* corner variant — Scene 3: top-left of the map, list first, button below */
.warn-stack--corner {
  align-self: flex-start;
  align-items: stretch;
  width: 340px;
  max-width: 60%;
}
.bogey-mini-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(var(--bg-base-rgb), 0.82);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  backdrop-filter: blur(4px);
}
.bogey-mini-list .bml-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-caption);
  color: var(--accent-risk);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 4px 6px;
}
.bogey-mini-list .bml-icon { display: inline-flex; }
.bogey-mini-list .bml-icon svg { width: 13px; height: 13px; }
.bogey-mini {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: var(--fs-label);
  text-align: left;
}
.bogey-mini .bm-name { font-weight: var(--w-medium); white-space: nowrap; }
.bogey-mini .bm-type {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bogey-mini:hover { background: rgba(var(--text-primary-rgb), 0.06); }
.bogey-mini.is-active {
  background: rgba(var(--accent-primary-rgb), 0.16);
  border-left-color: var(--accent-primary);
}
.bogey-mini.is-active .bm-name { color: var(--accent-primary); }

/* tab strip + body inside the Risk profile panel */
.panel-shell .tab-pair { display: flex; gap: 18px; margin-bottom: 4px; }
.tab-content { padding-top: 4px; }

/* ============================================================
   TWO-TIER DATA ROW + VERDICT / SCORE CHIPS  (revision R2)
   ============================================================ */
.verdict-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: var(--w-semibold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  background: rgba(var(--text-primary-rgb), 0.04);
}
.verdict-chip[data-tone="clear"] {
  color: var(--accent-clear);
  border-color: var(--accent-clear);
  background: rgba(var(--accent-clear-rgb), 0.14);
}
.verdict-chip[data-tone="caution"] {
  color: var(--accent-risk);
  border-color: var(--accent-risk);
  background: rgba(var(--accent-risk-rgb), 0.14);
}
.verdict-chip[data-tone="alert"] {
  color: var(--accent-attack);
  border-color: var(--accent-attack);
  background: rgba(var(--accent-attack-rgb), 0.16);
}
.verdict-chip[data-tone="muted"] {
  color: var(--text-muted);
  border-color: var(--hairline);
}

/* filled headline chip for panel headers — the verdict for the whole panel */
.score-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--on-accent);
  background: var(--accent-attack);
}
.score-chip[data-tone="clear"]   { background: var(--accent-clear); color: var(--on-risk); }
.score-chip[data-tone="caution"] { background: var(--accent-risk); color: var(--on-risk); }
.score-chip[data-tone="alert"]   { background: var(--accent-attack); color: var(--on-accent); }

.data-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid var(--hairline);
}
.data-row:first-of-type { border-top: 0; }
.data-row .dr-icon {
  display: flex;
  justify-content: center;
  padding-top: 1px;
  color: var(--text-muted);
}
.data-row .dr-icon svg { width: 15px; height: 15px; }
.dr-col { min-width: 0; }
.data-row .dr-label {
  font-size: var(--fs-label);
  color: var(--text-muted);
  margin-bottom: 5px;
}
.data-row .dr-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.data-row .dr-value {
  font-size: var(--fs-label);
  font-weight: var(--w-semibold);
  color: var(--text-primary);
}
.data-row .dr-detail {
  margin-top: 4px;
  font-size: var(--fs-caption);
  color: var(--text-muted);
  line-height: 1.5;
}

/* tappable candidate-vessel row on the Break panel (entry to Scene 5) */
.bogey-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 6px;
  background: none;
  border: 0;
  border-top: 1px solid var(--hairline);
  text-align: left;
  color: var(--text-primary);
}
.bogey-row:hover { background: rgba(var(--text-primary-rgb), 0.05); }
.bogey-row .dr-icon { display: flex; justify-content: center; color: var(--text-muted); }
.bogey-row .dr-icon svg { width: 15px; height: 15px; }
.bogey-row .dr-label { font-size: var(--fs-label); font-weight: var(--w-medium); }
.bogey-row .dr-detail { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 2px; }
.bogey-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }

/* ============================================================
   WARNING-HAIL MODAL + TOAST  (revision R3 §4)
   ============================================================ */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--accent-attack);
  border-radius: var(--radius-frame);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  padding: 20px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.modal-kicker {
  font-size: var(--fs-caption);
  font-weight: var(--w-semibold);
  letter-spacing: 0.12em;
  color: var(--accent-attack);
}
.modal-title {
  font-size: var(--fs-title);
  font-weight: var(--w-semibold);
  color: var(--text-primary);
  margin: 6px 0 12px;
}
.modal-msg {
  margin: 0;
  padding: 14px;
  background: var(--bg-base);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--fs-label);
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  letter-spacing: 0.01em;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  z-index: 2100;
  max-width: 460px;
  padding: 11px 18px;
  background: var(--bg-raised);
  border: 1px solid var(--accent-clear);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: var(--fs-label);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   style-guide view  (?styleguide=1)
   ============================================================ */
.styleguide {
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  overflow-y: auto;
  height: 100vh;
}
.styleguide h1 { font-size: var(--fs-title); font-weight: var(--w-semibold); margin: 0 0 4px; }
.styleguide .sg-sub { color: var(--text-muted); font-size: var(--fs-label); margin-bottom: 36px; }
.sg-section { margin-bottom: 40px; }
.sg-section > h2 {
  font-size: var(--fs-heading);
  font-weight: var(--w-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
  margin: 0 0 18px;
}
.sg-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.sg-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sg-swatch { border: 1px solid var(--hairline); border-radius: var(--radius-input); overflow: hidden; }
.sg-swatch .chip { height: 56px; }
.sg-swatch .meta { padding: 8px 10px; }
.sg-swatch .meta .name { font-size: var(--fs-label); color: var(--text-primary); }
.sg-swatch .meta .val { font-size: var(--fs-caption); color: var(--text-muted); }
.sg-type-row { margin-bottom: 12px; }
.sg-type-row .tag { font-size: var(--fs-caption); color: var(--text-muted); display: block; }
.sg-panel-frame {
  width: var(--sidebar-w);
  height: 460px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-input);
  overflow: hidden;
  background: var(--bg-panel);
}
