/* ===== IDSS MBG — Design Tokens & Base Styles ===== */
:root {
  /* Brand */
  --primary: oklch(0.42 0.13 255);
  --primary-700: oklch(0.34 0.13 255);
  --primary-600: oklch(0.42 0.13 255);
  --primary-500: oklch(0.52 0.14 255);
  --primary-100: oklch(0.94 0.03 255);
  --primary-50: oklch(0.98 0.012 255);

  --accent: oklch(0.62 0.14 145);   /* MBG green */
  --accent-700: oklch(0.50 0.14 145);
  --accent-100: oklch(0.94 0.04 145);

  --warn: oklch(0.72 0.17 55);
  --warn-100: oklch(0.95 0.06 55);
  --danger: oklch(0.58 0.20 25);
  --danger-100: oklch(0.94 0.05 25);
  --info: oklch(0.62 0.13 230);
  --info-100: oklch(0.94 0.04 230);

  /* Neutrals — warm-cool tinted */
  --ink: oklch(0.20 0.02 255);
  --ink-2: oklch(0.34 0.02 255);
  --ink-3: oklch(0.50 0.015 255);
  --ink-4: oklch(0.66 0.012 255);
  --line: oklch(0.90 0.008 255);
  --line-2: oklch(0.94 0.006 255);
  --bg: oklch(0.985 0.004 255);
  --bg-2: oklch(0.965 0.006 255);
  --surface: #ffffff;
  --surface-2: oklch(0.98 0.004 255);

  /* Density */
  --pad-xs: 6px;
  --pad-sm: 10px;
  --pad: 16px;
  --pad-lg: 24px;
  --pad-xl: 32px;
  --row-h: 40px;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(15, 25, 45, 0.05);
  --shadow: 0 2px 6px rgba(15, 25, 45, 0.06), 0 1px 2px rgba(15, 25, 45, 0.04);
  --shadow-lg: 0 12px 28px -8px rgba(15, 25, 45, 0.18), 0 4px 10px -4px rgba(15, 25, 45, 0.08);

  --font-display: "Inter Display", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Sidebar width (collapsible) */
  --sidebar-w: 248px;
}

/* Compact density */
[data-density="compact"] {
  --pad-xs: 4px;
  --pad-sm: 6px;
  --pad: 12px;
  --pad-lg: 18px;
  --pad-xl: 24px;
  --row-h: 32px;
}

/* Dark theme */
[data-theme="dark"] {
  --ink: oklch(0.96 0.01 255);
  --ink-2: oklch(0.84 0.012 255);
  --ink-3: oklch(0.68 0.015 255);
  --ink-4: oklch(0.52 0.012 255);
  --line: oklch(0.30 0.012 255);
  --line-2: oklch(0.24 0.01 255);
  --bg: oklch(0.16 0.012 255);
  --bg-2: oklch(0.20 0.013 255);
  --surface: oklch(0.22 0.013 255);
  --surface-2: oklch(0.25 0.014 255);
  --primary-100: oklch(0.30 0.07 255);
  --primary-50: oklch(0.24 0.04 255);
  --accent-100: oklch(0.30 0.07 145);
  --warn-100: oklch(0.32 0.08 55);
  --danger-100: oklch(0.30 0.08 25);
  --info-100: oklch(0.28 0.07 230);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 2px 6px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }

/* Typography utilities */
.h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; margin: 0; }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.005em; margin: 0; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: 14px; margin: 0; }
.eyebrow { text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.09em; font-weight: 600; color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }

/* App shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  transition: grid-template-columns 0.25s ease;
}
[data-density="compact"] .app { --sidebar-w: 220px; grid-template-rows: 48px 1fr; }

/* Sidebar collapsed state */
.app[data-sidebar="closed"] {
  --sidebar-w: 64px;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--pad);
  padding: 0 var(--pad-lg);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
  display: grid; place-items: center;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 13px;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 4px; border: 1.5px solid rgba(255,255,255,0.3); border-radius: 3px;
}
.brand-stack { line-height: 1.15; }
.brand-name { font-size: 13px; }
.brand-sub { font-size: 10.5px; color: var(--ink-3); font-weight: 500; letter-spacing: 0.02em; }

.topbar-spacer { flex: 1; }
.topbar-meta { display: flex; align-items: center; gap: var(--pad-lg); color: var(--ink-3); font-size: 12.5px; }
.topbar-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.user-chip:hover { background: var(--primary-50); border-color: var(--primary-100); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 11px; letter-spacing: 0.02em;
}
.user-chip-text { line-height: 1.15; }
.user-chip-name { font-size: 12.5px; font-weight: 600; }
.user-chip-role { font-size: 10.5px; color: var(--ink-3); }

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: var(--pad) var(--pad-sm);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-toggle {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: var(--pad-sm);
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--radius);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-toggle:hover {
  background: var(--bg-2);
  color: var(--ink);
}
.nav-section { margin-bottom: var(--pad); }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
  color: var(--ink-4); padding: 8px 10px 6px;
  transition: opacity 0.25s ease, font-size 0.25s ease;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: padding 0.25s ease, gap 0.25s ease;
}
.nav-item:hover { background: var(--bg-2); color: var(--ink); }
.nav-item.active {
  background: var(--primary-50);
  color: var(--primary);
  border-color: var(--primary-100);
}
.nav-item span {
  transition: opacity 0.25s ease, width 0.25s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-spacer { flex: 1; }
.nav-foot {
  padding: var(--pad-sm);
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-3);
  margin-top: auto;
  transition: opacity 0.25s ease;
}

/* Collapsed sidebar styles */
.app[data-sidebar="closed"] .nav-label {
  opacity: 0;
  font-size: 0;
  margin: 0;
  padding: 0;
}
.app[data-sidebar="closed"] .nav-item {
  padding: 8px;
  gap: 0;
  justify-content: center;
}
.app[data-sidebar="closed"] .nav-item span {
  display: none;
}
.app[data-sidebar="closed"] .nav-foot {
  display: none;
}
.app[data-sidebar="closed"] .nav-item .pill {
  display: none;
}

/* Content */
.content {
  overflow-y: auto;
  background: var(--bg);
}
.content-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--pad-lg) var(--pad-xl);
}
[data-density="compact"] .content-inner { padding: var(--pad) var(--pad-lg); }

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--pad-lg); margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.crumbs { color: var(--ink-3); font-size: 11.5px; margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs span + span::before { content: "/"; margin: 0 8px; color: var(--ink-4); }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
.page-sub { color: var(--ink-3); font-size: 13px; margin-top: 6px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--line);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--pad) var(--pad-lg);
  border-bottom: 1px solid var(--line);
  gap: var(--pad);
  background: var(--surface-2);
}
.card-head .h2 { font-size: 14px; }
.card-body { padding: var(--pad-lg); }
.card-body.tight { padding: var(--pad); }

.grid { display: grid; gap: var(--pad-lg); }
[data-density="compact"] .grid { gap: var(--pad); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-12 { grid-template-columns: repeat(12, 1fr); }

/* KPI */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--pad-lg);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.kpi:hover {
  box-shadow: var(--shadow);
  border-color: var(--line);
}
.kpi-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 8px; }
.kpi-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi-unit { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.kpi-delta.up { background: var(--accent-100); color: var(--accent-700); }
.kpi-delta.down { background: var(--danger-100); color: var(--danger); }
.kpi-delta.flat { background: var(--bg-2); color: var(--ink-3); }
.kpi-spark { margin-top: 12px; height: 36px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-weight: 500; font-size: 12.5px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .12s ease;
}
.btn:hover { background: var(--bg-2); border-color: var(--ink-4); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 11.5px; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn + .btn { border-left: 0; }
.btn.toggle.on { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); z-index: 1; }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.01em;
}
.pill .led { width: 6px; height: 6px; border-radius: 50%; }
.pill.ok { background: var(--accent-100); color: var(--accent-700); }
.pill.ok .led { background: var(--accent); }
.pill.warn { background: var(--warn-100); color: oklch(0.45 0.16 55); }
.pill.warn .led { background: var(--warn); }
.pill.danger { background: var(--danger-100); color: var(--danger); }
.pill.danger .led { background: var(--danger); }
.pill.info { background: var(--info-100); color: var(--info); }
.pill.info .led { background: var(--info); }
.pill.neutral { background: var(--bg-2); color: var(--ink-2); }
.pill.neutral .led { background: var(--ink-4); }

/* Tables */
table.data {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
table.data thead th {
  text-align: left; padding: 12px var(--pad);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 600; font-family: var(--font-sans);
  border-bottom: 2px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
  vertical-align: middle;
}
table.data tbody td {
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.data tbody tr {
  background: var(--surface);
  transition: background-color 0.15s ease;
}
table.data tbody tr:nth-child(odd) {
  background: var(--surface-2);
}
table.data tbody tr:hover {
  background: var(--bg-2);
}
table.data tbody tr:last-child td {
  border-bottom: 1px solid var(--line);
}
table.data .num { text-align: right; font-family: var(--font-mono); font-size: 12px; }

/* Form */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; }
.input, .select, .textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px; color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.input:hover, .select:hover, .textarea:hover {
  border-color: var(--ink-3);
  background: var(--surface-2);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--bg-2);
  color: var(--ink-3);
  cursor: not-allowed;
}
.input.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* Bars / mini visualizations */
.bar { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar.accent > span { background: var(--accent); }
.bar.warn > span { background: var(--warn); }
.bar.danger > span { background: var(--danger); }

/* Divider */
.hr { height: 1px; background: var(--line); margin: var(--pad) 0; }

/* Section header */
.section-h {
  display: flex; align-items: center; justify-content: space-between;
  margin: 32px 0 16px 0;
}
.section-h:first-child { margin-top: 0; }

/* Alert */
.alert {
  display: flex; gap: 14px; padding: 14px 16px;
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--warn);
  background: var(--warn-100);
  box-shadow: var(--shadow-sm);
  align-items: flex-start;
}
.alert.danger { border-color: var(--danger); background: var(--danger-100); }
.alert.info { border-color: var(--info); background: var(--info-100); }
.alert-title { font-weight: 700; font-size: 12.5px; }
.alert-body { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

/* Login */
.login-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
}
.login-aside {
  background: linear-gradient(165deg, var(--primary-700) 0%, var(--primary) 55%, oklch(0.50 0.16 235) 100%);
  color: #fff;
  padding: 56px;
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.login-aside::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 90% 10%, rgba(255,255,255,0.12), transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.08), transparent 50%);
  pointer-events: none;
}
.login-form-wrap {
  display: grid; place-items: center;
  padding: 56px;
}
.login-form { width: 100%; max-width: 420px; }

/* Animations */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.pulse { animation: pulse-soft 2.4s ease-in-out infinite; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up .32s ease-out both; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* Tweaks panel adjustments */
.tweaks-fab { z-index: 50; }

/* Stage chips for EWS pipeline */
.pipe {
  display: flex; align-items: stretch; gap: 8px;
  background: var(--surface-2); padding: 10px; border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}
.pipe-stage {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  transition: all .12s;
}
.pipe-stage.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 14%, transparent);
}
.pipe-stage-num {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-4); font-weight: 600;
}
.pipe-stage-name { font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.pipe-stage-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.pipe-stage-led {
  position: absolute; top: 10px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
}
.pipe-divider { width: 8px; display: grid; place-items: center; color: var(--ink-4); font-size: 14px; }

/* Heatmap */
.heatmap { display: grid; gap: 2px; }
.heatmap-cell {
  aspect-ratio: 1; border-radius: 3px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink); font-weight: 600;
}

/* Menu plan */
.menu-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; background: var(--surface);
}

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--line); }
.tab {
  padding: 12px var(--pad);
  font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  cursor: pointer; border: 0; background: transparent;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
}
.tab:hover {
  color: var(--ink);
  background: var(--bg-2);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: transparent;
}

/* Code/formula block */
.formula {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--pad);
  color: var(--ink-2); line-height: 1.65;
  overflow-x: auto; white-space: pre;
}
.formula .op { color: var(--primary); font-weight: 600; }
.formula .var { color: oklch(0.50 0.14 25); }
.formula .num { color: var(--accent-700); }
.formula .cmt { color: var(--ink-4); font-style: italic; }

/* Supply chain flow diagram */
.flow-svg { width: 100%; height: auto; display: block; }

/* Tag */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 4px;
  background: var(--bg-2); color: var(--ink-2);
  font-size: 11px; font-weight: 500;
}
.tag.mono { font-family: var(--font-mono); font-size: 10.5px; }

/* Helpers */
.row { display: flex; align-items: center; gap: var(--pad); }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--pad); }
.gap-sm { gap: var(--pad-sm); }
.gap-xs { gap: 4px; }

/* Score chip 1-5 */
.score {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  background: var(--bg-2); color: var(--ink-2);
}
.score.s5, .score.s4 { background: var(--accent-100); color: var(--accent-700); }
.score.s3 { background: var(--warn-100); color: oklch(0.45 0.17 55); }
.score.s2, .score.s1 { background: var(--danger-100); color: var(--danger); }

/* Modals & Overlays */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 25, 45, 0.4); backdrop-filter: blur(1px);
  display: grid; place-items: center; z-index: 40;
}
.modal-content {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-width: 520px; width: 90%; max-height: 90vh; overflow-y: auto;
  animation: modal-appear 0.2s ease-out;
}
.modal-header {
  padding: var(--pad-lg); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header .h2 { margin: 0; }
.modal-body { padding: var(--pad-lg); }
.modal-footer {
  padding: var(--pad-lg); border-top: 1px solid var(--line);
  display: flex; gap: var(--pad); justify-content: flex-end;
}

@keyframes modal-appear {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
