/* Options Lab — admin page (page-local ol-* classes; every colour/space/radius from design-tokens.css) */

/* ── Page header ─────────────────────────────────────────── */
.ol-head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.ol-head .qs-page-title { font-size: var(--text-xl); margin: 0; }
.ol-head .qs-page-subtitle { font-size: var(--text-sm); margin: 0; }
.ol-lab-badge { display: inline-flex; align-items: center; padding: 0.1rem 0.45rem; border-radius: var(--radius-xs); background: var(--lab-bg); color: var(--lab); font-size: 0.65rem; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; }

/* ── Card (house look; .qs-card has no stylesheet rule, so the page supplies it) ── */
.ol-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: var(--space-2) var(--space-3) var(--space-2); display: flex; flex-direction: column; min-width: 0; }
.ol-card-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-height: 1.75rem; margin-bottom: var(--space-1); }
.ol-card-title { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-secondary); text-transform: uppercase; letter-spacing: var(--tracking-wide); white-space: nowrap; }

/* ── Toolbar ─────────────────────────────────────────────── */
.ol-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); }
.ol-toolbar .qs-select { width: auto; padding: 0.3rem 1.9rem 0.3rem 0.6rem; font-size: var(--text-xs); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
.ol-toolbar .qs-select:disabled { opacity: 0.55; cursor: not-allowed; }
.ol-group { display: inline-flex; align-items: center; gap: var(--space-1); }
.ol-status { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* Segmented control */
.ol-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-inset); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.ol-seg button { background: transparent; color: var(--text-secondary); border: 0; border-radius: var(--radius-sm); padding: 0.28rem 0.65rem; font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; cursor: pointer; line-height: 1.2; transition: background-color var(--transition-fast), color var(--transition-fast); }
.ol-seg button:hover { color: var(--text-primary); }
.ol-seg button[aria-pressed="true"] { background: var(--bg-surface); color: var(--text-heading); box-shadow: var(--shadow-sm); }
.ol-seg--accent button[aria-pressed="true"] { background: var(--accent-primary); color: #FFFFFF; }

/* Icon button (prev/next day, play/pause, step) */
.ol-ibtn { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; padding: 0; background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border-primary); border-radius: var(--radius-sm); cursor: pointer; transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast); }
.ol-ibtn:hover:not(:disabled) { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--border-strong); }
.ol-ibtn:disabled { opacity: 0.4; cursor: not-allowed; }
.ol-ibtn svg { width: 14px; height: 14px; fill: currentColor; }
.ol-ibtn--primary { background: var(--accent-primary); border-color: var(--accent-primary); color: #FFFFFF; width: 2.1rem; height: 2.1rem; }
.ol-ibtn--primary:hover:not(:disabled) { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); color: #FFFFFF; }

/* Switch (label wrapping a visually-hidden checkbox) */
.ol-switch { display: inline-flex; align-items: center; gap: 0.45rem; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-secondary); cursor: pointer; user-select: none; }
.ol-switch-track { position: relative; width: 30px; height: 17px; border-radius: var(--radius-full); background: var(--border-strong); transition: background-color var(--transition-fast); flex: none; }
.ol-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #FFFFFF; box-shadow: var(--shadow-sm); transition: transform var(--transition-fast); }
.ol-switch input:checked + .ol-switch-track { background: var(--accent-primary); }
.ol-switch input:checked + .ol-switch-track::after { transform: translateX(13px); }
.ol-switch input:focus-visible + .ol-switch-track { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.ol-switch input:checked ~ .ol-switch-text { color: var(--text-heading); }
.ol-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; }

/* Status chips */
.ol-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border-radius: var(--radius-full); background: var(--neutral-bg); color: var(--text-secondary); font-size: 0.7rem; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.5; }
.ol-chip b { font-weight: var(--weight-bold); color: var(--text-primary); }
.ol-chip--ok { background: var(--badge-live-bg); color: var(--badge-live-text); }
.ol-chip--ok b { color: inherit; }
.ol-chip--warn { background: var(--warning-bg); color: var(--warning); }
.ol-chip--warn b { color: inherit; }
.ol-chip--bad { background: var(--danger-bg); color: var(--danger); }
.ol-chip--bad b { color: inherit; }
.ol-chip--note { background: var(--info-bg); color: var(--info); }

/* Clock + 30 s refresh ring (JS fills the text and the arc) */
.ol-clock { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text-secondary); font-size: 0.7rem; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ol-clock-text { font-family: var(--font-mono); color: var(--text-primary); }
.ol-ring { width: 16px; height: 16px; transform: rotate(-90deg); flex: none; }
.ol-ring-track { fill: none; stroke: var(--border-primary); stroke-width: 2; }
.ol-ring-arc { fill: none; stroke: var(--accent-primary); stroke-width: 2; stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }

/* ── Window row (strike-selection mode + range) ──────────── */
.ol-window { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-2); padding: 0 var(--space-3); margin: calc(-1 * var(--space-1)) 0 var(--space-3); }
.ol-window-k { font-size: 0.65rem; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--text-muted); }
.ol-window-k + .ol-seg, .ol-window-k + .ol-chip { margin-right: var(--space-2); }
.ol-window .ol-seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.ol-window-note { font-size: var(--text-xs); color: var(--text-muted); }

/* ── Replay bar ──────────────────────────────────────────── */
.ol-replay { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); background: var(--card-bg); border: 1px solid var(--card-border); border-left: 3px solid var(--accent-primary); border-radius: var(--radius-lg); }
.ol-replay-label { font-size: 0.65rem; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--accent-primary); }
.ol-range { flex: 1 1 240px; min-width: 160px; height: 18px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.ol-range:focus { outline: none; }
.ol-range::-webkit-slider-runnable-track { height: 4px; border-radius: var(--radius-full); background: var(--border-strong); }
.ol-range::-moz-range-track { height: 4px; border-radius: var(--radius-full); background: var(--border-strong); }
.ol-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent-primary); border: 2px solid var(--card-bg); box-shadow: var(--shadow-sm); }
.ol-range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-primary); border: 2px solid var(--card-bg); box-shadow: var(--shadow-sm); }
.ol-range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.ol-time { display: inline-flex; align-items: center; min-width: 3.6rem; justify-content: center; padding: 0.2rem 0.6rem; border-radius: var(--radius-sm); background: var(--bg-inset); border: 1px solid var(--border-subtle); color: var(--text-heading); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.ol-live-btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.28rem 0.7rem; border-radius: var(--radius-sm); border: 1px solid var(--bullish); background: var(--bullish-bg); color: var(--bullish-text); font-size: 0.7rem; font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide); cursor: pointer; transition: background-color var(--transition-fast); }
.ol-live-btn:hover { background: var(--bullish); color: #FFFFFF; }
.ol-live-btn .live-dot { background: currentColor; }

/* ── Chart grid ──────────────────────────────────────────── */
.ol-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-4); align-items: stretch; }
.ol-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.ol-col > .ol-card { flex: 1 1 0; }
/* Cards stretch to the taller column and the chart fills its card; the min-heights are the design sizes
   (price 560, side charts 270) and the floor if percentage heights ever fail to resolve. */
.ol-chart-wrap { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.ol-chart { width: 100%; flex: 1 1 auto; }
.ol-chart--price { min-height: 560px; }
.ol-chart--half { min-height: 270px; }

/* Legend toggles (eye + swatch + name; muted when the series is hidden) */
.ol-legend { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-left: auto; }
.ol-leg { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.5rem; border: 1px solid transparent; border-radius: var(--radius-full); background: transparent; color: var(--text-primary); font-size: var(--text-xs); font-weight: var(--weight-medium); cursor: pointer; transition: background-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast); white-space: nowrap; }
.ol-leg:hover { background: var(--bg-surface-hover); border-color: var(--border-subtle); }
.ol-leg svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }
.ol-leg .ol-eye-off { display: none; }
/* Series name takes the series colour; a hidden series just drops to 45 % opacity (no strikethrough). */
.ol-leg--bull { color: var(--bullish-text); }
.ol-leg--bear { color: var(--bearish-text); }
.ol-leg--smart { color: var(--text-heading); }
.ol-leg--vol { color: var(--neutral); }
.ol-leg--net { color: var(--accent-secondary); }
.ol-leg--info { color: var(--info); }
.ol-leg--warn { color: var(--warning); }
.ol-leg.is-off, .ol-leg[aria-pressed="false"] { opacity: 0.45; }
.ol-leg.is-off .ol-eye-on, .ol-leg[aria-pressed="false"] .ol-eye-on { display: none; }
.ol-leg.is-off .ol-eye-off, .ol-leg[aria-pressed="false"] .ol-eye-off { display: inline; }

/* OHLC / flow readout (top-left of the price chart; JS fills it) */
.ol-tip { position: absolute; top: 6px; left: 8px; z-index: 3; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.4rem; max-width: calc(100% - 70px); padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--card-bg) 82%, transparent); color: var(--text-secondary); font-size: 0.7rem; font-variant-numeric: tabular-nums; pointer-events: none; line-height: 1.4; }
.ol-tip:empty { display: none; }
.ol-tip.is-on { border: 1px solid var(--border-subtle); }
.ol-tip-time { font-family: var(--font-mono); font-weight: var(--weight-semibold); color: var(--text-heading); margin-right: 0.2rem; }
.ol-tip-k { color: var(--text-muted); font-weight: var(--weight-medium); }
.ol-tip-v { color: var(--text-primary); font-weight: var(--weight-semibold); }
.ol-tip-up { color: var(--bullish-text); }
.ol-tip-down { color: var(--bearish-text); }
.ol-tip-sep { width: 1px; height: 0.8rem; background: var(--border-primary); align-self: center; margin: 0 0.15rem; }

/* Floating per-chart tooltip (follows the pointer; one per chart wrapper) */
.ol-ftip { position: absolute; top: 0; left: 0; z-index: 4; min-width: 164px; padding: 0.4rem 0.55rem 0.45rem; border-radius: var(--radius-md); border: 1px solid var(--border-primary); background: color-mix(in srgb, var(--card-bg) 96%, transparent); box-shadow: var(--shadow-sm); color: var(--text-secondary); font-size: 0.72rem; line-height: 1.45; font-variant-numeric: tabular-nums; pointer-events: none; opacity: 0; transition: opacity var(--transition-fast); will-change: transform; }
.ol-ftip.is-on { opacity: 1; }
.ol-ftip-head { font-family: var(--font-mono); font-weight: var(--weight-semibold); color: var(--text-heading); margin-bottom: 0.25rem; }
.ol-ftip-row { display: flex; align-items: center; gap: 0.4rem; }
.ol-ftip-k { color: var(--text-muted); }
.ol-ftip-v { margin-left: auto; color: var(--text-primary); font-weight: var(--weight-semibold); font-family: var(--font-mono); }
.ol-ftip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); flex: 0 0 auto; }
.ol-ftip-dot.is-up { background: var(--bullish); } .ol-ftip-dot.is-down { background: var(--bearish); }
.ol-ftip-dot.is-call { background: var(--bullish); } .ol-ftip-dot.is-put { background: var(--bearish); }
.ol-ftip-dot.is-net { background: var(--accent-secondary); } .ol-ftip-dot.is-oipcr { background: var(--info); } .ol-ftip-dot.is-volpcr { background: var(--warning); } .ol-ftip-dot.is-vol { background: var(--neutral); }

/* Empty / partial states drawn inside the chart cards */
.ol-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding: var(--space-4); text-align: center; color: var(--text-muted); font-size: var(--text-sm); pointer-events: none; background: color-mix(in srgb, var(--card-bg) 55%, transparent); }
.ol-overlay strong { color: var(--text-secondary); font-weight: var(--weight-semibold); }
.ol-overlay-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.6; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .ol-grid { grid-template-columns: 1fr; }
  .ol-chart--price { min-height: 420px; }
  .ol-col > .ol-card { flex: 0 0 auto; }
  .ol-status { margin-left: 0; width: 100%; }
}
@media (max-width: 640px) {
  .ol-card-head { gap: var(--space-2); }
  .ol-legend { margin-left: 0; }
  .ol-tip { font-size: 0.65rem; }
}
