:root {
    --bg: #0a0e17;
    --bg-card: #111827;
    --bg-card-hover: #1a2332;
    --border: #1e293b;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --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: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px var(--red));
}

.nav-brand h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    border-left: 1px solid var(--border);
    padding-left: 12px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--green-bg);
    border: 1px solid var(--green);
    font-size: 12px;
    font-weight: 500;
}

.status-badge.offline {
    background: var(--red-bg);
    border-color: var(--red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

.status-badge.offline .status-dot {
    background: var(--red);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.alert-bell {
    position: relative;
    cursor: pointer;
    font-size: 22px;
    padding: 4px;
}

.alert-count {
    position: absolute;
    top: -4px;
    right: -8px;
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-xs.active { background: var(--accent); border-color: var(--accent); }

.btn-outline {
    background: transparent;
    border-color: var(--border);
}
.btn-outline:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.06));
    border-color: var(--text-muted);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: #ef4444;
    color: #fff;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

button.stat-card {
    font: inherit;
    color: inherit;
    width: 100%;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button.stat-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

#section-targets,
#section-alternatives,
#section-political,
#section-top-performers,
#section-alerts {
    scroll-margin-top: 96px;
}

.top-perf-updated {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.top-performers-body {
    max-height: none;
}

.top-perf-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 280px;
    margin-bottom: 16px;
}

.top-perf-table-wrap {
    overflow-x: auto;
}

.top-perf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.top-perf-table th,
.top-perf-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.top-perf-table th {
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.top-perf-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.top-perf-table .up {
    color: var(--green);
}

.top-perf-table .down {
    color: var(--red);
}

.top-perf-monitored {
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-dim);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-badge {
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-body {
    padding: 16px 20px;
    max-height: 500px;
    overflow-y: auto;
}

.card-body::-webkit-scrollbar {
    width: 6px;
}

.card-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.full-width { grid-column: 1 / -1; }

/* Grid */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Company Items */
.company-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.company-item:last-child { border-bottom: none; }

.company-item:hover { background: var(--bg-card-hover); margin: 0 -20px; padding: 14px 20px; }

.company-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.company-info {
    flex: 1;
}

.company-ticker {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.company-name {
    font-size: 13px;
    color: var(--text-dim);
}

.company-sector {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 4px;
}

.company-price {
    text-align: right;
}

.price-current {
    font-size: 18px;
    font-weight: 600;
}

.price-change {
    font-size: 14px;
    font-weight: 600;
}

.price-change.up { color: var(--green); }
.price-change.down { color: var(--red); }
.price-change.neutral { color: var(--text-muted); }

.company-reason {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.05);
    border-left: 3px solid var(--red);
    border-radius: 0 4px 4px 0;
}

.company-rationale {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(34, 197, 94, 0.05);
    border-left: 3px solid var(--green);
    border-radius: 0 4px 4px 0;
}

.confidence-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Alternatives nested */
.alt-list {
    margin-top: 10px;
    padding-left: 16px;
    border-left: 2px solid var(--green);
}

.alt-item {
    padding: 8px 0;
    font-size: 13px;
}

.alt-tag {
    font-size: 10px;
    color: var(--green);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Alerts */
.alert-item {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 4px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.15s;
    cursor: pointer;
}

.alert-item:hover { background: rgba(255, 255, 255, 0.05); }

.alert-item.unread { background: rgba(59, 130, 246, 0.05); }

.alert-item.TARGET_DROP { border-left-color: var(--red); }
.alert-item.TARGET_RISE { border-left-color: var(--green); }
.alert-item.ALT_DROP { border-left-color: var(--yellow); }
.alert-item.NEW_TARGET { border-left-color: var(--orange); }
.alert-item.NEW_ALT { border-left-color: var(--purple); }
.alert-item.TRADE_SIGNAL { border-left-color: var(--accent); }

.alert-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.alert-item.TARGET_DROP .alert-type { color: var(--red); }
.alert-item.TARGET_RISE .alert-type { color: var(--green); }
.alert-item.ALT_DROP .alert-type { color: var(--yellow); }
.alert-item.NEW_TARGET .alert-type { color: var(--orange); }
.alert-item.NEW_ALT .alert-type { color: var(--purple); }
.alert-item.TRADE_SIGNAL .alert-type { color: var(--accent); }

.alert-message {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

.alert-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.alert-feed {
    max-height: 400px;
}

/* Toast */
.toast-area {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.5s ease 8s forwards;
    cursor: pointer;
}

.toast.TARGET_DROP { border-left: 4px solid var(--red); }
.toast.TARGET_RISE { border-left: 4px solid var(--green); }
.toast.ALT_DROP { border-left: 4px solid var(--yellow); }
.toast.NEW_TARGET { border-left: 4px solid var(--orange); }
.toast.NEW_ALT { border-left: 4px solid var(--purple); }
.toast.TRADE_SIGNAL { border-left: 4px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateX(50px); }
}

.toast-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-dim);
}

/* Side Panel */
.alert-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 300;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.alert-panel.open { right: 0; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.panel-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* Scan Logs */
.scan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.scan-item:last-child { border-bottom: none; }

.scan-type {
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.scan-summary {
    color: var(--text-dim);
    flex: 1;
    margin: 0 16px;
}

.scan-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

/* Config Status */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    font-size: 13px;
}

.config-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.config-dot.ok { background: var(--green); }
.config-dot.missing { background: var(--red); }
.config-dot.optional { background: var(--yellow); }

/* Priority / Political Trades */
.stat-priority .stat-value { color: var(--orange); }

.priority-card {
    border-color: var(--orange);
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.1);
}

.priority-card .card-header {
    border-bottom-color: var(--orange);
}

.trade-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.trade-item:last-child { border-bottom: none; }

.trade-item.priority {
    background: rgba(249, 115, 22, 0.04);
    margin: 0 -20px;
    padding: 14px 20px;
    border-left: 3px solid var(--orange);
}

.trade-item.priority .trade-politician { color: var(--orange); }

.trade-badge {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.trade-badge.buy {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green);
}

.trade-badge.sell {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red);
}

.trade-details { flex: 1; }

.trade-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.trade-politician {
    font-size: 15px;
    font-weight: 600;
}

.trade-office {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.trade-priority-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bg);
    background: var(--orange);
    padding: 2px 8px;
    border-radius: 4px;
}

.trade-ticker-row {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.trade-ticker {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.trade-company {
    font-size: 13px;
    color: var(--text-dim);
}

.trade-amount {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
}

.trade-meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
}

.trade-price {
    text-align: right;
    flex-shrink: 0;
}

.alert-item.PRIORITY_TRADE { border-left-color: var(--orange); }
.alert-item.TRUTH_SOCIAL { border-left-color: #38bdf8; }
.alert-item.TRUTH_SOCIAL .alert-type { color: #38bdf8; }

.alert-item.POLITICAL_TRADE { border-left-color: #6366f1; }
.alert-item.PRIORITY_TRADE .alert-type { color: var(--orange); }
.alert-item.POLITICAL_TRADE .alert-type { color: #6366f1; }

.toast.PRIORITY_TRADE { border-left: 4px solid var(--orange); }
.toast.POLITICAL_TRADE { border-left: 4px solid #6366f1; }
.toast.TRUTH_SOCIAL { border-left: 4px solid #38bdf8; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 900px) {
    .grid-2col { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .nav-subtitle { display: none; }
}

@media (max-width: 600px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .navbar { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
    .container { padding: 12px; }
}
