:root {
    --bg: #ffffff;
    --panel: #f6f7f9;
    --border: #e1e4ea;
    --text: #2b3240;
    --text-bright: #10131a;
    --muted: #6b7688;
    --accent: #2563eb;
    --accent-bright: #1d4ed8;
    --green: #15803d;
    --green-bg: #e9f9ef;
    --green-border: #b7ebc6;
    --red: #b91c1c;
    --red-bg: #fdecec;
    --red-border: #f3bcbc;
}

* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0 1.5rem 3rem;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.header {
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}
.header h1 { font-size: 1.8rem; font-weight: 800; color: var(--text-bright); letter-spacing: -0.01em; margin: 0; }
.header .sub { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; margin-top: 0.3rem; }

.lang-toggle a {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--muted);
    margin-left: 4px;
}
.lang-toggle a.active { border-color: var(--accent); color: var(--accent-bright); background: #eaf1ff; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem 1.4rem;
    margin-bottom: 1.5rem;
}

.pulse-banner { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.pulse-badge { font-size: 1.1rem; font-weight: 700; padding: 6px 14px; border-radius: 8px; letter-spacing: 0.01em; }
.pulse-badge.bullish { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.pulse-badge.bearish { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.pulse-badge.neutral { background: #eaf1ff; color: var(--accent-bright); border: 1px solid #bcd2fb; }
.pulse-metrics { display: flex; gap: 1.8rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }
.pulse-metrics b { color: var(--text-bright); font-size: 0.95rem; }
.pulse-desc { font-size: 0.8rem; color: var(--muted); margin-top: 0.6rem; line-height: 1.5; }

h2, h3, h4 { font-weight: 700; color: var(--text-bright); letter-spacing: -0.005em; }
h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 0.8rem; color: var(--muted); }

.controls { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.controls input, .controls select {
    background: #fff; border: 1px solid var(--border); color: var(--text);
    font-family: inherit; font-size: 0.85rem; border-radius: 6px; padding: 8px 10px;
}
.controls input { flex: 1; min-width: 220px; }
.controls input:focus, .controls select:focus { outline: none; border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
thead th {
    text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer;
    white-space: nowrap;
}
tbody td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:hover { background: #eef2f8; }
.sym { font-weight: 700; color: var(--text-bright); }
.name { color: var(--muted); font-size: 0.75rem; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral { color: var(--muted); }
.badge { font-size: 0.68rem; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); }
.badge.high { color: var(--green); border-color: var(--green-border); background: var(--green-bg); }
.badge.low { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
.badge.bullish { color: var(--green); border-color: var(--green-border); background: var(--green-bg); }
.badge.bearish { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
.badge.neutral { color: var(--muted); }

.th-info {
    cursor: pointer; color: var(--muted); font-size: 0.68rem; margin-left: 2px;
    text-transform: none; letter-spacing: normal;
}
.th-info:hover { color: var(--accent-bright); }
.col-popover {
    position: absolute; top: 100%; left: 0; z-index: 30; width: 240px; margin-top: 4px;
    background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
    font-size: 0.72rem; font-weight: 400; text-transform: none; letter-spacing: normal;
    color: var(--text); box-shadow: 0 6px 18px rgba(20,25,35,0.14); white-space: normal; line-height: 1.45;
    cursor: default;
}

.count-line { font-size: 0.72rem; color: var(--muted); margin: 0.6rem 0 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1.2rem; }
.stat-tile { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 1.1rem; }
.stat-tile:hover { border-color: var(--accent); }
.stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: var(--text-bright); }
.stat-explain { font-size: 0.72rem; color: var(--muted); margin-top: 6px; line-height: 1.4; }

.chart-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 1.5rem; }
.period-tabs { display: flex; gap: 6px; margin-bottom: 0.8rem; }
.period-tabs a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.75rem; color: var(--muted); }
.period-tabs a.active { border-color: var(--accent); color: var(--accent-bright); background: #eaf1ff; }

.signal-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.83rem; }
.signal-line:last-child { border-bottom: none; }
.signal-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.signal-dot.positive { background: var(--green); }
.signal-dot.negative { background: var(--red); }
.signal-dot.neutral { background: var(--muted); }

.alert { background: var(--panel); border-left: 3px solid var(--accent); font-size: 0.83rem; padding: 0.9rem 1.1rem; border-radius: 6px; line-height: 1.6; margin-bottom: 1.5rem; }
.disclaimer { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 2rem; line-height: 1.6; }

.back-link { font-size: 0.78rem; margin-bottom: 1rem; display: inline-block; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.toolbar-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.ind-check { font-size: 0.75rem; color: var(--text); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; white-space: nowrap; }
.ind-check input { accent-color: var(--accent); }

.tool-btn {
    font-family: inherit; font-size: 0.75rem; padding: 5px 12px;
    border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer;
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent-bright); }
.tool-btn.active { border-color: var(--accent); color: var(--accent-bright); background: #eaf1ff; }

.hint { font-size: 0.7rem; color: var(--accent-bright); }
.alert-row input[type="number"] {
    background: #fff; border: 1px solid var(--border); color: var(--text);
    font-family: inherit; font-size: 0.8rem; border-radius: 6px; padding: 6px 8px;
}

.chip {
    display: inline-block; font-size: 0.72rem; padding: 3px 10px; border-radius: 12px;
    border: 1px solid var(--border); color: var(--accent-bright); background: #eaf1ff;
}
.chip:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

#mainChart, #rsiChart, #macdChart, #compareChart { width: 100%; margin-bottom: 4px; }

.site-nav { display: flex; gap: 1.4rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border); margin-bottom: 0.5rem; }
.site-nav-link { font-size: 0.85rem; font-weight: 600; color: var(--muted); padding: 4px 2px; border-bottom: 2px solid transparent; }
.site-nav-link:hover { text-decoration: none; color: var(--accent-bright); }
.site-nav-link.active { color: var(--text-bright); border-bottom-color: var(--accent); }

.main-tabs { display: flex; gap: 6px; margin-bottom: 1.2rem; }
.main-tab {
    font-size: 0.85rem; font-weight: 600; padding: 8px 18px; border-radius: 8px;
    border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer; text-decoration: none;
    display: inline-block;
}
.main-tab:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-bright); }
.main-tab.active { border-color: var(--accent); color: var(--accent-bright); background: #eaf1ff; }

.view-tabs { display: flex; gap: 6px; margin-bottom: 1.2rem; }
.view-tab {
    font-size: 0.8rem; font-weight: 600; padding: 8px 16px; border-radius: 8px;
    border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer;
}
.view-tab.active { border-color: var(--accent); color: var(--accent-bright); background: #eaf1ff; }

.cause-text { font-size: 0.78rem; color: var(--text); white-space: normal; max-width: 320px; }
.cause-none { font-size: 0.78rem; color: var(--muted); font-style: italic; }
.cause-publisher { font-size: 0.68rem; color: var(--muted); }

.movers-watch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.sym.sym-overlap { color: var(--accent-bright); font-weight: 800; }

@media (max-width: 1000px) {
    .movers-watch-grid { grid-template-columns: 1fr; }
}

.fav-star {
    background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--border);
    padding: 0; line-height: 1;
}
.fav-star.active { color: #f59e0b; }
.fav-star:hover { color: #f59e0b; }

.tv-layout { display: flex; gap: 1rem; align-items: flex-start; }
.tv-main { flex: 1; min-width: 0; }
.tv-sidebar { width: 340px; flex-shrink: 0; }
.sidebar-panel { position: sticky; top: 1rem; margin-bottom: 0; }
.sidebar-panel input[type="text"] {
    width: 100%; background: #fff; border: 1px solid var(--border); color: var(--text);
    font-family: inherit; font-size: 0.82rem; border-radius: 6px; padding: 8px 10px;
}

.watch-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; }
.watch-list-tall { max-height: 520px; }
.watch-row { display: flex; align-items: center; gap: 6px; padding: 4px 2px; border-radius: 6px; }
.watch-row:hover { background: #eef2f8; }
.watch-link { display: flex; align-items: center; flex: 1; gap: 6px; min-width: 0; }
.watch-link:hover { text-decoration: none; }
.watch-sym { font-size: 0.78rem; font-weight: 700; color: var(--text-bright); width: 52px; flex-shrink: 0; }
.watch-price { font-size: 0.75rem; color: var(--text); flex: 1; text-align: right; }
.watch-chg { font-size: 0.72rem; width: 64px; text-align: right; flex-shrink: 0; }
.watch-empty { font-size: 0.72rem; color: var(--muted); padding: 0.4rem 0; }
.watch-list-header {
    display: flex; align-items: center; gap: 6px; padding: 0 2px 6px;
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.watch-list-header .wh-star { width: 16px; flex-shrink: 0; }
.watch-list-header .wh-sym { width: 52px; flex-shrink: 0; }
.watch-list-header .wh-price { flex: 1; text-align: right; }
.watch-list-header .wh-chg { width: 64px; text-align: right; }

.snapshot-card { padding: 1.4rem 1.6rem; }
.snapshot-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; }
.snapshot-badge {
    width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 0.85rem; flex-shrink: 0;
}
.snapshot-badge.up { background: var(--green); }
.snapshot-badge.down { background: var(--red); }
.snapshot-title { font-size: 1.15rem; font-weight: 700; color: var(--text-bright); }
.snapshot-ticker {
    font-size: 0.68rem; color: var(--muted); background: var(--panel); border: 1px solid var(--border);
    border-radius: 6px; padding: 1px 7px; margin-left: 6px; vertical-align: middle;
}
.snapshot-price { font-size: 2.4rem; font-weight: 800; color: var(--text-bright); line-height: 1.1; }
.snapshot-point { font-size: 0.6rem; color: var(--muted); font-weight: 600; margin-left: 4px; }
.snapshot-change { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
#snapshotChart { width: 100%; }

@media (max-width: 900px) {
    .tv-layout { flex-direction: column; }
    .tv-sidebar { width: 100%; }
    .sidebar-panel { position: static; }
}
