/* ======================================================
   StockPulse v2.0 — Complete Design System
   ====================================================== */

:root {
    --bg-main: #060912;
    --bg-secondary: #0D1117;
    --bg-card: rgba(22, 27, 45, 0.65);
    --bg-card-hover: rgba(30, 38, 60, 0.85);
    --bg-sidebar: rgba(10, 14, 23, 0.95);
    --text-main: #E8ECF4;
    --text-muted: #7B8CA8;
    --text-dim: #4A5568;
    --accent: #00D4FF;
    --accent-hover: #00B8E0;
    --accent-dim: rgba(0, 212, 255, 0.12);
    --success: #00E68A;
    --success-dim: rgba(0, 230, 138, 0.12);
    --danger: #FF4D6A;
    --danger-dim: rgba(255, 77, 106, 0.12);
    --warning: #FFB020;
    --warning-dim: rgba(255, 176, 32, 0.12);
    --purple: #A78BFA;
    --purple-dim: rgba(167, 139, 250, 0.12);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --glow: rgba(0, 212, 255, 0.25);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ====== LAYOUT ====== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ====== SIDEBAR ====== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    transition: var(--transition);
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
}

.brand-icon {
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #00FF88);
    border-radius: 10px;
    flex-shrink: 0;
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-text .accent { color: var(--accent); }

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    padding: 1rem 0.75rem 0.4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.sidebar-user .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #000;
    flex-shrink: 0;
}

/* ====== MAIN CONTENT ====== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(6, 9, 18, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-body {
    flex: 1;
    padding: 2rem;
    max-width: 1600px;
    width: 100%;
}

/* ====== PAGES ====== */
.page { display: none; animation: pageIn 0.35s ease; }
.page.active { display: block; }

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

/* ====== GLASS CARDS ====== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-hover);
}

.glass-card.interactive:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ====== TYPOGRAPHY ====== */
.gradient-text {
    background: linear-gradient(135deg, #00D4FF 0%, #00FF88 50%, #A78BFA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.accent { color: var(--accent); }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.2rem; }
.text-xl { font-size: 1.5rem; }
.text-center { text-align: center; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.error-text { color: var(--danger); margin-top: 1rem; font-size: 0.85rem; }

h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00B8E0);
    color: #000;
    font-weight: 700;
    box-shadow: 0 0 20px var(--glow);
}
.btn-primary:hover {
    box-shadow: 0 0 30px var(--glow);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
}
.btn-ghost:hover { color: var(--text-main); background: rgba(255,255,255,0.04); }

.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid rgba(255,77,106,0.2);
}
.btn-danger:hover { background: rgba(255,77,106,0.2); }

/* ====== SEARCH BOX ====== */
.search-box {
    display: flex;
    align-items: center;
    background: rgba(22, 27, 45, 0.8);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0.4rem 0.5rem;
    transition: var(--transition);
    gap: 0.25rem;
    flex-wrap: wrap;
}
.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--glow);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    outline: none;
    min-width: 150px;
    font-family: inherit;
}

.search-box.compact { border-radius: var(--radius); padding: 0.6rem; }
.search-box.compact input { font-size: 0.95rem; }

.search-icon { font-size: 1rem; padding: 0 0.5rem; color: var(--text-muted); }

/* ====== FORM SELECTS ====== */
.select-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.select-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.select-styled {
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    font-family: inherit;
    outline: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.select-styled:hover { border-color: var(--accent); }
.select-styled:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(0,212,255,0.15); }
.select-styled option { background: var(--bg-main); }

.select-help-text {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ====== HERO SECTION ====== */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
    position: relative;
}

.hero-bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(0, 212, 255, 0.08) 0%, rgba(0, 255, 136, 0.04) 40%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.hero-title { font-size: 3rem; font-weight: 900; line-height: 1.15; margin-bottom: 0.75rem; letter-spacing: -0.03em; }
.hero-subtitle { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 2.5rem; max-width: 500px; margin-left: auto; margin-right: auto; }

.search-container { max-width: 580px; margin: 0 auto; }

/* ====== GRID LAYOUTS ====== */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.75rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.indices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.section { margin-bottom: 3rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.section h2 { font-size: 1.3rem; }

/* ====== STOCK CARDS ====== */
.stock-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    cursor: pointer;
}
.stock-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stock-card-symbol { font-weight: 800; font-size: 1.1rem; }
.stock-card-name { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.stock-card-price { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 700; }
.stock-badge { padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-bullish, .badge-strong-buy, .badge-buy { background: var(--success-dim); color: var(--success); }
.badge-bearish, .badge-strong-sell, .badge-sell { background: var(--danger-dim); color: var(--danger); }
.badge-neutral { background: rgba(123, 140, 168, 0.15); color: var(--text-muted); }

/* ====== MARKET OVERVIEW CARDS ====== */
.index-card {
    padding: 1.25rem;
}
.index-name { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.index-value { font-family: 'JetBrains Mono', monospace; font-size: 1.5rem; font-weight: 700; }
.index-change { font-size: 0.9rem; font-weight: 600; margin-top: 0.25rem; }

/* Fear & Greed */
.fear-greed-card {
    text-align: center;
    padding: 2rem;
}
.fg-score { font-size: 4rem; font-weight: 900; line-height: 1; }
.fg-label { font-size: 1.1rem; font-weight: 700; margin-top: 0.5rem; }
.fg-meter { width: 100%; height: 10px; background: linear-gradient(90deg, var(--danger), var(--warning), var(--success)); border-radius: 5px; margin: 1rem 0; position: relative; }
.fg-needle { position: absolute; top: -4px; width: 4px; height: 18px; background: #fff; border-radius: 2px; transition: left 1s ease; }

/* Sector heatmap */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}

.heatmap-cell {
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-sm);
    text-align: center;
    transition: var(--transition);
    cursor: default;
}
.heatmap-cell:hover { transform: scale(1.03); }
.heatmap-cell .sector-name { font-size: 0.75rem; font-weight: 600; opacity: 0.9; }
.heatmap-cell .sector-change { font-size: 1.1rem; font-weight: 800; margin-top: 2px; }

/* ====== ANALYZE PAGE ====== */
.analyze-header { margin-bottom: 1.5rem; }

.stock-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.stock-header h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.stock-price-main { display: flex; align-items: baseline; gap: 0.75rem; }
.stock-price-main .price { font-family: 'JetBrains Mono', monospace; font-size: 2.5rem; font-weight: 800; }
.stock-price-main .change { font-size: 1.1rem; font-weight: 600; }

/* ====== TABS ====== */
.tab-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.tab:hover { color: var(--text-main); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab .tab-spinner {
    display: inline-block;
    width: 11px;
    height: 11px;
    border: 2px solid rgba(0,212,255,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 5px;
    vertical-align: middle;
}

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

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: pageIn 0.3s ease; }

/* ====== METRICS ====== */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.metric-box {
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid rgba(255,255,255,0.04);
}
.metric-box .label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.metric-box .value { font-family: 'JetBrains Mono', monospace; font-size: 1.35rem; font-weight: 700; }

/* ====== DATA TABLE ====== */
.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: rgba(255,255,255,0.03);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover { color: var(--accent); }

.data-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: rgba(0, 212, 255, 0.03);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.01);
}

/* ====== RISK GAUGE ====== */
.risk-gauge-container { text-align: center; padding: 2rem; }
.risk-class { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.risk-score { font-size: 1.25rem; color: var(--text-muted); }
.risk-meter { width: 100%; height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; margin: 1rem 0; overflow: hidden; }
.risk-fill { height: 100%; transition: width 1s ease-out; border-radius: 4px; }

/* ====== INDICATORS ====== */
.indicators-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.indicator-card {
    display: flex;
    flex-direction: column;
}

.indicator-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.indicator-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
}
.indicator-badge.oversold { background: var(--success-dim); color: var(--success); }
.indicator-badge.overbought { background: var(--danger-dim); color: var(--danger); }
.indicator-badge.neutral { background: var(--warning-dim); color: var(--warning); }

.mini-chart { height: 200px; width: 100%; border-radius: 6px; }

/* ====== ML STEP LOADER ====== */
.ml-loading-card { text-align: center; padding: 3rem 2rem; }

.step-loader {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    max-width: 320px;
    margin: 0 auto;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.35;
    transition: all 0.5s ease;
}
.step-item.active { opacity: 1; color: var(--accent); }
.step-item.done { opacity: 1; color: var(--success); }

.step-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    flex-shrink: 0;
    position: relative;
}
.step-item.active .step-dot { border-color: var(--accent); animation: pulseDot 1.5s infinite; }
.step-item.done .step-dot { background: var(--success); border-color: var(--success); }
.step-item.done .step-dot::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 1px;
    font-size: 10px;
    color: #fff;
}

@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(0, 212, 255, 0); }
}

/* ====== SCREENER ====== */
.screener-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.filter-group input, .filter-group select {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    min-width: 100px;
    transition: var(--transition);
}
.filter-group input:focus, .filter-group select:focus { border-color: var(--accent); }
.filter-group select option { background: var(--bg-main); }

/* ====== COMPARISON ====== */
.compare-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.compare-input input {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    width: 150px;
    transition: var(--transition);
}
.compare-input input:focus { border-color: var(--accent); }

.correlation-matrix { overflow-x: auto; }
.correlation-matrix table { border-collapse: collapse; }
.correlation-matrix th, .correlation-matrix td {
    padding: 0.6rem 0.8rem;
    text-align: center;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid var(--border);
}
.correlation-matrix th { background: rgba(255,255,255,0.03); color: var(--text-muted); font-weight: 600; }

/* ====== FUNDAMENTALS ====== */
.fundamentals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.fundamentals-section h3 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.fundamentals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
}
.fundamentals-row .f-label { color: var(--text-muted); }
.fundamentals-row .f-value { font-family: 'JetBrains Mono', monospace; font-weight: 600; }

/* ====== LOADING ====== */
.loading-section { text-align: center; padding: 4rem 2rem; }
.pulse-loader {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    margin: 0 auto 1rem;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(0, 212, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 212, 255, 0); }
}

.loading-skeleton {
    height: 100px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.loading-text { color: var(--text-muted); font-size: 0.95rem; }

/* ====== GLOBAL LOADING BANNER ====== */
.global-loading-banner {
    position: sticky;
    top: 0;
    z-index: 150;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, rgba(0, 255, 136, 0.08) 50%, rgba(167, 139, 250, 0.10) 100%);
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 0.6rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bannerSlideIn 0.4s ease;
    transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease;
    max-height: 60px;
    overflow: hidden;
}

.global-loading-banner.banner-hidden {
    opacity: 0;
    transform: translateY(-100%);
    max-height: 0;
    padding: 0 2rem;
    border-bottom-color: transparent;
    pointer-events: none;
}

@keyframes bannerSlideIn {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

.global-loading-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.global-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(0, 212, 255, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.global-loading-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.hidden { display: none !important; }

/* ====== MODALS ====== */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.75); backdrop-filter: blur(8px); }
.modal-content { position: relative; width: 100%; max-width: 400px; background: var(--bg-secondary); padding: 2rem; z-index: 1001; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.auth-tab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); padding: 0.5rem; cursor: pointer; font-weight: 600; font-family: inherit; font-size: inherit; transition: var(--transition); }
.auth-tab.active { color: var(--accent); border-color: var(--accent); }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.form-group input { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem; color: var(--text-main); font-family: inherit; transition: var(--transition); }
.form-group input:focus { outline: none; border-color: var(--accent); }

/* ====== FOOTER ====== */
.footer {
    text-align: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-dim);
}
.footer-disclaimer { font-size: 0.7rem; color: var(--text-dim); margin-top: 0.25rem; }

/* ====== STAT CARD (for Data page) ====== */
.stat-card {
    padding: 1rem;
}
.stat-card .stat-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.4rem; }
.stat-card .stat-value { font-family: 'JetBrains Mono', monospace; font-size: 1.3rem; font-weight: 700; }
.stat-card .stat-sub { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 300;
    }

    .sidebar-brand, .sidebar-section-label, .sidebar-footer { display: none; }

    .sidebar-nav {
        flex-direction: row;
        padding: 0.5rem;
        gap: 0;
        justify-content: space-around;
        width: 100%;
        overflow-x: auto;
    }

    .nav-item {
        flex-direction: column;
        gap: 2px;
        padding: 0.5rem;
        font-size: 0.65rem;
        min-width: 50px;
    }

    .nav-item.active::before { display: none; }
    .nav-item .nav-text { display: block; }

    .main-content {
        margin-left: 0;
        margin-bottom: 70px;
    }

    .hero-title { font-size: 2rem; }
    .stock-header { flex-direction: column; gap: 1rem; }
    .stock-header h1 { font-size: 1.4rem; }
    .stock-price-main .price { font-size: 2rem; }
    .indicators-grid { grid-template-columns: 1fr; }
    .search-box.compact { flex-direction: column; }
    .select-group { flex-direction: row; gap: 6px; }
    .tab-bar { gap: 0; }
    .tab { font-size: 0.8rem; padding: 0.6rem; }
    .metrics-row { grid-template-columns: 1fr 1fr; }
    .main-body { padding: 1.25rem; }
    .fundamentals-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.7rem; }
    .stock-grid { grid-template-columns: 1fr; }
    .metrics-row { grid-template-columns: 1fr; }
    .indices-grid { grid-template-columns: 1fr 1fr; }
    .heatmap-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ====== UNIFIED VERDICT CARD ====== */
.verdict-section {
    margin-bottom: 1.5rem;
}

.verdict-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    transition: var(--transition);
    animation: verdictSlideIn 0.5s ease;
}

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

.verdict-main {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border);
}

.verdict-gauge-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 220px;
}

.verdict-gauge {
    width: 200px;
    height: 120px;
}

.verdict-gauge-svg {
    width: 100%;
    height: 100%;
}

.verdict-gauge-fill {
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.verdict-gauge-dot {
    filter: drop-shadow(0 0 6px currentColor);
    transition: cx 1.5s cubic-bezier(0.4, 0, 0.2, 1), cy 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.verdict-score-display {
    text-align: center;
    margin-top: -0.5rem;
}

.verdict-label {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.verdict-score-num {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1;
    margin-top: 0.25rem;
}

.verdict-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.verdict-confidence {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.verdict-confidence-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 80px;
}

.verdict-confidence-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.verdict-confidence-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-out;
}

.verdict-confidence-val {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 45px;
    text-align: right;
}

.verdict-updating {
    font-size: 0.8rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: subtlePulse 2s infinite;
}

@keyframes subtlePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.verdict-final {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
}

.verdict-partial {
    font-size: 0.8rem;
    color: var(--warning);
    font-weight: 500;
}

.verdict-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.verdict-components {
    padding: 1.5rem 2rem;
    border-right: 1px solid var(--border);
}

.verdict-components h4, .verdict-explanations h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.verdict-component {
    margin-bottom: 1rem;
}

.verdict-comp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.verdict-comp-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.verdict-comp-dir {
    font-size: 0.8rem;
    font-weight: 700;
}

.verdict-comp-bar-track {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.verdict-comp-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
}

.verdict-comp-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
}

.verdict-comp-bar.bar-right {
    left: 50%;
}

.verdict-comp-bar.bar-left {
    right: 50%;
}

.verdict-comp-weight {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.verdict-details {
    padding: 1.5rem 2rem;
}

.verdict-risk-card {
    margin-bottom: 1.25rem;
}

.verdict-risk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.verdict-risk-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verdict-risk-factors {
    margin-top: 0.75rem;
}

.verdict-risk-factor {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    line-height: 1.5;
}

.verdict-explanations {
    margin-top: 0.25rem;
}

.verdict-explanation-item {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
    line-height: 1.5;
}

/* Responsive verdict */
@media (max-width: 768px) {
    .verdict-main {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
    .verdict-gauge-area { min-width: unset; }
    .verdict-gauge { width: 160px; height: 100px; }
    .verdict-body {
        grid-template-columns: 1fr;
    }
    .verdict-components {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.25rem;
    }
    .verdict-details {
        padding: 1rem 1.25rem;
    }
}

