/* ================================================================
   GreenBook — ML-Powered Covered Call Optimizer
   Dark theme CSS — Three-panel UI architecture
   ================================================================ */

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #0d1117;
    color: #c9d1d9;
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ---------- App container ---------- */
#app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
}

/* ---------- Header ---------- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 16px;
    border-bottom: 1px solid #21262d;
    margin-bottom: 16px;
}

.header-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #f0f6fc;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8b949e;
    letter-spacing: 0.03em;
}

.header-subtitle {
    font-size: 0.82rem;
    color: #8b949e;
    margin-left: 12px;
}

/* ==========================================================
   LANDING PANEL — Centered analysis form (Robinhood-style)
   ========================================================== */
.landing-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.landing-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 16px;
    padding: 40px;
    max-width: 480px;
    width: 100%;
}

.landing-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 8px;
}

.landing-subtitle {
    font-size: 0.9rem;
    color: #8b949e;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* ==========================================================
   SPLASH PAGE — Hero + Screenshots + Features + Legal
   ========================================================== */
.splash-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 40px 0 48px;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: #f0f6fc;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: #58a6ff;
    font-weight: 600;
    margin-bottom: 16px;
}

.hero-description {
    font-size: 1rem;
    color: #8b949e;
    line-height: 1.6;
    max-width: 540px;
    margin: 0 auto 28px;
}

.btn--cta {
    display: inline-block;
    padding: 14px 40px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #238636, #2ea043);
    border: none;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(46, 160, 67, 0.3);
}

.btn--cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 160, 67, 0.4);
    filter: brightness(1.1);
}

.hero-note {
    font-size: 0.8rem;
    color: #484f58;
    margin-top: 14px;
}

.hero-alpha-note {
    font-size: 0.75rem;
    color: #bc8cff;
    margin-top: 8px;
    font-style: italic;
}

/* ── Screenshot showcase ── */
.showcase {
    margin-bottom: 48px;
}

.showcase-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 20px;
}

.showcase-tab {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.15s;
}

.showcase-tab:hover {
    color: #c9d1d9;
    border-color: #30363d;
}

.showcase-tab--active {
    background: #21262d;
    color: #f0f6fc;
    border-color: #58a6ff;
}

.showcase-display {
    display: flex;
    justify-content: center;
}

.showcase-img {
    display: none;
    max-width: 100%;
    width: 800px;
    border-radius: 12px;
    border: 1px solid #21262d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.showcase-img--active {
    display: block;
}

/* ── Features grid ── */
.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 48px;
}

.feature-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 20px 24px;
    transition: border-color 0.15s;
}

.feature-card:hover {
    border-color: #30363d;
}

.feature-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 6px;
}

.feature-card-desc {
    font-size: 0.82rem;
    color: #8b949e;
    line-height: 1.5;
}

/* ── Legal ── */
.splash-legal {
    border-top: 1px solid #21262d;
    padding-top: 20px;
    text-align: center;
}

.splash-legal p {
    font-size: 0.7rem;
    color: #484f58;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.splash-legal-links {
    margin-top: 10px !important;
}

.hero-legal-note {
    font-size: 0.75rem;
    color: #484f58;
    margin-top: 12px;
}

.legal-link {
    color: #58a6ff;
    text-decoration: none;
}

.legal-link:hover {
    text-decoration: underline;
}

.table-count-note {
    font-size: 0.75rem;
    color: #8b949e;
    text-align: right;
    margin-top: 8px;
}

/* ── Market Conditions Card ── */
.conditions-card-inner {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.conditions-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.conditions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.conditions-list li {
    font-size: 0.85rem;
    color: #c9d1d9;
    padding: 3px 0;
    padding-left: 12px;
    position: relative;
}

.conditions-list li::before {
    content: "\2022";
    color: #484f58;
    position: absolute;
    left: 0;
}

.conditions-list li.conditions-warning {
    color: #f0883e;
}

.conditions-list li.conditions-warning::before {
    content: "\26A0";
    color: #f0883e;
    font-size: 0.75rem;
}

/* ── Event Badges ── */
.event-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    margin-right: 6px;
    margin-bottom: 4px;
}

.event-badge--orange {
    background: rgba(240, 136, 62, 0.15);
    color: #f0883e;
    border: 1px solid rgba(240, 136, 62, 0.3);
}

.event-badge--blue {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.event-badge--red {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.event-badge--green {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

/* ── Download Button ── */
.btn--download {
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn--download:hover {
    background: rgba(88, 166, 255, 0.08);
    color: #58a6ff;
    border-color: #58a6ff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .showcase-tabs {
        flex-wrap: wrap;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .splash-page {
        padding: 20px 12px;
    }

    .hero {
        padding: 20px 0 32px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-description {
        font-size: 0.88rem;
    }

    .btn--cta {
        padding: 12px 32px;
        font-size: 0.9rem;
    }

    .showcase-tab {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .feature-card {
        padding: 16px 18px;
    }
}

/* ---------- Auth forms ---------- */
.auth-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: #8b949e;
    margin-bottom: 24px;
    line-height: 1.4;
}

.auth-error {
    font-size: 0.82rem;
    color: #f85149;
    min-height: 20px;
    margin-bottom: 8px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
}

.auth-switch-text {
    color: #8b949e;
}

.auth-switch-link {
    background: none;
    border: none;
    color: #58a6ff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.auth-switch-link:hover {
    text-decoration: underline;
}

.auth-forgot {
    text-align: right;
    margin-top: -8px;
    margin-bottom: 16px;
}

.auth-success {
    font-size: 0.82rem;
    color: #3fb950;
    min-height: 20px;
    margin-bottom: 8px;
}

/* Password show/hide toggle */
.pw-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.pw-wrapper .form-input {
    width: 100%;
}

.pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: #0d1117;
    border: none;
    color: #58a6ff;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    transition: color 0.15s;
}

.pw-toggle:hover {
    color: #f0f6fc;
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: #21262d;
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-divider-text {
    font-size: 0.78rem;
    color: #484f58;
    padding: 0 12px;
    background: #161b22;
    position: relative;
}

.btn--google {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #c9d1d9;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn--google:hover {
    background: #30363d;
    border-color: #484f58;
    color: #f0f6fc;
}

/* ---------- Landing tagline + recent chips ---------- */
.landing-tagline {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 24px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.recent-section {
    margin-top: 20px;
}

.recent-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.recent-label {
    font-size: 0.78rem;
    color: #8b949e;
    font-weight: 600;
}

.recent-chip {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 4px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.15s;
}

.recent-chip:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #f0f6fc;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.form-hint {
    display: block;
    font-size: 0.72rem;
    color: #8b949e;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: none;
    border: none;
    padding: 0;
}

.form-input input {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 14px 16px;
    color: #f0f6fc;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.form-input input::placeholder {
    color: #484f58;
}

/* Hide native number input spinners (Dash wraps inputs in a div) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.form-input--symbol input {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---------- Symbol search dropdown (dark theme override) ---------- */
.symbol-search,
.symbol-search * {
    background-color: #0d1117 !important;
    color: #f0f6fc !important;
    border-color: #30363d !important;
}

.symbol-search > div {
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    border-radius: 8px !important;
    min-height: 48px !important;
}

.symbol-search > div:hover {
    border-color: #58a6ff !important;
}

/* Selected value text */
.symbol-search span[class*="singleValue"],
.symbol-search div[class*="singleValue"] {
    color: #f0f6fc !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
}

/* Placeholder */
.symbol-search div[class*="placeholder"] {
    color: #8b949e !important;
    font-size: 0.95rem !important;
}

/* Search input text */
.symbol-search input {
    color: #f0f6fc !important;
    font-size: 0.95rem !important;
}

/* Dropdown menu */
.symbol-search div[class*="menu"] {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    border-radius: 8px !important;
    z-index: 200 !important;
}

/* Dropdown options */
.symbol-search div[class*="option"] {
    background: #161b22 !important;
    color: #c9d1d9 !important;
    font-size: 0.85rem !important;
    padding: 10px 14px !important;
    cursor: pointer !important;
}

.symbol-search div[class*="option"]:hover,
.symbol-search div[class*="option"][class*="focused"] {
    background: #21262d !important;
    color: #f0f6fc !important;
}

/* Clear (X) and arrow buttons */
.symbol-search div[class*="indicatorContainer"] {
    color: #8b949e !important;
}

.symbol-search div[class*="indicatorContainer"]:hover {
    color: #f0f6fc !important;
}

.advanced-section {
    margin-top: 16px;
    border-top: 1px solid #21262d;
    padding-top: 16px;
}

.advanced-toggle {
    font-size: 0.8rem;
    color: #58a6ff;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    user-select: none;
}

.advanced-toggle::-webkit-details-marker {
    display: none;
}

.advanced-toggle::marker {
    content: none;
}

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

/* ==========================================================
   PROGRESS PANEL — Step-by-step animated checklist
   ========================================================== */
.progress-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.progress-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 16px;
    padding: 40px;
    max-width: 480px;
    width: 100%;
}

.progress-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #f0f6fc;
    margin-bottom: 8px;
}

.progress-subtitle {
    font-size: 0.85rem;
    color: #8b949e;
}

.progress-steps {
    margin-top: 24px;
}

.progress-step {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(33, 38, 45, 0.5);
}

.progress-step:last-child {
    border-bottom: none;
}

.step-icon {
    width: 20px;
    min-width: 20px;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1;
}

.step-icon--done {
    color: #3fb950;
}

.step-icon--active {
    color: #58a6ff;
    animation: pulse 1.5s ease-in-out infinite;
}

.step-icon--pending {
    color: #30363d;
}

.step-label--done {
    color: #c9d1d9;
    font-size: 0.88rem;
}

.step-label--active {
    color: #f0f6fc;
    font-weight: 600;
    font-size: 0.88rem;
}

.step-label--pending {
    color: #484f58;
    font-size: 0.88rem;
}

.step-detail {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    color: #8b949e;
    margin-left: auto;
    white-space: nowrap;
}

.progress-error {
    color: #f85149;
    font-size: 0.9rem;
    margin-top: 20px;
    padding: 12px 16px;
    background: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.2);
    border-radius: 8px;
    line-height: 1.4;
}

@keyframes pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.4; }
    100% { opacity: 1; }
}

/* ==========================================================
   HISTORY SIDEBAR — Slide-out panel with saved analyses
   ========================================================== */
.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    cursor: pointer;
}

.history-sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: #161b22;
    border-left: 1px solid #21262d;
    z-index: 300;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #21262d;
    position: sticky;
    top: 0;
    background: #161b22;
    z-index: 1;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f0f6fc;
}

.sidebar-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.sidebar-close:hover {
    color: #f0f6fc;
    background: #21262d;
}

.history-list {
    padding: 12px;
}

.history-empty {
    color: #484f58;
    text-align: center;
    padding: 40px 20px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.history-item {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: border-color 0.15s;
}

.history-item:hover {
    border-color: #30363d;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-symbol {
    font-size: 1rem;
    font-weight: 700;
    color: #f0f6fc;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.03em;
}

.history-price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', monospace;
}

.history-item-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.history-regime {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 4px;
}

.history-regime--quiet { color: #4CAF50; background: rgba(76, 175, 80, 0.1); }
.history-regime--normal { color: #2196F3; background: rgba(33, 150, 243, 0.1); }
.history-regime--elevated { color: #FF9800; background: rgba(255, 152, 0, 0.1); }
.history-regime--exploding { color: #F44336; background: rgba(244, 67, 54, 0.1); }

.history-candidates {
    font-size: 0.75rem;
    color: #8b949e;
}

.history-date {
    font-size: 0.72rem;
    color: #484f58;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.sidebar-actions {
    padding: 12px;
    border-bottom: 1px solid #21262d;
}

.history-delete-all-btn {
    width: 100%;
    background: transparent;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #8b949e;
    padding: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.history-delete-all-btn:hover {
    color: #f85149;
    border-color: #f85149;
    background: rgba(248, 81, 73, 0.08);
}

.history-load-btn {
    flex: 1;
    text-align: center;
    padding: 6px;
    font-size: 0.78rem;
}

.history-delete-btn {
    background: transparent;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #8b949e;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.history-delete-btn:hover {
    color: #f85149;
    border-color: #f85149;
    background: rgba(248, 81, 73, 0.08);
}

/* ==========================================================
   RESULTS PANEL — Full dashboard (tabs/tables/charts)
   ========================================================== */
.results-panel {
    /* wrapper for the full results dashboard */
}

.results-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #21262d;
    margin-bottom: 16px;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge--green {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge--orange {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge--alpha {
    background: rgba(188, 140, 255, 0.15);
    color: #bc8cff;
    border: 1px solid rgba(188, 140, 255, 0.3);
    font-size: 0.6rem;
    vertical-align: middle;
    margin-left: 8px;
}

.badge--closed {
    background: rgba(139, 148, 158, 0.1);
    color: #8b949e;
    border: 1px solid rgba(139, 148, 158, 0.2);
}

/* ---------- Controls ---------- */
.controls {
    margin-bottom: 12px;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.control-input {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 8px 12px;
    font-size: 0.85rem;
    width: 100px;
    transition: border-color 0.15s ease;
}

.control-input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.control-input--narrow {
    width: 80px;
}

/* ---------- Buttons ---------- */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
}

.btn:hover:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    filter: brightness(1.1);
}

.btn:active:not([disabled]) {
    transform: translateY(0);
}

.btn--primary {
    background: linear-gradient(135deg, #238636, #2ea043);
    color: #fff;
}

.btn--secondary {
    background: linear-gradient(135deg, #30363d, #484f58);
    color: #c9d1d9;
}

.btn--analyze {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #238636, #2ea043);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 24px;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

.btn--analyze:hover:not([disabled]) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(35, 134, 54, 0.35);
    filter: brightness(1.1);
}

.btn--analyze:active:not([disabled]) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(35, 134, 54, 0.2);
}

.btn--analyze[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--back {
    background: transparent;
    color: #58a6ff;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn--back:hover {
    background: rgba(88, 166, 255, 0.08);
    border-color: #58a6ff;
}

.btn--feedback {
    background: transparent;
    color: #f0883e;
    border: 1px solid #f0883e40;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.btn--feedback:hover {
    background: rgba(240, 136, 62, 0.08);
    border-color: #f0883e;
}

/* ---------- Status bar ---------- */
.status-bar {
    font-size: 0.8rem;
    padding: 8px 0;
    font-family: 'JetBrains Mono', monospace;
    min-height: 28px;
}

/* ---------- Data source banner ---------- */
.data-source-banner {
    margin-bottom: 12px;
}

.data-banner-inner {
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 10px 16px;
}

.data-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.data-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
}

.data-badge--live {
    color: #3fb950;
    background: rgba(63, 185, 80, 0.12);
}

.data-badge--delayed {
    color: #d29922;
    background: rgba(210, 153, 34, 0.12);
}

.data-badge--synthetic {
    color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
}

.data-badge--historical {
    color: #8b949e;
    background: rgba(139, 148, 158, 0.1);
}

.data-badge--manual {
    color: #bc8cff;
    background: rgba(188, 140, 255, 0.1);
}

.data-badge-label {
    font-size: 0.72rem;
    color: #8b949e;
}

.data-badge-sep {
    color: #30363d;
    font-size: 0.75rem;
    margin: 0 4px;
}

.data-note {
    font-size: 0.7rem;
    color: #8b949e;
    margin-top: 6px;
    line-height: 1.4;
    font-style: italic;
}

/* ---------- Tabs ---------- */
.tab {
    background: #161b22 !important;
    border: 1px solid #21262d !important;
    border-bottom: none !important;
    color: #8b949e !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    border-radius: 8px 8px 0 0 !important;
    margin-right: 2px !important;
}

.tab--selected {
    background: #0d1117 !important;
    color: #f0f6fc !important;
    border-bottom: 2px solid #58a6ff !important;
}

.tab-content {
    padding: 20px 0;
}

/* ---------- Section titles ---------- */
.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #c9d1d9;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

/* ---------- Stats grid ---------- */
.stats-row {
    margin: 12px 0;
}

.stats-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 10px 16px;
    min-width: 100px;
    flex: 1;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f0f6fc;
    font-family: 'JetBrains Mono', monospace;
}

/* ---------- Company info card ---------- */
.company-info-card {
    margin-bottom: 16px;
}

.company-info-inner {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 16px 20px;
}

.company-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.company-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f0f6fc;
}

.company-sector {
    font-size: 0.78rem;
    color: #8b949e;
}

.company-metrics {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.company-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.company-metric-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.company-metric-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', monospace;
}

.company-flags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.company-flag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.02em;
}

.company-flag--warning {
    color: #d29922;
    background: rgba(210, 153, 34, 0.1);
    border: 1px solid rgba(210, 153, 34, 0.2);
}

.company-flag--info {
    color: #58a6ff;
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.15);
}

/* ---------- Top pick card ---------- */
.top-pick-card {
    margin-bottom: 16px;
}

.top-pick-inner {
    background: linear-gradient(145deg, rgba(35, 134, 54, 0.08), rgba(13, 17, 23, 0.95));
    border: 1px solid rgba(63, 185, 80, 0.25);
    border-radius: 12px;
    padding: 16px 20px;
}

.top-pick-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.top-pick-score {
    font-size: 0.85rem;
    color: #8b949e;
    font-family: 'JetBrains Mono', monospace;
}

.top-pick-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f0f6fc;
}

.top-pick-detail {
    font-size: 0.85rem;
    color: #8b949e;
    margin-left: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.top-pick-reasons {
    font-size: 0.78rem;
    color: #58a6ff;
    margin-top: 8px;
}

/* ---------- Premium card ---------- */
.premium-card {
    margin-bottom: 16px;
}

.premium-inner {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 16px 20px;
}

.premium-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.premium-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.premium-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    color: #c9d1d9;
}

.premium-rec {
    font-size: 0.82rem;
    color: #8b949e;
    margin-top: 10px;
    font-style: italic;
}

/* ---------- Regime card ---------- */
.regime-card {
    margin-bottom: 16px;
}

.regime-inner {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 16px 20px;
}

.regime-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.regime-value {
    font-size: 1.2rem;
}

.regime-detail {
    font-size: 0.8rem;
    color: #8b949e;
    font-family: 'JetBrains Mono', monospace;
}

.regime-desc {
    font-size: 0.82rem;
    color: #8b949e;
    margin-top: 10px;
    font-style: italic;
}

/* ---------- Chart layout ---------- */
.chart-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-half {
    flex: 1;
    min-width: 0;
}

.chart {
    border: 1px solid #21262d;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 900px) {
    .chart-row { flex-direction: column; }
}

/* ---------- MC controls ---------- */
.mc-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* ---------- Tables ---------- */
.table-container {
    margin-top: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.table-header-row .section-title {
    margin-bottom: 0;
}

/* Glossary */
.glossary-toggle {
    position: relative;
}

.glossary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #21262d;
    color: #8b949e;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    transition: all 0.15s ease;
}

.glossary-btn:hover {
    background: #30363d;
    color: #f0f6fc;
}

.glossary-btn::-webkit-details-marker {
    display: none;
}

.glossary-btn::marker {
    content: none;
}

/* Hidden — glossary content is cloned into a body-level modal by JS */
.glossary-content {
    display: none;
}

/* Body-level modal overlay (created by JS) */
.glossary-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.glossary-modal {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.glossary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #21262d;
}

.glossary-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f0f6fc;
    margin: 0;
}

.glossary-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.glossary-close:hover {
    color: #f0f6fc;
    background: #21262d;
}


.glossary-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(33, 38, 45, 0.4);
}

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

.glossary-term {
    font-size: 0.78rem;
    font-weight: 700;
    color: #58a6ff;
    min-width: 75px;
    font-family: 'JetBrains Mono', monospace;
}

.glossary-def {
    font-size: 0.78rem;
    color: #c9d1d9;
    line-height: 1.45;
}

.chain-table, .vol-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.chain-table thead th, .vol-table thead th {
    position: sticky;
    top: 0;
    background: #161b22;
    padding: 8px 10px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8b949e;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.chain-table thead th:hover {
    color: #f0f6fc;
}

.chain-table thead th.sort-asc::after {
    content: " \25B2";
    font-size: 0.55rem;
}

.chain-table thead th.sort-desc::after {
    content: " \25BC";
    font-size: 0.55rem;
}

.chain-table tbody td, .vol-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(33, 38, 45, 0.5);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}

.chain-table tbody tr:hover, .vol-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.04);
}

/* Row grade colors */
.row--grade-a {
    border-left: 3px solid #3fb950;
}

.row--grade-b {
    border-left: 3px solid #58a6ff;
}

.row--grade-c {
    border-left: 3px solid #d29922;
}

.row--grade-d {
    border-left: 3px solid #8b949e;
}

/* ---------- Strategy panel ---------- */
.strategy-panel {
    margin-top: 16px;
}

.strategy-inner {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 16px 20px;
}

.strategy-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.strategy-item {
    font-size: 0.85rem;
}

.strategy-label {
    font-weight: 600;
    color: #8b949e;
}

.strategy-value {
    color: #c9d1d9;
}

/* ---------- Detail panel ---------- */
.detail-panel {
    margin-top: 16px;
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.82rem;
}

/* ---------- Dash overrides ---------- */
.dash-table-container .dash-spreadsheet {
    background: #0d1117 !important;
}

._dash-undo-redo { display: none !important; }

.js-plotly-plot .plotly .modebar {
    background: transparent !important;
}

.js-plotly-plot .plotly .modebar-btn path {
    fill: #8b949e !important;
}

.js-plotly-plot .plotly .modebar-btn:hover path {
    fill: #f0f6fc !important;
}

/* ---------- Disclaimer footer ---------- */
.disclaimer {
    margin-top: 32px;
    padding: 16px 0;
    border-top: 1px solid #21262d;
}

.disclaimer p {
    font-size: 0.7rem;
    color: #484f58;
    line-height: 1.5;
    max-width: 900px;
}

/* ==========================================================
   RESPONSIVE — Tablet (768px)
   ========================================================== */
@media (max-width: 768px) {
    /* App container */
    #app-container {
        padding: 12px 16px;
    }

    /* Header */
    .header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-title {
        font-size: 1.3rem;
    }

    .header-right {
        gap: 6px;
    }

    .market-label {
        display: none;
    }

    /* Splash layout (already stacks at 768px) */
    .splash-title {
        font-size: 1.4rem;
    }

    .splash-container {
        gap: 24px;
    }

    /* Results bar */
    .results-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* History sidebar */
    .history-sidebar {
        width: min(380px, 85vw);
    }

    /* Glossary popup */

    /* Stats grid — auto-size text to fit */
    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        min-width: 0;
        flex-basis: calc(33% - 8px);
    }

    .stat-value {
        font-size: clamp(0.7rem, 2.5vw, 1.1rem);
        white-space: nowrap;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    /* Top pick card */
    .top-pick-body {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .top-pick-detail {
        margin-left: 0;
    }

    /* Premium stats */
    .premium-stats {
        gap: 12px;
    }

    /* Charts */
    .chart-row {
        gap: 8px;
    }

    /* MC controls */
    .mc-controls {
        gap: 8px;
    }

    .control-input {
        width: 100%;
        min-width: 0;
    }

    .control-input--narrow {
        width: 100%;
    }
}

/* ==========================================================
   RESPONSIVE — Phone portrait (480px)
   ========================================================== */
@media (max-width: 480px) {
    /* App container */
    #app-container {
        padding: 8px 12px;
    }

    /* Header */
    .header-title {
        font-size: 1.1rem;
    }

    .header-right .btn--back,
    .header-right .btn--feedback {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    /* Splash page */
    .splash-panel {
        padding: 20px 12px;
    }

    .splash-title {
        font-size: 1.2rem;
    }

    .splash-subtitle {
        font-size: 0.9rem;
    }

    .splash-feature-text {
        font-size: 0.8rem;
    }

    .splash-legal p {
        font-size: 0.65rem;
    }

    /* Landing card */
    .landing-card {
        padding: 24px;
    }

    .landing-tagline {
        font-size: 1rem;
    }

    /* Progress card */
    .progress-card {
        padding: 24px;
    }

    .progress-title {
        font-size: 1.1rem;
    }

    /* Advanced options */
    .advanced-grid {
        grid-template-columns: 1fr;
    }

    /* Auth */
    .auth-title {
        font-size: 1.1rem;
    }

    /* Tables */
    .chain-table thead th,
    .vol-table thead th {
        padding: 6px 6px;
        font-size: 0.65rem;
    }

    .chain-table tbody td,
    .vol-table tbody td {
        padding: 5px 6px;
        font-size: 0.72rem;
    }

    /* Stats */
    .stat-card {
        min-width: 70px;
        padding: 8px 10px;
    }

    .stat-value {
        font-size: 0.95rem;
    }

    /* Top pick */
    .top-pick-inner {
        padding: 12px 14px;
    }

    .top-pick-title {
        font-size: 1rem;
    }

    .top-pick-score {
        font-size: 0.75rem;
    }

    /* History sidebar */
    .history-sidebar {
        width: 85vw;
    }

    /* Glossary — already fixed-position from 768px breakpoint */

    .glossary-term {
        min-width: 60px;
        font-size: 0.72rem;
    }

    .glossary-def {
        font-size: 0.72rem;
    }

    /* Premium card */
    .premium-stats {
        gap: 8px;
        font-size: 0.78rem;
    }

    /* Strategy panel */
    .strategy-inner {
        padding: 12px 14px;
    }

    /* Status bar */
    .status-bar {
        font-size: 0.72rem;
        word-break: break-word;
    }

    /* Section titles */
    .section-title {
        font-size: 0.82rem;
    }

    /* Buttons */
    .btn--analyze {
        padding: 12px;
        font-size: 0.9rem;
    }
}
