/* === BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: clip; }

:root, [data-theme="dark"] {
    --bg: #101e36;
    --bg-card: #142642;
    --bg-hover: #1a3050;
    --border: #243a5c;
    --text: #c8cad0;
    --text-dim: #7a90b0;
    --green: #4dc465;
    --green-dim: #2d8c48;
    --red: #de5f58;
    --red-dim: #c34843;
    --yellow: #d09f34;
    --blue: #64abf6;
    --purple: #aa8ff2;
    --th-bg: #142642;
    --th-text: #c8cad0;
    --signal-bull-pb-bg: #0f2a1a;
    --signal-bull-pb-border: var(--green-dim);
    --signal-breakdown-bg: #2a1f0f;
    --signal-breakdown-border: #6d4e00;
    --signal-unstacked-bull-bg: #0f2a1a;
    --signal-unstacked-bull-text: #86e294;
    --signal-unstacked-bull-border: #1a3a2a;
    --signal-bear-rally-bg: #2a0f0f;
    --signal-unstacked-bear-bg: #2a0f0f;
    --signal-unstacked-bear-text: #f07f8a;
    --signal-unstacked-bear-border: #3a1a1a;
}

[data-theme="light"] {
    --bg: #f6f8fa;
    --bg-card: #ffffff;
    --bg-hover: #f0f3f6;
    --border: #d0d7de;
    --text: #1f2328;
    --text-dim: #656d76;
    --green: #1a7f37;
    --green-dim: #2da44e;
    --red: #cf222e;
    --red-dim: #d1242f;
    --yellow: #9a6700;
    --blue: #0969da;
    --purple: #8250df;
    --th-bg: #eaeef2;
    --th-text: #1f2328;
    --signal-bull-pb-bg: #dafbe1;
    --signal-bull-pb-border: #2da44e;
    --signal-breakdown-bg: #fff8c5;
    --signal-breakdown-border: #9a6700;
    --signal-unstacked-bull-bg: #dafbe1;
    --signal-unstacked-bull-text: #1a7f37;
    --signal-unstacked-bull-border: #a7d8b0;
    --signal-bear-rally-bg: #ffebe9;
    --signal-unstacked-bear-bg: #ffebe9;
    --signal-unstacked-bear-text: #cf222e;
    --signal-unstacked-bear-border: #f0b8b8;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Animated gradient mesh background */
.bg-mesh {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.bg-mesh .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.55;
    animation: drift 20s ease-in-out infinite;
}
.orb-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, #2563eb, transparent 65%);
    top: -10%; left: -10%;
}
.orb-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #7c3aed, transparent 65%);
    top: 40%; right: -15%;
    animation-delay: -7s;
    animation-duration: 25s;
}
.orb-3 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #f97316, transparent 65%);
    bottom: -10%; left: 30%;
    animation-delay: -14s;
    animation-duration: 22s;
    opacity: 0.4;
}
@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 40px) scale(0.95); }
    75% { transform: translate(30px, 20px) scale(1.02); }
}
.noise {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}
/* Ensure all content sits above the mesh */
main, footer { position: relative; z-index: 2; }
[data-theme="light"] .bg-mesh { opacity: 0.15; }
[data-theme="light"] .noise { opacity: 0.5; }

/* === HEADER === */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 100;
}

header {
    background: rgba(20, 38, 66, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.5rem 2rem 1rem;
    position: relative;
}

header::after {
    content: '';
    display: block;
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.4), transparent);
    margin-top: 0.75rem;
}

[data-theme="light"] header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom-color: var(--border);
}

[data-theme="light"] header::after {
    background: linear-gradient(90deg, transparent, rgba(9, 105, 218, 0.3), transparent);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #f8f9fb 0%, #64abf6 50%, #38c775 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .header-content h1 {
    background: linear-gradient(135deg, #1f2328 0%, #0969da 50%, #1a7f37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === BACK LINK === */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--blue);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 1px;
    white-space: nowrap;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(20, 38, 66, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.back-link:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--blue);
    transform: translateY(-1px);
}

[data-theme="light"] .back-link {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border);
}

/* === THEME TOGGLE === */
.theme-toggle {
    background: rgba(20, 38, 66, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.theme-toggle:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--blue);
    transform: translateY(-1px);
}

[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border);
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.data-date {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.6rem;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.7rem;
}

.data-date::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 2.5s ease-in-out infinite;
}

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

/* Pill badges */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pill strong {
    font-weight: 700;
}

.pill-detail {
    opacity: 0.7;
    font-size: 0.6rem;
}

.pill-date {
    background: rgba(88, 166, 255, 0.1);
    border-color: rgba(88, 166, 255, 0.2);
    color: var(--blue);
}

.pill-count {
    background: rgba(88, 166, 255, 0.08);
    border-color: rgba(88, 166, 255, 0.15);
    color: var(--blue);
}

.pill-spy {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
    color: #38c775;
}

.pill-qqq {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.25);
    color: #ac6af1;
}

.pill-btc {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.25);
    color: #f07f2e;
}

.pill-vix-low {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
    color: #38c775;
}

.pill-vix-mid {
    background: rgba(210, 153, 34, 0.1);
    border-color: rgba(210, 153, 34, 0.25);
    color: #d09f34;
}

.pill-vix-high {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.25);
    color: #f07f2e;
}

.pill-vix-extreme {
    background: rgba(229, 83, 75, 0.12);
    border-color: rgba(229, 83, 75, 0.3);
    color: #de5f58;
}

.pill-bull {
    background: rgba(63, 185, 80, 0.12);
    border-color: rgba(63, 185, 80, 0.3);
    color: #38c775;
    margin-left: auto;
}

.pill-bear {
    background: rgba(229, 83, 75, 0.12);
    border-color: rgba(229, 83, 75, 0.3);
    color: #de5f58;
    margin-left: auto;
}

.pill-neutral {
    background: rgba(210, 153, 34, 0.1);
    border-color: rgba(210, 153, 34, 0.25);
    color: #d09f34;
    margin-left: auto;
}

/* === TAB BAR === */
.tab-bar {
    display: flex;
    gap: 0;
    background: rgba(20, 38, 66, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

[data-theme="light"] .tab-bar {
    background: rgba(255, 255, 255, 0.75);
    border-bottom-color: var(--border);
}

.tab {
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.tab.active {
    color: #fff;
    border-bottom-color: var(--blue);
    background: rgba(88, 166, 255, 0.06);
}

[data-theme="light"] .tab.active {
    color: var(--text);
    background: rgba(9, 105, 218, 0.06);
}


/* === MAIN === */
main {
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
}

.tab-content { display: none; }
.tab-content.active { display: block; }


/* === CARDS === */
.card {
    background: rgba(20, 38, 66, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s;
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--border);
}

[data-theme="light"] .card:hover {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.card h3 {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.card p {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* === TOOLBAR (SEARCH + FILTERS) === */
.toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

/* Ticker search wrapper */
.ticker-search-wrap {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 6px;
    min-width: 200px;
    max-width: 400px;
    transition: border-color 0.15s;
}

.ticker-search-wrap:focus-within {
    border-color: var(--blue);
}

.ticker-chips {
    display: contents;
}

.ticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--blue);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.chip-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    margin-left: 1px;
}

.chip-remove:hover {
    color: #fff;
}

.search-input {
    background: transparent;
    border: none;
    padding: 0.3rem 0.2rem;
    color: var(--text);
    font-size: 0.8rem;
    flex: 1;
    min-width: 80px;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-dim);
}

/* Ticker autocomplete dropdown */
.ticker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.ticker-option {
    padding: 6px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-option:hover {
    background: var(--bg-hover);
}

.ticker-option strong {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.8rem;
    min-width: 50px;
}

.ticker-option span {
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    color: var(--text);
    font-size: 0.78rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.filter-select:focus {
    border-color: var(--blue);
}

/* Multi-select dropdown */
.multi-select {
    position: relative;
    display: inline-block;
}

.multi-select-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    color: var(--text);
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.multi-select-btn:hover,
.multi-select.open .multi-select-btn {
    border-color: var(--blue);
}

.multi-select-badge {
    background: var(--blue);
    color: #fff;
    font-size: 0.65rem;
    padding: 0 5px;
    border-radius: 3px;
    font-weight: 600;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 0;
    z-index: 100;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.multi-select.open .multi-select-dropdown {
    display: block;
}

.multi-select-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: background 0.1s;
}

.multi-select-item:hover {
    background: var(--bg-hover);
}

.multi-select-item input[type="checkbox"] {
    accent-color: var(--blue);
}

.multi-select-clear {
    display: block;
    padding: 5px 10px;
    font-size: 0.7rem;
    color: var(--blue);
    cursor: pointer;
    border-top: 1px solid var(--border);
    margin-top: 2px;
    text-align: center;
}

.multi-select-clear:hover {
    background: var(--bg-hover);
}

.filter-count {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-left: auto;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

/* === TABLES === */
.table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(20, 38, 66, 0.3);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
}

[data-theme="light"] .table-wrap {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border);
}

/* Scroll fade hints */
.table-wrap::after {
    content: "";
    position: sticky;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    pointer-events: none;
    background: linear-gradient(to left, var(--bg-card), transparent);
    display: block;
    float: right;
    margin-top: -100%;
    height: 100%;
}

.table-wrap.scrolled-end::after { display: none; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    white-space: nowrap;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

th {
    background: var(--th-bg);
    color: var(--th-text);
    font-weight: 700;
    text-align: center;
    padding: 0.55rem 0.5rem;
    border-bottom: 2px solid var(--blue);
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

th:hover { color: var(--text); }
th.sorted-asc::after { content: " ↑"; font-size: 0.65rem; }
th.sorted-desc::after { content: " ↓"; font-size: 0.65rem; }

td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

tr:hover td { background: var(--bg-hover); }

/* Numeric cells */
.num {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.75rem;
    text-align: right;
}

/* Truncate long stock names */
.name-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === SIGNAL BADGES === */
.signal {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.signal-full-bull       { background: var(--green-dim); color: #fff; }
.signal-bull-pullback   { background: var(--signal-bull-pb-bg); color: var(--green); border: 1px solid var(--signal-bull-pb-border); }
.signal-bull-breakdown  { background: var(--signal-breakdown-bg); color: var(--yellow); border: 1px solid var(--signal-breakdown-border); }
.signal-bullish-unstacked { background: var(--signal-unstacked-bull-bg); color: var(--signal-unstacked-bull-text); border: 1px solid var(--signal-unstacked-bull-border); }
.signal-full-bear       { background: var(--red-dim); color: #fff; }
.signal-bear-rally      { background: var(--signal-bear-rally-bg); color: var(--red); border: 1px solid var(--red-dim); }
.signal-bearish-unstacked { background: var(--signal-unstacked-bear-bg); color: var(--signal-unstacked-bear-text); border: 1px solid var(--signal-unstacked-bear-border); }

/* === VOLUME QUALITY BADGES === */
.vol-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.vol-low { background: var(--signal-bull-pb-bg); color: var(--green); border: 1px solid var(--green-dim); }
.vol-high { background: var(--signal-breakdown-bg); color: var(--yellow); border: 1px solid var(--signal-breakdown-border); }
.vol-normal { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.25); }

/* === COLOR UTILITIES === */
.pos { color: var(--green); }
.neg { color: var(--red); }
.neutral { color: var(--text-dim); }

/* === SECTOR BAR === */
.sector-bar {
    display: inline-block;
    height: 14px;
    border-radius: 2px;
    vertical-align: middle;
}

.sector-bar.bull { background: var(--green-dim); }
.sector-bar.bear { background: var(--red-dim); }

/* === STRATEGY NOTES === */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
}

.note-item {
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(16, 30, 54, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-left: 3px solid var(--border);
    font-size: 0.82rem;
}

[data-theme="light"] .note-item {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--border);
}

.note-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.note-item.bull { border-left-color: var(--green); }
.note-item.bear { border-left-color: var(--red); }
.note-item.caution { border-left-color: var(--yellow); }
.note-item.alert { border-left-color: var(--blue); }

/* === NEWS DRIVERS === */
.news-drivers-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}
.news-drivers-list li {
    padding: 8px 0 8px 16px;
    border-left: 3px solid var(--blue);
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* === DASHBOARD STATS === */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(16, 30, 54, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    flex: 1;
    min-width: 140px;
    text-align: center;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s,
                border-color 0.3s;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    opacity: 0.4;
}

.stat-box:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .stat-box {
    background: rgba(255, 255, 255, 0.6);
    border-color: var(--border);
}

[data-theme="light"] .stat-box:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.stat-box .risk-bar-wrap {
    margin-top: auto;
}

.stat-box .value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.stat-box .label {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

/* === ALERT TEXT === */
.alert-text {
    font-size: 0.75rem;
    white-space: normal;
    max-width: 400px;
    line-height: 1.5;
}

.alert-bull { color: var(--green); }
.alert-bear { color: var(--red); }

/* === AI SUMMARY META === */
.summary-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-style: italic;
    margin-top: 0.5rem;
}

/* === INDEX CONTEXT === */
.index-context-card {
    border-left: 3px solid var(--blue);
}

/* === FOOTER === */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 2rem;
}

[data-theme="light"] footer {
    border-top-color: var(--border);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    header { padding: 1rem; }
    main { padding: 1rem; }
    .stats-row { flex-direction: column; }
    .stat-box { min-width: 100%; }
    .notes-grid { grid-template-columns: 1fr; }
    .tab { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
}
