/* â”€â”€ Theme-aware aliases for the legacy --gex-* variables used by the
       strike summary rail, âš™ controls popover, etc. Map them to the
       already-themed --theme-* set so light vs dark works correctly.
       Without this binding the rule `var(--gex-surface, #161922)` always
       falls back to the dark hex, leaving the rail cards dark on light
       theme. â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
:root {
    --gex-fg:        var(--theme-text-primary);
    --gex-fg-muted:  var(--theme-text-muted);
    --gex-surface:   var(--theme-bg-card);
    --gex-bg:        var(--theme-bg-primary);
    --gex-border:    var(--theme-border-primary);
    --gex-hover:     var(--theme-bg-tertiary);
    --gex-active:    var(--theme-bg-secondary);
    --gex-accent:    var(--gex-nav-accent, #6366f1);
}

/* â”€â”€ âš™ Controls trigger (lives inside #gex-nav-bar, rendered by Controls module) â”€â”€ */
.gex-controls-trigger {
    appearance: none;
    background: transparent;
    border: 1px solid var(--gex-border, #2a2f3a);
    color: var(--gex-fg, #cfd6e4);
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
    height: 32px;
    line-height: 1;
}
.gex-controls-trigger:hover { background: var(--gex-hover, rgba(255,255,255,0.04)); }
.gex-controls-trigger[aria-expanded="true"] { background: var(--gex-active, rgba(255,255,255,0.06)); }
.gex-controls-trigger[hidden] { display: none !important; }
.gex-controls-trigger .gex-controls-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981; /* emerald */
    display: none;
}
.gex-controls-trigger[data-dirty="true"] .gex-controls-dot { display: block; }

/* Lucide SVG icon size â€” matches the category-tab icons (16px desktop, 22px
   mobile) so the gear reads as one of the toolbar siblings, not heavier or
   lighter. */
.gex-controls-trigger svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Mobile: match the enlarged category-tab footprint so the bottom bar reads
   as one row of equally-weighted controls (iOS tab-bar pattern). */
@media (max-width: 767.98px) {
    .gex-controls-trigger {
        height: 46px;
        min-width: 46px;
        padding: 6px 12px;
    }
    .gex-controls-trigger svg {
        width: 22px;
        height: 22px;
    }
}

/* â”€â”€ Desktop popover â€” anchored under the trigger â”€â”€ */
.gex-controls-popover {
    position: absolute;
    z-index: 1000;
    min-width: 240px;
    max-width: 320px;
    background: var(--gex-surface, #161922);
    border: 1px solid var(--gex-border, #2a2f3a);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.gex-controls-popover[hidden] { display: none !important; }
.gex-controls-popover h4 {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gex-fg-muted, #7d8597);
    margin: 0 0 4px 0;
}
.gex-controls-popover .gex-field,
.gex-controls-sheet .gex-field { display: flex; flex-direction: column; gap: 4px; }

/* Toggle row: checkbox + (swatch) + (icon) + label + (hint) on one baseline */
.gex-controls-popover .gex-field label,
.gex-controls-sheet .gex-field label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--gex-fg, #cfd6e4);
    cursor: pointer;
    line-height: 1.2;
    user-select: none;
}
.gex-controls-popover .gex-field input[type="checkbox"],
.gex-controls-sheet .gex-field input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--gex-accent, #6366f1);
}
.gex-controls-popover .gex-field-swatch,
.gex-controls-sheet .gex-field-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: -4px;
}
.gex-controls-popover .gex-field-icon,
.gex-controls-sheet .gex-field-icon {
    font-size: 14px;
    line-height: 1;
    color: var(--gex-fg-muted, #7d8597);
}
.gex-controls-popover .gex-field-text,
.gex-controls-sheet .gex-field-text { white-space: nowrap; }
.gex-controls-popover .gex-field-hint,
.gex-controls-sheet .gex-field-hint {
    font-size: 11px;
    color: var(--gex-fg-muted, #7d8597);
    margin-left: 2px;
}

/* Inline info (â“˜) icon attached to popover field labels â€” opens Help Drawer to
   the entry referenced by f.helpId. Sits at the end of the label row so it
   doesn't disturb the checkbox/swatch/text rhythm. */
.gex-controls-popover .gex-field-help,
.gex-controls-sheet .gex-field-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--gex-fg-muted, #7d8597);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.7;
    transition: color 120ms ease, opacity 120ms ease, background 120ms ease;
}
.gex-controls-popover .gex-field-help:hover,
.gex-controls-sheet .gex-field-help:hover {
    opacity: 1;
    color: var(--bs-primary, #4a9eff);
    background: rgba(74, 158, 255, 0.12);
}
.gex-controls-popover .gex-field-help svg,
.gex-controls-sheet .gex-field-help svg {
    width: 14px;
    height: 14px;
}

/* For select fields, keep the label as a small caption above the control */
.gex-controls-popover .gex-field > label:first-child:not(:has(input[type="checkbox"])),
.gex-controls-sheet .gex-field > label:first-child:not(:has(input[type="checkbox"])) {
    display: block;
    font-size: 12px;
    color: var(--gex-fg-muted, #7d8597);
}
/* Styled <select> â€” replaces the browser-default look (which renders a thin
   system chevron glued to the right edge and inconsistent borders per OS).
   Native dropdown UX is preserved (iOS picker, Android wheel) â€” only the
   closed-state button is restyled. The chevron is a Lucide chevron-down SVG
   embedded as background-image with stroke colour matching --gex-fg-muted. */
.gex-controls-popover .gex-field select,
.gex-controls-sheet .gex-field select {
    appearance: none;
    -webkit-appearance: none;
    font-size: 13px;
    color: var(--gex-fg, #cfd6e4);
    /* color-mix lifts the select 6% toward the foreground so it reads as an
       elevated input inside the popover, and works in both dark + light themes
       (no hardcoded hex that'd look wrong on a light surface). */
    background-color: color-mix(in srgb, var(--gex-surface, #161922) 94%, var(--gex-fg, #cfd6e4) 6%);
    border: 1px solid var(--gex-border, #2a2f3a);
    border-radius: 8px;
    padding: 8px 36px 8px 12px;
    cursor: pointer;
    line-height: 1.2;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8597' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    transition: border-color 120ms ease, background-color 120ms ease;
}
.gex-controls-popover .gex-field select:hover,
.gex-controls-sheet .gex-field select:hover {
    border-color: color-mix(in srgb, var(--gex-border, #2a2f3a) 70%, var(--gex-fg, #cfd6e4) 30%);
}
.gex-controls-popover .gex-field select:focus,
.gex-controls-sheet .gex-field select:focus {
    outline: none;
    border-color: var(--gex-accent, #6366f1);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--gex-accent, #6366f1) 25%, transparent);
}
/* Segmented button group (e.g. Strike Concentration 90/95/99/100) â€” a row of
   joined buttons sharing one border, the active one filled with the accent. */
.gex-controls-popover .gex-segmented,
.gex-controls-sheet .gex-segmented {
    display: flex;
    border: 1px solid var(--gex-border, #2a2f3a);
    border-radius: 8px;
    overflow: hidden;
    background-color: color-mix(in srgb, var(--gex-surface, #161922) 94%, var(--gex-fg, #cfd6e4) 6%);
}
.gex-controls-popover .gex-segmented-btn,
.gex-controls-sheet .gex-segmented-btn {
    appearance: none;
    flex: 1 1 0;
    border: 0;
    border-left: 1px solid var(--gex-border, #2a2f3a);
    background: transparent;
    color: var(--gex-fg-muted, #7d8597);
    font-size: 13px;
    padding: 7px 8px;
    cursor: pointer;
    line-height: 1.2;
    transition: background-color 120ms ease, color 120ms ease;
}
.gex-controls-popover .gex-segmented-btn:first-child,
.gex-controls-sheet .gex-segmented-btn:first-child { border-left: 0; }
.gex-controls-popover .gex-segmented-btn:hover,
.gex-controls-sheet .gex-segmented-btn:hover {
    color: var(--gex-fg, #cfd6e4);
    background-color: color-mix(in srgb, var(--gex-surface, #161922) 85%, var(--gex-fg, #cfd6e4) 15%);
}
.gex-controls-popover .gex-segmented-btn.active,
.gex-controls-sheet .gex-segmented-btn.active {
    color: #fff;
    background-color: var(--gex-accent, #6366f1);
}
.gex-controls-popover .gex-segmented-btn:focus-visible,
.gex-controls-sheet .gex-segmented-btn:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gex-accent, #6366f1) 50%, transparent);
}
/* â”€â”€ Slider field (range input + live value readout) â”€â”€ */
.gex-controls-popover .gex-field > label.gex-slider-label,
.gex-controls-sheet .gex-field > label.gex-slider-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gex-controls-popover .gex-field-value,
.gex-controls-sheet .gex-field-value {
    margin-left: auto;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--gex-fg, #cfd6e4);
    min-width: 34px;
    text-align: right;
}
/* When a help (â“˜) button is present it owns margin-left:auto, so the value
   chip drops that and sits right after it. */
.gex-controls-popover .gex-slider-label .gex-field-help + .gex-field-value,
.gex-controls-sheet .gex-slider-label .gex-field-help + .gex-field-value {
    margin-left: 0;
}
.gex-controls-popover input.gex-slider,
.gex-controls-sheet input.gex-slider {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    margin: 4px 0 2px;
    border-radius: 999px;
    background: var(--gex-border, #2a2f3a);
    cursor: pointer;
}
.gex-controls-popover input.gex-slider::-webkit-slider-thumb,
.gex-controls-sheet input.gex-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gex-accent, #6366f1);
    border: 2px solid var(--gex-surface, #161922);
    box-shadow: 0 0 0 1px var(--gex-accent, #6366f1);
    cursor: pointer;
}
.gex-controls-popover input.gex-slider::-moz-range-thumb,
.gex-controls-sheet input.gex-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gex-accent, #6366f1);
    border: 2px solid var(--gex-surface, #161922);
    box-shadow: 0 0 0 1px var(--gex-accent, #6366f1);
    cursor: pointer;
}
.gex-controls-popover input.gex-slider:focus-visible,
.gex-controls-sheet input.gex-slider:focus-visible {
    outline: none;
}
.gex-controls-popover input.gex-slider:focus-visible::-webkit-slider-thumb,
.gex-controls-sheet input.gex-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px var(--gex-accent, #6366f1), 0 0 0 4px color-mix(in srgb, var(--gex-accent, #6366f1) 35%, transparent);
}

.gex-controls-popover .gex-action {
    appearance: none;
    border: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--gex-accent, #6366f1);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.gex-controls-popover .gex-action:hover { filter: brightness(1.08); }
.gex-controls-popover .gex-action.secondary {
    background: transparent;
    color: var(--gex-fg, #cfd6e4);
    border: 1px solid var(--gex-border, #2a2f3a);
}

/* â”€â”€ Mobile bottom sheet â”€â”€ */
.gex-controls-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;
}
.gex-controls-sheet[hidden] { display: none !important; }
.gex-controls-sheet .gex-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.gex-controls-sheet .gex-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gex-surface, #161922);
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    padding: 18px 18px 28px 18px;
    max-height: 70vh;
    overflow-y: auto;
}
.gex-controls-sheet .gex-sheet-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: 0;
    color: var(--gex-fg-muted, #7d8597);
    font-size: 18px;
    cursor: pointer;
}
.gex-controls-sheet .gex-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
}

/* â”€â”€ Mobile touch-target sizing for the bottom-sheet controls â”€â”€
   Apple HIG = 44pt min, Material = 48dp, WCAG 2.2 AA = 24px. The desktop
   popover keeps its compact 13px / 16px-checkbox look; only the mobile sheet
   bumps everything up so fingers don't miss. iOS also auto-zooms any focused
   <select>/<input> with font-size < 16px, so we lift the select to 16px to
   stop the page from jumping on focus. */
@media (max-width: 768px) {
    /* Whole row becomes a tap target â€” label spans full width with min-height
       44px so the user can tap anywhere on the row, not just the 16px box. */
    .gex-controls-sheet .gex-field label {
        min-height: 44px;
        padding: 6px 0;
        font-size: 15px;
        gap: 12px;
    }
    .gex-controls-sheet .gex-field input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }
    /* 16px font stops iOS auto-zoom on focus; min-height 44px hits Apple HIG.
       Right padding leaves room for the chevron (set in the base rule above);
       chevron itself moves out to 14px from the edge for more breathing room
       and a larger 18px size to balance the bigger select height. */
    .gex-controls-sheet .gex-field select {
        font-size: 16px;
        min-height: 44px;
        padding: 10px 40px 10px 14px;
        background-position: right 14px center;
        background-size: 18px 18px;
    }
    /* "Re-run simulation" etc â€” primary action buttons. */
    .gex-controls-sheet .gex-action,
    .gex-controls-popover .gex-action {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 15px;
    }
    /* Ã— close button â€” was a naked 18px glyph; now a real 44Ã—44 button. */
    .gex-controls-sheet .gex-sheet-close {
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        top: 6px;
        right: 6px;
        border-radius: 8px;
    }
    /* Info (â“˜) â€” visual SVG stays at 14px, but the hit area grows to 32Ã—32
       so users can tap without aiming. margin-left:auto keeps it right-pinned. */
    .gex-controls-sheet .gex-field-help {
        width: 32px;
        height: 32px;
    }
    /* Caption above the select (small grey label) â€” bump for readability. */
    .gex-controls-sheet .gex-field > label:first-child:not(:has(input[type="checkbox"])) {
        font-size: 13px;
        margin-bottom: 2px;
    }
}

/* â”€â”€ Strike summary rail (left side â€” right edge reserved for âš™ popover) â”€â”€ */
#gex-bars-view { position: relative; }
/* Make the chart CONTAINER itself narrower (margin-left + reduced width)
   instead of using padding-left.
   `!important` is required because Plotly's `responsive: true` writes an
   explicit inline `style="width: â€¦px"` on #gex-chart at render time, which
   would otherwise win over our CSS rule. Without it the chartDiv shifts via
   margin-left but keeps its old pixel width â€” extending past the viewport
   on the right instead of shrinking. The plotter's `_reconcileVisibility`
   handler re-runs `plot()` on toggle so Plotly re-measures clientWidth and
   redraws against the new (smaller) container. */
/* Left side (default): rail at left:0, chart shifts right via margin-left. */
#gex-bars-view.with-summary-rail-left #gex-chart {
    /* 332 = rail width 324 + 8 px gap to plot area. */
    margin-left: 332px !important;
    margin-right: 0 !important;
    width: calc(100% - 332px) !important;
}
#gex-bars-view.with-summary-rail-left .strike-summary-rail {
    left: 0;
    right: auto;
}

/* Right side: rail at right:0, chart shifts left via margin-right. */
#gex-bars-view.with-summary-rail-right #gex-chart {
    margin-left: 0 !important;
    margin-right: 332px !important;
    width: calc(100% - 332px) !important;
}
#gex-bars-view.with-summary-rail-right .strike-summary-rail {
    left: auto;
    right: 0;
}
.strike-summary-rail {
    position: absolute;
    top: 8px;
    /* left: 0 so the rail's left edge aligns with the markers widget and
       Zoom slider below (both sit flush against #chart-widgets-container's
       left edge). With left:8 the rail looked indented by 8 px compared to
       everything else underneath. */
    left: 0;
    /* bottom: 0 so the rail reaches the chart container's bottom edge, then
       the parent #chart-widgets-container's 8px gap handles the gutter to
       the markers widget â€” matches the 8 px gap on the right side
       (rail.right â†’ chart plot area, see #gex-bars-view.with-summary-rail
       #gex-chart margin-left below) for uniform spacing. */
    bottom: 0;
    width: 324px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 5;
    pointer-events: auto;
    color: var(--gex-fg, #cfd6e4);
    overflow-y: auto;
    overflow-x: hidden;
}
.strike-summary-rail[hidden] { display: none; }
.strike-summary-rail .srail-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 2px 4px 0;
}
.strike-summary-rail .srail-asset {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gex-fg-muted, #7d8597);
}
.strike-summary-rail .srail-spot {
    font-size: 13px;
    font-weight: 600;
    color: var(--gex-fg, #cfd6e4);
}
.strike-summary-rail .srail-card {
    background: color-mix(in srgb, var(--gex-surface, #161922) 88%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--gex-border, #2a2f3a);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Each card shares remaining vertical space equally so all three sparklines
       scale together on tall/short viewports. Sparkline height itself is set
       per-render via renderMetricChart's `height` opt, fed by ResizeObserver. */
    flex: 1 1 0;
    min-height: 0;
}
.strike-summary-rail .srail-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.strike-summary-rail .srail-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.strike-summary-rail .srail-card-titles { display: flex; flex-direction: column; line-height: 1.2; flex: 1 1 auto; min-width: 0; }
.strike-summary-rail .srail-card-title { font-size: 12px; font-weight: 600; }

/* Help (â“˜) icon button on each rail card â€” opens the Help Drawer to the
   relevant glossary entry. Pinned to the right of the head so it sits in line
   with the title row regardless of card width. */
.strike-summary-rail .srail-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--gex-fg-muted, #7d8597);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.65;
    transition: color 120ms ease, opacity 120ms ease, background 120ms ease;
}
.strike-summary-rail .srail-help-btn:hover {
    opacity: 1;
    color: var(--bs-primary, #4a9eff);
    background: rgba(74, 158, 255, 0.12);
}
.strike-summary-rail .srail-help-btn svg {
    width: 14px;
    height: 14px;
}
.strike-summary-rail .srail-card-sub {
    font-size: 10px;
    color: var(--gex-fg-muted, #7d8597);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
/* Hero ticker top-right of the Flip Point head â€” mirrors the flip-DM alert card.
   Sits between the (flex-growing) titles and the â“˜ button, so it lands at the
   right edge next to the help icon. */
.strike-summary-rail .srail-card-symbol {
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--gex-fg, #e6edf3);
    white-space: nowrap;
}
/* Hairline separators under the head and above the footer (mirrors the alert). */
.strike-summary-rail .srail-card-divider {
    height: 1px;
    background: var(--gex-border, #2a2f3a);
    opacity: 0.7;
}
.strike-summary-rail .srail-card-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
/* When the big value lives inside the head row (Net GEX / Abs GEX cards), it
   sits top-right beside the title instead of on its own line â€” reclaiming
   ~28px of vertical space for the sparkline. The current value is also drawn
   on the spark's right edge, so this stays as the at-a-glance headline number.
   flex-shrink:0 + nowrap keep it intact; titles' flex-grow pushes it right,
   the â“˜ button follows. */
.strike-summary-rail .srail-card-head .srail-card-value {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 20px;
    line-height: 1.1;
}
/* Value pairs (Flip + Index on the flip card)
   .srail-card-values         â€” legacy stacked layout (kept for other cards)
   .srail-card-values-inline  â€” compact one-line layout used by Flip Point:
       [â–¬ 75,885 Flip]   [â–¬ 75,767 Index]
   The inline variant frees ~30px vertical for the sparkline so it stays
   readable in the narrow rail. */
.strike-summary-rail .srail-card-values { display: flex; flex-direction: column; gap: 3px; }
.strike-summary-rail .srail-card-values-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}
.strike-summary-rail .srail-value-pair {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.strike-summary-rail .srail-card-values-inline .srail-value-pair {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-start;
}
.strike-summary-rail .srail-value-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.strike-summary-rail .srail-value-key-index { color: var(--gex-fg, #cfd6e4); }
.strike-summary-rail .srail-value-num {
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
/* Inline values shrink slightly so two prices + labels fit a 324px rail */
.strike-summary-rail .srail-card-values-inline .srail-value-num {
    font-size: 15px;
}
.strike-summary-rail .srail-card-values-inline .srail-value-key {
    font-size: 10px;
    opacity: 0.7;
}
.strike-summary-rail .srail-mini-line {
    display: inline-block;
    width: 14px;
    height: 0;
    border-top: 2px solid currentColor;
    flex-shrink: 0;
}
.strike-summary-rail .srail-mini-line-flip { color: var(--marker-flip-bg); }
.strike-summary-rail .srail-mini-line-index { color: var(--gex-fg, #cfd6e4); }
.strike-summary-rail .srail-card-delta {
    font-size: 11px;
    color: var(--gex-fg-muted, #7d8597);
    font-variant-numeric: tabular-nums;
}
.strike-summary-rail .srail-card-spark {
    flex: 1 1 0;
    /* min-height MUST stay 0 so the spark can shrink below its content on short
       viewports. The JS (_render â†’ MIN_SPARK_HEIGHT) measures this slot and
       hides the sparkline entirely once it drops under 60px, freeing room for
       the value + hint rows. A non-zero floor here would re-break that: the
       spark couldn't compress, card content would overflow its flex box, and
       the hint row (Below flip Â· negative / Dealers amplify moves / Liquidity
       depth) would bleed out the bottom behind the next card's blurred bg. */
    min-height: 0;
    margin: 0 -4px;
    color: var(--gex-fg-muted, #7d8597);
    overflow: hidden;
}
.strike-summary-rail .srail-card-spark svg { width: 100%; display: block; cursor: crosshair; }
.strike-summary-rail .srail-card-spark p { margin: 0; padding: 20px 0; text-align: center; }
.strike-summary-rail .srail-spark-empty text {
    font-size: 9px;
    fill: var(--gex-fg-muted, #7d8597);
    font-family: inherit;
}
.strike-summary-rail .srail-card-hint {
    font-size: 11px;
    color: var(--gex-fg-muted, #7d8597);
}
.strike-summary-rail .srail-regime-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
/* Keep regime pill and delta on a single line â€” without these, sub-1 prices
   (XRP) push the delta string wide enough to wrap the pill onto a 2nd line. */
.strike-summary-rail .srail-regime-row .srail-regime,
.strike-summary-rail .srail-regime-row .srail-card-delta {
    white-space: nowrap;
}
.strike-summary-rail .srail-regime {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.strike-summary-rail .srail-regime-positive {
    background: color-mix(in srgb, var(--marker-pos-bg) 22%, transparent);
    color: var(--marker-pos-bg);
}
.strike-summary-rail .srail-regime-negative {
    background: color-mix(in srgb, var(--marker-neg-bg) 22%, transparent);
    color: var(--marker-neg-bg);
}
.strike-summary-rail .srail-regime-neutral {
    background: color-mix(in srgb, var(--gex-fg-muted, #7d8597) 18%, transparent);
    color: var(--gex-fg-muted, #7d8597);
}

/* Mobile (â‰¤767px): the rail takes more horizontal space than a phone has
   â€” hide it outright and reset the chart's rail-aware margins so the
   chart reclaims the full container width. Users on desktop who want
   the rail off can still opt out via the "Hidden" select option. */
@media (max-width: 767.98px) {
    .strike-summary-rail { display: none !important; }
    #gex-bars-view.with-summary-rail-left #gex-chart,
    #gex-bars-view.with-summary-rail-right #gex-chart {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }
    #gex-bars-view.with-summary-rail-left > .gex-chart-title,
    #gex-bars-view.with-summary-rail-right > .gex-chart-title {
        margin-left: 0;
        margin-right: 0;
        padding-left: 8px;
    }
}

/* â”€â”€ Nav bar container query â”€â”€ */
#gex-nav-bar { container-type: inline-size; }

/* Chip-dropdown form for secondary axes on tablet/mobile */
.gex-nav-axis-chip {
    appearance: none;
    background: var(--gex-surface, #161922);
    border: 1px solid var(--gex-border, #2a2f3a);
    color: var(--gex-fg, #cfd6e4);
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
@container (max-width: 1023px) {
    .gex-nav-axis[data-kind="param"],
    .gex-nav-axis[data-kind="mode"] { display: none; }
    .gex-nav-axis-chip[data-kind="param"],
    .gex-nav-axis-chip[data-kind="mode"] { display: inline-flex; }
}
@container (min-width: 1024px) {
    .gex-nav-axis-chip[data-kind="param"],
    .gex-nav-axis-chip[data-kind="mode"] { display: none; }
}

.gex-nav-axis-chip-menu {
    background: var(--gex-surface, #161922);
    border: 1px solid var(--gex-border, #2a2f3a);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.gex-nav-axis-chip-menu button {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--gex-fg, #cfd6e4);
    text-align: left;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.gex-nav-axis-chip-menu button:hover { background: var(--gex-hover, rgba(255,255,255,0.06)); }
.gex-nav-axis-chip-menu button.active { color: #fff; background: var(--gex-active, rgba(99,102,241,0.25)); }

/* â”€â”€ Mobile horizontal scroll snap â”€â”€ */
#gex-nav-bar #gex-nav-subs {
    overflow-x: auto;
    scrollbar-width: none;       /* Firefox */
    scroll-snap-type: x mandatory;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
#gex-nav-bar #gex-nav-subs::-webkit-scrollbar { display: none; }
#gex-nav-bar .gex-nav-view { scroll-snap-align: start; }
