* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── CSS Custom Properties ─────────────────────────────────── */

:root {
    --bg-primary: #0b0e1a;
    --bg-secondary: #0a1628;
    --bg-surface: rgba(12, 15, 30, 0.95);
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: rgba(255, 255, 255, 0.5);
    --accent-blue: #5a8fd4;
    --accent-gold: #c9a84c;
    --accent-gold-dim: rgba(201, 168, 76, 0.4);
    --prob-low: #c0392b;
    --prob-med: #d4a843;
    --prob-high: #27ae60;
    /* News pressure directions (double-encoded with a glyph everywhere). Shared
       by the chain cards, the flow-map edges, and the event pressure ledger. */
    --news-up: #6fbf73;
    --news-down: #d1706b;
    --news-flat: #8a8266;
    /* Judge-radar series. Categorical identity (never status): the slot order is
       fixed so a hue follows its entity. Validated against this surface
       (#0b0e1a) on the adjacent pairlist — worst CVD ΔE 8.4, worst
       normal-vision ΔE 19.8, all ≥3:1 contrast. JUDGE_DIM_ORDER groups each
       entity's dims into one contiguous ring sector, which is what makes
       adjacent the right pairlist; re-order either list and re-validate. */
    --judge-s1: #3987e5;   /* summaries */
    --judge-s2: #d95926;   /* scripts */
    --judge-s3: #199e70;   /* prophecies */
    --judge-s4: #c98500;   /* factors */
    --judge-s5: #9085e9;   /* event_dependencies */
    /* macOS system font stacks (SF Pro / New York / SF Mono), no CDN fonts. */
    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', 'Segoe UI', system-ui, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', system-ui, sans-serif;
    --font-serif: 'New York', ui-serif, Georgia, 'Times New Roman', serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, 'Cascadia Code', monospace;
    --sidebar-width: 360px;

    /* Liquid Glass — translucent blurred surfaces over the ambient underlay. */
    --glass-bg:          rgba(255, 255, 255, 0.06);   /* standard floating surface */
    --glass-bg-strong:   rgba(16, 20, 38, 0.55);      /* header/popovers needing legibility */
    --glass-border:      rgba(255, 255, 255, 0.14);
    --glass-border-soft: rgba(255, 255, 255, 0.08);
    --glass-blur:        22px;
    --glass-saturate:    160%;
    --glass-highlight:   inset 0 1px 0 rgba(255, 255, 255, 0.10);  /* specular top edge */
    --glass-shadow:      0 8px 32px rgba(0, 0, 0, 0.35);
    --radius-sm: 8px;  --radius-md: 12px;  --radius-lg: 16px;  --radius-xl: 22px;
}

body {
    /* Ambient underlay: the deep base tone plus a cold-blue glow upper-left and a
       faint gold glow lower-right, so the glass surfaces have light to refract. */
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(60% 55% at 12% 6%, rgba(64, 108, 190, 0.10) 0%, rgba(64, 108, 190, 0) 60%),
        radial-gradient(55% 55% at 92% 96%, rgba(201, 168, 76, 0.06) 0%, rgba(201, 168, 76, 0) 62%),
        radial-gradient(70% 60% at 78% 20%, rgba(90, 143, 212, 0.05) 0%, rgba(90, 143, 212, 0) 60%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────── */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    border-top: 2px solid var(--accent-gold-dim);
    flex-shrink: 0;
    gap: 20px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.brand-sigil {
    font-size: 24px;
    color: var(--accent-gold);
    opacity: 0.85;
    line-height: 1;
}

header h1 {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 4px;
    font-weight: 600;
    color: var(--accent-gold);
    white-space: nowrap;
}

#event-count {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.45;
    margin-left: 4px;
    white-space: nowrap;
}

.brand-info-link {
    display: inline-flex;
    align-items: center;
    font-size: 15px;
    color: var(--accent-gold);
    opacity: 0.45;
    text-decoration: none;
    line-height: 1;
    transition: opacity 0.2s;
}

.brand-info-link:hover,
.brand-info-link:focus-visible {
    opacity: 0.9;
}

.filter {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    opacity: 0.75;
    transition: opacity 0.2s;
}

.filter:hover { opacity: 1; }

.filter input[type="checkbox"] {
    accent-color: var(--accent-blue);
    width: 13px;
    height: 13px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.dot-low { background: var(--prob-low); }
.dot-med { background: var(--prob-med); }
.dot-high { background: var(--prob-high); }

/* ── Tab navigation ─────────────────────────────────── */

#tab-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    padding-left: 20px;
    margin-left: 20px;
    border-left: 1px solid var(--border-medium);
}

.tab-btn {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--accent-gold);
    opacity: 0.4;
    padding: 8px 20px;
    cursor: pointer;
    transition: opacity 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    opacity: 0.7;
}

.tab-btn.active {
    opacity: 1;
    border-bottom-color: var(--accent-gold);
}

/* ── Tab panels ────────────────────────────────────── */

.tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.tab-panel.active {
    display: flex;
}

/* ── Map tab controls row ──────────────────────────── */

#map-tab-controls {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
}

/* ── Filters combo (category + probability) ───────────── */

.filters-combo {
    position: relative;
    flex-shrink: 0;
}

.filters-combo-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    color: #d0d0d0;
    font-size: 11px;
    font-family: var(--font-body);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.filters-combo-btn:hover {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.07);
}

.filters-combo-btn[aria-expanded="true"] {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(90, 143, 212, 0.15);
}

.filters-combo-label {
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.filters-combo-summary {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.filters-combo-chevron {
    color: #888;
    font-size: 10px;
    margin-left: 2px;
}

.filters-combo-popover {
    /* Sibling of #map-tab-controls — when visible, this row pushes the
       timeline + map down rather than overlaying them. */
    padding: 14px 24px 14px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.filters-combo-popover.hidden {
    display: none;
}

.filters-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filters-section + .filters-section {
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.filters-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filters-section-title {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.filters-section-toggle {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s;
}

.filters-section-toggle:hover {
    color: #8fb6e6;
}

.filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

/* ── Main layout ────────────────────────────────────────── */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

/* ── Map ────────────────────────────────────────────────── */

#map-container {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#world-map {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
}

/* SVG map styling */
.country {
    fill: #2a3a2a;
    stroke: none;
    transition: fill 0.2s;
}

.country:hover {
    fill: #3a4a35;
}

.country-border {
    fill: none;
    stroke: #4a5a40;
    stroke-width: 0.25;
    stroke-linejoin: round;
    pointer-events: none;
}

.graticule {
    fill: none;
    stroke: #0e1e30;
    stroke-width: 0.15;
}

.coastline {
    fill: none;
    stroke: #2a3355;
    stroke-width: 0.2;
}

/* ── Country pie chart markers ─────────────────────────── */

.country-group {
    transition: transform 0.2s ease;
}

.pie-slice {
    cursor: pointer;
    transition: opacity 0.2s, filter 0.2s;
    stroke: var(--bg-primary);
    stroke-width: 0.15;
}

.pie-slice:hover {
    filter: brightness(1.3);
}

.prob-slice {
    cursor: pointer;
    transition: opacity 0.2s, filter 0.2s;
    stroke: var(--bg-primary);
    stroke-width: 0.1;
}

.prob-slice:hover {
    filter: brightness(1.3);
}

.country-ring {
    pointer-events: none;
    transition: opacity 0.2s, stroke-width 0.2s;
}

.country-label {
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
    font-family: var(--font-mono);
}

/* Marker glow filter (applied via JS) */
.marker-glow {
    filter: drop-shadow(0 0 2px rgba(90, 143, 212, 0.4));
}

.marker-glow-gold {
    filter: drop-shadow(0 0 3px rgba(201, 168, 76, 0.5));
}

/* ── Tooltip ────────────────────────────────────────────── */

#tooltip {
    position: absolute;
    background: rgba(15, 18, 35, 0.95);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    z-index: 100;
    max-width: 300px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#tooltip.hidden { display: none; }

#tooltip .tt-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    margin-bottom: 4px;
}

#tooltip .tt-meta {
    opacity: 0.6;
    font-size: 11px;
}

#tooltip .tt-prob {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 13px;
}

#tooltip .tt-count {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

#tooltip .tt-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tt-cat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.tt-cat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tt-cat-name {
    flex: 1;
    opacity: 0.8;
}

.tt-cat-count {
    font-family: var(--font-mono);
    opacity: 0.5;
    flex-shrink: 0;
    font-size: 10px;
}

.tt-prob-bar {
    display: flex;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    margin: 2px 0 1px 12px;
}

.tt-prob-seg {
    display: block;
    height: 100%;
    min-width: 1px;
}

.tt-prob-labels {
    display: flex;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 9px;
    margin-left: 12px;
    margin-bottom: 4px;
    opacity: 0.7;
}

/* ── Timeline panel ─────────────────────────────────────── */

#timeline-panel {
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

#timeline-header {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.timeline-title {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ── Search & year filter ────────────────────────────── */

#timeline-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#event-search {
    width: 180px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    color: #d0d0d0;
    font-size: 11px;
    padding: 0 10px;
    outline: none;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

#event-search::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

#event-search:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(90, 143, 212, 0.15);
}

#year-filter {
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    color: #d0d0d0;
    font-size: 11px;
    padding: 0 6px;
    outline: none;
    font-family: var(--font-body);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: border-color 0.2s;
}

#year-filter:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(90, 143, 212, 0.15);
}

#year-filter option {
    background: #0c0f1e;
    color: #d0d0d0;
}

/* ── Date accumulation slider ─────────────────────────── */

#slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.slider-bound {
    font-family: var(--font-mono);
    font-size: 10px;
    opacity: 0.35;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
}

#slider-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    padding-top: 38px;
    height: 14px;
    box-sizing: content-box;
}

/* Per-month event-count histogram, sitting above the slider track. */
#slider-histogram {
    position: absolute;
    left: 0;
    right: 0;
    top: 16px;
    width: 100%;
    height: 20px;
    pointer-events: none;
    overflow: visible;
}

#slider-histogram .histogram-bar {
    fill: var(--accent-blue);
    opacity: 0.55;
    pointer-events: auto;
    transition: opacity 0.15s ease;
}

#slider-histogram .histogram-bar.out-of-range {
    opacity: 0.18;
}

#slider-histogram .histogram-bar:hover {
    opacity: 0.95;
}

/* ── Dual-range slider ────────────────────────────────── */

#slider-track-bg,
#slider-track-fill {
    position: absolute;
    height: 4px;
    border-radius: 2px;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 19px; /* compensates wrapper padding-top so the track sits centered visually */
}

#slider-track-bg {
    left: 0;
    right: 0;
    background: #1c2240;
    z-index: 1;
}

#slider-track-fill {
    left: 0;
    width: 100%;
    background: var(--accent-blue);
    z-index: 2;
}

.dual-range-input {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 14px;
    background: transparent;
    outline: none;
    pointer-events: none;
    margin: 0;
    margin-top: 19px;
    z-index: 3;
}

.dual-range-input::-webkit-slider-runnable-track {
    background: transparent;
    border: none;
    height: 4px;
}

.dual-range-input::-moz-range-track {
    background: transparent;
    border: none;
    height: 4px;
}

.dual-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: grab;
    border: 2px solid #0d1117;
    box-shadow: 0 0 6px rgba(90, 143, 212, 0.5);
    pointer-events: auto;
    transition: box-shadow 0.2s;
    margin-top: -5px; /* center the 14px thumb on the 4px track */
}

.dual-range-input::-webkit-slider-thumb:hover {
    box-shadow: 0 0 10px rgba(90, 143, 212, 0.8);
}

.dual-range-input::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.dual-range-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: grab;
    border: 2px solid #0d1117;
    box-shadow: 0 0 6px rgba(90, 143, 212, 0.5);
    pointer-events: auto;
}

.slider-thumb-label {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-blue);
    letter-spacing: 0.5px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
}

/* ── Timeline track ─────────────────────────────────────── */

#timeline-track {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 20px 12px;
    position: relative;
    outline: none;
}

#timeline-track:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

#timeline-events {
    position: relative;
    min-height: 100%;
}

/* Month group headers */
.tl-month-header {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--accent-gold);
    opacity: 0.5;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 2px;
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 1;
}

.tl-row {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: background 0.15s;
    gap: 10px;
    border-left: 3px solid transparent;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.tl-row::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.06;
    pointer-events: none;
    transition: width 0.3s ease;
}

.tl-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.tl-row:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

.tl-row.highlighted {
    background: rgba(90, 143, 212, 0.1);
}

.tl-row.active {
    background: rgba(90, 143, 212, 0.15);
    border-left-color: var(--accent-blue);
}

.tl-row.keyboard-focus {
    background: rgba(90, 143, 212, 0.08);
    border-left-color: var(--accent-blue);
}

.tl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tl-title {
    flex: 1;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.85;
}

.tl-location {
    font-size: 11px;
    opacity: 0.4;
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}

.tl-prob {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 44px;
    text-align: right;
}

.tl-month-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    opacity: 0.4;
    flex-shrink: 0;
    min-width: 100px;
    white-space: nowrap;
}

/* Rarity tier indicators on timeline rows */
.tl-row[data-rarity="legendary"] {
    border-left-color: var(--accent-gold);
}

.tl-row[data-rarity="legendary"] .tl-title {
    color: var(--accent-gold);
    opacity: 1;
}

.tl-row[data-rarity="epic"] {
    border-left-color: #9B59B6;
}

.tl-row[data-rarity="rare"] {
    border-left-color: var(--accent-blue);
}

/* ── Scrollbar ──────────────────────────────────────────── */

#timeline-track::-webkit-scrollbar {
    width: 4px;
}

#timeline-track::-webkit-scrollbar-track {
    background: transparent;
}

#timeline-track::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

#timeline-track::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Connection line (map marker ↔ timeline) ────────────── */

.connection-line {
    position: absolute;
    pointer-events: none;
    z-index: 50;
}

/* ── Event Details tab ─────────────────────────────── */

.tab-btn-hidden {
    display: none !important;
}

#tab-event-details {
    flex-direction: column;
    overflow: hidden;
}

#details-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.details-back-btn {
    background: rgba(90, 143, 212, 0.08);
    border: 1px solid rgba(90, 143, 212, 0.25);
    color: var(--accent-blue);
    font-family: var(--font-body);
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.details-back-btn:hover {
    background: rgba(90, 143, 212, 0.16);
    border-color: rgba(90, 143, 212, 0.5);
}

.details-back-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

#details-title-label {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    opacity: 0.5;
}

#details-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 40px;
}

#details-content #event-detail {
    max-width: 760px;
    margin: 0 auto;
}

/* ── Country events popup (map overlay) ───────────────── */

#country-events-popup {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 320px;
    max-height: calc(100% - 32px);
    background: rgba(12, 15, 30, 0.96);
    border: 1px solid rgba(90, 143, 212, 0.3);
    border-radius: 6px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 150;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#country-events-popup.hidden {
    display: none;
}

#country-events-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

#country-events-title {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--accent-gold);
    opacity: 0.85;
}

#country-events-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
    padding: 0 4px;
}

#country-events-close:hover { opacity: 1; }

#country-events-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    flex: 1;
}

#country-events-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.12s;
}

#country-events-list li:hover {
    background: rgba(90, 143, 212, 0.1);
}

#country-events-list .cep-prob {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    min-width: 38px;
    text-align: right;
    flex-shrink: 0;
}

#country-events-list .cep-title {
    font-size: 12px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* ── Probability gauge in event sidebar ──────────────── */

#sidebar-prob-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

#sidebar-prob-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.prob-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.prob-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 6;
}

.prob-ring-fill {
    fill: none;
    stroke: var(--accent-blue);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 0.8s ease, stroke 0.3s;
    filter: drop-shadow(0 0 6px rgba(90, 143, 212, 0.4));
}

#sidebar-prob-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

#sidebar-prob-label {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.4;
    margin-top: 4px;
}

/* Rarity border glow on event details */
#tab-event-details.rarity-legendary .prob-ring-fill {
    filter: drop-shadow(0 0 8px rgba(201, 168, 76, 0.5));
}

#tab-event-details.rarity-legendary #sidebar-event-title {
    color: var(--accent-gold);
    text-shadow: 0 0 14px rgba(201, 168, 76, 0.3);
}

#tab-event-details.rarity-epic #sidebar-event-title {
    color: #C28DE6;
}

#tab-event-details.rarity-rare #sidebar-event-title {
    color: var(--accent-blue);
}

#sidebar-event-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 12px;
    text-align: center;
}

#sidebar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

#sidebar-meta span {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    opacity: 0.7;
}

#sidebar-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
    font-size: 12px;
    opacity: 0.6;
}

#sidebar-loading.hidden,
#sidebar-error.hidden,
#sidebar-summary.hidden {
    display: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#sidebar-error {
    color: #EE5A6F;
    font-size: 12px;
    padding: 12px 0;
}

.summary-section {
    margin-bottom: 18px;
}

.summary-section h3 {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-bottom: 6px;
    opacity: 0.8;
}

.summary-section p {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.85;
    color: #d0d0d0;
}

/* ── Market outcomes in sidebar ─────────────────────── */

#sidebar-markets.hidden { display: none; }

.markets-header {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--accent-gold);
    opacity: 0.7;
    margin-bottom: 8px;
}

#sidebar-markets {
    margin-bottom: 18px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}

.market-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
    overflow: hidden;
}

/* Stacked label + settlement-rule sub-line, left of the probability */
.market-text {
    flex: 1;
    min-width: 0;
    margin-right: 8px;
    position: relative;
    z-index: 1;
}

.market-row:last-child {
    border-bottom: none;
}

/* Probability fill bar behind market rows */
.market-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--prob-width, 0%);
    opacity: 0.08;
    pointer-events: none;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.market-title {
    display: block;
    font-size: 12px;
    color: #d0d0d0;
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-rule {
    font-size: 10.5px;
    color: #9a9a9a;
    opacity: 0.7;
    margin-top: 2px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.market-prob {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 44px;
    text-align: right;
    position: relative;
    z-index: 1;
}

/* ── Market signals + settlement rules in sidebar ────── */

#sidebar-signals.hidden,
#sidebar-history.hidden,
#sidebar-rules.hidden { display: none; }

#sidebar-signals,
#sidebar-history,
#sidebar-rules {
    margin-bottom: 18px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
}

/* ── Market history sparkline (docs/SPEC_event_history.md P4) */
.history-spark-svg {
    display: block;
    width: 100%;
    height: 60px;
}

.history-spark-line {
    fill: none;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.history-spark-area {
    opacity: 0.12;
    stroke: none;
}

.history-spark-mid {
    stroke: var(--border-medium);
    stroke-width: 1;
    stroke-dasharray: 2 3;
    vector-effect: non-scaling-stroke;
    opacity: 0.6;
}

.history-spark-caption {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.signal-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.signal-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.signal-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.signal-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.signal-value {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-primary);
}

.signal-wide .signal-value { font-size: 13px; }

.signal-dim { color: rgba(255, 255, 255, 0.4); font-size: 0.85em; }

.rule-block {
    padding: 9px 11px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.rule-block + .rule-block { margin-top: 7px; }

.rule-primary { border-left: 2px solid var(--accent-blue); }
.rule-secondary { border-left: 2px solid var(--accent-gold-dim); }

.rule-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.rule-primary .rule-label { color: var(--accent-blue); }
.rule-secondary .rule-label { color: var(--accent-gold); }

.rule-text {
    font-size: 12.5px;
    line-height: 1.5;
    color: #cfcfcf;
}

/* ── Script section in sidebar ───────────────────────── */

#sidebar-script-section.hidden { display: none; }

.script-btn {
    background: rgba(90, 143, 212, 0.15);
    border: 1px solid rgba(90, 143, 212, 0.3);
    color: var(--accent-blue);
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    width: 100%;
    font-family: var(--font-body);
}

.script-btn:hover {
    background: rgba(90, 143, 212, 0.25);
    border-color: rgba(90, 143, 212, 0.5);
}

.script-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.script-btn.hidden { display: none; }

#script-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    font-size: 12px;
    opacity: 0.6;
}

#script-loading.hidden,
#script-error.hidden,
#script-content.hidden {
    display: none;
}

#script-error {
    color: #EE5A6F;
    font-size: 12px;
    padding: 8px 0;
}

#script-text {
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
    color: #d0d0d0;
    opacity: 0.9;
    background: var(--bg-card);
    padding: 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
}

#script-examples.hidden { display: none; }

#script-examples h4 {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin: 12px 0 6px;
    opacity: 0.7;
}

#script-examples ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#script-examples li {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    padding: 4px 0 4px 12px;
    border-left: 2px solid rgba(201, 168, 76, 0.2);
    margin-bottom: 4px;
}

/* ── Video section in sidebar ────────────────────────── */

#sidebar-video-section.hidden { display: none; }

#video-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    font-size: 12px;
    opacity: 0.6;
}

#video-loading.hidden,
#video-error.hidden,
#video-content.hidden {
    display: none;
}

#video-error {
    color: #EE5A6F;
    font-size: 12px;
    padding: 8px 0;
}

#video-player {
    width: 100%;
    border-radius: 4px;
    margin-top: 8px;
    background: #000;
    max-height: 240px;
}

/* ── Event detail minor ────────────────────────────────── */

#event-detail.hidden { display: none; }

.prob-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

/* Details scrollbar */
#details-content::-webkit-scrollbar {
    width: 4px;
}

#details-content::-webkit-scrollbar-track {
    background: transparent;
}

#details-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* ── Oracle Tab ────────────────────────────────────────── */

#tab-oracle {
    flex-direction: column;
    overflow: hidden;
}

#oracle-root {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 14px;
    padding: 18px 22px;
    height: 100%;
    overflow: hidden;
}

#oracle-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.oracle-kpi {
    background: var(--bg-surface, rgba(12, 15, 30, 0.95));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.oracle-kpi .kpi-label {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(201, 168, 76, 0.7);
}

.oracle-kpi .kpi-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: #f0eada;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#oracle-dim-bar {
    background: var(--bg-surface, rgba(12, 15, 30, 0.95));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.oracle-dim-title {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(201, 168, 76, 0.65);
    text-transform: uppercase;
}

#oracle-dim-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.oracle-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(240, 234, 218, 0.6);
    font-family: var(--font-body);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.oracle-chip.active {
    background: rgba(201, 168, 76, 0.12);
    border-color: rgba(201, 168, 76, 0.5);
    color: #f0eada;
}

.oracle-chip:hover {
    border-color: rgba(201, 168, 76, 0.7);
}

.oracle-chip.dragging {
    opacity: 0.4;
}

.oracle-chip.drag-over {
    border-color: #c9a84c;
    box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.25);
}

.oracle-chip .chip-grip {
    color: rgba(255, 255, 255, 0.35);
    cursor: grab;
    font-size: 14px;
}

.oracle-chip .chip-toggle {
    color: rgba(201, 168, 76, 0.8);
    font-size: 10px;
}

#oracle-main {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
    gap: 16px;
    min-height: 0;
    overflow: hidden;
}

#oracle-sunburst-wrap {
    background: radial-gradient(ellipse at center, #12152a 0%, #070911 75%);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
}

#oracle-sunburst {
    width: 100%;
    height: 100%;
    max-height: 100%;
}

.oracle-wedge {
    stroke: rgba(0, 0, 0, 0.4);
    stroke-width: 0.5;
    transition: filter 0.15s;
}

.oracle-wedge:hover {
    filter: brightness(1.25);
}

#oracle-detail-panel {
    background: var(--bg-surface, rgba(12, 15, 30, 0.95));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#oracle-breadcrumb {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(201, 168, 76, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    word-wrap: break-word;
}

#oracle-detail-body .detail-empty {
    color: rgba(240, 234, 218, 0.4);
    font-size: 12px;
    font-style: italic;
}

.detail-path {
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(240, 234, 218, 0.55);
    word-wrap: break-word;
}

.detail-stats {
    display: flex;
    gap: 14px;
    margin-top: 4px;
}

.detail-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-stat .ds-label {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(201, 168, 76, 0.65);
}

.detail-stat .ds-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: #f0eada;
}

.detail-probbar {
    display: flex;
    height: 18px;
    border-radius: 4px;
    overflow: hidden;
    gap: 1px;
    margin-top: 6px;
}

.dp-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2px;
}

.dp-seg span {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: #000;
    opacity: 0.8;
}

.dp-low  { background: var(--prob-low, #c0392b); }
.dp-med  { background: var(--prob-med, #d4a843); }
.dp-high { background: var(--prob-high, #27ae60); }

.detail-legend {
    display: flex;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(240, 234, 218, 0.65);
}

.detail-legend .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.detail-legend .dot-low  { background: var(--prob-low, #c0392b); }
.detail-legend .dot-med  { background: var(--prob-med, #d4a843); }
.detail-legend .dot-high { background: var(--prob-high, #27ae60); }

.detail-top-title {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(201, 168, 76, 0.7);
    margin-top: 4px;
}

.detail-top-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-top-list li {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: rgba(240, 234, 218, 0.85);
}

.detail-top-list li.detail-top-item {
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    transition: background 0.12s;
}

.detail-top-list li.detail-top-item:hover,
.detail-top-list li.detail-top-item:focus {
    background: rgba(90, 143, 212, 0.12);
    outline: none;
}

.dtl-prob {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: #000;
    text-align: center;
    padding: 2px 0;
    border-radius: 3px;
}

.dtl-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dtl-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(240, 234, 218, 0.4);
}

#oracle-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--bg-surface, rgba(12, 15, 30, 0.95));
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    padding: 10px 14px;
}

.oracle-prob-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.oracle-filter-label {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(201, 168, 76, 0.65);
    margin-right: 4px;
}

.oracle-prob-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: rgba(240, 234, 218, 0.8);
    cursor: pointer;
}

.oracle-prob-chip input {
    margin: 0;
    accent-color: #c9a84c;
}

.oracle-prob-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.oracle-prob-chip .dot-low  { background: var(--prob-low, #c0392b); }
.oracle-prob-chip .dot-med  { background: var(--prob-med, #d4a843); }
.oracle-prob-chip .dot-high { background: var(--prob-high, #27ae60); }

#oracle-search {
    flex: 0 1 260px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 7px 12px;
    color: #f0eada;
    font-family: var(--font-body);
    font-size: 12px;
    outline: none;
}

#oracle-search:focus {
    border-color: rgba(201, 168, 76, 0.7);
}

@media (max-width: 900px) {
    #oracle-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    #oracle-main { grid-template-columns: 1fr; }
    #oracle-detail-panel { max-height: 320px; }
}

/* ── Prophecy Tab ──────────────────────────────────────── */

#tab-prophecy {
    background: radial-gradient(ellipse at center, #12152a 0%, #070911 70%);
    align-items: center;
    justify-content: center;
}

#prophecy-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    text-align: center;
}

#prophecy-content::-webkit-scrollbar {
    width: 4px;
}

#prophecy-content::-webkit-scrollbar-track {
    background: transparent;
}

#prophecy-content::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 76, 0.2);
    border-radius: 2px;
}

.prophecy-sigil {
    font-size: 48px;
    color: var(--accent-gold);
    margin-bottom: 16px;
    opacity: 0.8;
}

.prophecy-title {
    font-family: var(--font-serif);
    font-size: 17px;
    letter-spacing: 5px;
    color: var(--accent-gold);
    margin-bottom: 32px;
    font-weight: 500;
}

#prophecy-body {
    font-family: var(--font-serif);
    font-size: 16px;
    line-height: 2;
    color: #d4c5a0;
    white-space: pre-line;
    opacity: 0.9;
    margin-bottom: 36px;
}

/* Prophecy loading state */
#prophecy-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#prophecy-loading.hidden,
#prophecy-text.hidden {
    display: none;
}

.prophecy-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(201, 168, 76, 0.15);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.prophecy-loading-text {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--accent-gold);
    opacity: 0.6;
    font-style: italic;
}

.prophecy-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.prophecy-categories button {
    background: transparent;
    border: 1px solid rgba(201, 168, 76, 0.3);
    color: var(--accent-gold);
    opacity: 0.7;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.prophecy-categories button:hover {
    opacity: 1;
    border-color: rgba(201, 168, 76, 0.6);
}

.prophecy-categories button.is-active {
    opacity: 1;
    border-color: rgba(201, 168, 76, 0.8);
    background-color: rgba(201, 168, 76, 0.08);
}

/* ── Map loading overlay — themed rune spinner ─────────── */

#map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 50;
    background: rgba(10, 22, 40, 0.75);
}

#map-loading.hidden { display: none; }

.rune-spinner {
    width: 80px;
    height: 80px;
}

.rune-svg {
    width: 100%;
    height: 100%;
}

.rune-ring {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 20 10;
}

.rune-ring-outer {
    stroke: var(--accent-gold);
    opacity: 0.6;
    animation: rune-rotate 4s linear infinite;
    transform-origin: center;
}

.rune-ring-inner {
    stroke: var(--accent-blue);
    opacity: 0.4;
    animation: rune-rotate-reverse 3s linear infinite;
    transform-origin: center;
}

.rune-sigil {
    font-size: 24px;
    fill: var(--accent-gold);
    opacity: 0.7;
    animation: rune-pulse 2s ease-in-out infinite;
}

@keyframes rune-rotate {
    to { transform: rotate(360deg); }
}

@keyframes rune-rotate-reverse {
    to { transform: rotate(-360deg); }
}

@keyframes rune-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

.loading-label {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px;
    color: var(--accent-gold);
    opacity: 0.6;
    font-style: italic;
}

#load-progress-bar {
    width: 160px;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

#load-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-blue));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── Timeline skeleton loading ───────────────────────── */

.tl-skeleton-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.skeleton-bar {
    display: block;
    height: 12px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 3px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Empty state ─────────────────────────────────────── */

#empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    text-align: center;
}

#empty-state.hidden { display: none; }

.empty-state-text { font-size: 12px; opacity: 0.5; margin-bottom: 12px; }

#reset-filters-btn {
    background: rgba(90, 143, 212, 0.15);
    border: 1px solid rgba(90, 143, 212, 0.3);
    color: var(--accent-blue);
    padding: 6px 14px;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-body);
    transition: all 0.2s;
}

#reset-filters-btn:hover {
    background: rgba(90, 143, 212, 0.25);
}

#reset-filters-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ── Retry link ──────────────────────────────────────── */

.retry-link {
    background: none;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    font-family: var(--font-body);
    padding: 0;
    margin-left: 4px;
}

/* ── Trade Terminal View ───────────────────────────────── */

#trade-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#trade-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    gap: 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.trade-input {
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    color: #d0d0d0;
    font-size: 11px;
    padding: 0 10px;
    outline: none;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

.trade-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(90, 143, 212, 0.15);
}

.trade-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

#trade-search {
    width: 220px;
}

#trade-category-filter {
    width: 140px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

#trade-category-filter option {
    background: #0c0f1e;
    color: #d0d0d0;
}

.trade-prob-range {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.trade-prob-range input {
    width: 50px;
}

.trade-stats {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Trade table wrapper */
#trade-table-wrap {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#trade-table-wrap::-webkit-scrollbar {
    width: 4px;
}

#trade-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

#trade-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Trade table */
#trade-table {
    width: 100%;
    border-collapse: collapse;
}

#trade-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-surface);
}

#trade-table th {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-medium);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.2s;
}

#trade-table th:hover {
    color: var(--accent-gold);
}

#trade-table th.sorted {
    color: var(--accent-gold);
}

.sort-arrow {
    font-size: 8px;
    margin-left: 4px;
    opacity: 0.6;
}

#trade-table td {
    font-size: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

#trade-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

#trade-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Striping is class-driven, not :nth-child — drawer rows share the tbody and
   would otherwise flip the alternation of every row below an open one. */
#trade-table tbody tr.tr-alt {
    background: rgba(255, 255, 255, 0.01);
}

#trade-table tbody tr.tr-alt:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Ticker column */
.td-ticker {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-gold);
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Title column */
.td-title {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.85;
}

/* Category column */
.td-category {
    white-space: nowrap;
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}

.cat-badge .dot {
    width: 6px;
    height: 6px;
}

/* Probability column */
.td-prob {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.prob-bar-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prob-mini-bar {
    width: 50px;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.prob-mini-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Market type badge */
.type-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Country column */
.td-country {
    font-size: 11px;
    opacity: 0.6;
    white-space: nowrap;
}

/* Date column */
.td-date {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.5;
    white-space: nowrap;
}

/* Lifecycle columns: opened / early close / last seen / settled */
.td-opened,
.td-seen,
.td-settled {
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: nowrap;
    color: var(--text-secondary);
}

.td-dash { opacity: 0.35; }

.early-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(201, 168, 76, 0.13);
    border: 1px solid var(--accent-gold-dim);
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: default;
}

.seen-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: 1px;
}

.seen-fresh { background: var(--prob-high); }
.seen-stale { background: rgba(255, 255, 255, 0.3); }

.settled-chip {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.settled-yes { background: rgba(39, 174, 96, 0.15); color: var(--prob-high); border: 1px solid rgba(39, 174, 96, 0.4); }
.settled-no  { background: rgba(192, 57, 43, 0.15); color: var(--prob-low); border: 1px solid rgba(192, 57, 43, 0.4); }

/* Trade empty state */
#trade-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

#trade-empty .empty-state-text {
    font-size: 13px;
    opacity: 0.4;
}

/* ── Trade forecast drawer ─────────────────────────────────
   docs/SPEC_trade_forecast_drawer.md — the kaldamus columns and the per-row
   expandable drawer. Gold is the house's own layer, blue is the market;
   signed values always pair a --news-* color with a glyph. */

.trade-forecast-only {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.trade-forecast-only input {
    accent-color: var(--accent-gold);
    cursor: pointer;
}

#trade-table th.th-static {
    cursor: default;
}

#trade-table th.th-static:hover {
    color: var(--text-muted);
}

.td-expand {
    width: 22px;
    padding-right: 0 !important;
}

.fc-chevron {
    background: none;
    border: none;
    padding: 0;
    width: 16px;
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s, color 0.15s;
}

.fc-chevron:hover { color: var(--accent-gold); }
.fc-chevron.open  { transform: rotate(90deg); color: var(--accent-gold); }
.fc-chevron:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.td-kaldamus,
.td-div,
.td-basis {
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: nowrap;
}

.fc-kaldamus {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-gold);
}

.fc-div { font-weight: 600; }
.fc-up   { color: var(--news-up); }
.fc-down { color: var(--news-down); }
.fc-flat { color: var(--news-flat); }

.fc-basis {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    cursor: default;
}

.fc-basis-quantitative { color: var(--news-up);   border-color: rgba(111, 191, 115, 0.4); }
.fc-basis-partial      { color: var(--accent-gold); border-color: var(--accent-gold-dim); }
.fc-basis-cosmetic     { color: var(--text-muted); }

/* Drawer row — a recess under its event row. */
.fc-drawer[hidden] { display: none; }

.fc-drawer,
.fc-drawer:hover {
    background: rgba(10, 22, 40, 0.55);
    cursor: default;
}

.fc-drawer > td {
    padding: 0 !important;
    border-bottom: 1px solid var(--border-subtle);
}

/* The colspan cell is as wide as the 15-column table, which scrolls past the
   viewport — so the grid caps at the stacking breakpoint (never clipped above
   it) and sticks to the left edge of the scrollport, keeping all three panes
   readable at any horizontal scroll offset. */
.fc-drawer-grid {
    position: sticky;
    left: 0;
    max-width: 1100px;
    display: grid;
    grid-template-columns: minmax(250px, 0.95fr) minmax(300px, 1.05fr) minmax(300px, 1.05fr);
}

.fc-pane {
    padding: 12px 16px;
    min-width: 0;
}

.fc-pane + .fc-pane {
    border-left: 1px solid var(--border-subtle);
}

.fc-pane-label {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.fc-muted {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 0;
}

.fc-caption {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Trend pane */
.fc-legend {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.fc-spark-wrap { width: 100%; }

.fc-spark {
    width: 100%;
    height: 74px;
    display: block;
    overflow: visible;
}

.fc-spark-mid {
    stroke: rgba(255, 255, 255, 0.14);
    stroke-width: 1;
    stroke-dasharray: 2 3;
}

.fc-spark-mid-label {
    font-family: var(--font-mono);
    font-size: 7px;
    fill: var(--text-muted);
}

.fc-spark-area  { fill: rgba(90, 143, 212, 0.10); }
.fc-spark-line  { fill: none; stroke: var(--accent-blue); stroke-width: 2; }
.fc-spark-dot   { stroke: var(--bg-primary); stroke-width: 1; }
.fc-spark-gap   { stroke: var(--accent-gold); stroke-width: 1; stroke-dasharray: 2 2; }
.fc-spark-k     { fill: var(--accent-gold); }

.fc-spark-k-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    fill: var(--accent-gold);
}

.fc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.fc-chip {
    font-family: var(--font-mono);
    font-size: 9.5px;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Factors pane — the diverging contribution tornado. */
.fc-edge {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto 84px 46px;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 11px;
    cursor: default;
}

.fc-edge-dir { font-size: 11px; text-align: center; }

.fc-edge-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.fc-edge-meta,
.fc-edge-value {
    font-family: var(--font-mono);
    font-size: 9.5px;
}

.fc-edge-meta  { color: var(--text-muted); white-space: nowrap; }
.fc-edge-value { text-align: right; font-size: 10px; }

.fc-bar {
    position: relative;
    display: block;
    height: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
}

.fc-bar-axis {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.18);
}

.fc-bar-fill {
    position: absolute;
    top: 1px;
    bottom: 1px;
    border-radius: 1px;
}

.fc-up-bg   { background: var(--news-up); }
.fc-down-bg { background: var(--news-down); }

/* Forecast pane */
.fc-numbers {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 8px;
}

.fc-num-label {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.fc-num-value {
    font-family: var(--font-mono);
    font-weight: 600;
    line-height: 1.1;
}

.fc-num-k .fc-num-value { font-size: 30px; color: var(--accent-gold); }
.fc-num-m .fc-num-value { font-size: 18px; color: var(--accent-blue); }

.fc-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.fc-outside {
    border-left: 2px solid var(--accent-gold-dim);
    padding: 2px 0 2px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    cursor: default;
}

.fc-indicators .fc-pane-label { margin-bottom: 5px; }

.fc-indicator {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 1px 0;
    font-size: 11px;
}

.fc-ind-support {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.fc-ind-prior { color: var(--accent-gold); flex-shrink: 0; cursor: default; }

.fc-ind-claim {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    cursor: default;
}

.fc-ind-asof {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.fc-rationale {
    margin-top: 10px;
    font-size: 11px;
}

.fc-rationale summary {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
}

.fc-rationale summary:hover { color: var(--accent-gold); }

.fc-rationale p {
    font-family: var(--font-serif);
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Narrow viewports: the three panes stack rather than crush. */
@media (max-width: 1100px) {
    .fc-drawer-grid { grid-template-columns: 1fr; }
    .fc-pane + .fc-pane {
        border-left: none;
        border-top: 1px solid var(--border-subtle);
    }
}

/* ── Reports tab (dashboard) ───────────────────────────── */

#tab-reports {
    overflow-y: auto;
    padding: 20px 28px 60px;
}

#reports-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#reports-loading,
.reports-empty,
.reports-error {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
}

.reports-error { color: var(--prob-low); }

.reports-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dashboard-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
}

.dashboard-header h2 {
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 3px;
    color: var(--accent-gold);
    font-weight: 600;
}

.dashboard-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.reports-timestamp {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.dashboard-health-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
}

.dashboard-health-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dashboard-health-good .health-dot { background: var(--prob-high); }
.dashboard-health-warn .health-dot { background: var(--prob-med); }
.dashboard-health-bad .health-dot { background: var(--prob-low); }
.dashboard-health-good { color: #b8d9c1; }
.dashboard-health-warn { color: #e6d59a; }
.dashboard-health-bad { color: #e8a094; }

.entity-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.entity-matrix-col {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entity-matrix-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--border-subtle);
}

.entity-matrix-row:last-child { border-bottom: none; }

.entity-matrix-label {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
}

.entity-matrix-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.quality-score-good { color: var(--prob-high); }
.quality-score-warn { color: var(--prob-med); }
.quality-score-bad  { color: var(--prob-low); }

.delta {
    font-family: var(--font-mono);
    font-size: 10px;
    min-width: 40px;
    text-align: right;
}

.delta-up   { color: var(--prob-high); }
.delta-down { color: var(--prob-low); }
.delta-flat { color: var(--text-muted); }

.reports-subhead {
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-gold);
    opacity: 0.85;
    margin-bottom: 6px;
}

.reports-table-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px 16px;
}

.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.reports-table th {
    text-align: left;
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-medium);
}

.reports-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.reports-table tbody tr:last-child td { border-bottom: none; }

.reports-numeric {
    font-family: var(--font-mono);
    text-align: right;
}

.reports-numeric-zero { color: var(--text-muted); }

.reports-empty-row {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0;
}

.judge-heatmap td.heatmap-cell {
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
}

.heatmap-cell-good { background: rgba(39, 174, 96, 0.18); color: #c9eed4; }
.heatmap-cell-warn { background: rgba(212, 168, 67, 0.18); color: #f1e1a6; }
.heatmap-cell-bad  { background: rgba(192, 57, 43, 0.20); color: #f4b6ad; }

.failing-checks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.failing-check-card {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.failing-check-card-title {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-gold);
}

.failing-check {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
    border-top: 1px dashed var(--border-subtle);
}

.failing-check:first-of-type { border-top: none; }

.failing-check-name {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
}

.failing-check-rate {
    font-family: var(--font-mono);
    font-size: 11px;
}

.failing-check-ids {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
}

.failing-check-ids li,
.failing-check-ids li a {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent-gold);
    text-decoration: none;
}

.failing-check-ids li a:hover { text-decoration: underline; }

.strata-table td { font-family: var(--font-mono); font-size: 11px; }

.reports-break {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.reports-break-has-unexpected { border-color: rgba(192, 57, 43, 0.4); }

.reports-break-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reports-break-summary::-webkit-details-marker { display: none; }

.reports-break-summary::before {
    content: '▸';
    color: var(--accent-gold);
    font-size: 10px;
    transition: transform 0.15s;
    display: inline-block;
}

.reports-break[open] > .reports-break-summary::before { transform: rotate(90deg); }

.reports-break-label {
    flex: 1;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-primary);
}

.reports-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.reports-badge-unexpected {
    background: rgba(192, 57, 43, 0.18);
    color: #e8a094;
    border: 1px solid rgba(192, 57, 43, 0.4);
}

.reports-badge-expected {
    background: rgba(201, 168, 76, 0.15);
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold-dim);
}

.reports-badge-zero {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

.reports-break-body {
    padding: 0 16px 14px;
    border-top: 1px solid var(--border-subtle);
}

.reports-break-subhead {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 12px 0 6px;
}

.reports-id-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reports-id-list li {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px dashed var(--border-subtle);
}

.reports-id-list li:last-child { border-bottom: none; }

.reports-id,
.reports-id a {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-gold);
    text-decoration: none;
    flex-shrink: 0;
}

.reports-id a:hover { text-decoration: underline; }

.reports-reason {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

.reports-meta {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-left: auto;
}

/* ── Reports sub-tabs (Completeness / Accuracy / Timeliness) ───────── */

.reports-asof { font-style: italic; }

.dashboard-health-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.dashboard-health-link:hover { text-decoration: underline; }

#reports-subtabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.reports-subtab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: -1px;
}
.reports-subtab-btn:hover { color: var(--text-primary); }
.reports-subtab-btn.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

.reports-pane { display: none; flex-direction: column; gap: 24px; }
.reports-pane-active { display: flex; }

/* ── Chart blocks + chart⇄table toggle ────────────────────────────── */

.reports-chart-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reports-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.reports-chart-head .reports-subhead { margin-bottom: 0; }

.reports-chart-toggle { display: flex; gap: 4px; }
.reports-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 2px 10px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
}
.reports-toggle-btn.active {
    color: var(--accent-gold);
    border-color: var(--accent-gold-dim);
}

.reports-caption {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Funnel + stat tiles ───────────────────────────────────────────── */

.funnel { display: flex; flex-direction: column; gap: 2px; }
.funnel-conv {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    padding-left: 148px;
}

.reports-stat-tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.reports-stat-tile {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 14px;
    min-width: 84px;
    text-align: center;
}
.reports-stat-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.reports-stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.reports-stat-bad .reports-stat-value { color: var(--prob-low); }
.reports-stat-warn .reports-stat-value { color: var(--prob-med); }

/* ── Horizontal magnitude bars ─────────────────────────────────────── */

.bar-list { display: flex; flex-direction: column; gap: 6px; }
.bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 52px;
    align-items: center;
    gap: 10px;
}
.bar-row-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-row-label-cat { display: flex; align-items: center; gap: 6px; }
.cat-swatch {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
}
.bar-row-track {
    background: var(--glass-bg);
    border-radius: 3px;
    height: 12px;
    overflow: hidden;
}
.bar-row-fill { height: 100%; border-radius: 3px; }
.bar-row-fill-muted { opacity: 0.5; }
.bar-row-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
    text-align: right;
}
.bar-row-zero {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--prob-high);
    grid-column: 2 / 4;
}

/* ── Vertical columns (close year) ─────────────────────────────────── */

.year-cols {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    overflow-x: auto;
    padding-top: 8px;
}
.year-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 34px;
}
.year-col-count {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-primary);
}
.year-col-track {
    height: 100px;
    width: 26px;
    display: flex;
    align-items: flex-end;
    background: var(--glass-bg);
    border-radius: 3px;
    overflow: hidden;
}
.year-col-fill { width: 100%; background: var(--accent-blue); }
.year-col-fill-muted { background: var(--text-muted); }
.year-col-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
}

/* ── Coverage heatmap ──────────────────────────────────────────────── */

.coverage-heatmap td.coverage-cell {
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Score meters + sparklines (Accuracy) ──────────────────────────── */

.score-meter-list { display: flex; flex-direction: column; gap: 8px; }
.score-meter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.score-meter-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    width: 110px;
    flex-shrink: 0;
}
.score-meter-track {
    flex: 1;
    min-width: 80px;
    background: var(--glass-bg);
    border-radius: 3px;
    height: 12px;
    overflow: hidden;
}
.score-meter-fill { height: 100%; border-radius: 3px; }
.score-meter-fill.quality-score-good { background: var(--prob-high); }
.score-meter-fill.quality-score-warn { background: var(--prob-med); }
.score-meter-fill.quality-score-bad { background: var(--prob-low); }
.score-meter-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    width: 40px;
    text-align: right;
}
.score-meter-n {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    width: 44px;
}
.score-meter-missing {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.score-sparkline { flex-shrink: 0; }
.spark-line { fill: none; stroke: var(--accent-blue); stroke-width: 1.4; }
.spark-ref { stroke: var(--border-medium); stroke-dasharray: 2 2; stroke-width: 1; }
.spark-dot { fill: var(--accent-blue); }
.spark-dot-last { fill: var(--accent-gold); }

.reports-accuracy-meta { margin-top: -8px; }
.reports-missing { color: var(--prob-low); }

/* ── Judge radar ───────────────────────────────────────────────────── */

.judge-radar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.judge-radar-svg {
    width: 100%;
    max-width: 560px;
    height: auto;
    overflow: visible;
}

.judge-radar-ring {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 1;
}

/* 3.0 is the threshold the table flags with "!" — dashed so it reads as a
   reference, not as another gridline. */
.judge-radar-ring-warn {
    stroke: var(--border-medium);
    stroke-dasharray: 3 3;
}

.judge-radar-spoke {
    stroke: var(--border-subtle);
    stroke-width: 1;
}

.judge-radar-tick,
.judge-radar-axis-label {
    font-family: var(--font-mono);
    fill: var(--text-muted);
}

.judge-radar-tick { font-size: 9px; }
.judge-radar-axis-label { font-size: 10px; letter-spacing: 0.5px; }

.judge-radar-line {
    fill: none;               /* ragged axes — area would be meaningless */
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* Surface ring so overlapping dots stay countable. */
.judge-radar-dot {
    stroke: var(--bg-primary);
    stroke-width: 2;
}

.judge-radar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    margin-top: 4px;
}

.judge-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.judge-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.judge-legend-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* ── Timeliness: age-bucket bars + legend ──────────────────────────── */

.age-dist { display: flex; flex-direction: column; gap: 12px; }

.age-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.age-legend-item { display: flex; align-items: center; gap: 5px; }
.age-legend-swatch { width: 12px; height: 12px; border-radius: 2px; }
.age-legend-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
}
.age-legend-note {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.age-row { display: flex; flex-direction: column; gap: 4px; }
.age-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.age-row-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}
.age-row-caption {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}
.age-abs-caption {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.age-bar {
    display: flex;
    gap: 2px;
    height: 14px;
    width: 100%;
    border-radius: 3px;
    overflow: hidden;
}
.age-seg-cell { height: 100%; min-width: 1px; }
.age-seg { background: var(--accent-blue); }
.age-seg-warn { background: var(--prob-med); }
.age-seg-bad { background: var(--prob-low); }
.age-seg-unknown { background: var(--text-muted); }

@media (max-width: 900px) {
    .entity-matrix { grid-template-columns: 1fr; }
    .failing-checks-grid { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 100px 1fr 44px; }
    .funnel-conv { padding-left: 108px; }
    .score-meter-label { width: 78px; }
}

/* ── Responsive breakpoints ──────────────────────────── */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
    }

    header {
        padding: 10px 16px;
        gap: 12px;
    }

    header h1 {
        font-size: 16px;
        letter-spacing: 3px;
    }

    #category-filters {
        gap: 8px;
    }

    .filter {
        font-size: 10px;
    }

    #prob-legend {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    header {
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    .header-brand {
        width: 100%;
        justify-content: center;
    }

    #categories {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        justify-content: center;
        width: 100%;
    }

    #category-filters {
        justify-content: center;
    }

    #prob-legend {
        display: none;
    }

    #country-events-popup {
        width: calc(100% - 32px);
    }

    #details-content {
        padding: 18px;
    }
}

/* ── Factors tab ─────────────────────────────────────── */

#tab-factors {
    overflow-y: auto;
}

#factors-container {
    padding: 1.5rem 2rem 3rem;
    max-width: 1100px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.85);
}

.factors-header-block {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--accent-gold-dim);
    padding-bottom: 1rem;
}

.factors-title {
    font-family: var(--font-display);
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}

.factors-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
}

.factors-loading,
.factors-empty,
.factors-error {
    padding: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-mono);
}

.factors-error {
    color: var(--prob-low);
}

.factors-kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.factors-kpi {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.factors-kpi .kpi-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
}

.factors-kpi .kpi-value {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--accent-gold);
}

.factors-section {
    margin: 1.5rem 0;
}

.factors-section-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--accent-gold);
    margin: 0 0 0.75rem;
    text-transform: uppercase;
}

.factors-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.factors-leaderboard-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 0.6rem 1rem;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.factors-leaderboard-row:hover {
    border-color: var(--accent-gold-dim);
    background: rgba(201, 168, 76, 0.04);
}

.factors-row-rank {
    font-family: var(--font-mono);
    color: var(--accent-gold);
    font-size: 0.9rem;
}

.factors-row-name {
    font-family: var(--font-display);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.factors-row-meta {
    display: flex;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.factors-row-category {
    color: rgba(255, 255, 255, 0.7);
}

.factors-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.factors-table th,
.factors-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.factors-table th {
    color: var(--accent-gold);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

.factors-table td.num,
.factors-table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.factors-detail-host {
    background: var(--bg-card);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    min-height: 4rem;
}

.factors-detail-empty {
    color: rgba(255, 255, 255, 0.45);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.factors-detail-header {
    margin-bottom: 0.5rem;
}

.factors-detail-title {
    font-family: var(--font-display);
    color: var(--accent-gold);
    font-size: 1.15rem;
    margin: 0 0 0.4rem;
}

.factors-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.factors-detail-pill {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.75);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.factors-detail-desc {
    margin: 0.75rem 0;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.85);
}

.factors-subhead {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin: 1rem 0 0.4rem;
}

.factors-indicators {
    list-style: disc inside;
    padding: 0;
    margin: 0 0 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.factors-indicators li {
    margin: 0.2rem 0;
    color: rgba(255, 255, 255, 0.75);
}

.factors-indicators a {
    color: var(--accent-gold);
}

.factors-event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.factors-event-list li {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
}

.factors-event-link {
    background: none;
    border: none;
    color: var(--accent-gold);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-align: left;
}

.factors-event-link:hover {
    text-decoration: underline;
}

.factors-event-meta {
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .factors-kpi-strip {
        grid-template-columns: repeat(2, 1fr);
    }
    .factors-leaderboard-row {
        grid-template-columns: 60px 1fr;
    }
    .factors-row-meta {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

/* ── Event Details: causal factors section ────────────── */

#sidebar-factors {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.factors-header {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--accent-gold);
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

#sidebar-factors-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.factor-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid var(--accent-gold-dim);
    border-radius: 4px;
    padding: 0.7rem 0.9rem;
}

.factor-card-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 0.4rem;
}

.factor-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.factor-card-desc {
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
    margin: 0.45rem 0 0.5rem;
}

.factor-card-pill {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.72);
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.factor-card-pill-shared {
    background: rgba(39, 174, 96, 0.12);
    color: var(--prob-high);
}

.factor-card-indicators {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.factor-card-indicators a {
    color: var(--accent-gold);
}

/* ── Timeline tab (time-laid-out dependency graph) ─────── */

#tab-timeline { overflow: hidden; }              /* shell stays fixed */
#timeline-graph-root {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 1rem 1.25rem;
}

#timeline-kpi-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.tl-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    min-width: 92px;
}
.tl-kpi-warn { border-color: rgba(192, 57, 43, 0.6); }
.tl-kpi-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.tl-kpi-value { font-size: 1.15rem; color: var(--text-primary); font-weight: 600; }
.tl-kpi-warn .tl-kpi-value { color: var(--prob-low); }

#timeline-controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.tl-toggle { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; user-select: none; }
#timeline-legend { display: inline-flex; flex-wrap: wrap; gap: 0.85rem; margin-left: auto; font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); }
.tl-leg { display: inline-flex; align-items: center; gap: 0.35rem; }
.tl-leg-line { display: inline-block; width: 20px; height: 0; border-top-width: 2px; border-top-style: solid; }
.tl-leg-hard { border-top-color: #5a8fd4; }
.tl-leg-soft { border-top-color: rgba(255, 255, 255, 0.35); border-top-style: dashed; }
.tl-leg-viol { border-top-color: var(--prob-low); border-top-width: 3px; }
.tl-leg-met { border-top-color: var(--prob-high); }
.tl-leg-down { border-top-color: #22d3ee; }
.tl-leg-up { border-top-color: #ff5bd1; }
.tl-leg-hint { color: var(--text-muted); font-style: italic; }

#timeline-focus-bar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
#timeline-focus-bar.hidden { display: none; }
.tl-focus-back {
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.5);
    color: #9fe9f4;
    border-radius: 5px;
    padding: 0.28rem 0.65rem;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    transition: background 0.12s;
}
.tl-focus-back:hover { background: rgba(34, 211, 238, 0.22); }
.tl-focus-label { color: var(--text-secondary); }

#timeline-svg-wrap {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;                            /* x only engages via the safety valve */
    background: #070d16;
    border: 1px solid rgba(34, 211, 238, 0.18);
    border-radius: 8px;
}
/* Sized 1:1 in px by timeline.js so the wrap scrolls in whichever axis overflows. */
#timeline-svg { display: block; }

.tl-gridline { stroke: rgba(90, 143, 212, 0.12); stroke-width: 1; }
.tl-band-rule { stroke: rgba(120, 180, 210, 0.06); stroke-width: 1; }
.tl-axis-label { fill: #5f93b0; font-family: var(--font-mono); font-size: 12px; }
.tl-axis-hint { fill: #5f93b0; font-family: var(--font-mono); font-size: 11px; font-style: italic; }

/* Traces: three stacked strokes fake a neon glow without filters. Idle stays
   calm; hovering a chip lights its downstream (cyan) / upstream (magenta) and
   dims the rest. Coherence violations stay red, met preconditions green. */
.tl-trace { transition: opacity 0.15s; }
.tl-trace .tl-glow { fill: none; stroke-width: 7; opacity: 0; stroke-linecap: round; stroke-linejoin: round; }
.tl-trace .tl-mid  { fill: none; stroke-width: 3.2; opacity: 0; stroke-linecap: round; stroke-linejoin: round; }
.tl-trace .tl-core { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.tl-trace.is-soft .tl-core { stroke: #5c7686; stroke-dasharray: 6 6; opacity: 0.5; marker-end: url(#tlm-soft); }
.tl-trace.is-hard .tl-core { stroke: #5a8fd4; opacity: 0.78; marker-end: url(#tlm-hard); }
.tl-trace.is-met  .tl-core { stroke: #2fae6a; opacity: 0.85; marker-end: url(#tlm-met); }
.tl-trace.is-viol .tl-core { stroke: #e0524a; opacity: 0.95; stroke-width: 2.1; marker-end: url(#tlm-viol); }

.tl-trace.is-dim { opacity: 0.06; }
.tl-trace.is-down .tl-core { stroke: #22d3ee; opacity: 1; marker-end: url(#tlm-down); }
.tl-trace.is-down .tl-mid  { stroke: #22d3ee; opacity: 0.3; }
.tl-trace.is-down .tl-glow { stroke: #22d3ee; opacity: 0.16; }
.tl-trace.is-up .tl-core { stroke: #ff5bd1; opacity: 1; marker-end: url(#tlm-up); }
.tl-trace.is-up .tl-mid  { stroke: #ff5bd1; opacity: 0.3; }
.tl-trace.is-up .tl-glow { stroke: #ff5bd1; opacity: 0.16; }
.tl-trace.is-flow .tl-core { stroke-dasharray: 11 14; animation: tl-flow 1.05s linear infinite; }
@keyframes tl-flow { to { stroke-dashoffset: -50; } }

/* Chips (events) */
.tl-chip { cursor: pointer; }
.tl-chip-body { stroke-width: 2; transition: stroke 0.12s; }
.tl-chip-halo { fill: none; stroke: #eaffff; stroke-width: 2; opacity: 0; }
.tl-pin { stroke: #22d3ee; stroke-opacity: 0.7; stroke-width: 1; }
.tl-flag { pointer-events: none; }
.tl-chip-label { font-family: var(--font-mono); font-size: 11px; fill: #c2d4de; pointer-events: none; text-anchor: start; dominant-baseline: middle; }
.tl-chip.is-dim { opacity: 0.22; }
.tl-chip.is-focus .tl-chip-body { stroke: #eaffff; stroke-width: 2.6; }
.tl-chip.is-focus .tl-chip-label { fill: #eaffff; }
.tl-chip.is-focus .tl-chip-halo { opacity: 0.5; animation: tl-pulse 1.6s ease-in-out infinite; }
.tl-chip.nb-down .tl-chip-body { stroke: #22d3ee; }
.tl-chip.nb-up .tl-chip-body { stroke: #ff5bd1; }
@keyframes tl-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.5; } }

/* Shared-factor bus (optional layer) */
.tl-factor-link { fill: none; stroke: rgba(201, 168, 76, 0.22); stroke-width: 0.8; stroke-dasharray: 2 4; }
.tl-factor-node { fill: rgba(201, 168, 76, 0.45); stroke: #c9a84c; stroke-width: 1; }

#timeline-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 20;
    max-width: 260px;
    padding: 0.5rem 0.7rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-size: 0.78rem;
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.tl-tip-title { font-weight: 600; margin-bottom: 0.2rem; }
.tl-tip-meta { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-muted); }

#timeline-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ── Event Details: Connections section ────────────────── */

#sidebar-connections {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
#sidebar-connections-list { display: flex; flex-direction: column; gap: 0.9rem; }
.conn-group-title {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.conn-card {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    text-align: left;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid var(--accent-blue);
    border-radius: 4px;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    color: var(--text-primary);
    font: inherit;
}
.conn-card:hover { border-color: var(--accent-blue); background: rgba(90, 143, 212, 0.08); }
.conn-card.conn-soft { border-left-color: var(--accent-gold-dim); }
.conn-name { font-size: 0.85rem; line-height: 1.3; }
.conn-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.conn-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.35; }
.conn-pill {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}
.conn-pill-hard { background: rgba(90, 143, 212, 0.18); color: #8fb4e6; }
.conn-pill-met { background: rgba(39, 174, 96, 0.18); color: var(--prob-high); }
.conn-pill-failed { background: rgba(192, 57, 43, 0.18); color: var(--prob-low); }

/* ── Reduced motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   LIQUID GLASS RE-SKIN (WS3 · docs/SPEC_ui_liquid_glass.md §3)

   Translucent, blurred, softly-bordered floating surfaces over the ambient
   underlay. Applied via grouped selectors so no HTML changes are needed; these
   rules sit last so they override the flat --bg-surface / --bg-card panels above
   at equal specificity. Semantic colors (probability / category / trace hues)
   are deliberately untouched — this restyles SURFACES only. backdrop-filter is
   confined to chrome-level surfaces (never per-row items); fallbacks for engines
   without backdrop-filter and for prefers-reduced-transparency live at the end.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Header — strong glass so the brand + nav stay legible over any tab. */
header {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border-bottom: 1px solid var(--glass-border-soft);
    border-top: 2px solid var(--accent-gold-dim);   /* keep the gold brand accent line */
    box-shadow: var(--glass-shadow);
}

/* Tab nav — macOS segmented control: a glass capsule with a lighter inner pill
   for the active tab instead of the old gold underline. Gold text + tracking
   still read as a wordmark. */
#tab-nav {
    gap: 2px;
    padding: 4px 5px;
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-xl);
    background: rgba(0, 0, 0, 0.22);
    box-shadow: var(--glass-highlight);
}
.tab-btn {
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    padding: 7px 15px;
    opacity: 0.55;
    transition: opacity 0.18s, background 0.18s, color 0.18s;
}
.tab-btn:hover { opacity: 0.85; background: rgba(255, 255, 255, 0.06); }
.tab-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: var(--glass-highlight), 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Full-bleed chrome bars — glass, but keep them as bars (bottom border only). */
#map-tab-controls,
#timeline-panel,
#details-header,
#trade-toolbar {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border-bottom: 1px solid var(--glass-border-soft);
}

/* Floating popovers / tooltips — strong glass for legibility, fully rounded. */
.filters-combo-popover,
#country-events-popup,
#tooltip,
#timeline-tooltip {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-highlight), var(--glass-shadow);
}
.filters-combo-popover { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
#country-events-popup   { border-radius: var(--radius-lg); }
#tooltip, #timeline-tooltip { border-radius: var(--radius-md); }

/* Chrome tiles + control bars — glass, rounded. (KPI tiles, oracle panels,
   timeline controls: all short chrome above the scroll regions, never rows.) */
.oracle-kpi,
#oracle-dim-bar,
#oracle-filter-bar,
.tl-kpi,
#timeline-controls-bar,
#timeline-focus-bar,
.factors-kpi {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-highlight), var(--glass-shadow);
}
#oracle-detail-panel {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-highlight), var(--glass-shadow);
}
#timeline-controls-bar,
#timeline-focus-bar { padding: 0.5rem 0.85rem; }
.tl-kpi-warn { border-color: rgba(192, 57, 43, 0.6); }   /* re-assert the semantic warn border */

/* Timeline board — keep the dark solid backdrop (neon traces need contrast),
   just soften the frame and round it. */
#timeline-svg-wrap {
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-lg);
}

/* Translucent surfaces — repeated / boxed items get a plain translucent fill and
   a soft border, NO blur (a stack of blur layers is a compositing hazard). */
#sidebar-markets,
#sidebar-signals,
#sidebar-rules,
.factors-leaderboard-row,
.factors-detail-host,
.reports-table-block,
.entity-matrix-col,
.failing-check-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-md);
}
.reports-break {
    background: var(--glass-bg);
    border-color: var(--glass-border-soft);
    border-radius: var(--radius-md);
}
.reports-break-has-unexpected { border-color: rgba(192, 57, 43, 0.4); }  /* re-assert semantic */

/* Cards carrying a semantic left-accent border (blue = connection, gold = factor)
   — restyle fill + radius only, leaving the accent stripe intact. */
.factor-card,
.conn-card {
    background: var(--glass-bg);
    border-radius: var(--radius-md);
}

/* Buttons — soft pills, brighter on hover; colors stay (some are semantic). */
.details-back-btn,
.tl-focus-back,
.script-btn,
.filters-section-toggle,
.filters-combo-btn {
    border-radius: var(--radius-md);
}

/* Inputs — translucent inset fields. */
#event-search,
#oracle-search,
#year-filter,
.trade-input {
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-sm);
}

/* Scrollbars — thin translucent overlay style, matching macOS. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

/* Fallback 1 — engines without backdrop-filter: swap glass surfaces to an opaque
   fill so text stays legible (Firefox configs, older WebKit). */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    header,
    #map-tab-controls,
    #timeline-panel,
    #details-header,
    #trade-toolbar,
    .filters-combo-popover,
    #country-events-popup,
    #tooltip,
    #timeline-tooltip,
    .oracle-kpi,
    #oracle-dim-bar,
    #oracle-detail-panel,
    #oracle-filter-bar,
    .tl-kpi,
    #timeline-controls-bar,
    #timeline-focus-bar,
    .factors-kpi {
        background: var(--glass-bg-strong);
    }
}

/* Fallback 2 — user prefers reduced transparency: drop the blur and use the same
   opaque fill. (prefers-reduced-motion is handled above.) */
@media (prefers-reduced-transparency: reduce) {
    header,
    #map-tab-controls,
    #timeline-panel,
    #details-header,
    #trade-toolbar,
    .filters-combo-popover,
    #country-events-popup,
    #tooltip,
    #timeline-tooltip,
    .oracle-kpi,
    #oracle-dim-bar,
    #oracle-detail-panel,
    #oracle-filter-bar,
    .tl-kpi,
    #timeline-controls-bar,
    #timeline-focus-bar,
    .factors-kpi {
        background: var(--glass-bg-strong);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* Keep the segmented-control nav (now a wider capsule) inside the header at the
   narrow breakpoints — tighten the pills so all tabs stay on one line. */
@media (max-width: 1024px) {
    #tab-nav { margin-left: 12px; padding: 3px 4px; gap: 1px; }
    .tab-btn { padding: 6px 10px; font-size: 10px; letter-spacing: 1px; }
}
@media (max-width: 768px) {
    #tab-nav { margin-left: 0; }
}

/* ── News tab: the daily Dispatch (Liquid Glass, newspaper column) ─────────── */
#tab-news { overflow: auto; padding: 24px 16px 48px; }

#news-root {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* Date strip — restyled chip/badge pattern, horizontally scrollable */
.news-dates {
    display: flex;
    gap: 8px;
    max-width: 72ch;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.news-date-chip {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    padding: 6px 12px;
    border-radius: 999px;
    color: #d4c5a0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-soft);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.news-date-chip:hover { color: var(--accent-gold); }
.news-date-chip.active {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: var(--glass-highlight);
}

/* Reading pane — a glass card sized like a newspaper column */
.news-article {
    max-width: 72ch;
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow), var(--glass-highlight);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    padding: 36px 40px;
    font-family: var(--font-serif);
    color: #e6dcc4;
    line-height: 1.75;
}

.news-article .news-headline {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--accent-gold);
    margin: 0 0 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--accent-gold-dim);
}
.news-article h2 {
    font-family: var(--font-display);
    font-size: 15px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin: 30px 0 10px;
}
.news-article h3 {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 1px;
    color: #d4c5a0;
    margin: 22px 0 8px;
}
.news-article p { margin: 0 0 16px; }
.news-article .news-dek {
    font-size: 17px;
    color: #d4c5a0;
    opacity: 0.85;
    margin-bottom: 14px;
}
.news-article .news-provenance {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    color: #8a8266;
    opacity: 0.9;
    margin-bottom: 24px;
}
.news-article a { color: var(--accent-gold); text-decoration: none; border-bottom: 1px solid var(--accent-gold-dim); }
.news-article a:hover { border-bottom-color: var(--accent-gold); }
.news-article .news-event-link { cursor: pointer; }
.news-article ul, .news-article ol { margin: 0 0 16px; padding-left: 22px; }
.news-article li { margin-bottom: 6px; }
.news-article blockquote {
    margin: 0 0 16px;
    padding-left: 16px;
    border-left: 2px solid var(--accent-gold-dim);
    color: #d4c5a0;
    font-style: italic;
}
.news-article hr { border: none; border-top: 1px solid var(--glass-border-soft); margin: 28px 0; }
.news-article h2:first-child { margin-top: 0; }

.news-message {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #8a8266;
    text-align: center;
    padding: 40px 0;
}

/* Working-brief collapsible — the analyst view, one click from the reader view */
.news-brief-collapse {
    max-width: 72ch;
    width: 100%;
    font-family: var(--font-body);
}
.news-brief-collapse.hidden { display: none; }
.news-brief-collapse > summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 1px;
    color: #d4c5a0;
    padding: 10px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-soft);
    border-radius: 10px;
    list-style: none;
}
.news-brief-collapse > summary::-webkit-details-marker { display: none; }
.news-brief-collapse > summary:hover { color: var(--accent-gold); }
/* Edition masthead — headline/dek/provenance from the dispatch row (§3.1) */
.news-edition-head { max-width: 72ch; width: 100%; }
.news-edition-head .news-headline {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1.25;
    font-weight: 600;
    color: var(--accent-gold);
    margin: 0 0 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--accent-gold-dim);
}
.news-edition-head .news-dek {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.5;
    color: #d4c5a0;
    opacity: 0.85;
    margin: 0 0 8px;
}
.news-edition-head .news-provenance {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    color: #8a8266;
    margin: 0;
}

/* Component B — the edition flow map (SVG, §5) */
.news-flow-map { max-width: 72ch; width: 100%; }
.news-flow-map.hidden { display: none; }
.news-map-svg {
    display: block;
    width: 100%;
    height: auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-soft);
    border-radius: 14px;
}
.news-map-node { cursor: pointer; }
.news-map-rect {
    fill: rgba(255, 255, 255, 0.05);
    stroke: var(--glass-border-soft);
    transition: stroke 0.15s;
}
.news-map-node:hover .news-map-rect { stroke: var(--accent-gold); }
.news-map-node-title { fill: #e6dcc4; font-family: var(--font-display); font-size: 12px; font-weight: 600; }
.news-map-node-sub { fill: #8a8266; font-family: var(--font-mono); font-size: 10px; }
.news-map-edge { fill: none; opacity: 0.65; }
.news-map-edge.news-up { stroke: var(--news-up); }
.news-map-edge.news-down { stroke: var(--news-down); }
.news-map-edge.news-flat { stroke: var(--news-flat); stroke-dasharray: 5 4; }
.news-map-footer { fill: #8a8266; font-family: var(--font-mono); font-size: 10px; }

/* Component A — story chain cards (§4) */
.news-stories { max-width: 72ch; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.news-chain-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-soft);
    border-radius: 12px;
    padding: 14px 16px;
    scroll-margin-top: 80px;
}
.news-chain-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.news-chain-rank {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-gold);
    flex: 0 0 auto;
    width: 20px; height: 20px;
    border: 1px solid var(--accent-gold-dim);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.news-chain-headline { font-size: 15px; color: #e6dcc4; font-weight: 500; flex: 1 1 auto; }
.news-chain-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.news-chain-chip {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 999px;
    color: #d4c5a0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border-soft);
}
.news-chain-chip-warn { color: #e0a86a; border-color: rgba(224, 168, 106, 0.4); }

.news-chain-body {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) auto minmax(0, 1fr) auto minmax(0, 1.4fr);
    gap: 8px 10px;
    align-items: start;
    margin-top: 12px;
}
.news-chain-arrow { align-self: center; color: var(--text-muted); font-size: 16px; }
.news-chain-col { min-width: 0; }
.news-chain-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8a8266;
    margin-bottom: 6px;
}
.news-chain-sources .news-chain-chips { flex-direction: column; align-items: flex-start; gap: 4px; }
.news-chain-src-chip {
    font-family: var(--font-mono);
    font-size: 10px;
    color: #cfc4a8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border-soft);
    border-radius: 6px;
    padding: 2px 7px;
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.news-chain-src-chip:hover { color: var(--accent-gold); border-color: var(--accent-gold-dim); }
.news-chain-src-muted { color: #8a8266; }

.news-chain-factor-tile {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border-soft);
    border-radius: 8px;
    padding: 7px 9px;
    margin-bottom: 6px;
}
.news-chain-factor-name { font-size: 12px; color: #e6dcc4; }
.news-chain-move { font-family: var(--font-mono); font-size: 11px; margin-top: 3px; }
.news-chain-move.news-up { color: var(--news-up); }
.news-chain-move.news-down { color: var(--news-down); }
.news-chain-move.news-flat { color: var(--news-flat); }
.news-chain-corrob { font-family: var(--font-mono); font-size: 10px; margin-top: 3px; }
.news-corrob-agree { color: var(--accent-gold); }
.news-corrob-disagree { color: #e0a86a; }
.news-corrob-nodata { color: #8a8266; }

.news-chain-impact { margin-bottom: 10px; }
.news-chain-impact:last-child { margin-bottom: 0; }
.news-chain-impact-head { font-size: 12px; color: #cfc4a8; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.news-chain-impact-glyph { flex: 0 0 auto; font-size: 10px; }
.news-chain-impact.news-up .news-chain-impact-glyph { color: var(--news-up); }
.news-chain-impact.news-down .news-chain-impact-glyph { color: var(--news-down); }
.news-chain-impact.news-flat .news-chain-impact-glyph { color: var(--news-flat); }
.news-chain-impact .news-event-link {
    color: #d4c5a0;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.2);
    cursor: pointer;
}
.news-chain-impact .news-event-link:hover { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }
.news-chain-prob { font-family: var(--font-mono); font-size: 11px; color: #8a8266; }
.news-chain-trace { font-family: var(--font-mono); font-size: 10px; color: #9a8f70; margin-top: 3px; word-break: break-word; }
.news-chain-sub { font-size: 11px; color: #8a8266; margin-top: 3px; }

/* Shared signed pressure bar — solid = quantified, dashed = qualitative (§4/§6) */
.news-pbar { width: 100%; max-width: 170px; margin-top: 5px; }
.news-pbar-track {
    position: relative;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}
.news-pbar-track::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -1px;
    bottom: -1px;
    width: 1px;
    background: rgba(255, 255, 255, 0.22);
}
.news-pbar-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.news-pbar-fill.news-up { color: var(--news-up); background: var(--news-up); }
.news-pbar-fill.news-down { color: var(--news-down); background: var(--news-down); }
.news-pbar-fill.news-flat { color: var(--news-flat); background: var(--news-flat); }
.news-pbar-fill.news-pbar-dashed { background: transparent; border: 1px dashed; }

/* Event pressure ledger — the details-sidebar section (Component C, §6) */
#sidebar-news-section.hidden { display: none; }
.news-pressure-prov { font-family: var(--font-mono); font-size: 10px; color: #8a8266; margin-bottom: 10px; }
.news-pressure-row { margin-bottom: 12px; }
.news-pressure-head { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: #cfc4a8; }
.news-pressure-glyph { flex: 0 0 auto; font-size: 10px; }
.news-pressure-row.news-up .news-pressure-glyph { color: var(--news-up); }
.news-pressure-row.news-down .news-pressure-glyph { color: var(--news-down); }
.news-pressure-row.news-flat .news-pressure-glyph { color: var(--news-flat); }
.news-pressure-downstream { font-family: var(--font-mono); font-size: 11px; color: #8a8266; margin-top: 3px; }
.news-pressure-net { font-family: var(--font-mono); font-size: 11px; color: #d4c5a0; margin-top: 4px; }

@media (max-width: 640px) {
    .news-chain-body { grid-template-columns: 1fr; }
    .news-chain-arrow { display: none; }
    .news-chain-sources .news-chain-chips { flex-direction: row; }
}

@media (max-width: 768px) {
    .news-article { padding: 24px 20px; }
    .news-article .news-headline { font-size: 22px; }
    .news-edition-head .news-headline { font-size: 22px; }
}
