:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d3a;
    --text: #e1e4eb;
    --text-muted: #8b8fa3;
    --accent: #5b8def;
    --green: #4caf50;
    --red: #ef5350;
    --orange: #ff9800;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Nav */
nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    margin-bottom: 24px;
}
nav .container {
    display: flex;
    align-items: center;
    gap: 24px;
}
nav .brand {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    text-decoration: none;
}
nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
}
nav a:hover, nav a.active { color: var(--text); }

/* Symbol filter buttons in navbar */
.nav-sym-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid var(--border);
    transition: background 0.15s;
}
.nav-sym-btn:hover { background: rgba(91,141,239,0.1); color: var(--text); }
.nav-sym-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Run selector */
.run-selector {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.run-selector label { color: var(--text-muted); font-size: 12px; }
.run-selector select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Page header */
h1 { font-size: 20px; margin-bottom: 4px; }
.page-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.card .label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.card .value { font-size: 28px; font-weight: 700; margin: 4px 0; }
.card .sub { color: var(--text-muted); font-size: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow: hidden; }
thead { background: var(--bg); }
th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(91, 141, 239, 0.05); }

/* Result badges */
.badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-tp { background: rgba(76, 175, 80, 0.15); color: var(--green); }
.badge-sl { background: rgba(239, 83, 80, 0.15); color: var(--red); }
.badge-expired { background: rgba(255, 152, 0, 0.15); color: var(--orange); }
.badge-open { background: rgba(91, 141, 239, 0.15); color: var(--accent); animation: pulse-open 2s ease-in-out infinite; }
@keyframes pulse-open {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--text-muted);
}
.tooltip .tip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2a2d3a;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 4px;
}
.tooltip:hover .tip { display: block; }

/* Section */
.section { margin-bottom: 32px; }
.section h2 { font-size: 16px; margin-bottom: 4px; }
.section .desc { color: var(--text-muted); font-size: 12px; margin-bottom: 12px; }

/* Filters */
.filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

/* Empty state */
.empty { text-align: center; color: var(--text-muted); padding: 40px; font-size: 14px; }

/* Signal toast notification */
.signal-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface);
    border: 1px solid var(--accent);
    border-left: 4px solid var(--accent);
    color: var(--text);
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.signal-toast.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ── Performance Tab ─────────────────────────────────────────── */

/* Account banner */
.account-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 24px;
    align-items: center;
}
.account-item {
    display: flex;
    flex-direction: column;
    padding: 4px 20px 4px 0;
    margin-right: 20px;
    border-right: 1px solid var(--border);
}
.account-item:last-child { border-right: none; margin-right: 0; }
.ab-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 2px; }
.ab-value { font-size: 13px; font-weight: 600; }
.ab-value.accent { color: var(--accent); }
.ab-value.muted { color: var(--text-muted); }

/* Leverage tier badges */
.lev { font-size: 12px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.lev-elite { background: rgba(239, 83, 80, 0.15); color: var(--red); }
.lev-high  { background: rgba(255, 152, 0, 0.15);  color: var(--orange); }
.lev-low   { background: rgba(91, 141, 239, 0.15); color: var(--accent); }
.lev-sep   { color: var(--text-muted); margin: 0 2px; }
.lev-note  { font-size: 11px; color: var(--text-muted); margin-left: 6px; }

/* Performance sections */
.perf-section { margin-bottom: 32px; }
.perf-section h2 { font-size: 16px; margin-bottom: 12px; }
.section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.section-header h2 { margin-bottom: 0; }

/* Curve controls */
.curve-controls { display: flex; align-items: center; gap: 8px; }
.ctrl-label { font-size: 12px; color: var(--text-muted); }
.date-input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.btn-reset {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.btn-reset:hover { color: var(--text); border-color: var(--text-muted); }

/* Equity chart */
.chart-wrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.chart-empty { text-align: center; color: var(--text-muted); padding: 40px; font-size: 13px; }

/* Equity summary row */
.equity-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.eq-stat { font-size: 13px; font-weight: 600; }
.eq-label { font-size: 11px; font-weight: 400; color: var(--text-muted); margin-right: 4px; }

/* KPI row for performance */
.kpi-row-perf { display: flex; flex-wrap: wrap; gap: 10px; }
.kpi-card-perf {
    flex: 1;
    min-width: 90px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    text-align: center;
}
.kpi-card-perf.green  { border-color: rgba(76, 175, 80, 0.4); }
.kpi-card-perf.red    { border-color: rgba(239, 83, 80, 0.4); }
.kpi-card-perf.blue   { border-color: rgba(91, 141, 239, 0.3); }
.kpi-card-perf.orange { border-color: rgba(255, 152, 0, 0.4); }
.kpi-card-perf.muted-card { opacity: 0.7; }
.kpi-card-perf .kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-card-perf .kpi-val   { font-size: 22px; font-weight: 700; }
.kpi-card-perf.green .kpi-val  { color: var(--green); }
.kpi-card-perf.red .kpi-val    { color: var(--red); }
.kpi-card-perf.blue .kpi-val   { color: var(--accent); }
.kpi-card-perf.orange .kpi-val { color: var(--orange); }

/* Performance tables */
.table-wrap { overflow-x: auto; }
.perf-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow: hidden; }
.perf-table thead { background: var(--bg); }
.perf-table th { text-align: left; padding: 9px 12px; font-size: 10px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.perf-table th .th-sub { font-size: 9px; display: block; color: var(--text-muted); font-weight: 400; text-transform: none; }
.perf-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
.perf-table tr:last-child td { border-bottom: none; }
.perf-table tr:hover { background: rgba(91, 141, 239, 0.04); }
.perf-table tr.row-active { background: rgba(91, 141, 239, 0.06); }
.perf-table th.green { color: var(--green); }
.perf-table th.red   { color: var(--red); }
.perf-table td.green { color: var(--green); }
.perf-table td.red   { color: var(--red); }
.perf-table td.orange { color: var(--orange); }
.perf-table td.blue  { color: var(--accent); }
.perf-table td.muted { color: var(--text-muted); }
.perf-table td.accent { color: var(--accent); }
.perf-table td.mono  { font-family: monospace; font-size: 12px; }

/* Run status badges */
.badge-running   { background: rgba(91, 141, 239, 0.15); color: var(--accent); animation: pulse-open 2s ease-in-out infinite; }
.badge-done      { background: rgba(139, 143, 163, 0.15); color: var(--text-muted); }

/* Alert status badges */
.badge-execute   { background: rgba(76, 175, 80, 0.2);  color: var(--green); }
.badge-prepare   { background: rgba(91, 141, 239, 0.2); color: var(--accent); animation: pulse-open 2s ease-in-out infinite; }
.badge-standdown { background: rgba(139, 143, 163, 0.15); color: var(--text-muted); }
.badge-suppressed{ background: rgba(239, 83, 80, 0.12);  color: var(--red); opacity: 0.7; }
.badge-blocked   { background: rgba(255, 152, 0, 0.15);  color: var(--orange); }

/* Bar indicator */
.bar-bg { background: var(--border); border-radius: 3px; height: 6px; width: 80px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.bar-green  { background: var(--green); }
.bar-orange { background: var(--orange); }
.bar-muted  { background: var(--text-muted); }
