/* Sector Rotation Flow — page styles (sector-flow.html only) */

:root {
    --sf-border-soft: rgba(255, 255, 255, 0.07);
    --sf-border-gold: rgba(179, 161, 125, 0.30);
    --sf-card-bg: rgba(10, 14, 22, 0.72);
    --sf-muted: rgba(255, 255, 255, 0.45);
    --sf-pos-text: #4ade80;
    --sf-neg-text: #ff6b6b;
    --sf-amber: #f0b429;
    --sf-radius: 14px;
    --sf-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.03);

    /* Atlas heat ramp: diverging, two hues around a neutral gray midpoint.
       Stepped for luminance separation on the dark card surface (#0A0E16) and
       validated for adjacent-pair separation under normal and CVD vision. The
       brightest step on each arm is the page's own pos/neg text color, so the
       tape and the map speak the same language. Every cell also carries its
       number in a tooltip, a focus label, and the table view, so the ramp is
       never the only way to read a value. */
    --sf-tape-neg-3: #FF6B6B;
    --sf-tape-neg-2: #C23A3C;
    --sf-tape-neg-1: #7E2126;
    --sf-tape-zero:  #232833;
    --sf-tape-pos-1: #1E6B41;
    --sf-tape-pos-2: #2FA85E;
    --sf-tape-pos-3: #4ADE80;

    /* Matrix persistence ramp: sequential, one hue (brand gold), light to dark
       reading as low to high because the surface is dark. */
    --sf-matrix-0: rgba(255, 255, 255, 0.035);
    --sf-matrix-1: #443A26;
    --sf-matrix-2: #6E6040;
    --sf-matrix-3: #8F7D57;
    --sf-matrix-4: #B3A17D;
}

body { overflow-x: clip; background: var(--dark-bg); }

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(1100px 700px at -10% -10%, rgba(179, 161, 125, 0.14), transparent 55%),
                linear-gradient(160deg, rgba(5, 8, 16, 0.95) 25%, rgba(8, 12, 22, 0.99) 70%);
    pointer-events: none;
    z-index: -1;
}

/* ── Slim page header ─────────────────────────────────────────────── */

.sf-page-header { padding: 7rem 2rem 1.1rem; }

.sf-page-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.sf-page-title {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--light-text);
    margin: 0 0 0.25rem;
}

.sf-page-sub { font-size: 0.82rem; color: var(--gray-text); margin: 0; }

.sf-status-block {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding-bottom: 0.15rem;
}

.sf-market-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--sf-border-soft);
    color: var(--sf-muted);
    white-space: nowrap;
}

.sf-market-chip::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

.sf-market-chip[data-state="live"] {
    color: var(--sf-pos-text);
    border-color: rgba(74, 222, 128, 0.35);
}
.sf-market-chip[data-state="live"]::before {
    background: var(--sf-pos-text);
    animation: sf-live-pulse 2s ease-in-out infinite;
}
.sf-market-chip[data-state="stale"] {
    color: var(--sf-amber);
    border-color: rgba(240, 180, 41, 0.4);
}
.sf-market-chip[data-state="stale"]::before { background: var(--sf-amber); }
.sf-market-chip[data-state="closed"]::before { background: rgba(255, 255, 255, 0.3); }

@keyframes sf-live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.sf-updated { font-size: 0.72rem; color: var(--sf-muted); white-space: nowrap; }

/* ── Controls ─────────────────────────────────────────────────────── */

.sf-main { padding: 0 2rem 3rem; max-width: 1460px; margin: 0 auto; }

.sf-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.sf-tf-bar {
    display: inline-flex;
    gap: 0.3rem;
    padding: 0.25rem;
    border: 1px solid var(--sf-border-soft);
    border-radius: 10px;
    background: rgba(8, 12, 20, 0.6);
}

.sf-tf-btn {
    appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--sf-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.42rem 0.9rem;
    min-height: 32px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.sf-tf-btn:hover { color: var(--light-text); background: rgba(255, 255, 255, 0.04); }
.sf-tf-btn:active { transform: scale(0.96); }

.sf-tf-btn.sf-tf-active {
    color: var(--secondary-gold);
    background: rgba(179, 161, 125, 0.12);
    border-color: var(--sf-border-gold);
}

.sf-tf-btn:focus-visible,
.sf-flow-item:focus-visible,
.sf-rank-item:focus-visible {
    outline: 2px solid var(--secondary-gold);
    outline-offset: 2px;
}

.sf-state-note {
    font-size: 0.74rem;
    color: var(--sf-amber);
    margin: 0;
    min-height: 1em;
    text-align: right;
    flex: 1;
}

/* ── Layout ───────────────────────────────────────────────────────── */

.sf-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 1.1rem;
    align-items: start;
}

.sf-layout > * { min-width: 0; }

.sf-map-panel {
    background: var(--sf-card-bg);
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    padding: 0.9rem;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.sf-map-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#sf-map { display: block; width: 100%; height: auto; }

.sf-map-hint {
    font-size: 0.7rem;
    color: var(--sf-muted);
    margin: 0.6rem 0.2rem 0;
    line-height: 1.5;
}

/* ── SVG nodes ────────────────────────────────────────────────────── */

.sf-node { cursor: pointer; outline: none; }

.sf-node-box {
    fill: rgba(32, 38, 56, 0.96);
    stroke: rgba(255, 255, 255, 0.16);
    stroke-width: 1;
    transition: stroke 0.15s ease, fill 0.15s ease;
}

/* Inflow tiers (green intensity scales with heat) */
.sf-heat-pos-1 .sf-node-box { fill: rgba(34, 197, 94, 0.16); stroke: rgba(74, 222, 128, 0.45); }
.sf-heat-pos-2 .sf-node-box { fill: rgba(34, 197, 94, 0.24); stroke: rgba(74, 222, 128, 0.62); }
.sf-heat-pos-3 .sf-node-box { fill: rgba(34, 197, 94, 0.34); stroke: rgba(74, 222, 128, 0.85); }

/* Outflow tiers (red intensity scales with heat) */
.sf-heat-neg-1 .sf-node-box { fill: rgba(255, 59, 59, 0.16); stroke: rgba(255, 107, 107, 0.45); }
.sf-heat-neg-2 .sf-node-box { fill: rgba(255, 59, 59, 0.24); stroke: rgba(255, 107, 107, 0.62); }
.sf-heat-neg-3 .sf-node-box { fill: rgba(255, 59, 59, 0.34); stroke: rgba(255, 107, 107, 0.85); }

.sf-node-selected .sf-node-box,
.sf-node:focus-visible .sf-node-box,
.sf-node:hover .sf-node-box { stroke: var(--primary-gold); stroke-width: 1.6; }

.sf-node-etf { fill: var(--light-text); font-size: 17px; font-weight: 800; letter-spacing: 0.02em; }
.sf-node-heat { fill: rgba(255, 255, 255, 0.6); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sf-heat-pos-1 .sf-node-heat, .sf-heat-pos-2 .sf-node-heat, .sf-heat-pos-3 .sf-node-heat { fill: var(--sf-pos-text); }
.sf-heat-neg-1 .sf-node-heat, .sf-heat-neg-2 .sf-node-heat, .sf-heat-neg-3 .sf-node-heat { fill: var(--sf-neg-text); }
.sf-node-name { fill: rgba(255, 255, 255, 0.78); font-size: 10.5px; }
.sf-node-rel { fill: rgba(255, 255, 255, 0.94); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sf-node-conf { fill: rgba(255, 255, 255, 0.66); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* ── SVG edges ────────────────────────────────────────────────────── */

.sf-edge {
    stroke: rgba(201, 176, 55, 0.75);
    stroke-linecap: round;
    outline: none;
    cursor: help;
    transition: stroke 0.15s ease;
}

.sf-edge:hover, .sf-edge:focus-visible { stroke: var(--secondary-gold); opacity: 1 !important; }

.sf-arrowhead { stroke: rgba(201, 176, 55, 0.85); }

/* Flow layer: a steady stream of dots drifting from source to target.
   Visible only while the map is in its animated (live) state. */
.sf-edge-flow {
    stroke: var(--secondary-gold);
    stroke-linecap: round;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sf-edges-animated .sf-edge-flow {
    opacity: 0.95;
    stroke-dasharray: 6 14;
    animation: sf-edge-flow 1.6s linear infinite;
}

@keyframes sf-edge-flow {
    to { stroke-dashoffset: -20; }
}

/* ── Tooltip + overlay ────────────────────────────────────────────── */

.sf-tooltip {
    position: absolute;
    max-width: 280px;
    background: rgba(8, 12, 20, 0.96);
    border: 1px solid var(--sf-border-gold);
    border-radius: 8px;
    color: var(--light-text);
    font-size: 0.72rem;
    line-height: 1.45;
    padding: 0.45rem 0.6rem;
    pointer-events: none;
    z-index: 5;
}

.sf-overlay[hidden] { display: none; }

.sf-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 11, 15, 0.72);
    border-radius: 10px;
    z-index: 4;
}

.sf-overlay-box { text-align: center; max-width: 420px; padding: 1rem; }
.sf-overlay-title { color: var(--light-text); font-size: 0.9rem; font-weight: 700; margin: 0 0 0.35rem; }
.sf-overlay-message { color: var(--sf-muted); font-size: 0.76rem; line-height: 1.5; margin: 0; }

/* ── Side panels ──────────────────────────────────────────────────── */

.sf-side { display: flex; flex-direction: column; gap: 1.1rem; }

.sf-side-card {
    background: var(--sf-card-bg);
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    padding: 0.9rem 1rem;
}

.sf-side-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-gold);
    margin: 0 0 0.6rem;
}

.sf-flow-list, .sf-rank-list, .sf-mobile-edge-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sf-flow-item, .sf-rank-item {
    width: 100%;
    display: grid;
    align-items: center;
    gap: 0.5rem;
    background: rgba(26, 31, 46, 0.5);
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 0.45rem 0.6rem;
    min-height: 44px;
    color: var(--light-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sf-flow-item { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.sf-flow-item:hover, .sf-rank-item:hover {
    border-color: var(--sf-border-gold);
    background: rgba(26, 31, 46, 0.75);
}

.sf-flow-name, .sf-rank-name {
    font-size: 0.78rem;
    font-weight: 600;
    overflow: clip;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sf-flow-etf, .sf-rank-etf { font-size: 0.68rem; color: var(--sf-muted); font-weight: 700; }
.sf-flow-rel, .sf-rank-rel { font-size: 0.72rem; color: rgba(255, 255, 255, 0.72); font-variant-numeric: tabular-nums; }

.sf-badge {
    display: inline-block;
    min-width: 2.4em;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    padding: 0.18rem 0.4rem;
    border-radius: 6px;
    border: 1px solid var(--sf-border-soft);
    color: var(--sf-muted);
}

.sf-badge.sf-heat-pos-1 { color: var(--sf-pos-text); border-color: rgba(74, 222, 128, 0.30); background: rgba(34, 197, 94, 0.10); }
.sf-badge.sf-heat-pos-2 { color: var(--sf-pos-text); border-color: rgba(74, 222, 128, 0.48); background: rgba(34, 197, 94, 0.17); }
.sf-badge.sf-heat-pos-3 { color: var(--sf-pos-text); border-color: rgba(74, 222, 128, 0.70); background: rgba(34, 197, 94, 0.26); }
.sf-badge.sf-heat-neg-1 { color: var(--sf-neg-text); border-color: rgba(255, 107, 107, 0.30); background: rgba(255, 59, 59, 0.10); }
.sf-badge.sf-heat-neg-2 { color: var(--sf-neg-text); border-color: rgba(255, 107, 107, 0.48); background: rgba(255, 59, 59, 0.17); }
.sf-badge.sf-heat-neg-3 { color: var(--sf-neg-text); border-color: rgba(255, 107, 107, 0.70); background: rgba(255, 59, 59, 0.26); }

.sf-empty-item { font-size: 0.74rem; color: var(--sf-muted); padding: 0.4rem 0.2rem; }

.sf-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: clip;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Detail panel ─────────────────────────────────────────────────── */

.sf-detail-hint { font-size: 0.74rem; color: var(--sf-muted); line-height: 1.5; margin: 0; }

.sf-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.sf-detail-title { font-size: 0.84rem; font-weight: 700; color: var(--light-text); }

.sf-detail-grid { display: flex; flex-direction: column; }

.sf-detail-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.sf-detail-label { font-size: 0.7rem; color: var(--sf-muted); }
.sf-detail-value { font-size: 0.76rem; color: var(--light-text); font-variant-numeric: tabular-nums; text-align: right; }

/* ── Mobile blocks (hidden on desktop) ────────────────────────────── */

.sf-mobile { display: none; }

.sf-rank-item { grid-template-columns: 1.4em minmax(0, 1fr) auto auto auto; }
.sf-rank-num { font-size: 0.68rem; color: var(--sf-muted); font-variant-numeric: tabular-nums; }
.sf-rank-selected { border-color: var(--sf-border-gold); background: rgba(179, 161, 125, 0.08); }

.sf-mobile-edge {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    background: rgba(26, 31, 46, 0.5);
    border-radius: 9px;
    padding: 0.55rem 0.65rem;
    min-height: 44px;
    justify-content: center;
}

.sf-mobile-edge-route { font-size: 0.78rem; font-weight: 600; color: var(--light-text); }
.sf-mobile-edge-meta { font-size: 0.68rem; color: var(--sf-muted); font-variant-numeric: tabular-nums; }

/* ── Methodology + disclosure ─────────────────────────────────────── */

.sf-method {
    margin-top: 1.4rem;
    background: var(--sf-card-bg);
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    padding: 1rem 1.2rem 1.1rem;
}

.sf-method p { font-size: 0.76rem; line-height: 1.65; color: var(--gray-text); margin: 0 0 0.7rem; }
.sf-method p:last-child { margin-bottom: 0; }

.sf-disclosure {
    color: rgba(255, 255, 255, 0.78) !important;
    border-left: 2px solid var(--primary-gold);
    padding-left: 0.8rem;
}

.sf-method-links a { color: var(--secondary-gold); text-decoration: underline; }

/* ── Rotation Atlas ───────────────────────────────────────────────── */

.sf-atlas[hidden] { display: none; }

.sf-atlas {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.sf-atlas-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.sf-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    color: var(--sf-muted);
    cursor: pointer;
    user-select: none;
}

.sf-check input { accent-color: var(--primary-gold); width: 15px; height: 15px; }
.sf-check:hover { color: var(--secondary-gold); }

.sf-atlas-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.6rem;
}

.sf-atlas-chip {
    background: var(--sf-card-bg);
    border: 1px solid var(--sf-border-soft);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.sf-atlas-chip-label {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sf-muted);
}

.sf-atlas-chip-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--light-text);
    font-variant-numeric: tabular-nums;
}

.sf-atlas-card {
    background: var(--sf-card-bg);
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    box-shadow: var(--sf-shadow);
    padding: 1rem 1.2rem 1.1rem;
    min-width: 0;
}

.sf-atlas-head { margin-bottom: 0.8rem; }

.sf-atlas-hint {
    font-size: 0.7rem;
    line-height: 1.55;
    color: var(--sf-muted);
    margin: 0.3rem 0 0;
    max-width: 76ch;
}

.sf-atlas-note {
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--gray-text);
    margin: 0.7rem 0 0;
    font-variant-numeric: tabular-nums;
}

.sf-atlas-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.1rem;
    align-items: start;
}

/* Wide grids scroll inside their own container, never the page. */
.sf-tape-wrap, .sf-matrix-wrap {
    position: relative;
    overflow-x: auto;
    overflow-y: clip;
}

.sf-tape-wrap svg, .sf-matrix-wrap svg { display: block; width: 100%; height: auto; min-width: 640px; }

/* The matrix is a small fixed grid. Letting it stretch to a wide column scales
   its 9.5px labels past the label gutter, so cap it near its natural size. */
.sf-matrix-wrap svg { min-width: 420px; max-width: 560px; }

/* ── Tape marks ───────────────────────────────────────────────────── */

.sf-tape-label {
    font-size: 10.5px;
    font-weight: 600;
    fill: var(--gray-text);
    cursor: pointer;
    transition: fill 0.18s ease;
}

.sf-tape-label:hover { fill: var(--secondary-gold); }
.sf-tape-row-selected .sf-tape-label { fill: var(--secondary-gold); }
.sf-tape-label:focus-visible { outline: 1px solid var(--primary-gold); outline-offset: 2px; }

.sf-tape-cell { shape-rendering: crispEdges; }
.sf-tape-cell:hover { stroke: rgba(255, 255, 255, 0.55); stroke-width: 1; }

.sf-tape-neutral { fill: var(--sf-tape-zero); }
.sf-tape-pos-1 { fill: var(--sf-tape-pos-1); }
.sf-tape-pos-2 { fill: var(--sf-tape-pos-2); }
.sf-tape-pos-3 { fill: var(--sf-tape-pos-3); }
.sf-tape-neg-1 { fill: var(--sf-tape-neg-1); }
.sf-tape-neg-2 { fill: var(--sf-tape-neg-2); }
.sf-tape-neg-3 { fill: var(--sf-tape-neg-3); }
.sf-tape-gap { fill: rgba(255, 255, 255, 0.04); }

/* A degraded capture is hatched, so a data-quality problem is visible in the
   tape itself rather than only in a tooltip. */
.sf-tape-degraded { opacity: 0.55; }

.sf-tape-row-frame { stroke: var(--secondary-gold); stroke-width: 1.4; }

.sf-tape-axis-tick { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; }
.sf-tape-axis-label { font-size: 9.5px; fill: var(--sf-muted); text-anchor: middle; font-variant-numeric: tabular-nums; }

.sf-regime-bar { fill: rgba(179, 161, 125, 0.62); }
.sf-regime-bar:hover { fill: var(--secondary-gold); }
.sf-regime-baseline { stroke: rgba(255, 255, 255, 0.14); stroke-width: 1; }
.sf-regime-caption, .sf-tf-lane-label {
    font-size: 9.5px;
    fill: var(--sf-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Alert marks are annotation, so they wear the brand accent, never a heat
   color. A surface-colored ring keeps adjacent marks separable. */
.sf-tape-mark-pin {
    fill: var(--secondary-gold);
    stroke: var(--dark-bg);
    stroke-width: 2;
    paint-order: stroke;
}

.sf-tape-mark-stem { stroke: rgba(226, 207, 181, 0.28); stroke-width: 1; stroke-dasharray: 2 3; }
.sf-tape-mark-broad .sf-tape-mark-pin { fill: none; stroke: var(--secondary-gold); stroke-width: 1.6; }
.sf-tape-mark:focus-visible { outline: 1px solid var(--primary-gold); outline-offset: 2px; }
.sf-tape-mark:hover .sf-tape-mark-stem { stroke: rgba(226, 207, 181, 0.6); }

/* ── Legends ──────────────────────────────────────────────────────── */

.sf-legend { margin-top: 0.7rem; }

.sf-legend-scale {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.sf-legend-swatch {
    width: 26px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

.sf-legend-end {
    font-size: 0.62rem;
    color: var(--sf-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0 0.4rem;
}

.sf-legend-swatch.sf-tape-neutral { background: var(--sf-tape-zero); }
.sf-legend-swatch.sf-tape-pos-1 { background: var(--sf-tape-pos-1); }
.sf-legend-swatch.sf-tape-pos-2 { background: var(--sf-tape-pos-2); }
.sf-legend-swatch.sf-tape-pos-3 { background: var(--sf-tape-pos-3); }
.sf-legend-swatch.sf-tape-neg-1 { background: var(--sf-tape-neg-1); }
.sf-legend-swatch.sf-tape-neg-2 { background: var(--sf-tape-neg-2); }
.sf-legend-swatch.sf-tape-neg-3 { background: var(--sf-tape-neg-3); }
.sf-legend-swatch.sf-matrix-step-1 { background: var(--sf-matrix-1); }
.sf-legend-swatch.sf-matrix-step-2 { background: var(--sf-matrix-2); }
.sf-legend-swatch.sf-matrix-step-3 { background: var(--sf-matrix-3); }
.sf-legend-swatch.sf-matrix-step-4 { background: var(--sf-matrix-4); }

/* ── Matrix ───────────────────────────────────────────────────────── */

.sf-matrix-cell { transition: none; }
.sf-matrix-step-0 { fill: var(--sf-matrix-0); }
.sf-matrix-step-1 { fill: var(--sf-matrix-1); }
.sf-matrix-step-2 { fill: var(--sf-matrix-2); }
.sf-matrix-step-3 { fill: var(--sf-matrix-3); }
.sf-matrix-step-4 { fill: var(--sf-matrix-4); }
.sf-matrix-cell:hover { stroke: var(--secondary-gold); stroke-width: 1.2; }
.sf-matrix-cell:focus-visible { outline: 1px solid var(--primary-gold); outline-offset: 1px; }
.sf-matrix-diagonal { fill: rgba(255, 255, 255, 0.02); }

.sf-matrix-head {
    font-size: 9.5px;
    font-weight: 700;
    fill: var(--sf-muted);
    text-anchor: middle;
    letter-spacing: 0.03em;
}

.sf-matrix-head-active { fill: var(--secondary-gold); }
/* Only the two lightest steps get a direct label, so the ink is always dark. */
.sf-matrix-value { font-size: 9px; fill: rgba(8, 11, 15, 0.85); text-anchor: middle; font-weight: 700; }
.sf-matrix-axis-note { font-size: 9px; fill: var(--sf-muted); letter-spacing: 0.04em; }

/* ── Pair list ────────────────────────────────────────────────────── */

.sf-pair-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sf-pair-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--sf-border-soft);
    border-radius: 10px;
}

.sf-pair-route { font-size: 0.78rem; font-weight: 600; color: var(--light-text); }
.sf-pair-meta { font-size: 0.66rem; color: var(--sf-muted); font-variant-numeric: tabular-nums; }

/* ── Agreement strip ──────────────────────────────────────────────── */

.sf-tf-agree { fill: rgba(255, 255, 255, 0.10); }
.sf-tf-agree-full { fill: rgba(179, 161, 125, 0.65); }
.sf-tf-agree:hover { fill: var(--secondary-gold); }

/* ── Table view ───────────────────────────────────────────────────── */

.sf-table-details { margin-top: 0.9rem; }

.sf-table-details summary {
    font-size: 0.7rem;
    color: var(--sf-muted);
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sf-table-details summary:hover { color: var(--secondary-gold); }
.sf-table-details > div { overflow-x: auto; margin-top: 0.7rem; }

.sf-atlas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.sf-atlas-table caption {
    text-align: left;
    color: var(--sf-muted);
    font-size: 0.66rem;
    padding-bottom: 0.5rem;
}

.sf-atlas-table th, .sf-atlas-table td {
    padding: 0.4rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid var(--sf-border-soft);
    white-space: nowrap;
}

.sf-atlas-table thead th { color: var(--sf-muted); font-weight: 600; font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; }
.sf-atlas-table tbody th { text-align: left; color: var(--light-text); font-weight: 600; }
.sf-atlas-table td { color: var(--gray-text); }

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

@media (max-width: 1080px) {
    .sf-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .sf-atlas-grid { grid-template-columns: minmax(0, 1fr); }
    .sf-atlas-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .sf-page-header { padding: 6.25rem 1rem 0.9rem; }
    .sf-main { padding: 0 1rem 2.5rem; }
    .sf-layout { display: none; }
    .sf-mobile { display: flex; flex-direction: column; gap: 1.1rem; }
    .sf-controls { flex-direction: column; align-items: stretch; }
    .sf-tf-bar { display: flex; }
    .sf-tf-btn { flex: 1; min-height: 44px; }
    .sf-state-note { text-align: left; }
    .sf-status-block { padding-bottom: 0; flex-wrap: wrap; }
    .sf-atlas-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sf-atlas-card { padding: 0.9rem 0.9rem 1rem; }
    .sf-atlas-bar { flex-direction: column; align-items: stretch; }
    /* The tape stays scrollable rather than shrinking rows below a legible
       height; the label column narrows to give the grid more room. */
    .sf-tape-wrap svg { min-width: 720px; }
}

/* ── Motion ───────────────────────────────────────────────────────── */

@keyframes sf-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes sf-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Entrance choreography: starts when the auth gate lifts, plays once. */
html:not(.bcs-auth-pending) .sf-page-header-row { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
html:not(.bcs-auth-pending) .sf-controls { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.06s backwards; }
html:not(.bcs-auth-pending) .sf-map-panel { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.12s backwards; }
html:not(.bcs-auth-pending) .sf-side-card:nth-child(1) { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.16s backwards; }
html:not(.bcs-auth-pending) .sf-side-card:nth-child(2) { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards; }
html:not(.bcs-auth-pending) .sf-side-card:nth-child(3) { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.24s backwards; }
html:not(.bcs-auth-pending) .sf-mobile > * { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.12s backwards; }
html:not(.bcs-auth-pending) .sf-method { animation: sf-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.28s backwards; }

/* Atlas cards fade in when the view is switched on, not on every repaint. */
.sf-atlas-enter > * { animation: sf-fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.sf-atlas-enter > *:nth-child(2) { animation-delay: 0.05s; }
.sf-atlas-enter > *:nth-child(3) { animation-delay: 0.1s; }
.sf-atlas-enter > *:nth-child(4) { animation-delay: 0.15s; }
.sf-atlas-enter > *:nth-child(5) { animation-delay: 0.2s; }

/* Data-arrival motion: applied by render only on first load and timeframe
   switch (never on background polls). Per-item delay is set inline. */
.sf-enter { animation: sf-fade-up 0.35s ease-out backwards; }
.sf-node-enter { animation: sf-fade 0.4s ease-out backwards; }
.sf-edge-layer-enter { animation: sf-fade 0.5s ease-out 0.35s backwards; }

/* Selection crossfade on the detail panel. */
.sf-detail-anim { animation: sf-fade-up 0.22s ease-out; }

/* Tooltip fade on reveal (mousemove repositions without retriggering). */
.sf-tooltip:not([hidden]) { animation: sf-fade 0.15s ease-out; }

/* Overlay fade on state change (loading / empty / error). */
.sf-overlay:not([hidden]) { animation: sf-fade 0.25s ease-out; }

/* Fresh-snapshot blip on the timestamp. */
@keyframes sf-updated-blip {
    0% { color: var(--secondary-gold); }
    100% { color: var(--sf-muted); }
}

.sf-updated-blip { animation: sf-updated-blip 1.4s ease-out; }

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

@media (prefers-reduced-motion: reduce) {
    .sf-edges-animated .sf-edge-flow { animation: none; opacity: 0; }
    .sf-market-chip[data-state="live"]::before { animation: none; }
    .sf-tf-btn, .sf-flow-item, .sf-rank-item, .sf-node-box { transition: none; }
    html:not(.bcs-auth-pending) .sf-page-header-row,
    html:not(.bcs-auth-pending) .sf-controls,
    html:not(.bcs-auth-pending) .sf-map-panel,
    html:not(.bcs-auth-pending) .sf-side-card,
    html:not(.bcs-auth-pending) .sf-mobile > *,
    html:not(.bcs-auth-pending) .sf-method,
    .sf-enter, .sf-node-enter, .sf-edge-layer-enter,
    .sf-detail-anim, .sf-tooltip:not([hidden]), .sf-overlay:not([hidden]),
    .sf-atlas-enter > *,
    .sf-updated-blip { animation: none; }
    .sf-tape-label, .sf-check, .sf-matrix-cell { transition: none; }
}

/* ── Constituents: which company moved the sector ──────────────────
   Sits under the sector detail panel. Five columns on one grid so the
   symbol, weight, move, bar, and contribution line up across rows. The
   bar restates the contribution number beside it; it is never the only
   way to read a row. */

.sf-constituents:empty { display: none; }

.sf-constituents {
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sf-con-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.sf-con-title {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--secondary-gold);
}

.sf-con-basis {
    font-size: 0.62rem;
    color: var(--sf-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* rem, not em: the legend sits at a smaller font-size than the rows, so em
   columns would resolve to different widths and the header would not line up
   with the data underneath it. */
.sf-con-legend,
.sf-con-row {
    display: grid;
    grid-template-columns: 3.1rem 2.3rem 3.2rem minmax(0, 1fr) 3.4rem;
    align-items: center;
    gap: 0.4rem;
}

.sf-con-legend {
    font-size: 0.55rem;
    text-align: left;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sf-con-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sf-con-row {
    padding: 0.32rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.sf-con-symbol {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--light-text);
}

.sf-con-weight,
.sf-con-change,
.sf-con-contribution {
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.sf-con-weight { color: var(--sf-muted); }
.sf-con-change { color: rgba(255, 255, 255, 0.62); }

.sf-con-legend .sf-con-contribution { text-align: right; font-weight: 400; }

.sf-con-contribution {
    font-weight: 700;
    text-align: right;
    color: rgba(255, 255, 255, 0.72);
}

.sf-con-pos .sf-con-contribution { color: var(--sf-pos-text); }
.sf-con-neg .sf-con-contribution { color: var(--sf-neg-text); }

.sf-con-track {
    height: 6px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    overflow-x: clip;
}

.sf-con-bar {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.sf-con-pos .sf-con-bar { background: var(--sf-tape-pos-2); }
.sf-con-neg .sf-con-bar { background: var(--sf-tape-neg-2); }

.sf-con-note {
    margin: 0.6rem 0 0;
    font-size: 0.62rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.32);
}

/* ═══════════════════════════════════════════════════════════════════
   V2 decision workspace

   The historical atlas keeps its established chart rules above. This layer
   replaces the live snapshot surface with one compact command bar, one
   three-lane map, one persistent detail rail, and one sortable rank board.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --sf-card-bg: #0d1118;
    --sf-card-raised: #111720;
    --sf-card-quiet: #090d13;
    --sf-border-soft: #202735;
    --sf-border-gold: rgba(179, 161, 125, 0.42);
    --sf-muted: rgba(226, 231, 239, 0.54);
    --sf-pos-text: #62d792;
    --sf-neg-text: #ff7a80;
    --sf-radius: 10px;
    --sf-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
}

body { background: #070a0f; }
body::before { display: none; }

.sf-page-header {
    width: 100%;
    max-width: 1460px;
    margin: 0 auto;
    padding: 6.8rem 2rem 1rem;
}

.sf-page-header-row { align-items: end; flex-wrap: nowrap; }

.sf-page-kicker,
.sf-panel-kicker {
    margin: 0 0 0.22rem;
    color: var(--primary-gold);
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.sf-page-title {
    font-size: clamp(1.55rem, 2.4vw, 2rem);
    font-weight: 780;
    letter-spacing: -0.035em;
    margin-bottom: 0.32rem;
}

.sf-page-title span {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.12rem 0.34rem;
    border: 1px solid var(--sf-border-gold);
    border-radius: 4px;
    color: var(--secondary-gold);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    vertical-align: 0.42rem;
}

.sf-page-sub { max-width: 720px; font-size: 0.78rem; line-height: 1.45; }
.sf-status-block { align-self: end; }

.sf-main { max-width: 1460px; padding: 0 2rem 3rem; }

.sf-controls {
    display: flex;
    align-items: end;
    justify-content: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    background: #0a0e14;
    flex-wrap: wrap;
}

.sf-control-cluster { display: flex; flex-direction: column; gap: 0.3rem; }

.sf-control-label,
.sf-select-control > span {
    color: rgba(226, 231, 239, 0.45);
    font-size: 0.57rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sf-tf-bar {
    gap: 0;
    padding: 2px;
    border-color: #272f3d;
    border-radius: 7px;
    background: #070b10;
}

.sf-tf-btn {
    min-height: 28px;
    padding: 0.3rem 0.68rem;
    border-radius: 5px;
    font-size: 0.66rem;
    letter-spacing: 0.025em;
}

.sf-tf-btn.sf-tf-active {
    color: #f0e2cc;
    border-color: rgba(179, 161, 125, 0.34);
    background: #26251f;
}

.sf-state-note {
    align-self: end;
    margin: 0 0 0.38rem auto;
    min-height: 0;
    max-width: 430px;
    font-size: 0.65rem;
}

.sf-snapshot-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 0.75rem;
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    background: var(--sf-card-bg);
    box-shadow: var(--sf-shadow);
}

.sf-snapshot-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.65rem;
    min-height: 64px;
    padding: 0.68rem 0.8rem;
    border-right: 1px solid var(--sf-border-soft);
}

.sf-snapshot-item:last-child { border-right: 0; }
.sf-snapshot-label { grid-column: 1 / -1; color: var(--sf-muted); font-size: 0.59rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sf-snapshot-value { color: #f5f7fa; font-size: 0.84rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.sf-snapshot-meta { align-self: center; color: rgba(226, 231, 239, 0.43); font-size: 0.62rem; text-align: right; font-variant-numeric: tabular-nums; }
.sf-snapshot-positive .sf-snapshot-value { color: var(--sf-pos-text); }
.sf-snapshot-negative .sf-snapshot-value { color: var(--sf-neg-text); }

.sf-workspace {
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 0.75rem;
    align-items: start;
}

.sf-map-panel,
.sf-side-card,
.sf-rankings-card {
    border: 1px solid var(--sf-border-soft);
    border-radius: var(--sf-radius);
    background: var(--sf-card-bg);
    box-shadow: var(--sf-shadow);
}

.sf-map-panel { padding: 0.78rem; }

.sf-panel-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
}

.sf-panel-title {
    margin: 0;
    color: #f5f7fa;
    font-size: 0.9rem;
    font-weight: 730;
    letter-spacing: -0.01em;
}

.sf-panel-sub { margin: 0.18rem 0 0; color: var(--sf-muted); font-size: 0.64rem; line-height: 1.4; }

.sf-select-control { display: flex; flex-direction: column; gap: 0.3rem; min-width: 126px; }

.sf-select-control select {
    width: 100%;
    min-height: 30px;
    padding: 0.3rem 1.7rem 0.3rem 0.55rem;
    border: 1px solid #2a3240;
    border-radius: 6px;
    background: #080c12;
    color: #e8ebef;
    font: 650 0.66rem/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sf-map-wrap {
    min-height: 420px;
    border: 1px solid #1a202b;
    border-radius: 8px;
    background: #080c12;
}

#sf-map { width: 100%; }

.sf-map-lane { stroke: #1b222d; stroke-width: 1; }
.sf-map-lane-outflow { fill: #100d12; }
.sf-map-lane-neutral { fill: #0b1017; }
.sf-map-lane-inflow { fill: #0b1211; }

.sf-map-lane-title { fill: rgba(226, 231, 239, 0.62); font-size: 10px; font-weight: 800; letter-spacing: 0.11em; }
.sf-map-lane-title-outflow { fill: var(--sf-neg-text); }
.sf-map-lane-title-inflow { fill: var(--sf-pos-text); }
.sf-map-lane-sub { fill: rgba(226, 231, 239, 0.35); font-size: 9.5px; }
.sf-map-order-note { fill: rgba(179, 161, 125, 0.52); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; }

.sf-node { transition: opacity 0.14s ease; }
.sf-node-box,
.sf-heat-pos-1 .sf-node-box,
.sf-heat-pos-2 .sf-node-box,
.sf-heat-pos-3 .sf-node-box,
.sf-heat-neg-1 .sf-node-box,
.sf-heat-neg-2 .sf-node-box,
.sf-heat-neg-3 .sf-node-box {
    fill: #121923;
    stroke: #2a3341;
    stroke-width: 1;
}

.sf-lane-inflow .sf-node-box { fill: #111c19; }
.sf-lane-outflow .sf-node-box { fill: #1c1318; }
.sf-node-direction-bar { fill: rgba(226, 231, 239, 0.34); }
.sf-lane-inflow .sf-node-direction-bar { fill: var(--sf-pos-text); }
.sf-lane-outflow .sf-node-direction-bar { fill: var(--sf-neg-text); }

.sf-node-selected .sf-node-box,
.sf-node:focus-visible .sf-node-box,
.sf-node:hover .sf-node-box { stroke: var(--secondary-gold); stroke-width: 1.5; }

.sf-node-selected .sf-node-box { fill: #1a1b1d; }
.sf-node-etf { font-size: 15px; font-weight: 800; }
.sf-node-heat { font-size: 13px; font-weight: 760; }
.sf-node-name { fill: rgba(226, 231, 239, 0.55); font-size: 9.5px; }
.sf-node-rel { fill: rgba(245, 247, 250, 0.9); font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; }
.sf-node-conf { fill: rgba(226, 231, 239, 0.68); font-size: 9px; font-weight: 700; }
.sf-node-conf-track { fill: rgba(255, 255, 255, 0.08); }
.sf-node-conf-fill { fill: var(--primary-gold); }

.sf-edge { stroke: #b3a17d; transition: opacity 0.14s ease, stroke 0.14s ease; }
.sf-edge-flow { stroke: #ead8b9; }
.sf-edge-group { transition: opacity 0.14s ease; }
.sf-map-emphasis .sf-edge-group:not(.sf-edge-related) { opacity: 0.08; }
.sf-map-emphasis .sf-edge-related { opacity: 1; }
.sf-map-emphasis .sf-node:not(.sf-node-related) { opacity: 0.28; }

.sf-map-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.15rem 0.05rem;
    color: rgba(226, 231, 239, 0.48);
    font-size: 0.61rem;
}

.sf-map-legend b { color: #e7e9ed; font-size: 0.64rem; }
.sf-legend-line { display: inline-block; width: 18px; margin-right: 3px; border-top: solid var(--primary-gold); vertical-align: middle; }
.sf-legend-line-thin { border-top-width: 1px; }
.sf-legend-line-thick { border-top-width: 3px; }
.sf-legend-confidence { display: inline-block; width: 26px; height: 4px; margin-right: 4px; border-radius: 2px; background: #383a37; vertical-align: middle; }
.sf-legend-confidence::after { content: ''; display: block; width: 72%; height: 100%; border-radius: inherit; background: var(--primary-gold); }

.sf-detail-rail { gap: 0; }
.sf-detail-card { position: sticky; top: 5.6rem; padding: 0.85rem; }
.sf-detail-panel-head { margin-bottom: 0.8rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--sf-border-soft); }

.sf-detail-head { align-items: center; margin-bottom: 0.62rem; }
.sf-detail-identity { display: flex; flex-direction: column; gap: 0.12rem; }
.sf-detail-ticker { color: #fff; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; }
.sf-detail-title { color: var(--sf-muted); font-size: 0.68rem; font-weight: 600; }
.sf-detail-pressure { padding: 0.28rem 0.48rem; border: 1px solid #303744; border-radius: 5px; color: rgba(226, 231, 239, 0.68); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.sf-detail-inflow { color: var(--sf-pos-text); border-color: rgba(98, 215, 146, 0.28); }
.sf-detail-outflow { color: var(--sf-neg-text); border-color: rgba(255, 122, 128, 0.3); }
.sf-detail-readout { margin: 0 0 0.72rem; color: rgba(226, 231, 239, 0.7); font-size: 0.68rem; line-height: 1.52; }

.sf-detail-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--sf-border-soft); border-radius: 7px; }
.sf-detail-metric { display: flex; flex-direction: column; gap: 0.18rem; min-height: 55px; padding: 0.55rem; border-right: 1px solid var(--sf-border-soft); border-bottom: 1px solid var(--sf-border-soft); }
.sf-detail-metric:nth-child(2n) { border-right: 0; }
.sf-detail-metric:nth-last-child(-n + 2) { border-bottom: 0; }
.sf-detail-metric strong { color: #f2f4f7; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.sf-detail-metric span { color: var(--sf-muted); font-size: 0.56rem; letter-spacing: 0.05em; text-transform: uppercase; }
.sf-detail-metric.sf-detail-inflow strong { color: var(--sf-pos-text); }
.sf-detail-metric.sf-detail-outflow strong { color: var(--sf-neg-text); }

.sf-detail-confidence { margin: 0.7rem 0; }
.sf-detail-confidence-head { display: flex; justify-content: space-between; margin-bottom: 0.3rem; color: var(--sf-muted); font-size: 0.62rem; }
.sf-detail-confidence-head strong { color: #f2f4f7; font-variant-numeric: tabular-nums; }
.sf-detail-confidence-track { display: block; height: 4px; border-radius: 2px; background: #212731; }
.sf-detail-confidence-fill { display: block; height: 100%; border-radius: inherit; background: var(--primary-gold); }

.sf-detail-grid { border-top: 1px solid var(--sf-border-soft); border-bottom: 1px solid var(--sf-border-soft); }
.sf-detail-row { padding: 0.34rem 0; }
.sf-detail-label { font-size: 0.61rem; }
.sf-detail-value { font-size: 0.66rem; }

.sf-detail-routes { padding: 0.72rem 0 0; }
.sf-detail-section-label { display: block; margin-bottom: 0.42rem; color: var(--primary-gold); font-size: 0.57rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.sf-detail-route-list { list-style: none; margin: 0; padding: 0; }
.sf-detail-route-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.35rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.045); }
.sf-detail-route-list strong { color: #f2f4f7; font-size: 0.64rem; }
.sf-detail-route-list span { color: var(--sf-muted); font-size: 0.56rem; text-align: right; }
.sf-detail-route-empty { margin: 0; color: var(--sf-muted); font-size: 0.62rem; line-height: 1.45; }

.sf-detail-history {
    width: 100%;
    min-height: 34px;
    margin-top: 0.72rem;
    border: 1px solid var(--sf-border-gold);
    border-radius: 6px;
    background: rgba(179, 161, 125, 0.08);
    color: var(--secondary-gold);
    font: 720 0.64rem/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.sf-detail-history:hover { background: rgba(179, 161, 125, 0.14); }

.sf-rankings-card { margin-top: 0.75rem; padding: 0.8rem; }
.sf-ranking-head { margin-bottom: 0.75rem; }
.sf-ranking-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 0.82fr; gap: 0.7rem; }
.sf-ranking-column { min-width: 0; padding: 0.7rem; border: 1px solid #1d2430; border-radius: 8px; background: var(--sf-card-quiet); }
.sf-ranking-title { margin: 0 0 0.52rem; color: #edf0f4; font-size: 0.68rem; font-weight: 760; letter-spacing: 0.04em; text-transform: uppercase; }
.sf-ranking-title span { color: currentColor; }
.sf-ranking-column:first-child .sf-ranking-title { color: var(--sf-pos-text); }
.sf-ranking-column:nth-child(2) .sf-ranking-title { color: var(--sf-neg-text); }
.sf-ranking-columns,
.sf-flow-item { display: grid; grid-template-columns: minmax(0, 1.4fr) 78px 62px 50px; gap: 0.48rem; align-items: center; }
.sf-ranking-columns { padding: 0 0.46rem 0.3rem; color: rgba(226, 231, 239, 0.3); font-size: 0.5rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; text-align: right; }
.sf-ranking-columns span:first-child { text-align: left; }
.sf-flow-list { gap: 0.25rem; }
.sf-flow-item { min-height: 41px; padding: 0.38rem 0.46rem; border-radius: 6px; background: #101620; }
.sf-flow-item:hover,
.sf-flow-selected { border-color: var(--sf-border-gold); background: #171a1d; }
.sf-flow-sector { display: flex; align-items: baseline; gap: 0.42rem; min-width: 0; }
.sf-flow-etf { flex: 0 0 auto; color: #f4f6f8; font-size: 0.69rem; }
.sf-flow-name { color: var(--sf-muted); font-size: 0.59rem; font-weight: 560; }
.sf-flow-momentum,
.sf-flow-rel,
.sf-flow-confidence { color: rgba(238, 241, 245, 0.8); font-size: 0.64rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.sf-flow-inflow { color: var(--sf-pos-text); }
.sf-flow-outflow { color: var(--sf-neg-text); }
.sf-flow-confidence { position: relative; padding-bottom: 0.24rem; }
.sf-flow-confidence::before,
.sf-flow-confidence::after { content: ''; position: absolute; right: 0; bottom: 0; height: 2px; border-radius: 1px; }
.sf-flow-confidence::before { width: 100%; background: #292f38; }
.sf-flow-confidence::after { width: var(--sf-confidence); max-width: 100%; background: var(--primary-gold); }

.sf-route-help { margin: -0.15rem 0 0.52rem; color: var(--sf-muted); font-size: 0.56rem; }
.sf-mobile-edge-list { gap: 0.25rem; }
.sf-mobile-edge { min-height: 41px; padding: 0.42rem 0.5rem; border: 1px solid transparent; border-radius: 6px; background: #101620; }
.sf-mobile-edge-route { font-size: 0.64rem; }
.sf-mobile-edge-meta { font-size: 0.56rem; }

.sf-mobile-index { display: none; }

.sf-method { padding: 0; }
.sf-method summary { padding: 0.78rem 0.95rem; color: var(--primary-gold); font-size: 0.64rem; font-weight: 760; letter-spacing: 0.09em; text-transform: uppercase; cursor: pointer; }
.sf-method-body { padding: 0 1rem 0.9rem; border-top: 1px solid var(--sf-border-soft); }
.sf-method-body p:first-child { padding-top: 0.8rem; }

@media (max-width: 1180px) {
    .sf-workspace { grid-template-columns: minmax(0, 1fr); }
    .sf-detail-card { position: static; }
    .sf-detail-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sf-detail-metric { border-bottom: 0; }
    .sf-detail-metric:nth-child(2) { border-right: 1px solid var(--sf-border-soft); }
    .sf-ranking-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sf-route-ledger { grid-column: 1 / -1; }
    .sf-mobile-edge-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .sf-page-header { padding: 6rem 1rem 0.8rem; }
    .sf-page-header-row { align-items: flex-start; flex-direction: column; }
    .sf-main { padding: 0 1rem 2.5rem; }
    .sf-controls { flex-direction: row; align-items: end; }
    .sf-control-cluster { flex: 1 1 180px; }
    .sf-tf-btn { min-height: 38px; padding-inline: 0.42rem; }
    .sf-state-note { flex: 1 0 100%; margin: 0; text-align: left; }
    .sf-snapshot-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sf-snapshot-item:nth-child(2) { border-right: 0; }
    .sf-snapshot-item:nth-child(-n + 2) { border-bottom: 1px solid var(--sf-border-soft); }
    .sf-workspace { display: grid; }
    .sf-map-panel { display: none; }
    .sf-mobile-index { display: block; margin-bottom: 0.75rem; padding: 0.75rem; border: 1px solid var(--sf-border-soft); border-radius: var(--sf-radius); background: var(--sf-card-bg); }
    .sf-mobile-index .sf-panel-head { margin-bottom: 0.55rem; }
    .sf-mobile-index .sf-rank-list { gap: 0.25rem; }
    .sf-mobile-index .sf-rank-item { min-height: 42px; border-radius: 6px; background: #101620; }
    .sf-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sf-detail-metric:nth-child(2) { border-right: 0; }
    .sf-detail-metric:nth-child(-n + 2) { border-bottom: 1px solid var(--sf-border-soft); }
    .sf-ranking-grid { grid-template-columns: minmax(0, 1fr); }
    .sf-route-ledger { grid-column: auto; }
    .sf-mobile-edge-list { grid-template-columns: minmax(0, 1fr); }
    .sf-method { margin-top: 0.75rem; }
}

@media (max-width: 560px) {
    .sf-page-title { font-size: 1.45rem; }
    .sf-page-title span { vertical-align: 0.3rem; }
    .sf-page-sub { font-size: 0.72rem; }
    .sf-status-block { gap: 0.45rem; }
    .sf-updated { white-space: normal; }
    .sf-control-cluster { flex-basis: 100%; }
    .sf-snapshot-item { min-height: 68px; padding: 0.58rem 0.62rem; }
    .sf-snapshot-item { grid-template-columns: minmax(0, 1fr); }
    .sf-snapshot-meta { text-align: left; }
    .sf-ranking-head { align-items: stretch; flex-direction: column; }
    .sf-select-control { width: 100%; }
    .sf-ranking-columns,
    .sf-flow-item { grid-template-columns: minmax(0, 1.1fr) 68px 58px 45px; gap: 0.3rem; }
    .sf-flow-name { display: none; }
    .sf-con-legend,
    .sf-con-row { grid-template-columns: 2.6rem 2rem 2.7rem minmax(2rem, 1fr) 3rem; gap: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    .sf-node,
    .sf-edge,
    .sf-edge-group { transition: none; }
}
