/* ───────────────────────────────────────────────────────────────────────────
   Open=Low / Open=High F&O Scanner  (/open-low-fno)
   Layout: filters + grouped table on the left, collapsible Sectors sidebar on
   the right (same sector set as F&O Market Movers). Tokens only — both themes.
   ─────────────────────────────────────────────────────────────────────────── */

.op-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: var(--space-4);
    align-items: start;
}
.op-layout.collapsed { grid-template-columns: minmax(0, 1fr) 44px; }
.op-main { min-width: 0; }

/* ── Filter panel ─────────────────────────────────────────────────────── */
.op-filters {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.op-frow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.op-flabel {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 92px;
}
.op-fgroup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.op-sep { width: 1px; align-self: stretch; background: var(--border-subtle); margin: 0 var(--space-1); }
.op-hint { font-size: var(--text-xs); color: var(--text-muted); }

.op-filters .qs-segment-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.op-filters .qs-chip { font-size: var(--text-xs); cursor: pointer; }
.op-filters .qs-chip:not(.active) { background: transparent; color: var(--text-secondary); }
.op-filters .qs-chip.active { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--text-on-accent); }
.op-filters .qs-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.op-filters .op-chip-star.active { background: var(--bullish); border-color: var(--bullish); color: var(--text-on-accent); }

.op-time { width: 96px; padding: 0.3rem 0.5rem; }
.op-search { width: 170px; }
.op-preset-name { width: 160px; }

/* ── Summary line ─────────────────────────────────────────────────────── */
.op-summary {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    font-size: var(--text-sm); color: var(--text-secondary);
    margin: 0 0 var(--space-3);
}
.op-summary strong { color: var(--text-heading); }
.op-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: var(--radius-full);
    background: var(--accent-primary-muted); color: var(--text-primary);
    font-size: var(--text-xs); font-weight: var(--weight-medium);
}
.op-link { background: none; border: 0; color: var(--accent-primary); cursor: pointer; font-size: var(--text-xs); padding: 0; }
.op-link:hover { text-decoration: underline; }

/* ── Stat cards (clickable shortcuts) ─────────────────────────────────── */
.op-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.op-stats .qs-stat-card { cursor: default; }
.op-stats .qs-stat-card.op-click { cursor: pointer; }
.op-stats .qs-stat-card.op-click:hover { background: var(--bg-surface-hover); }

/* ── Grouped table ────────────────────────────────────────────────────── */
.op-table td { vertical-align: middle; }
.op-table tbody tr.op-group-start td { border-top: 2px solid var(--border-strong); }
.op-table tbody tr.op-broken td:not(.op-und) { opacity: 0.55; }
.op-und { vertical-align: top !important; min-width: 150px; background: var(--bg-surface); }
.op-und-name { font-weight: var(--weight-bold); color: var(--text-heading); }
.op-und-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.op-sec {
    font-size: 10px; font-weight: var(--weight-semibold);
    padding: 1px 5px; border-radius: var(--radius-xs);
    background: var(--neutral-bg); color: var(--text-secondary);
}
.op-ncpr {
    font-size: 10px; font-weight: var(--weight-bold);
    padding: 1px 6px; border-radius: var(--radius-xs);
    background: var(--accent-primary-muted); color: var(--accent-primary);
}
.op-pat { font-size: 11px; font-weight: var(--weight-bold); padding: 2px 6px; border-radius: var(--radius-xs); }
.op-pat.ol { background: var(--bullish-bg); color: var(--bullish-text); }
.op-pat.oh { background: var(--bearish-bg); color: var(--bearish-text); }
.op-status { font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; }
.op-status.hold { color: var(--bullish-text); }
.op-status.broke { color: var(--bearish-text); }
.op-muted { color: var(--text-muted); }

/* ── Sectors sidebar ──────────────────────────────────────────────────── */
.op-side {
    position: sticky; top: var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.op-side-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-primary);
    font-size: var(--text-xs); font-weight: var(--weight-bold);
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary);
}
.op-collapse {
    border: 1px solid var(--border-primary); background: transparent; color: var(--text-secondary);
    border-radius: var(--radius-xs); width: 26px; height: 26px; cursor: pointer; line-height: 1;
}
.op-collapse:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.op-side-list { max-height: calc(100vh - 160px); overflow: auto; }
.op-srow {
    display: grid; grid-template-columns: 1fr auto 58px; align-items: center; gap: var(--space-2);
    width: 100%; padding: 7px var(--space-3);
    background: transparent; border: 0; border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary); font-size: var(--text-sm); text-align: left; cursor: pointer;
}
.op-srow:hover { background: var(--bg-surface-hover); }
.op-srow.on { background: var(--accent-primary-muted); box-shadow: inset 3px 0 0 var(--accent-primary); }
.op-srow.zero { color: var(--text-muted); }
.op-scount {
    min-width: 24px; text-align: center; font-variant-numeric: tabular-nums;
    font-size: var(--text-xs); font-weight: var(--weight-bold);
    padding: 1px 6px; border-radius: var(--radius-full);
    background: var(--bg-elevated); color: var(--text-primary);
}
.op-srow.zero .op-scount { background: transparent; color: var(--text-muted); }
.op-spct { text-align: right; font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.op-spct.up { color: var(--bullish-text); }
.op-spct.down { color: var(--bearish-text); }

/* Collapsed rail */
.op-rail {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
    padding: var(--space-2) 0;
}
.op-rail-label {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.08em;
    color: var(--text-secondary); text-transform: uppercase; cursor: pointer;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .op-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .op-layout, .op-layout.collapsed { grid-template-columns: minmax(0, 1fr); }
    .op-side { position: static; order: -1; }
    .op-side-list { max-height: 260px; }
    .op-rail { flex-direction: row; justify-content: space-between; padding: var(--space-2) var(--space-3); }
    .op-rail-label { writing-mode: horizontal-tb; transform: none; }
    .op-flabel { min-width: 100%; }
    .op-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .op-search, .op-preset-name { width: 100%; }
}
