
html, body { min-height: 100%; background: var(--bg) !important; color: var(--text) !important; }
body { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.header-bar, .header-container, .gex-app, .gex-shell, .gex-main, .gex-content, .gex-page, .gex-container, .gex-view, .chart-section, #chart-widgets-container { background: var(--bg) !important; color: var(--text) !important; }
.header-bar { border-color: var(--line) !important; }
.header-bar a, .header-bar h1, .header-bar h2, .header-bar h3, .header-bar h4, .header-bar span { color: var(--text) !important; }
.gex-view > *, #gex-bars-view, #gex-ohlc-view, #gex-term-container, #gex-heatmap-view, #gex-flow-view, #gex-forecast-view, #forecast-chart-stage { background: var(--panel) !important; color: var(--text) !important; }
.gex-panel, .gex-card, .gex-chart-container, .gex-ctx-panel, .v2-drawer, .gex-modal-content, .gex-term-container, .gex-ohlc-container { background: var(--panel) !important; border-color: var(--line) !important; color: var(--text) !important; }
.strike-summary-rail, [class*="srail"], .markers-section, .markers-widget, .markers-widget-header, .markers-widget-body, .marker-display, .slider-section-container, .slider-header, .slider-wrapper { background: var(--panel) !important; border-color: var(--line) !important; color: var(--text) !important; }
.strike-summary-rail *, [class*="srail"] *, .markers-widget *, .slider-section-container * { color: inherit; }
.gex-nav-bar, .gex-header, .gex-control-toolbar { background: var(--panel) !important; border-color: var(--line) !important; }
button, select, input, textarea { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
button:hover, select:focus, input:focus, textarea:focus { border-color: var(--accent) !important; }
.gex-nav-view.active, .gex-category-tab.active, .ctx-preset.is-active { color: var(--accent) !important; border-color: var(--accent) !important; }
.gex-live-dot, .v2-live-dot, .positive, .buy { color: var(--up) !important; }
.gex-ctx-list li:hover, .gex-ctx-list li.is-active { background: var(--accent-soft) !important; }
.gex-ctx-list .is-empty { color: var(--muted); cursor: default; }
.ctx-li-icon-fallback { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.v2-data-unavailable { margin: 24px; padding: 48px 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: center; }
.js-plotly-plot, .plot-container, .svg-container, .gex-chart-stage, .v2-ohlc-main, .v2-strike-dock, #gex-chart, #gex-term-plot, #gex-forecast-plot, #gex-flow-plot, #gex-heatmap-view { background: var(--panel) !important; }
.v2-flow-view, .v2-history-view { background: var(--panel) !important; color: var(--text) !important; }
.v2-data-unavailable p, .gex-chart-title span, .gex-ctx-col-label { color: var(--muted); }
.v2-source-unavailable, .v2-source-error, .v2-source-unavailable .v2-source-error { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line) !important; }
#gex-forecast-view, #gex-forecast-view > *, #gex-flow-view, #gex-flow-view > *, #gex-heatmap-view, #gex-heatmap-view > *, #gex-term-container, #gex-term-container > * { background: var(--panel) !important; color: var(--text) !important; }
.gex-chart-title, .v2-flow-view .gex-chart-title, .v2-history-view .gex-chart-title { color: var(--text) !important; }
@media (max-width: 850px) { .gex-nav-bar { overflow-x: auto; } .gex-nav-bar > * { min-width: 0 !important; } }

/* GammaFlip presentation pass: keep the source UI structure, but make every
   interactive surface belong to the Option dark theme.  These selectors are
   deliberately scoped to GammaFlip's generated regions so Bootstrap's
   shared styles remain available to the auth and subscription dialogs. */
body[data-bs-theme="light"],
body.v2-ready[data-bs-theme="light"] {
  color-scheme: dark;
}

.gex-nav-bar,
.gex-nav-bar > *,
.gex-nav-axis,
.gex-nav-axis-btns,
.gex-nav-axis-label,
.gex-nav-axis-sep,
.gex-nav-axis-chip-menu,
.gex-subnav,
.gex-header,
.gex-control-toolbar {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.gex-controls-trigger,
.reach-prob-toggle {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

/* Controls are injected outside the navigation subtree, so they need their
   own explicit theme instead of relying on the surrounding toolbar. */
#gex-controls-popover,
#gex-controls-sheet,
#gex-controls-sheet .gex-sheet-panel,
#gex-controls-sheet .gex-sheet-body,
#gex-controls-popover .gex-field,
#gex-controls-sheet .gex-field {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

#gex-controls-popover {
  box-shadow: 0 16px 40px rgb(0 0 0 / 52%);
}

#gex-controls-popover h4,
#gex-controls-sheet h4,
#gex-controls-popover .gex-field-text,
#gex-controls-sheet .gex-field-text,
#gex-controls-popover label,
#gex-controls-sheet label {
  color: var(--text) !important;
}

#gex-controls-popover .gex-field-help,
#gex-controls-sheet .gex-field-help,
#gex-controls-popover .gex-field-value,
#gex-controls-sheet .gex-field-value {
  color: var(--muted) !important;
}

#gex-controls-popover select,
#gex-controls-sheet select {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.gex-nav-bar {
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line) !important;
  border-radius: 10px;
}

.gex-nav-view,
.gex-category-tab,
.gex-nav-axis button,
.gex-nav-axis select,
.gex-nav-axis-chip-menu button,
.gex-segmented-btn,
.marker-toggle,
.marker-toggle-style {
  background: transparent !important;
  color: var(--muted) !important;
  border-color: transparent !important;
}

.gex-nav-view:hover,
.gex-category-tab:hover,
.gex-nav-axis button:hover,
.gex-nav-axis-chip-menu button:hover,
.gex-nav-view.active,
.gex-category-tab.active,
.gex-category-tab[data-cat][aria-selected="true"],
.gex-nav-view[aria-selected="true"],
.gex-nav-axis-chip-menu button.active,
.gex-segmented-btn.active,
.marker-toggle.active,
.marker-toggle-style.active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.gex-nav-view:focus-visible,
.gex-category-tab:focus-visible,
.gex-nav-axis button:focus-visible,
.gex-nav-axis-chip-menu button:focus-visible,
.marker-toggle:focus-visible,
.marker-item:focus-visible,
.srail-help-btn:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
}

/* Context picker and its three columns. */
#gex-ctx-modal {
  background: color-mix(in srgb,var(--bg) 72%,transparent) !important;
  color: var(--text) !important;
}

#gex-ctx-modal .gex-ctx-card,
#gex-ctx-modal .gex-ctx-panel,
#gex-ctx-modal .gex-ctx-col,
#gex-ctx-modal .gex-ctx-list,
#gex-ctx-modal .ctx-exp-presets,
#gex-ctx-modal .ctx-preset,
#gex-ctx-modal input,
#gex-ctx-modal select {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

#gex-ctx-modal .gex-ctx-card {
  box-shadow: 0 18px 48px rgb(0 0 0 / 42%);
}

#gex-ctx-modal .gex-ctx-card * {
  color: var(--text) !important;
}

#gex-ctx-modal .gex-ctx-col-label,
#gex-ctx-modal .gex-ctx-col small,
#gex-ctx-modal .gex-ctx-help,
#gex-ctx-modal .ctx-preset small {
  color: var(--muted) !important;
}

#gex-ctx-modal .gex-ctx-list li:hover,
#gex-ctx-modal .gex-ctx-list li.is-active,
#gex-ctx-modal .ctx-preset.is-active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* Summary cards: title, number and units get their own columns so long
   proxy labels never compete with the value. */
.strike-summary-rail,
.srail-card,
.srail-card-head,
.srail-card-values,
.srail-card-spark,
.srail-card-hint,
.srail-card-divider {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.srail-card {
  border: 1px solid var(--line) !important;
  border-radius: 10px;
  padding: 12px;
}

.srail-card-head {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 9px;
}

/* Net/absolute cards use a deliberate second row for the numeric readout.
   This keeps long GEX proxy subtitles readable while the help affordance
   stays anchored in the upper-right corner. Flip Point has a symbol in that
   position, so it keeps the four-column header layout. */
.srail-card[data-kind="net"] .srail-card-head,
.srail-card[data-kind="abs"] .srail-card-head {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.srail-card[data-kind="net"] .srail-card-value,
.srail-card[data-kind="abs"] .srail-card-value {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  margin-top: 2px;
}

.srail-card[data-kind="net"] .srail-help-btn,
.srail-card[data-kind="abs"] .srail-help-btn {
  grid-column: 3;
  grid-row: 1;
}

.srail-card-titles { min-width: 0; }
.srail-card-title { color: var(--text) !important; font-weight: 700; line-height: 1.2; }
.srail-card-sub { color: var(--muted) !important; font-size: 11px; line-height: 1.3; }
.srail-card-value,
.srail-value-num { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.srail-card-hint { color: var(--muted) !important; line-height: 1.4; }
.srail-help-btn { color: var(--muted) !important; background: transparent !important; }
.srail-help-btn:hover { color: var(--accent) !important; }

/* Marker levels remain compact, but are readable and scroll instead of
   squeezing long subtitles into overlapping columns on small screens. */
.marker-display {
  display: flex !important;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--surface-2) transparent;
}

.marker-item {
  flex: 0 0 156px !important;
  width: 156px !important;
  max-width: none !important;
  min-width: 156px !important;
  padding: 9px 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px;
  background: var(--surface) !important;
  color: var(--text) !important;
}

.marker-item:hover { border-color: var(--faint) !important; background: var(--accent-soft) !important; }
.marker-label, .marker-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.marker-line { flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 5px; }
.marker-subtitle { display: block; margin-top: 5px; color: var(--muted) !important; line-height: 1.3; }
.marker-price { white-space: nowrap; }
.marker-value { color: var(--muted) !important; font-size: 12px !important; line-height: 1.25; white-space: nowrap; }

/* The source shell inherits the light Bootstrap body colour for this label. */
.mode-switch,
.mode-switch-label,
#modeToggleLabel,
.mode-switch-track { color: var(--text) !important; }
.mode-switch-label { font-weight: 600; }

/* Drawers, help, marker breakdown and tooltips. */
.v2-drawer,
.v2-help-drawer,
.v2-help-header,
.v2-help-body,
.v2-help-tour-card,
.v2-help-category,
.v2-help-entry,
.v2-help-entry-body,
#v2-marker-breakdown,
.tippy-box[data-theme~="marker-explanation"],
.heatmap-tooltip {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.v2-help-header h2,
.v2-help-category-header,
.v2-help-entry,
.v2-help-entry-title,
.v2-help-entry-body { color: var(--text) !important; }
.v2-help-entry-summary,
.v2-help-tour-card small,
.v2-help-category-chevron,
.v2-help-empty,
#v2-marker-breakdown p,
#v2-marker-breakdown small { color: var(--muted) !important; }
.v2-help-search { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
.v2-help-tour-card { border-color: var(--line-strong) !important; background: var(--accent-soft) !important; }
.v2-help-entry-body { background: var(--surface) !important; border-color: var(--line-strong) !important; }
#v2-marker-breakdown { box-shadow: 0 12px 35px rgb(0 0 0 / 56%); }
#v2-marker-breakdown > button { color: var(--muted) !important; }
.tippy-box[data-theme~="marker-explanation"] a { color: var(--accent) !important; }

@media (max-width: 767px) {
  .gex-nav-bar { border-radius: 8px; padding: 5px; }
  .gex-nav-bar > * { flex: 0 0 auto; }
  #gex-nav-subs { padding-right: 52px; }
  #gex-controls-trigger { position: relative; z-index: 2; }
  .srail-card[data-kind="net"] .srail-card-head,
  .srail-card[data-kind="abs"] .srail-card-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .marker-item { flex-basis: 148px !important; width: 148px !important; min-width: 148px !important; }
  .v2-drawer { width: min(420px, 100vw); }
  #v2-marker-breakdown { width: min(330px, calc(100vw - 20px)); }
}

#gex-ctx-modal .gex-ctx-kbd { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line-strong) !important; }
.srail-card-spark { font-size: 13px; line-height: 1.45; color: var(--muted) !important; }

#heatmap-image-area, #heatmap-chart-img, #heatmap-container, .v2-history-view { background: var(--panel) !important; border-color: var(--line) !important; }
