/* ── VARIABLES ──────────────────────────────────────────────── */
:root {
    --bg0: #0a0c10;
    --bg1: #0f1117;
    --bg2: #151820;
    --bg3: #1c2030;
    --bg4: #242840;

    --accent: #00e5ff;
    --accent2: #7b61ff;
    --accent3: #ff6b35;
    --green: #00ff9d;
    --red: #ff3b5c;
    --yellow: #ffd600;

    --text0: #f0f4ff;
    --text1: #a8b2cc;
    --text2: #5a6480;
    --text3: #2e3450;

    --border: rgba(255,255,255,0.06);
    --border-accent: rgba(0,229,255,0.2);

    /* Chart grid colors */
    --chart-grid-color: rgba(28,32,48,0.8);
    --chart-text-color: #5a6480;

    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-ui: 'Syne', system-ui, sans-serif;

    --sidebar-width: 200px;
    --sidebar-collapsed: 52px;
    --tabs-height: 38px;
    --titlebar-height: 32px;

    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --shadow-accent: 0 0 20px rgba(0,229,255,0.1);

    --radius: 6px;
    --radius-sm: 3px;

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── LIGHT MODE ──────────────────────────────────────────────── */
:root.theme-light {
    --bg0: #f5f5f7;
    --bg1: #ffffff;
    --bg2: #f0f0f3;
    --bg3: #e8e8eb;
    --bg4: #dcdce0;

    --accent: #0099cc;
    --accent2: #6b4fb8;
    --accent3: #d24d1f;

    --text0: #1a1a1d;
    --text1: #505058;
    --text2: #7a7a82;
    --text3: #b0b0b8;

    --border: rgba(0,0,0,0.1);
    --border-accent: rgba(0,153,204,0.3);

    --shadow: 0 4px 24px rgba(0,0,0,0.1);
    --shadow-accent: 0 0 20px rgba(0,153,204,0.08);

    /* Chart grid colors for light theme */
    --chart-grid-color: rgba(200,200,220,0.6);
    --chart-text-color: #888888;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg0);
    color: var(--text0);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input { font: inherit; }
svg { display: block; flex-shrink: 0; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg0);
    background-image:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(0,229,255,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 40% 30% at 80% 80%, rgba(123,97,255,0.04) 0%, transparent 60%);
}

.login-card {
    width: 360px;
    background: var(--bg1);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border-accent);
    border-radius: var(--radius);
    padding: 40px 36px;
    box-shadow: var(--shadow), var(--shadow-accent);
}

.login-logo {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 28px;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.05em;
    color: var(--text1);
}

.login-card h2 {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 24px;
    color: var(--text0);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.login-sub {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 28px;
    font-family: var(--font-mono);
}

.login-fields { display: flex; flex-direction: column; gap: 14px; }

.field-group { display: flex; flex-direction: column; gap: 5px; }

.field-group label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--text2);
}

.field-group input {
    height: 38px;
    padding: 0 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text0);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition);
}

.field-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}

.field-group input::placeholder { color: var(--text3); }

.btn-connect {
    height: 42px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--accent);
    color: var(--bg0);
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    margin-top: 6px;
    transition: opacity var(--transition), transform var(--transition);
}
.btn-connect:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-connect:active { transform: translateY(0); opacity: 1; }

.login-error {
    min-height: 18px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--red);
    text-align: center;
}

/* ── APP LAYOUT ─────────────────────────────────────────────── */
.app-layout {
    display: flex;
    width: 100%; height: 100%;
    overflow: hidden;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg0);
}

/* ── PANEL TABS BAR ─────────────────────────────────────────── */
.panel-tabs-bar {
    display: flex;
    align-items: center;
    height: var(--tabs-height);
    background: var(--bg1);
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
    gap: 4px;
    flex-shrink: 0;
}

.panel-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.panel-tab {
    display: flex; align-items: center; gap: 6px;
    height: 28px;
    padding: 0 12px;
    background: var(--bg2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text2);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    user-select: none;
}

.panel-tab:hover { color: var(--text1); background: var(--bg3); }

.panel-tab.active {
    background: var(--bg3);
    border-color: var(--border-accent);
    color: var(--accent);
}

.panel-tab .tab-close {
    width: 14px; height: 14px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 2px;
    color: var(--text2);
    font-size: 10px;
    transition: all var(--transition);
    margin-left: 2px;
}
.panel-tab .tab-close:hover { background: rgba(255,59,92,0.2); color: var(--red); }

.btn-add-panel {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    transition: all var(--transition);
}
.btn-add-panel:hover { color: var(--accent); border-color: var(--border-accent); }

/* ── CHART GRID ─────────────────────────────────────────────── */
.chart-grid {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* ── DROP OVERLAY ───────────────────────────────────────────── */
.drop-overlay {
    position: absolute; inset: 0;
    background: rgba(0,229,255,0.04);
    border: 2px dashed rgba(0,229,255,0.3);
    border-radius: var(--radius);
    margin: 8px;
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    pointer-events: none;
}

.drop-overlay-inner {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 13px;
    opacity: 0.7;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text3); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px;
    color: var(--text2);
    pointer-events: none;
}

.empty-state svg { opacity: 0.3; }

.empty-state p {
    font-family: var(--font-mono);
    font-size: 12px;
    text-align: center;
    line-height: 1.8;
    opacity: 0.6;
}

/* ── CHARTS FOOTER ──────────────────────────────────────────── */
.charts-footer {
    background: var(--bg1);
    border-top: 1px solid var(--border);
    padding: 8px 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.footer-info {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text2);
}

.footer-status {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text1);
    flex: 1;
}

/* ── TRACK LINES ────────────────────────────────────────────── */
.track-line {
    cursor: col-resize !important;
}

.track-line-single {
    background: #00e5ff !important;
}

.track-line-0 {
    background: #00e5ff !important;
}

.track-line-1 {
    background: #ff6b35 !important;
}

.track-display,
.track-delta-display {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(15,17,23,0.95);
    border: 1px solid rgba(0,229,255,0.2);
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 22;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #f0f4ff;
    line-height: 1.6;
}

.cursor-single-btn.active,
.cursor-dual-btn.active {
    color: var(--accent);
    border-color: var(--border-accent);
    background: rgba(0,229,255,0.06);
}

.cursor-single-btn.active svg {
    stroke: #00e5ff;
}

.cursor-dual-btn.active svg {
    stroke: #ff6b35;
}

