/* 
   NEURAL OPTIONS LAB
   Apple HIG dark-mode design tokens. Elevation via background shifts,
   not borders. Single accent (systemBlue). SF Pro via system font stack,
   Inter as cross-platform fallback. JetBrains Mono for tabular data.
*/

:root {
  /* Apple dark-mode elevation ramp */
  --bg-0: #000000;
  --bg-1: #000000;
  --surface: #1c1c1e;
  --raised: #2c2c2e;
  --well: #141416;
  --line: rgba(84, 84, 88, 0.36);
  --line-hi: rgba(84, 84, 88, 0.65);

  /* Apple label hierarchy */
  --ink-hi: #f5f5f7;
  --ink: rgba(235, 235, 245, 0.6);
  --ink-mid: rgba(235, 235, 245, 0.3);
  --ink-low: rgba(235, 235, 245, 0.18);

  /* Apple system colors (dark mode) */
  --neural: #0A84FF;
  --neural-soft: rgba(10, 132, 255, 0.12);
  --classic: #FF9F0A;
  --classic-soft: rgba(255, 159, 10, 0.10);
  --single: #8E8E93;
  --mint: #30D158;
  --rose: #FF453A;

  /* type: SF Pro via system stack, Inter as web fallback */
  --font-display: "Inter", -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Inter", -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  /* geometry */
  --r-panel: 12px;
  --r-ctl: 8px;
  --shadow-ambient: 0 2px 8px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* every numeral in the app: mono + tabular so columns align perfectly */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* No decorative canvas layers: the background is a flat, quiet gradient.
   Ambient orbs, dot grids, and drifting glows read as generated design. */
.canvas-glow, .canvas-grid { display: none; }

/* Command Bar */
.cmd-bar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 20px;
  padding: 12px 28px;
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 18px; font-weight: 600;
  color: var(--ink-hi);
  background: var(--raised);
}
.brand-copy { display: flex; flex-direction: column; }
.brand-name {
  font-family: var(--font-display); font-size: 16.5px; font-weight: 600;
  letter-spacing: 0.02em; color: var(--ink-hi);
}
.brand-sub {
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-low); margin-top: 1px;
}

/* tab nav lives in the chrome — content area stays pure data */
.tab-nav {
  display: flex; gap: 1px; padding: 3px;
  background: var(--well);
  border-radius: var(--r-ctl);
}
.tab-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 7px 18px; border-radius: 6px;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--ink-mid);
  transition: color 0.2s ease, background 0.2s ease;
}
.tab-btn:hover { color: var(--ink-hi); }
.tab-btn.active {
  color: var(--ink-hi);
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line-hi);
}

.status-cluster {
  justify-self: end;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: var(--r-ctl);
  background: var(--surface);
}
.status-text { font-size: 11px; color: var(--ink-mid); }
.status-dot { width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-low); flex: none; }
.status-dot.ok { background: var(--mint); }
.status-dot.bad { background: var(--rose); }

/* Shell Layout */
.shell {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 296px 1fr; gap: 22px;
  max-width: 1640px; margin: 0 auto; padding: 22px 28px 44px;
  align-items: start;
}
@media (max-width: 1100px) { .shell { grid-template-columns: 1fr; } }

/* Parameter Rail */
.rail {
  position: sticky; top: 70px;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 18px;
  background: var(--surface);
  border-radius: var(--r-panel);
}
.rail-section { display: flex; flex-direction: column; gap: 14px; }
.rail-section + .rail-section { border-top: 1px solid var(--line);
  padding-top: 18px; }

/* the micro-label that anchors every section of the app */
.kicker {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-low);
}
h3 + p, .kicker + h3 { margin-top: 3px; }

/* ticker */
.ticker-row { display: flex; gap: 8px; }
.ticker-input {
  flex: 1; min-width: 0;
  background: var(--well); border: 1px solid var(--line);
  color: var(--ink-hi); border-radius: var(--r-ctl);
  padding: 9px 12px; font-size: 13px; text-transform: uppercase;
  outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ticker-input::placeholder { color: var(--ink-low); }
.ticker-input:focus { border-color: var(--neural);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.20); }

.market-chip {
  display: none; padding: 10px 12px; border-radius: var(--r-ctl);
  font-size: 11px; line-height: 1.65;
  background: var(--neural-soft);
  border: 1px solid rgba(10, 132, 255, 0.20); color: var(--ink);
}
.market-chip.show { display: block; }
.market-chip .warn { color: var(--rose); }
.market-chip b { color: var(--ink-hi); }

/* segmented controls — shared by call/put, MC paths, error metric */
.segmented {
  display: flex; gap: 3px; padding: 3px;
  background: var(--well); border: 1px solid var(--line);
  border-radius: var(--r-ctl);
}
.seg-btn {
  flex: 1; padding: 7px 0; border: none; border-radius: 6px;
  background: transparent; color: var(--ink-mid);
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.segmented.dense .seg-btn { padding: 6px 10px; font-size: 11.5px; }
.seg-btn.mono { font-family: var(--font-mono); font-weight: 500; }
.seg-btn:hover { color: var(--ink-hi); }
.seg-btn.active {
  background: var(--raised);
  color: var(--ink-hi);
  box-shadow: inset 0 0 0 1px var(--line-hi);
}

/* parameter sliders */
.param { display: flex; flex-direction: column; gap: 8px; }
.param-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; color: var(--ink-mid);
}
.param-head .sym { font-family: var(--font-mono); font-style: normal;
  font-size: 11px; color: var(--ink-low); margin-left: 3px; }
.param-val {
  font-size: 13px; font-weight: 500; color: var(--ink-hi);
  padding: 2px 9px; border-radius: 5px; background: var(--raised);
  transition: transform 0.15s ease, color 0.15s ease;
}
.param:active .param-val { transform: scale(1.1); color: var(--neural); }

/* the track fill is painted by app.js via the --fill custom property */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--neural) var(--fill, 50%),
              rgba(255, 255, 255, 0.09) var(--fill, 50%));
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-hi); border: 1px solid var(--line-hi);
  transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink-hi); border: 1px solid var(--line-hi);
}

.readout-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 13px; border-radius: var(--r-ctl);
  background: var(--well); border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-mid);
}
.readout-row .mono { color: var(--ink-hi); }

.domain-warning {
  display: none; font-size: 11.5px; line-height: 1.5; color: var(--rose);
  padding: 9px 12px; border-radius: var(--r-ctl);
  background: rgba(255, 107, 129, 0.08);
  border: 1px solid rgba(255, 107, 129, 0.3);
}
.domain-warning.show { display: block; }

.rail-note {
  font-size: 11px; line-height: 1.7; color: var(--ink-low);
  border-top: 1px solid var(--line); padding-top: 16px;
}

/* Stage and Panels */
.stage { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.tab-pane { display: none; flex-direction: column; gap: 20px; }
.tab-pane.active { display: flex; }

/* the workhorse panel: elevation from background, one hairline, air */
.panel {
  background: var(--surface);
  border-radius: var(--r-panel);
}

/* Hero Row: NN price dominates, dial pivots, MC answers */
.hero { display: grid; grid-template-columns: 1.15fr 0.7fr 1.15fr; gap: 18px; }
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; } }

.hero-card { padding: 20px 24px; }
/* Data-source identity comes from the labeled tag chips alone. Colored
   card edges and hover lifts on non-interactive surfaces are decoration. */

.panel-tag {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.tag {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 5px;
}
.tag-nn { color: var(--neural); background: var(--neural-soft); }
.tag-mc { color: var(--classic); background: var(--classic-soft); }
.meta { font-size: 11px; color: var(--ink-mid); }
.meta.accent { color: var(--neural); }

.price {
  font-size: 44px; font-weight: 500; letter-spacing: -0.02em;
  line-height: 1.05; color: var(--ink-hi);
}
.card-sub { margin-top: 10px; font-size: 11.5px; color: var(--ink-mid); }
.card-sub.centered { text-align: center; }
.agreement-ok { color: var(--mint) !important; }
.agreement-warn { color: var(--rose) !important; }

/* speedup: a plain centered statistic, no ornament */
.hero-vs { display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; }
.dial { display: grid; place-items: center; }
.dial-ring { display: none; }
.dial-core { display: flex; flex-direction: column; align-items: center;
  gap: 2px; }
.dial-label {
  font-family: var(--font-display); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-low);
}
.speedup {
  font-size: 32px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink-hi);
}

/* Greeks: A single dense instrument strip */
.greek-strip {
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 0;
}
@media (max-width: 980px) { .greek-strip { grid-template-columns: repeat(2, 1fr); } }
.greek {
  display: flex; align-items: baseline; gap: 9px;
  padding: 15px 20px;
  border-left: 1px solid var(--line);
  transition: background 0.2s ease;
}
.greek:first-child { border-left: none; }
.greek:hover { background: var(--raised); }
.greek-sym {
  font-family: var(--font-mono); font-size: 16px; color: var(--neural);
  opacity: 0.7;
}
.greek-name {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-low);
}
.greek-val { margin-left: auto; font-size: 16.5px; font-weight: 500;
  color: var(--ink-hi); }

/* Charts */
.grid-75 { display: grid; grid-template-columns: 7fr 5fr; gap: 20px; }
@media (max-width: 1240px) { .grid-75 { grid-template-columns: 1fr; } }

.chart-panel { padding: 20px 22px 14px; }
.chart-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 10px;
}
.chart-head h3 {
  font-family: var(--font-display); font-size: 15.5px; font-weight: 600;
  color: var(--ink-hi); letter-spacing: 0.01em;
}
.chart-head p { font-size: 11.5px; color: var(--ink-mid); margin-top: 3px;
  max-width: 60ch; }
.chart-tools { display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; flex: none; }

.plot { height: 330px; position: relative; }
.plot.tall { height: 460px; }

/* buttons */
.btn {
  padding: 8px 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-hi);
  background: var(--raised); color: var(--ink);
  font-family: var(--font-display); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all 0.2s ease;
}
.btn:hover { border-color: var(--line-hi); color: var(--ink-hi); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: wait; }
.btn-accent {
  border: none;
  background: var(--neural); color: #fff;
}
.btn-accent:hover { background: #0077e6; }
.btn-accent:active { background: #006acc; }

/* loading shimmer inside empty plot containers */
.shimmer {
  position: absolute; inset: 10px; border-radius: 12px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.025) 30%,
              rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.025) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Hedging Tab */
.cost-slider-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--ink-mid); white-space: nowrap;
}
.cost-slider-row input[type="range"] { width: 130px; }

.hedge-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 8px 0 14px;
}
@media (max-width: 980px) { .hedge-stats { grid-template-columns: repeat(2, 1fr); } }
.hedge-stat {
  padding: 13px 16px; border-radius: var(--r-ctl);
  background: var(--well); border: 1px solid var(--line);
}
.hedge-stat .k {
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-low);
}
.hedge-stat .v {
  display: block; margin-top: 6px; font-size: 17px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--ink-hi);
}
.hedge-stat .v.good { color: var(--mint); }

/* Live Stream Stats */
.stream-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin: 8px 0 14px;
}
@media (max-width: 980px) { .stream-stats { grid-template-columns: repeat(2, 1fr); } }
.stream-stat {
  padding: 13px 16px; border-radius: var(--r-ctl);
  background: var(--well); border: 1px solid var(--line);
}
.stream-stat .k {
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-low);
}
.stream-stat .v {
  display: block; margin-top: 6px; font-size: 17px;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--ink-hi);
}
.stream-stat .v.live { color: var(--neural); }

.btn-stream-active {
  border-color: rgba(77, 186, 142, 0.5) !important;
  background: rgba(77, 186, 142, 0.12) !important;
  color: var(--mint) !important;
}

/* AI Risk Report: A reading surface, not a chart */
.report-panel { min-height: 420px; }
.report-body {
  margin-top: 6px; padding: 22px 26px;
  border-radius: var(--r-ctl);
  background: var(--well); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.7; color: var(--ink);
  white-space: pre-wrap; max-width: 88ch;
}
/* streaming caret while the LLM writes */
.report-body.streaming::after {
  content: "▌"; color: var(--neural);
  animation: caret 0.9s steps(1) infinite; margin-left: 2px;
}
@keyframes caret { 50% { opacity: 0; } }

.colophon {
  text-align: center; font-size: 11px; color: var(--ink-low);
  line-height: 1.7; padding: 6px 0 2px;
}

/* stale-while-updating: readouts dim while a newer request is in flight */
.updating .price, .updating .greek-val, .updating .speedup {
  opacity: 0.45; transition: opacity 0.2s ease;
}

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