/* ==========================================================================
   军工复合体：喷气时代 — 界面样式
   Light, restrained product UI. One accent (navy blue), neutral grays,
   thin dividers, no glow. Status colors are used for text, not decoration.
   ========================================================================== */

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-3: #f2f2f0;
  --border: #e6e6e3;
  --border-strong: #d6d6d2;

  --text: #18181b;
  --text-2: #52525b;
  --text-3: #8a8a93;

  --accent: #1e40af;
  --accent-hover: #1a368f;
  --accent-soft: #eef2fb;

  --ok: #15803d;
  --ok-soft: #ecf7ef;
  --bad: #b91c1c;
  --bad-soft: #fcefee;
  --warn: #a16207;
  --warn-soft: #fbf5e6;
  --info-soft: #f1f1ef;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 8px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 16, 20, 0.04);
  --shadow-pop: 0 12px 32px rgba(16, 16, 20, 0.12), 0 2px 6px rgba(16, 16, 20, 0.06);

  /* legacy aliases used by inline styles in app.js */
  --text-primary: var(--text);
  --text-secondary: var(--text-2);
  --text-muted: var(--text-3);
  --accent-cyan: var(--accent);
  --accent-brass: var(--warn);
  --accent-green: var(--ok);
  --accent-red: var(--bad);
  --accent-pink: #9d174d;
  --bg-card-hi: var(--surface-3);
  --bg-sunken: var(--surface-2);
  --line: var(--border);
  --line-strong: var(--border-strong);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

::selection { background: #dbe4f7; }

.mono, .num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--text-3); }
.sec { color: var(--text-2); }
.c-cyan { color: var(--accent); }
.c-brass { color: var(--text); }
.c-green { color: var(--ok); }
.c-red { color: var(--bad); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================================
   Header
   ========================================================================== */
.topbar-hud {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-block { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--text);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 26px;
}
.brand-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.brand-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

.vitals-strip { display: flex; align-items: center; gap: 0; }
.hud-stat {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  border-left: 1px solid var(--border);
  line-height: 1.25;
}
.hud-stat:first-child { border-left: 0; }
.hud-stat .lbl { font-size: 11.5px; color: var(--text-3); }
.hud-stat .val { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.hud-stat .val.c-green, .hud-stat .val.c-cyan, .hud-stat .val.c-brass { color: var(--text); }

.hud-feed-toggle { margin-left: 16px; }
.hud-feed-toggle .count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
}

/* ==========================================================================
   Scenario tabs
   ========================================================================== */
.scenario-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  gap: 18px;
  overflow-x: auto;
}
.scenario-bar .eyebrow { display: flex; align-items: center; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.scenario-buttons { display: flex; gap: 4px; }

.scen-card {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 12px 9px;
  font-family: var(--font);
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.scen-card:hover { color: var(--text); }
.scen-card .yr { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-3); }
.scen-card .t1 { font-size: 13.5px; font-weight: 500; }
.scen-card .t2 { display: none; }
.scen-card br { display: none; }
.scen-card.active { color: var(--text); border-bottom-color: var(--text); }
.scen-card.active .yr { color: var(--text); }
.scen-card.active .t1 { font-weight: 600; }

.mode-banner {
  flex: 1;
  min-width: 200px;
  align-self: center;
  margin: 0;
  padding: 8px 0 10px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.45;
}
.mode-banner b { color: var(--text-2); font-weight: 600; }

/* ==========================================================================
   Shell
   ========================================================================== */
.main-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 300px;
  gap: 28px;
  padding: 24px 24px 48px;
  flex: 1;
  max-width: 1840px;
  width: 100%;
  margin: 0 auto;
  align-items: start;
}
body.ws-design .main-shell { grid-template-columns: 200px minmax(0, 1fr); }

body.ws-design .right-feed {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-height: none;
  z-index: 300;
  padding: 20px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  overflow-y: auto;
  transform: translateX(105%);
  transition: transform 0.22s ease;
}
body.ws-design.feed-open .right-feed { transform: translateX(0); }
.feed-scrim { display: none; }
body.ws-design.feed-open .feed-scrim { display: block; position: fixed; inset: 0; background: rgba(16, 16, 20, 0.18); z-index: 250; }

.btn.feed-close, .btn.hud-feed-toggle { display: none; }
body.ws-design .btn.feed-close, body.ws-design .btn.hud-feed-toggle { display: inline-flex; }

@media (max-width: 1360px) {
  .main-shell { grid-template-columns: 184px minmax(0, 1fr); gap: 24px; }
  .right-feed { grid-column: 2 / -1; position: static !important; max-height: none !important; }
  .brand-sub, .brand-sep { display: none; }
}
@media (max-width: 1100px) {
  .vitals-strip .hud-stat:nth-child(n+4) { display: none; }
}
@media (max-width: 920px) {
  .main-shell, body.ws-design .main-shell { grid-template-columns: 1fr; padding: 16px; }
  .left-nav { position: static !important; }
  .right-feed { grid-column: 1 / -1; }
}

/* ==========================================================================
   Left nav
   ========================================================================== */
.left-nav { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 1px; }
.nav-section-title { font-size: 12px; color: var(--text-3); margin: 0 10px 6px; }

.nav-btn {
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  text-align: left;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-btn .n { width: 16px; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.nav-btn .lab { flex: 1; }
.nav-btn .lab small { display: none; }
.nav-btn .kbd { font-size: 11px; color: var(--text-3); font-family: var(--font); }
.nav-btn:hover { background: var(--surface-3); color: var(--text); }
.nav-btn.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border); }
.nav-btn.active .n { color: var(--text); }

.guide-box { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 14px; }
.guide-box summary { list-style: none; cursor: pointer; font-size: 12px; color: var(--text-3); padding: 0 10px 8px; display: flex; justify-content: space-between; }
.guide-box summary::-webkit-details-marker { display: none; }
.guide-box summary::after { content: "收起"; font-size: 12px; color: var(--text-3); }
.guide-box:not([open]) summary::after { content: "展开"; }
.guide-steps { list-style: none; padding: 0 10px; display: flex; flex-direction: column; gap: 10px; counter-reset: g; }
.guide-steps li { counter-increment: g; position: relative; padding-left: 20px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.guide-steps li::before { content: counter(g) "."; position: absolute; left: 0; color: var(--text-3); font-variant-numeric: tabular-nums; }
.guide-steps b { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Workspace + cards
   ========================================================================== */
.workspace-panel { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.panel-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.panel-title { font-size: 22px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; display: flex; align-items: center; gap: 10px; }
.panel-title .step, .panel-title .eyebrow { display: none; }
.panel-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; max-width: 760px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.flat { box-shadow: none; }
.card.sunken { background: var(--surface-2); box-shadow: none; }
.card.accent-cyan, .card.accent-brass, .card.accent-green, .card.accent-red, .card.accent-pink { border-color: var(--border); }
.card.accent-red { border-left: 3px solid var(--bad); }
.card.accent-green { border-left: 3px solid var(--ok); }
.card.accent-pink { border-left: 3px solid #9d174d; }

.card-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .eyebrow { margin-left: auto; font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.card-title .dot { display: none; }
.eyebrow { font-size: 12.5px; color: var(--text-3); }

.section-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin: 18px 0 10px; padding-top: 16px; border-top: 1px solid var(--border); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }

.design-grid { display: grid; grid-template-columns: 264px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1520px) {
  .design-grid { grid-template-columns: 256px minmax(0, 1fr); }
  .design-grid > .report-col { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
}
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .grid-2, .grid-3, .design-grid, .design-grid > .report-col { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Buttons & controls
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(16, 16, 20, 0.03);
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn-green, .btn-brass { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-green:hover, .btn-brass:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-brass { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-brass:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-red { color: var(--bad); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* Segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--r); }
.seg button {
  background: none;
  border: 0;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  height: 28px;
  padding: 0 12px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 16, 20, 0.08), 0 0 0 1px rgba(16, 16, 20, 0.04); }
.seg .sep { width: 1px; background: var(--border-strong); margin: 6px 4px; }
.seg .tag { display: none; }

/* Toolbar + chips */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0; }
.toolbar .tb-label { font-size: 12.5px; color: var(--text-3); margin-right: 2px; }
.toolbar .tb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 8px; }
.toolbar .hint { font-size: 12.5px; color: var(--text-3); margin-left: auto; }
.chip {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.chip.on small { color: rgba(255, 255, 255, 0.6); }
.chip.go { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.go:hover { background: var(--accent-hover); }
.chip small { color: var(--text-3); font-weight: 400; }

/* Sliders */
.slider-row { margin-bottom: 14px; }
.slider-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.slider-header .s-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; --pct: 50%; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--text) 0, var(--text) var(--pct), var(--border) var(--pct), var(--border) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 3px rgba(16, 16, 20, 0.2);
}
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px #dbe4f7; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--text); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1px solid var(--border-strong); }
input[type="range"].brass::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--text) 0, var(--text) var(--pct), var(--border) var(--pct), var(--border) 100%); }

select, input[type="number"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  padding: 0 30px 0 10px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8a93' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13.5px;
  cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #dbe4f7; }

/* Switches */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; cursor: pointer; font-size: 13.5px; color: var(--text); }
.switch-row .txt small { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; line-height: 1.45; }
.switch-row .txt b { font-weight: 500; }
.switch-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 32px;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 16, 20, 0.25);
  transition: transform 0.15s;
}
.switch-row input[type="checkbox"]:checked { background: var(--accent); }
.switch-row input[type="checkbox"]:checked::after { transform: translateX(14px); }
.switch-row.feature { padding: 10px 12px; margin: 0 0 4px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }

/* ==========================================================================
   Tables & badges
   ========================================================================== */
table.bp-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.bp-table th, table.bp-table td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: middle; }
table.bp-table th { font-size: 12.5px; font-weight: 500; color: var(--text-3); background: var(--surface); position: sticky; top: 0; z-index: 1; }
table.bp-table tbody tr:hover { background: var(--surface-2); }
table.bp-table tbody tr:last-child td { border-bottom: 0; }
table.bp-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.bp-table tr.me { background: var(--accent-soft); }
table.bp-table tr.me:hover { background: var(--accent-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--info-soft);
  color: var(--text-2);
}
.badge-sim, .badge-muted { background: var(--info-soft); color: var(--text-2); }
.badge-tunnel { background: var(--accent-soft); color: var(--accent); }
.badge-flight, .badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-uncharted { background: #f8eef3; color: #9d174d; }

/* ==========================================================================
   Design workspace
   ========================================================================== */
.stage { display: flex; flex-direction: column; gap: 14px; }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.blueprint-canvas {
  width: 100%;
  height: 470px;
  border: 1px solid #b8c9e8;
  border-radius: var(--r-sm);
  background:
    linear-gradient(rgba(30, 64, 175, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 64, 175, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
  background-size: 24px 24px, 24px 24px, auto;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.card.stage { background: linear-gradient(180deg, #fff 0%, #fafbfd 100%); border-color: #d4deef; }

.fail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bad-soft);
  border: 1px solid #f0caca;
  font-size: 13px;
  color: var(--bad);
}
.fail-summary.ok-bar { background: var(--ok-soft); border-color: #b8e0c4; color: var(--ok); }
.fail-summary .chip-fail {
  background: #fff;
  border: 1px solid #f0caca;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  font-size: 12.5px;
}

.coach-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid #c7d7f5;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.coach-banner button { flex-shrink: 0; }

.params-advanced { margin-top: 4px; }
.params-advanced > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--accent);
  padding: 6px 0 10px;
  font-weight: 600;
}
.params-advanced > summary::-webkit-details-marker { display: none; }

.metric.metric-hi {
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: var(--r-sm);
  animation: metricPulse 0.9s ease 2;
}
@keyframes metricPulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(30, 64, 175, 0.35); }
  50% { box-shadow: inset 0 0 0 2px var(--accent); }
}

.metric.pass-icon::before, .metric.fail-icon::before {
  content: "✓";
  display: inline-block;
  margin-right: 4px;
  font-weight: 700;
  color: var(--ok);
}
.metric.fail-icon::before { content: "✕"; color: var(--bad); }

.schedule-bar-wrap { margin-top: 8px; }
.schedule-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  border: 1px solid var(--border);
}
.schedule-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.schedule-bar.over i { background: var(--bad); }

.pilot-card.sel { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }

.tnode.researchable { cursor: pointer; border-style: dashed; }
.tnode.researchable:hover { border-color: var(--accent); color: var(--accent); }
.tnode.owned { border-color: var(--ok); background: var(--ok-soft); }

.rival-details summary { cursor: pointer; font-size: 12px; color: var(--accent); margin-top: 4px; }

.hud-pilot-chip {
  font-size: 11.5px;
  color: var(--text-3);
  padding: 0 12px;
  border-left: 1px solid var(--border);
  align-self: center;
  white-space: nowrap;
}

.kpi { padding: 2px 16px; border-left: 1px solid var(--border); min-width: 0; }
.grid-4 > .kpi:first-child { border-left: 0; padding-left: 0; }
.kpi .k-lbl { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.35; white-space: nowrap; letter-spacing: -0.01em; }
.kpi .k-val small { font-size: 12.5px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.card > .kpi, .grid-3 > .kpi { border-left: 0; padding: 0; }

.report-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.metric { padding: 12px 0; border-bottom: 1px solid var(--border); }
.metric:first-child { padding-top: 0; }
.metric:last-child { border-bottom: 0; padding-bottom: 0; }
.metric-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.metric-name { font-size: 13.5px; color: var(--text-2); }
.metric-val { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.metric-val .sig { font-size: 12.5px; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.metric-val.fail { color: var(--bad); }
.metric-val.pass { color: var(--text); }

.mbar { position: relative; height: 6px; margin: 9px 0 6px; background: var(--surface-3); border-radius: 3px; }
.mbar .zone-ok { display: none; }
.mbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--text); }
.mbar .fill.fail { background: var(--bad); }
.mbar .fill.pass { background: var(--text); }
.mbar .sigma { position: absolute; top: 0; bottom: 0; background: rgba(24, 24, 27, 0.14); border-radius: 3px; }
.mbar .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-3); }
.mbar .tick.ob { background: var(--text-3); opacity: 0.5; }
.metric-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.metric-foot span:nth-child(2) { display: none; }

.diag-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.diag-list li { display: grid; grid-template-columns: 8px 1fr; gap: 10px; font-size: 13.5px; color: var(--text); line-height: 1.55; }
.diag-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-top: 8px; background: var(--text-3); }
.diag-list li.ok::before { background: var(--ok); }
.diag-list li.warn::before { background: var(--bad); }
.diag-list b { font-weight: 600; }
.diag-list .muted { font-size: 13px; }

/* ==========================================================================
   Testing / procurement / propulsion / tech
   ========================================================================== */
.stack { display: flex; flex-direction: column; }
.action-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
}
.stack .action-tile:first-child { padding-top: 0; }
.stack .action-tile:last-child { border-bottom: 0; padding-bottom: 0; }
.action-tile:hover .t { color: var(--accent); }
.action-tile .ic {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
}
.action-tile .body { flex: 1; min-width: 0; }
.action-tile .t { font-size: 14px; font-weight: 500; }
.action-tile .d { font-size: 12.5px; color: var(--text-3); }
.action-tile .meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.action-tile.done .ic { background: var(--ok-soft); color: var(--ok); }

.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.step-node {
  padding: 12px;
  background: var(--surface);
  border: 0;
  border-left: 1px solid var(--border);
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
}
.step-node:first-child { border-left: 0; }
.step-node:hover { background: var(--surface-2); }
.step-node .bar { display: none; }
.step-node .p { font-size: 12px; color: var(--text-3); font-weight: 500; }
.step-node .t { font-size: 13.5px; font-weight: 500; margin-top: 2px; }
.step-node .d { display: none; }
.step-node.done { background: var(--ok-soft); }
.step-node.done .p { color: var(--ok); }

.pilot-card { cursor: pointer; position: relative; transition: border-color 0.12s; }
.pilot-card:hover { border-color: var(--border-strong); }
.pilot-card.sel { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.pilot-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--surface-3); color: var(--text-2); }
.pilot-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.pilot-role { font-size: 12.5px; color: var(--text-3); }
.pilot-desc { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.statbar { display: grid; grid-template-columns: 40px 1fr 28px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.statbar .b { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.statbar .b i { display: block; height: 100%; background: var(--text) !important; }
.statbar .v { color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.sel-check { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 600; color: var(--text); }

.flaw-card .flaw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.flaw-card .flaw-title { font-weight: 600; font-size: 14.5px; line-height: 1.4; color: var(--text) !important; }
.flaw-card .flaw-desc { font-size: 13.5px; color: var(--text-2); margin-bottom: 12px; }
.flaw-card .fix { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.sev { display: inline-flex; gap: 2px; }
.sev i { width: 4px; height: 12px; border-radius: 1px; background: var(--border); }
.sev i.on { background: var(--text-2); }

.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13.5px; border: 1px dashed var(--border-strong); border-radius: var(--r); }

.score-bar { display: grid; grid-template-columns: 1fr 36px; gap: 8px; align-items: center; }
.score-bar .b { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.score-bar .b i { display: block; height: 100%; background: var(--text-2); }
.score-bar .v { font-size: 12.5px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

.result-banner { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.result-banner.win { border-left: 3px solid var(--ok); }
.result-banner.lose { border-left: 3px solid var(--bad); }
.result-banner .big { display: none; }
.result-banner .h { font-size: 17px; font-weight: 650; }
.result-banner .s { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.result-banner .score { margin-left: auto; text-align: right; }
.result-banner .score b { display: block; font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }

.vendor-card .vendor-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.vendor-logo { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--surface-3); color: var(--text-2); letter-spacing: 0.02em; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.kv div { display: flex; flex-direction: column; }
.kv span { font-size: 12.5px; color: var(--text-3); }
.kv b { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text) !important; }

.timeline { display: flex; flex-direction: column; }
.tl-year { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tl-year:last-child { border-bottom: 0; }
.tl-year .y { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); padding-top: 3px; }
.tl-year.future .y { color: var(--text-3); }
.tl-nodes { display: flex; flex-wrap: wrap; gap: 6px; }
.tnode { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 5px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: help; }
.tnode .br { font-size: 12px; color: var(--text-3); }
.tnode.future { background: var(--surface); border-style: dashed; color: var(--text-3); }

/* ==========================================================================
   Right feed + toasts
   ========================================================================== */
.right-feed { display: flex; flex-direction: column; gap: 16px; min-width: 0; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.feed-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: center; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.feed-item .what { grid-column: 1 / -1; color: var(--text); line-height: 1.55; }
.status-kv { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

#toast-host { position: fixed; right: 24px; bottom: 24px; z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  width: 360px;
  padding: 12px 14px;
  background: var(--text);
  color: #fff;
  border-radius: var(--r);
  box-shadow: var(--shadow-pop);
  font-size: 13.5px;
  line-height: 1.5;
  animation: toastIn 0.2s ease;
}
.toast .badge { display: none; }
.toast.out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  .metric.metric-hi { animation: none; }
}
