:root {
  color-scheme: dark;
  --bg: #070a12;
  --bg-gradient:
    radial-gradient(circle at 15% 0%, rgba(99, 102, 241, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 85% 25%, rgba(56, 189, 248, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.07) 0%, transparent 50%);

  --panel: #0d1424;
  --panel-card: rgba(15, 23, 42, 0.68);
  --panel-card-hover: rgba(22, 33, 58, 0.82);
  --panel-sub: rgba(0, 0, 0, 0.28);

  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --border-focus: #818cf8;

  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --mute: #94a3b8;
  --subtle: #64748b;

  --bs-primary: #818cf8;
  --bs-gradient: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  --bs-glow: rgba(129, 140, 248, 0.25);

  --mc-primary: #38bdf8;
  --mc-gradient: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  --mc-glow: rgba(56, 189, 248, 0.25);

  --up: #10b981;
  --up-glow: rgba(16, 185, 129, 0.25);
  --down: #f59e0b;
  --down-glow: rgba(245, 158, 11, 0.25);
  --danger: #f43f5e;
  --exp: #e2e8f0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.32);
  --shadow-hover: 0 14px 40px rgba(0, 0, 0, 0.45);

  --font-main: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

/* Global Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

::selection {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #080c16;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

.app-container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 24px 28px 52px;
}

/* Multi-Model Selector Bar (OG Selector) */
.model-nav {
  margin-bottom: 18px;
}

.model-nav-inner {
  display: flex;
  align-items: center;
  background: var(--panel-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  gap: 12px;
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  scrollbar-width: none;
}

.model-nav-inner::-webkit-scrollbar {
  display: none;
}

.model-nav-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
  padding: 0 10px 0 2px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.model-nav-icon {
  width: 15px;
  height: 15px;
  color: var(--bs-primary);
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Two Independent Cards Side-by-Side: Parameters (68%) & Methodology Guide (32%) */
.top-row-grid {
  display: grid;
  grid-template-columns: minmax(0, 68%) minmax(0, calc(32% - 18px));
  gap: 18px;
  margin-bottom: 22px;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .top-row-grid {
    grid-template-columns: 1fr;
  }
}

/* Controls Card (Left Box) */
.controls-card {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
}

.controls-card-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  height: 100%;
}

@media (max-width: 900px) {
  .controls-card-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: stretch;
  }
}

/* Column 1: Stacked Action Buttons */
.buttons-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 20px;
}

@media (max-width: 900px) {
  .buttons-column {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-right: 0;
    padding-bottom: 16px;
  }
}

.buttons-column .segmented-control {
  width: 100%;
  padding: 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  gap: 5px;
  margin-bottom: 10px;
}

.buttons-column .seg-btn {
  height: 38px;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 7px;
  gap: 8px;
}

.buttons-column .btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 40px;
  letter-spacing: 0.01em;
}

.btn-reset {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--mute) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  font-size: 0.82rem !important;
}

/* Column 2: Parameters Grid */
.params-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.status-pill {
  font-size: 0.74rem;
  color: var(--mute);
  padding: 5px 11px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* Parameters Ribbon (4 columns x 2 rows in 68% container) */
.params-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, 101px);
  gap: 12px;
  height: 214px;
}

@media (max-width: 768px) {
  .params-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    height: auto;
  }
}

.param-item {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  height: 101px;
  box-sizing: border-box;
}

.param-label-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
  min-height: 35px;
}

.param-label-row label {
  white-space: normal;
  line-height: 1.25;
  font-size: 0.83rem;
  font-weight: 600;
  color: #e2e8f0;
  cursor: pointer;
  letter-spacing: -0.01em;
  word-break: normal;
}

.param-label-row label[for="D"] {
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.param-item .control-val {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 2px 6px;
  min-width: 40px;
  text-align: center;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: #a5b4fc;
  flex-shrink: 0;
  line-height: 1.25;
}

.param-item input[type="range"] {
  margin: 3px 0 2px 0;
  height: 6px;
}

.param-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.71rem;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-weight: 500;
  line-height: 1;
}


.model-nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.model-nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--mute);
  font-family: var(--font-main);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.model-nav-tab.active {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.42);
  color: #ffffff;
  box-shadow: 0 2px 14px rgba(99, 102, 241, 0.22);
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--subtle);
  transition: background 0.2s ease, transform 0.2s ease;
}

.model-nav-tab.active .tab-dot {
  background: #818cf8;
  box-shadow: 0 0 8px #818cf8;
  transform: scale(1.15);
}

.tab-badge {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--mute);
}

.model-nav-tab.active .tab-badge {
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}

.tab-badge.badge-slot {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  font-size: 0.65rem;
  opacity: 0.85;
}

/* KPI Summary Banner */
.kpi-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}

@media (max-width: 960px) {
  .kpi-banner {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .kpi-banner {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  position: relative;
  background: var(--panel-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.kpi-card:nth-child(1)::before {
  background: linear-gradient(90deg, #6366f1, #a855f7);
}

.kpi-card:nth-child(2)::before {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.kpi-card:nth-child(3)::before {
  background: linear-gradient(90deg, #f59e0b, #ec4899);
}

.kpi-card:nth-child(4)::before {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}

.kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-meta {
  font-size: 0.78rem;
  color: var(--subtle);
  font-weight: 500;
}

/* Main Content Layout */
.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Charts Grid (All 4 Quantitative Visualizers in 2x2 Layout) */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  height: 100%;
  box-sizing: border-box;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.card {
  background: var(--panel-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Chart Headers - Fixed Height Anchor for Grid Symmetry */
.chart-header {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  min-height: 78px;
}

.chart-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

@media (max-width: 768px) {
  .chart-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

.chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.model-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag-bs {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.tag-mc {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.chart-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #ffffff;
  margin: 0;
  line-height: 1.25;
}

.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  color: var(--mute);
}

.pill-bs {
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.08);
}

.pill-mc {
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.08);
}

.chart-badge-accent {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--mute);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.chart-desc {
  font-size: 0.875rem;
  color: var(--ink-secondary);
  margin: 0;
  line-height: 1.5;
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tab Group (Segmented Pill Switcher) */
.tab-group {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--mute);
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-main);
  white-space: nowrap;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* Canvas Wrapper */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 350px;
  background: radial-gradient(ellipse at 50% 50%, rgba(17, 24, 39, 0.4) 0%, rgba(8, 12, 22, 0.85) 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.35);
}

canvas {
  display: block;
  width: 100%;
  height: 350px;
  touch-action: none;
}

/* Chart Tooltip */
.chart-tooltip {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.77rem;
  font-family: var(--font-mono);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 20;
  line-height: 1.45;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}

/* Chart Legends - Balanced spacing right above Metrics Grid */
.chart-legend {
  display: flex;
  gap: 6px 14px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--mute);
  margin-bottom: 10px;
  padding: 0 2px;
  min-height: 24px;
  align-items: center;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chart-legend i {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.legend-dot {
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
}

/* Metrics Grid (Financial Tile View - 3 Columns per Chart Card) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

@media (max-width: 540px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-height: 58px;
  box-sizing: border-box;
  gap: 3px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.m-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.m-val {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

/* Sidebar Controls */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.controls-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.btn-text {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.22);
  color: var(--bs-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

/* Sidebar Section Titles & Dividers */
.sidebar-section-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mute);
  margin-bottom: 9px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Option Contract Segmented Control (Call / Put) */
.option-toggle-wrap {
  margin-bottom: 12px;
}

.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
}

.seg-btn {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--mute);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.seg-btn.active {
  color: #ffffff;
}

.seg-btn.active[data-opt="call"] {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.36);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.seg-btn.active[data-opt="put"] {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.36);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
}

.seg-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.model-specific-slot {
  display: flex;
  flex-direction: column;
}

.control-group {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: border-color 0.2s, background 0.2s;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

.control-val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

/* Custom Range Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  margin: 8px 0 6px 0;
  transition: background 0.15s ease;
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* WebKit Slider Thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--bs-primary);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, background 0.15s ease;
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.3);
  background: #e0e7ff;
  border-color: #a5b4fc;
  box-shadow: 0 0 20px rgba(129, 140, 248, 1), 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Firefox Slider Thumb & Progress */
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--bs-primary);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
}

input[type="range"]::-moz-range-progress {
  background: linear-gradient(90deg, #6366f1, #818cf8);
  height: 6px;
  border-radius: 6px;
}

.range-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--subtle);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* Action Buttons */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-main);
  border: 1px solid transparent;
}

.btn-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-primary {
  background: #4f46e5;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.btn-primary:active {
  background: #3730a3;
  transform: translateY(1px);
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(1px);
  box-shadow: none;
}

/* Status Message Box */
.status-msg {
  font-size: 0.78rem;
  color: var(--mute);
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

/* Model Formulation Card (Right Box) */
.formulation-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

/* Header Row: Title & Tag */
.formulation-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 8px;
}

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

.formulation-icon {
  width: 16px;
  height: 16px;
  color: var(--bs-primary);
  flex-shrink: 0;
}

.formulation-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f1f5f9;
  line-height: 1;
}

/* Subtle Divider */
.formulation-divider {
  height: 1px;
  width: calc(100% - 16px);
  background: rgba(255, 255, 255, 0.08);
  margin: 12px auto;
}

/* Formulation Body */
.formulation-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 0 8px;
}

.formulation-model-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
}

.formulation-desc {
  font-size: 0.82rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin: 0;
  width: 100%;
}

/* Equation Showcase Box */
.formulation-equation-box {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 12px 14px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.formulation-equation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 6px;
  padding-bottom: 2px;
}

.equation-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.equation-accent {
  color: #818cf8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  line-height: 1.3;
}

.equation-code-wrap {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  padding: 2px 0;
}

.formulation-code {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: #c7d2fe;
  background: transparent;
  border: none;
  padding: 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-shadow: 0 0 18px rgba(99, 102, 241, 0.35);
}

.code-pill {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: #c7d2fe;
  word-break: normal;
}

/* Antithetic Variates Header Badge Button */
.chart-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-antithetic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 3px 10px;
  color: #94a3b8;
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-antithetic-badge .anti-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.4);
  transition: all 0.2s ease;
}

.btn-antithetic-badge.active {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(14, 165, 233, 0.55);
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
}

.btn-antithetic-badge.active .anti-badge-dot {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

[hidden] {
  display: none !important;
}

/* Variance Reduction Metrics Panel */
.variance-reduction-panel {
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s ease;
}

.variance-reduction-panel[hidden] {
  display: none !important;
}

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

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

.vr-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #38bdf8;
}

.vr-method {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--mute);
}

.vr-gain-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
}

.vr-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

@media (max-width: 600px) {
  .vr-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.vr-item {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vr-label {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.vr-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

.vr-val-accent {
  color: #38bdf8;
}

/* Advanced Greeks Expandable Panel */
.advanced-greeks-container {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.advanced-greeks-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  color: #94a3b8;
  font-family: var(--font-main);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  width: 100%;
}

.adv-greeks-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.adv-greeks-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.advanced-greeks-toggle[aria-expanded="true"] .adv-greeks-arrow {
  transform: rotate(180deg);
}

.advanced-greeks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

@media (max-width: 600px) {
  .advanced-greeks-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.m-sub {
  font-size: 0.62rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 1px;
}

/* ==========================================================================
   RESEARCH JOURNAL THEME — applied to the ORIGINAL layout
   ========================================================================== */

:root {
  color-scheme: light;

  --paper: #F1EEE4;
  --paper-raised: #F8F6EF;
  --ink: #1D2621;
  --ink-soft: #4E5751;
  --ink-mute: #6D746D;
  --rule: #C7C0AF;
  --accent: #2E6B5B;
  --accent-wash: rgba(46, 107, 91, .10);
  --signal: #A13D30;
  --signal-wash: rgba(161, 61, 48, .10);
  --font-display: "Newsreader", Georgia, serif;
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;

  /* Remap legacy tokens so original rules follow the paper theme. */
  --bg: var(--paper);
  --bg-gradient: none;
  --panel: var(--paper-raised);
  --panel-card: var(--paper-raised);
  --panel-card-hover: var(--paper-raised);
  --panel-sub: transparent;
  --border: var(--rule);
  --border-light: var(--rule);
  --border-focus: var(--accent);
  --ink-secondary: var(--ink-soft);
  --mute: var(--ink-mute);
  --subtle: var(--ink-mute);
  --bs-primary: var(--accent);
  --bs-gradient: none;
  --bs-glow: transparent;
  --mc-primary: var(--accent);
  --mc-gradient: none;
  --mc-glow: transparent;
  --up: var(--accent);
  --up-glow: transparent;
  --down: var(--signal);
  --down-glow: transparent;
  --danger: var(--signal);
  --exp: var(--ink);
  --font-main: var(--font-ui);
  --font-mono: var(--font-ui);
  --shadow-card: none;
  --shadow-hover: none;
}

body {
  background: var(--paper);
  background-image: none;
  color: var(--ink);
  font-family: var(--font-ui);
}

::selection {
  background: var(--accent-wash);
  color: var(--ink);
}

::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--rule); }

.card,
.controls-card,
.guide-card,
.formulation-card,
.chart-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
}

.pill,
.pill-bs,
.pill-mc {
  background: var(--accent-wash);
  border: 1px solid var(--rule);
  color: var(--accent);
}

.chart-badge-accent,
.formulation-title,
.model-nav-label {
  color: var(--ink-soft);
}

/* ==========================================================================
   RESEARCH JOURNAL — editorial layer
   ========================================================================== */

@keyframes masthead-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-container {
  max-width: 1520px;
  margin: 0 auto;
  padding: 34px 40px 80px;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: start;
}

#readingColumn {
  grid-column: 1;
}

#paramRail {
  grid-column: 2;
}

/* Masthead */
#masthead {
  animation: masthead-in 0.6s ease-out both;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 34px;
}

.model-nav-label {
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.01em;
}

.model-nav {
  margin: 0;
}

.model-nav-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow-x: auto;
}

.model-nav-label {
  padding: 0 14px 0 0;
  border-right: 1px solid var(--rule);
  white-space: nowrap;
  color: var(--ink-mute);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.model-nav-icon {
  display: none;
}

.model-nav-tabs {
  gap: 2px;
}

.model-nav-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 7px 12px;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.model-nav-tab.active {
  background: transparent;
  color: var(--accent);
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.tab-dot {
  display: none;
}

/* Parameter rail */
.param-rail {
  border-left: 1px solid var(--rule);
  padding-left: 24px;
  position: sticky;
  top: 20px;
}

.rail-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.params-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 26px;
  row-gap: 0;
}

.param-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 12px 0;
  box-shadow: none;
}

.param-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.param-item label {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 500;
}

.param-item .control-val,
.control-val {
  color: var(--ink);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  font-weight: 600;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  text-align: left;
}

.param-item input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  margin: 4px 0;
  border-radius: 0;
  background: var(--rule);
  cursor: pointer;
}

.param-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.param-item input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.param-bounds {
  display: flex;
  justify-content: space-between;
  color: var(--ink-mute);
  font-size: 0.66rem;
  margin-top: 3px;
}

/* Lead */
.reading-column {
  min-width: 0;
}

.lead {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.lead-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

#leadTitle {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4.2vw, 3.6rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
}

#leadDeck {
  max-width: 64ch;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.65;
}

.segmented-control {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 0;
  gap: 0;
}

.seg-btn {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--ink-mute);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 14px;
}

.seg-btn.active {
  background: transparent;
  color: var(--accent);
  border-bottom-color: var(--accent);
  box-shadow: none;
}

/* Facts row */
.kpi-banner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  background: transparent;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 0;
  margin: 0 0 20px;
  box-shadow: none;
}

.kpi-card {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
  padding: 14px 18px;
}

.kpi-card:last-child {
  border-right: 0;
}

.kpi-card::before,
.kpi-card:nth-child(n)::before {
  background: transparent;
}

.kpi-label,
.kpi-meta {
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0;
  text-transform: none;
}

.kpi-value {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
}

/* Actions */
.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 26px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 7px 11px;
  cursor: pointer;
}

.action-primary {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.action-btn .anti-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rule);
}

.action-btn.active .anti-badge-dot {
  background: var(--accent);
}

/* Figures */
.figures-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 32px;
}

.figure {
  margin: 0 0 40px;
  padding: 26px 0 18px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: transparent;
  min-width: 0;
}

.figure-hero {
  grid-column: 1 / -1;
  padding-top: 20px;
}

.figures-grid .figure {
  margin-bottom: 0;
}

.figure-header {
  margin-bottom: 18px;
}

.figure-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.figure h2 {
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.figure-tag {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-wash);
  border: 0;
  border-radius: 0;
  padding: 3px 8px;
  text-transform: none;
  letter-spacing: 0;
}

.figure-aside {
  display: block;
  color: var(--ink-mute);
  font-size: 0.72rem;
  margin-top: 4px;
}

.figure-desc {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.55;
  max-width: 72ch;
  margin-top: 10px;
}

.canvas-wrapper {
  position: relative;
  height: 330px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.figure-hero .canvas-wrapper {
  height: 420px;
}

.chart-tooltip {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(29, 38, 33, 0.12);
}

.chart-legend {
  color: var(--ink-soft);
  font-size: 0.72rem;
  padding-top: 10px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--rule);
}

.metric-item {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 9px 10px;
}

.m-label {
  color: var(--ink-mute);
  font-size: 0.68rem;
  text-transform: none;
  letter-spacing: 0;
}

.m-val {
  color: var(--ink);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 600;
}

figcaption {
  color: var(--ink-mute);
  font-size: 0.74rem;
  line-height: 1.5;
  padding-top: 12px;
}

/* Notes */
.note {
  background: var(--accent-wash);
  border-left: 2px solid var(--accent);
  padding: 18px 20px;
  margin: 0 0 32px;
}

.note .formulation-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}

.note .formulation-model-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
}

.note .formulation-desc {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.6;
}

.note .equation-tag,
.note .equation-accent {
  font-size: 0.68rem;
  text-transform: none;
  letter-spacing: 0;
}

.note .equation-tag {
  color: var(--ink-mute);
}

.note .equation-accent {
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
}

.note .code-pill,
.note .formulation-code {
  color: var(--ink);
  background: var(--paper-raised);
  border: 0;
  border-radius: 0;
}

.note .formulation-equation-box,
.note .advanced-greeks-container {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
}

.variance-reduction-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.vr-badge {
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}

.advanced-greeks-toggle {
  background: transparent;
  border: 0;
  color: var(--accent);
  font-size: 0.82rem;
  border-radius: 0;
}

.advanced-greeks-grid {
  animation: none;
}

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .app-container {
    padding: 24px 22px 56px;
  }
  .app-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  #paramRail {
    order: -1;
    position: static;
    border-left: 0;
    border-bottom: 1px solid var(--rule);
    padding: 0 0 18px;
  }
  .params-ribbon {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }
  .figures-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #leadTitle {
    font-size: 2.15rem;
  }
  .kpi-banner,
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .params-ribbon {
    grid-template-columns: 1fr;
  }
  .canvas-wrapper,
  .figure-hero .canvas-wrapper {
    height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #masthead {
    animation: none;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* Guard: preserve the original layout geometry. */
.params-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, 101px);
  gap: 12px;
  height: 214px;
}

@media (min-width: 901px) {
  .canvas-wrapper,
  canvas {
    height: 350px;
  }
}

.app-container {
  padding: 24px 28px 52px;
}

@media (min-width: 601px) and (max-width: 900px) {
  .params-ribbon {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Final pass: replace remaining hardcoded dark-theme literals. */
.segmented-control {
  background: var(--paper);
  border: 1px solid var(--rule);
}

.seg-btn.active,
.seg-btn.active[data-opt="call"] {
  background: var(--accent-wash);
  color: var(--accent);
  border-color: var(--rule);
  box-shadow: none;
}

.seg-btn.active[data-opt="put"] {
  background: var(--signal-wash);
  color: var(--signal);
  border-color: var(--rule);
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--paper-raised);
  border: 1px solid var(--accent);
  box-shadow: none;
}

.btn-secondary,
.btn-reset {
  background: var(--paper-raised) !important;
  color: var(--ink) !important;
  border: 1px solid var(--rule) !important;
  box-shadow: none;
}

.chart-header h2 {
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 500;
  color: var(--ink);
}

.formulation-model-name {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
}

.formulation-equation-box {
  background: var(--paper);
  border: 1px solid var(--rule);
}

.equation-tag {
  color: var(--ink-mute);
  text-transform: none;
  letter-spacing: 0;
}

.formulation-code {
  color: var(--ink);
  text-shadow: none;
}

.canvas-wrapper {
  background: var(--paper-raised);
  border-radius: 0;
  box-shadow: none;
}

.buttons-column .segmented-control {
  background: var(--paper);
  border: 1px solid var(--rule);
}

.equation-accent {
  background: var(--accent-wash);
  border: 1px solid var(--rule);
  color: var(--accent);
}

/* Review fixes: panels and toggles */
.vr-item {
  background: transparent;
  border: 1px solid var(--rule);
}

.vr-val {
  color: var(--ink);
}

.vr-val-accent {
  color: var(--accent);
}

.vr-gain-tag {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: var(--rule);
}

.btn-antithetic-badge {
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink-mute);
  box-shadow: none;
}

.btn-antithetic-badge.active {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.btn-antithetic-badge.active .anti-badge-dot {
  background: var(--accent);
  box-shadow: none;
}

.m-sub {
  color: var(--ink-mute);
}

.formulation-title,
.chart-badge-accent,
.vr-label {
  text-transform: none;
}

.chart-tooltip {
  font-variant-numeric: tabular-nums;
}
