/**
 * History — horizontal day-card timeline
 * Used by: pages/history.php → content/history.php
 * Class prefix: hi-
 */

.hi-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 48px 24px 32px;
}
.hi-hero-inner {
    max-width: 1400px;
    margin: 0 auto;
}
.hi-hero h1 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.hi-hero-sub {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.hi-hero-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

/* ── Year tabs ─────────────────────────────────── */
.hi-year-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    border-radius: 10px;
}
.hi-year-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    font-variant-numeric: tabular-nums;
}
.hi-year-tab:hover {
    color: #e2e8f0;
    background: rgba(79, 70, 229, 0.15);
}
.hi-year-tab.is-active {
    color: #fff;
    background: #4f46e5;
}
.hi-year-tab.is-active:hover {
    background: #4338ca;
}

/* ── Timeline scroller ─────────────────────────── */
.hi-timeline-wrap {
    position: relative;
    background: #0b1220;
    padding: 28px 0 36px;
    overflow: hidden;
}

.hi-timeline {
    display: flex;
    align-items: stretch;
    position: relative;                /* positioning context for the tracking banner */
    gap: 8px;                          /* gap between month groups */
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 48px 28px;            /* bottom reserve set inline (trend lane + events lane); base clears scrollbar */
    /* scroll-behavior intentionally auto here so the JS-driven initial
       centering is instant. We flip to smooth via .is-ready once it's done. */
    scroll-behavior: auto;
    visibility: hidden;                /* hide until JS centers on today */
    scrollbar-width: auto;             /* Firefox — full-size scrollbar, easier to grab */
    scrollbar-color: #475569 transparent;
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    overscroll-behavior-x: contain;    /* don't trigger browser back-swipe */
}
.hi-timeline.is-ready {
    visibility: visible;
    scroll-behavior: smooth;
}
.hi-timeline::-webkit-scrollbar { height: 16px; }
.hi-timeline::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin: 0 8px;
}
.hi-timeline::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 8px;
    border: 3px solid #0b1220;         /* inset look — thumb sits inside the track */
}
.hi-timeline::-webkit-scrollbar-thumb:hover { background: #64748b; }
.hi-timeline::-webkit-scrollbar-thumb:active { background: #818cf8; }

/* Touch / coarse-pointer devices (iPad, phones, touch laptops):
   bigger scrollbar + bigger tap targets. iOS Safari hides scrollbars
   regardless, so this mostly helps Android / hybrid touch devices. */
@media (pointer: coarse) {
    .hi-timeline { padding-bottom: 28px; }
    .hi-timeline::-webkit-scrollbar { height: 22px; }
    .hi-timeline::-webkit-scrollbar-thumb { border-width: 4px; }
}

/* ── Month group (colored bar + day cards) ─────── */
.hi-month-group {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hi-month-bar {
    height: 28px;
    background: var(--month-color, #64748b);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;     /* labels pinned to each end */
    padding: 0 6px;
    overflow: hidden;
    position: relative;
}
/* Chip-style label: dark pill on top of the colored bar so legibility is
   consistent regardless of which month's color is behind it. */
.hi-month-bar-label {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    background: rgba(15, 23, 42, 0.7);
    padding: 3px 10px;
    border-radius: 999px;
    line-height: 1;
}
.hi-month-days {
    display: flex;
    align-items: stretch;
    gap: 6px;                          /* gap between day cards within a month */
}

/* ── Day card ──────────────────────────────────── */
.hi-card {
    flex: 0 0 auto;
    width: 67px;            /* +20% to fit the per-day S&P 500 readout */
    height: 140px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 6px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
    /* Card is an <a> so middle-click opens a new tab; kill default link styling. */
    text-decoration: none;
    color: inherit;
}
.hi-card:hover {
    transform: translateY(-3px);
    border-color: #4f46e5;
    background: #283449;
}
.hi-card-wknd {
    background: #131c2e;
    opacity: 0.55;
}
.hi-card-wknd:hover { opacity: 1; }

/* ── Pre-data days (before tracking began) ──────────────────────────
   Any day earlier than the first date we have a summary for. Rendered as a
   flat, ghosted, dashed "no data yet" placeholder so the start-of-tracking
   boundary reads at a glance — distinct from tracked-era days that merely had
   no movers row (those stay solid). Placed after .hi-card-wknd so a pre-data
   weekend reads as pre-data, not as a normal weekend. */
.hi-card-predata {
    background: #0e1626;
    border-color: #1c2638;
    border-style: dashed;
    opacity: 0.3;
    box-shadow: none;
}
.hi-card-predata:hover {
    opacity: 0.6;
    transform: none;
    background: #0e1626;
    border-color: #2a3850;
}
.hi-card-predata .hi-dow,
.hi-card-predata .hi-d   { color: #3a475c; }
.hi-card-predata .hi-spark   { display: none; }   /* no data → no sparkline */
.hi-card-predata .hi-foot-dot { background: #1c2638; }

/* Floating "Tracking Started …" marker, centered over the pre-data cards.
   JS sets left/top in the track's scroll-content coordinates; it rides along
   with the blackened cards as you scroll. pointer-events:none so clicks still
   reach the cards underneath. */
.hi-tracking-banner {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 4;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #3a475c;
    border-radius: 999px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.hi-tracking-banner i { color: #818cf8; font-size: 15px; line-height: 1; }

/* ── Sentiment-stretch bars (the lane below the day cards) ───────────
   One bar per settled directional stretch; JS sets left/width/top so it spans
   its start→end day-cards. Up = green, down = red. Memo (or the stat fallback)
   shows inline, full text on hover (title). */
.hi-trend {
    position: absolute;
    height: 30px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 11.5px;
    font-weight: 600;
    color: #e8eef7;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: filter 0.12s;
}
.hi-trend:hover { filter: brightness(1.13); }
.hi-trend-icon  { font-size: 12px; flex-shrink: 0; opacity: 0.95; }
.hi-trend-label { overflow: hidden; text-overflow: ellipsis; }
.hi-trend-up {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.30), rgba(34, 197, 94, 0.15));
    border-color: rgba(34, 197, 94, 0.55);
}
.hi-trend-up .hi-trend-icon { color: #4ade80; }
.hi-trend-down {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.30), rgba(239, 68, 68, 0.15));
    border-color: rgba(239, 68, 68, 0.55);
}
.hi-trend-down .hi-trend-icon { color: #f87171; }
/* Forming = in-progress, not yet settled: dashed + faded, with a tag. */
.hi-trend-forming {
    opacity: 0.68;
    border-style: dashed;
    box-shadow: none;
}
.hi-trend-forming-tag {
    flex-shrink: 0;
    font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 1px 5px; margin-left: 2px; border-radius: 4px;
    background: rgba(255, 255, 255, 0.13); color: #e8eef7; white-space: nowrap;
}

/* ── Monthly-ish trend bars (the lane between weekly and events) ─────
   MA-based uptrend / downtrend / range — the broad tide under the weekly runs.
   Label pins to the viewport like the event bars. */
.hi-month-trend {
    position: absolute;
    height: 22px;
    z-index: 3;
    border-radius: 6px;
    border: 1px solid transparent;
    overflow: hidden;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.28);
    transition: filter 0.12s;
}
.hi-month-trend:hover { filter: brightness(1.12); }
.hi-month-inner {
    display: flex; align-items: center; height: 100%; padding: 0 11px;
    width: max-content; will-change: transform;
}
.hi-month-label { font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 0.2px; }
.hi-month-up    { background: linear-gradient(180deg, rgba(34, 197, 94, 0.24), rgba(34, 197, 94, 0.12)); border-color: rgba(34, 197, 94, 0.5); }
.hi-month-up    .hi-month-label { color: #bbf7d0; }
.hi-month-down  { background: linear-gradient(180deg, rgba(239, 68, 68, 0.24), rgba(239, 68, 68, 0.12)); border-color: rgba(239, 68, 68, 0.5); }
.hi-month-down  .hi-month-label { color: #fecaca; }
.hi-month-range { background: linear-gradient(180deg, rgba(148, 163, 184, 0.18), rgba(148, 163, 184, 0.09)); border-color: rgba(148, 163, 184, 0.4); }
.hi-month-range .hi-month-label { color: #cbd5e1; }
.hi-month-current { border-style: dashed; }

/* ── Macro-event bars (the top lane) ────────────────────────────────
   Curated major issues, monthly-esque. JS spans each to its dates (ongoing →
   right edge) and stacks up to 3 concurrent via data-row. Category = left-accent
   + icon color. Title inline, full summary on hover. */
.hi-event {
    position: absolute;
    height: 24px;
    z-index: 4;
    border-radius: 6px;
    background: color-mix(in srgb, var(--ev-color, #94a3b8) 16%, #1e293b);
    border: 1px solid color-mix(in srgb, var(--ev-color, #94a3b8) 42%, transparent);
    border-left: 3px solid var(--ev-color, #94a3b8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    transition: filter 0.12s;
}
.hi-event:hover { filter: brightness(1.14); }
/* Inner row is content-sized and translated by JS so the label stays in view
   while a long bar scrolls under it (the label never leaves the bar's bounds). */
.hi-event-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 100%;
    padding: 0 9px;
    width: max-content;
    will-change: transform;
}
.hi-event-icon  { font-size: 12px; flex-shrink: 0; color: var(--ev-color, #94a3b8); }
.hi-event-title {
    font-size: 11px; font-weight: 600; color: #f1f5f9; white-space: nowrap;
    max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.hi-event-ongoing {
    flex-shrink: 0; font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.4px; opacity: 0.75; margin-left: 2px; white-space: nowrap;
    color: var(--ev-color, #94a3b8);
}

/* Hero "tracking since" marker — quiet, but tells you the coverage start. */
.hi-hero-since {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.12);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

/* Today = YELLOW, so it never gets confused with the blue "selected" (currently-
   viewing) outline — which now defaults to the last tracked day, a different card. */
.hi-card-today {
    border-color: #facc15;
    box-shadow: 0 0 0 1px #facc15, 0 4px 16px rgba(250, 204, 21, 0.3);
    background: #283449;
}
/* Circle the date number so "today" is unmistakable at a glance. */
.hi-card-today .hi-d {
    color: #facc15;
    width: 28px;
    height: 28px;
    margin-top: 1px;
    border: 2px solid #facc15;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.hi-card-today .hi-dow { color: #fde68a; }
.hi-card-today .hi-foot-dot { background: #facc15; }

/* ── Sentiment + magnitude (only when summary exists) ───────────
   Sentiment recolors the inner spark gradient + foot dot + adds a
   thin top accent. Magnitude controls the outer glow strength.
   #today still wins via specificity (its own border/shadow rules). */
.hi-card-has-data {
    background: #1c2840;
}
.hi-card-has-data::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--sentiment-color, #475569);
    opacity: 0.85;
}

/* Direction swatches — drives ::before stripe, foot dot, spark gradient.
   Five levels of market_direction collapse to 3 visual states (positive,
   negative, neutral) at the strip resolution — 56px cards can't carry
   more visual weight without becoming noisy. The full 5-level signal still
   surfaces in the day panel below. */
.hi-card-positive { --direction-color: #16a34a; }
.hi-card-negative { --direction-color: #dc2626; }
.hi-card-neutral  { --direction-color: #94a3b8; }

.hi-card-has-data .hi-foot-dot { background: var(--direction-color); }

.hi-card-positive .hi-spark {
    background: linear-gradient(180deg,
        rgba(34,197,94,0.40) 0%,
        rgba(34,197,94,0.10) 70%,
        rgba(34,197,94,0.02) 100%);
}
.hi-card-negative .hi-spark {
    background: linear-gradient(0deg,
        rgba(239,68,68,0.40) 0%,
        rgba(239,68,68,0.10) 70%,
        rgba(239,68,68,0.02) 100%);
}
.hi-card-neutral .hi-spark {
    background: linear-gradient(180deg,
        rgba(148,163,184,0.25) 0%,
        rgba(148,163,184,0.05) 50%,
        rgba(148,163,184,0.05) 50%,
        rgba(148,163,184,0.25) 100%);
}

/* Dispersion — outer glow tier. Quiet/normal: nothing extra.
   High/extreme: progressively stronger ring of direction-color. */
.hi-disp-high {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 0 14px -2px var(--direction-color, transparent);
}
.hi-disp-extreme {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 0 20px -1px var(--direction-color, transparent), 0 4px 14px rgba(0,0,0,0.35);
    border-color: var(--direction-color, #334155);
}

/* Today wins outright — re-assert its indigo glow above any sentiment styling. */
.hi-card-today.hi-card-has-data {
    border-color: #facc15;
    box-shadow: 0 0 0 1px #facc15, 0 4px 16px rgba(250, 204, 21, 0.4);
}
.hi-card-today.hi-card-has-data .hi-foot-dot { background: #facc15; }

.hi-card-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.hi-dow {
    font-size: 9px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.hi-d {
    font-size: 18px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1;
}

.hi-card-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Per-day S&P 500 readout (data cards): start + end prices (dialed back) and the
   Diff % (the headline). No labels — order is start, end, diff top-to-bottom. */
.hi-mkt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 100%;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.hi-mkt-num  { font-size: 9.5px; font-weight: 500; color: #8a99ad; }   /* start + end */
.hi-mkt-diff { margin-top: 2px; font-size: 13px; font-weight: 800; letter-spacing: -0.02em; }
.hi-mkt-pos  { color: #34d399; }
.hi-mkt-neg  { color: #f87171; }
.hi-mkt-flat { color: #94a3b8; }
.hi-spark {
    width: 80%;
    height: 32px;
    background: linear-gradient(180deg,
        rgba(34,197,94,0.12) 0%,
        rgba(34,197,94,0.03) 50%,
        rgba(239,68,68,0.03) 50%,
        rgba(239,68,68,0.12) 100%);
    border-radius: 3px;
}

.hi-card-foot {
    display: flex;
    justify-content: center;
}
.hi-foot-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #475569;
}

/* Per-day market-intensity gauge (replaces the foot dot on data cards):
   an arrow tilted by the −10..10 score (+10 = up, 0 = horizontal, −10 = down)
   + the score number, both tinted by the diverging score color. */
.hi-gauge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    line-height: 1;
}
.hi-gauge-arrow {
    font-size: 15px;
    line-height: 1;
    display: inline-block;
    transform-origin: 50% 50%;
}
.hi-gauge-score {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* ── Scroll buttons ────────────────────────────── */
.hi-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #334155;
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.15s;
}
.hi-scroll-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}
.hi-scroll-left  { left: 8px; }
.hi-scroll-right { right: 8px; }

/* Bigger tap targets on touch devices */
@media (pointer: coarse) {
    .hi-scroll-btn { width: 44px; height: 44px; font-size: 20px; }
    .hi-year-tab   { min-height: 44px; padding: 10px 18px; }
}

/* ── Selected-card highlight (when its detail is showing in the panel) ── */
.hi-card.is-selected {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px #818cf8, 0 6px 18px rgba(99, 102, 241, 0.35);
    background: #2a3457;
    transform: translateY(-2px);
}
/* When today is also the selected card, show both: yellow border (today) +
   blue selection ring (currently viewing). */
.hi-card-today.is-selected {
    border-color: #facc15;
    box-shadow: 0 0 0 2px #818cf8, 0 6px 22px rgba(99, 102, 241, 0.5);
}

/* ── Panel section (sits below the year strip) ─────────────────── */
.hi-panel-section {
    background: #f9fafb;
    padding: 32px 24px 64px;
    border-top: 1px solid #e5e7eb;
}
.hi-panel {
    max-width: 980px;
    margin: 0 auto;
    transition: opacity 0.18s;
}
.hi-panel.hi-panel-loading {
    opacity: 0.55;
    pointer-events: none;
}
.hi-panel-headline {
    margin-bottom: 20px;
}
.hi-panel-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #111827;
    letter-spacing: -0.02em;
}
.hi-panel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
}
.hi-panel-meta i { margin-right: 4px; color: #9ca3af; }
.hi-panel-meta strong { color: #1f2937; font-weight: 600; }

/* ── Movers card framing (gainers / losers / indexes / day-summary cards) ── */
.mv-empty {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}
.mv-empty code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.mv-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    margin-bottom: 24px;
}
.mv-card:last-child { margin-bottom: 0; }
.mv-card-gainers { border-top: 3px solid #16a34a; }
.mv-card-losers  { border-top: 3px solid #dc2626; }
.mv-card-indexes { border-top: 3px solid #475569; }

.mv-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid #f3f4f6;
}
.mv-card-header h2 { font-size: 18px; font-weight: 700; margin: 0; color: #1f2937; flex: 1; }
.mv-card-header i { font-size: 20px; }
.mv-card-gainers .mv-card-header i { color: #16a34a; }
.mv-card-losers  .mv-card-header i { color: #dc2626; }
.mv-card-indexes .mv-card-header i { color: #475569; }
.mv-count {
    font-size: 12px; font-weight: 600; color: #6b7280;
    background: #f3f4f6; padding: 2px 10px; border-radius: 999px;
}

.mv-list { display: flex; flex-direction: column; }

.mv-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 20px;
    border-bottom: 1px solid #f5f5f7;
    cursor: pointer;
    transition: background-color 0.12s;
}
.mv-list .mv-row:last-child { border-bottom: none; }
.mv-row:hover { background: #fafbfc; }
.mv-row.expanded { background: #f9fafb; }
.mv-row-no-detail { cursor: default; }
.mv-row-no-detail:hover { background: transparent; }

/* Single-line identity strip: ticker pill + name (ellipsized).
   Exchange is no longer in the row — bumped into the detail panel meta. */
.mv-row-id {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}
/* Ticker pill — colored background + text from persisted ticker color
   (StocksTickerColors), set inline. The pill IS the per-stock identity. */
.mv-row-sym {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 4px 9px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.1;
    letter-spacing: 0.3px;
    text-decoration: none;
    transition: filter 0.12s, transform 0.12s;
}
.mv-row-sym:hover { filter: brightness(1.08); text-decoration: none; }
.mv-row-name {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    color: #1f2937;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Visible sector column — sits between the ticker name and price.
   Lets you eyeball the color↔sector mapping at a glance. */
.mv-row-sector {
    width: 160px;
    flex-shrink: 0;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mv-row-price {
    width: 88px; flex-shrink: 0; text-align: right;
    color: #1f2937; font-size: 13.5px;
    font-variant-numeric: tabular-nums; font-weight: 500;
    letter-spacing: -0.01em;
}
/* Dollar change — secondary signal between price and the % pill.
   Same red/green semantics as the pill but no background, lighter weight. */
.mv-row-amt {
    width: 80px; flex-shrink: 0; text-align: right;
    font-size: 12.5px; font-weight: 500;
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.mv-amt-up   { color: #15803d; }
.mv-amt-down { color: #b91c1c; }
.mv-amt-flat { color: #6b7280; }
/* % change pill — the headline number, given more visual weight. */
.mv-row-change {
    width: 92px; flex-shrink: 0; box-sizing: border-box;
    padding: 5px 10px; border-radius: 6px; text-align: center;
    font-size: 13px; font-weight: 700;
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.mv-pct-up   { background: #dcfce7; color: #15803d; }
.mv-pct-down { background: #fee2e2; color: #b91c1c; }
.mv-pct-flat { background: #f3f4f6; color: #6b7280; }

/* ── Index card rows ─────────────────────────────────────────────
   Same skeleton as the gainer/loser rows but with a friendly label
   instead of a colored ticker pill (4 indexes don't need identity colors). */
.mv-row-index { cursor: default; }
.mv-row-index:hover { background: transparent; }
.mv-row-index-label {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tier chip column — fixed-width container so chips align down the right
   edge regardless of label length. The chip itself contains the expand
   chevron, becoming the affordance for opening the detail drawer. */
.mv-row-tier-col {
    width: 168px;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}
.mv-row-tier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: filter 0.12s, transform 0.1s;
    white-space: nowrap;
    font-family: inherit;
}
.mv-row-tier:hover  { filter: brightness(0.96); }
.mv-row-tier:active { transform: translateY(1px); }
.mv-tier-icon  { font-size: 11px; line-height: 1; }
.mv-tier-label { line-height: 1; }
.mv-tier-arrow {
    font-size: 11px; line-height: 1;
    margin-left: 2px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 12px; height: 12px;
    transition: transform 0.15s;
    opacity: 0.7;
}
.mv-row.expanded .mv-tier-arrow { transform: rotate(180deg); opacity: 1; }

/* Tier color variants */
.mv-tier-grounded  { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.mv-tier-inference { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.mv-tier-nodata    { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* Detail panel — left padding tightened (no rank gutter anymore). */
.mv-row-detail {
    padding: 14px 22px 18px 22px;
    background: #fafafa;
    border-bottom: 1px solid #f3f4f6;
}
/* Meta strip — exchange and any other context bumped out of the row. */
.mv-detail-meta {
    font-size: 10.5px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 8px;
}
.mv-detail-tldr { font-size: 13.5px; line-height: 1.55; color: #1f2937; margin-bottom: 10px; }
.mv-detail-full {
    font-size: 12.5px; line-height: 1.65; color: #4b5563;
    padding-top: 10px; border-top: 1px solid #e5e7eb;
}

/* ── Day-summary card (sits above Gainers/Losers in the panel) ──── */
/* Top border + header icon color follow market_direction. 5-level scale,
   collapsed to 3 hues for visual restraint (strong-X uses same hue as X
   but the regime pill below carries the additional resolution). */
.mv-card-summary { border-top-width: 3px; border-top-style: solid; }
.mv-summary-strong-up   { border-top-color: #15803d; }
.mv-summary-up          { border-top-color: #16a34a; }
.mv-summary-flat        { border-top-color: #94a3b8; }
.mv-summary-down        { border-top-color: #dc2626; }
.mv-summary-strong-down { border-top-color: #991b1b; }

.mv-summary-strong-up   .mv-card-header i { color: #15803d; }
.mv-summary-up          .mv-card-header i { color: #16a34a; }
.mv-summary-flat        .mv-card-header i { color: #94a3b8; }
.mv-summary-down        .mv-card-header i { color: #dc2626; }
.mv-summary-strong-down .mv-card-header i { color: #991b1b; }

/* Regime pill — the *interesting* signal. 10 categories, each gets its
   own color so a glance tells you what kind of day this was. Pinned next
   to the dispersion pill on the right side of the header. */
.mv-regime-pill {
    margin-left: auto;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
    padding: 4px 10px; border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.mv-regime-broad_rally       { background: #dcfce7; color: #15803d; border-color: #86efac; }
.mv-regime-small_cap_rally   { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }
.mv-regime-tech_rally        { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.mv-regime-broad_selloff     { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.mv-regime-risk_off          { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.mv-regime-value_rotation    { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.mv-regime-complacency       { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }
.mv-regime-calm_tape         { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.mv-regime-stock_pickers_day { background: #fff7ed; color: #9a3412; border-color: #fdba74; }
.mv-regime-divergent         { background: #f5f5f4; color: #57534e; border-color: #d6d3d1; }

/* Dispersion pill — independent axis, shown alongside the regime pill */
.mv-disp-pill {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
    padding: 4px 10px; border-radius: 999px;
}
.mv-disp-quiet   { background: #f3f4f6; color: #6b7280; }
.mv-disp-normal  { background: #e0e7ff; color: #4338ca; }
.mv-disp-high    { background: #fef3c7; color: #b45309; }
.mv-disp-extreme { background: #fee2e2; color: #991b1b; }

.mv-summary-body { padding: 18px 22px 20px; }
.mv-summary-teaser {
    font-size: 16px; font-weight: 600; line-height: 1.45;
    color: #111827; margin: 0 0 12px; letter-spacing: -0.01em;
}
/* Weighted bullets — each carries an "[NN%]" weight from the LLM that
   sums to 100 across the three bullets. The weight badge replaces the
   old sequential number; visual emphasis scales with the weight via the
   data-weight attribute (heavier weight = heavier styling). */
.mv-summary-bullets {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
}
.mv-summary-bullets li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.55;
    color: #374151;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
}
.mv-summary-bullets li:last-child { margin-bottom: 0; }
.mv-bullet-weight {
    flex-shrink: 0;
    min-width: 44px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1.4;
}
.mv-bullet-text {
    flex: 1;
    min-width: 0;
}

/* Tier classes are assigned in PHP based on the bullet's weight:
   lead (≥40%), supporting (25-39%), context (<25% or no weight). */
.mv-bullet-tier-lead {
    background: #fff !important;
    border-color: #e5e7eb !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    color: #111827 !important;
    font-weight: 500 !important;
}
.mv-bullet-tier-lead .mv-bullet-weight {
    background: #4f46e5;
    color: #fff;
}
.mv-bullet-tier-supporting .mv-bullet-weight {
    background: #475569;
    color: #fff;
}
/* tier-context keeps the default badge styling (light grey) */

.mv-summary-fallback {
    font-size: 13px; color: #6b7280; margin: 0 0 14px;
    padding: 12px 14px; background: #f9fafb;
    border: 1px dashed #d1d5db; border-radius: 8px;
}
.mv-summary-fallback code {
    background: #fff; padding: 2px 6px; border-radius: 4px;
    font-size: 11.5px; border: 1px solid #e5e7eb;
}

.mv-summary-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.mv-summary-tag {
    display: inline-flex; align-items: center;
    padding: 5px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500;
    background: #f3f4f6; color: #374151;
    border: 1px solid #e5e7eb; white-space: nowrap;
}
.mv-summary-tag-superlative { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.mv-summary-tag-streak      { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.mv-summary-tag-debutant    { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }

/* ── Market Regime (Brick 1 — standing macro read) ──────────────────────────
   Shared label palette: risk_on=green · neutral=slate · risk_off=amber · stress=red.
   `reg-pill-*` is used in BOTH the day panel and the history hero. */
.reg-pill-risk_on  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.reg-pill-neutral  { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.reg-pill-risk_off { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.reg-pill-stress   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.reg-pill, .reg-conf, .reg-proto {
    display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
    border-radius: 999px; padding: 2px 9px; line-height: 1.6; white-space: nowrap;
}
.reg-conf { font-weight: 600; text-transform: capitalize; }
.reg-conf-high   { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.reg-conf-medium { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.reg-conf-low    { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }
.reg-proto { background: #f5f3ff; color: #7c3aed; border: 1px dashed #ddd6fe; font-weight: 600; }

/* Day-panel regime card */
.reg-card { border-left: 4px solid #cbd5e1; position: relative; }
.reg-card .reg-body { padding-bottom: 16px; }   /* clear the bottom-right slang chip */
.reg-card.reg-risk_on  { border-left-color: #16a34a; }
.reg-card.reg-neutral  { border-left-color: #94a3b8; }
.reg-card.reg-risk_off { border-left-color: #f59e0b; }
.reg-card.reg-stress   { border-left-color: #dc2626; }
.reg-body { padding: 4px 2px 2px; }
.reg-score-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.reg-score { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: #334155; }
.reg-risk_on  .reg-score { color: #16a34a; }
.reg-risk_off .reg-score { color: #b45309; }
.reg-stress   .reg-score { color: #dc2626; }
.reg-score-meta { display: flex; flex-direction: column; gap: 3px; }
.reg-dir { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.reg-dir-tailwind { color: #16a34a; } .reg-dir-headwind { color: #dc2626; } .reg-dir-neutral { color: #64748b; }
.reg-scale { font-size: 11px; color: #9ca3af; }
.reg-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.reg-stat { display: inline-flex; flex-direction: column; gap: 1px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 5px 11px; }
.reg-stat-k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #94a3b8; }
.reg-stat-v { font-size: 13px; font-weight: 700; color: #334155; font-variant-numeric: tabular-nums; }
.reg-stat-v small { font-weight: 600; color: #94a3b8; }
.reg-drivers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.reg-drivers-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #94a3b8; }
.reg-driver { font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.reg-driver-pos { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.reg-driver-neg { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* Hero pill (history.php) */
.hi-regime-pill {
    display: inline-flex; align-items: center; gap: 7px; margin-top: 9px;
    font-size: 12.5px; border-radius: 999px; padding: 4px 12px;
}
.hi-regime-pill strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.hi-regime-since { font-size: 11px; opacity: .7; font-weight: 600; }

/* ── Regime ribbon under each day card (the "see the arc" overlay) ── */
.hi-regime-strip { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
.hi-rg-risk_on  { background: #22c55e; }
.hi-rg-neutral  { background: #64748b; }
.hi-rg-risk_off { background: #f59e0b; }
.hi-rg-stress   { background: #ef4444; }

/* Explainer + legend band (sits on the dark hero gradient) */
.hi-regime-explainer {
    margin-top: 20px;
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid #334155; border-radius: 10px; padding: 12px 16px;
}
.hi-rgx-lead { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.55; color: #cbd5e1; max-width: 860px; }
.hi-rgx-lead i { color: #a78bfa; font-size: 16px; margin-top: 1px; flex: 0 0 auto; }
.hi-rgx-lead strong { color: #f1f5f9; }
.hi-rgx-lead em { color: #fbbf24; font-style: normal; font-weight: 600; }
.hi-rgx-legend { display: flex; flex-wrap: wrap; gap: 7px; }
.hi-rgx-key { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 3px 10px; color: #0b1220; white-space: nowrap; }
.hi-rgx-key.hi-rg-neutral { color: #f1f5f9; }
.hi-rgx-key.hi-rg-stress  { color: #fff; }

/* ── Mobile (≤640px) ─────────────────────────────────────────────────
   The movers / index rows are a fixed-width flex "table" (sector 160 + price 88
   + amt 80 + change 92 + tier 168, all flex-shrink:0). That sum overflows a
   phone viewport, pushing the whole row off to the right with horizontal scroll.
   On narrow screens we drop the two secondary columns (sector + $ change — the
   % pill is the headline), collapse the tier chip to its icon, and tighten the
   numeric columns and paddings so each row fits the screen cleanly. */
@media (max-width: 640px) {
    .hi-panel-section { padding: 24px 12px 48px; }
    .hi-panel-title   { font-size: 21px; }

    .mv-card-header     { padding: 14px; gap: 8px; }
    .mv-card-header h2  { font-size: 16px; }

    .mv-row        { gap: 10px; padding: 10px 14px; }
    .mv-row-detail { padding: 12px 14px 16px; }

    /* Desktop-only secondary columns — hide to reclaim width on phones. */
    .mv-row-sector,
    .mv-row-amt { display: none; }

    .mv-row-price  { width: 72px; font-size: 13px; }
    .mv-row-change { width: 66px; padding: 5px 6px; font-size: 12.5px; }

    /* Tier chip stays as the expand affordance but sizes to content (no 168px
       reservation) and shows icon + chevron only — the label text is too wide
       for a phone row (e.g. "Insufficient data"). */
    .mv-row-tier-col            { width: auto; }
    .mv-row-tier               { padding: 4px 7px; }
    .mv-row-tier .mv-tier-label { display: none; }
}

