/* ═══════════════════════════════════════════════════════════════
   AETHEL // JPL — Space Mission Engineering Simulator
   Calm, Practical Engineering Dashboard — OrbitGuard Style
   Type Scale: 26px Page Title, 18px Card Title, 15px Body, 13px Labels, 26px Vitals
   Palette: Neutral Light (#F5F7FA / #FFFFFF), Accent #0B6E99 / #0E3D48
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-app: #F5F7FA;
  --surface: #FFFFFF;
  --surface-subtle: #F8FAFC;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text-main: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --accent: #0B6E99;
  --accent-dark: #0E3D48;
  --accent-light: #EBF5FA;
  --accent-hover: #09587B;
  --status-ok: #15803D;
  --status-ok-bg: #DCFCE7;
  --status-warn: #B45309;
  --status-warn-bg: #FEF3C7;
  --status-danger: #B91C1C;
  --status-danger-bg: #FEE2E2;

  --viewport-bg: #070B14;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Courier New', monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --transition: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

svg {
  max-width: 100%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
}

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* ── App Shell Layout ── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Left Sidebar Navigation (~220px) ── */
#sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  z-index: 10;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.logo-glyph {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.nav-link:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--accent-dark);
  color: #FFFFFF;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  color: currentColor;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--status-ok);
  font-weight: 600;
  padding: 6px 10px;
  background: var(--status-ok-bg);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-ok);
}

.btn-sources {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.btn-sources:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

/* ── Main Workspace ── */
#workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  background: var(--bg-app);
}

/* ── Persistent Top Header (~52px) ── */
.top-header {
  height: 52px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-clocks {
  display: flex;
  align-items: center;
  gap: 28px;
}

.clock-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.clock-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.clock-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-header {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
}

.btn-header:hover {
  background: #EDF2F7;
  color: var(--text-main);
}

.btn-advisor-toggle {
  background: var(--surface);
  border-color: var(--border-strong);
}

.review-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.review-badge.ok {
  background: var(--status-ok-bg);
  color: var(--status-ok);
}

.review-badge.blocker {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

/* ── Persistent 5-Card Vitals Strip ── */
.vitals-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  padding: 16px 24px 0 24px;
}

.vital-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}

.vital-tile:hover {
  border-color: var(--border-strong);
}

.vital-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vital-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.vital-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.vital-chip.ok {
  background: var(--status-ok-bg);
  color: var(--status-ok);
}

.vital-chip.warn {
  background: var(--status-warn-bg);
  color: var(--status-warn);
}

.vital-chip.danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.vital-body {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.vital-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.vital-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.vital-progress {
  height: 4px;
  background: var(--surface-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.vital-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.vital-bar-fill.danger {
  background: var(--status-danger);
}

.math-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: color var(--transition);
}

.math-toggle:hover {
  color: var(--accent);
}

/* ── View Container ── */
.view-container {
  padding: 20px 24px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.view-heading {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.view-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Target Selection Tabs (Mission Strip) ── */
.mission-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.mission-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.mission-tab:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.mission-tab.active {
  border-color: var(--accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.mission-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  background: #000000;
}

.mission-tab-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tab-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-code {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.mission-tab.active .tab-code {
  background: var(--accent-dark);
  color: #FFFFFF;
}

.tab-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.tab-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Viewport Stage Stepper Tabs (Transfer, Orbit, Landing Site) */
.viewport-stage-stepper {
  position: absolute;
  top: 48px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px;
  border-radius: 20px;
  z-index: 15;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.stage-step-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-step-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.stage-step-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* "NOT TO SCALE" Schematic Badge */
.not-to-scale-badge {
  position: absolute;
  bottom: 48px;
  left: 14px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #FCD34D;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 15;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.not-to-scale-badge.hidden {
  display: none !important;
}

/* ── Middle Grid (3D Viewport + Payload Outfitter) ── */
.middle-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

/* 3D Viewport Card */
.viewport-card {
  background: var(--viewport-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 440px;
  box-shadow: var(--shadow-md);
}

.viewport-controls-top {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none;
}

.viewport-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.v-tab {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94A3B8;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.v-tab:hover {
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.3);
}

.v-tab.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.viewport-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.btn-vp-tool {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #CBD5E1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-vp-tool:hover {
  color: #FFFFFF;
  background: rgba(15, 23, 42, 0.95);
}

#canvas-3d-wrap {
  width: 100%;
  height: 440px;
  position: relative;
}

#canvas-2d-map {
  width: 100%;
  height: 440px;
  display: none;
}

.viewport-bottom-stats {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 16px;
  border-radius: 20px;
  z-index: 10;
}

.vp-stat-item {
  color: #94A3B8;
  font-size: 12px;
}

.vp-stat-item b {
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-left: 4px;
}

/* Floating 3D Satellite Label */
.vp-sat-pill {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.vp-sat-pill-name {
  color: #38BDF8;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.vp-sat-pill-sub {
  color: #E2E8F0;
  font-size: 11px;
  font-family: var(--font-mono);
}

/* Satellite 14px Pill Badge */
.satellite-label-pill {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: opacity 0.15s ease;
  will-change: transform;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38BDF8;
  box-shadow: 0 0 8px #38BDF8;
  flex-shrink: 0;
}

.pill-text {
  display: flex;
  flex-direction: column;
}

.pill-title {
  color: #38BDF8;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.pill-meta {
  color: #E2E8F0;
  font-size: 11.5px;
  font-family: var(--font-mono);
}

/* ── Payload Outfitter Panel ── */
.outfitter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  max-height: 440px;
  overflow: hidden;
}

.outfitter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.outfitter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.category-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.cat-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.cat-btn:hover {
  color: var(--text-main);
  background: #E2E8F0;
}

.cat-btn.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.module-item {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--transition);
}

.module-item.equipped {
  border-color: #93C5FD;
  background: #F0F9FF;
}

.mod-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mod-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.mod-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
}

.mod-chip.equipped {
  background: #DBEAFE;
  color: #1D4ED8;
}

.mod-chip.stowed {
  background: #E2E8F0;
  color: #64748B;
}

.mod-specs {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-toggle-mod {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-toggle-mod:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

/* ── Trajectory Conic Panel (Bottom) ── */
.trajectory-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.traj-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.traj-header b {
  font-size: 15px;
  color: var(--text-main);
}

.traj-canvas-wrap {
  width: 100%;
  height: 180px;
  position: relative;
}

#canvas-conic {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Vehicle Class Selection View ── */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.vehicle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.vehicle-card:hover {
  border-color: var(--border-strong);
}

.vehicle-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.v-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.v-card-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.v-card-price {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

.v-stat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.v-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

.v-stat-label {
  color: var(--text-muted);
}

.v-stat-val {
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* ── Launch View Panel ── */
.launch-view-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.launch-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.btn-hold-launch {
  position: relative;
  overflow: hidden;
  background: #0F172A;
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius);
  padding: 16px 36px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s ease;
  user-select: none;
}

.btn-hold-launch:active {
  transform: scale(0.98);
}

.hold-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: var(--status-ok);
  opacity: 0.85;
  transition: width 0.05s linear;
}

.btn-hold-launch span {
  position: relative;
  z-index: 2;
}

/* Post-Mortem Failure Box */
.postmortem-box {
  background: var(--status-danger-bg);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius);
  padding: 18px 24px;
  max-width: 620px;
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.pm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pm-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--status-danger);
}

.pm-time {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--status-danger);
}

.pm-desc {
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.4;
}

.pm-fix {
  font-size: 13px;
  color: var(--status-ok);
  font-weight: 600;
  margin-top: 4px;
}

/* ── Advisor Drawer (Design Review) ── */
.advisor-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.advisor-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-title {
  font-weight: 800;
  font-size: 15px;
}

.drawer-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-finding-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-finding-card.blocker {
  border-color: #FCA5A5;
  background: var(--status-danger-bg);
}

.rule-finding-card.warning {
  border-color: #FCD34D;
  background: var(--status-warn-bg);
}

.rfc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rfc-title {
  font-size: 13px;
  font-weight: 700;
}

.rfc-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
}

.rfc-badge.blocker { background: var(--status-danger); color: #FFF; }
.rfc-badge.warning { background: var(--status-warn); color: #FFF; }
.rfc-badge.info { background: #E2E8F0; color: var(--text-muted); }

.rfc-text {
  font-size: 12.5px;
  color: var(--text-main);
  line-height: 1.4;
}

.rfc-fix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.btn-autofix {
  background: var(--accent);
  color: #FFF;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-autofix:hover {
  background: var(--accent-hover);
}

/* ── Modals (Math & Sources) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.math-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.math-formula {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 580px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 15px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.source-item {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.source-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.source-link {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.source-link:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .vitals-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  .middle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .vitals-bar {
    grid-template-columns: 1fr;
  }
  .mission-strip {
    grid-template-columns: 1fr;
  }
  .vehicle-grid {
    grid-template-columns: 1fr;
  }
}
