/* ══════════════════════════════════════════════════════
   MERIDIAN DASHBOARD — index.css
   ══════════════════════════════════════════════════════ */

:root {
    --bg:           #0f1115; /* Charcoal-black background */
    --bg2:          #0a0b0d; /* Darker sidebar background */
    --card:         #181b21; /* Distinct card background */
    --border:       rgba(255, 255, 255, 0.15); /* Sleek card border */
    --accent:       #ffffff;
    --accent-glow:  rgba(255, 255, 255, 0.04);
    --green:        #7dd493;
    --green-glow:   rgba(125, 212, 147, 0.08);
    --amber:        #fec84b;
    --amber-glow:   rgba(254, 200, 75, 0.08);
    --red:          #fb8989;
    --red-glow:     rgba(251, 137, 137, 0.08);
    --text:         #ffffff;
    --muted:        rgba(255, 255, 255, 0.45);
    --muted2:       rgba(255, 255, 255, 0.7);
    --sidebar-w:    240px;
    --radius:       0px;
    --radius-sm:    0px;
    --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; font-weight: inherit; }

html, body {
    height: 100vh;
    overflow: hidden;
}
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    position: relative;
}

body.boot-loading {
    overflow: hidden;
}

/* Ambient glow blobs */
body::before {
    content: '';
    position: fixed; top: -15%; left: -10%;
    width: 55%; height: 55%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 65%);
    filter: blur(120px); z-index: 0; pointer-events: none;
}
body::after {
    content: '';
    position: fixed; bottom: -20%; right: -10%;
    width: 50%; height: 50%;
    background: radial-gradient(circle, var(--green-glow) 0%, transparent 65%);
    filter: blur(120px); z-index: 0; pointer-events: none;
}

/* ── Layout ─────────────────────────────────────────── */
.app-container { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg2);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    padding: 1.75rem 1.25rem 1.5rem;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto;
}

.logo { display: flex; align-items: center; gap: 10px; margin-bottom: 2.5rem; }
.logo-icon {
    width: 36px; height: 36px; border-radius: 0px;
    background: linear-gradient(135deg, var(--accent), #555555);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-sans) !important;
    font-weight: 300 !important;
    font-size: 1.3rem;
    color: white !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}
.logo h2 {
    font-family: var(--font-sans); font-size: 1.15rem;
    letter-spacing: 2px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-sub { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.5px; }

nav ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
nav ul li {
    display: flex; align-items: center; gap: 14px;
    padding: 0.75rem 1rem; border-radius: var(--radius-sm);
    cursor: pointer; color: var(--muted2); font-size: 0.9rem;
    transition: all 0.18s ease;
    font-family: 'JetBrains Mono', monospace !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
}
nav ul li:hover { background: rgba(255,255,255,0.04); color: var(--text); }
nav ul li.active { background: rgba(255, 255, 255, 0.05); border-left: 2px solid var(--accent); color: var(--text); font-weight: 400; }
.nav-icon { font-size: 0.72rem; color: var(--muted); }
.nav-svg {
    width: 16px;
    height: 16px;
    stroke: var(--muted);
    transition: stroke 0.18s;
    flex-shrink: 0;
}
nav ul li:hover .nav-svg, nav ul li.active .nav-svg {
    stroke: var(--accent);
}

/* Regime block */
.regime-status {
    margin-top: auto; padding: 1.25rem;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.regime-label {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--muted); margin-bottom: 0.6rem;
}
.regime-indicator {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 0.95rem; margin-bottom: 0.4rem;
}
.dot {
    width: 9px; height: 9px; border-radius: 50%;
    flex-shrink: 0; animation: glow-pulse 2.2s infinite;
}
.regime-detail {
    font-size: 0.75rem; color: var(--muted2); line-height: 1.4;
    margin-bottom: 0.5rem;
}
.regime-weight { font-size: 0.75rem; color: var(--muted); }
.regime-help-btn {
    margin-top: 0.6rem; width: 100%;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
    color: var(--accent); font-size: 0.75rem; padding: 6px 10px;
    border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.regime-help-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.4); }
.sidebar-footer { margin-top: 0.75rem; }
.last-run { font-size: 0.72rem; color: var(--muted); text-align: center; }
.install-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; margin-bottom: 0.75rem;
    background: var(--green); border: 1px solid var(--green);
    color: #000000; font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem; font-weight: 600; padding: 8px 12px;
    cursor: pointer; transition: all 0.2s;
    border-radius: 0px !important;
}
.install-btn:hover {
    background: transparent;
    color: var(--green);
}

/* Regime color themes */
.regime-bull  { color: var(--green); }
.regime-bear  { color: var(--red); }
.regime-neutral { color: var(--amber); }
.dot-bull   { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-bear   { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.dot-neutral{ background: var(--amber); box-shadow: 0 0 8px var(--amber); }

@keyframes glow-pulse {
    0%, 100% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ── Main Content ─────────────────────────────────────── */
.main-content {
    flex: 1; padding: 0 1.5rem 1.5rem;
    overflow-y: auto; position: relative;
    height: 100vh;
}

header {
    display: flex; justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding-top: 1.25rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.0rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.header-meta {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}
.page-title {
    font-family: var(--font-sans);
    font-size: 2.0rem; font-weight: 300;
}
.page-subtitle { font-size: 0.85rem; color: var(--muted2); margin-top: 0.25rem; }
.health-pill {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    background: rgba(125, 212, 147, 0.08); border: 1px solid rgba(125, 212, 147, 0.2);
    color: var(--green); font-size: 0.78rem; font-weight: 600;
    padding: 7px 12px; border-radius: 0px;
    font-family: var(--font-mono) !important;
}
.health-pill.health-warn {
    background: rgba(247, 144, 9, 0.08); border: 1px solid rgba(247, 144, 9, 0.2);
    color: var(--amber);
}
.health-pill.health-error {
    background: rgba(251, 137, 137, 0.08); border: 1px solid rgba(251, 137, 137, 0.2);
    color: var(--red);
}
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── KPI Strip ────────────────────────────────────────── */
.kpi-strip {
    display: flex;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0px;
    margin-bottom: 1.0rem;
    backdrop-filter: blur(12px);
}
@media (max-width: 1100px) {
    .kpi-strip {
        flex-direction: column;
    }
}
.kpi-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0px;
    box-shadow: none;
    transition: background 0.2s ease;
}
@media (max-width: 1100px) {
    .kpi-card {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .kpi-card:last-child {
        border-bottom: none;
    }
}
.kpi-card:last-child {
    border-right: none;
}
.kpi-card:hover {
    background: rgba(255, 255, 255, 0.02);
    transform: none;
    box-shadow: none;
}
.kpi-label {
    font-size: 0.70rem; color: var(--muted2); text-transform: uppercase;
    letter-spacing: 0.8px; margin-bottom: 2px; cursor: help;
}
.kpi-value { font-size: 1.6rem; font-weight: 300; font-family: var(--font-sans); }
.kpi-alert { color: var(--amber); }

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); backdrop-filter: blur(12px);
    display: flex; flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}
.card::before {
    content: '+';
    position: absolute;
    top: -5px;
    left: -4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    z-index: 10;
    line-height: 1;
}
.card::after {
    content: '+';
    position: absolute;
    top: -5px;
    right: -4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    z-index: 10;
    line-height: 1;
}
.card:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: #20242c;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    transform: translateY(-2px);
}
.card-header {
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex; justify-content: space-between; align-items: flex-start;
}
.card-header h3 { font-size: 1.1rem; font-weight: 600; }
.subtitle { font-size: 0.78rem; color: var(--muted2); margin-top: 3px; }
.card-body { padding: 1.25rem 1.5rem; flex: 1; }

/* Responsive utility classes */
.mobile-title, .mobile-text {
    display: none !important;
}
.desktop-title, .desktop-text {
    display: inline !important;
}

/* ── Grids ──────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }

/* ── Chart ──────────────────────────────────────────────── */
.chart-wrap { position: relative; width: 100%; min-height: 220px; }

/* ── Insight Box ─────────────────────────────────────────── */
.insight-box {
    margin-top: 1rem; padding: 0.9rem 1rem;
    background: rgba(255,255,255,0.025);
    border-left: 3px solid var(--accent);
    border-radius: 4px 8px 8px 4px;
    font-size: 0.85rem; color: var(--muted2); line-height: 1.5;
}

/* ── Signal List ─────────────────────────────────────────── */
.signal-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.signal-item {
    background: rgba(0,0,0,0.25); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 1rem 1.1rem;
}
.signal-ticker-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.5rem;
}
.signal-ticker { font-weight: 800; font-size: 1.1rem; letter-spacing: 1px; }
.signal-price { font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; color: var(--muted2); }
.signal-badge {
    display: inline-block; padding: 3px 9px;
    border-radius: 5px; font-size: 0.78rem; font-weight: 700;
    margin-bottom: 0.4rem;
}
.sig-buy  { background: rgba(125,212,147,0.08); color: var(--green); border: 1px solid rgba(125,212,147,0.2); }
.sig-watch{ background: rgba(254,200,75,0.08); color: var(--amber); border: 1px solid rgba(254,200,75,0.2); }
.sig-hold { background: rgba(255,255,255,0.04); color: var(--muted2); border: 1px solid var(--border); }
.sig-data_warn { background: rgba(251,137,137,0.08); color: var(--red); border: 1px solid rgba(251,137,137,0.2); }
.signal-logic { font-size: 0.82rem; color: var(--muted2); line-height: 1.4; }
.signal-loading { color: var(--muted); font-size: 0.9rem; padding: 1rem; }

/* ── Tables ─────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 0.9rem 0.75rem 0.75rem;
    color: var(--muted2); font-size: 0.78rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border); text-align: left;
    cursor: help;
}
.data-table td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-size: 0.88rem; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.expandable-row { cursor: pointer; }
.data-table tr.expandable-row:hover td { background: rgba(255,255,255,0.02); }

/* Velocity / Momentum colors */
.vel-pos { color: var(--green); font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.vel-neg { color: var(--red);   font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.vel-neu { color: var(--muted2); font-family: 'JetBrains Mono', monospace; }
.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red); font-weight: 600; }

.tag {
    display: inline-block; padding: 3px 8px; border-radius: 5px;
    font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.tier-s { background: rgba(255, 255, 255, 0.1);  color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.25); }
.tier-a { background: rgba(125,212,147,0.1);  color: var(--green); border: 1px solid rgba(125,212,147,0.2); }
.tier-b { background: rgba(254,200,75,0.1);  color: var(--amber); border: 1px solid rgba(254,200,75,0.25); }
.tag-buy  { background: rgba(125,212,147,0.08); color: var(--green); border: 1px solid rgba(125,212,147,0.2); }
.tag-hold { background: rgba(255,255,255,0.04); color: var(--muted2); border: 1px solid var(--border); }
.tag-watch{ background: rgba(254,200,75,0.08); color: var(--amber); border: 1px solid rgba(254,200,75,0.2); }
.tag-warn { background: rgba(251,137,137,0.08); color: var(--red); border: 1px solid rgba(251,137,137,0.2); }
.tag-breach { background: rgba(254,200,75,0.08); color: var(--amber); border: 1px solid rgba(254,200,75,0.2); }
.tag-stable { background: rgba(255,255,255,0.07); color: var(--muted2); }

/* ── Watchlist filters/search ─────────────────────────── */
.filter-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: transparent; color: var(--muted2); font-size: 0.78rem;
    font-family: var(--font-mono) !important;
    cursor: pointer; transition: all 0.18s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: rgba(255, 255, 255, 0.1); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.search-box {
    padding: 6px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: rgba(255,255,255,0.04);
    color: var(--text); font-size: 0.82rem; width: 200px; outline: none;
}
.search-box:focus { border-color: var(--accent); }

/* ── View intros ─────────────────────────────────────────── */
.view-intro { margin-bottom: 1.5rem; }
.view-intro h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.4rem; }
.view-intro p { color: var(--muted2); font-size: 0.87rem; line-height: 1.5; max-width: 700px; }

/* ── Signals Grid ────────────────────────────────────────── */
.signals-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}
.signal-full-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
    transition: box-shadow 0.2s;
}
.signal-full-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
.sfc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.sfc-ticker { font-size: 1.2rem; font-weight: 800; letter-spacing: 1px; }
.sfc-meta { font-size: 0.8rem; color: var(--muted2); margin-bottom: 0.5rem; }
.sfc-logic { font-size: 0.82rem; color: var(--muted2); line-height: 1.45; }
.sfc-stats { display: flex; gap: 1rem; margin-top: 0.75rem; }
.sfc-stat { font-size: 0.75rem; color: var(--muted); }
.sfc-stat span { color: var(--text); font-weight: 600; }

/* ── Regime Page ────────────────────────────────────────── */
.regime-explainer {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem 2rem;
    display: flex; align-items: center; gap: 1.5rem;
}
.re-icon { font-size: 3.5rem; flex-shrink: 0; }
.re-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.35rem; }
.re-desc { color: var(--muted2); font-size: 0.88rem; line-height: 1.5; }
.gauge-body { display: flex; flex-direction: column; align-items: center; padding: 1rem 1.5rem 1.25rem; }
.gauge-wrap { width: 160px; height: 90px; position: relative; }
.gauge-label { font-weight: 600; font-size: 0.9rem; margin-top: 0.5rem; text-align: center; }
.gauge-desc { font-size: 0.78rem; color: var(--muted2); text-align: center; margin-top: 0.3rem; }

.regime-glossary { display: flex; flex-direction: column; gap: 1rem; }
.rg-row { display: flex; gap: 1.25rem; align-items: flex-start; }
.rg-badge {
    padding: 5px 14px; border-radius: 20px; font-weight: 700;
    font-size: 0.85rem; white-space: nowrap; flex-shrink: 0;
}
.rg-badge.bull    { background: rgba(16,185,129,0.15); color: var(--green); }
.rg-badge.neutral { background: rgba(245,158,11,0.15); color: var(--amber); }
.rg-badge.bear    { background: rgba(239,68,68,0.12);  color: var(--red); }
.rg-text { font-size: 0.86rem; color: var(--muted2); line-height: 1.5; padding-top: 2px; }

/* ── Portfolio ──────────────────────────────────────────── */
.pnl-summary {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1rem; margin-bottom: 0;
}
.pnl-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem 1.5rem;
}
.pnl-card-label { font-size: 0.75rem; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 0.4rem; }
.pnl-card-value { font-size: 1.6rem; font-weight: 300; font-family: var(--font-sans); }
.pnl-pos-val { color: var(--green); }
.pnl-neg-val { color: var(--red); }

/* ── Health Bars ────────────────────────────────────────── */
.health-row { margin-bottom: 1rem; }
.health-row-header { display: flex; justify-content: space-between; margin-bottom: 0.3rem; }
.health-name { font-size: 0.82rem; color: var(--muted2); }
.health-val  { font-size: 0.82rem; font-weight: 600; }
.health-bar-bg {
    height: 6px; background: rgba(255,255,255,0.06);
    border-radius: 4px; overflow: hidden;
}
.health-bar-fill {
    height: 100%; border-radius: 4px;
    transition: width 1s ease;
}
.hb-green { background: linear-gradient(to right, var(--green), #6ee7b7); }
.hb-amber { background: linear-gradient(to right, var(--amber), #fcd34d); }
.hb-red   { background: linear-gradient(to right, var(--red),   #fca5a5); }

/* ── Info Icon / Tooltip ────────────────────────────────── */
.info-icon {
    color: var(--muted); cursor: help; font-size: 1rem;
    flex-shrink: 0; padding: 2px;
}
.info-icon:hover { color: var(--accent); }

.global-tooltip {
    position: fixed; z-index: 9999;
    background: rgba(10,13,20,0.97);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 10px 14px;
    max-width: 320px; font-size: 0.82rem; line-height: 1.5;
    color: var(--muted2); pointer-events: none;
    opacity: 0; transition: opacity 0.15s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.global-tooltip.visible { opacity: 1; }

/* ── Loading / Misc ─────────────────────────────────────── */
.loading-cell { color: var(--muted); font-size: 0.85rem; padding: 2rem; text-align: center; }
.watchlist-table td { padding: 0.85rem 0.75rem; }

/* ── Signal Breakdown Rows ─────────────────────────────── */
.signal-row {
    display: flex; gap: 1rem; padding: .9rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: help; transition: background .15s;
}
.signal-row:last-child { border-bottom: none; }
.signal-row:hover { background: rgba(255,255,255,0.02); border-radius: 6px; }
.sr-dot { width: 18px; display: flex; justify-content: center; padding-top: 2px; flex-shrink: 0; }
.sr-body { flex: 1; }
.sr-name  { font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.sr-what  { font-size: .78rem; color: var(--muted2); margin-bottom: .3rem; }
.sr-value { font-family: 'JetBrains Mono', monospace; font-size: .82rem; color: var(--text); margin-bottom: .2rem; }
.sr-verdict { font-size: .78rem; font-style: italic; line-height: 1.4; }

/* ── Signals Toolbar ─────────────────────────────────────── */
.signals-toolbar {
    position: sticky;
    top: var(--header-h, 72px);
    z-index: 99;
    background: var(--bg);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.5rem;
    padding: 0.5rem 0 0.75rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.0rem;
}
.sig-filters {
    display: flex;
    gap: .5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
}
.sig-filters::-webkit-scrollbar {
    display: none;
}
.sig-filter-btn {
    flex-shrink: 0;
}
.btn-label-mobile {
    display: none;
}
.sig-legend  { display: flex; gap: 1rem; flex-wrap: wrap; }
.legend-item {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-size: .75rem; color: var(--muted2);
    border: 1px solid var(--border); border-radius: 6px;
    padding: .25rem .6rem; cursor: help;
    transition: border-color .2s;
    font-family: var(--font-mono) !important;
}
.legend-item:hover { border-color: var(--accent); }

svg.mono-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Stale banner */
.stale-banner {
    background: rgba(245,158,11,.08);
    border: 1px solid rgba(245,158,11,.25);
    border-radius: 8px; padding: .6rem 1rem;
    font-size: .82rem; color: #f59e0b;
    margin-bottom: 1rem;
}

/* ── Signal Full Cards (redesigned) ─────────────────────── */
.sfc {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.01) 100%) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35) !important;
    border-radius: 20px !important;
    padding: 1.25rem;
    display: flex; flex-direction: column; gap: 0.85rem;
    cursor: pointer;
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1), border-color .25s, box-shadow .25s, background .25s;
    position: relative; overflow: hidden;
}
.sfc .signal-badge {
    border-radius: 6px !important;
}
.sfc .tag {
    border-radius: 4px !important;
}
.sfc:hover {
    transform: translateY(-4px);
    border-color: var(--hover-border) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 20px var(--hover-glow) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
}
.sfc-buy   { border: 1px solid rgba(16, 185, 129, 0.22) !important; }
.sfc-watch { border: 1px solid rgba(245, 158, 11, 0.22) !important; }
.sfc-hold  { border: 1px solid rgba(255, 255, 255, 0.12) !important; }
.sfc-data-warn { border: 1px solid rgba(239, 68, 68, 0.22) !important; }

/* ── Option 4 Layout Selectors ── */
.sfc-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sfc-hud-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.ticker-logo-hud-wrap {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.ticker-logo-hud {
    width: 28px;
    height: 28px;
    border-radius: 6px !important;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
    padding: 1px;
}
.ticker-logo-fallback-hud {
    width: 28px;
    height: 28px;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}
.sfc-hud-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.sfc-hud-ticker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sfc-ticker-large {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.3px;
}
.sfc-company-name {
    font-size: 0.72rem;
    color: var(--muted2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
    max-width: 150px;
}
.sfc-hud-price-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}
.sfc-price-large {
    font-size: 1.25rem;
    font-weight: 750;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.1;
}
.sfc-change {
    font-size: 0.68rem;
    font-weight: 600;
    margin-top: 2px;
}

/* Glowing Indicator Dot and Animations */
.sfc-hud-dot {
    width: 8px;
    height: 8px;
    border-radius: 50% !important;
    display: inline-block;
    flex-shrink: 0;
}
.sfc-hud-dot.buy {
    background-color: #00e676;
    box-shadow: 0 0 8px #00e676;
    animation: pulse-green 2s infinite;
}
.sfc-hud-dot.watch {
    background-color: #ffb300;
    box-shadow: 0 0 8px #ffb300;
    animation: pulse-amber 2s infinite;
}
.sfc-hud-dot.hold {
    background-color: #94a3b8;
    box-shadow: 0 0 6px #94a3b8;
}
.sfc-hud-dot.data-warn {
    background-color: #ff1744;
    box-shadow: 0 0 8px #ff1744;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}
@keyframes pulse-amber {
    0% { box-shadow: 0 0 0 0 rgba(255, 179, 0, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(255, 179, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 179, 0, 0); }
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(255, 23, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0); }
}

.sfc-spark-wrap {
    position: relative;
    height: 48px;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding: 4px 0;
    margin: 2px 0;
}
.sfc-spark {
    width: 100%;
    height: 40px;
    display: block;
}
.sfc-spark-val {
    position: absolute;
    top: 6px;
    right: 0;
    font-size: 0.68rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px !important;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.sfc-spark-val.pos { color: var(--green); border-color: rgba(16, 185, 129, 0.2); }
.sfc-spark-val.neg { color: var(--red); border-color: rgba(239, 68, 68, 0.2); }

.sfc-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 2px 0;
}

.sfc-footer-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sfc-meta-tags {
    display: flex;
    gap: 0.4rem;
}
.sfc-action-text {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--muted2);
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 0.5rem;
}
.sfc-buy   .sfc-action-text { border-color: var(--green); }
.sfc-watch .sfc-action-text { border-color: var(--amber); }
.sfc-hold  .sfc-action-text { border-color: var(--muted); }
.sfc-data-warn .sfc-action-text { border-color: var(--red); }

.sfc-stats { display: flex; gap: .6rem; flex-wrap: nowrap; }
.sfc-stat {
    flex: 1; min-width: 0;
    background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.04); border-radius: 8px;
    padding: .45rem .6rem;
    cursor: help;
    transition: background 0.15s, border-color 0.15s;
}
.sfc-stat:hover {
    background: rgba(255,255,255,.04);
    border-color: rgba(255, 255, 255, 0.08);
}
.sfc-stat-label { font-size: .60rem; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfc-stat-val   { font-size: .78rem; font-weight: 700; color: var(--text); display: block; margin-top: 1px; }

.sfc-click-hint {
    font-size: .65rem; color: var(--muted); text-align: right;
    margin-top: 1px; opacity: 0;
    transition: opacity .2s;
}
.sfc:hover .sfc-click-hint { opacity: 1; }

/* ── Detail Drawer ───────────────────────────────────────── */
.signal-drawer {
    position: fixed; inset: 0; z-index: 900;
    display: none; align-items: flex-start; justify-content: flex-end;
}
.drawer-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
}
.drawer-panel {
    position: relative; z-index: 1;
    width: min(720px, 95vw);
    height: 100vh;
    overflow: hidden; /* Fixed header/footer support */
    background: var(--bg2);
    border-left: 1px solid var(--border);
    box-shadow: -16px 0 48px rgba(0,0,0,.4);
    animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-close {
    position: absolute; top: 1.25rem; right: 1.5rem;
    background: rgba(255,255,255,.07); border: 1px solid var(--border);
    border-radius: 6px; color: var(--muted2); font-size: 1rem;
    padding: .2rem .6rem; cursor: pointer;
    z-index: 10;
}
.drawer-close:hover { background: rgba(255,255,255,.12); }
.drawer-content-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.drawer-header-fixed {
    flex-shrink: 0;
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}
.drawer-body-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem 1.5rem 104px; /* Extra bottom padding to clear the collapsed chat stub shifted up by 32px */
}
.drawer-footer-fixed {
    flex-shrink: 0;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg2);
}
.drawer-ticker { font-size: 2rem; font-weight: 900; margin-bottom: .5rem; }
.drawer-section { margin: 1.5rem 0; }
.drawer-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text);
    margin-bottom: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}
.drawer-sublabel {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted2);
    margin-top: 1rem;
    margin-bottom: 0.45rem;
}
.drawer-body  { font-size: .88rem; line-height: 1.6; color: var(--text); }
.drawer-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.25rem; }
.drawer-stat  { background: rgba(255,255,255,.04); border-radius: 8px; padding: .75rem; }
.drawer-stat-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: .25rem; }
.drawer-stat-val   { font-size: .82rem; line-height: 1.4; color: var(--text); font-weight: 600; }

.drawer-separator {
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.01) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.01) 100%);
    margin: 1.8rem 0;
}

.hud-step {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    line-height: 1;
    display: inline-block;
}

.alpaca-fill-shares-btn {
    background: transparent;
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 4px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.2;
}
.alpaca-fill-shares-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 8px var(--accent-glow);
}

.calc-helper-tip {
    font-size: 0.72rem;
    color: var(--muted);
    cursor: help;
    margin-left: 2px;
}
.calc-helper-tip:hover {
    color: var(--accent);
}

/* ── Update Data Button ─────────────────────────────────── */
.refresh-btn {
    display: flex; align-items: center; justify-content: center; gap: .45rem;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 0px;
    color: var(--text);
    font-size: .76rem; font-weight: 600;
    cursor: pointer;
    font-family: var(--font-mono) !important;
    transition: background .2s, border-color .2s, transform .1s;
    white-space: nowrap;
}
.refresh-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}
.refresh-btn:disabled {
    opacity: .6; cursor: not-allowed;
}

/* ── Quality Dots ───────────────────────────────────────── */
.sfc-qual-dots { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .72rem; font-weight: 600; margin-top: 2px; }
.qdot { cursor: help; white-space: nowrap; }

/* Tighten alpha canvas label */
.sfc-spark { border-radius: 4px; }

/* Playbook Ticker Badges */
.playbook-ticker-badge {
    display: inline-block;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    margin: 2px 3px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    vertical-align: middle;
}
.playbook-ticker-badge:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

/* ── Premium Playbook Banner ────────────────────────────── */
.playbook-banner {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.0rem;
    backdrop-filter: blur(16px);
}
.playbook-banner-left {
    flex: 1;
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.playbook-banner-right {
    width: 220px;
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}
.playbook-banner-right::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.15;
    z-index: 0;
}
.pb-weather-icon {
    font-size: 2.2rem;
    margin-bottom: 0.2rem;
    z-index: 1;
}
.pb-weather-label {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    z-index: 1;
}
.pb-weather-aggr {
    font-size: 0.68rem;
    color: var(--muted2);
    margin-top: 0.15rem;
    z-index: 1;
}

/* Playbook Gradients */
.pb-gradient-bull { border-left: 4px solid var(--green); }
.pb-gradient-bull .playbook-banner-right::before { background: radial-gradient(circle, var(--green) 0%, transparent 80%); }
.pb-gradient-bull .pb-weather-label { color: var(--green); }

.pb-gradient-neutral { border-left: 4px solid var(--amber); }
.pb-gradient-neutral .playbook-banner-right::before { background: radial-gradient(circle, var(--amber) 0%, transparent 80%); }
.pb-gradient-neutral .pb-weather-label { color: var(--amber); }

.pb-gradient-bear { border-left: 4px solid var(--red); }
.pb-gradient-bear .playbook-banner-right::before { background: radial-gradient(circle, var(--red) 0%, transparent 80%); }
.pb-gradient-bear .pb-weather-label { color: var(--red); }

/* ── Momentum Meter visual progress bars ────────────────── */
.momentum-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.momentum-progress-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.momentum-progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.mp-pos { background: linear-gradient(90deg, #10b981, #34d399); }
.mp-neg { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ── Position Sizer Card ───────────────────────────────── */
#sizerOutput p {
    margin-bottom: 6px;
}
#sizerOutput p:last-child {
    margin-bottom: 0;
}
.sizer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.sizer-row:last-child {
    border-bottom: none;
}
.sizer-label {
    color: var(--muted2);
    font-size: 0.76rem;
}
.sizer-val {
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}

/* ══════════════════════════════════════════════════════
   OVERHAUL STYLES — HUD, LOADER, TELEMETRY, SOUND
   ══════════════════════════════════════════════════════ */

/* Analog Console Scanline Texture */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%),
                linear-gradient(90deg, rgba(255, 0, 0, 0.015), rgba(0, 255, 0, 0.005), rgba(0, 0, 255, 0.015));
    background-size: 100% 4px, 6px 100%;
    opacity: 0.05;
    pointer-events: none;
}

/* HUD Viewport Border Frame */
.hud-frame {
    position: fixed;
    inset: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 9995;
    pointer-events: none;
}

.hud-corner {
    position: absolute;
    width: 11px;
    height: 11px;
}
.hud-tl { top: -6px; left: -6px; }
.hud-tr { top: -6px; right: -6px; }
.hud-bl { bottom: -6px; left: -6px; }
.hud-br { bottom: -6px; right: -6px; }

/* Interactive Boot Loader Sequence */
.boot-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.8s;
    font-family: 'JetBrains Mono', monospace;
}
.boot-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}
.boot-container {
    width: 380px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.boot-logo {
    font-family: var(--font-sans);
    font-size: 2.2rem;
    font-weight: 300;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #555555);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
    align-self: center;
}
.boot-title {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-align: center;
}
.boot-logs {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    height: 110px;
    padding: 10px 14px;
    font-size: 0.72rem;
    color: var(--muted2);
    overflow-y: hidden;
    line-height: 1.5;
}
.boot-log-line {
    margin-bottom: 4px;
    animation: flash 0.15s ease-out;
}
@keyframes flash {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.boot-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.boot-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}
.boot-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    transition: width 0.1s linear;
}
.boot-percent {
    font-size: 0.8rem;
    color: var(--text);
    width: 32px;
    text-align: right;
}



/* Interactive Background Matrix Canvas */
#matrixCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--bg);
}

/* Sidebar Telemetry Cell Layout */
.sidebar-telemetry {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--muted2);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tel-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 4px;
}
.tel-val {
    color: var(--text);
    font-weight: 600;
}

/* Infinite Marquee Ticker Footer */
.marquee-ticker {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: var(--bg2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    z-index: 9991;
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted2);
    pointer-events: none;
}
.marquee-content {
    display: flex;
    white-space: nowrap;
    animation: marquee 45s linear infinite;
}
.ticker-item {
    padding: 0 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}
@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-50%); }
}

/* Page Frame/Layout tweaks for bottom margin (to clear marquee height) */
/* Page Frame/Layout tweaks for bottom margin (to clear marquee height) */
.main-content {
    padding-bottom: 50px !important;
}
.sidebar {
    padding-bottom: 50px !important;
}

/* ── Phase 3: Fintech Design System Overhaul ── */

/* Force zero radius globally */
*, *::before, *::after {
    border-radius: 0px !important;
}

/* Snapping Cursor Focus Box styling */
.cursor-focus-box {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.03);
    transition: opacity 0.15s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, width, height, opacity;
    z-index: 9999;
}
.cursor-focus-box.is-visible {
    opacity: 1;
}
.focus-corner {
    position: absolute;
    width: 6px;
    height: 6px;
}
.focus-corner::before,
.focus-corner::after {
    content: "";
    position: absolute;
    background: var(--accent);
}
.focus-corner::before {
    width: 6px;
    height: 1px;
}
.focus-corner::after {
    width: 1px;
    height: 6px;
}
.focus-corner--tl { top: -3px; left: -3px; }
.focus-corner--tr { top: -3px; right: -3px; transform: rotate(90deg); }
.focus-corner--br { bottom: -3px; right: -3px; transform: rotate(180deg); }
.focus-corner--bl { bottom: -3px; left: -3px; transform: rotate(270deg); }

/* HUD frame adjustments */
.hud-frame {
    position: fixed;
    inset: 0;
    z-index: 9990;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.hud-corner {
    position: absolute;
    width: 11px;
    height: 11px;
}
.hud-tl { top: -5px; left: -5px; }
.hud-tr { top: -5px; right: -5px; }
.hud-bl { bottom: -5px; left: -5px; }
.hud-br { bottom: -5px; right: -5px; }

/* Brutalist Grid Separator Line and Junction */
.card-header, .kpi-card, .signal-item, .data-table th, .data-table td {
    position: relative;
}

/* Zero radius modifications and high-contrast typography overrides */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif !important;
    font-weight: 300 !important;
}
.page-title, .logo h2, .kpi-value, .signal-ticker, .pnl-val, .nav-icon, .pnl-card-value, .card-header h3 {
    font-family: 'Inter', sans-serif !important;
    font-weight: 300 !important; /* Lightweight for modern editorial typography */
    letter-spacing: -0.02em !important;
}
.kpi-label, .subtitle, .signal-price, .signal-logic, .data-table th, .data-table td, .tel-val, .last-run, .marquee-ticker {
    font-family: 'JetBrains Mono', monospace !important;
}

/* High contrast inputs and select */
input[type="number"], select, .search-box {
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    font-family: 'JetBrains Mono', monospace !important;
}
input[type="number"]:focus, select:focus, .search-box:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 6px var(--accent-glow) !important;
}

/* Custom styles for Circular SVG Gauges */
.gauge-svg-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mono-meter-svg {
    overflow: visible;
}
/* Monochromatic weather SVG styling */
.weather-mono-svg {
    stroke: currentColor;
    fill: none;
    vertical-align: middle;
    flex-shrink: 0;
    display: inline-block;
}
.regime-icon-span {
    display: flex;
    align-items: center;
}
/* Biggest Mover card flex layout to fill empty vertical space */
.card-body-flex {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.chart-wrap-flex {
    flex: 1;
    min-height: 180px;
    max-height: 250px;
    position: relative;
    width: 100%;
}

/* ── Mobile Toggles and Alignment (Desktop) ───────────────── */
.menu-toggle {
    display: none;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-overlay {
    display: none;
}

/* ── Mobile Responsiveness (max-width: 768px) ──────────────── */
@media (max-width: 768px) {
    /* Layout */
    .app-container {
        flex-direction: column;
        min-height: 100vh;
    }

    html, body {
        height: auto;
        overflow: visible;
    }

    /* Sidebar Drawer */
    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        width: 240px;
        height: 100vh;
        z-index: 10000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
        border-right: 1px solid var(--border);
        overflow-y: auto;
    }
    
    .sidebar.open {
        left: 0;
    }

    /* Sidebar overlay drawer backdrop */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 9999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Main Content */
    .main-content {
        width: 100%;
        padding: 1rem;
        height: auto;
        overflow-y: visible;
    }

    .signals-toolbar {
        width: 100% !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
    }
    .sig-filters {
        flex-wrap: nowrap !important;
        overflow-x: visible !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 4px !important;
    }
    .sig-filter-btn {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 5px 4px !important;
        font-size: 0.65rem !important;
        gap: 3px !important;
        justify-content: center !important;
    }
    .sig-filter-btn svg.mono-icon {
        width: 11px !important;
        height: 11px !important;
        flex-shrink: 0 !important;
    }
    .btn-label-desktop {
        display: none !important;
    }
    .btn-label-mobile {
        display: inline !important;
    }

    /* Header & Mobile Toggle button */
    header {
        position: sticky;
        top: 0;
        z-index: 500;
        background: rgba(15, 17, 21, 0.92);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1rem;
        margin-top: -1rem;
        margin-left: -1rem;
        margin-right: -1rem;
        margin-bottom: 1.25rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border);
        color: var(--text);
        cursor: pointer;
        border-radius: var(--radius-sm);
        flex-shrink: 0;
        transition: background 0.2s;
    }

    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .menu-toggle svg {
        width: 20px;
        height: 20px;
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
        overflow: hidden;
    }

    .header-left div {
        display: flex;
        flex-direction: column;
    }

    .page-title {
        font-size: 1.35rem !important;
        margin-bottom: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 600 !important;
    }

    .page-subtitle {
        display: none !important;
    }

    .header-meta {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: auto;
        justify-content: flex-end;
        flex-shrink: 0;
    }

    /* Hide health pill on mobile to save space */
    .health-pill {
        display: none !important;
    }

    /* Make buttons slightly smaller on mobile to fit header bar */
    .refresh-btn {
        padding: 6px 12px !important;
        font-size: 0.72rem !important;
    }



    /* Grid Layouts Stacked */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Playbook Banner Stacked & Compact */
    .playbook-banner {
        flex-direction: column;
    }
    
    .playbook-banner-right {
        width: 100%;
        border-top: 1px solid var(--border);
        padding: 0.6rem 1.25rem !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: left !important;
    }

    .pb-weather-label {
        font-size: 0.85rem !important;
        margin-bottom: 0 !important;
        justify-content: flex-start !important;
    }

    .pb-weather-aggr {
        font-size: 0.68rem !important;
        margin-top: 0 !important;
    }

    /* KPI strip grid layout on mobile (reclaims ~250px vertical height) */
    .kpi-strip {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        border: 1px solid var(--border) !important;
        flex-direction: unset !important;
    }

    .kpi-card {
        border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        padding: 0.75rem 0.5rem !important;
        text-align: center;
        align-items: center;
    }

    .kpi-card:nth-child(2n) {
        border-right: none !important;
    }

    .kpi-card:nth-child(5) {
        grid-column: span 2 !important;
        border-right: none !important;
        border-bottom: none !important;
    }

    /* Scrollable Cards/Tables to prevent breaking card widths */
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    #portfolio-view .data-table {
        min-width: 0 !important;
    }

    .pnl-summary {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .pnl-card {
        padding: 0.85rem 1rem !important;
    }

    .pnl-card-value {
        font-size: 1.25rem !important;
    }

    /* Fonts scale-down */
    .page-title {
        font-size: 1.6rem;
    }
    
    .page-subtitle {
        font-size: 0.8rem;
    }
}

/* ── Enhanced Thesis Details Drawer UX ── */
.drawer-calc-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(10px);
}

.drawer-calc-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.drawer-calc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.drawer-calc-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drawer-calc-group label {
    font-size: 0.7rem;
    color: var(--muted2);
    text-transform: uppercase;
}

.drawer-calc-input {
    background: #090a0f;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.drawer-calc-input:focus {
    border-color: var(--accent);
}

.drawer-calc-outputs {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.drawer-calc-out-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.drawer-calc-out-label {
    color: var(--muted2);
}

.drawer-calc-out-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
}

.drawer-calc-out-val.highlight {
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent);
}

.drawer-calc-out-val.stop {
    color: var(--red);
}

/* Moat Component Bars */
.drawer-moat-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.moat-comp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.moat-comp-name {
    color: var(--muted2);
    width: 110px;
    flex-shrink: 0;
}

.moat-comp-bar-container {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin: 0 0.75rem;
    overflow: hidden;
}

.moat-comp-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.moat-comp-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    width: 25px;
    text-align: right;
}

/* Timeline */
.drawer-timeline-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0.5rem 0.25rem 0.25rem;
    margin-top: 0.5rem;
}

.drawer-timeline-line {
    position: absolute;
    top: 15px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 0;
}

.drawer-timeline-progress {
    position: absolute;
    top: 15px;
    left: 10%;
    height: 2px;
    background: var(--accent);
    z-index: 1;
    transition: width 0.6s ease;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    width: 60px;
}

.timeline-node {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1f2026;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.35rem;
    transition: all 0.3s;
}

.timeline-step.active .timeline-node {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.timeline-step.completed .timeline-node {
    background: #ffffff;
    border-color: #ffffff;
}

.timeline-step-label {
    font-size: 0.65rem;
    color: var(--muted2);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

.timeline-step.active .timeline-step-label {
    color: #ffffff;
    font-weight: 700;
}

/* Checklist */
.drawer-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
    cursor: pointer;
    user-select: none;
    color: var(--muted2);
    transition: color 0.2s;
}

.checklist-item:hover {
    color: #ffffff;
}

.checklist-item input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── AI Advisor Chat Drawer Section ── */
.ai-advisor-chat-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05);
}

.ai-advisor-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
}

.chat-status-pulse {
    width: 6px;
    height: 6px;
    background-color: var(--green);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--green);
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ai-chat-messages {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-right: 4px;
    scroll-behavior: smooth;
}

.ai-chat-msg {
    max-width: 85%;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    animation: fadeInMsg 0.2s ease-out;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-chat-sender {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted2);
    margin-bottom: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.ai-chat-msg.user-msg {
    align-self: flex-end;
    background: rgba(147, 51, 234, 0.15); /* Purple glassmorphic */
    border: 1px solid rgba(147, 51, 234, 0.3);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.ai-chat-msg.ai-msg {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 2px;
}

/* Custom styles for terminal code elements */
.chat-code-block {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(16, 185, 129, 0.2); /* Emerald terminal tint */
    border-radius: 6px;
    padding: 0.5rem;
    margin: 0.4rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    overflow-x: auto;
    color: #a7f3d0;
}

.chat-inline-code {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 1px 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--accent);
}

.ai-chat-suggested {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.2rem;
}

.chat-suggest-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--muted2);
    font-size: 0.7rem;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-suggest-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--muted);
    color: #ffffff;
    transform: translateY(-1px);
}

.ai-chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.75rem;
}

.ai-chat-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    resize: none;
    max-height: 80px;
    font-family: inherit;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.ai-chat-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

.ai-chat-send-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.ai-chat-send-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--muted);
    color: #ffffff;
}

/* Typing Indicator Animation */
.loading-msg .ai-chat-text {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
}

.chat-dot {
    width: 4px;
    height: 4px;
    background-color: var(--muted2);
    border-radius: 50%;
    display: inline-block;
    animation: chatDotJump 1.4s infinite both;
}

.chat-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatDotJump {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.2) translateY(-2px); opacity: 1; }
}

/* Hermes Thought Process / Terminal Panel */
.hermes-thought-console {
    background: rgba(10, 10, 10, 0.75);
    border: 1px solid rgba(0, 255, 128, 0.12);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    animation: slideDownConsole 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

@keyframes slideDownConsole {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.hermes-thought-console.running {
    border-color: rgba(52, 211, 153, 0.35);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12);
}

.hermes-thought-console .console-header {
    background: rgba(20, 20, 20, 0.85);
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hermes-thought-console .console-dots {
    display: flex;
    gap: 4px;
}

.hermes-thought-console .console-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0.75;
}
.hermes-thought-console .console-dot.red { background: #ef4444; }
.hermes-thought-console .console-dot.yellow { background: #f59e0b; }
.hermes-thought-console .console-dot.green { background: #10b981; }

.hermes-thought-console .console-title {
    font-size: 0.62rem;
    color: var(--muted2);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-left: 4px;
}

.hermes-thought-console .console-chevron {
    margin-left: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--muted2);
}

.hermes-thought-console .console-body {
    padding: 8px 10px;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 120px;
    overflow-y: auto;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hermes-thought-console.collapsed .console-body {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
}

.hermes-thought-console.collapsed .console-chevron {
    transform: rotate(-90deg);
}

/* Custom scrollbar for console body */
.hermes-thought-console .console-body::-webkit-scrollbar {
    width: 4px;
}
.hermes-thought-console .console-body::-webkit-scrollbar-track {
    background: transparent;
}
.hermes-thought-console .console-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.console-line {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #e2e8f0;
    word-break: break-all;
    line-height: 1.35;
}

.console-line.system {
    color: #60a5fa; /* Blue tint for system info */
}

.console-line.tool-run {
    color: #34d399; /* Green/emerald for active tools */
}

.console-line.tool-run .spinner {
    width: 8px;
    height: 8px;
    border: 1.5px solid rgba(52, 211, 153, 0.2);
    border-top-color: #34d399;
    border-radius: 50%;
    animation: consoleSpin 0.8s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

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

.console-line.tool-done {
    color: var(--muted);
    opacity: 0.75;
}

.console-line.tool-done .badge-done {
    font-size: 0.52rem;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: auto;
}

/* Streaming Text Cursor Effect */
.streaming-cursor::after {
    content: "▋";
    color: #10b981;
    animation: blinkCursor 0.8s steps(2, start) infinite;
    font-family: monospace;
    font-size: 0.82rem;
    margin-left: 2px;
    vertical-align: middle;
}

@keyframes blinkCursor {
    to { opacity: 0; }
}

/* Alpaca Integration Styles */
.alpaca-connection-status {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideDownConsole 0.25s ease-out;
}

.alpaca-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.alpaca-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px currentColor;
}

.alpaca-status-dot.connected {
    color: #10b981;
    background-color: #10b981;
}

.alpaca-status-dot.sandbox {
    color: #f59e0b;
    background-color: #f59e0b;
}

.alpaca-account-details {
    display: flex;
    gap: 1.5rem;
}

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

.alpaca-detail-label {
    font-size: 0.6rem;
    color: var(--muted2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alpaca-detail-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: #ffffff;
}

/* Details Drawer Alpaca Panel */
.alpaca-trade-panel {
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alpaca-panel-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alpaca-panel-title svg {
    color: #10b981;
}

.alpaca-trade-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.alpaca-qty-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
    height: 36px;
}

.alpaca-qty-input {
    width: 60px;
    border: none;
    background: transparent;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    padding: 0;
}

.alpaca-qty-input:focus {
    outline: none;
}

.alpaca-qty-btn {
    background: rgba(255, 255, 255, 0.04);
    border: none;
    color: var(--muted);
    width: 24px;
    height: 100%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.alpaca-qty-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.alpaca-execute-btn {
    flex-grow: 1;
    height: 36px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(4, 120, 87, 0.12));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    color: #34d399;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.alpaca-execute-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(4, 120, 87, 0.2));
    border-color: #34d399;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.12);
    transform: translateY(-1px);
}

.alpaca-execute-btn:active:not(:disabled) {
    transform: translateY(0);
}

.alpaca-execute-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: none;
}

.alpaca-trade-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    padding: 8px 12px;
    border-radius: 6px;
    display: none;
    line-height: 1.35;
    animation: alpacaSlideDown 0.2s ease-out;
}

@keyframes alpacaSlideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.alpaca-trade-status.success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
    display: block;
}

.alpaca-trade-status.error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    display: block;
}

/* Quick Scroll & Direct Buy Buttons */
.alpaca-scroll-btn {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 4px;
    color: #10b981;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.alpaca-scroll-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.alpaca-direct-buy-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(4, 120, 87, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 6px;
    color: #10b981;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.alpaca-direct-buy-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(4, 120, 87, 0.35));
    border-color: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.alpaca-direct-buy-btn:active {
    transform: translateY(0);
}

@keyframes pulseHighlight {
    0% {
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: none;
    }
    50% {
        border-color: #10b981;
        box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    }
    100% {
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: none;
    }
}

.alpaca-trade-panel.pulse-highlight {
    animation: pulseHighlight 2s ease-in-out;
}

/* ── Momentum Meter Split Columns ────────────────────────── */
.momentum-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-top: 0.75rem;
}
.momentum-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.momentum-column-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.momentum-column-title.risers-title {
    color: var(--green);
}
.momentum-column-title.fallers-title {
    color: var(--red);
}

@media (max-width: 1024px) {
    .momentum-split-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .momentum-split-grid .data-table,
    #watchlist-view .data-table {
        min-width: 0 !important;
    }
    #watchlist-view .card-body {
        overflow: visible !important;
    }
    #watchlist-view .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }
    #watchlist-view .card-header > div:last-child {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    #watchlist-view .data-table th,
    #watchlist-view .data-table td {
        padding: 0.75rem 0.5rem;
    }
    #watchlist-view .filter-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        width: 100%;
    }
    #watchlist-view .filter-btn {
        flex: 1;
        text-align: center;
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    #watchlist-view .search-box {
        flex: 1;
        width: auto !important;
        box-sizing: border-box;
    }
}

/* ── Company Ticker Logo Styling ───────────────────────── */
.ticker-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    flex-shrink: 0;
}
.ticker-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px;
}
.ticker-logo-fallback {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.show-mobile {
    display: none !important;
}

/* ── Mobile Column Hiding (max-width: 768px) ─────────────── */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    td.show-mobile, th.show-mobile {
        display: table-cell !important;
    }
    div.show-mobile, span.show-mobile {
        display: block !important;
    }
}

/* ── Pull to Refresh ────────────────────────────────────── */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translate(-50%, 0);
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    z-index: 10000;
    pointer-events: none;
    background: rgba(24, 27, 33, 0.85); /* Matches --card with opacity */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 0 1.25rem;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.ptr-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    transition: transform 0.1s linear;
}

.ptr-icon {
    width: 100%;
    height: 100%;
    stroke: var(--text);
}

.ptr-text {
    color: var(--muted2);
}

/* Spinner class when active */
.ptr-refreshing .ptr-icon-wrap {
    animation: ptr-spin 0.8s linear infinite;
    transform: none !important;
}

@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ── Market Breadth Cockpit Grid ────────────────────────── */
.cockpit-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
}

.cockpit-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cockpit-chart-body {
    padding: 0.5rem 0.75rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 160px;
}

/* ── Credit & Yield Spread Panel ────────────────────────── */
.spread-group {
    margin-bottom: 0.5rem;
}

.spread-group-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 0.45rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.spread-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.3rem 0;
    gap: 0.5rem;
}

.spread-name {
    font-size: 0.8rem;
    color: var(--muted2);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spread-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    transition: color 0.3s;
}

.spread-value.spread-warn   { color: var(--amber); }
.spread-value.spread-danger { color: var(--red); }
.spread-value.spread-ok     { color: var(--green); }

.spread-unit {
    font-size: 0.68rem;
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
}

.spread-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0.5rem 0;
}

.spread-asof {
    font-size: 0.63rem;
    color: var(--muted);
    margin-top: 0.6rem;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Weather Details Grid ───────────────────────────────── */
.weather-details-grid {
    display: grid;
    grid-template-columns: 1.5fr 1.3fr 1.1fr;
    gap: 1.5rem;
}

.overnight-status-bar {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.overnight-status-bar.green {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: var(--green);
}
.overnight-status-bar.yellow {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--amber);
}
.overnight-status-bar.red {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--red);
}
.overnight-status-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

/* ── Investor Academy Card ──────────────────────────────── */
.academy-card {
    display: flex;
    flex-direction: column;
}
.academy-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.academy-section h4 {
    margin: 0 0 0.4rem 0;
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 600;
}
.academy-section p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted2);
    line-height: 1.5;
}
.academy-section ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.78rem;
    color: var(--muted2);
    line-height: 1.5;
}
.academy-section li {
    margin-bottom: 0.4rem;
}
.academy-section li strong {
    color: var(--text);
}
.academy-playbooks {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}
.ap-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--muted2);
    line-height: 1.4;
}
.ap-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    min-width: 55px;
    text-align: center;
}
.ap-badge.bull {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.ap-badge.neutral {
    background: rgba(245, 158, 11, 0.15);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.ap-badge.bear {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Horizontal Signal Breakdown Row ────────────────────── */
@media (min-width: 769px) {
    .signal-row .sr-body {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1.5rem;
    }
    .signal-row .sr-left {
        flex: 1.8;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    .signal-row .sr-mid {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.82rem;
        color: var(--text);
    }
    .signal-row .sr-right {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        text-align: right;
        font-size: 0.78rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .signal-row .sr-name {
        margin-bottom: 0;
    }
    .signal-row .sr-what {
        margin-bottom: 0;
    }
}

/* ── Mobile Fallbacks for Signal Breakdown & Weather View ── */
@media (max-width: 768px) {
    .signal-row .sr-body {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    .signal-row .sr-mid {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.82rem;
        color: var(--text);
        margin-bottom: 0;
    }
    .signal-row .sr-right {
        font-size: 0.78rem;
        font-style: italic;
        line-height: 1.4;
    }
    
    /* Weather View Gauge Responsiveness */
    .mobile-title, .mobile-text {
        display: inline !important;
    }
    .desktop-title, .desktop-text {
        display: none !important;
    }
    #regime-view .grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.25rem !important;
        background: var(--card) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius) !important;
        backdrop-filter: blur(12px) !important;
        padding: 0.85rem 0.4rem !important;
        position: relative !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    }
    #regime-view .grid-4::before {
        content: '+';
        position: absolute;
        top: -5px;
        left: -4px;
        font-family: 'JetBrains Mono', monospace;
        font-size: 10px;
        color: rgba(255, 255, 255, 0.3);
        z-index: 10;
        line-height: 1;
    }
    #regime-view .grid-4::after {
        content: '+';
        position: absolute;
        top: -5px;
        right: -4px;
        font-family: 'JetBrains Mono', monospace;
        font-size: 10px;
        color: rgba(255, 255, 255, 0.3);
        z-index: 10;
        line-height: 1;
    }
    #regime-view .gauge-card {
        background: transparent !important;
        border: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        transform: none !important;
    }
    #regime-view .gauge-card::before,
    #regime-view .gauge-card::after {
        display: none !important;
    }
    #regime-view .gauge-card:hover {
        transform: none !important;
        background: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }
    #regime-view .gauge-card .card-header {
        padding: 0 0 0.4rem 0 !important;
        border-bottom: none !important;
        justify-content: center !important;
        background: transparent !important;
    }
    #regime-view .gauge-body {
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        background: transparent !important;
    }
    #regime-view .gauge-card h3 {
        font-size: 0.62rem !important;
        font-weight: 600 !important;
        color: var(--muted2) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        margin: 0 !important;
        text-align: center !important;
        white-space: nowrap !important;
    }
    #regime-view .gauge-card .info-icon {
        display: none !important;
    }
    #regime-view .gauge-wrap {
        width: 100% !important;
        max-width: 90px !important;
        height: auto !important;
        aspect-ratio: 120 / 90 !important;
        margin: 0 auto !important;
    }
    #regime-view .gauge-label {
        font-size: 0.65rem !important;
        line-height: 1.3 !important;
        margin-top: 0.35rem !important;
        text-align: center !important;
        color: var(--text) !important;
        font-family: 'JetBrains Mono', monospace !important;
        font-weight: 500 !important;
        width: 100% !important;
    }
    #regime-view .gauge-label .lbl-part {
        display: block !important;
        font-size: 0.6rem !important;
        color: var(--muted2) !important;
    }
    #regime-view .gauge-label .lbl-sep {
        display: none !important;
    }
    #regime-view .gauge-label .lbl-val {
        display: block !important;
        font-size: 0.68rem !important;
        font-weight: 600 !important;
        color: var(--text) !important;
        margin-top: 2px !important;
    }
    #regime-view .gauge-desc {
        display: none !important;
    }
}

/* ── Media Query for Stacking Weather Details Grid ────────── */
@media (max-width: 1200px) {
    .weather-details-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }
    .academy-card {
        grid-column: span 2;
    }
    .cockpit-grid {
        grid-template-columns: 1fr 1fr;
    }
    .cockpit-grid .cockpit-card:first-child {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .weather-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .academy-card {
        grid-column: span 1;
    }
    .overnight-card .data-table {
        min-width: 0 !important;
    }
    .overnight-card .data-table th,
    .overnight-card .data-table td {
        padding: 0.5rem 0.4rem !important;
        font-size: 0.78rem !important;
    }
    .cockpit-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .cockpit-grid .cockpit-card:first-child {
        grid-column: span 1;
    }
    .cockpit-chart-body {
        min-height: 140px;
    }
}

/* ── Academy Card SVG Icon styling ── */
.academy-icon {
    width: 16px;
    height: 16px;
    stroke: var(--accent);
    vertical-align: -2px;
    margin-right: 8px;
    display: inline-block;
}

/* ── Floating value overlay inside sparkline ── */
.sfc-spark-wrap {
    position: relative;
    height: 40px;
}
.sfc-spark-val {
    position: absolute;
    top: 4px;
    right: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    pointer-events: none;
    background: rgba(24, 27, 33, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sfc-spark-val.pos {
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.05);
}
.sfc-spark-val.neg {
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.05);
}

/* ── Multi-User Authentication Styles ── */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 10, 15, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: rgba(20, 24, 33, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    animation: authFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent, #3b82f6) 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-card p {
    font-size: 0.85rem;
    color: var(--muted2, #9ca3af);
    margin-bottom: 2rem;
}

.auth-card .form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.auth-card .form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted2, #9ca3af);
    margin-bottom: 0.5rem;
}

.auth-card .form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.auth-card .form-group input:focus {
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    color: #f87171;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    text-align: left;
    display: flex;
    align-items: center;
}

.auth-btn {
    width: 100%;
    background: var(--accent, #3b82f6);
    color: #0f1115; /* Dark charcoal text for high contrast readability on white background */
    border: none;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.auth-btn:hover {
    background: #2563eb;
    color: #ffffff; /* Transition to white text as background becomes blue */
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
    background: #1d4ed8;
    color: #ffffff;
}

.auth-switch {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--muted2, #9ca3af);
}

.auth-switch a {
    color: var(--accent, #3b82f6);
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.25rem;
    transition: color 0.2s;
}

.auth-switch a:hover {
    color: #2563eb;
}

/* User Profile Badge in Sidebar */
.user-profile {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent, #3b82f6) 0%, #1e40af 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--muted2, #9ca3af);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--muted2, #9ca3af);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
}

/* Watchlist checklists & buttons */
.admin-watchlist-checklist {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.5rem;
    text-align: left;
    margin-top: 0.5rem;
}

.admin-watchlist-checklist::-webkit-scrollbar {
    width: 6px;
}

.admin-watchlist-checklist::-webkit-scrollbar-track {
    background: transparent;
}

.admin-watchlist-checklist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.admin-watchlist-checklist::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s ease;
    cursor: pointer;
    font-size: 0.82rem;
    color: #e5e7eb;
}

.checklist-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.checklist-item input[type="checkbox"] {
    margin-right: 0.75rem;
    accent-color: var(--accent, #3b82f6);
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.checklist-item-ticker {
    font-weight: 700;
    color: var(--accent, #3b82f6);
    margin-right: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    min-width: 45px;
}

.checklist-item-reason {
    color: var(--muted2, #9ca3af);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    flex: 1;
}

.remove-watchlist-btn {
    background: none;
    border: none;
    color: var(--muted2, #9ca3af);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
}

.remove-watchlist-btn:hover {
    color: var(--red, #ef4444);
    background: rgba(239, 68, 68, 0.15);
    opacity: 1;
    transform: scale(1.08);
}

.remove-watchlist-btn:active {
    transform: scale(0.95);
}

/* Collapsible AI Advisor Chat Panel */
.ai-advisor-chat-panel {
    position: absolute;
    bottom: 32px; /* Offset up by 32px to clear the fixed rolling marquee ticker tape */
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(10, 11, 13, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}

.ai-advisor-chat-panel.expanded {
    height: calc(100% - var(--header-height, 110px) - 32px); /* Offset expanded height by 32px to clear ticker tape at bottom */
    top: var(--header-height, 110px);
}

.chat-drag-handle {
    height: 52px;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid transparent;
    user-select: none;
    flex-shrink: 0;
}

.ai-advisor-chat-panel.expanded .chat-drag-handle {
    border-bottom-color: var(--border);
}

.chat-drag-bar {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-bottom: 6px;
    margin-top: 4px;
}

.chat-drag-handle:hover .chat-drag-bar {
    background: rgba(255, 255, 255, 0.4);
}

.chat-stub-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--muted2);
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
}

.chat-chevron {
    margin-left: auto;
    color: var(--muted2);
    transition: transform 0.3s ease;
}

.ai-advisor-chat-panel.expanded .chat-chevron {
    transform: rotate(180deg);
}

.chat-expanded-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem 1.5rem;
    overflow: hidden;
}

.ai-advisor-chat-panel .ai-advisor-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-top: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    overflow: hidden;
}

.ai-advisor-chat-panel .ai-chat-messages {
    flex: 1;
    max-height: none;
    overflow-y: auto;
}

/* Visibility classes */
.ai-advisor-chat-panel.collapsed .expanded-only {
    display: none !important;
}

.ai-advisor-chat-panel.expanded .collapsed-only {
    display: none !important;
}

/* Chat Stub Bouncing and Glowing Animations */
@keyframes chat-stub-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
        box-shadow: 0 -12px 24px rgba(6, 182, 212, 0.25);
        border-top-color: rgba(6, 182, 212, 0.45);
    }
}

.ai-advisor-chat-panel.collapsed.bounce {
    animation: chat-stub-bounce 0.8s ease-in-out 3;
}

.ai-advisor-chat-panel.collapsed {
    border-top: 1px solid rgba(6, 182, 212, 0.2);
    box-shadow: 0 -4px 16px rgba(6, 182, 212, 0.08);
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.ai-advisor-chat-panel.collapsed:hover {
    border-top-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 -6px 20px rgba(6, 182, 212, 0.2);
    background: rgba(14, 16, 20, 0.95);
}

.chat-drag-handle:hover .chat-chevron {
    transform: translateY(-2px);
    color: var(--cyan) !important;
}

.ai-advisor-chat-panel.expanded .chat-drag-handle:hover .chat-chevron {
    transform: rotate(180deg) translateY(-2px);
    color: var(--cyan) !important;
}

/* Bouncing downward arrow animation for prominent minimize pill */
@keyframes bounce-slow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(4px);
    }
}

.chat-minimize-pill div {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--cyan) !important;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}

.chat-minimize-pill div:hover {
    color: #ffffff !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* ── Sticky Watchlist Toolbar & Header ─────────────────── */
#watchlist-view .card-header {
    position: sticky;
    top: var(--header-h, 72px);
    z-index: 90;
    background: var(--card); /* Ensure solid background overlay */
    border-bottom: 1px solid var(--border);
}

.watchlist-table th {
    position: sticky;
    top: calc(var(--header-h, 72px) + var(--watchlist-header-h, 54px) - 1px);
    z-index: 89;
    background: var(--card); /* Ensure solid background overlay */
}


