/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    --border: #2a3a50;
    --text-primary: #e8edf5;
    --text-secondary: #8899aa;
    --text-muted: #5a6a7a;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.1);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.1);
    --orange: #f97316;
    --purple: #a855f7;
    --radius: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f2f5;
    --border: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.08);
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.08);
    --yellow: #ca8a04;
    --yellow-bg: rgba(202, 138, 4, 0.08);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* ===== Market Dashboard ===== */
.market-dashboard { margin-bottom: 30px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    background: var(--bg-hover);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    cursor: default;
    user-select: none;
}

.update-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-content {
    color: var(--text-secondary);
}

/* Fear & Greed Gauge */
.gauge-container {
    width: 250px;
    height: 160px;
    margin: 0 auto 16px;
    position: relative;
}

.gauge-level {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.gauge-value {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Global Markets */
.markets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.market-section-label {
    grid-column: 1 / -1;
}

.market-item {
    text-align: center;
    padding: 5px 3px;
    border-radius: 6px;
    background: var(--bg-hover);
    transition: background 0.2s;
}

.market-item:hover {
    background: var(--bg-secondary);
}

.market-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.market-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.market-change {
    font-size: 0.7rem;
    font-weight: 600;
}

.market-change.up { color: var(--green); }
.market-change.down { color: var(--red); }

/* Economic Calendar */
.calendar-list {
    
}

.calendar-event {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.calendar-event:last-child {
    border-bottom: none;
}

.event-info {
    flex: 1;
}

.event-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.event-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.event-impact {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.event-impact.high { background: var(--red); color: white; }
.event-impact.medium { background: var(--orange); color: white; }
.event-impact.low { background: var(--yellow); color: black; }

/* Market Sentiment */
.sentiment-summary {
    text-align: center;
    margin-bottom: 16px;
}

.sentiment-mood {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.sentiment-stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.8rem;
}

.sentiment-stat {
    text-align: center;
}

.sentiment-stat .label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sentiment-stat .value {
    font-weight: 700;
    color: var(--text-primary);
}

.news-mini {
    
}

.news-mini-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

.news-mini-item:hover {
    color: var(--accent);
}

.news-title {
    font-size: 0.8rem;
    line-height: 1.3;
    margin-bottom: 2px;
}

.news-sentiment {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.news-sentiment.positive { background: var(--green); }
.news-sentiment.negative { background: var(--red); }
.news-sentiment.neutral { background: var(--yellow); }

/* Hot Topics */
.hot-topics-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.topic-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.topic-list {
    space-y: 6px;
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-hover);
    font-size: 0.8rem;
}

.topic-symbol {
    font-weight: 600;
    color: var(--text-primary);
}

.topic-change {
    font-weight: 600;
}

.topic-change.up { color: var(--green); }
.topic-change.down { color: var(--red); }

/* Sector Performance */
.sector-bars {
    space-y: 8px;
}

.sector-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.sector-name {
    min-width: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sector-chart {
    flex: 1;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 10px;
    margin: 0 8px;
    position: relative;
    overflow: hidden;
}

.sector-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.sector-fill.up { background: linear-gradient(to right, var(--green), #34d399); }
.sector-fill.down { background: linear-gradient(to right, var(--red), #f87171); }

.sector-value {
    min-width: 50px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 600;
}

.sector-value.up { color: var(--green); }
.sector-value.down { color: var(--red); }

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-secondary) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-text.long { width: 100%; }

/* Auto-refresh indicator */
.auto-refresh {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.refresh-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}

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

/* Enhanced gauge for fallback */
.gauge-simple {
    position: relative;
    width: 150px;
    height: 75px;
    margin: 0 auto;
}

.gauge-arc {
    width: 100%;
    height: 100%;
    border: 8px solid transparent;
    border-bottom-color: var(--border);
    border-left-color: var(--border);
    border-right-color: var(--border);
    border-radius: 75px 75px 0 0;
    position: relative;
}

.gauge-needle {
    position: absolute;
    top: 67px;
    left: 50%;
    transform-origin: 0 0;
    width: 2px;
    height: 60px;
    background: var(--accent);
    border-radius: 1px;
}

/* Card hover effects */
.dashboard-card {
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.5s;
}

.dashboard-card:hover::before {
    left: 100%;
}

/* Real-time News Feed */
.news-feed {
}

.news-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

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

.news-item:hover {
    background: var(--bg-hover);
    border-radius: 4px;
    padding-left: 8px;
}

.news-title {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.news-region {
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
}

.news-region.kr {
    background: #22c55e;
    color: white;
}

.news-region.us {
    background: #3b82f6;
    color: white;
}

/* Market Clock */
.market-clock {
    space-y: 8px;
}

.market-item-clock {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--bg-hover);
    margin-bottom: 6px;
}

.market-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.market-flag {
    font-size: 1.2rem;
}

.market-details {
    display: flex;
    flex-direction: column;
}

.market-name-clock {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.market-hours {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.market-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-open {
    background: var(--green);
    color: white;
}

.status-closed {
    background: var(--red);
    color: white;
}

.local-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Dark mode improvements */
.card-content {
    position: relative;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .hot-topics-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .markets-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    
    .gauge-container {
        width: 120px;
        height: 70px;
    }
    
    .gauge-value {
        font-size: 1.3rem;
    }
    
    .card-header h3 {
        font-size: 0.9rem;
    }
    
    .dashboard-card {
        padding: 12px;
    }
    
    .sector-name {
        min-width: 80px;
        font-size: 0.75rem;
    }
    
    .calendar-event {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }
    
    .search-container input {
        width: 100%;
    }
    
    .dashboard-grid {
        gap: 12px;
        padding: 0 10px;
    }
    
    .markets-grid {
        grid-template-columns: 1fr;
    }
    
    .market-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .gauge-container {
        width: 100px;
        height: 60px;
    }
    
    .gauge-value {
        font-size: 1.1rem;
    }
}

/* Header ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s;
}
.header h1 { font-size: 18px; white-space: nowrap; min-width: 180px; }
.header-left { display: flex; align-items: baseline; gap: 12px; }
.logo { font-size: 1.3rem; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.subtitle { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 6px; }
.search-container { display: flex; gap: 6px; }
.search-container input {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 14px; color: var(--text-primary); font-size: 0.9rem; width: 280px; outline: none;
    transition: border-color 0.2s;
}
.search-container input:focus { border-color: var(--accent); }
.btn {
    padding: 8px 18px; border: none; border-radius: var(--radius); font-size: 0.85rem;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-small { padding: 5px 12px; font-size: 0.78rem; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
/* 공통 네비게이션 */
.nav-bar { display: flex; gap: 6px; }
.nav-bar a { color: #8b95a5; text-decoration: none; padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: bold; background: #1a2035; transition: all 0.2s; }
.nav-bar a:hover { background: #2d3748; color: #fff; }
.nav-bar a.active { background: #3b82f6; color: #fff; }
.nav-bar .sep { color: #2d3748; line-height: 32px; }

.btn-sm { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 2px 8px; font-size: 0.75rem; border-radius: 4px; cursor: pointer; vertical-align: middle; }
.btn-sm:hover { background: var(--accent); color: white; border-color: var(--accent); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-active { border-color: var(--accent) !important; color: var(--accent) !important; }
.period-selector { display: flex; gap: 6px; }
.period-selector select {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 10px; color: var(--text-primary); font-size: 0.85rem; cursor: pointer; outline: none;
}

/* ===== Main Content ===== */
.main-content { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }

/* ===== Popular Stocks ===== */
.popular-section { margin-bottom: 24px; }
.popular-section h2 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 16px; }
.popular-grid { display: flex; flex-direction: column; gap: 16px; }
.popular-category { margin-bottom: 8px; }
.popular-category h3 { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.popular-items { display: flex; flex-wrap: wrap; gap: 8px; }
.popular-item {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 16px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 8px;
}
.popular-item:hover { background: var(--bg-hover); border-color: var(--accent); transform: translateY(-1px); }
.popular-item .item-name { font-weight: 600; font-size: 0.85rem; }
.popular-item .item-desc { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Loading ===== */
.loading-overlay { text-align: center; padding: 80px 20px; }
.spinner {
    width: 48px; height: 48px; border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { color: var(--text-secondary); font-size: 0.95rem; }

/* ===== Summary Bar ===== */
.summary-bar {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 16px;
}
.stock-title h2 { font-size: 1.4rem; font-weight: 700; }
.symbol-badge { display: inline-block; background: var(--bg-hover); padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; color: var(--text-secondary); margin-left: 8px; }
.sector-badge { display: inline-block; background: rgba(59,130,246,0.15); color: var(--accent); padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; margin-left: 4px; }
.price-display { display: flex; align-items: baseline; gap: 8px; }
.current-price { font-size: 1.8rem; font-weight: 700; }
.price-change { font-size: 1rem; font-weight: 600; }
.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }
.opinion-badge { padding: 8px 20px; border-radius: 20px; font-weight: 700; font-size: 0.95rem; text-align: center; min-width: 120px; }
.opinion-badge.strong-buy { background: var(--green); color: #000; }
.opinion-badge.buy { background: rgba(34,197,94,0.7); color: #fff; }
.opinion-badge.hold { background: var(--yellow); color: #000; }
.opinion-badge.sell { background: rgba(239,68,68,0.7); color: #fff; }
.opinion-badge.strong-sell { background: var(--red); color: #fff; }
.score-display { display: flex; gap: 16px; margin-left: auto; }
.score-item { text-align: center; }
.score-item label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.score-item span { font-size: 1.3rem; font-weight: 700; }

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
    padding-bottom: 0; overflow-x: auto;
}
.tab-btn {
    background: none; border: none; color: var(--text-secondary); padding: 12px 16px; font-size: 0.85rem;
    font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s; white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Charts ===== */
.chart-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.indicator-toggles { display: flex; gap: 16px; flex-wrap: wrap; }
.indicator-toggles label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; }
.indicator-toggles input[type="checkbox"] { accent-color: var(--accent); }
.chart-actions { display: flex; align-items: center; gap: 8px; }
.auto-refresh-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); cursor: pointer; }
.auto-refresh-toggle input[type="checkbox"] { accent-color: var(--accent); }
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.chart-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; }
.chart-container h3 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.chart-main { min-height: 400px; }
.chart-sub { min-height: 150px; max-height: 250px; height: 200px; }

/* ===== Analysis Cards ===== */
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color 0.2s; }
.card:hover { border-color: var(--accent); }
.card h3 { font-size: 0.95rem; color: var(--accent); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.analysis-content { font-size: 0.88rem; line-height: 1.8; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table tr { border-bottom: 1px solid var(--border); }
.data-table tr:last-child { border-bottom: none; }
.data-table td { padding: 6px 0; }
.data-table td:first-child { color: var(--text-secondary); font-size: 0.82rem; width: 45%; }
.data-table td:last-child { text-align: right; font-weight: 600; }

/* Signal items */
.signal-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; margin-bottom: 6px; border-radius: 6px; font-size: 0.85rem; }
.signal-buy { background: var(--green-bg); border-left: 3px solid var(--green); }
.signal-sell { background: var(--red-bg); border-left: 3px solid var(--red); }
.signal-neutral { background: var(--yellow-bg); border-left: 3px solid var(--yellow); }
.signal-tag { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.tag-buy { background: var(--green); color: #000; }
.tag-sell { background: var(--red); color: #fff; }
.tag-neutral { background: var(--yellow); color: #000; }

/* ===== Report ===== */
.report-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; max-width: 900px; margin: 0 auto; }
.report-header { text-align: center; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 2px solid var(--accent); }
.report-header h2 { font-size: 1.6rem; margin-bottom: 8px; }
.report-header .report-date { color: var(--text-muted); font-size: 0.85rem; }
.report-section { margin-bottom: 28px; }
.report-section h3 { font-size: 1.1rem; color: var(--accent); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.report-section h4 { font-size: 0.95rem; color: var(--text-primary); margin: 16px 0 8px; }
.report-section p, .report-section li { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.8; }
.report-section ul { list-style: none; padding: 0; }
.report-section li { padding: 4px 0 4px 18px; position: relative; }
.report-section li::before { content: '>'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.report-opinion-box { text-align: center; padding: 24px; border-radius: var(--radius); margin: 16px 0; }
.report-opinion-box.strong-buy { background: var(--green-bg); border: 2px solid var(--green); }
.report-opinion-box.buy { background: var(--green-bg); border: 2px solid rgba(34,197,94,0.5); }
.report-opinion-box.hold { background: var(--yellow-bg); border: 2px solid var(--yellow); }
.report-opinion-box.sell { background: var(--red-bg); border: 2px solid rgba(239,68,68,0.5); }
.report-opinion-box.strong-sell { background: var(--red-bg); border: 2px solid var(--red); }
.report-opinion-box .opinion-text { font-size: 1.4rem; font-weight: 700; }
.report-disclaimer { background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.3); border-radius: var(--radius); padding: 16px; margin-top: 32px; }
.report-disclaimer p { color: var(--yellow) !important; font-size: 0.82rem !important; }

/* ===== Compare ===== */
.compare-input { display: flex; gap: 8px; margin-bottom: 20px; }
.compare-input input { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; color: var(--text-primary); font-size: 0.9rem; outline: none; }
.compare-input input:focus { border-color: var(--accent); }
.compare-results { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; }
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.compare-table th { background: var(--bg-hover); color: var(--text-secondary); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.compare-table td { font-size: 0.88rem; }
.compare-table tr:hover td { background: var(--bg-hover); }

/* Risk & Strategy */
.risk-item { padding: 8px 12px; margin-bottom: 6px; border-radius: 6px; background: var(--red-bg); border-left: 3px solid var(--red); font-size: 0.85rem; color: var(--text-secondary); }
.strategy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.strategy-item { padding: 12px; background: var(--bg-hover); border-radius: 6px; }
.strategy-item label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.strategy-item span { font-size: 0.9rem; font-weight: 600; }

/* ===== Gauge ===== */
.gauge-container { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.gauge-bar { flex: 1; height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.gauge-label { font-size: 0.85rem; font-weight: 600; min-width: 45px; text-align: right; }

/* ===== Watchlist ===== */
.watchlist-section { margin-bottom: 20px; }
.watchlist-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.watchlist-header h2 { font-size: 1rem; color: var(--text-secondary); }
.watchlist-items { display: flex; flex-wrap: wrap; gap: 8px; }
.watchlist-item { background: var(--bg-card); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 14px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 10px; }
.watchlist-item:hover { background: var(--bg-hover); transform: translateY(-1px); }
.watchlist-item-info { display: flex; align-items: center; gap: 8px; }
.watchlist-name { font-weight: 600; font-size: 0.85rem; }
.watchlist-symbol { font-size: 0.72rem; color: var(--text-muted); }
.watchlist-remove { background: none; border: none; color: var(--text-muted); font-size: 0.85rem; cursor: pointer; padding: 0 4px; line-height: 1; }
.watchlist-remove:hover { color: var(--red); }

/* ===== Alerts ===== */
.alerts-section { margin-bottom: 20px; }
.alerts-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.alerts-header h2 { font-size: 1rem; color: var(--text-secondary); }
.alert-form { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.alert-input { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; color: var(--text-primary); font-size: 0.85rem; outline: none; width: 120px; }
.alerts-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; }
.alert-item .alert-info { display: flex; gap: 12px; align-items: center; }
.alert-item .alert-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; }
.alert-item .alert-del:hover { color: var(--red); }
.alert-triggered { border-color: var(--green) !important; background: var(--green-bg) !important; }

/* ===== News ===== */
.news-container { display: flex; flex-direction: column; gap: 12px; }
.news-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: border-color 0.2s; }
.news-item:hover { border-color: var(--accent); }
.news-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.news-title { font-weight: 600; font-size: 0.92rem; line-height: 1.4; }
.news-sentiment { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.news-sentiment.positive { background: var(--green-bg); color: var(--green); }
.news-sentiment.negative { background: var(--red-bg); color: var(--red); }
.news-sentiment.neutral { background: var(--yellow-bg); color: var(--yellow); }
.news-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ===== Backtest ===== */
.backtest-controls { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.backtest-input { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; color: var(--text-primary); font-size: 0.85rem; outline: none; }
.backtest-results { }
.backtest-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.backtest-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.backtest-stat .stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.backtest-stat .stat-value { font-size: 1.4rem; font-weight: 700; }
.backtest-chart { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-height: 300px; margin-bottom: 16px; }
.backtest-trades { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-height: 300px; overflow-y: auto; }
.trade-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.trade-buy { color: var(--green); }
.trade-sell { color: var(--red); }

/* ===== Portfolio ===== */
.portfolio-controls { margin-bottom: 20px; }
.portfolio-controls h3 { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 10px; }
.portfolio-form { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-input { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; color: var(--text-primary); font-size: 0.85rem; outline: none; width: 130px; }
.portfolio-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pf-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.pf-stat .pf-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.pf-stat .pf-value { font-size: 1.3rem; font-weight: 700; margin-top: 4px; }
.portfolio-table-wrap { overflow-x: auto; }

/* ===== Heatmap ===== */
.heatmap-container { }
.heatmap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.heatmap-sector { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.heatmap-sector-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.heatmap-sector-name { font-weight: 700; font-size: 0.95rem; }
.heatmap-sector-change { font-weight: 700; font-size: 0.9rem; }
.heatmap-stocks { display: flex; flex-direction: column; gap: 6px; }
.heatmap-stock { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 6px; font-size: 0.82rem; }
.heatmap-stock.positive { background: var(--green-bg); }
.heatmap-stock.negative { background: var(--red-bg); }
.heatmap-stock.neutral { background: var(--bg-hover); }
.heatmap-stock-name { font-weight: 600; }
.heatmap-stock-change { font-weight: 700; }

/* ===== Error Display ===== */
.error-display { text-align: center; padding: 60px 20px; }
.error-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--red-bg); border: 2px solid var(--red); color: var(--red); font-size: 1.6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.error-display p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 20px; }

/* ===== Footer ===== */
.footer { text-align: center; padding: 24px; border-top: 1px solid var(--border); margin-top: 40px; }
.disclaimer { font-size: 0.78rem; color: var(--text-muted); max-width: 700px; margin: 0 auto 8px; }
.copyright { font-size: 0.72rem; color: var(--text-muted); }

/* ===== Utility ===== */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-muted { color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
    .header h1 { min-width: auto; font-size: 16px; flex: 1; }
    .header .nav-bar { order: 10; width: 100%; flex-wrap: wrap; gap: 4px; }
    .header .nav-bar a { padding: 5px 10px; font-size: 11px; }
    .header .nav-bar .sep { display: none; }
    .search-container input { width: 160px; }
    .main-content { padding: 12px; }
    .summary-bar { flex-direction: column; align-items: flex-start; }
    .score-display { margin-left: 0; }
    .analysis-grid { grid-template-columns: 1fr; }
    .strategy-grid { grid-template-columns: 1fr; }
    .report-container { padding: 16px; }
    .tab-btn { padding: 10px 12px; font-size: 0.78rem; }
    .backtest-controls { flex-direction: column; }
    .portfolio-form { flex-direction: column; }
    .pf-input { width: 100%; }
}
