:root {
    --bg:          #0d1117;
    --card:        #161b22;
    --subtle-bg:   #21262d;
    --border:      #30363d;
    --text:        #c9d1d9;
    --dim:         #8b949e;
    --blue:        #58a6ff;
    --green:       #3fb950;
    --red:         #f85149;
    --yellow:      #d29922;
    --zebra-odd:   #10141a;
    --zebra-even:  #101114;
    --theme-transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;

    /* z-index scale — every overlay layer references one of these tokens
       instead of a hand-picked magic number. Order: base < raised < dropdown
       < sticky-header < floating-button < modal-backdrop < modal < toast.
       Anything outside this scale is a bug. */
    --z-base:           1;
    --z-raised:         2;
    --z-dropdown:       10;
    --z-sticky-header:  100;
    --z-sidebar:        1000;
    --z-floating-btn:   1001;
    --z-modal:          2000;
    --z-toast:          3000;
}

body.light-mode {
    --bg:          #ffffff;
    --card:        #f6f8fa;
    --subtle-bg:   #eaeef2;
    --border:      #d0d7de;
    --text:        #24292f;
    --dim:         #57606a;
    --blue:        #0969da;
    --green:       #1a7f37;
    --red:         #cf222e;
    --yellow:      #9a6700;
    --zebra-odd:   #f6f8fa;
    --zebra-even:  #ffffff;
}

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

/* ===========================================
   Global scrollbar — floating overlay style
   (matches the sidebar nav). Track always reserved so layout never
   shifts; thumb is invisible at rest and fades in to --border when
   the scrollable element is hovered or focus-within. Brightens to
   --dim when the thumb itself is hovered.
   =========================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
*:hover, *:focus-within {
    scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background-color 0.25s ease;
}
*:hover::-webkit-scrollbar-thumb,
*:focus-within::-webkit-scrollbar-thumb {
    background-color: var(--border);
}
*::-webkit-scrollbar-thumb:hover {
    background-color: var(--dim) !important;
}
*::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    transition: var(--theme-transition);
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--card);
    border-right: 1px solid var(--border);
    transition: width 0.3s ease, var(--theme-transition);
    position: fixed;
    height: 100vh;
    z-index: var(--z-sidebar);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    /* Scrollbar styling is supplied by the global rule near the top of
       this file, so it stays consistent with every other scroll
       container on the site. */
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
}

.theme-toggle:hover {
    background-color: var(--subtle-bg);
    border-color: var(--blue);
}

.theme-toggle:active {
    transform: scale(0.94);
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 12px 5px;
}

/* Donate button — always expanded: "☕ Donate" always visible. */
.donate-toggle {
    margin-left: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}

.donate-toggle .donate-icon {
    font-size: 18px;
}

.donate-toggle .donate-label {
    font-size: 14px;
    font-weight: 600;
}

.donate-toggle:hover,
.donate-toggle:focus-visible {
    background-color: var(--subtle-bg);
    border-color: var(--blue);
    outline: none;
}

.donate-toggle:active { transform: scale(0.97); }

/* When the sidebar is collapsed, hide the label so the button fits. */
.sidebar.collapsed .donate-toggle {
    padding: 0;
    width: 38px;
    justify-content: center;
}
.sidebar.collapsed .donate-toggle .donate-label {
    display: none;
}

/* Christmas settings cog (only rendered on 12-25). Mirrors the theme
   toggle's pill shape so the footer reads as a row of equal chips. */
.settings-toggle {
    margin-left: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.settings-toggle:hover,
.settings-toggle:focus-visible {
    background-color: var(--subtle-bg);
    border-color: var(--blue);
    outline: none;
}
.settings-toggle:active { transform: scale(0.94); }

/* One-line toggle row inside the settings modal. */
.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
}
.settings-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--blue);
}

/* ===========================================
   Snow overlay (Christmas only — markup is only emitted on 12-25)
   =========================================== */
.snow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}
.flake {
    position: absolute;
    top: -12px;
    border-radius: 50%;
    background: #fff;
    /* Both keyframes only animate transform/opacity so the work stays
       on the GPU compositor — main-thread activity (mouse moves, hover
       transitions, scripts) cannot affect the animation. */
    animation:
        flake-fall var(--fall-dur, 9s) linear infinite,
        flake-sway var(--sway-dur, 3s) ease-in-out infinite alternate;
    animation-delay: var(--fall-delay, 0s), var(--sway-delay, 0s);
    will-change: transform, opacity;
}
[data-theme="light"] .flake,
.light-mode .flake {
    background: #6c7d99;
    opacity: 0.6;
}
@keyframes flake-fall {
    0%   { transform: translate3d(0, 0,     0); opacity: 0; }
    8%   {                                       opacity: var(--alpha, 0.85); }
    92%  {                                       opacity: var(--alpha, 0.85); }
    100% { transform: translate3d(0, 110vh, 0); opacity: 0; }
}
@keyframes flake-sway {
    from { margin-left: calc(-1 * var(--sway-amp, 12px)); }
    to   { margin-left: var(--sway-amp, 12px); }
}
@media (prefers-reduced-motion: reduce) {
    .snow { display: none; }
}

/* ===========================================
   New Year fireworks (markup only emitted on 01-01; the JS gates
   playback further with a 30-day "seen this year" cookie).
   All animation is on transform/opacity so it runs on the GPU
   compositor and isn't affected by main-thread activity.
   =========================================== */
.fireworks {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 10000;
}
.fw-burst {
    position: absolute;
}
.fw-rocket {
    position: absolute;
    left: -2px;
    top: 0;
    width: 4px;
    height: 30px;
    border-radius: 999px;
    background: linear-gradient(0deg, transparent 0%, #ffd56a 65%, #ffffff 100%);
    box-shadow: 0 0 8px 1px #ffd56a, 0 0 18px 3px rgba(255, 170, 63, 0.6);
    transform: translate3d(0, var(--rocket-from, 70vh), 0);
    opacity: 0;
    animation: fw-rocket-up var(--rocket-dur, 0.85s) cubic-bezier(.6, .1, .9, .35) forwards;
    will-change: transform, opacity;
}
@keyframes fw-rocket-up {
    0%   { transform: translate3d(0, var(--rocket-from, 70vh), 0); opacity: 0; }
    10%  { opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translate3d(0, 0, 0); opacity: 0; }
}
.fw-flash {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 0%, var(--c, #fff) 22%, rgba(255,255,255,0) 70%);
    transform: scale(0.3);
    opacity: 0;
    animation: fw-flash 0.55s ease-out var(--rocket-dur, 0.85s) forwards;
    will-change: transform, opacity;
}
@keyframes fw-flash {
    0%   { opacity: 0; transform: scale(0.3); }
    20%  { opacity: 1; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(2.6); }
}
.fw-spark {
    position: absolute;
    left: -1.5px;
    top: -18px;
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(0deg, rgba(255,255,255,0) 0%, var(--c, #fff) 65%, #ffffff 100%);
    box-shadow: 0 0 6px var(--c, #fff), 0 0 14px var(--c, #fff);
    transform-origin: 50% 100%;
    transform: rotate(var(--angle, 0deg)) translateY(0) scaleY(0.4);
    opacity: 0;
    animation: fw-spark-fly var(--dur, 1.6s) cubic-bezier(.15, .9, .35, 1) var(--rocket-dur, 0.85s) forwards;
    will-change: transform, opacity;
}
@keyframes fw-spark-fly {
    0%   { transform: rotate(var(--angle, 0deg)) translateY(0)                                   scaleY(0.4); opacity: 0; }
    7%   { transform: rotate(var(--angle, 0deg)) translateY(calc(-0.15 * var(--dist, 200px)))    scaleY(1.5); opacity: 1; }
    60%  { opacity: 1; }
    100% { transform: rotate(var(--angle, 0deg)) translateY(calc(-1 * var(--dist, 200px)))       scaleY(0.18); opacity: 0; }
}
.fw-message {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10001;
}
.fw-message-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(2.5rem, 10vw, 8rem);
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: center;
    background: linear-gradient(120deg, #ffd56a 0%, #ffeb6f 25%, #ff8a3f 50%, #ffeb6f 75%, #ffd56a 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 28px rgba(255, 170, 63, 0.7))
            drop-shadow(0 0 60px rgba(255, 95, 95, 0.35));
    opacity: 0;
    transform: scale(0.6);
    will-change: transform, opacity, background-position;
    animation:
        fw-message-pop     3.6s cubic-bezier(.2, .9, .25, 1) 5.4s forwards,
        fw-message-shimmer 2.6s linear                       5.4s infinite;
}
@keyframes fw-message-pop {
    0%   { opacity: 0; transform: scale(0.6); }
    16%  { opacity: 1; transform: scale(1.06); }
    28%  { opacity: 1; transform: scale(1); }
    72%  { opacity: 1; transform: scale(1.03); }
    100% { opacity: 0; transform: scale(1.2); }
}
@keyframes fw-message-shimmer {
    0%   { background-position:   0% 0%; }
    100% { background-position: 220% 0%; }
}
@media (prefers-reduced-motion: reduce) {
    .fireworks { display: none; }
}

/* ===========================================
   Easter rain (markup only emitted on Easter Sunday; the JS gates
   playback further with a 30-day "seen this year" cookie).
   Outer element handles fall + sway (positional), inner element
   handles wobble rotation — kept on separate elements so neither
   animation stomps the other's `transform`.
   =========================================== */
.easter-rain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 10000;
}
.easter-emoji {
    position: absolute;
    top: -60px;
    animation:
        easter-fall var(--fall-dur, 5s) linear forwards,
        easter-sway var(--sway-dur, 2s) ease-in-out infinite alternate;
    animation-delay: 0s, var(--sway-delay, 0s);
    will-change: transform, opacity;
}
.easter-emoji-inner {
    display: block;
    line-height: 1;
    font-size: var(--size, 32px);
    transform-origin: 50% 50%;
    animation: easter-wobble var(--wobble-dur, 1.5s) ease-in-out infinite alternate;
    animation-delay: var(--wobble-delay, 0s);
    will-change: transform;
}
@keyframes easter-fall {
    0%   { transform: translateY(0);     opacity: 0; }
    6%   {                                opacity: 1; }
    94%  {                                opacity: 1; }
    100% { transform: translateY(112vh); opacity: 0; }
}
@keyframes easter-sway {
    from { margin-left: calc(-1 * var(--sway-amp, 25px)); }
    to   { margin-left: var(--sway-amp, 25px); }
}
@keyframes easter-wobble {
    from { transform: rotate(calc(-1 * var(--wobble-amp, 14deg))); }
    to   { transform: rotate(var(--wobble-amp, 14deg)); }
}
@media (prefers-reduced-motion: reduce) {
    .easter-rain { display: none; }
}

/* Donate modal (opened by clicking the donate button) */
.donate-modal[hidden] { display: none; }

.donate-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.donate-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
}

.donate-modal-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 28px 32px 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    animation: donateModalIn 0.15s ease-out;
}

@keyframes donateModalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.donate-modal-card h2 {
    color: var(--blue);
    margin: 0 0 8px;
    font-size: 20px;
}

.donate-modal-card p {
    color: var(--dim);
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.45;
}

.donate-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: 0;
    color: var(--dim);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.donate-modal-close:hover {
    color: var(--text);
    background: var(--subtle-bg);
}

.donate-modal-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.donate-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.donate-option:hover {
    background: var(--bg);
    transform: translateY(-1px);
}

.donate-option .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.donate-option-bmac:hover   { border-color: #ffdd00; }
.donate-option-paypal:hover { border-color: #0070ba; }

.sidebar.collapsed {
    width: 1cm;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    min-height: 60px;
}

.sidebar-header h2 {
    font-size: 18px;
    color: var(--blue);
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 5px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header h2 {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background-color: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    flex-shrink: 0;
    min-width: 30px;
}

.sidebar-toggle:hover {
    color: var(--blue);
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    /* nav-items are <button>s now — strip native button chrome so they look
       like the original divs while remaining keyboard-focusable. */
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    width: 100%;

    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-item:hover {
    background-color: var(--subtle-bg);
}

.nav-item:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

.nav-item.active {
    background-color: var(--subtle-bg);
    border-left-color: var(--blue);
    color: var(--blue);
}

.nav-hidden {
    display: none;
}

.nav-text {
    flex: 1;
}

.nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    margin-left: 10px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item {
    padding: 12px 5px;
    justify-content: center;
}

.sidebar.collapsed .nav-text {
    font-size: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-icon {
    margin-left: 0;
}

.nav-section-label {
    padding: 22px 20px 10px;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);
}

.nav-section-label + .nav-section-label,
.sidebar-nav .nav-section-label:not(:first-child) {
    margin-top: 18px;
    border-top: 1px solid var(--border);
}

.sidebar.collapsed .nav-section-label {
    padding: 6px 0;
    font-size: 0;
    letter-spacing: 0;
}

.sidebar.collapsed .nav-section-label:first-child {
    padding: 0;
    border-top: 0;
    margin-top: 0;
}

/* Sidebar Backdrop (hidden by default, shown on mobile) */
.sidebar-backdrop {
    display: none;
}

/* Floating Menu Button (hidden by default, shown on mobile) */
.floating-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    width: 50px;
    height: 50px;
    background-color: rgba(22, 27, 34, 0.85);
    border: 1px solid rgba(88,166,255,0.3);
    border-radius: 12px;
    color: var(--blue);
    font-size: 24px;
    cursor: pointer;
    z-index: var(--z-floating-btn);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.floating-menu-btn:hover {
    background-color: rgba(22, 27, 34, 0.95);
    border-color: var(--blue);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.floating-menu-btn:active {
    transform: scale(0.95);
}

.floating-menu-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    transition: margin-left 0.3s ease;
    padding: 20px;
}

.main-content.expanded {
    margin-left: 1cm;
}

/* Page Content */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--blue);
}

.page-header p {
    color: var(--dim);
    font-size: 16px;
}

/* Chart Sections */
.chart-section {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.chart-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
    color: var(--text);
}

.chart-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-group {
    display: flex;
    gap: 5px;
}

.btn {
    padding: 8px 16px;
    background-color: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.ed-rail-announcements {
    margin-top: auto;
    padding: 16px 14px 6px;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border);
}

.ed-rail-announcements-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ed-rail-announcements-btn:hover,
.ed-rail-announcements-btn:focus-visible {
    background-color: var(--subtle-bg);
    border-color: var(--blue);
    outline: none;
}

.ed-rail-announcements-btn:active { transform: scale(0.97); }

@keyframes ed-pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.55);
        border-color: var(--blue);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(88, 166, 255, 0);
        border-color: var(--blue);
    }
}

.ed-rail-announcements-btn.is-pulsing {
    animation: ed-pulse-glow 1.1s ease-in-out infinite;
    border-color: var(--blue);
    background-color: var(--subtle-bg);
}

.ed-rail-announcements-icon {
    font-size: 18px;
    line-height: 1;
}

.btn:hover {
    background-color: var(--border);
}

.btn.active {
    background-color: var(--blue);
    border-color: var(--blue);
    color: var(--bg);
}

select {
    padding: 8px 12px;
    background-color: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--blue);
}

.chart-container {
    min-height: 400px;
    width: 100%;
}

.chart-container > div {
    width: 100% !important;
}

label {
    color: var(--dim);
    font-size: 14px;
    margin-right: 8px;
}

/* Latest Date Badge - Variation 1 (on Short Data page) */
.page-header-with-date {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title-section h1 {
    font-size: 32px;
    color: var(--blue);
    margin-bottom: 5px;
}

.page-title-section p {
    color: var(--dim);
    font-size: 16px;
}

.latest-date-badge {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 20px;
    text-align: center;
    min-width: 140px;
    flex-shrink: 0;
    /* ensure consistent vertical sizing and centering */
    min-height: 65px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* push badges to the right when there are multiple siblings */
    margin-left: auto;
}

.latest-date-badge[hidden] {
    display: none;
}

.latest-date-badge .date-label {
    font-size: 11px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.latest-date-badge .date-value {
    font-size: 16px;
    color: var(--blue);
    font-weight: 600;
}

.latest-date-badge .date-note {
    font-size: 10px;
    color: #6e7681;
    margin-top: 4px;
}

/* LAST REFRESH badge - matches latest-date-badge visuals */
.last-refresh-badge {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 20px;
    text-align: center;
    min-width: 140px;
    flex-shrink: 0;
    margin-left: 10px; /* gap between badges */
    /* match latest-date-badge vertical sizing and centering */
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.last-refresh-badge .date-label {
    font-size: 11px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.last-refresh-badge .date-value {
    font-size: 16px;
    color: var(--blue);
    font-weight: 600;
}


/* Top 5 Snapshot */
.top5-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.top5-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.top5-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.top5-card .rank {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--blue);
    margin-bottom: 8px;
    line-height: 1;
}

.top5-card .ticker {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 8px 0 4px;
    position: relative;
    z-index: var(--z-raised);
}

/* Crown for #1 most shorted stock */
.top5-grid .top5-card:first-child .ticker::before {
    content: '';
    position: absolute;
    width: 35px;
    height: 35px;
    background-image: url('images/crown.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: rotate(20deg);
    opacity: 0.9;
    right: 85px;
    top: -20px;
    z-index: var(--z-base);
}

.top5-card .name {
    font-size: 0.95rem;
    color: var(--dim);
    margin-bottom: 12px;
    line-height: 1.3;
    min-height: 2.6em;
}

.top5-card .short-pct {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--red);
}

.top5-card.loading {
    background-color: var(--bg);
    color: var(--dim);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    font-style: italic;
}

/* Top 5 Funding Cards - reuse top5-card styles */
.top5-funding-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.top5-funding-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.top5-funding-card .rank {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--blue);
    margin-bottom: 8px;
    line-height: 1;
}

.top5-funding-card .ticker {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 8px 0 4px;
}

.top5-funding-card .name {
    font-size: 0.95rem;
    color: var(--dim);
    margin-bottom: 12px;
    line-height: 1.3;
    min-height: 2.6em;
}

.top5-funding-card .quarters {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--red);
}

.top5-funding-card.loading {
    background-color: var(--bg);
    color: var(--dim);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    font-style: italic;
}

/* Sentiment Info Boxes */
.sentiment-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sentiment-info-card {
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.sentiment-info-card:hover {
    border-color: rgba(88, 166, 255, 0.267);
    transform: translateY(-2px);
}

.sentiment-info-card .info-label {
    font-size: 0.85rem;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sentiment-info-card .info-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--blue);
    line-height: 1;
    margin-bottom: 4px;
}

.sentiment-info-card .info-value.change span {
    display: block;
    margin-top: 4px;
}

.sentiment-info-card .info-classification {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 8px;
}

/* Watchlists */
.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.watchlist-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.watchlist-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border-color: rgba(88, 166, 255, 0.267);
}

.watchlist-card h3 {
    margin: 0 0 16px 0;
    color: var(--blue);
    font-size: 1.35rem;
    font-weight: 600;
}

.watchlist-links {
    list-style: none;
    margin: 0;
    padding: 0;
    flex-grow: 1;
}

.watchlist-links li {
    margin-bottom: 12px;
}

.watchlist-links a {
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.watchlist-links a:hover {
    background-color: var(--subtle-bg);
    color: var(--blue);
}

.external-icon {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-left: 8px;
    transition: all 0.2s;
}

.watchlist-links a:hover .external-icon {
    opacity: 1;
    transform: translate(2px, -2px);
}

/* External link style for tables */
.external-link {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.15s ease;
}

.external-link:hover {
    color: #79c0ff;
    text-decoration: underline;
}

/* New Listings Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.listings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--bg);
}

.listings-table thead {
    background-color: var(--card);
}

.listings-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--blue);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background-color: var(--card);
    z-index: var(--z-dropdown);
}

.listings-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

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

.listings-table tbody tr:hover {
    background-color: var(--card);
}

.listings-table td {
    padding: 16px 20px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

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

.listings-table .ticker-cell {
    font-weight: 600;
    color: var(--blue);
    font-family: 'Courier New', monospace;
    font-size: 1.05em;
}


tbody tr:nth-child(odd) { background-color: var(--zebra-odd); }
tbody tr:nth-child(even) { background-color: var(--zebra-even); }

#funding-history-table tbody tr:nth-child(odd) {
    background-color: var(--zebra-odd);
}
#funding-history-table tbody tr:nth-child(even) {
    background-color: var(--zebra-even);
}
    


.load-more-container {
    text-align: center;
    margin-top: 20px;
}

.load-more-container .btn {
    padding: 12px 32px;
    font-size: 15px;
}

.no-more-results {
    color: var(--dim);
    font-style: italic;
    padding: 20px;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Chart Loading Overlay */
.chart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(13, 17, 23, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--dim);
    font-size: 18px;
    z-index: var(--z-dropdown);
    border-radius: 6px;
}


/* Sentiment change detail – smaller text showing old → new value */
.change-detail {
    display: block;
    font-size: 0.72em;          /* ≈ 72% of parent size – feels secondary */
    opacity: 0.75;
    margin-top: 4px;
    font-weight: normal;
    color: inherit;             /* keeps the green/red color from parent */
    letter-spacing: 0.3px;
}

/* Optional: make it even more subdued on hover/focus if you want */
.sentiment-info-card:hover .change-detail {
    opacity: 0.85;
}

.source-note {
    font-size: 0.65em;           /* ≈ 65% of parent h2 size – looks good at ~11–13px */
    color: var(--dim);              /* your muted gray */
    font-weight: normal;         /* not bold like the main title */
    vertical-align: baseline;    /* aligns nicely with text */
    margin-left: 8px;            /* small breathing room */
    opacity: 0.75;               /* slightly subdued */
}

/* Optional: make it even more discreet on hover/focus */
.chart-section h2:hover .source-note {
    opacity: 0.9;
}

/* AAII specific overrides */
#aaiiChart .plotly .modebar {
    right: 8px !important;
}

#aaiiChart .plotly .legend {
    display: none !important; /* we use top annotations instead */
}

/* Make sure annotations look good in dark mode */
.plotly .annotation-text {
    fill: var(--text) !important;
    font-weight: 600 !important;
}

.chart-header-with-date {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.chart-header-with-date h2 {
    margin: 0;
    flex: 1;
}

.chart-date-badge {
    color: var(--dim);
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Compare Company Section */
.compare-controls {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.search-container {
	position: relative;
	max-width: 500px;
}

.search-container input {
	width: 100%;
	padding: 12px 16px;
	background-color: var(--bg);
	border: 2px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	font-size: 15px;
	transition: border-color 0.2s;
}

.search-container input:focus {
	outline: none;
	border-color: var(--blue);
}

.search-container input::placeholder {
	color: #6e7681;
}

.search-container.searching input {
	border-color: var(--blue);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2358a6ff' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 20px;
	padding-right: 40px;
}

.search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background-color: var(--card);
	border: 1px solid var(--border);
	border-radius: 6px;
	margin-top: 4px;
	max-height: 300px;
	overflow-y: auto;
	z-index: var(--z-dropdown);
	display: none;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.search-results.active {
	display: block;
}

.search-result-item {
	padding: 12px 16px;
	cursor: pointer;
	border-bottom: 1px solid var(--border);
	transition: background-color 0.15s;
}

.search-result-item:last-child {
	border-bottom: none;
}

.search-result-item:hover {
	background-color: var(--subtle-bg);
}

.search-result-symbol {
	font-weight: 600;
	color: var(--blue);
	font-family: 'Courier New', monospace;
	margin-right: 8px;
}

.search-result-name {
	color: var(--dim);
	font-size: 0.9em;
}

.search-result-badge {
    display: inline-block;
    margin-left: 8px;
    background: rgba(88,166,255,0.12); /* subtle blue box */
    border: 1px solid rgba(88,166,255,0.18);
    color: var(--red); /* red text */
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 1em; /* same size as company text */
    font-weight: 700; /* bold */
    vertical-align: middle;
}

/* Slightly dim tracked results by changing text color (avoid parent opacity so badge stays vivid) */
.search-result-item.tracked .search-result-symbol,
.search-result-item.tracked .search-result-name {
    color: #6e7681;
}

/* Ensure badge stays the specified red and bold even when parent text is dimmed */
.search-result-item.tracked .search-result-badge {
    color: rgba(248, 82, 73, 0.773) !important;
    font-weight: 700 !important;
    background: rgba(88,166,255,0.12) !important;
    border: 1px solid rgba(88,166,255,0.18) !important;
}

.search-result-item.tracked:hover {
    background-color: var(--card); /* reduce hover contrast */
}

.search-no-results {
	padding: 16px;
	text-align: center;
	color: #6e7681;
	font-style: italic;
}

.selected-companies {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	min-height: 48px;
	padding: 12px;
	background-color: var(--bg);
	border: 1px solid var(--border);
	border-radius: 6px;
}

.selected-companies .no-selection {
	color: #6e7681;
	font-style: italic;
	display: flex;
	align-items: center;
}

.company-tag {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background-color: var(--subtle-bg);
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	font-size: 14px;
	transition: all 0.2s;
}

.company-tag:hover {
	border-color: rgba(88, 166, 255, 0.267);
	transform: translateY(-1px);
}

.company-tag-symbol {
	font-weight: 600;
	color: var(--blue);
	font-family: 'Courier New', monospace;
}

.company-tag-name {
	color: var(--dim);
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.company-tag-remove {
	background: none;
	border: none;
	color: var(--red);
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 0;
	margin-left: 4px;
	transition: color 0.2s;
}

.company-tag-remove:hover {
	color: #ff6b6b;
}

/* Verified info icon next to verified mark */
.verified-info {
    display: inline-block;
    margin-left: 6px;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: transparent;
    color: var(--dim);
    cursor: default;
    font-size: 12px;
    border: 1px solid var(--border);
}
.verified-info:hover {
    background: var(--subtle-bg);
    color: var(--text);
}

.verified-tooltip {
    pointer-events: none;
    max-width: 300px;
    line-height: 1.2;
}

/* Confidence info icon next to confidence column */
.confidence-info {
    display: inline-block;
    margin-left: 6px;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: transparent;
    color: var(--dim);
    cursor: default;
    font-size: 12px;
    border: 1px solid var(--border);
}
.confidence-info:hover {
    background: var(--subtle-bg);
    color: var(--text);
}

.confidence-tooltip {
    pointer-events: none;
    max-width: 300px;
    line-height: 1.2;
}

/* Confidence circles */
.confidence-circle {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.confidence-circle.green {
    background-color: #2ea44f;
}

.confidence-circle.orange {
    background-color: #fb8500;
}

.empty-chart-message {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 400px;
	color: #6e7681;
	text-align: center;
}

.empty-icon {
	font-size: 64px;
	margin-bottom: 16px;
	opacity: 0.5;
}

.empty-chart-message p {
	font-size: 16px;
	margin: 0;
}

#compareChart.has-data .empty-chart-message {
	display: none;
}

/* Scrollbar styling for search results */
.search-results::-webkit-scrollbar {
	width: 8px;
}

.search-results::-webkit-scrollbar-track {
	background: var(--bg);
	border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
	background: #484f58;
}

/* Status badge styles */
.status-badge {
	padding: 4px 12px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.status-badge.healthy {
	background-color: rgba(46, 160, 67, 0.2);
	color: var(--green);
	border: 1px solid var(--green);
}

.status-badge.warning {
	background-color: rgba(187, 128, 9, 0.2);
	color: var(--yellow);
	border: 1px solid var(--yellow);
}

.status-badge.critical {
	background-color: rgba(248, 81, 73, 0.2);
	color: var(--red);
	border: 1px solid var(--red);
}

.status-badge.unknown {
	background-color: rgba(139, 148, 158, 0.2);
	color: var(--dim);
	border: 1px solid var(--dim);
}

/* Quarters display coloring */
.quarters-display.healthy {
	color: var(--green);
	font-weight: 600;
}

.quarters-display.warning {
	color: var(--yellow);
	font-weight: 600;
}

.quarters-display.critical {
	color: var(--red);
	font-weight: 700;
}

/* Error message styling */
.error-message {
	padding: 20px;
	text-align: center;
}

.error-message-icon {
	font-size: 48px;
	margin-bottom: 12px;
}

.error-message-text {
	font-size: 18px;
	color: var(--red);
	margin-bottom: 8px;
	font-weight: 600;
}

.error-message-detail {
	font-size: 14px;
	color: var(--dim);
	line-height: 1.6;
	max-width: 600px;
	margin: 0 auto;
}

/* Table loading state */
.table-loading {
	text-align: center !important;
	padding: 40px !important;
	color: var(--dim) !important;
}

/* Toast animations */
@keyframes slideIn {
	from {
		transform: translateX(400px);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOut {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(400px);
		opacity: 0;
	}
}

/* Toast UI */
.toast {
    color: #ffffff;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(2,6,23,0.6);
    transform-origin: right top;
}

.toast .toast-progress {
    height: 4px;
    background: rgba(255,255,255,0.9);
    width: 100%;
}

@keyframes toast-shrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* Variants (fallback colors if JS doesn't set inline colors) */
.toast-success { background: #16a34a; }
.toast-warning { background: #f97316; }
.toast-error { background: #ef4444; }
.toast-info { background: #0ea5e9; }


/* ========================================================================
   DASHBOARD GRID 2 STYLES - Large Cards Layout
   ======================================================================== */

.grid-large {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
	gap: 25px;
}

.large-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 30px;
	position: relative;
}

.large-card h3 {
	margin: 0 0 20px 0;
	color: var(--blue);
	font-size: 20px;
	border-bottom: 2px solid var(--border);
	padding-bottom: 12px;
}

.large-metric {
	text-align: center;
	padding: 20px;
	background: var(--bg);
	border-radius: 8px;
	margin-bottom: 15px;
}

.large-metric-value {
	font-size: 48px;
	font-weight: bold;
	color: var(--text);
	margin: 10px 0;
}

.metric-label {
	font-size: 12px;
	color: var(--dim);
	text-transform: uppercase;
}

.metric-change {
	font-size: 14px;
	margin-top: 5px;
}

.metric-change.positive {
	color: var(--green);
}

.metric-change.negative {
	color: var(--red);
}

.stat-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-top: 10px;
}

.stat-item {
	background: var(--bg);
	padding: 10px;
	border-radius: 6px;
	text-align: center;
}

.highlight-box {
	padding: 15px;
	background: var(--bg);
	border-radius: 6px;
	border-left: 3px solid var(--blue);
}

.ticker {
	font-weight: bold;
	color: var(--blue);
}

.company-name {
	font-size: 12px;
	color: var(--dim);
}

/* Dashboard status badges */
.status-badge.extreme-fear {
	background: rgba(248, 81, 73, 0.125);
	color: var(--red);
	border: 1px solid var(--red);
}

.status-badge.fear {
	background: rgba(210, 153, 34, 0.125);
	color: var(--yellow);
	border: 1px solid var(--yellow);
}

.status-badge.neutral {
	background: rgba(139, 148, 158, 0.125);
	color: var(--dim);
	border: 1px solid var(--dim);
}

.status-badge.greed {
	background: rgba(63, 185, 80, 0.125);
	color: var(--green);
	border: 1px solid var(--green);
}

.status-badge.extreme-greed {
	background: rgba(63, 185, 80, 0.188);
	color: var(--green);
	border: 1px solid var(--green);
	font-weight: 700;
}

/* ========================================================================
   DASHBOARD HEIGHT REDUCTION (~30%) - Home Page Only
   ======================================================================== */

/* Target only the dashboard/home page */
#home .grid-large {
	gap: 18px; /* reduced from 25px */
}

#home .large-card {
	padding: 21px; /* reduced from 30px (30% reduction) */
}

#home .large-card h3 {
	margin: 0 0 14px 0; /* reduced from 20px */
	font-size: 21px; /* increased from 16px (30% bigger: 16 * 1.3 = 20.8 ≈ 21px) */
	font-weight: bold; /* ensure bold */
	padding-bottom: 8px; /* reduced from 12px */
}

#home .large-metric {
	padding: 14px; /* reduced from 20px */
	margin-bottom: 10px; /* reduced from 15px */
}

#home .large-metric-value {
	font-size: 34px; /* reduced from 48px (≈30% reduction) */
	margin: 7px 0; /* reduced from 10px */
}

#home .metric-label {
	font-size: 10px; /* reduced from 12px */
}

/*
 * NOTE on the dashboard `!important` block below: the markup in #home cards
 * still uses inline `style="font-size: 11px;"` etc., which beats this
 * stylesheet on specificity. The attribute-selectors (`div[style*="..."]`)
 * + `!important` are the cheap counterweight. The proper fix is to replace
 * those inline styles with utility classes (.text-xs, .text-2xl, .gap-1,
 * etc.) — once the inline styles are gone, every `!important` here can go
 * with them. Tracked as a follow-up; do not add MORE rules to this block.
 */
#home .stat-grid {
	gap: 7px; /* reduced from 10px */
	margin-top: 7px; /* reduced from 10px */
}

#home .stat-item {
	padding: 7px; /* reduced from 10px */
}

#home .stat-item > div[style*="font-size: 11px"] {
	font-size: 9px !important; /* reduce label size */
	margin-bottom: 3px !important;
}

#home .stat-item > div[style*="font-size: 24px"] {
	font-size: 17px !important; /* reduced from 24px (≈30% reduction) */
}

#home .highlight-box {
	padding: 10px; /* reduced from 15px */
}

#home .highlight-box > div[style*="font-size: 13px"] {
	font-size: 11px !important;
	margin-bottom: 3px !important;
}

#home .highlight-box > div[style*="font-size: 32px"] {
	font-size: 22px !important; /* reduced from 32px (≈30% reduction) */
}

/* AAII sentiment bars and text - 30% bigger labels */
#home #dashboard-aaii-card > div[style*="margin-bottom: 20px"] {
	margin-bottom: 14px !important; /* reduced from 20px */
}

#home #dashboard-aaii-card span[style*="font-size: 16px"] {
	font-size: 21px !important; /* increased from 13px (original 16px + 30%) */
}

#home #dashboard-aaii-card span[style*="font-size: 32px"] {
	font-size: 22px !important; /* reduced from 32px (≈30% reduction) */
}

#home #dashboard-aaii-card div[style*="margin-bottom: 12px"] {
	margin-bottom: 8px !important; /* reduced from 12px */
}

#home #dashboard-aaii-card div[style*="height: 12px"] {
	height: 8px !important; /* reduced bar height from 12px */
}

/* Tables in dashboard - 30% bigger symbols */
#home .large-card table {
	font-size: 12px !important; /* reduced from 14px */
}

#home .large-card table td {
	padding: 8px 10px !important; /* reduced padding */
}

#home .large-card table .ticker {
	font-size: 17px !important; /* 30% bigger than 13px */
}

#home .large-card table .company-name {
	font-size: 10px !important; /* reduced from 12px */
}

/* Market stats card - two column layout */
#home #dashboard-stats-card > div[style*="grid-template-columns"] .large-metric {
	padding: 10px; /* further reduced for this specific card */
}

#home #dashboard-stats-card div[style*="font-size: 40px"] {
	font-size: 28px !important; /* reduced from 40px (30% reduction) */
	margin: 10px 0 !important; /* reduced from 15px */
}

#home #dashboard-stats-card div[style*="font-size: 13px"] {
	font-size: 11px !important;
}

/* Recent listings stats row */
#home #dashboard-listings-card > div[style*="margin-top: 20px"] {
	margin-top: 14px !important; /* reduced from 20px */
	gap: 7px !important; /* reduced from 10px */
}

/* 2026 YTD box - change to white */
#home #dashboard-listings-current-year {
	color: var(--text) !important; /* white instead of green */
}

/* Industry status badges in listings table */
#home #dashboard-listings-table .status-badge {
	font-size: 9px !important;
	padding: 3px 8px !important;
}

/* Funding alert box */
#home #dashboard-funding-alert {
	padding: 10px !important; /* reduced from 15px */
	margin-bottom: 14px !important; /* reduced from 20px */
}

#home #dashboard-funding-alert > div[style*="font-size: 12px"] {
	font-size: 10px !important;
	margin-bottom: 3px !important;
}

#home #dashboard-funding-alert > div[style*="font-size: 14px"] {
	font-size: 12px !important;
}

/* ========================================================================
   MEDIA QUERIES - All responsive styles consolidated here
   ======================================================================== */

/* Desktop styles - exact badge heights */
@media (min-width: 769px) {
    .latest-date-badge,
    .last-refresh-badge {
        height: 72px;
        box-sizing: border-box;
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Mobile and tablet styles */
@media (max-width: 768px) {
    /* Floating menu button - visible on mobile */
    .floating-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        opacity:50%;
    }

    /* Sidebar - full screen overlay on mobile */
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.collapsed {
        width: 100%;
        transform: translateX(0);
    }

    .sidebar.collapsed .sidebar-header h2 {
        opacity: 1;
        width: auto;
    }

    .sidebar.collapsed .nav-item {
        padding: 12px 20px;
        font-size: inherit;
        justify-content: space-between;
    }

    .sidebar.collapsed .nav-text {
        font-size: inherit;
        width: auto;
        overflow: visible;
    }

    .sidebar.collapsed .nav-icon {
        margin-left: 10px;
    }

    /* On mobile `.collapsed` = sidebar is OPEN, so restore the section labels
       (the desktop rule hides them with font-size: 0 for the icon-only state). */
    .sidebar.collapsed .nav-section-label {
        padding: 22px 20px 10px;
        font-size: 14px;
        letter-spacing: 1px;
    }

    /* Toggle button - larger hit area on mobile */
    .sidebar-toggle {
        font-size: 24px;
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
    }

    /* Main content - no margin on mobile */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }

    .main-content.expanded {
        margin-left: 0;
    }

    /* Sidebar backdrop overlay */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: calc(var(--z-sidebar) - 1);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }

    /* Page headers and badges */
    .page-header-with-date {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }

    .page-title-section h1 {
        font-size: 26px;
    }

    .page-title-section p {
        font-size: 14px;
    }

    .latest-date-badge {
        width: 100%;
    }

    .last-refresh-badge {
        width: 100%;
    }

    /* Chart sections */
    .chart-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .chart-section h2 {
        font-size: 18px;
    }

    /* Chart headers */
    .chart-header-with-date {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-date-badge {
        width: 100%;
        text-align: left;
    }

    /* Top 5 grid */
    .top5-grid {
        grid-template-columns: 1fr;
    }

    .top5-card {
        padding: 15px;
    }

    /* Sentiment info grid */
    .sentiment-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Dashboard grid large */
    .grid-large {
        grid-template-columns: 1fr;
    }

    .large-card {
        padding: 20px;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Watchlists */
    .watchlist-grid {
        grid-template-columns: 1fr;
    }

    /* Tables */
    .listings-table {
        font-size: 0.9rem;
    }

    .listings-table th,
    .listings-table td {
        padding: 10px 8px;
    }

    /* Search and company tags */
    .search-container {
        max-width: 100%;
    }

    .company-tag-name {
        max-width: 120px;
    }

    /* Button controls */
    .chart-controls {
        gap: 8px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .btn-group {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* Labels and selects */
    label {
        font-size: 13px;
    }

    select {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* Mobile-specific adjustments */
    body {
        overflow-x: hidden;
    }

    .container {
        position: relative;
    }
}

/* ===================== Cap Raise Tictacs ===================== */
.tictac-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 20px;
}

.tictac {
    border-radius: 50px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: default;
}

.tictac:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tictac.critical {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.188) 0%, rgba(248, 81, 73, 0.125) 100%);
    border-color: rgba(248, 81, 73, 0.314);
}

.tictac.critical:hover {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.251) 0%, rgba(248, 81, 73, 0.188) 100%);
    border-color: var(--red);
}

.tictac.warning {
    background: linear-gradient(135deg, rgba(210, 153, 34, 0.188) 0%, rgba(210, 153, 34, 0.125) 100%);
    border-color: rgba(210, 153, 34, 0.314);
}

.tictac.warning:hover {
    background: linear-gradient(135deg, rgba(210, 153, 34, 0.251) 0%, rgba(210, 153, 34, 0.188) 100%);
    border-color: var(--yellow);
}

.tictac.healthy {
    background: linear-gradient(135deg, rgba(63, 185, 80, 0.188) 0%, rgba(63, 185, 80, 0.125) 100%);
    border-color: rgba(63, 185, 80, 0.314);
}

.tictac.healthy:hover {
    background: linear-gradient(135deg, rgba(63, 185, 80, 0.251) 0%, rgba(63, 185, 80, 0.188) 100%);
    border-color: var(--green);
}

.tictac.neutral {
    background: linear-gradient(135deg, rgba(139, 148, 158, 0.188) 0%, rgba(139, 148, 158, 0.125) 100%);
    border-color: rgba(139, 148, 158, 0.314);
}

.tictac.neutral:hover {
    background: linear-gradient(135deg, rgba(139, 148, 158, 0.251) 0%, rgba(139, 148, 158, 0.188) 100%);
    border-color: var(--dim);
}

.tictac .symbol {
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
    min-width: 40px;
}

.tictac .quarters {
    font-size: 14px;
    font-weight: bold;
}

.tictac.critical .quarters {
    color: var(--red);
}

.tictac.warning .quarters {
    color: var(--yellow);
}

.tictac.healthy .quarters {
    color: var(--green);
}

.tictac.neutral .quarters {
    color: var(--dim);
}

/* ============================================================================
   Seasonality page
   ============================================================================ */

.seasonality-section .seasonality-month-strip {
    display: grid;
    grid-template-columns: 70px repeat(12, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    font-family: ui-monospace, monospace;
    margin-top: 8px;
}

/* Playground — multi-symbol chip list */
.seasonality-section .playground-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 2px;
    min-height: 32px;
}

.seasonality-section .playground-chips:empty {
    display: none;
}

.seasonality-section .playground-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 12px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    position: relative;
}

.seasonality-section .playground-chip .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.seasonality-section .playground-chip .remove {
    background: transparent;
    border: 0;
    color: var(--dim);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 2px;
}

.seasonality-section .playground-chip .remove:hover {
    color: var(--red);
    background: var(--bg);
}

/* Playground — multi-row month strip (one row per symbol) */
.seasonality-section .seasonality-month-strip.multi-strip {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

.seasonality-section .seasonality-month-strip.multi-strip .strip-row {
    display: grid;
    grid-template-columns: 70px repeat(12, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

.seasonality-section .seasonality-month-strip.multi-strip .strip-row .ms-label {
    border-left: 4px solid var(--blue);
}

.seasonality-section .seasonality-month-strip:empty {
    display: none;
}

.seasonality-section .seasonality-month-strip .ms-label {
    background: var(--subtle-bg);
    color: var(--blue);
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.seasonality-section .seasonality-month-strip .ms-label .sub {
    color: var(--dim);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    margin-top: 2px;
    text-transform: none;
}
.seasonality-section .seasonality-month-strip .ms-cell {
    padding: 8px 4px;
    text-align: center;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: filter 0.1s;
}
.seasonality-section .seasonality-month-strip .ms-cell:hover {
    filter: brightness(1.3);
}
.seasonality-section .seasonality-month-strip .ms-cell .month {
    font-size: 10px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.seasonality-section .seasonality-month-strip .ms-cell .value {
    font-size: 13px;
    font-weight: 700;
}
.seasonality-section .seasonality-month-strip .ms-cell.pos .value { color: var(--green); }
.seasonality-section .seasonality-month-strip .ms-cell.neg .value { color: var(--red); }
.seasonality-section .seasonality-month-strip .ms-cell.na .value { color: var(--dim); }

.seasonality-section .seasonality-meta {
    font-size: 13px;
    color: var(--dim);
    margin: 8px 0 6px 2px;
    letter-spacing: 0.02em;
}

.seasonality-section .year-range-label {
    font-weight: 600;
    color: var(--blue);
}

.seasonality-section .seasonality-main-chart {
    min-height: 440px;
}

.seasonality-section .seasonality-overview-chart {
    min-height: 180px;
    margin-top: 12px;
}

.seasonality-section .seasonality-region-toggle .btn {
    padding: 6px 14px;
}

.seasonality-section .chart-controls {
    align-items: center;
}

.seasonality-section .bear-exclude-label {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--dim);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.seasonality-section .bear-exclude-label:hover {
    color: var(--text);
}

.seasonality-section .bear-exclude-label input[type="checkbox"] {
    accent-color: var(--red);
    cursor: pointer;
}

.seasonality-section .bear-info-button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dim);
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.seasonality-section .bear-info-button:hover {
    color: var(--text);
    border-color: var(--blue);
    background: var(--subtle-bg);
}

.seasonality-section .chart-controls label {
    color: var(--text);
    font-size: 14px
}
/* ============================================================================
   Education page (mods + company reports)
   ============================================================================ */
.education-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 16px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.18),
        0 6px 18px rgba(0, 0, 0, 0.40),
        0 18px 48px rgba(0, 0, 0, 0.30);
}

/* Tab toggle */
.education-card .ed-tab-toggle {
    display: flex; gap: 4px;
    margin: 18px 24px 0;
    padding: 4px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 480px;
}
.education-card .ed-tab-toggle button {
    flex: 1;
    background: transparent; color: var(--dim);
    border: 0; padding: 8px 14px;
    font-size: 13px; font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
}
.education-card .ed-tab-toggle button:hover { color: var(--text); }
.education-card .ed-tab-toggle button.active { background: var(--blue); color: white; }
.education-card .ed-tab-toggle button .count {
    background: rgba(255,255,255,0.18);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-family: ui-monospace, monospace;
}
.education-card .ed-tab-toggle button:not(.active) .count {
    background: var(--card); color: var(--dim);
}

.education-card .ed-tab-panel { display: none; }
.education-card .ed-tab-panel.active { display: block; }

/* Make the Education / Company Reports page take a bounded height so the
   card stays a "nice box" with the body scrolling inside it.
   Each level needs `min-height: 0` so children can shrink below their
   intrinsic content size — without this, long markdown blows the box out. */
#education.active,
#company-reports.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    min-height: 600px;
}

/* Vertical-space-tight header on the Education / Company Reports pages */
#education .page-header-with-date,
#company-reports .page-header-with-date {
    margin-bottom: 6px;
}
#education .page-title-section p,
#company-reports .page-title-section p {
    margin: 0;
}
#education .education-card,
#company-reports .education-card {
    margin-top: 4px;
}
#education .education-card,
#company-reports .education-card {
    flex: 1 1 auto;
    min-height: 540px;
    display: flex;
    flex-direction: column;
}
#education .education-card .ed-tab-panel.active,
#company-reports .education-card .ed-tab-panel.active {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

/* Split layout — fills the panel above, no overflow itself */
.education-card .ed-split {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
}
.education-card .ed-rail {
    border-right: 1px solid var(--border);
    padding: 14px 0;
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.education-card .ed-rail-section {
    padding: 12px 18px 6px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dim);
}
.education-card .ed-rail-item {
    padding: 10px 18px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.1s, border-color 0.1s;
}
.education-card .ed-rail-item:hover { background: var(--subtle-bg); }
.education-card .ed-rail-item.active {
    background: var(--subtle-bg);
    border-left-color: var(--blue);
}
.education-card .ed-rail-item .num {
    flex-shrink: 0;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--subtle-bg);
    color: var(--dim);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px;
    font-family: ui-monospace, monospace;
    border: 1px solid var(--border);
}
.education-card .ed-rail-item.is-faq .num {
    font-size: 9px;
    letter-spacing: 0.5px;
}
.education-card .ed-rail-item.done .num {
    background: var(--green);
    color: var(--bg);
    border-color: var(--green);
}
.education-card .ed-rail-item.active .num {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}
.education-card .ed-rail-item .ticker {
    flex-shrink: 0;
    font-family: ui-monospace, monospace;
    font-size: 11px; font-weight: 700;
    padding: 3px 7px;
    background: var(--subtle-bg);
    color: var(--blue);
    border-radius: 4px;
}
.education-card .ed-rail-item.active .ticker {
    background: var(--blue); color: white;
}
.education-card .ed-rail-item .rail-title {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    line-height: 1.35;
}
.education-card .ed-rail-item.active .rail-title {
    color: var(--blue); font-weight: 600;
}
.education-card .ed-rail-item.no-audio .num,
.education-card .ed-rail-item.no-audio .ticker { opacity: 0.55; }

/* Content area — fixed head + scrolling body */
.education-card .ed-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.education-card .ed-content-head {
    flex-shrink: 0;
    padding: 22px 32px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.education-card .ed-content-head h3 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 22px;
}
.education-card .ed-content-head .meta-row {
    color: var(--dim); font-size: 12px;
    margin-bottom: 14px;
    display: flex; gap: 8px; flex-wrap: wrap;
}
.education-card .ed-content-head .meta-row .pill {
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 10px;
}
.education-card .ed-content-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 32px 36px;
}

/* MP3 player bar */
.education-card .mp3-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0;
}
.education-card .mp3-bar .play-btn {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--blue); color: white;
    border: 0; font-size: 13px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: inherit;
}
.education-card .mp3-bar .play-btn:hover { filter: brightness(1.1); }
.education-card .mp3-bar .scrub {
    flex: 1; display: flex; align-items: center; gap: 10px;
}
.education-card .mp3-bar .scrub .bar {
    flex: 1; position: relative;
    height: 4px; background: var(--border); border-radius: 2px;
    cursor: pointer;
}
.education-card .mp3-bar .scrub .bar .fill {
    position: absolute; top: 0; left: 0; bottom: 0;
    background: var(--blue); border-radius: 2px;
    width: 0;
}
.education-card .mp3-bar .scrub .bar .knob {
    position: absolute; top: 50%; left: 0;
    width: 12px; height: 12px;
    background: var(--blue);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.education-card .mp3-bar .time {
    font-family: ui-monospace, monospace;
    font-size: 11px; color: var(--dim);
    flex-shrink: 0;
}

/* Rendered markdown body — line highlight + clean typography */
.education-card .ed-text {
    font-size: 15px; line-height: 1.7; color: var(--text);
}
.education-card .ed-text h1,
.education-card .ed-text h2,
.education-card .ed-text h3,
.education-card .ed-text h4 {
    color: var(--text);
    margin: 22px 0 8px;
    line-height: 1.3;
}
.education-card .ed-text h1 { font-size: 22px; }
.education-card .ed-text h2 { font-size: 18px; color: var(--blue); }
.education-card .ed-text h3 { font-size: 16px; }
.education-card .ed-text h4 { font-size: 14px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; }
.education-card .ed-text p { margin: 10px 0; }
.education-card .ed-text ul,
.education-card .ed-text ol { margin: 10px 0; padding-left: 26px; }
.education-card .ed-text li { margin: 4px 0; }
.education-card .ed-text strong { color: var(--text); }
.education-card .ed-text em { color: var(--text); }
.education-card .ed-text a { color: var(--blue); text-decoration: none; }
.education-card .ed-text a:hover { text-decoration: underline; }
.education-card .ed-text code {
    background: var(--subtle-bg);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 13px;
}
.education-card .ed-text pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    font-size: 13px;
}
.education-card .ed-text hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 22px 0;
}
.education-card .ed-text blockquote {
    border-left: 3px solid var(--border);
    padding-left: 14px;
    margin: 10px 0;
    color: var(--dim);
}
.education-card .ed-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 14px 0;
    font-size: 13px;
}
.education-card .ed-text th,
.education-card .ed-text td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.education-card .ed-text th {
    background: var(--subtle-bg);
    color: var(--blue);
    font-weight: 700;
}

/* Active line highlight (any speakable block tagged with data-line-idx) */
.education-card .ed-text [data-line-idx] {
    padding: 4px 12px;
    margin: 2px -12px;
    border-radius: 4px;
    transition: background 0.15s;
}
.education-card .ed-text [data-line-idx].active {
    background: rgba(88, 166, 255, 0.12);
}

/* Mark complete row */
.education-card .mark-complete-row {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.education-card .mark-complete-row .next-up {
    color: var(--dim); font-size: 12px;
}
.education-card .mark-complete-row .next-up strong {
    color: var(--text); font-weight: 600;
}
.education-card .mark-complete {
    background: var(--blue); color: white;
    border: 0;
    padding: 10px 18px;
    font-size: 13px; font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.education-card .mark-complete:hover { filter: brightness(1.1); }
.education-card .mark-complete.completed { background: var(--green); }

/* Empty / loading states */
.education-card .ed-empty {
    color: var(--dim);
    font-style: italic;
    padding: 40px 0;
    text-align: center;
}

/* Responsive */
@media (max-width: 820px) {
    .education-card .ed-split {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .education-card .ed-rail {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        max-height: 240px;
    }
    .education-card .ed-content { max-height: none; }
    .education-card .ed-content-head { padding: 18px 22px 14px; }
    .education-card .ed-content-body { padding: 18px 22px 28px; }
}

/* Click-to-seek: lines are clickable when audio is available */
.education-card .ed-content.has-audio .ed-text [data-line-idx] {
    cursor: pointer;
}
.education-card .ed-content.has-audio .ed-text [data-line-idx]:hover {
    background: rgba(88, 166, 255, 0.07);
}

/* Inline images in markdown (modules + reports) */
.education-card .ed-text img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 14px auto;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
}
.education-card .ed-text figure { margin: 14px 0; }
.education-card .ed-text figure img { margin: 0 auto 6px; }
.education-card .ed-text figure figcaption,
.education-card .ed-text img + em {
    display: block;
    color: var(--dim);
    font-size: 12px;
    text-align: center;
    margin-top: 6px;
    font-style: italic;
}

/* ============================================================================
   Case Studies page + Announcements modal
   ============================================================================ */

/* Stretch the active page so the table card fills the viewport — same trick
   as #education / #company-reports */
#case-studies.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    min-height: 600px;
}
#case-studies .page-header-with-date { margin-bottom: 6px; }
#case-studies .page-title-section p { margin: 0; }
#case-studies .education-card {
    flex: 1 1 auto;
    min-height: 540px;
    display: flex;
    flex-direction: column;
    margin-top: 4px;
    padding: 16px 20px 0;
}

.cs-card .cs-tab-row {
    display: flex;
    gap: 4px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.cs-tab {
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--dim);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.cs-tab:hover { color: var(--text); border-color: var(--blue); }
.cs-tab.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

.cs-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.cs-search {
    flex: 1 1 220px;
    min-width: 180px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}
.cs-search:focus { outline: none; border-color: var(--blue); }
.cs-type, .cs-date {
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}
.cs-date { color-scheme: dark; }
.cs-date-sep {
    color: var(--dim);
    font-size: 12px;
    padding: 0 2px;
}
.cs-count {
    margin-left: auto;
    color: var(--dim);
    font-size: 12px;
    font-family: ui-monospace, monospace;
}

.cs-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin-top: 4px;
}
.cs-modal-table-wrap {
    max-height: 60vh;
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.cs-table thead {
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: var(--z-base);
}
.cs-table th {
    text-align: left;
    padding: 10px 12px 8px;
    color: var(--dim);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.cs-table th.cs-sortable { cursor: pointer; user-select: none; }
.cs-table th.cs-sortable:hover { color: var(--text); }
.cs-table th.cs-sort-asc::after  { content: ' ▲'; color: var(--blue); }
.cs-table th.cs-sort-desc::after { content: ' ▼'; color: var(--blue); }
.cs-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}
.cs-table tbody tr:hover { background: var(--subtle-bg); }
.cs-table .cs-co-col   { width: 56px; }
.cs-table .cs-size-col { width: 70px;  text-align: right; }
.cs-table .cs-date-cell {
    font-family: ui-monospace, monospace;
    color: var(--dim);
    white-space: nowrap;
}
.cs-table .cs-co-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--subtle-bg);
    color: var(--blue);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
}
.cs-table .cs-title-link {
    color: var(--text);
    text-decoration: none;
}
.cs-table .cs-title-link:hover { color: var(--blue); text-decoration: underline; }
.cs-table .cs-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    color: var(--dim);
    font-size: 11px;
    border-radius: 10px;
    white-space: nowrap;
}
.cs-table .cs-size-cell {
    color: var(--dim);
    font-family: ui-monospace, monospace;
    text-align: right;
}

/* Subtle highlight for rows matching the current exercise hint */
.cs-table tr.cs-suggested {
    background: rgba(88, 166, 255, 0.10);
}
.cs-table tr.cs-suggested:hover { background: rgba(88, 166, 255, 0.18); }
.cs-table tr.cs-suggested .cs-title-link { color: var(--blue); font-weight: 600; }

.cs-empty {
    padding: 32px;
    text-align: center;
    color: var(--dim);
    font-style: italic;
}

/* Coloured type badges (subtle — same palette as the rest of the dashboard) */
.cs-type-badge.t-quarterly                 { color: var(--blue); border-color: rgba(88,166,255,0.3); }
.cs-type-badge.t-mre-update                 { color: var(--green); border-color: rgba(63,185,80,0.3); }
.cs-type-badge.t-reserve-update             { color: var(--green); border-color: rgba(63,185,80,0.3); }
.cs-type-badge.t-feasibility-study          { color: var(--yellow); border-color: rgba(210,153,34,0.3); }
.cs-type-badge.t-drill-results              { color: var(--blue); border-color: rgba(88,166,255,0.3); }
.cs-type-badge.t-capital-raise              { color: var(--red); border-color: rgba(248,81,73,0.3); }
.cs-type-badge.t-trading-halt               { color: var(--red); border-color: rgba(248,81,73,0.3); }
.cs-type-badge.t-production-update          { color: var(--green); border-color: rgba(63,185,80,0.3); }
.cs-type-badge.t-acquisition                { color: var(--yellow); border-color: rgba(210,153,34,0.3); }
.cs-type-badge.t-half-yearly                { color: var(--text); }
.cs-type-badge.t-annual-report              { color: var(--text); }

/* ─── Announcements modal ───────────────────────────────────────────────── */
.cs-modal[hidden] { display: none; }
.cs-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cs-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
}
.cs-modal-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.18),
        0 6px 18px rgba(0, 0, 0, 0.40),
        0 18px 48px rgba(0, 0, 0, 0.30);
    width: min(1100px, 94vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 22px 24px 18px;
}
.cs-modal-card h2 {
    margin: 0 0 14px;
    color: var(--text);
    font-size: 20px;
}
.cs-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: 0;
    color: var(--dim);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.cs-modal-close:hover { color: var(--text); background: var(--subtle-bg); }

/* When the modal is open, prevent the body scrolling underneath */
body.cs-modal-open { overflow: hidden; }

/* ===========================================
   Crypto Scanner (experimental)
   =========================================== */
.scanner-card {
    padding: 18px 18px 12px;
    /* Force the whole card to fill the viewport (minus page header +
       tabs ~ 200px) so the inner table-wrap (flex: 1) inherits a
       generous explicit height. With max-height alone the card just
       hugged its content and the wrap never expanded — calcInitialVisible
       then bottomed out at the 5-row floor. */
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 420px;
}
/* Re-assert display:none for cards toggled off via the [hidden] attribute.
   Without this, our `display: flex` above would override the UA-stylesheet
   default for [hidden] (same specificity → last one wins) and the inactive
   view would stay visible underneath the active one. */
.scanner-card[hidden] { display: none; }
.scanner-controls,
.scanner-loadmore-row { flex-shrink: 0; }
.scanner-view-tabs { margin: 0 0 14px; }

/* Ratio breakout grouped headers + tighter bench cells. */
.ratio-table th.ratio-group-head {
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dim, #888);
    border-bottom: 1px solid var(--border, #30363d);
    padding-bottom: 4px;
}
.ratio-table th.ratio-group-bench + th.ratio-group-bench,
.ratio-table th.ratio-group-head + th.ratio-group-head {
    border-left: 1px solid var(--border, #30363d);
}
.ratio-table th.bench-cell,
.ratio-table td.bench-cell {
    padding-left: 4px;
    padding-right: 4px;
    min-width: 38px;
    font-size: 12px;
}
/* Subtle vertical separator at the start of each benchmark group. */
.ratio-table th.bench-start,
.ratio-table td.bench-start {
    border-left: 1px solid var(--border, #30363d);
}
.scanner-loadmore-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 0 4px;
}
.scanner-loadmore-info {
    font-size: 12px;
    color: var(--dim, #888);
}

.scanner-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 24px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.scanner-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.scanner-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dim);
    font-weight: 500;
}
.scanner-select,
.scanner-input {
    background: var(--subtle-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    font-family: inherit;
    min-width: 90px;
}
.scanner-input { min-width: 160px; text-align: right; font-variant-numeric: tabular-nums; }
.scanner-select:focus,
.scanner-input:focus {
    outline: none;
    border-color: var(--blue);
}

.scanner-meta {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 12px;
    color: var(--dim);
}
.scanner-count { font-weight: 600; color: var(--text); }

.scanner-table-wrap {
    /* Inherits flex: 1 1 auto + min-height: 0 + overflow-y: auto from
       .cs-table-wrap, so the wrap fills whatever vertical space the
       flex parent (.scanner-card) hands it. We only add horizontal
       scroll for ratio view's wide table on narrow laptops. */
    overflow-x: auto;
}
.scanner-table { font-variant-numeric: tabular-nums; }
.scanner-table th.scanner-num,
.scanner-table td.scanner-num { text-align: right; white-space: nowrap; }
.scanner-table th.scanner-flag,
.scanner-table td.scanner-flag { text-align: center; width: 56px; }
.scanner-table td.scanner-symbol { font-weight: 600; }
.scanner-table td.pos { color: var(--green, #1faa64); }
.scanner-table td.neg { color: var(--red,   #d34b4b); }
.scanner-table td.top10 { color: var(--green, #1faa64); font-weight: 700; }
.scanner-table .scanner-tick {
    display: inline-block;
    color: var(--green, #1faa64);
    font-size: 14px;
    line-height: 1;
}

/* ── Stock scanner (OBV vs price, windows as columns) ─────────────────── */
.ss-table th.ss-group-head {
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dim, #888);
    border-bottom: 1px solid var(--border, #30363d);
    border-left: 1px solid var(--border, #30363d);
    padding-bottom: 4px;
}
.ss-table thead tr:last-child th { font-size: 11px; color: var(--dim, #888); font-weight: 600; }
/* vertical separator at the start of each window group (the P sub-column) */
.ss-table thead tr:last-child th[data-col$="_price"],
.ss-table td.ss-p { border-left: 1px solid var(--border, #30363d); }
.ss-table th.cs-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ss-table th.cs-sorted-asc::after  { content: " \25B2"; font-size: 9px; opacity: .8; }
.ss-table th.cs-sorted-desc::after { content: " \25BC"; font-size: 9px; opacity: .8; }

.ss-table td.ss-sym { white-space: nowrap; }
.ss-ticker { font-weight: 700; }
.ss-sub { display: block; font-size: 11px; color: var(--dim, #888); margin-top: 1px; }
.ss-stale-tag { color: var(--red, #d34b4b); font-weight: 600; }
.ss-row-stale { opacity: .58; }

/* P = price direction (absolute); OBV/Acc = beating price (relative). */
.ss-table td.ss-pos  { color: var(--green, #1faa64); }
.ss-table td.ss-neg  { color: var(--red,   #d34b4b); }
.ss-table td.ss-beat { color: var(--green, #1faa64); }
.ss-table td.ss-lag  { color: var(--red,   #d34b4b); }
.ss-table td.ss-flag {
    font-weight: 700;
    background: color-mix(in srgb, var(--green, #1faa64) 16%, transparent);
}
.ss-table td.ss-o { opacity: .92; }   /* literal OBV column slightly de-emphasised (it's the noisy one) */

/* ───────────────────────────────────────────────────────────────────────
   YT Sentiment Analysis (scaffolding only)
   Mirrors the look-and-feel of the crypto-scanner / education cards so
   it doesn't feel like a separate site. Card chrome is borrowed via
   .education-card; everything below is YT-specific.
   ─────────────────────────────────────────────────────────────────── */

.yt-wip-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding: 10px 14px;
    background: rgba(210, 153, 34, 0.12);
    border: 1px solid rgba(210, 153, 34, 0.45);
    border-left: 3px solid var(--yellow);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
}
.yt-wip-icon { font-size: 18px; line-height: 1; }
.yt-wip-text strong { color: var(--yellow); font-weight: 700; }

.yt-card { padding: 18px 20px 16px; }
.yt-card + .yt-card { margin-top: 18px; }

.yt-card-head { margin-bottom: 14px; }
.yt-card-head h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.yt-card-sub {
    margin: 0;
    font-size: 13px;
    color: var(--dim);
}

/* Submit form */
.yt-submit-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}
.yt-url-field { flex: 0 0 360px; max-width: 360px; }
.yt-url-input {
    text-align: left !important;
    min-width: 0 !important;
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}
.yt-queue-count {
    align-self: center;
    font-size: 13px;
    color: var(--dim);
    white-space: nowrap;
}
.yt-submit-btn {
    height: 36px;
    padding: 0 18px;
    font-weight: 600;
    background-color: var(--blue);
    border-color: var(--blue);
    color: var(--bg);
}
.yt-submit-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    background-color: var(--blue);
}
.yt-submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.yt-stats-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.yt-recent {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--subtle-bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
}
.yt-recent-head {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dim);
    margin-bottom: 6px;
    font-weight: 600;
}
.yt-recent-empty {
    font-size: 13px;
    color: var(--dim);
    font-style: italic;
}
.yt-queue-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
    margin-top: 6px;
}
.yt-queue-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dim);
    padding: 4px 8px 6px;
    border-bottom: 1px solid var(--border);
}
.yt-queue-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.yt-queue-table a {
    color: var(--blue);
    text-decoration: none;
}
.yt-queue-table a:hover {
    text-decoration: underline;
}
.yt-queue-more {
    text-align: center;
    padding: 8px 0 4px;
    color: var(--dim);
    font-style: italic;
    font-size: 0.85em;
}
.yt-status-pending td:nth-child(2) { color: var(--yellow); }
.yt-status-processing td:nth-child(2) { color: var(--blue); }
.yt-status-done td:nth-child(2) { color: var(--green); }
.yt-status-error td:nth-child(2) { color: var(--red); }
.yt-status-skipped td:nth-child(2) { color: var(--dim); }

/* Sentiment-over-time controls */
.yt-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 22px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.yt-controls .scanner-select { min-width: 180px; }
.yt-hidden { display: none !important; }

/* Placeholder chart panel */
.yt-chart-placeholder {
    position: relative;
    height: 320px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background:
        linear-gradient(transparent 0 calc(50% - 1px), var(--border) calc(50% - 1px) calc(50% + 0px), transparent calc(50% + 0px)),
        repeating-linear-gradient(
            to right,
            transparent 0 calc(10% - 1px),
            rgba(139, 148, 158, 0.10) calc(10% - 1px) 10%
        ),
        var(--card);
    overflow: hidden;
}
.yt-chart-mock {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.55;
}
.yt-mock-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 2px;
}
.yt-mock-line-bull {
    top: 32%;
    background: linear-gradient(to right,
        transparent 0%,
        var(--green) 8%,
        var(--green) 92%,
        transparent 100%);
    clip-path: polygon(
        0 60%, 6% 50%, 14% 65%, 22% 40%, 30% 55%, 38% 30%,
        46% 45%, 54% 25%, 62% 35%, 70% 20%, 78% 30%, 86% 15%, 94% 25%, 100% 18%,
        100% 100%, 0 100%);
}
.yt-mock-line-bear {
    top: 64%;
    background: linear-gradient(to right,
        transparent 0%,
        var(--red) 8%,
        var(--red) 92%,
        transparent 100%);
    clip-path: polygon(
        0 40%, 6% 55%, 14% 35%, 22% 60%, 30% 45%, 38% 70%,
        46% 55%, 54% 75%, 62% 65%, 70% 80%, 78% 70%, 86% 85%, 94% 75%, 100% 82%,
        100% 100%, 0 100%);
}
.yt-mock-zero {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 1px;
    background: var(--border);
}
.yt-chart-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 20px;
}
.yt-overlay-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.yt-overlay-text {
    max-width: 420px;
    font-size: 13px;
    color: var(--dim);
    line-height: 1.5;
}

/* Stat row under the chart */
.yt-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}
.yt-stat {
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.yt-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dim);
    margin-bottom: 4px;
    font-weight: 600;
}
.yt-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.yt-stat-bull { color: var(--green); }
.yt-stat-bear { color: var(--red); }

@media (max-width: 720px) {
    .yt-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .yt-submit-btn { width: 100%; }
}

/* YT Comment detail modal */
.yt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.yt-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 560px;
    width: 92%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px 32px 24px;
    position: relative;
}
.yt-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    color: var(--dim);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.yt-modal-close:hover { color: var(--fg); }
.yt-modal-loading,
.yt-modal-error {
    text-align: center;
    color: var(--dim);
    padding: 24px 0;
}
.yt-modal-video {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-word;
}
.yt-modal-video a { color: var(--blue); text-decoration: none; }
.yt-modal-video a:hover { text-decoration: underline; }
.yt-modal-channel {
    font-size: 13px;
    color: var(--dim);
    margin-bottom: 4px;
}
.yt-modal-date {
    font-size: 12px;
    color: var(--dim);
    margin-bottom: 14px;
}
.yt-modal-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--fg);
    background: var(--subtle-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}
.yt-modal-author {
    font-size: 13px;
    color: var(--dim);
    font-style: italic;
    margin-bottom: 14px;
}
.yt-modal-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.yt-modal-asset-tag {
    display: inline-block;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: capitalize;
}
.yt-modal-sentiment-bearish { background: rgba(248,81,73,0.2); color: #f85149; }
.yt-modal-sentiment-neutral { background: rgba(139,158,255,0.2); color: #8b9eff; }
.yt-modal-sentiment-bullish { background: rgba(126,231,135,0.2); color: #7ee787; }

/* HotCopper tracked-ticker chip row */
.hc-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--subtle-bg);
    border: 1px dashed var(--border);
    border-radius: 8px;
    min-height: 56px;
    align-items: center;
}
.hc-chip-empty {
    color: var(--dim);
    font-size: 13px;
    font-style: italic;
}
.hc-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    font-family: inherit;
}
.hc-chip:hover {
    background: var(--bg);
    border-color: var(--blue);
}
.hc-chip.active {
    border-color: var(--blue);
    background: rgba(88, 166, 255, 0.12);
}
.hc-chip-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 13px;
    color: var(--blue);
    letter-spacing: 0.04em;
}
.hc-chip-count {
    font-size: 11px;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

/* ── ASX Sector Data (split panel) ──────────────────────────────────── */
/* Same pattern as .scanner-card: give the container an explicit height
   tied to the viewport (minus page-header + breathing room), then let the
   left/right panes scroll inside via `min-height: 0; overflow: auto`. */
.sectors-split {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    align-items: stretch;
    height: calc(100vh - 150px);
    min-height: 480px;
}
.sectors-split-left {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
    min-height: 0;
}
.sectors-split-left ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sectors-split-left li {
    display: grid;
    grid-template-columns: 1.6em 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}
.sectors-split-left li:hover {
    background: var(--subtle-bg);
}
.sectors-split-left li.active {
    background: rgba(88, 166, 255, 0.10);
    border-left: 3px solid var(--blue);
    padding-left: 13px;
}
.sectors-split-left li.sectors-split-loading {
    display: block;
    color: var(--dim);
    font-style: italic;
    cursor: default;
}
.sectors-split-left li.sectors-split-loading:hover {
    background: transparent;
}
.sectors-split-emoji {
    font-size: 16px;
    line-height: 1;
    text-align: center;
}
.sectors-split-name {
    color: var(--text);
    font-weight: 500;
}
.sectors-split-left li .sectors-split-code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--blue);
    background: rgba(88, 166, 255, 0.10);
    padding: 1px 6px;
    border-radius: 3px;
}

.sectors-split-right {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
    min-height: 0;
}
.sectors-split-head {
    padding: 20px 24px;
    background: var(--subtle-bg);
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
    overflow: hidden;
}
.sectors-split-head h2 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
}
.sectors-split-head-code {
    font-family: 'Courier New', monospace;
    color: var(--dim);
    font-size: 14px;
    margin-left: 6px;
    font-weight: 400;
}
.sectors-split-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 8px;
    color: var(--dim);
    font-size: 13px;
}
.sectors-split-stats strong {
    color: var(--text);
    font-weight: 600;
}
.sectors-split-watermark {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 96px;
    line-height: 1;
    opacity: 0.12;
    pointer-events: none;
    user-select: none;
}

/* Copy buttons (TradingView paste formats) — two buttons sit over the
   watermark on the right side of the sector header.
   - "Copy tickers": every holding, ASX:CODE,ASX:CODE,…
   - "Copy ratios": top 20 holdings, each paired with the sector index and
     with the other top-20 stocks (400 entries).
   Both switch to a green "copied" state for ~1.8s after a clipboard write. */
.sectors-split-copy-row {
    position: absolute;
    right: 18px;
    bottom: 16px;
    z-index: 2;
    display: inline-flex;
    gap: 8px;
}
.sectors-split-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sectors-split-copy:hover {
    background: var(--subtle-bg);
    border-color: var(--blue);
    color: var(--blue);
}
.sectors-split-copy:active { transform: translateY(1px); }
.sectors-split-copy.is-copied {
    background: rgba(46, 160, 67, 0.12);
    border-color: #2ea043;
    color: #2ea043;
}
.sectors-split-copy-icon { font-size: 13px; line-height: 1; }

.sectors-split-table-wrap {
    /* table inherits scroll from the parent .sectors-split-right */
}
.sectors-split-table {
    width: 100%;
    border-collapse: collapse;
}
.sectors-split-table th {
    text-align: left;
    color: var(--dim);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}
.sectors-split-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.sectors-split-table tbody tr:last-child td {
    border-bottom: none;
}
.sectors-split-table tbody tr:hover td {
    background: var(--subtle-bg);
}
.sectors-split-table .sectors-split-num,
.sectors-split-table th.sectors-split-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.sectors-split-table .sectors-split-ticker {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--blue);
}

@media (max-width: 880px) {
    #asx-sectors.active {
        min-height: 0;
    }
    .sectors-split {
        grid-template-columns: 1fr;
        flex: 0 1 auto;
    }
    .sectors-split-left {
        max-height: 320px;
    }
    .sectors-split-watermark {
        font-size: 64px;
    }
    .sectors-split-copy-row {
        right: 12px;
        bottom: 12px;
        gap: 6px;
    }
    .sectors-split-copy {
        padding: 6px 10px;
        font-size: 11px;
    }
}

