/* --- Global CSS Reset & Tokens --- */
:root {
    --bg-app: #080a10;
    --bg-panel: #0f131e;
    --bg-panel-header: #141a29;
    --bg-card: #182033;
    --bg-card-hover: #1f2a42;
    --border-color: #1f293d;
    --border-glow: rgba(41, 98, 255, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #2962ff;
    --accent-glow: rgba(41, 98, 255, 0.4);
    --accent-hover: #1557ff;
    
    --up-color: #26a69a;
    --up-bg: rgba(38, 166, 154, 0.1);
    --up-blink: rgba(38, 166, 154, 0.35);
    
    --down-color: #ef5350;
    --down-bg: rgba(239, 83, 80, 0.1);
    --down-blink: rgba(239, 83, 80, 0.35);
    
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', source-code-pro, Menlo, Monaco, Consolas, monospace;
    
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* --- Layout Structure --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* --- Header --- */
.dashboard-header {
    background: linear-gradient(90deg, var(--bg-panel) 0%, #121824 100%);
    border-bottom: 1px solid var(--border-color);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

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

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- 차트/뉴스 높이 조절 리사이저 (우측 컬럼) --- */
.v-resizer {
    flex-shrink: 0;
    height: 10px;
    margin: -7px 0;          /* 위아래 gap을 잠식해 군더더기 공백 최소화 */
    cursor: row-resize;
    position: relative;
    z-index: 6;
}
.v-resizer::before {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 4px;
    border-radius: 3px;
    background: var(--border-color);
    transition: background var(--transition-fast), width var(--transition-fast);
}
.v-resizer:hover::before,
.v-resizer.dragging::before {
    background: var(--accent);
    width: 72px;
}

/* --- 종목 검색 (대시보드 좌측 패널) --- */
.stock-search {
    position: relative;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}
.stock-search .search-ico {
    width: 16px; height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}
#stock-search-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
}
#stock-search-input::placeholder { color: var(--text-muted); }
.search-clear {
    background: none; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.search-clear:hover { color: var(--text-primary); }
.search-results {
    position: absolute;
    top: 100%; left: 8px; right: 8px;
    background-color: var(--bg-panel-header);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    z-index: 50;
    max-height: 340px;
    overflow-y: auto;
    padding: 4px;
}
.search-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
}
.search-item:hover, .search-item.kbd-active { background-color: var(--bg-card-hover); }
.search-item .si-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.search-item .si-code { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-left: 6px; }
.search-item .si-market { font-size: 10.5px; color: var(--text-secondary); border: 1px solid var(--border-color); border-radius: 4px; padding: 1px 6px; }
.search-empty { padding: 14px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* --- 텔레그램 매칭 분류 필터 칩 --- */
.news-filter {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.nf-chip {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.nf-chip:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.nf-chip.active { background-color: var(--accent); color: #fff; border-color: var(--accent); }

/* --- 페이지 네비게이션 (대시보드/메인/채팅 공통) --- */
.main-nav { display: flex; gap: 6px; }
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.nav-link:hover { color: var(--text-primary); background-color: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--text-primary); background-color: var(--accent); }

.header-logo h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: linear-gradient(120deg, #ffffff 40%, #cbd5e1 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pulse-icon {
    width: 10px;
    height: 10px;
    background-color: var(--accent);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px var(--accent);
}

.pulse-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--accent);
    border-radius: 50%;
    animation: ripple 2s infinite ease-in-out;
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

.market-tickers {
    display: flex;
    gap: 16px;
}

.ticker-card {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.ticker-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.ticker-value {
    font-family: var(--font-mono);
    font-weight: 500;
}

.ticker-change.up { color: var(--up-color); }
.ticker-change.down { color: var(--down-color); }

.header-status {
    display: flex;
    align-items: center;
    gap: 20px;
}

.time-display {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 15px;
    letter-spacing: 0.5px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.connection-status.connected .status-dot {
    background-color: var(--up-color);
    box-shadow: 0 0 8px var(--up-color);
}

.connection-status.disconnected .status-dot {
    background-color: var(--down-color);
    box-shadow: 0 0 8px var(--down-color);
}

/* --- Main Layout Grid --- */
.dashboard-main {
    flex-grow: 1;
    display: flex;
    padding: 16px;
    gap: 16px;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.panel-header {
    background-color: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title-area h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Icons --- */
.icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.icon-sm {
    width: 16px;
    height: 16px;
}

/* --- Left Panel: Stock Table --- */
.left-panel {
    width: 380px;
    flex-shrink: 0;
}

.list-container {
    flex-grow: 1;
    overflow-y: auto;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.stock-table th, .stock-table td {
    padding: 8px 6px;
    font-size: 12.5px;
    border-bottom: 1px solid #141b29;
}

.stock-table th {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    background-color: var(--bg-panel);
    z-index: 1;
    border-bottom: 2px solid var(--border-color);
}

.stock-table tbody tr {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.stock-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.stock-table tbody tr.active {
    background-color: rgba(41, 98, 255, 0.08);
    border-left: 3px solid var(--accent);
}

.col-rank {
    width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
}

.col-name {
    max-width: 120px;
}

.stock-name-cell {
    display: flex;
    flex-direction: column;
}

.stock-fullname {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-code-lbl {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.font-mono {
    font-family: var(--font-mono);
}

.text-right {
    text-align: right;
}

/* Price blink animations */
.blink-up {
    animation: blink-green-anim 0.8s ease-out;
}

.blink-down {
    animation: blink-red-anim 0.8s ease-out;
}

@keyframes blink-green-anim {
    0% { background-color: var(--up-blink); }
    100% { background-color: transparent; }
}

@keyframes blink-red-anim {
    0% { background-color: var(--down-blink); }
    100% { background-color: transparent; }
}

/* Color states */
.txt-up { color: var(--up-color); }
.txt-down { color: var(--down-color); }
.txt-flat { color: var(--text-secondary); }

/* --- Right Column & Panels --- */
.right-column {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

/* --- Chart Panel --- */
.chart-panel {
    flex: 3 1 0; /* 60% of right side — basis:0 so the ratio holds regardless of content */
    min-height: 0;
    position: relative;
}

.chart-header-details {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.selected-stock-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.stock-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-badge {
    background-color: var(--border-color);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    padding: 2px 5px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.selected-stock-info h2 {
    font-size: 16px;
    font-weight: 700;
}

.stock-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    border-left: 1px solid var(--border-color);
    padding-left: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 10.5px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 13.5px;
    font-weight: 600;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeframe-group {
    display: flex;
    gap: 2px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 2px;
}

.timeframe-badge {
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.timeframe-badge:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.timeframe-badge.active {
    background-color: var(--accent);
    color: white;
}

.btn-refresh {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-refresh:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.02);
}

.chart-container-wrapper {
    flex-grow: 1;
    min-height: 0;
    position: relative;
    width: 100%;
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
}

.chart-view {
    flex-grow: 1;
    min-height: 0;
    width: 100%;
    z-index: 1;
}

.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 19, 30, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    transition: opacity var(--transition-normal);
}

.chart-loading.hidden {
    display: none !important;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(41, 98, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

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

/* --- Telegram News Panel --- */
.news-panel {
    flex: 2 1 0; /* 40% of right side — basis:0 so news content can't squeeze the chart */
    min-height: 0;
}

.news-header {
    border-bottom: 1px solid var(--border-color);
}

.badge {
    background-color: rgba(41, 98, 255, 0.1);
    border: 1px solid rgba(41, 98, 255, 0.2);
    color: var(--accent);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.timeline-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-fast);
    animation: slide-in 0.3s ease-out;
}

.news-card:hover {
    border-color: rgba(41, 98, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.04);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.news-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* 매칭 분류 배지: 직접언급 / 관련·테마 / 관련·유사 */
.news-class-badge {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.news-class-badge.cls-direct {
    color: var(--accent);
    background: rgba(41, 98, 255, 0.12);
    border-color: rgba(41, 98, 255, 0.35);
}
.news-class-badge.cls-theme {
    color: var(--up-color);
    background: rgba(38, 166, 154, 0.12);
    border-color: rgba(38, 166, 154, 0.35);
}
.news-class-badge.cls-semantic {
    color: #b07cff;
    background: rgba(176, 124, 255, 0.12);
    border-color: rgba(176, 124, 255, 0.35);
}

.news-source-tag {
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-source-tag::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
}

.news-time {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.news-content {
    font-size: 13.5px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.news-content a {
    color: var(--accent);
    text-decoration: none;
}

.news-content a:hover {
    text-decoration: underline;
}

.news-content mark {
    background-color: rgba(41, 98, 255, 0.25);
    color: #ffffff;
    border-bottom: 2px solid var(--accent);
    padding: 0 2px;
    border-radius: 2px;
}

.news-footer {
    display: flex;
    justify-content: flex-end;
    font-size: 11px;
    color: var(--text-muted);
}

.relevance-score {
    display: flex;
    align-items: center;
    gap: 4px;
}

.relevance-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--up-color);
}

/* Empty states */
.empty-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
    padding: 32px 0;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--border-color);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Skeleton loader for tables */
.skeleton-row td {
    color: var(--text-muted);
    text-align: center;
    padding: 32px 0;
    font-style: italic;
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
    .selected-stock-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .stock-stats-row {
        border-left: none;
        padding-left: 0;
        gap: 12px;
    }
    .chart-header-details {
        padding: 8px 12px;
    }
}

/* --- AI 심층분석 버튼 + 리포트 모달 --- */
.btn-report {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, var(--accent), #1557ff);
    color: #fff; border: none; border-radius: var(--border-radius-sm);
    font-size: 12px; font-weight: 600; padding: 6px 12px; cursor: pointer;
    transition: all var(--transition-fast); white-space: nowrap;
}
.btn-report:hover { filter: brightness(1.12); box-shadow: 0 0 14px var(--accent-glow); }
.btn-report-sec { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-report-sec:hover { color: var(--text-primary); border-color: var(--accent); background: rgba(41,98,255,0.08); box-shadow: none; filter: none; }
.btn-report:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-report .icon-sm { width: 14px; height: 14px; }

.report-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.report-modal[hidden] { display: none; }
.report-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
.report-dialog {
    position: relative; width: min(720px, 92vw); max-height: 88vh;
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow: hidden;
}
.report-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-color); background: var(--bg-panel-header); }
.report-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.report-title .icon-sm { width: 16px; height: 16px; color: var(--accent); }
.report-stock { color: var(--accent); }
.report-close { background: none; border: none; color: var(--text-muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.report-close:hover { color: var(--text-primary); }
.report-scroll { flex-grow: 1; overflow-y: auto; padding: 18px 20px; min-height: 180px; }
.report-foot { padding: 10px 18px; border-top: 1px solid var(--border-color); font-size: 11px; color: var(--text-muted); text-align: center; }

/* 작성중 로더 (동적 애니메이션) */
.report-loader { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 34px 0; }
.report-loader[hidden] { display: none; }
.report-spinner { width: 38px; height: 38px; border: 3px solid rgba(41,98,255,0.15); border-top-color: var(--accent); border-radius: 50%; animation: rspin 0.8s linear infinite; }
@keyframes rspin { to { transform: rotate(360deg); } }
.report-status-text { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.rdots i { font-style: normal; animation: rblink 1.4s infinite both; opacity: 0.2; }
.rdots i:nth-child(2) { animation-delay: 0.2s; }
.rdots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes rblink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.report-progress { width: 220px; height: 3px; background: var(--border-color); border-radius: 2px; overflow: hidden; }
.report-progress-bar { width: 35%; height: 100%; background: var(--accent); border-radius: 2px; animation: rprog 1.3s ease-in-out infinite; }
@keyframes rprog { 0% { transform: translateX(-130%); } 100% { transform: translateX(360%); } }
.report-reasoning { max-width: 520px; max-height: 84px; overflow: hidden; font-size: 12px; color: var(--text-muted); line-height: 1.6; text-align: center; opacity: 0.75; padding: 0 10px; }
.report-reasoning[hidden] { display: none; }

/* 리포트 마크다운 */
.report-content { font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.report-content h2 { font-size: 16px; color: var(--text-primary); margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border-color); }
.report-content h2:first-child { margin-top: 0; }
.report-content h3 { font-size: 14px; color: var(--text-primary); margin: 12px 0 6px; }
.report-content ul, .report-content ol { margin: 6px 0 10px; padding-left: 20px; }
.report-content li { margin: 3px 0; }
.report-content p { margin: 6px 0; }
.report-content strong { color: var(--text-primary); font-weight: 600; }
.report-content table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.report-content th, .report-content td { border: 1px solid var(--border-color); padding: 6px 10px; text-align: left; }
.report-content th { background: var(--bg-panel-header); }
.report-content .scursor { display: inline-block; width: 7px; height: 14px; background: var(--accent); animation: rblink 1s infinite; vertical-align: text-bottom; margin-left: 1px; }

/* ④ 타임라인 기간 선택 팝오버 */
.tl-wrap { position: relative; display: inline-flex; }
.tl-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
    display: flex; flex-direction: column; min-width: 124px; padding: 5px;
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md); box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.tl-menu[hidden] { display: none; }
.tl-menu button {
    text-align: left; padding: 7px 10px; cursor: pointer; font-size: 12.5px;
    background: none; border: none; border-radius: var(--border-radius-sm);
    color: var(--text-secondary); transition: background 0.12s, color 0.12s;
}
.tl-menu button:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ② AI 종목 발굴 */
.btn-discovery {
    display: flex; align-items: center; gap: 8px; width: 100%;
    margin: 8px 0 4px; padding: 9px 12px; cursor: pointer;
    background: linear-gradient(90deg, rgba(41,98,255,0.16), rgba(41,98,255,0.05));
    border: 1px solid rgba(41,98,255,0.35); border-radius: var(--border-radius-md);
    color: var(--text-primary); font-size: 13px; font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}
.btn-discovery:hover { border-color: var(--accent); background: linear-gradient(90deg, rgba(41,98,255,0.26), rgba(41,98,255,0.1)); }
.btn-discovery .disc-ico { font-size: 15px; }
.btn-discovery .disc-hint { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--text-muted); }

.disc-dialog { width: min(640px, 94vw); }
.disc-query-row { display: flex; gap: 8px; padding: 16px 18px 8px; }
#discovery-input {
    flex: 1; padding: 10px 12px; font-size: 14px;
    background: var(--bg-panel-header); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md); color: var(--text-primary); outline: none;
}
#discovery-input:focus { border-color: var(--accent); }
#discovery-input::placeholder { color: var(--text-muted); }
#discovery-run { white-space: nowrap; }
.disc-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 18px 8px; font-size: 11.5px; color: var(--text-muted); }
.disc-examples button {
    padding: 3px 9px; cursor: pointer; font-size: 11.5px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 20px; color: var(--text-secondary); transition: all 0.15s;
}
.disc-examples button:hover { color: var(--text-primary); border-color: var(--accent); }

.disc-results { display: flex; flex-direction: column; gap: 7px; }
.disc-head-line { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.disc-head-line strong { color: var(--accent); }
.disc-empty { padding: 28px 10px; text-align: center; color: var(--text-muted); font-size: 13px; }
.disc-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md); transition: border-color 0.15s, background 0.15s;
}
.disc-row:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.disc-rank { flex: 0 0 22px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-muted); font-family: var(--font-mono); }
.disc-main { flex: 1; min-width: 0; }
.disc-name-row { display: flex; align-items: baseline; gap: 7px; }
.disc-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.disc-code { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.disc-mkt { font-size: 10px; color: var(--text-secondary); border: 1px solid var(--border-color); border-radius: 3px; padding: 0 5px; }
.disc-ev { margin-top: 3px; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disc-ev-meta { color: var(--text-secondary); }
.disc-metrics { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.disc-count { font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono); }
.disc-sim { font-size: 12px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
