@font-face {
    font-family: 'Young Typeface';
    src: url('assets/fonts/Young%20Typeface.otf') format('opentype');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Young Display';
    src: url('assets/fonts/Young%20Typeface%20-%20Bold%20Display.otf') format('opentype');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}
/* ═══════════════════════════════════════════════════
   GEN Z QUANT DASHBOARD — CSS STYLES
   Aesthetics: Modern Premium Glassmorphism, Rounded, Jitter-style Transitions
   ═══════════════════════════════════════════════════ */

/* ── Base Tokens & Constants ── */
:root {
    --font-family: 'Young Typeface', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Animation Easing Styles (Jitter-like) */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: 0.2s var(--ease-out);
    --transition-normal: 0.35s var(--ease-out);
    --transition-slow: 0.5s var(--ease-spring);
    
    /* Layout Constants */
    --sidebar-width: 280px;
    --header-height: 72px;
}

/* ── NEUTRAL PALETTES: LIGHT MODE ── */
body.light-mode {
    --bg-base: #f4f7fa;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-gray: #f8fafc;
    --bg-box-highlight: #f0f9ff;
    --text-base: #0f172a;
    --text-muted: #475569;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.05), 0 2px 6px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 16px 32px -4px rgba(15,23,42,0.06), 0 4px 12px -2px rgba(15,23,42,0.03);
    --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.03);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
}

/* ── NEUTRAL PALETTES: DARK MODE ── */
body.dark-mode {
    --bg-base: #0b0f19;
    --bg-surface: #121824;
    --bg-card: #182030;
    --bg-gray: #1f2a3c;
    --bg-box-highlight: #0d2238;
    --text-base: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #475569;
    --border: #242f41;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 6px 18px -2px rgba(0,0,0,0.25), 0 2px 6px -1px rgba(0,0,0,0.15);
    --shadow-lg: 0 24px 48px -6px rgba(0,0,0,0.35), 0 8px 18px -2px rgba(0,0,0,0.2);
    --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.2);
    --glass-bg: rgba(18, 24, 36, 0.7);
    --glass-border: rgba(36, 47, 65, 0.4);
}

/* ── 7 THEME COLORS x 2 MODES ── */

/* Theme 1: Ocean Blue (Default) */
body.light-mode.theme-ocean {
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;
    --primary-glow: rgba(14, 165, 233, 0.2);
}
body.dark-mode.theme-ocean {
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --primary-light: #0c4a6e;
    --primary-glow: rgba(56, 189, 248, 0.25);
}

/* Theme 2: Emerald Mint */
body.light-mode.theme-emerald {
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-light: #d1fae5;
    --primary-glow: rgba(16, 185, 129, 0.2);
}
body.dark-mode.theme-emerald {
    --primary: #34d399;
    --primary-hover: #10b981;
    --primary-light: #064e3b;
    --primary-glow: rgba(52, 211, 153, 0.25);
}

/* Theme 3: Sunset Orange */
body.light-mode.theme-orange {
    --primary: #f97316;
    --primary-hover: #ea580c;
    --primary-light: #ffedd5;
    --primary-glow: rgba(249, 115, 22, 0.2);
}
body.dark-mode.theme-orange {
    --primary: #fb923c;
    --primary-hover: #f97316;
    --primary-light: #7c2d12;
    --primary-glow: rgba(251, 146, 60, 0.25);
}

/* Theme 4: Cyber Pink */
body.light-mode.theme-pink {
    --primary: #ec4899;
    --primary-hover: #db2777;
    --primary-light: #fce7f3;
    --primary-glow: rgba(236, 72, 153, 0.2);
}
body.dark-mode.theme-pink {
    --primary: #f472b6;
    --primary-hover: #ec4899;
    --primary-light: #831843;
    --primary-glow: rgba(244, 114, 182, 0.25);
}

/* Theme 5: Lavender Dream */
body.light-mode.theme-lavender {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-light: #ede9fe;
    --primary-glow: rgba(139, 92, 246, 0.2);
}
body.dark-mode.theme-lavender {
    --primary: #a78bfa;
    --primary-hover: #8b5cf6;
    --primary-light: #4c1d95;
    --primary-glow: rgba(167, 139, 250, 0.25);
}

/* Theme 6: Sunshine Gold */
body.light-mode.theme-gold {
    --primary: #eab308;
    --primary-hover: #ca8a04;
    --primary-light: #fef9c3;
    --primary-glow: rgba(234, 179, 8, 0.2);
}
body.dark-mode.theme-gold {
    --primary: #facc15;
    --primary-hover: #eab308;
    --primary-light: #713f12;
    --primary-glow: rgba(250, 204, 21, 0.25);
}

/* Theme 7: Crimson Fire */
body.light-mode.theme-crimson {
    --primary: #ef4444;
    --primary-hover: #dc2626;
    --primary-light: #fee2e2;
    --primary-glow: rgba(239, 68, 68, 0.2);
}
body.dark-mode.theme-crimson {
    --primary: #f87171;
    --primary-hover: #ef4444;
    --primary-light: #7f1d1d;
    --primary-glow: rgba(248, 113, 113, 0.25);
}

/* ── Reset & Baseline Styles ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: var(--font-family);
    background: var(--bg-base);
    color: var(--text-base);
    overflow-x: hidden;
    height: 100%;
    transition: background 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

button {
    font-family: var(--font-family);
    border: none;
    outline: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Interactive Particle Background ── */
#app-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

/* ── SPA Main Layout ── */
.app-layout {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar Component ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform var(--transition-normal), background 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
    z-index: 100;
}

.sidebar-brand {
    padding: 1.35rem 1.75rem 1.15rem;
    border-bottom: 1px solid var(--border);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0;
}

.app-brand-logo {
    display: block;
    width: min(176px, 100%);
    height: auto;
}

.brand-mascot {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(14, 165, 233, 0.15));
    transition: transform var(--transition-slow);
}

.brand-link:hover .brand-mascot {
    transform: rotate(10deg) scale(1.1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.logo-name {
    font-size: 1.85rem;
    line-height: 0.95;
    font-weight: 900;
    color: var(--text-base);
    background: none;
    -webkit-text-fill-color: currentColor;
    letter-spacing: 0;
}

.logo-badge {
    font-size: 1.02rem;
    line-height: 1.15;
    font-weight: 650;
    color: var(--text-muted);
    letter-spacing: 0;
    margin-top: 0;
}

/* Wallet Widget in Sidebar */
.wallet-widget {
    margin: 1.25rem 1.5rem;
    padding: 1.25rem;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: all 0.4s var(--ease-out);
}

.wallet-widget:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.wallet-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.wallet-balance {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.wallet-icon {
    font-size: 1.35rem;
    margin-right: 4px;
}

.balance-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-base);
    letter-spacing: -0.5px;
}

.balance-unit {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}

.wallet-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Sidebar Menu Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
}

.nav-item i {
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-base);
    background: var(--bg-gray);
}

.nav-item:hover i {
    transform: scale(1.15);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-item.active i {
    color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-theme-toggle-trigger {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.btn-theme-toggle-trigger:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Main Content Container ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Header Component */
.app-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 10;
    transition: background 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.header-action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.header-action-btn i {
    font-size: 1.25rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 8px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 9999px;
}

.user-avatar {
    font-size: 1.25rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-base);
}

.user-logout-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-logout-btn:hover {
    border-color: var(--border);
    background: var(--bg-gray);
    color: var(--primary);
}

/* Viewport for tab contents */
.tab-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.tab-panel {
    display: none;
    animation: tabSlideIn var(--transition-normal);
}

.tab-panel.active {
    display: block;
}

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

/* ── Common Panels & Cards ── */
.panel-intro-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-base));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.panel-intro-card::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

.intro-text h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.intro-text p {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.6;
}

.intro-progress-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    min-width: 260px;
    box-shadow: var(--shadow-sm);
}

.progress-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.progress-track {
    height: 8px;
    width: 100%;
    background: var(--bg-gray);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 9999px;
    transition: width 0.5s var(--ease-out);
}

.progress-percent {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 6px;
    text-align: right;
}

.intro-image-mock {
    font-size: 4rem;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
}

/* Generic Layout boxes */
.bg-box-gray {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
}

.bg-box-highlight {
    background: var(--bg-box-highlight);
    border: 1px solid var(--primary-glow);
    border-radius: 16px;
    padding: 1.25rem;
}

.bg-box-green {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 16px;
    padding: 1.25rem;
}

.text-highlight {
    color: var(--primary);
    font-weight: 700;
}

.text-green {
    color: #10b981;
    font-weight: 700;
}

.text-red {
    color: #ef4444;
    font-weight: 700;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 11px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
}

.btn-outline:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

/* DORY Home */
.home-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.home-hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 2rem;
    align-items: end;
    padding: clamp(1.5rem, 4vw, 3rem);
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-box-highlight) 100%);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.home-hero-copy h2 {
    max-width: 760px;
    margin: 0.75rem 0 0.85rem;
    color: var(--text-base);
    font-family: 'Young Display', var(--font-family);
    font-size: clamp(2rem, 5vw, 4.6rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.home-hero-copy p,
.home-lab-card p,
.home-sim-card p {
    max-width: 640px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.65;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.home-hero-actions .btn-primary,
.home-hero-actions .btn-outline,
.home-sim-card .btn-primary {
    gap: 0.5rem;
}

.home-discipline-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    padding-left: 1.25rem;
    border-left: 3px solid var(--primary);
}

.home-discipline-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    min-width: 78px;
    color: var(--primary);
    font-family: 'Young Display', var(--font-family);
    font-weight: 900;
}

.home-discipline-score span {
    font-size: 3.2rem;
    line-height: 1;
}

.home-discipline-score small {
    color: var(--text-muted);
    font-size: 1.15rem;
    font-weight: 800;
}

.home-discipline-card strong {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-base);
    font-size: 1.1rem;
}

.home-discipline-card p {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-weight: 650;
}

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    grid-template-areas:
        "roadmap daily"
        "roadmap assistant"
        "lab journal"
        "sim journal";
    gap: 1rem;
}

.home-roadmap-card,
.home-daily-card,
.home-lab-card,
.home-sim-card,
.home-journal-card,
.home-assistant-anchor .dory-assistant-panel {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    padding: 1.35rem;
}

.home-roadmap-card {
    grid-area: roadmap;
}

.home-daily-card {
    grid-area: daily;
}

.home-assistant-anchor {
    grid-area: assistant;
}

.home-lab-card {
    grid-area: lab;
}

.home-sim-card {
    grid-area: sim;
}

.home-journal-card {
    grid-area: journal;
}

.home-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.home-card-head h3,
.home-lab-card h3,
.home-sim-card h3,
.home-journal-card h3 {
    margin: 0.2rem 0 0;
    color: var(--text-base);
    font-size: clamp(1.18rem, 2.5vw, 1.55rem);
    line-height: 1.15;
}

.home-card-label {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.home-time-pill,
.home-date-pill {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-gray);
    color: var(--text-muted);
    padding: 0.45rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 800;
}

.home-roadmap-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.home-roadmap-list li {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-gray);
}

.home-roadmap-list li.done {
    border-color: rgba(16, 185, 129, 0.38);
    background: rgba(16, 185, 129, 0.08);
}

.home-roadmap-list li.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.home-roadmap-list li > span {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 850;
}

.home-roadmap-list li.done > span,
.home-roadmap-list li.active > span {
    border-color: var(--primary);
    color: var(--primary);
}

.home-roadmap-list strong {
    display: block;
    color: var(--text-base);
    font-size: 0.95rem;
    line-height: 1.25;
}

.home-roadmap-list small {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.home-market-mood {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.9rem;
    border-radius: 14px;
    background: var(--primary-light);
}

.home-market-mood span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.home-market-mood small {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
    text-transform: none;
}

.home-market-mood strong {
    color: var(--text-base);
    text-align: right;
}

.home-daily-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.home-daily-list li {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0.65rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.home-daily-list i {
    color: var(--primary);
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.home-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--primary);
    font-weight: 850;
}

.home-inline-action:hover {
    gap: 0.7rem;
}

.home-ticker-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 1rem;
}

.home-ticker-row button {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-gray);
    color: var(--text-base);
    font-weight: 850;
}

.home-ticker-row button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.home-journal-intro {
    margin-top: 0.55rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.home-journal-form {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
}

.home-journal-field {
    display: grid;
    gap: 0.4rem;
}

.home-journal-field > span {
    color: var(--text-base);
    font-size: 0.86rem;
    font-weight: 800;
}

.home-journal-field textarea,
.home-journal-field select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--bg-gray);
    color: var(--text-base);
    padding: 0.75rem 0.8rem;
    font: inherit;
    line-height: 1.45;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.home-journal-field textarea {
    min-height: 86px;
    resize: vertical;
}

.home-journal-field textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.home-journal-field textarea:focus,
.home-journal-field select:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.home-journal-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.home-journal-actions .btn-primary {
    min-height: 42px;
}

.home-journal-clear {
    min-height: 42px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    font-weight: 750;
}

.home-journal-clear:hover {
    color: var(--color-danger, #dc2626);
}

.home-journal-status {
    min-height: 1.25rem;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.home-journal-status.is-saved {
    color: #059669;
}

.home-journal-status.is-error {
    color: #dc2626;
}

.home-journal-privacy {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin: -0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.home-journal-privacy i {
    flex: 0 0 auto;
    margin-top: 0.08rem;
    color: var(--primary);
}

.home-journal-form.is-invalid .home-journal-field textarea:invalid,
.home-journal-form.is-invalid .home-journal-field select:invalid {
    border-color: #dc2626;
}

.bctc-rag-summary {
    max-height: 250px;
    margin-top: 8px;
    overflow-y: auto;
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    background: var(--bg-gray);
    padding: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-line;
}

.quant-evidence-note {
    margin: 0.6rem 0 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-gray);
    color: var(--text-muted);
    padding: 0.65rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.45;
}

.home-journal-prompts span {
    display: block;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    background: var(--bg-gray);
    font-weight: 700;
}

.home-assistant-anchor {
    min-width: 0;
}

.home-assistant-anchor .dory-assistant-panel {
    margin: 0;
}

.home-assistant-anchor .dory-assistant-head {
    align-items: flex-start;
}

.home-assistant-anchor .dory-answer-box {
    min-height: 118px;
}

/* Course selector */
.course-catalog {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.course-card {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.course-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.course-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.course-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.course-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.course-kicker {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.course-title {
    font-size: 0.95rem;
    font-weight: 850;
    color: var(--text-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 650;
}

.course-progress-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--bg-surface) 52%, transparent 53%),
        conic-gradient(var(--primary) var(--course-progress), var(--border) 0);
    border: 1px solid var(--border);
}

/* ─── TAB 1: ACADEMY LAYOUT ─── */
.academy-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

.lessons-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-sec-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-left: 6px;
}

.lesson-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lesson-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lesson-list-item:hover {
    background: var(--bg-gray);
}

.lesson-status-icon {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-top: 2px;
}

.lesson-meta {
    display: flex;
    flex-direction: column;
}

.lesson-number {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-light);
}

.lesson-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 2px;
}

.lesson-list-item.active {
    background: var(--primary-light);
}

.lesson-list-item.active .lesson-status-icon {
    color: var(--primary);
}

.lesson-list-item.active .lesson-title {
    color: var(--text-base);
}

.lesson-list-item.completed .lesson-status-icon {
    color: #10b981;
}

/* Lesson Viewer Panel */
.lesson-viewer {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.lesson-content-card {
    padding: 2.5rem;
}

.lesson-header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.lesson-badge-category {
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.lesson-read-time {
    font-size: 0.78rem;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lesson-display-title {
    font-size: 1.8rem;
    font-weight: 850;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.lesson-body-text {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.lesson-body-text p {
    margin-bottom: 1rem;
}

.lesson-body-text ul {
    margin: 1rem 0 1.5rem 1.5rem;
}

.lesson-body-text li {
    margin-bottom: 0.5rem;
}

.lesson-body-text strong {
    color: var(--text-base);
}

/* Quiz Box Styles */
.quiz-box {
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    background: var(--bg-gray);
    transition: border-color var(--transition-normal);
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.quiz-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.quiz-reward {
    background: #eab308;
    color: #0f172a;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
}

.quiz-question {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-base);
    margin-bottom: 1.25rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-opt-btn {
    width: 100%;
    text-align: left;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

.quiz-opt-btn:hover {
    border-color: var(--primary);
    background: var(--bg-base);
    color: var(--text-base);
}

.quiz-opt-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: transparent;
    font-weight: 800;
}

.quiz-opt-btn.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
    color: #10b981;
}

.quiz-opt-btn.correct .quiz-opt-indicator {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.quiz-opt-btn.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    color: #ef4444;
}

.quiz-opt-btn.wrong .quiz-opt-indicator {
    border-color: #ef4444;
    background: #ef4444;
    color: white;
}

.quiz-result-message {
    margin-top: 1rem;
    font-size: 0.92rem;
    font-weight: 700;
    display: none;
    animation: tabSlideIn 0.3s;
}

.quiz-result-message.success {
    display: block;
    color: #10b981;
}

.quiz-result-message.error {
    display: block;
    color: #ef4444;
}

/* ─── TAB 2: SAVINGS CALCULATOR LAYOUT ─── */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.calc-inputs-card, .calc-results-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.section-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Preset savings buttons grid */
.preset-savings-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.btn-preset {
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 75px;
}

.btn-preset:hover {
    border-color: var(--primary);
    background: var(--bg-base);
}

.btn-preset.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.preset-emoji {
    font-size: 1.25rem;
}

.preset-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preset-name {
    font-size: 0.68rem;
    font-weight: 700;
}

.preset-cost {
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.85;
}

/* Custom numbers inputs */
.input-with-addon {
    display: flex;
    align-items: center;
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.input-with-addon:focus-within {
    border-color: var(--primary);
}

.input-with-addon input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-base);
}

.input-addon {
    background: var(--border);
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-note {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* Frequency switcher */
.frequency-toggle {
    display: flex;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 12px;
    gap: 4px;
}

.btn-freq {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.btn-freq:hover {
    color: var(--text-base);
}

.btn-freq.active {
    background: var(--bg-surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Sliders custom styles */
.slider-control {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 9999px;
    background: var(--border);
    outline: none;
    margin: 10px 0;
}

.slider-control::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px var(--primary-glow);
    transition: transform 0.1s;
}

.slider-control::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Result Statistics inside Calculator */
.stats-result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.stat-res-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 8px;
}

.stat-res-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-res-val {
    font-size: 0.95rem;
    font-weight: 800;
    word-break: break-all;
}

/* SVG Chart details */
.chart-container {
    margin-top: 1.5rem;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 10px;
}

.legend-item {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.color-invest {
    background: var(--primary);
}

.color-idle {
    background: var(--text-light);
}

.svg-chart-wrapper {
    width: 100%;
    height: 220px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
}

.result-analysis-box {
    margin-top: 1.5rem;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 12px;
    background: var(--primary-light);
}

.analysis-icon {
    font-size: 1.25rem;
}

.analysis-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ─── TAB 3: QUANT LITE LAYOUT ─── */
.quant-intro {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.quant-intro h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.quant-intro p {
    font-size: 0.92rem;
    color: var(--text-muted);
}

/* Stock selector bar */
.ticker-selectors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.ticker-btn {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

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

.ticker-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.ticker-btn .t-name {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text-base);
}

.ticker-btn .t-desc {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}

.ticker-btn.active .t-name {
    color: var(--primary);
}

/* Stock Dashboard Grid */
.stock-dashboard {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
}

.stock-dashboard.is-hidden,
.market-overview-dashboard.is-hidden {
    display: none;
}

.derivatives-shell {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.derivatives-hero,
.derivatives-chart-card,
.derivatives-metrics-card,
.derivatives-scenario-card,
.derivatives-hedge-card,
.derivatives-learning-grid > div {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.derivatives-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem;
    background:
        linear-gradient(135deg, var(--primary-light) 0%, rgba(255,255,255,0) 60%),
        var(--bg-surface);
}

.derivatives-hero h2 {
    margin: 0.55rem 0 0.4rem;
    color: var(--text-base);
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    font-weight: 900;
    letter-spacing: 0;
}

.derivatives-hero p {
    max-width: 780px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.derivatives-status {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    color: var(--text-muted);
    background: var(--bg-gray);
    font-size: 0.78rem;
    font-weight: 900;
}

.derivatives-status.success {
    color: #059669;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
}

.derivatives-status.error {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.22);
}

.derivatives-contract-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.derivative-contract-btn {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-surface);
    color: var(--text-base);
    padding: 0.9rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.derivative-contract-btn span,
.derivative-contract-btn small {
    display: block;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.derivative-contract-btn strong {
    display: block;
    margin: 0.2rem 0;
    font-size: 1.35rem;
    color: var(--text-base);
}

.derivative-contract-btn:hover,
.derivative-contract-btn.active {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px var(--primary-glow);
}

.derivative-contract-btn.active {
    background: linear-gradient(135deg, var(--primary-light), var(--bg-surface));
}

.derivatives-grid,
.derivatives-lab-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
    gap: 1rem;
}

.derivatives-chart-card,
.derivatives-metrics-card,
.derivatives-scenario-card,
.derivatives-hedge-card {
    padding: 1rem;
}

.derivatives-chart-head,
.derivatives-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.derivatives-chart-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.derivatives-range-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-gray);
}

.derivatives-range-btn {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    padding: 0.45rem 0.7rem;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 900;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.derivatives-range-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 8px 18px var(--primary-glow);
}

.derivatives-quote-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.derivatives-quote-board div {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-gray);
    padding: 0.65rem 0.7rem;
}

.derivatives-quote-board span {
    display: block;
    color: var(--text-light);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.derivatives-quote-board strong {
    display: block;
    margin-top: 0.2rem;
    color: var(--text-base);
    font-size: 0.98rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.derivatives-card-head h3 {
    margin: 0 0 0.3rem;
    color: var(--text-base);
    font-size: 1.05rem;
    font-weight: 900;
}

.derivatives-card-head p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.86rem;
}

.derivatives-chart-area {
    width: 100%;
    height: 420px;
    min-height: 420px;
    max-height: 420px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-gray);
    overflow: hidden;
    contain: layout paint;
    position: relative;
}

.derivatives-chart-area > .js-plotly-plot,
.derivatives-chart-area .plot-container,
.derivatives-chart-area .svg-container,
.derivatives-chart-area .main-svg {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.derivatives-risk-note {
    padding: 1rem;
    border-radius: 16px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.derivatives-risk-note strong {
    display: block;
    color: var(--text-base);
    font-size: 1rem;
    margin: 0.25rem 0;
}

.derivatives-risk-note p {
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
    font-size: 0.86rem;
}

.derivatives-plain-summary {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(14, 165, 233, 0.24);
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.08);
    color: var(--text-muted);
    line-height: 1.55;
    font-size: 0.86rem;
}

.derivatives-plain-summary strong {
    color: var(--text-base);
}

.derivatives-plain-summary ul {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
}

.derivatives-plain-summary li + li {
    margin-top: 0.25rem;
}

.derivatives-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.derivatives-mini-metric {
    min-width: 0;
    padding: 0.85rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-gray);
}

.derivatives-mini-metric span {
    display: block;
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.derivatives-mini-metric strong {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-base);
    font-size: 1rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.derivatives-mini-metric small {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    line-height: 1.35;
    font-size: 0.72rem;
}

.derivatives-source-note {
    margin-top: 0.85rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.derivatives-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.derivatives-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
}

.derivatives-table th,
.derivatives-table td {
    padding: 0.82rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    color: var(--text-base);
    font-size: 0.86rem;
    white-space: nowrap;
}

.derivatives-table th {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    background: var(--bg-gray);
}

.derivatives-table tr:last-child td {
    border-bottom: 0;
}

.derivatives-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.derivatives-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.derivatives-form-grid input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-gray);
    color: var(--text-base);
    padding: 0.75rem 0.8rem;
    font-family: inherit;
    font-weight: 800;
}

.derivatives-hedge-result {
    margin-top: 0.9rem;
    color: var(--text-muted);
    line-height: 1.55;
    font-size: 0.88rem;
}

.derivatives-hedge-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.8rem;
}

.derivatives-hedge-summary div {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-gray);
    padding: 0.75rem;
}

.derivatives-hedge-summary span {
    display: block;
    color: var(--text-light);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.derivatives-hedge-summary strong {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-base);
    overflow-wrap: anywhere;
}

.derivatives-zero-note {
    padding: 0.75rem;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.10);
    color: var(--text-muted);
    border: 1px solid rgba(245, 158, 11, 0.18);
    margin-bottom: 0.8rem;
}

.derivatives-learning-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.derivatives-learning-grid > div {
    padding: 1rem;
}

.derivatives-learning-grid strong {
    display: block;
    margin: 0.25rem 0 0.35rem;
    color: var(--text-base);
    font-size: 1rem;
}

.derivatives-learning-grid p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
    font-size: 0.86rem;
}

.market-overview-dashboard {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.market-overview-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        linear-gradient(135deg, var(--primary-light) 0%, rgba(255,255,255,0) 58%),
        var(--bg-gray);
    margin-bottom: 1rem;
}

.market-hero-copy h3 {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-base);
    margin: 0 0 0.35rem;
    letter-spacing: 0;
}

.market-hero-copy p {
    max-width: 620px;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0;
}

.market-switcher {
    display: inline-flex;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 5px;
    flex-shrink: 0;
}

.market-switch-btn {
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 900;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.market-switch-btn:hover {
    color: var(--primary);
}

.market-switch-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 14px var(--primary-glow);
}

.market-overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
    gap: 1rem;
}

.market-chart-panel,
.market-metrics-panel,
.market-insight-strip > div {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-gray);
}

.market-chart-panel {
    padding: 1rem;
    min-width: 0;
}

.market-chart-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.market-active-label,
.market-small-label {
    display: block;
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.market-value-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 3px;
}

.market-value-row strong {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-base);
}

.market-change-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-muted);
    padding: 5px 9px;
    font-size: 0.78rem;
    font-weight: 900;
}

.market-change-badge.positive {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.market-change-badge.negative {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.market-updated-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-light);
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 850;
    white-space: nowrap;
}

.market-plot-area {
    width: 100%;
    height: clamp(320px, 38vw, 460px);
    min-height: 320px;
    border: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
    border-radius: 14px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--primary) 7%, var(--bg-surface)) 0%, var(--bg-surface) 74%),
        var(--bg-surface);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.market-plot-area .main-svg {
    border-radius: inherit;
}

.market-plot-area .js-plotly-plot,
.market-plot-area .plot-container,
.market-plot-area .svg-container,
.market-plot-area .main-svg {
    width: 100% !important;
    height: 100% !important;
}

.market-chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.82rem;
    font-weight: 800;
}

.market-fallback-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.market-chart-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0.8rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 750;
}

.market-chart-foot span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.market-chart-foot i {
    color: var(--primary);
}

.market-metrics-panel {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.market-regime-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-surface);
    padding: 1rem;
}

.market-regime-card strong {
    display: block;
    color: var(--text-base);
    font-size: 1.1rem;
    font-weight: 900;
    margin-top: 4px;
}

.market-regime-card p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    margin-top: 6px;
}

.market-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.market-mini-metric {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
    padding: 0.9rem;
}

.market-mini-metric span {
    display: block;
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 850;
    margin-bottom: 4px;
}

.market-mini-metric strong {
    color: var(--text-base);
    font-size: 1rem;
    font-weight: 900;
}

.market-mini-metric strong.positive {
    color: #059669;
}

.market-mini-metric strong.negative {
    color: #dc2626;
}

.market-signal-stack {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-surface);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.market-signal-row {
    display: grid;
    grid-template-columns: 86px 1fr 44px;
    gap: 10px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.market-signal-row b {
    color: var(--text-base);
    text-align: right;
}

.market-signal-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.market-signal-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #10b981);
    transition: width 0.45s ease;
}

.market-signal-bar.muted i {
    background: linear-gradient(90deg, #f59e0b, var(--primary));
}

.market-insight-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.market-insight-strip > div {
    padding: 1rem;
}

.market-insight-strip strong {
    display: block;
    color: var(--text-base);
    font-size: 0.95rem;
    font-weight: 900;
    margin: 4px 0;
}

.market-insight-strip p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
}

.investment-news-radar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem;
    margin: 1.25rem 0 1.75rem;
    box-shadow: var(--shadow-sm);
}

.news-radar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.news-radar-head h3 {
    color: var(--text-base);
    font-size: 1.15rem;
    font-weight: 900;
    margin: 0.45rem 0 0.25rem;
}

.news-radar-head p {
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.5;
    max-width: 720px;
    margin: 0;
}

.news-radar-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    min-width: min(100%, 430px);
}

.news-radar-controls input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg-gray);
    color: var(--text-base);
    padding: 10px 12px;
    font-size: 0.84rem;
    font-weight: 700;
    outline: none;
}

.news-radar-controls input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-surface);
}

.news-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--primary);
    border-radius: 12px;
    background: var(--primary);
    color: white;
    padding: 10px 13px;
    font-size: 0.8rem;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.news-refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px var(--primary-glow);
}

.news-sentiment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.news-sentiment-card,
.news-radar-status {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-gray);
    padding: 0.9rem;
}

.news-sentiment-card span {
    display: block;
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.news-sentiment-card strong {
    display: block;
    color: var(--text-base);
    font-size: 1rem;
    font-weight: 900;
    margin: 4px 0 8px;
}

.news-score-track {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.news-score-track i {
    display: block;
    height: 100%;
    width: 50%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
    transition: width 0.35s ease;
}

.news-radar-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-align: center;
}

.news-radar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.news-list-panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-gray);
    padding: 1rem;
    min-width: 0;
}

.news-list-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-base);
    font-size: 0.9rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
}

.news-list-title i {
    color: var(--primary);
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.news-item {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
    padding: 0.85rem;
    color: inherit;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.news-item:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px var(--primary-light);
}

.news-item-title {
    color: var(--text-base);
    font-size: 0.84rem;
    font-weight: 850;
    line-height: 1.35;
    margin-bottom: 0.4rem;
}

.news-item-summary {
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.45;
    margin-bottom: 0.45rem;
}

.news-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.7rem;
    font-weight: 800;
}

.news-loading-row,
.news-empty-row {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 750;
    text-align: center;
}

.stock-card-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.25rem;
    box-shadow: var(--shadow-sm);
}

.panel-header-badge {
    display: inline-block;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.bg-badge-accent {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-glow);
}

.stock-title-large {
    font-size: 1.8rem;
    font-weight: 850;
    letter-spacing: -0.5px;
}

.stock-price-block {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 1.5rem;
}

.stock-price {
    font-size: 1.6rem;
    font-weight: 800;
}

.stock-change {
    font-size: 1rem;
}

.business-info-section {
    margin-bottom: 1.5rem;
}

.business-info-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-base);
    margin-bottom: 8px;
}

.business-info-section p {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.business-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.metric-mini-card {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.metric-m-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
}

.metric-m-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-base);
}

.business-pro-con h4 {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.business-bullet-list {
    list-style: none;
    padding-left: 0;
}

.business-bullet-list li {
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 6px;
    color: var(--text-muted);
}

/* Quant factors details */
.quant-radial-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1.5rem 0 2rem;
}

.quant-score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 8px solid var(--primary-light);
    border-top-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--bg-gray);
    box-shadow: var(--shadow-sm);
}

.score-num {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.score-max {
    font-size: 0.78rem;
    color: var(--text-light);
    font-weight: 600;
}

.quant-rating-badge {
    margin-top: 12px;
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 0.88rem;
    padding: 6px 16px;
    border-radius: 9999px;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.quant-factors-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.factor-progress-item {
    margin-bottom: 4px;
}

.factor-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.factor-score {
    color: var(--primary);
}

.factor-progress-track {
    height: 6px;
    background: var(--bg-gray);
    border-radius: 9999px;
    overflow: hidden;
}

.factor-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 9999px;
    transition: width 0.6s var(--ease-out);
}

.quant-summary-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-gray);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.q-icon {
    font-size: 1.2rem;
}

.q-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ─── TAB 4: BROKERS & PARTNERS LAYOUT ─── */
.brokers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.broker-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.broker-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.broker-logo-wrap {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #ffffff;
    color: var(--color-midnight-ink);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.vps-bg {
    background: #ffffff;
}

.tcbs-bg {
    background: #ffffff;
}

.ssi-bg {
    background: #ffffff;
}

.broker-logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.broker-logo-vps {
    object-position: center;
}

.broker-logo-tcbs {
    object-position: center;
}

.broker-logo-ssi {
    object-position: center;
}

.broker-details {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.broker-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-base);
}

.broker-tags {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.b-tag {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 4px;
}

.tag-reward {
    background: #fef9c3;
    border-color: #fef08a;
    color: #854d0e;
}

.broker-features {
    list-style: none;
    margin-bottom: 1.5rem;
    flex: 1;
}

.broker-features li {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.broker-features li i {
    color: #10b981;
    font-size: 1rem;
}

/* ─── TAB 5: TOKEN SHOP LAYOUT ─── */
.shop-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    align-items: start;
}

.shop-earn-card, .shop-redeem-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.current-balance-display {
    background: var(--primary-light);
    border: 1px solid var(--primary-glow);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.bal-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bal-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

.bal-icon {
    font-size: 1.75rem;
}

.bal-number {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-base);
}

.bal-unit {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.buy-tokens-section h3 {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.buy-desc {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

.token-packages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.25rem;
}

.package-btn {
    width: 100%;
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.package-btn:hover {
    border-color: var(--primary);
    background: var(--bg-base);
}

.package-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.pkg-tokens {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-base);
}

.package-btn.active .pkg-tokens {
    color: var(--primary);
}

.pkg-cost {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
}

.package-btn.active .pkg-cost {
    color: var(--primary);
}

/* Redeem Privileges List */
.redeem-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.redeem-item {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color var(--transition-fast);
}

.redeem-item:hover {
    border-color: var(--primary-glow);
}

.item-icon {
    font-size: 1.75rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.item-details {
    flex: 1;
}

.item-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-base);
}

.item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.35;
}

.btn-redeem {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-width: 1.5px;
    border-radius: 10px;
    min-width: 95px;
}

.btn-redeem.unlocked {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* Skin manager */
.skin-manager h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.skin-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.skin-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.skin-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.skin-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-gray);
}

/* ─── FLOATING INTERACTIVE MASCOT ─── */
.mascot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

.mascot-speech-bubble {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    padding: 10px 16px;
    border-radius: 14px 14px 2px 14px;
    box-shadow: var(--shadow-lg);
    max-width: 220px;
    margin-bottom: 12px;
    transform-origin: bottom right;
    animation: bubbleAppear 0.4s var(--ease-spring);
    pointer-events: auto;
    cursor: pointer;
}

.speech-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-base);
    line-height: 1.4;
}

.mascot-character {
    width: 90px;
    height: 90px;
    position: relative;
    pointer-events: auto;
    cursor: pointer;
}

.mascot-img-char {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: appMascotFloat 3.5s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
    transition: transform 0.3s var(--ease-spring);
}

.mascot-character:hover .mascot-img-char {
    transform: scale(1.1) rotate(5deg);
}

.mascot-shadow {
    width: 60px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.12) 0%, transparent 70%);
    border-radius: 50%;
    position: absolute;
    bottom: -4px;
    left: 15px;
    animation: appMascotFloat 3.5s ease-in-out infinite reverse;
}

@keyframes appMascotFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ─── MODAL DIALOGS ─── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
    animation: modalAppear 0.35s var(--ease-spring);
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    padding: 2.25rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.modal-close:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.modal-card h3 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.qr-code-box {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.qr-mockup {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    min-width: 244px;
    min-height: 244px;
}

.payos-qr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.6rem;
    color: var(--gray-700);
    font-size: 0.82rem;
    font-weight: 800;
}

.payos-qr-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

.payos-qr-img {
    display: none;
    width: 220px;
    height: 220px;
    object-fit: contain;
}

.qr-mockup.ready .payos-qr-loading {
    display: none;
}

.qr-mockup.ready .payos-qr-img {
    display: block;
}

.qr-payment-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

.qr-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.qr-info-row strong {
    color: var(--text-base);
}

.payos-checkout-link {
    margin-bottom: 0.75rem;
    text-decoration: none;
}

/* Customizer modal custom card styling */
.customizer-card {
    max-width: 500px;
    text-align: left;
}

.customizer-sections-wrap {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.customizer-group {
    display: flex;
    flex-direction: column;
}

.custom-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.mode-selectors {
    display: flex;
    gap: 10px;
}

.mode-select-btn {
    flex: 1;
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    padding: 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.mode-select-btn:hover {
    border-color: var(--primary);
}

.mode-select-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.theme-color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.color-theme-btn {
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
}

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

.color-theme-btn.active {
    background: var(--bg-surface);
    border-color: var(--btn-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.color-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--btn-color);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
}

.color-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.color-theme-btn.active .color-name {
    color: var(--text-base);
    font-weight: 700;
}

/* ─── TOAST NOTIFICATIONS ─── */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 5px solid #10b981;
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1050;
    max-width: 320px;
    transform: translateX(-150%);
    transition: transform 0.4s var(--ease-spring);
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-icon {
    font-size: 1.6rem;
}

.toast-body h5 {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-base);
}

.toast-body p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ─── RESPONSIVE STYLES ─── */
@media (max-width: 1024px) {
    .home-hero-card,
    .home-grid {
        grid-template-columns: 1fr;
    }

    .home-grid {
        grid-template-areas:
            "roadmap"
            "daily"
            "assistant"
            "lab"
            "sim"
            "journal";
    }

    .course-catalog {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .calc-grid {
        grid-template-columns: 1fr;
    }
    
    .stock-dashboard {
        grid-template-columns: 1fr;
    }

    .market-overview-grid,
    .derivatives-grid,
    .derivatives-lab-grid,
    .derivatives-learning-grid,
    .market-insight-strip,
    .news-radar-grid,
    .news-sentiment-grid {
        grid-template-columns: 1fr;
    }

    .market-overview-hero,
    .derivatives-hero,
    .market-chart-head,
    .derivatives-chart-head,
    .news-radar-head {
        flex-direction: column;
    }

    .derivatives-chart-tools {
        width: 100%;
        justify-content: space-between;
    }

    .derivatives-quote-board {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .market-switcher,
    .market-updated-pill,
    .derivatives-status,
    .news-radar-controls,
    .news-radar-status {
        width: 100%;
    }

    .market-switch-btn {
        flex: 1;
    }
    
    .brokers-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .shop-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Hamburger layout toggles */
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .app-header {
        padding: 0 1rem;
    }
    
    .tab-viewport {
        padding: 1rem;
    }

    .home-hero-card {
        padding: 1.25rem;
        border-radius: 18px;
    }

    .home-hero-actions,
    .home-hero-actions .btn-primary,
    .home-hero-actions .btn-outline {
        width: 100%;
    }

    .home-discipline-card,
    .home-market-mood {
        grid-template-columns: 1fr;
    }

    .home-market-mood {
        display: grid;
    }

    .home-market-mood strong {
        text-align: left;
    }

    .home-ticker-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .academy-layout {
        grid-template-columns: 1fr;
    }
    
    .lessons-sidebar {
        order: 2;
    }
    
    .lesson-viewer {
        order: 1;
    }
    
    .lesson-content-card {
        padding: 1.5rem;
    }
    
    .lesson-display-title {
        font-size: 1.4rem;
    }
    
    .brokers-grid {
        grid-template-columns: 1fr;
    }
    
    .panel-intro-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
    }
    
    .intro-progress-box {
        width: 100%;
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .course-catalog {
        grid-template-columns: 1fr;
    }

    .stats-result-grid {
        grid-template-columns: 1fr;
    }
    
    .preset-savings-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .business-metrics-grid {
        grid-template-columns: 1fr;
    }

    .market-metric-grid {
        grid-template-columns: 1fr;
    }

    .market-value-row {
        align-items: flex-start;
        flex-direction: column;
    }
    
    .theme-color-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── NEW STYLES: STOCK SEARCH & DIVERSIFICATION / RISK SIMULATOR ─── */
.quant-search-bar-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.search-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.search-input-group input {
    flex: 1;
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-base);
    outline: none;
    transition: all var(--transition-fast);
}

.search-input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-surface);
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 24px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 10px var(--primary-glow);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.search-btn:hover {
    transform: translateY(-2px);
    opacity: 0.95;
    box-shadow: 0 6px 14px var(--primary-glow);
}

.search-btn:active {
    transform: translateY(0);
}

.preset-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82rem;
}

.preset-label {
    color: var(--text-light);
    font-weight: 700;
}

.preset-tag {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 9999px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-tag:hover, .preset-tag.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.03);
}

/* Tooltip Styles */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--border);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 900;
    cursor: help;
    transition: all var(--transition-fast);
}

.tooltip-trigger:hover, .tooltip-wrapper:hover .tooltip-trigger {
    background: var(--primary);
    color: white;
}

.tooltip-content {
    position: absolute;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    width: 320px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 200;
    text-align: left;
}

.tooltip-content h4 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-base);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tooltip-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
    font-weight: 500;
    white-space: normal;
}

.tooltip-content p:last-child {
    margin-bottom: 0;
}

.tooltip-wrapper:hover .tooltip-content,
.tooltip-trigger:focus + .tooltip-content {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Diversification Section */
.quant-extra-section {
    margin-top: 1.75rem;
}

.advisory-card, .simulator-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.advisory-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.advisory-icon {
    font-size: 1.4rem;
}

.advisory-title-row h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-base);
    display: flex;
    align-items: center;
}

.advisory-body-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 2rem;
    align-items: start;
}

.advisory-desc p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}

.advisory-tip-note {
    background: var(--primary-light);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    border-left: 4px solid var(--primary);
    color: var(--text-muted);
    font-weight: 500;
}

.suggested-portfolios {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
}

.port-suggest-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.allocation-radar-status {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-badges, 999px);
    background: var(--bg-surface);
    color: var(--text-light);
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 850;
    white-space: nowrap;
}

.allocation-radar-status.ready {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.allocation-radar-status.loading {
    border-color: var(--border);
    background: var(--bg-gray);
}

.allocation-radar-status.fallback {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

.port-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.port-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    transition: all var(--transition-fast);
}

.port-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-light);
}

.port-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    flex: 1;
    min-width: 0;
}

.port-name {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-base);
}

.port-allocation {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-light);
}

.port-model-note {
    display: block;
    max-width: 520px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 650;
    line-height: 1.35;
}

.btn-use-portfolio {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 850;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-use-portfolio:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.port-item.active .btn-use-portfolio {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 6px var(--primary-glow);
}

/* Simulator layout */
.simulator-layout-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 2rem;
    margin-top: 1.25rem;
}

.sim-controls-panel {
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.input-field-group label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
}

.capital-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.capital-input-wrap:focus-within {
    border-color: var(--primary);
}

.capital-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-weight: 750;
    color: var(--text-base);
}

.currency-label {
    background: var(--bg-gray);
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 750;
    color: var(--text-light);
    border-left: 1.5px solid var(--border);
}

.quick-capital-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.btn-quick-cap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 6px 2px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-quick-cap:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-quick-cap.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.duration-selector-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.btn-duration {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 8px 2px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-duration.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.alloc-type-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alloc-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    user-select: none;
}

.alloc-radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: inline-block;
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.alloc-radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary);
}

.alloc-radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.alloc-radio-label:hover .radio-text {
    color: var(--text-base);
}

.sim-results-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.results-visual-container {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: 16px;
}

.visual-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.visual-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-muted);
}

.risk-badge {
    font-size: 0.7rem;
    font-weight: 850;
    padding: 3px 8px;
    border-radius: 6px;
}

.badge-low {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.badge-medium {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.badge-high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.var-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.var-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.var-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #f97316 60%, #ef4444 100%);
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.var-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-light);
    font-weight: 700;
}

.results-value-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.result-value-card {
    border-radius: 16px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.expect-card {
    background: rgba(16, 185, 129, 0.03);
    border: 1.5px solid rgba(16, 185, 129, 0.12);
}

.worst-card {
    background: rgba(239, 68, 68, 0.03);
    border: 1.5px solid rgba(239, 68, 68, 0.12);
}

.card-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
}

.card-main-val {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -0.3px;
}

.card-sub-desc {
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.4;
    font-weight: 500;
}

.simulator-disclaimer {
    font-size: 0.72rem;
    color: var(--text-light);
    line-height: 1.5;
    text-align: left;
}

@media (max-width: 900px) {
    .advisory-body-grid, .simulator-layout-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ═══════════════════════════════════════════════════
   VN30 RANKING TAB
   ═══════════════════════════════════════════════════ */

.vn30-header {
    margin-bottom: 1.5rem;
}
.vn30-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.vn30-title-row h2 {
    font-size: 1.45rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent, #f59e0b));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.vn30-update-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.update-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}
.vn30-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 700px;
}

/* ── Portfolio Suggestion Card ── */
.vn30-portfolio-card {
    background: linear-gradient(135deg, var(--primary-rgb, 14 165 233) / 0.08, var(--accent-rgb, 245 158 11) / 0.06);
    border: 1.5px solid color-mix(in srgb, var(--primary) 30%, transparent);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.vn30-portfolio-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 15%, transparent), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.portfolio-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.portfolio-card-title {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.portfolio-icon {
    font-size: 1.6rem;
    line-height: 1;
}
.portfolio-card-title h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.portfolio-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.portfolio-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}
.portfolio-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    min-width: 150px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}
.portfolio-chip:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 20%, transparent);
}
.portfolio-chip .chip-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}
.chip-rank.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.chip-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.chip-rank.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); }
.chip-rank.rank-other { background: var(--primary); }
.chip-info .chip-ticker {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}
.chip-info .chip-score {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.chip-weight {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

/* ── Loading Skeleton ── */
.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-gray) 25%, color-mix(in srgb, var(--bg-gray) 50%, var(--bg-card)) 50%, var(--bg-gray) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.chip-skeleton {
    height: 52px;
    min-width: 150px;
    flex: 1;
}
.table-skeleton {
    height: 44px;
    width: 100%;
}

/* ── Ranking Table ── */
.vn30-table-wrap {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    margin-bottom: 1.25rem;
}
.vn30-ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.vn30-ranking-table thead {
    background: var(--bg-gray);
    position: sticky;
    top: 0;
    z-index: 2;
}
.vn30-ranking-table th {
    padding: 0.7rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-bottom: 1.5px solid var(--border);
}
.vn30-ranking-table td {
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    vertical-align: middle;
    white-space: nowrap;
}
.vn30-ranking-table tbody tr {
    transition: background 0.15s ease;
}
.vn30-ranking-table tbody tr:hover {
    background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.th-rank { width: 40px; text-align: center; }
.th-ticker { width: 60px; }
.th-company { min-width: 130px; }
.th-price { text-align: right; }
.th-change { width: 65px; text-align: right; }
.th-score { width: 75px; text-align: center; }
.th-total { width: 60px; text-align: center; }
.th-rating { width: 120px; text-align: center; }
.th-action { width: 70px; text-align: center; }

/* Rank Badge */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.82rem;
}
.rank-1 { background: linear-gradient(135deg, #fef3c7, #f59e0b); color: #92400e; }
.rank-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #334155; }
.rank-3 { background: linear-gradient(135deg, #fed7aa, #d97706); color: #7c2d12; }
.rank-default { background: var(--bg-gray); color: var(--text-secondary); }

/* Score Pill */
.score-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.78rem;
    text-align: center;
    min-width: 42px;
}
.score-high { background: color-mix(in srgb, #22c55e 15%, transparent); color: #16a34a; }
.score-medium { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #d97706; }
.score-low { background: color-mix(in srgb, #ef4444 12%, transparent); color: #dc2626; }

/* Total Score Cell */
.total-score-cell {
    font-weight: 800;
    font-size: 1rem;
    text-align: center;
}
.total-score-cell.high { color: #16a34a; }
.total-score-cell.medium { color: #d97706; }
.total-score-cell.low { color: #dc2626; }
.total-score-cell.missing { color: var(--text-secondary); }
.score-pill.score-missing { color: var(--text-secondary); background: color-mix(in srgb, var(--text-secondary) 10%, transparent); }

/* Rating Badge in Table */
.table-rating-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.rating-strong { background: color-mix(in srgb, #22c55e 18%, transparent); color: #16a34a; }
.rating-gradual { background: color-mix(in srgb, #0ea5e9 15%, transparent); color: #0284c7; }
.rating-hold { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #d97706; }
.rating-wait { background: color-mix(in srgb, #94a3b8 18%, transparent); color: #64748b; }

/* Detail Button */
.btn-detail {
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-detail:hover {
    background: var(--primary);
    color: #fff;
}

/* Ticker cell with name */
.td-ticker-name {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.td-ticker-name .ticker-code {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.88rem;
}
.td-company-name {
    font-size: 0.73rem;
    color: var(--text-secondary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Disclaimer */
.vn30-disclaimer {
    background: var(--bg-gray);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-top: 0.5rem;
}
.vn30-disclaimer p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* ── VN30 Responsive ── */
@media (max-width: 768px) {
    .vn30-title-row { flex-direction: column; align-items: flex-start; }
    .portfolio-chips { flex-direction: column; }
    .portfolio-chip { min-width: auto; }
    .th-company, .td-company-name { display: none; }
    .th-score { font-size: 0.7rem; }
    .vn30-ranking-table { font-size: 0.78rem; }
}

/* ── Quant Lite: Diversification & Simulator ── */
.quant-extra-section {
    margin-top: 1.5rem;
    animation: fadeInUp 0.6s ease-out;
}

/* Tooltip */
.tooltip-wrapper {
    display: inline-block;
    position: relative;
    margin-left: 0.5rem;
}
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    color: var(--bg-card);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: help;
}
.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 280px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    padding: 1rem;
    border-radius: 12px;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}
.tooltip-wrapper:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.tooltip-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: var(--text-base);
}
.tooltip-content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}
.tooltip-content p:last-child {
    margin-bottom: 0;
}

/* Advisory Card */
.advisory-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.advisory-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.advisory-title-row h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}
.advisory-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.advisory-desc p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 0;
}
.advisory-tip-note {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--text-base);
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem !important;
}

/* Portfolios */
.port-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.port-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}
.port-item:hover {
    border-color: var(--primary);
}
.port-item.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}
.port-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.port-name {
    font-weight: 700;
    font-size: 0.9rem;
}
.port-allocation {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.btn-use-portfolio {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: var(--bg-gray);
    color: var(--text-base);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}
.port-item.active .btn-use-portfolio {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Risk Simulator */
.simulator-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.simulator-card h3 {
    margin: 0.5rem 0;
}
.simulator-layout-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.sim-controls-panel {
    padding: 1.2rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.input-field-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-base);
}
.capital-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}
.capital-input-wrap input {
    width: 100%;
    padding: 0.8rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--bg-main);
    color: var(--text-base);
}
.capital-input-wrap .currency-label {
    position: absolute;
    right: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}
.quick-capital-buttons {
    display: flex;
    gap: 0.4rem;
}
.btn-quick-cap {
    flex: 1;
    padding: 0.4rem 0;
    font-size: 0.75rem;
    border-radius: 6px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
}
.btn-quick-cap.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: bold;
}
.duration-selector-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.btn-duration {
    padding: 0.6rem;
    font-size: 0.8rem;
    border-radius: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    cursor: pointer;
}
.btn-duration.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.alloc-type-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.alloc-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Results visual */
.results-visual-container {
    background: var(--bg-gray);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}
.visual-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.visual-label {
    font-weight: 700;
    font-size: 0.9rem;
}
.risk-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}
.badge-low { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-medium { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-high { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.var-bar-wrapper {
    position: relative;
}
.var-bar-track {
    height: 12px;
    background: linear-gradient(to right, #10b981 0%, #10b981 40%, #f59e0b 60%, #ef4444 100%);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}
.var-bar-fill {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: var(--bg-main);
    opacity: 0.8;
    transition: width 0.4s ease;
}
.var-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.results-value-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.result-value-card {
    padding: 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.expect-card { background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.2); }
.worst-card { background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.2); }
.card-label { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-main-val { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.3rem; }
.card-sub-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }

.simulator-disclaimer {
    background: rgba(var(--primary-rgb), 0.05);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

@media (max-width: 900px) {
    .advisory-body-grid { grid-template-columns: 1fr; }
    .simulator-layout-grid { grid-template-columns: 1fr; }
}

/* Young Typeface + Brainfish app refresh */
:root {
    --font-young: 'Young Typeface', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-young-display: 'Young Display', 'Young Typeface', ui-sans-serif, system-ui, sans-serif;
    --font-family: var(--font-young);
    --color-midnight-ink: #000000;
    --color-canvas-white: #ffffff;
    --color-charcoal-border: #171717;
    --color-shadow-base: #0a0a0d;
    --color-pale-ash: #f5f5f5;
    --color-accent-green: #a3e635;
    --color-card-saffron: #fef3c8;
    --color-card-lavender: #fae9ff;
    --color-card-mint: #d2fae5;
    --color-card-pink: #f5d1fe;
    --color-highlight-yellow: #fbbf25;
    --radius-cards: 8px;
    --radius-buttons: 4px;
    --radius-badges: 100px;
    --shadow-subtle: rgb(10, 10, 13) 2px 2px 0px 0px;
    --shadow-subtle-2: rgb(10, 10, 13) 4px 4px 0px 0px;
    --shadow-subtle-3: rgb(10, 10, 13) 1px 1px 0px 0px;
    --primary-rgb: 163, 230, 53;
}

body.light-mode,
body.light-mode.theme-ocean,
body.light-mode.theme-emerald,
body.light-mode.theme-orange,
body.light-mode.theme-pink,
body.light-mode.theme-lavender,
body.light-mode.theme-gold,
body.light-mode.theme-crimson {
    --bg-base: var(--color-canvas-white);
    --bg-main: var(--color-pale-ash);
    --bg-surface: var(--color-canvas-white);
    --bg-card: var(--color-canvas-white);
    --bg-gray: var(--color-pale-ash);
    --bg-box-highlight: var(--color-card-mint);
    --text-base: var(--color-midnight-ink);
    --text-muted: var(--color-charcoal-border);
    --text-light: #525252;
    --border: var(--color-charcoal-border);
    --border-color: var(--color-charcoal-border);
    --primary: var(--color-accent-green);
    --primary-hover: #8fcd24;
    --primary-light: var(--color-card-mint);
    --primary-glow: rgba(163, 230, 53, 0.24);
    --shadow-sm: var(--shadow-subtle);
    --shadow-md: var(--shadow-subtle);
    --shadow-lg: var(--shadow-subtle-2);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(23, 23, 23, 0.18);
}

body.dark-mode {
    --primary: var(--color-accent-green);
    --primary-hover: #bef264;
    --primary-rgb: 163, 230, 53;
}

html,
body {
    font-family: var(--font-young);
    font-weight: 500;
}

body.light-mode {
    background:
        linear-gradient(90deg, rgba(23, 23, 23, 0.035) 1px, transparent 1px),
        linear-gradient(rgba(23, 23, 23, 0.035) 1px, transparent 1px),
        var(--color-canvas-white);
    background-size: 36px 36px;
}

h1,
h2,
h3,
.logo-name,
.page-title,
.lesson-display-title,
.stock-title-large,
.card-main-val,
.vn30-title-row h2 {
    font-family: var(--font-young-display);
    font-weight: 900;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font-family: var(--font-young);
}

#app-particles {
    opacity: 0.12;
    mix-blend-mode: multiply;
}

.app-layout {
    gap: 16px;
    padding: 16px;
}

.sidebar {
    height: calc(100vh - 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius-cards);
    box-shadow: var(--shadow-subtle);
    overflow: hidden;
}

.sidebar-brand,
.sidebar-footer,
.app-header {
    border-color: var(--border);
}

.sidebar-brand {
    border-bottom: 0;
    background: color-mix(in srgb, var(--bg-surface) 88%, var(--primary-light));
}

.brand-mascot {
    display: none;
}

.user-avatar {
    border: 1px solid var(--border);
    border-radius: var(--radius-buttons);
    background: var(--primary-light);
    box-shadow: var(--shadow-subtle-3);
    color: var(--text-base);
    font-size: 0.8rem;
    font-weight: 900;
    line-height: 1;
}

.logo-name {
    background: none;
    color: var(--text-base);
    -webkit-text-fill-color: currentColor;
    font-size: 1.85rem;
    line-height: 0.95;
    letter-spacing: 0;
}

.logo-badge,
.wallet-title,
.wallet-subtitle,
.lesson-number,
.section-subtitle,
.card-sub-desc {
    color: var(--text-muted);
}

.logo-badge {
    font-size: 1.02rem;
    line-height: 1.15;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
}

.wallet-widget,
.app-header,
.panel-intro-card,
.course-card,
.lessons-sidebar,
.lesson-content-card,
.calc-inputs-card,
.calc-results-card,
.stock-card-panel,
.metric-mini-card,
.broker-card,
.shop-earn-card,
.shop-redeem-card,
.advisory-card,
.simulator-card,
.vn30-portfolio-card,
.vn30-table-wrap,
.modal-card,
.customizer-card,
.result-value-card,
.results-visual-container,
.sim-controls-panel,
.quiz-box,
.result-analysis-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-cards);
    background: var(--bg-card);
    box-shadow: var(--shadow-subtle);
}

.panel-intro-card {
    background: linear-gradient(135deg, var(--color-card-mint), var(--color-canvas-white));
}

.panel-intro-card::after {
    display: none;
}

.wallet-widget {
    background: var(--color-card-saffron);
}

.nav-item,
.course-card,
.lesson-list-item,
.btn-preset,
.btn-freq,
.btn-quick-cap,
.btn-duration,
.btn-use-portfolio,
.btn-detail,
.header-action-btn,
.sidebar-toggle,
.btn-theme-toggle-trigger,
.btn-primary,
.btn-outline,
.btn-redeem {
    border: 1px solid var(--border);
    border-radius: var(--radius-buttons);
    box-shadow: var(--shadow-subtle-3);
    color: var(--text-base);
}

.nav-item.active,
.course-card.active,
.lesson-list-item.active,
.btn-preset.active,
.btn-freq.active,
.btn-quick-cap.active,
.btn-duration.active,
.btn-primary,
.btn-redeem.unlocked,
.port-item.active .btn-use-portfolio {
    background: var(--color-accent-green);
    color: var(--color-midnight-ink);
    border-color: var(--border);
}

.nav-item:hover,
.course-card:hover,
.lesson-list-item:hover,
.btn-preset:hover,
.btn-freq:hover,
.btn-quick-cap:hover,
.btn-duration:hover,
.header-action-btn:hover,
.sidebar-toggle:hover,
.btn-theme-toggle-trigger:hover,
.btn-outline:hover,
.btn-primary:hover,
.broker-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: var(--shadow-subtle);
}

.sidebar .nav-item {
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    background: transparent;
    color: var(--text-muted);
    padding: 11px 12px;
}

.sidebar .nav-item i {
    color: var(--text-light);
    font-size: 1.14rem;
}

.sidebar .nav-item.active {
    background: color-mix(in srgb, var(--primary-light) 72%, var(--bg-surface));
    color: var(--text-base);
    border: 0;
    box-shadow: none;
}

.sidebar .nav-item.active i {
    color: var(--text-base);
}

.sidebar .nav-item:hover {
    transform: none;
    box-shadow: none;
    background: var(--bg-gray);
    color: var(--text-base);
}

.input-with-addon,
.capital-input-wrap,
.search-input-group,
.port-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-buttons);
    background: var(--color-canvas-white);
    box-shadow: var(--shadow-subtle-3);
}

.input-with-addon input,
.capital-input-wrap input,
.search-input-group input {
    color: var(--text-base);
    background: transparent;
}

.lesson-badge-category,
.quiz-badge,
.panel-header-badge,
.broker-tag,
.risk-badge {
    border: 1px solid var(--border);
    border-radius: var(--radius-badges);
    background: var(--color-canvas-white);
    color: var(--color-midnight-ink);
}

.progress-track,
.var-bar-track {
    border: 1px solid var(--border);
    background: var(--color-canvas-white);
}

.progress-bar-fill,
.progress-fill,
.var-bar-fill {
    background: var(--color-accent-green);
}

.stats-result-card:nth-child(4n + 1),
.metric-mini-card:nth-child(4n + 1),
.result-value-card:nth-child(4n + 1),
.broker-card:nth-child(4n + 1) {
    background: var(--color-card-mint);
}

.stats-result-card:nth-child(4n + 2),
.metric-mini-card:nth-child(4n + 2),
.result-value-card:nth-child(4n + 2),
.broker-card:nth-child(4n + 2) {
    background: var(--color-card-lavender);
}

.stats-result-card:nth-child(4n + 3),
.metric-mini-card:nth-child(4n + 3),
.broker-card:nth-child(4n + 3) {
    background: var(--color-card-saffron);
}

.stats-result-card:nth-child(4n),
.metric-mini-card:nth-child(4n),
.broker-card:nth-child(4n) {
    background: var(--color-card-pink);
}

.vn30-ranking-table thead,
.quiz-reward,
.wallet-balance {
    color: var(--color-midnight-ink);
}

.tab-viewport {
    padding-bottom: 16px;
}

@media (max-width: 900px) {
    .app-layout {
        padding: 10px;
    }

    .sidebar {
        height: 100vh;
        border-radius: 0 var(--radius-cards) var(--radius-cards) 0;
    }
}

/* Forecast Lab */
.forecast-intro-card {
    align-items: stretch;
}

.forecast-cost-panel {
    min-width: 210px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    box-shadow: var(--shadow-sm);
}

.forecast-cost-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.forecast-cost-panel strong {
    font-size: 1.35rem;
    color: var(--primary);
}

.forecast-cost-panel span:last-child {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.forecast-workbench {
    display: grid;
    grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.forecast-control-card,
.forecast-results-shell,
.forecast-result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.forecast-control-card,
.forecast-results-shell {
    padding: 2rem;
}

.forecast-control-card h3,
.forecast-results-header h3 {
    font-size: 1.1rem;
    font-weight: 850;
    margin-bottom: 4px;
}

.forecast-textarea,
.forecast-select {
    width: 100%;
    background: var(--bg-gray);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    font-weight: 650;
    color: var(--text-base);
    outline: none;
    transition: all var(--transition-fast);
}

.forecast-textarea {
    min-height: 108px;
    resize: vertical;
    line-height: 1.45;
}

.forecast-textarea:focus,
.forecast-select:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.forecast-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -0.65rem 0 1.25rem;
}

.forecast-chip {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.forecast-chip:hover,
.forecast-chip.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.forecast-method-note {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: var(--bg-gray);
    border-left: 4px solid var(--primary);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.forecast-results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.forecast-status-pill,
.forecast-confidence-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 0.74rem;
    font-weight: 850;
    white-space: nowrap;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-glow);
}

.forecast-status-pill.is-loading {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.25);
}

.forecast-status-pill.is-ready {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
}

.forecast-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.25rem;
}

.forecast-summary-card {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.forecast-summary-card span {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.forecast-summary-card strong {
    font-size: 1.1rem;
    color: var(--text-base);
}

.forecast-empty-state {
    min-height: 280px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.forecast-empty-state i {
    font-size: 2.4rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.forecast-empty-state h4 {
    color: var(--text-base);
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.forecast-empty-state p {
    max-width: 430px;
    line-height: 1.5;
    font-size: 0.88rem;
}

.forecast-results-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.forecast-result-card {
    padding: 1.2rem;
    overflow: hidden;
}

.forecast-result-card.is-error {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(239, 68, 68, 0.04);
}

.forecast-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.forecast-ticker-lockup {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.forecast-ticker {
    font-size: 1.45rem;
    font-weight: 950;
    color: var(--text-base);
    letter-spacing: -0.02em;
}

.forecast-subline {
    font-size: 0.74rem;
    color: var(--text-light);
    font-weight: 700;
}

.forecast-confidence-pill.high {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
}

.forecast-confidence-pill.medium {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.25);
}

.forecast-confidence-pill.low {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
    border-color: rgba(100, 116, 139, 0.25);
}

.forecast-chart-box {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.7rem;
    min-height: 190px;
}

.forecast-chart-svg {
    display: block;
    width: 100%;
    height: auto;
}

.forecast-chart-grid {
    stroke: currentColor;
    color: var(--border);
    stroke-width: 1;
}

.forecast-band-path {
    fill: var(--primary);
    opacity: 0.12;
}

.forecast-history-path {
    fill: none;
    stroke: var(--text-light);
    stroke-width: 2.2;
}

.forecast-expected-path {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
}

.forecast-chart-marker {
    fill: var(--bg-surface);
    stroke: var(--primary);
    stroke-width: 3;
}

.forecast-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0.9rem;
}

.forecast-metric {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
    min-width: 0;
}

.forecast-metric span {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.forecast-metric strong {
    display: block;
    font-size: 0.96rem;
    color: var(--text-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forecast-metric .is-up {
    color: #10b981;
}

.forecast-metric .is-down {
    color: #ef4444;
}

.forecast-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0.75rem;
}

.forecast-detail-box {
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 0.85rem;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.forecast-detail-box strong {
    color: var(--text-base);
}

.forecast-card-actions {
    margin-top: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.forecast-card-note {
    color: var(--text-light);
    font-size: 0.72rem;
    line-height: 1.4;
}

.forecast-open-quant {
    padding: 8px 14px;
    font-size: 0.78rem;
    border-radius: 10px;
}

.forecast-loading-card {
    height: 190px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(90deg, var(--bg-gray) 25%, var(--bg-surface) 50%, var(--bg-gray) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.dory-assistant-panel {
    margin-top: 1rem;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.dory-assistant-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.dory-assistant-kicker {
    display: inline-flex;
    width: fit-content;
    border: 1px solid var(--primary);
    border-radius: 999px;
    padding: 3px 8px;
    color: var(--primary);
    background: var(--primary-light);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dory-assistant-head h3 {
    margin: 0.4rem 0 0.2rem;
    font-size: 0.98rem;
    font-weight: 900;
    color: var(--text-base);
}

.dory-assistant-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.dory-assistant-status {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-gray);
    color: var(--text-light);
    padding: 5px 9px;
    font-size: 0.68rem;
    font-weight: 850;
    white-space: nowrap;
}

.dory-question-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.8rem;
}

.dory-question-chip,
.dory-ask-btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-gray);
    color: var(--text-base);
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dory-question-chip {
    padding: 7px 11px;
}

.dory-question-chip:hover,
.dory-ask-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.dory-question-chip:disabled,
.dory-ask-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.dory-custom-question {
    display: flex;
    gap: 8px;
    margin-bottom: 0.8rem;
}

.dory-question-input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    background: var(--bg-gray);
    color: var(--text-base);
    padding: 9px 12px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    outline: none;
}

.dory-question-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-surface);
}

.dory-ask-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    white-space: nowrap;
}

.dory-answer-box {
    min-height: 74px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-gray);
    color: var(--text-muted);
    padding: 0.9rem;
    font-size: 0.82rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

@media (max-width: 1100px) {
    .forecast-workbench {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .forecast-results-header,
    .forecast-card-head,
    .forecast-intro-card {
        flex-direction: column;
    }

    .forecast-cost-panel {
        width: 100%;
        min-width: unset;
    }

    .forecast-summary-grid,
    .forecast-metrics-grid,
    .forecast-detail-grid {
        grid-template-columns: 1fr;
    }

    .forecast-control-card,
    .forecast-results-shell {
        padding: 1.25rem;
    }

    .dory-assistant-head,
    .dory-custom-question {
        flex-direction: column;
    }

    .dory-assistant-status,
    .dory-ask-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Stock Data OHLCV */
.stock-data-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stock-data-hero,
.stock-data-toolbar,
.stock-data-summary,
.stock-data-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-cards);
    background: var(--bg-card);
    box-shadow: var(--shadow-subtle);
}

.stock-data-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.35rem;
}

.stock-data-hero h2 {
    margin: 0.5rem 0 0.4rem;
    font-size: 1.45rem;
    color: var(--text-base);
}

.stock-data-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.stock-data-status {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-badges);
    background: var(--bg-gray);
    color: var(--text-muted);
    padding: 7px 11px;
    font-size: 0.74rem;
    font-weight: 850;
    white-space: nowrap;
}

.stock-data-status.ready {
    background: color-mix(in srgb, #10b981 14%, var(--bg-gray));
    color: #059669;
}

.stock-data-status.warn {
    background: color-mix(in srgb, #f59e0b 16%, var(--bg-gray));
    color: #b45309;
}

.stock-data-status.error {
    background: color-mix(in srgb, #ef4444 16%, var(--bg-gray));
    color: #dc2626;
}

.stock-data-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(230px, 0.28fr);
    gap: 1rem;
    padding: 1.25rem;
}

.stock-data-search,
.stock-data-controls {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.stock-data-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.7rem;
}

.stock-data-search-row input,
.stock-data-select {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-buttons);
    background: var(--bg-gray);
    color: var(--text-base);
    padding: 0 0.85rem;
    font: inherit;
    font-weight: 700;
    outline: none;
}

.stock-data-search-row input:focus,
.stock-data-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-surface);
}

.stock-data-chips,
.stock-data-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.stock-data-chip,
.stock-data-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-buttons);
    background: var(--bg-gray);
    color: var(--text-base);
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 850;
}

.stock-data-chip:hover,
.stock-data-download-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--text-base);
}

.stock-data-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
}

.stock-data-summary-card {
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--border);
}

.stock-data-summary-card:last-child {
    border-right: 0;
}

.stock-data-summary-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.stock-data-summary-card strong {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-base);
    font-size: 1.2rem;
    font-weight: 900;
}

.stock-data-table-wrap {
    overflow: auto;
    max-height: 620px;
}

.stock-data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 840px;
}

.stock-data-table th,
.stock-data-table td {
    padding: 0.78rem 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-base);
    font-size: 0.84rem;
    text-align: right;
    white-space: nowrap;
}

.stock-data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-gray);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.stock-data-table th:first-child,
.stock-data-table td:first-child,
.stock-data-table th:nth-child(2),
.stock-data-table td:nth-child(2) {
    text-align: left;
}

.stock-data-table tbody tr:hover td {
    background: color-mix(in srgb, var(--primary-light) 45%, transparent);
}

.stock-data-ticker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-buttons);
    background: var(--primary-light);
    color: var(--text-base);
    padding: 4px 8px;
    font-weight: 900;
}

.stock-data-empty {
    padding: 2rem !important;
    text-align: center !important;
    color: var(--text-muted) !important;
}

.stock-data-muted {
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .stock-data-hero,
    .stock-data-toolbar {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .stock-data-search-row {
        grid-template-columns: 1fr;
    }

    .stock-data-summary {
        grid-template-columns: 1fr;
    }

    .stock-data-summary-card {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .stock-data-summary-card:last-child {
        border-bottom: 0;
    }
}

/* Dark-mode contrast guard for the Brainfish refresh */
body.dark-mode {
    --bg-main: var(--bg-base);
}

body.dark-mode .wallet-widget {
    background: color-mix(in srgb, var(--primary) 10%, var(--bg-card));
}

body.dark-mode .panel-intro-card {
    background: var(--bg-card);
    color: var(--text-base);
}

body.dark-mode .panel-intro-card p,
body.dark-mode .intro-text p,
body.dark-mode .progress-percent,
body.dark-mode .progress-label {
    color: var(--text-muted);
}

body.dark-mode .wallet-title,
body.dark-mode .wallet-subtitle,
body.dark-mode .balance-unit,
body.dark-mode .wallet-balance,
body.dark-mode .quiz-reward,
body.dark-mode .vn30-ranking-table thead {
    color: var(--text-base);
}

body.dark-mode .input-with-addon,
body.dark-mode .capital-input-wrap,
body.dark-mode .search-input-group,
body.dark-mode .news-radar-controls input,
body.dark-mode .port-item {
    background: var(--bg-gray);
    border-color: var(--border);
    color: var(--text-base);
}

body.dark-mode .input-with-addon input,
body.dark-mode .capital-input-wrap input,
body.dark-mode .search-input-group input,
body.dark-mode .news-radar-controls input,
body.dark-mode .dory-question-input {
    background: transparent;
    color: var(--text-base);
    caret-color: var(--primary);
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: var(--text-light);
    opacity: 1;
}

body.dark-mode .capital-input-wrap .currency-label,
body.dark-mode .port-allocation,
body.dark-mode .port-model-note,
body.dark-mode .card-sub-desc {
    color: var(--text-muted);
}

body.dark-mode .port-name,
body.dark-mode .card-label {
    color: var(--text-base);
}

body.dark-mode .port-item.active {
    background: color-mix(in srgb, var(--primary) 12%, var(--bg-gray));
    border-color: var(--primary);
}

body.dark-mode .btn-use-portfolio {
    background: var(--bg-card);
    color: var(--text-base);
    border-color: var(--border);
}

body.dark-mode .port-item.active .btn-use-portfolio,
body.dark-mode .btn-primary,
body.dark-mode .btn-redeem.unlocked {
    color: var(--color-midnight-ink);
}

body.dark-mode .stats-result-card:nth-child(n),
body.dark-mode .metric-mini-card:nth-child(n),
body.dark-mode .broker-card:nth-child(n),
body.dark-mode .shop-earn-card,
body.dark-mode .shop-redeem-card,
body.dark-mode .result-value-card {
    background: var(--bg-gray);
    color: var(--text-base);
    border-color: var(--border);
}

body.dark-mode .expect-card {
    background: color-mix(in srgb, #10b981 16%, var(--bg-gray));
    border-color: rgba(16, 185, 129, 0.35);
}

body.dark-mode .worst-card {
    background: color-mix(in srgb, #ef4444 16%, var(--bg-gray));
    border-color: rgba(239, 68, 68, 0.35);
}

body.dark-mode .lesson-badge-category,
body.dark-mode .quiz-badge,
body.dark-mode .panel-header-badge,
body.dark-mode .broker-tag,
body.dark-mode .risk-badge,
body.dark-mode .progress-track,
body.dark-mode .var-bar-track {
    background: var(--bg-gray);
    color: var(--text-base);
    border-color: var(--border);
}

/* Mobile-first app shell polish for iOS / Android */
:root {
    --mobile-bottom-nav-height: 76px;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overscroll-behavior-y: none;
    touch-action: manipulation;
}

input,
select,
textarea,
button {
    -webkit-tap-highlight-color: transparent;
}

input,
select,
textarea {
    font-size: max(16px, 1rem);
}

.main-content,
.tab-panel,
.stock-card-panel,
.market-chart-panel,
.forecast-results-shell,
.forecast-result-card,
.stock-data-table-wrap {
    min-width: 0;
}

.sidebar-scrim,
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 900px) {
    html,
    body {
        height: 100%;
        min-height: 100dvh;
    }

    .app-layout {
        flex-direction: row;
        height: 100dvh;
        min-height: 100dvh;
        padding: 0;
        gap: 0;
        background: var(--bg-base);
    }

    .main-content {
        width: 100%;
        height: 100dvh;
        min-height: 0;
    }

    .app-header {
        height: auto;
        min-height: calc(58px + env(safe-area-inset-top));
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-top: 0;
        box-shadow: 0 1px 0 var(--border);
        position: relative;
        z-index: 80;
    }

    .header-left {
        min-width: 0;
        gap: 10px;
    }

    .page-title {
        min-width: 0;
        max-width: 58vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1.06rem;
        line-height: 1.2;
    }

    .sidebar-toggle,
    .header-action-btn,
    .user-logout-btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .header-actions {
        gap: 8px;
        flex-shrink: 0;
    }

    .user-badge {
        min-height: 44px;
        padding: 5px 7px;
        gap: 6px;
    }

    .user-name {
        display: none;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    .tab-viewport {
        padding: 12px 12px calc(var(--mobile-bottom-nav-height) + 20px + env(safe-area-inset-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-padding-bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 360px);
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0 20px 20px 0;
        transform: translateX(-105%);
        z-index: 1200;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 18px 0 42px rgba(15, 23, 42, 0.18);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        z-index: 1190;
        display: block;
        background: rgba(15, 23, 42, 0.36);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-fast);
    }

    body.mobile-sidebar-open .sidebar-scrim {
        opacity: 1;
        pointer-events: auto;
    }

    body.mobile-sidebar-open {
        overflow: hidden;
    }

    .sidebar-brand {
        padding: 14px 18px 10px;
    }

    .wallet-widget {
        margin: 10px 14px 12px;
        padding: 14px;
        border-radius: 14px;
    }

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

    .nav-menu {
        gap: 4px;
    }

    .sidebar .nav-item {
        min-height: 48px;
        padding: 11px 12px;
        font-size: 0.9rem;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 10px;
        right: auto;
        bottom: max(8px, env(safe-area-inset-bottom));
        width: calc(100dvw - 20px);
        max-width: calc(100dvw - 20px);
        box-sizing: border-box;
        overflow: hidden;
        z-index: 1210;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        min-height: var(--mobile-bottom-nav-height);
        padding: 7px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        transition: transform var(--transition-fast), opacity var(--transition-fast);
    }

    body.mobile-sidebar-open .mobile-bottom-nav {
        opacity: 0;
        pointer-events: none;
        transform: translateY(calc(100% + 18px));
    }

    .modal-overlay.active {
        z-index: 1400;
    }

    .modal-overlay.active ~ .mobile-bottom-nav {
        opacity: 0;
        pointer-events: none;
        transform: translateY(calc(100% + 18px));
    }

    .mobile-nav-item {
        min-width: 0;
        overflow: hidden;
        min-height: 58px;
        border-radius: 13px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 850;
        line-height: 1;
    }

    .mobile-nav-item span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav-item i {
        font-size: 1.24rem;
    }

    .mobile-nav-item.active {
        background: var(--primary);
        color: var(--color-midnight-ink, var(--text-base));
        box-shadow: var(--shadow-subtle-3);
    }

    .panel-intro-card,
    .quant-search-bar-wrap,
    .market-overview-dashboard,
    .stock-card-panel,
    .quant-extra-section,
    .advisory-card,
    .simulator-card,
    .forecast-control-card,
    .forecast-results-shell,
    .stock-data-hero,
    .stock-data-toolbar,
    .stock-data-summary,
    .stock-data-table-wrap,
    .shop-earn-card,
    .shop-redeem-card,
    .broker-card,
    .lesson-content-card,
    .lessons-sidebar,
    .calc-inputs-card,
    .calc-results-card,
    .vn30-portfolio-card,
    .vn30-table-wrap {
        border-radius: 16px;
        padding: 1rem;
    }

    .quant-intro {
        text-align: left;
        margin: 0 0 1rem;
        max-width: none;
    }

    .quant-intro h2,
    .stock-data-hero h2,
    .forecast-intro-card h2,
    .shop-earn-card h2,
    .shop-redeem-card h2 {
        font-size: 1.28rem;
        line-height: 1.15;
    }

    .quant-intro p,
    .section-subtitle,
    .buy-desc,
    .modal-desc,
    .stock-data-hero p,
    .shop-earn-card > p,
    .shop-redeem-card > p {
        font-size: 0.9rem;
        line-height: 1.58;
    }

    .buy-desc {
        margin-bottom: 1rem;
    }

    .shop-earn-card h2,
    .shop-redeem-card h2 {
        margin-bottom: 8px;
    }

    .search-input-group,
    .stock-data-search-row,
    .forecast-card-actions,
    .dory-custom-question {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .search-input-group input,
    .stock-data-search-row input,
    .forecast-textarea,
    .forecast-select,
    .dory-question-input {
        min-height: 48px;
        border: 1.5px solid var(--border);
        border-radius: 12px;
        background: var(--bg-surface);
    }

    .search-btn,
    .btn-primary,
    .btn-outline,
    .stock-data-chip,
    .stock-data-download-btn,
    .package-btn,
    .btn-redeem,
    .forecast-chip,
    .dory-ask-btn {
        min-height: 48px;
    }

    .search-btn,
    .dory-ask-btn {
        width: 100%;
        justify-content: center;
    }

    .preset-links,
    .stock-data-chips,
    .forecast-quick-tags,
    .dory-question-row {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .preset-links::-webkit-scrollbar,
    .stock-data-chips::-webkit-scrollbar,
    .forecast-quick-tags::-webkit-scrollbar,
    .dory-question-row::-webkit-scrollbar {
        display: none;
    }

    .preset-label {
        flex: 0 0 auto;
    }

    .preset-tag,
    .stock-data-chip,
    .forecast-chip,
    .dory-question-chip {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .market-overview-hero,
    .derivatives-hero,
    .derivatives-chart-head,
    .market-chart-head,
    .stock-data-hero,
    .forecast-intro-card,
    .vn30-header,
    .portfolio-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .market-overview-grid,
    .derivatives-grid,
    .derivatives-lab-grid,
    .derivatives-learning-grid,
    .derivatives-form-grid,
    .derivatives-hedge-summary,
    .market-insight-strip,
    .stock-dashboard,
    .business-metrics-grid,
    .stock-news-sentiment-grid,
    .news-radar-grid,
    .news-sentiment-grid,
    .shop-grid,
    .brokers-grid,
    .forecast-workbench,
    .forecast-summary-grid,
    .forecast-metrics-grid,
    .forecast-detail-grid,
    .advisory-body-grid,
    .simulator-layout-grid,
    .results-value-grid,
    .stock-data-toolbar,
    .stock-data-summary,
    .academy-layout,
    .calc-grid {
        grid-template-columns: 1fr !important;
    }

    .market-plot-area {
        min-height: 260px;
        height: 300px;
    }

    .derivatives-chart-area {
        height: clamp(260px, 72vw, 320px);
        min-height: 260px;
        max-height: 320px;
    }

    .derivatives-chart-tools,
    .derivatives-range-switch {
        width: 100%;
    }

    .derivatives-range-btn {
        flex: 1;
    }

    .derivatives-quote-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .market-chart-foot,
    .market-metric-grid,
    .portfolio-chips,
    .skin-options,
    .quick-capital-buttons {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .portfolio-chip,
    .skin-btn,
    .btn-quick-cap {
        flex: 0 0 auto;
    }

    .stock-title-large {
        font-size: 1.38rem;
        line-height: 1.15;
        word-break: break-word;
    }

    .stock-price-block {
        flex-wrap: wrap;
        margin-bottom: 1rem;
    }

    .stock-price {
        font-size: 1.35rem;
    }

    .business-metrics-grid {
        gap: 8px;
    }

    .metric-mini-card {
        text-align: left;
        padding: 12px;
    }

    .quant-radial-section {
        margin: 1rem 0 1.35rem;
    }

    .quant-score-circle {
        width: 116px;
        height: 116px;
        border-width: 7px;
    }

    .score-num {
        font-size: 2rem;
    }

    .quant-summary-note,
    .redeem-item,
    .port-item {
        align-items: flex-start;
    }

    .redeem-item {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .redeem-item .btn-redeem {
        grid-column: 1 / -1;
        width: 100%;
    }

    .item-title,
    .item-desc,
    .q-text,
    .dory-answer-box,
    .forecast-detail-box {
        overflow-wrap: anywhere;
    }

    .stock-data-table-wrap,
    .vn30-table-wrap {
        max-height: min(62vh, 560px);
        overflow: auto;
    }

    .vn30-ranking-table,
    .stock-data-table {
        min-width: 720px;
    }

    .toast-notification {
        left: 12px;
        right: 12px;
        bottom: calc(var(--mobile-bottom-nav-height) + 18px + env(safe-area-inset-bottom));
        max-width: none;
        transform: translateY(150%);
    }

    .toast-notification.show {
        transform: translateY(0);
    }

    .mascot-widget {
        right: 10px;
        bottom: calc(var(--mobile-bottom-nav-height) + 80px + env(safe-area-inset-bottom));
        transform: scale(0.82);
        transform-origin: bottom right;
    }

    .mascot-speech-bubble {
        max-width: min(220px, 72vw);
        padding: 9px 12px;
    }
}

@media (max-width: 600px) {
    .tab-viewport {
        padding-left: 10px;
        padding-right: 10px;
    }

    .app-brand-logo {
        width: 154px;
    }

    .header-action-btn {
        display: none;
    }

    .page-title {
        max-width: 64vw;
        font-size: 1rem;
    }

    .market-value-row strong {
        font-size: 1.55rem;
    }

    .modal-overlay {
        align-items: flex-end;
        justify-content: stretch;
        padding: 0;
        background: rgba(15, 23, 42, 0.46);
    }

    .modal-overlay.active {
        animation: none;
    }

    .modal-card {
        max-width: none;
        width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
        overflow-y: auto;
        border-radius: 22px 22px 0 0;
        padding: 1.25rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
        text-align: left;
        animation: mobileSheetIn 0.28s var(--ease-out);
    }

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

    .modal-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .modal-card h3 {
        max-width: calc(100% - 52px);
        font-size: 1.18rem;
        line-height: 1.2;
    }

    .qr-code-box {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .qr-mockup {
        display: flex;
        width: min(100%, 292px);
        min-width: 0;
        min-height: 0;
        aspect-ratio: 1;
        margin: 0 auto 0.9rem;
        padding: 0.75rem;
    }

    .payos-qr-img {
        width: 100%;
        height: 100%;
    }

    .qr-info-row {
        gap: 12px;
        align-items: flex-start;
        font-size: 0.86rem;
    }

    .qr-info-row strong {
        text-align: right;
        overflow-wrap: anywhere;
    }

    .current-balance-display {
        padding: 1rem;
    }

    .bal-number {
        font-size: 1.8rem;
    }

    .mascot-widget {
        display: none;
    }
}

@media (max-width: 380px) {
    .mobile-bottom-nav {
        left: 6px;
        right: auto;
        width: calc(100dvw - 12px);
        max-width: calc(100dvw - 12px);
        gap: 2px;
        padding: 6px;
    }

    .mobile-nav-item {
        font-size: 0.62rem;
    }

    .mobile-nav-item i {
        font-size: 1.12rem;
    }

    .page-title {
        max-width: 58vw;
    }
}
