/*
signal-shell.css
Role: dedicated Signal shell presentation.
Responsibility: 5-column signal board, compact card scale, signal-specific indicators, coverage landscape panel.
*/

.signal-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 0;
}

.signal-content-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 var(--space-sm) var(--space-sm);
}


/* ═══════════════════════════════════════════════════════════
   Signal Board — 3-panel table view
   ═══════════════════════════════════════════════════════════ */

/* ── Layout tokens (single source of truth for bar dimensions) ── */

:root {
    --sb-bar-h:   4px;   /* all four table indicator bars */
    --sb-gauge-h: 8px;   /* detail panel gradient gauges + bias bar */
}

/* ── Shell ── */

.sb-shell {
    display: grid;
    /* Both tracks anchored so a table column-hide can't desync the panel:
       panel = viewport-locked (min of 42vw and the user's resize ceiling); table
       column is 1fr but its content is pinned to fill (see .sb-center/.sb-row
       width:100%), so hiding a column changes only internal row layout, never the
       track width — the panel stays put. */
    grid-template-columns: minmax(0, 1fr) 10px min(42vw, var(--sb-right-w, 600px));
    height: 100%;
    min-height: 0;
}

/* ── Panel resize dividers ── */

.sb-divider {
    cursor: col-resize;
    flex-shrink: 0;
    align-self: stretch;
    position: relative;
}

.sb-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 80px;
    border-radius: 2px;
    background: var(--border);
    transition: background-color 120ms ease;
}

.sb-divider:hover::after {
    background: var(--border-accent);
}

body.sb-resizing {
    cursor: col-resize !important;
    user-select: none;
}

body.sb-resizing * {
    cursor: col-resize !important;
}

/* ── Left rail ── */

/* .sb-rail-l visual skin and .sb-rail-section spacing → shared via .rail-panel / .rail-section in layout.css */

/* .sb-rail-section-label — visual style is now shared via .section-header in layout.css */

/* Hide State and Bias sections when an advisory category is active */
#sb-rail-l.is-advisory-mode .rail-section:has([data-sb-action="state"]),
#sb-rail-l.is-advisory-mode .rail-section:has([data-sb-action="bias"]) {
    display: none;
}

/* Signal rail labels are non-interactive divs — suppress the button hover state */
div.section-header {
    cursor: default;
}

div.section-header:hover {
    color: var(--muted);
    background: color-mix(in srgb, var(--border) 55%, var(--panel-soft) 45%);
}

.sb-rail-btn {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-base);
    border-left: 2px solid transparent;
    color: var(--muted);
}

.sb-rail-btn:hover {
    color: var(--link-text);
    background: var(--link-bg);
}

.sb-rail-btn:hover .sb-rail-count {
    color: inherit;
}

.sb-rail-btn.is-active {
    color: var(--link-text);
    border-left-color: var(--border-accent);
    background: color-mix(in srgb, var(--link-bg) 55%, transparent 45%);
}

.sb-header-select option:checked {
    color: var(--link-text);
    font-weight: 700;
}

.sb-rail-count {
    font-size: var(--text-xs);
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
    min-width: 1.5em;
    text-align: right;
}

.sb-rail-btn.is-active .sb-rail-count {
    color: color-mix(in srgb, var(--link-text) 70%, transparent 30%);
}

.sb-rail-header-count {
    font-size: var(--text-xs);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

.sb-rail-btn--indent {
    padding-left: calc(var(--space-md) + var(--space-xs));
    font-size: var(--text-sm);
}

/* ── Center ── */

.sb-center {
    display: flex;
    flex-direction: column;
    width: 100%;        /* fill the 1fr track regardless of which columns are shown */
    min-width: 0;
    min-height: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-y: auto;
}

/* ── Subgrid table: ONE column definition shared by the main header + the rows ──
   .sb-table defines the column tracks ONCE (Headline greedy 1fr; Trend/Score/Bias content-sized
   `auto`, so they hug their content and scale with the user's font size — no fixed px). The main
   header and the rows container subgrid off it, so header labels and row cells land on IDENTICAL
   tracks: perfectly aligned, no dead space, no hand-syncing. The column GAP lives here so the
   subgrids inherit it. The ADVISORY header/rows are a separate 3-col layout (advisory mode) and
   keep their OWN grid — they don't subgrid (different column count). */
.sb-table {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    column-gap: 8px;
    /* Horizontal padding lives HERE (once) so the header and rows share the same left/right edges —
       per-band padding would inset their tracks differently and break subgrid alignment. */
    padding: 0 var(--space-sm);
}
/* EVERY direct child spans the full width (header, advisory header, rows, and the injected
   "Local news for ..." bar) — only the cells INSIDE the col-hd/rows use the column tracks. Without
   this, non-table children (like .sb-local-bar) get squeezed into column 1. */
.sb-table > * { grid-column: 1 / -1; }

.sb-col-hd {
    display: grid;
    grid-template-columns: subgrid;
    height: 28px;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 78%, black 22%);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Advisory col-hd: its OWN 3-column grid (not subgrid — advisory mode has a different layout). */
.sb-col-hd--advisory {
    grid-template-columns: 1fr 150px 72px;
}

/* Show advisory col-hd only in advisory mode; hide main col-hd in advisory mode */
.sb-center:not(.is-advisory-view) .sb-col-hd--advisory { display: none; }
.sb-center.is-advisory-view .sb-col-hd:not(.sb-col-hd--advisory) { display: none; }

.sb-col-right {
    text-align: right;
}

.sb-col-sortable {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.sb-col-sortable:hover {
    color: var(--text);
}

.sb-col-sortable.is-sorted {
    color: var(--link-text);
}

.sb-sort-icon {
    font-size: 0.6rem;
    opacity: 0.55;
    min-width: 0.7em;
}

.sb-col-sortable.is-sorted .sb-sort-icon {
    opacity: 1;
}

/* Rows container is a subgrid pass-through: it spans .sb-table's columns and re-exposes them so each
   .sb-row can subgrid off the SAME shared tracks (two-level subgrid, like the portfolio editor). */
.sb-rows {
    display: grid;
    grid-template-columns: subgrid;
}

/* ── Local category "pick your states" prompt (shown when Local is selected with no states) ── */

/* While prompting, there is no Top Stories table to head and the Under-Reported (blindspot)
   sections are national-only — hide both so only the prompt shows. */
.sb-center.is-local-prompt .sb-col-hd,
.sb-center.is-local-prompt .sb-blindspot-section {
    display: none !important;
}

.sb-local-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    color: var(--muted);
}

.sb-local-prompt-title {
    margin: 0;
    font-size: var(--text-panel);
    font-weight: 700;
    color: var(--text);
}

.sb-local-prompt-sub {
    margin: 0;
    max-width: 42ch;
    font-size: var(--text-sm);
    line-height: 1.5;
}

.sb-local-prompt-btn {
    margin-top: var(--space-xs);
    padding: 9px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--text);
    font-size: var(--text-ui);
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s, background 0.15s;
}

.sb-local-prompt-btn:hover {
    background: var(--link-bg);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* "Select states" button beside the Category menu (visible only when Local is active) */
.sb-local-states-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel-soft);
    color: var(--text);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, box-shadow 0.15s;
}

.sb-local-states-chev { font-size: 0.7rem; line-height: 1; pointer-events: none; display: inline-flex; align-items: center; justify-content: center; transform: translateY(3px) scale(2.5); transform-origin: center; }

.sb-local-states-btn:hover { background: var(--link-bg); box-shadow: var(--shadow-sm); }
.sb-local-states-btn[hidden] { display: none; }

/* "Local news for <states>" label bar above a populated Local board. It's a .sb-table child, which
   has horizontal padding for the table bands — cancel it so the bar spans the FULL width edge-to-edge
   (uniform with section headers app-wide). */
.sb-local-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    border-bottom: 1px solid var(--border);
    background: var(--panel-soft);
    margin-left: calc(-1 * var(--space-sm));
    margin-right: calc(-1 * var(--space-sm));
}

/* Loading state shown while a Local board fetches (cold path) */
.sb-local-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl) var(--space-md);
    color: var(--muted);
    font-size: var(--text-sm);
}

.sb-local-loading-spin {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--link-text);
    border-radius: 50%;
    animation: chart-spin 0.8s linear infinite;
}

.sb-local-bar-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    color: var(--muted);
}

/* State picker popup (Signal has no rail; opens from the prompt or the Select-states button) */
.sb-local-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;            /* above topbar (1100) + status strip (1099) */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    padding: var(--space-md);
}

.sb-local-picker {
    width: fit-content;                 /* only as wide as its content needs — i.e. the actions row (Clear All + Apply) */
    max-width: min(340px, 100%);
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sb-local-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
}

.sb-local-picker-title {
    font-size: var(--text-ui);
    font-weight: 700;
    color: var(--text);
}

.sb-local-picker-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.sb-local-picker-close:hover { color: var(--text); }

.sb-local-picker-list {
    flex: 1;
    overflow-y: auto;
    touch-action: pan-y;            /* lock touch to VERTICAL panning — a diagonal swipe won't drift sideways */
    overscroll-behavior: contain;   /* and the stray horizontal component can't chain to the phone card carousel behind */
    padding: var(--space-xs) var(--space-xs);
}

/* The state rows reuse the shared rail checklist (.rail-state-option), which sets width:100% + padding
   but NO box-sizing — i.e. content-box, so the padding adds to 100% and each row overflows the list by
   ~20px (the horizontal scrollbar, and the right-aligned count shoved that far past the edge). border-box
   keeps the padding inside the width so the row fits and the count (margin-left:auto, kept as the rails
   have it) lands at its normal right-padding gap. We also tighten the left inset for this narrow dialog. */
.sb-local-picker-list .rail-state-option {
    box-sizing: border-box;
    padding-left: var(--space-xs);
}

.sb-local-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border);
}

.sb-local-picker-clear,
.sb-local-picker-apply {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.sb-local-picker-clear {
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--text);
}

.sb-local-picker-clear:hover { background: var(--link-bg); }

.sb-local-picker-apply {
    border: 1px solid var(--link-text);
    background: var(--link-text);
    color: #fff;
}

.sb-local-picker-apply:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* ── Individual row ── */

.sb-row {
    display: grid;
    grid-template-columns: subgrid;   /* shares .sb-table's column tracks → aligns with the header */
    grid-column: 1 / -1;
    column-gap: 8px;
    padding: 3px 0;                   /* horizontal padding is on .sb-table (shared edges) */
    border-top: 1px solid var(--border);
    cursor: pointer;
    align-items: center;
    box-sizing: border-box;
    /* template tag is a non-rendered child; doesn't affect grid */
}

.sb-row:hover {
    background: var(--link-bg);
}


.sb-row:hover .sb-headline-text {
    color: var(--link-text);
}

.sb-row.is-sel {
    background: color-mix(in srgb, var(--link-bg) 78%, var(--panel) 22%);
    position: relative;
}
/* Selected indicator at the TRUE far-left edge of the table — NOT an inset bar, which would
   draw inside .sb-table's shared horizontal padding (var(--space-sm)) and land over the
   thumbnail. The ::before is pulled out by that padding so it sits flush at the column edge. */
.sb-row.is-sel::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--space-sm));
    width: 3px;
    background: var(--border-accent);
}

.sb-row.is-sel .sb-headline-text,
.sb-row.is-sel .sb-cell-articles {
    color: var(--link-text);
}

/* ── Section headers (TOP STORIES, blindspot-style) ── */

.section-header--actionable {
    justify-content: space-between;
}

.sb-board-hint {
    padding: 4px var(--space-md) 5px;
    font-size: var(--text-xs);
    color: var(--muted);
    background: var(--panel-soft);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    opacity: 0.75;
}

.sb-board-hint kbd {
    display: inline-block;
    padding: 0 4px;
    font-family: inherit;
    font-size: var(--text-mini);
    line-height: 1.6;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
}

.sb-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    font: inherit;
    font-size: var(--text-meta);
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 2px 8px;
    line-height: 1;
    margin: 0;
    border-radius: var(--radius-sm);
    transition: color 0.12s ease, background 0.12s ease;
    flex-shrink: 0;
}

.sb-refresh-btn::before {
    content: '↻';
    display: inline-block;
}

.sb-refresh-btn.has-update {
    color: var(--link-text, #5a8dee);
    animation: sb-refresh-pulse 2s ease-in-out infinite;
}

.sb-refresh-btn.is-refreshing::before {
    animation: refresh-spin 0.7s linear infinite;
}

.sb-refresh-btn:hover {
    color: var(--text);
    background: var(--link-bg);
    animation: none;
}

@keyframes sb-refresh-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ── Board header dropdowns ── */

.sb-header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sb-header-select-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.sb-header-select-label {
    font-size: var(--text-meta);
    /* weight inherits from the parent .section-header (single source of truth);
       only the uppercase/letter-spacing are reset since this reads as a control label */
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    white-space: nowrap;
}
/* Phone: drop the "Category"/"Time Frame" labels so the two selects fit one row without clipping
   (the selects are self-explanatory). */
html[data-phone-mode] .sb-header-select-label { display: none; }

.sb-header-select {
    border: 1px solid var(--border);
    color: var(--text);
    font-size: var(--text-meta);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    padding: 6px 17px 6px 6px;   /* 6px vertical restores the height the native control gave (appearance:none drops it) + matches the Select-states button; right room is for the custom chevron only */
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    margin: 0;
    /* Auto-size to the widest option (e.g. "Network News (12)"); the cap is a safety bound. Use
       appearance:none + a small custom chevron instead of the native arrow: the native control
       reserved arrow width ON TOP OF our padding, which made the menus wider than needed (and cut
       the Time Frame menu once "Select states" appears). Chevron is a theme-neutral SVG (#888 reads
       on light and dark). */
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--panel);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath d='M1 1.5 4 4.5 7 1.5' fill='none' stroke='%23888888' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    width: max-content;
    max-width: 170px;
}

.sb-header-select:focus {
    outline: 1px solid var(--border-accent);
    outline-offset: 0;
}

/* ── Trend cell glyphs (resurfaced ↩) ── */

.sb-ongoing-top {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sb-ongoing-glyph {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1;
    cursor: help;
}

/* ── New-since-last-visit green dot in headline ── */

.sb-new-dot {
    color: var(--market-up);
    font-size: 0.6em;
    vertical-align: middle;
    margin-right: 4px;
}

/* ── Advisory rows (3-column grid: headline cell | source | published) ── */

.sb-advisory-row {
    display: grid;
    grid-template-columns: 1fr 150px 72px;
    grid-column: 1 / -1;   /* span the full subgrid width of .sb-rows, then use its OWN 3-col grid */
    gap: 8px;
    padding: 3px 0;        /* horizontal padding is on .sb-table (shared with the advisory header) */
    border-top: 1px solid var(--border);
    cursor: pointer;
    align-items: center;
    box-sizing: border-box;
}

.sb-advisory-row:hover {
    background: var(--link-bg);
}

.sb-advisory-row:hover .sb-advisory-row-headline {
    color: var(--link-text);
}

.sb-advisory-row.is-sel {
    background: color-mix(in srgb, var(--link-bg) 78%, var(--panel) 22%);
    position: relative;
}
/* Far-left selected indicator (same rationale as .sb-row.is-sel::before — pulled out of
   .sb-table's shared horizontal padding so it sits flush at the column edge, not over content). */
.sb-advisory-row.is-sel::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--space-sm));
    width: 3px;
    background: var(--border-accent);
}

.sb-advisory-headline-cell {
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.sb-advisory-icon-wrap {
    width: 53px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-advisory-type-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    opacity: 0.85;
}

.sb-advisory-row-headline {
    font-size: var(--text-ui);
    font-weight: 500;
    color: var(--text);
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sb-advisory-row.is-sel .sb-advisory-row-headline {
    color: var(--link-text);
}

.sb-advisory-row-source {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-advisory-row-age {
    font-size: var(--text-xs);
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
}

.sb-advisory-headline-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sb-advisory-row-subline {
    font-size: var(--text-mini);
    font-weight: 600;
    color: var(--muted);
    opacity: 0.85;
    white-space: nowrap;
}

/* ── Alert advisory timeline (detail panel) ── */

/* advisory section label gets the same full-width background-stripe treatment */

.sb-advisory-timeline-item {
    display: flex;
    gap: var(--space-sm);
    padding: 7px var(--space-sm);
    border-top: 1px solid var(--border);
}

.sb-advisory-timeline-item:last-child {
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.sb-advisory-timeline-age {
    font-size: var(--text-xs);
    color: var(--muted);
    white-space: nowrap;
    width: 52px;
    flex-shrink: 0;
    padding-top: 2px;
}

.sb-advisory-timeline-body {
    min-width: 0;
    flex: 1;
}

.sb-advisory-timeline-headline {
    color: var(--link);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sb-advisory-timeline-headline:hover {
    text-decoration: underline;
}

div.sb-advisory-timeline-headline {
    color: var(--text);
}

.sb-advisory-timeline-summary {
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Row cells ── */

.sb-cell-headline {
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.sb-thumb-wrap {
    width: 53px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 2px;
    overflow: hidden;
    background: color-mix(in srgb, var(--panel-soft) 80%, transparent 20%);
}

.sb-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sb-thumb[hidden] {
    display: none !important;
}

.sb-headline-text {
    font-size: var(--text-ui);
    font-weight: 500;
    line-height: var(--leading-heading);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ── Trend / Ongoing cell ── */

.sb-cell-ongoing {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sb-ongoing-arrow {
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
}

.sb-ongoing-hot    { color: #e53e3e; }
.sb-ongoing-steady { color: var(--text); }
.sb-ongoing-active { color: var(--text); }
.sb-ongoing-watch  { color: var(--text); }
.sb-ongoing-cool   { color: #22c55e; }

/* ── Story history sparkline (board row Trend cell) ── */

.sb-story-sparkline {
    display: block;
    width: 100%;
    height: 18px;
    overflow: visible;
}

.sb-sparkline-line {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* ── State / Momentum cell — same layout as sb-cell-bar ── */

.sb-cell-state {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* sb-state / dot styles kept for detail panel meta pills */
.sb-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.sb-state-dot {
    width: 5px;
    height: 5px;
    border-radius: 1px;
    flex-shrink: 0;
}

.sb-state-hot    { color: #c85a20; }
.sb-state-hot .sb-state-dot    { background: #c85a20; box-shadow: 0 0 4px rgba(200,90,32,0.45); }
.sb-state-steady { color: #9a7a10; }
.sb-state-steady .sb-state-dot { background: #b89020; }
.sb-state-active { color: #1a8c62; }
.sb-state-active .sb-state-dot { background: #1a8c62; }
.sb-state-watch  { color: #4a70a8; }
.sb-state-watch .sb-state-dot  { background: #4a70a8; }
.sb-state-cool   { color: var(--muted); }
.sb-state-cool .sb-state-dot   { background: var(--muted); }

/* ── Bar cells (compact inline bars) ── */

.sb-cell-bar {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sb-bar-numval {
    font-size: var(--text-xs);
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.sb-bar-track {
    height: var(--sb-bar-h);
    background: color-mix(in srgb, var(--border) 70%, transparent 30%);
    border-radius: 0;
    overflow: hidden;
}

.sb-bar-fill {
    height: 100%;
    border-radius: 0;
}

.sb-bar-strength   { background: oklch(68% 0.14 145); }
.sb-bar-confidence { background: #6a5acd; }

/* ── Bias bar (inline, compact) ── */

.sb-cell-bias {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

/* "N articles" label must not wrap in the snug Bias column. */
.sb-cell-bias .sb-bar-numval {
    white-space: nowrap;
}

/* The tri-color bias bar is capped to the Score bar's width (52px column) and left-aligned, so it
   renders the same length as the Score bar rather than stretching across the wider Bias column
   (which is sized for the "N articles" label). */
.sb-cell-bias .signal-card-bar.signal-card-bar-bias {
    height: var(--sb-bar-h);
    width: 100%;
    max-width: 52px;
    align-self: start;
}

.sb-bias-pct-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-top: 15px;
}

.sb-bias-pct-l { color: var(--lean-left); }
.sb-bias-pct-c { color: var(--muted-2); text-align: center; }
.sb-bias-pct-r { color: var(--lean-right); text-align: right; }

.sb-bias-gradient-bar {
    position: relative;
    width: 100%;
    height: var(--sb-bar-h);
    background: linear-gradient(to right, var(--lean-left), var(--muted) 50%, var(--lean-right));
    flex-shrink: 0;
    border-radius: 0;
}

.sb-bias-needle {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 10px;
    background: var(--text);
    transform: translateX(-50%);
    border-radius: 1px;
    pointer-events: none;
}

/* ── Articles count ── */

.sb-cell-articles {
    text-align: right;
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-weight: 600;
}

/* ── Right detail panel ── */

/* .sb-rail-r visual skin → shared via .rail-panel in layout.css */

/* Split-scroll (desktop detail rail): the PANEL itself no longer scrolls (overrides .rail-panel's
   overflow-y:auto via ID specificity). It's a fixed-height flex column — the fixed top zone
   (coverage, hero, metrics) + a single inner scroll region (.sb-detail-scroll). This keeps the hero
   and metric bars from reflowing when a per-source body-length change would otherwise toggle the
   whole-panel scrollbar and jolt the cycle reveal. */
#sb-rail-r {
    min-width: 260px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
/* The detail-empty placeholder isn't a flex layout — let it sit normally. */
#sb-rail-r > .sb-detail-empty { flex-shrink: 0; }
/* Coverage section (sparkline/timeline/bias/chips/controls) is part of the FIXED top zone. */
#sb-rail-r > .sb-detail-coverage-section { flex-shrink: 0; }

.sb-detail-empty {
    padding: 24px 16px;
}

.sb-detail-empty-title {
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.sb-detail-empty p {
    font-size: var(--text-sm);
    color: var(--muted-2);
    line-height: var(--leading-prose);
    margin: 0;
}

/* ── Swappable top card ── */

/* Split-scroll is DESKTOP RAIL ONLY (scoped under #sb-rail-r). The phone feed renders the same
   detail template inside #sb-phone-feed where cards scroll as part of the vertical feed — there the
   .sb-detail-scroll wrapper must stay inert (no inner scroll / flex sizing), so these rules don't
   apply to it. */
#sb-rail-r .sb-detail-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
#sb-rail-r .sb-detail-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
/* The ONLY scroll region in the desktop detail panel. */
#sb-rail-r .sb-detail-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sb-detail-card-top {
    display: flex;
    align-items: stretch;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* Reveal swap: on a source advance the NEW image slides in from the right ON TOP of the old one
   (which stays put underneath) until it fully covers it — a "slide-over" wipe. Only the media area
   animates; the chevrons (siblings) are untouched. Layers are absolutely stacked DURING the
   transition only; after it the surviving image returns to normal flow (sizes the area). */
/* The NEW image layer is absolutely positioned over the old (which stays in flow + holds the
   area's height) and slides in from the right. Scoped under the media area so it OUTRANKS the
   .sb-detail-card-img-wrap { position: relative } rule (equal specificity loses on source order
   otherwise → the layer would stay in flow and appear below, then jump up). */
.sb-detail-card-media-area > .sb-media-layer-new {
    position: absolute;
    inset: 0;
    z-index: 2;
    transform: translateX(0);
    transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sb-detail-card-media-area > .sb-media-layer-new.sb-media-enter {
    transform: translateX(100%);  /* start fully off the right edge */
    transition: none;
}
.sb-detail-card-media-area > .sb-media-layer-new.sb-media-enter-left {
    transform: translateX(-100%); /* start fully off the left edge */
    transition: none;
}
@media (prefers-reduced-motion: reduce) {
    .sb-detail-card-media-area > .sb-media-layer-new { transition: none; }
}

.sb-detail-card-media-area {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;  /* clip the slide-over new image layer while it enters from the right */
}

.sb-detail-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 120px;
    overflow: hidden;
    background: var(--panel-soft);
    flex-shrink: 0;
}

.sb-detail-card-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.42);
    color: #fff;
    font-size: 2.5rem;
    text-decoration: none;
    transition: background 0.15s;
}

.sb-detail-card-play-btn:hover {
    background: rgba(0, 0, 0, 0.65);
}

.sb-detail-card-video-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

.sb-detail-card-video-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--panel-soft);
    flex-shrink: 0;
}

.sb-detail-card-video-link a {
    font-size: var(--text-ui);
    color: var(--link-text);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.sb-detail-card-video-link a:hover {
    background: var(--link-bg);
}

.sb-detail-card-podcast-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    background: var(--panel-soft);
    overflow: hidden;
}

.sb-detail-card-podcast-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sb-detail-podcast-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(3px);
}

.sb-detail-card-podcast-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    font-size: var(--text-ui);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.sb-detail-card-podcast-play::after {
    content: none;
}

.sb-detail-card-podcast-play.is-playing {
    background: rgba(255, 255, 255, 0.30);
    border-color: rgba(255, 255, 255, 0.6);
}

.sb-detail-card-podcast-play:hover {
    background: rgba(255, 255, 255, 0.28);
}

.sb-detail-podcast-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sb-detail-podcast-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.sb-detail-podcast-fill {
    height: 100%;
    background: var(--border-accent);
    border-radius: 2px;
    transition: width 0.5s linear;
    width: 0%;
}

.sb-detail-podcast-time {
    font-size: var(--text-mini);
    color: rgba(255, 255, 255, 0.70);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sb-detail-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sb-detail-card-img[hidden] {
    display: none !important;
}

/* ── Detail card nav chevrons ── */
.sb-detail-nav-btn {
    flex-shrink: 0;
    align-self: stretch;
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-soft);
    color: var(--muted-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.08s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;  /* we provide our own press feedback below */
}

.sb-detail-nav-btn:hover {
    background: var(--link-bg);
    color: var(--link-text);
}

/* Tap/press feedback — confirms the chevron registered the tap (depress + accent flash). The fast
   0.08s transform makes the press feel immediate on touch. */
.sb-detail-nav-btn:active {
    transform: scale(0.88);
    background: var(--link-bg);
    color: var(--link-text);
}

.sb-detail-card-body {
    padding: var(--space-md) var(--space-sm) var(--space-sm);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sb-detail-card-headline {
    display: block;
    margin: 0 0 var(--space-sm);
    font-size: var(--text-panel);
    font-weight: 700;
    line-height: var(--leading-heading);
    color: var(--text);
    text-decoration: none;
}

a.sb-detail-card-headline:hover {
    color: var(--link-text);
    text-decoration: underline;
}

.sb-detail-card-summary {
    margin: 0 0 8px;
    font-size: var(--text-ui);
    color: var(--text-soft);
    line-height: var(--leading-prose);
}

.sb-detail-card-summary > *:first-child {
    margin-top: 0;
}

.sb-detail-card-time {
    font-size: inherit;
    color: var(--muted);
    font-weight: 400;
}

.sb-byline-label {
    color: var(--muted-2);
    font-size: var(--text-xs);
    flex-shrink: 0;
}

.sb-byline-sep {
    color: var(--muted-2);
    font-size: var(--text-xs);
    line-height: 1;
    flex-shrink: 0;
}

/* ── Inline "Read more" / outlet buttons in card summary ── */

.sb-read-btn {
    display: inline-block;
    vertical-align: middle;
    font-size: var(--text-mini);
    font-weight: 600;
    padding: 2px var(--space-xs);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-accent);
    background: var(--link-bg);
    color: var(--link-text);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    line-height: 1.6;
}

.sb-read-btn:hover {
    background: var(--border-accent);
    color: var(--bg);
}

/* Byline: outlet · time above the story body */
.sb-detail-card-byline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--muted);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border);
    margin-bottom: var(--space-xs);
}

/* ── Inline article body (shown on Read more click) ── */

.sb-detail-body-content {
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border);
}

.sb-fullstory-back {
    margin-top: var(--space-lg);
    text-align: right;
}

.sb-fullstory-back a {
    font-size: var(--text-xs);
    color: var(--muted-2);
    text-decoration: none;
}

.sb-fullstory-back a:hover {
    color: var(--link-text);
    text-decoration: underline;
}

/* ── Divider between swappable card and metadata ── */

.sb-detail-divider {
    height: 1px;
    background: var(--border);
    flex-shrink: 0;
}

/* Detail section wrapper */

.sb-detail-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

/* ── Gradient gauges (detail panel) ── */

.sb-gauge-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.sb-gauge-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sb-gauge-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--muted);
}

.sb-gauge-val {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.sb-gauge {
    position: relative;
    height: var(--sb-gauge-h);
    border-radius: 0;
    background: var(--surface-2, #2a2a3a);
}

/* Score — solid green, matching table bar */
.sb-gauge-score      { background: oklch(68% 0.14 145); }
.sb-gauge-confidence { background: #6a5acd; }

.sb-gauge-marker {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: var(--text);
    transform: translateX(-1px);
    box-shadow: 0 0 0 1px var(--panel);
    left: var(--sb-marker-pos, 0%);
}

/* ── Compact gauge for table rows (must come after .sb-gauge so height wins) ── */

.sb-gauge-sm {
    height: var(--sb-bar-h);
    border-radius: 0;
}

.sb-gauge-sm .sb-gauge-marker {
    top: -2px;
    bottom: -2px;
    width: 2px;
}

/* State (momentum) gauge — green to red */
.sb-gauge-state {
    background: linear-gradient(90deg,
        oklch(65% 0.18 145) 0%,
        oklch(76% 0.16 80)  50%,
        oklch(58% 0.20 25)  100%
    );
}

/* Three gauges side by side — minmax(0,1fr) enforces truly equal widths */
.sb-gauge-trio {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Bias section in detail panel: label above chips ── */

.sb-detail-metrics-section,
.sb-detail-bias-section,
.sb-advisory-timeline-section {
    padding: 0;
}


.sb-detail-coverage-sparkline {
    padding: var(--space-sm) var(--space-sm) 0;
}

.sb-detail-coverage-svg {
    display: block;
    width: 100%;
    height: 50px;
}

.sb-detail-density-area {
    fill: var(--link-text);
    fill-opacity: 0.28;
}

.sb-detail-density-line {
    fill: none;
    stroke: var(--link-text);
    stroke-opacity: 0.8;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}


.sb-sparkline-axis {
    position: relative;
    height: 14px;
    margin: 3px var(--space-sm) 0;
}

.sb-sparkline-axis-label {
    position: absolute;
    top: 0;
    font-size: var(--text-mini);
    color: var(--muted);
    white-space: nowrap;
    line-height: 1;
}

.sb-sparkline-tick {
    stroke: var(--border);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.sb-metrics-body {
    padding: var(--space-sm) var(--space-sm);
}

.sb-bias-body {
    padding: var(--space-sm);
}

/* Bias chips use is-active for selection state (not nav) — suppress the group-node border-left decoration.
   Rule must match layout.css specificity: [data-group-node]:has([data-group-children] .is-active) is (0,4,0). */
.sb-detail-bias-section [data-group-node]:has([data-group-children] .is-active) > .section-header {
    border-left: none;
}

.sb-group-toggle-link {
    display: inline-block;
    font-size: var(--text-sm);
    color: var(--muted-2);
    padding: var(--space-xs) 0;
    text-decoration: none;
    cursor: pointer;
}
.sb-group-toggle-link:hover {
    color: var(--link-text);
    text-decoration: underline;
}

/* Detail-panel controls row: "Show sources" button + Auto-cycle toggle, centered above the hero
   with the standard gap before the hero image. */
.sb-detail-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-sm);
}

/* "Show sources" as a button — matches the publisher "read" button (.sb-read-btn). */
.sb-group-toggle-btn {
    display: inline-block;
    vertical-align: middle;
    font-size: var(--text-mini);
    font-weight: 600;
    padding: 2px var(--space-xs);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-accent);
    background: var(--link-bg);
    color: var(--link-text);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.6;
    transition: background 0.15s, color 0.15s;
}
.sb-group-toggle-btn:hover {
    background: var(--border-accent);
    color: var(--bg);
}

/* Auto-cycle on/off switch. */
.sb-autocycle-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    user-select: none;
}
.sb-autocycle-label {
    font-size: var(--text-sm);
    color: var(--muted);
}
.sb-autocycle-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.sb-autocycle-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    border-radius: 9px;
    background: var(--border);
    transition: background 0.15s;
    flex-shrink: 0;
}
.sb-autocycle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}
.sb-autocycle-toggle input[type="checkbox"]:checked + .sb-autocycle-switch {
    background: var(--link-text);
}
.sb-autocycle-toggle input[type="checkbox"]:checked + .sb-autocycle-switch::after {
    transform: translateX(14px);
}
.sb-autocycle-toggle input[type="checkbox"]:focus-visible + .sb-autocycle-switch {
    outline: 2px solid var(--link-text);
    outline-offset: 2px;
}

.sb-detail-bias-section .signal-card-bias-groups {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: var(--space-sm);
    border-top: 1px solid var(--border);
    padding-top: var(--space-sm);
}

.sb-bias-body .sb-bias-pct-row {
    margin-top: 0;
    margin-bottom: var(--space-xs);
}

.sb-detail-bias-section .signal-card-bias-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
}

.sb-detail-bias-section .signal-card-bias-group + .signal-card-bias-group {
    border-top: 1px solid var(--border);
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
}

.sb-detail-bias-section .signal-card-bias-group-label {
    width: auto;
    flex: none;
    font-size: var(--text-xs);
    color: var(--muted-2);
}

.sb-detail-bias-section .signal-card-bias-group-left .signal-card-bias-group-label {
    color: var(--lean-left);
}

.sb-detail-bias-section .signal-card-bias-group-right .signal-card-bias-group-label {
    color: var(--lean-right);
}

.sb-detail-bias-section .signal-card-bias-group-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}


/* ── Bias spin — Left/Right framing side by side ── */

.sb-detail-spin-section {
    padding: 0;
}

.sb-spin-cols {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
}

.sb-spin-col {
    flex: 1;
    min-width: 0;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.sb-spin-col-left {
    border-left: 3px solid var(--lean-left);
    background: rgba(74, 123, 209, 0.06);
}

.sb-spin-col-right {
    border-left: 3px solid var(--lean-right);
    background: rgba(209, 100, 100, 0.06);
}

.sb-spin-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    margin-bottom: 4px;
}

.sb-spin-col-left .sb-spin-label { color: var(--lean-left); }
.sb-spin-col-right .sb-spin-label { color: var(--lean-right); }

.sb-spin-text {
    font-size: var(--text-xs);
    color: var(--text-secondary, var(--muted));
    line-height: 1.45;
    margin: 0;
}

/* ── Coverage (activity sparkline + source dot lane) ── */

.sb-coverage-count {
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted-2);
    font-size: var(--text-xs);
    margin-left: var(--space-xs);
}

.sb-detail-coverage-section {
    padding: 0;
    /* Coverage lives inside .sb-detail-card-body, which insets it by var(--space-sm) (10px) on each
       side — that wrongly inset the COVERAGE header (should span the full panel width) and the
       sparkline/dots/bias bar. Pull the section back out to the card edges with a negative
       horizontal margin so it sits as if directly inside the detail panel; the header then spans
       full width, and the inner content below re-applies the standard 10px edge gap. (DOM stays
       inside .sb-detail-card so chip-swap / timeline-dot triggers keep working — CSS-only fix.) */
    margin-left: calc(-1 * var(--space-sm));
    margin-right: calc(-1 * var(--space-sm));
    /* No bottom border (the .sb-detail-section default) — it doubled up with the byline's
       border-top below the Show-sources/Auto-cycle row. The byline keeps its own divider. */
    border-bottom: none;
}
/* Re-inset the content rows to the standard 10px gap from the (now edge-to-edge) section. The
   .section-header deliberately keeps padding 0 so it spans the full width. */
.sb-detail-coverage-section > .sb-timeline,
.sb-detail-coverage-section > .sb-detail-coverage-sparkline,
.sb-detail-coverage-section > .sb-bias-body,
.sb-detail-coverage-section > [data-group-node] {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
}
/* No divider directly above the COVERAGE header (the headline below it no longer has a border;
   this section shouldn't add a top rule of its own either). */
.sb-detail-coverage-section,
.sb-detail-coverage-section > .section-header {
    border-top: none;
}

.sb-detail-coverage-section > .sb-bias-body {
    margin-top: 0;
    padding-bottom: 0;
}

.sb-detail-coverage-section .sb-timeline {
    padding-bottom: 0;
}

.sb-detail-coverage-section .sb-timeline-bar {
    margin-bottom: 8px;
}

.sb-detail-coverage-section > [data-group-node] {
    margin-top: var(--space-sm);
    text-align: center;
}

.sb-detail-coverage-section > [data-group-node] > .sb-group-toggle-link {
    padding-top: 0;
}

.sb-detail-coverage-sparkline + .sb-timeline {
    padding-top: 0;
}

.sb-detail-coverage-section .sb-timeline {
    padding-top: 2px;
}

.sb-detail-coverage-section .sb-timeline-bar {
    background: var(--link-bg);
}

.sb-detail-coverage-section .sb-timeline-bar::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -20px;
    height: 20px;
    background: var(--link-text);
    opacity: 0.28;
}


.sb-timeline {
    padding: var(--space-sm) var(--space-sm) 8px;
}

.sb-timeline-bar {
    position: relative;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 18px;
    margin-bottom: 14px;
}

.sb-timeline-tick {
    position: absolute;
    bottom: 0;
    height: 10px;
    width: 1px;
    background: var(--muted);
    opacity: 0.40;
    pointer-events: none;
}

.sb-timeline-tick.is-mid {
    height: 20px;
    opacity: 0.45;
    z-index: 2;
}

.sb-timeline-tick.is-major {
    height: 20px;
    width: 2px;
    opacity: 0.60;
    z-index: 3;
}

.sb-timeline-tick-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    font-size: var(--text-mini);
    color: var(--muted);
    white-space: nowrap;
    line-height: 1;
}

.sb-fan-tip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: var(--text-sm);
    padding: 3px var(--space-xs);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    pointer-events: none;
    white-space: nowrap;
}

.sb-timeline-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--muted);
    border: 2px solid var(--panel, #fff);
    cursor: pointer;
    transition: transform 0.12s ease;
}

.sb-timeline-dot:hover {
    transform: translate(-50%, -50%) scale(1.5);
    z-index: 5;
}

.sb-timeline-dot-left   { background: var(--lean-left); border-color: rgba(74,123,209,0.2); }
.sb-timeline-dot-right  { background: var(--lean-right); border-color: rgba(209,100,100,0.2); }
.sb-timeline-dot-center { background: var(--muted); }


.sb-timeline-dot.is-active {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.85);
    z-index: 3;
    transform: translate(-50%, -50%) scale(1.1);
}

.sb-timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--muted);
}

.sb-timeline-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: var(--text-xs);
    color: var(--muted);
}

.sb-tl-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--muted);
}

.sb-tl-dot-left     { background: var(--lean-left); }
.sb-tl-dot-right    { background: var(--lean-right); }
.sb-tl-dot-center   { background: var(--muted); }
.sb-tl-dot-official { background: #b58800; }

/* Advisory-corroborated badge on news rows */
.sb-advisory-corroborated-badge {
    display: inline-block;
    margin-right: var(--space-xs);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: rgba(181, 136, 0, 0.18);
    color: #b58800;
    font-size: var(--text-mini);
    font-weight: 700;
    letter-spacing: 0.04em;
    vertical-align: middle;
    white-space: nowrap;
}

/* Advisory row back-link to matched news story */
.sb-advisory-backlink {
    margin-top: 4px;
    font-size: var(--text-xs);
    color: #b58800;
    font-weight: 600;
}

.sb-advisory-backlink-title {
    color: #b58800;
    font-style: italic;
    font-weight: 400;
}

.sb-tl-legend-note {
    margin-left: 2px;
    opacity: 0.7;
}


/* Column header help cursor when tooltip present */
.sb-col-hd [title] { cursor: help; }


.sb-refresh-btn[hidden]  { display: none !important; }

/* ── Skeleton rows (loading placeholder) ── */

.sb-skel {
    display: block;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--panel-soft) 80%, transparent 20%);
    animation: sb-pulse 1.6s ease-in-out infinite;
}

@keyframes sb-pulse {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

/* ── Responsive ── */

/* Shrink table+detail together at narrower widths.
   Detail panel is never hidden — it anchors the UX at all desktop/tablet widths. */

/* Staged column hides as the table narrows toward the mobile (card) switch.
   Column order: Headline | Score | Trend | Bias. SCORE IS NEVER DROPPED (it stays next to Headline);
   priority (most-expendable first): Bias+Articles → Trend → keep Headline+Score. Headline is col1
   (1fr) and absorbs each freed column, so drops don't shift the others. */

/* Responsive column drops under subgrid: hiding a cell collapses its `auto` track to 0 (the track
   definition stays on .sb-table; we only narrow the template as columns drop so no empty gap remains —
   redefining per-band would conflict with subgrid). DOM order: 1=Headline 2=Score 3=Trend 4=Bias. */
@media (max-width: 960px) {
    /* Drop Bias+Articles (.sb-cell-bias) — keep Headline, Score, Trend */
    .sb-table { grid-template-columns: 1fr auto auto; }
    .sb-col-hd > :nth-child(4),
    .sb-row .sb-cell-bias { display: none; }
}

@media (max-width: 860px) {
    /* Drop Trend (.sb-cell-ongoing) — keep Headline + Score (Score is never hidden, down to the
       phone/card switch). */
    .sb-table { grid-template-columns: 1fr auto; }
    .sb-col-hd > :nth-child(3),
    .sb-row .sb-cell-ongoing { display: none; }
}

/* ── Phone view — vertical card feed ──────────────────────────────────────
   Triggered by the topbar phone-mode signal (html[data-phone-mode]) — the
   viewport's right edge reaching the icon group, a LATER point than the burger
   collapse — NOT a px breakpoint, so it respects the user's font scale. signal.js
   builds #sb-phone-feed: one hydrated detail card per visible story
   (SignalDetailPlugin.hydrateDetail, auto-cycle + nav off). The list/table and
   right rail are hidden; the Category + Time Frame header stays pinned on top.
   Replaced the old <600px fly-in drawer (removed). The staged column hides above
   (960/860/800) cover the laptop/tablet range down to this point. */
/* Phone: the Signal panel spans the full viewport — drop the content shell's gutter on all
   sides (internal section-header/row padding still keeps content off the edges) so it reaches
   the screen's left, right, and bottom edges. */
html[data-phone-mode] .signal-content-shell {
    padding: 0;
}
html[data-phone-mode] .sb-shell {
    display: block;            /* drop the table|divider|rail grid */
}
html[data-phone-mode] .sb-col-hd,
html[data-phone-mode] #sb-rows,
html[data-phone-mode] .sb-divider,
html[data-phone-mode] #sb-rail-r,
html[data-phone-mode] .sb-blindspot-section {
    display: none;
}

/* Lock the Signal area to the viewport so the FEED is the scroller (the <820px
   responsive rules set body{overflow:auto}/app-wrap height:auto, which would
   otherwise let the page grow and break scroll-snap). .sb-center becomes a fixed
   viewport-height flex column: header on top (flex:0), feed fills the rest
   (flex:1, own scroll). --topbar-h is kept current by shared_ui.js. */
html[data-phone-mode] .sb-center {
    height: calc(100svh - var(--topbar-h, 56px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Pin Category + Time Frame above the feed; the refresh button is dropped on
   phone (the feed re-ranks on the normal background refresh). */
html[data-phone-mode] .sb-center > .section-header {
    flex: 0 0 auto;
    z-index: 5;
    background: var(--panel);
}
html[data-phone-mode] .sb-center > .section-header .sb-refresh-btn {
    display: none;
}

/* ── Phone quick story-list (chevron picker left of Category) ─────────────────────────────── */
/* The chevron is phone-only; the picker overlay flies down over the card feed. */
.sb-phone-story-toggle { display: none; }
html[data-phone-mode] .sb-phone-story-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 24px;
    padding: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, box-shadow 0.15s;
}
html[data-phone-mode] .sb-phone-story-toggle:hover,
html[data-phone-mode] .sb-phone-story-toggle.is-open {
    background: var(--link-bg);
    box-shadow: var(--shadow-sm);
}
/* Bigger glyph, same 28×24 button (fixed button size + line-height:1 keep it from growing). */
.sb-phone-story-toggle-chev { font-size: 1.75rem; line-height: 1; pointer-events: none; }

/* Overlay anchors to .sb-center (relative only on phone — never perturb desktop layout).
   top set by signal.js to the header's height on open; bottom:0 makes the open list fill the
   ENTIRE area below the header (no card peeking at the bottom). */
html[data-phone-mode] .sb-center { position: relative; }
.sb-phone-story-list {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    background: var(--panel);
    box-shadow: var(--shadow-float);
    /* Contain the scroll so over-scrolling the list does NOT chain to the body (that dragged the
       whole page — ticker over the topbar — when scrolling the list past its bottom). Same guard
       the phone cards use (.sb-phone-card overscroll-behavior-y: contain). */
    overscroll-behavior: contain;
    transition: max-height 0.25s ease, opacity 0.18s ease;
}
.sb-phone-story-list.is-open {
    max-height: 100dvh;   /* clamped by bottom:0 → fills the full screen below the header */
    overflow-y: auto;
    opacity: 1;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
}
.sb-phone-story-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    text-align: left;
    /* Tight 5px left gutter — the .is-current accent border already provides the visual inset;
       trimmed right gutter too. */
    padding: var(--space-sm) var(--space-sm) var(--space-sm) 5px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: var(--text-meta);
    line-height: 1.3;
    cursor: pointer;
}
.sb-phone-story-list-thumb {
    flex: 0 0 auto;
    width: 52px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--panel-soft);
}
.sb-phone-story-list-text {
    flex: 1 1 auto;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sb-phone-story-list-score {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 44px;
    align-items: stretch;
    text-align: center;
}
.sb-phone-story-list-item:hover { background: var(--link-bg); }
.sb-phone-story-list-item.is-current {
    background: var(--link-bg);
    font-weight: 600;
    border-left: 3px solid var(--border-accent);
    padding-left: calc(5px - 3px);   /* 3px accent + 2px = 5px, aligned with non-current rows */
}

/* ONE story at a time. The feed is a native horizontal scroll-snap carousel: one card per
   visible story, side-by-side; LEFT/RIGHT swipe follows the finger then snaps to the next/prev
   card (browser physics, no JS transform). STOP-AT-ENDS: the feed is just the real cards in board
   order, so scroll-snap naturally stops at the first and last card (no wrap-around / no buffer
   clones — the earlier infinite-loop version was removed 2026-06-09). */
html[data-phone-mode] #sb-phone-feed {
    flex: 1 1 auto;
    min-height: 0;
}
#sb-phone-feed {
    display: flex;
    flex-direction: row;
    position: relative;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* hide scrollbar Firefox */
}
#sb-phone-feed::-webkit-scrollbar { display: none; }

.sb-phone-card {
    flex-shrink: 0;
    width: 100%;                    /* JS also sets explicit px width for reliability */
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scroll-snap-align: start;
    scroll-snap-stop: always;       /* don't skip cards on fast fling */
    padding: var(--space-sm) 0;
    box-sizing: border-box;
}

/* Phone Local with no states selected: the desktop prompt (#sb-rows .sb-local-prompt) is
   display:none on phone, so signal.js mirrors it into the feed as one full-screen card — center it. */
.sb-phone-local-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Blindspot sections (below main board, inside .sb-center) ── */

/* Blindspot sections hold a CLONED .sb-col-hd + cloned .sb-row elements, both of which use
   `grid-template-columns: subgrid` (from the main table) and so need a subgrid PARENT — without one
   they collapse to a single column and stack vertically. So .sb-blindspot-section is its OWN
   track-definer (mirrors .sb-table): the cloned header subgrids off it directly; .sb-blindspot-rows
   is a subgrid pass-through and its rows subgrid off that (same two-level pattern as the main table). */
.sb-blindspot-section {
    flex-shrink: 0;
    border-top: 2px solid var(--border);
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    column-gap: 8px;
    /* NO horizontal padding here — the section header spans edge-to-edge with its OWN internal
       padding (like every section header app-wide); the table bands below get the alignment inset
       on themselves instead. */
}
/* EVERY direct child spans the full width; only the cells inside the col-hd/rows use the tracks. */
.sb-blindspot-section > * { grid-column: 1 / -1; }
/* The alignment inset lives on the table bands (col-hd + rows), not the section — so the header
   stays full-width while the columns align. */
.sb-blindspot-section > .sb-col-hd,
.sb-blindspot-section > .sb-blindspot-rows {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
}
.sb-blindspot-rows {
    display: grid;
    grid-template-columns: subgrid;
}
.sb-blindspot-rows > .sb-row { grid-column: 1 / -1; }

.sb-blindspot-rows .sb-row:first-child {
    border-top: none;
}


/* ── Timeline window slider ─────────────────────────────────────── */

#sb-timeline-section {
    padding-bottom: var(--space-sm);
}

.sb-timeline-ctrl {
    padding: 0 var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sb-timeline-track-wrap {
    padding: var(--space-xs) 0 0;
    position: relative;
}

.sb-timeline-ticks {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    pointer-events: none;
}

.sb-timeline-ticks span {
    position: absolute;
    width: 2px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(-50%);
}
.sb-timeline-ticks span:nth-child(1) { left: 8px; }
.sb-timeline-ticks span:nth-child(2) { left: calc(50% + 1px); }
.sb-timeline-ticks span:nth-child(3) { left: calc(100% - 6px); }

.sb-timeline-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 20px;
    background: transparent;
    cursor: pointer;
    outline: none;
    --fill-pct: 0%;
}

.sb-timeline-slider:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    pointer-events: none;
}

.sb-timeline-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to left,
        var(--link-text) var(--fill-pct),
        rgba(255,255,255,0.12) var(--fill-pct));
}

.sb-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--link-text);
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.sb-timeline-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
}

.sb-timeline-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--link-text);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.sb-timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--muted);
    user-select: none;
}

.sb-timeline-labels span {
    cursor: pointer;
    transition: color 0.15s;
    padding: 2px 0;
}

.sb-timeline-labels span:hover {
    color: var(--text);
}

.sb-timeline-labels span.is-active {
    color: var(--link-text);
    font-weight: 600;
}

/* Window badge shown in the board header when not on Today */
#sb-window-badge {
    display: none;
    font-size: var(--text-xs);
    color: var(--muted);
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    margin-left: var(--space-sm);
}

#sb-window-badge.is-visible {
    display: inline;
}
