/* ══════════════════════════════════════════════════════════════════════════
   THEME :: NEW  — Technical / Terminal Aesthetic
   ──────────────────────────────────────────────────────────────────────────
   All rules are scoped under `html.theme-new` so the legacy theme remains
   completely untouched when the class is absent. Loaded alongside (and
   after) style.css on every page; theme.js toggles the root class.
   ══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@500;600;700&display=swap');

/* ── Root palette override ─────────────────────────────────────────────── */
html.theme-new {
    --bg-primary:    #03060c;
    --bg-secondary:  #07101c;
    --bg-tertiary:   #0e1828;
    --bg-card:       #08101c;
    --border:        #1e2a44;
    --border-strong: #2b3c5e;
    --text-primary:  #e8eef7;
    --text-secondary:#95a3b8;
    --text-muted:    #5a6a85;
    --accent:        #5ecbf5;
    --accent-hover:  #8fdcff;
    --green:         #22d27c;
    --green-bg:      rgba(34, 210, 124, 0.12);
    --red:           #ff5c5c;
    --red-bg:        rgba(255, 92, 92, 0.12);
    --yellow:        #ffb340;
    --yellow-bg:     rgba(255, 179, 64, 0.12);
    --shadow:        0 2px 0 rgba(0,0,0,0.4), 0 18px 48px rgba(0,0,0,0.55);
    --radius:        4px;
    --radius-sm:     3px;

    --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, 'Courier New', monospace;
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --grad-header: linear-gradient(180deg, #111d35 0%, #0a1220 100%);
    --grad-accent: linear-gradient(90deg, #5ecbf5 0%, #22d27c 100%);
    --grad-warn:   linear-gradient(90deg, #ffb340 0%, #ff5c5c 100%);
}

/* ── Body + global typography ──────────────────────────────────────────── */
html.theme-new body {
    font-family: var(--font-mono);
    background:
        radial-gradient(1200px 600px at 50% -200px, rgba(94,203,245,0.05), transparent 60%),
        linear-gradient(180deg, #05080f 0%, #070b18 100%);
    color: var(--text-primary);
    letter-spacing: 0.01em;
    font-feature-settings: "ss01", "ss02";
}

html.theme-new h1,
html.theme-new h2,
html.theme-new h3,
html.theme-new h4,
html.theme-new h5,
html.theme-new h6 {
    font-family: var(--font-sans);
    letter-spacing: 0.01em;
}

html.theme-new * { font-variant-numeric: tabular-nums; }

html.theme-new ::selection { background: rgba(94,203,245,0.35); color: #fff; }

/* ── Header bar ────────────────────────────────────────────────────────── */
html.theme-new .header {
    background: var(--grad-header);
    border-bottom: 1px solid var(--border-strong);
    padding: 12px 28px;
    box-shadow: 0 1px 0 rgba(94,203,245,0.08) inset;
}
html.theme-new .header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: var(--grad-accent);
    opacity: 0.4;
}
html.theme-new .header { position: sticky; }

html.theme-new .logo {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 15px;
    padding-right: 14px;
    border-right: 1px solid var(--border);
}
html.theme-new .logo::before {
    content: "▲ ";
    color: var(--accent);
}

html.theme-new .nav-menu { border-left: none; padding-left: 6px; }

html.theme-new .nav-link {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 2px;
    border: 1px solid transparent;
}
html.theme-new .nav-link:hover {
    color: var(--accent);
    background: rgba(94,203,245,0.06);
    border-color: rgba(94,203,245,0.25);
}
html.theme-new .nav-link.active {
    color: var(--accent);
    background: rgba(94,203,245,0.1);
    border-color: rgba(94,203,245,0.4);
}

html.theme-new .user-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: rgba(255,255,255,0.02);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
html.theme-new .btn {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 600;
    padding: 7px 14px;
    background: #0f1a2e;
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.15s ease;
}
html.theme-new .btn:hover {
    background: #152340;
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(94,203,245,0.25);
}
html.theme-new .btn-primary {
    background: rgba(94,203,245,0.15);
    border-color: var(--accent);
    color: var(--accent);
}
html.theme-new .btn-primary:hover {
    background: rgba(94,203,245,0.25);
    color: #fff;
}
html.theme-new .btn-danger {
    background: rgba(255,92,92,0.1);
    border-color: var(--red);
    color: var(--red);
}
html.theme-new .btn-danger:hover {
    background: rgba(255,92,92,0.2);
    color: #fff;
}

/* ── Generic "section" pattern ─────────────────────────────────────────── */
html.theme-new .summary-card,
html.theme-new .chart-container,
html.theme-new .table-container,
html.theme-new .detail-stat,
html.theme-new .modal,
html.theme-new .card {
    background: linear-gradient(180deg, #0c1426 0%, #0a1220 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
}

/* Gradient hairline at top of every panel — the signature "technical" bar */
html.theme-new .chart-container::before,
html.theme-new .table-container::before,
html.theme-new .modal::before,
html.theme-new .card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--grad-accent);
    opacity: 0.5;
    pointer-events: none;
}

/* ── Summary cards ─────────────────────────────────────────────────────── */
html.theme-new .summary-bar { padding: 20px 28px 12px; gap: 10px; }

html.theme-new .summary-card {
    padding: 14px 18px 16px;
    overflow: hidden;
}
html.theme-new .summary-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0.6;
}
html.theme-new .summary-card .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}
html.theme-new .summary-card .value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.15;
}
html.theme-new .summary-card .change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

/* ── Chart section ─────────────────────────────────────────────────────── */
html.theme-new .chart-section { padding: 0 28px 20px; }
html.theme-new .chart-container { padding: 18px 20px 20px; }

html.theme-new .chart-title,
html.theme-new .table-title {
    font-family: var(--font-sans);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 600;
    color: var(--text-secondary);
}
html.theme-new .chart-title::before,
html.theme-new .table-title::before {
    content: "◆ ";
    color: var(--accent);
    margin-right: 2px;
}

html.theme-new .time-range-btns {
    background: #0a1220;
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 2px;
}
html.theme-new .time-btn {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 1px;
}
html.theme-new .time-btn:hover { color: var(--accent); }
html.theme-new .time-btn.active {
    background: rgba(94,203,245,0.18);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(94,203,245,0.4) inset;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
html.theme-new .table-section { padding: 0 28px 20px; }
html.theme-new .table-header-bar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.015);
}

html.theme-new .positions-table { font-family: var(--font-mono); font-size: 12px; }
html.theme-new .positions-table th {
    background: #0a1424;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 9px 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-strong);
}
html.theme-new .positions-table td {
    padding: 11px 14px;
    font-size: 12px;
    border-bottom: 1px solid rgba(30,42,68,0.5);
}
html.theme-new .positions-table tbody tr:hover {
    background: rgba(94,203,245,0.04);
}
html.theme-new .ticker-cell {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.04em;
}
html.theme-new .totals-row {
    background: rgba(94,203,245,0.06) !important;
}
html.theme-new .totals-row td {
    border-top: 1px solid var(--accent);
    font-weight: 700;
}

/* ── Semantic colors / P&L values ──────────────────────────────────────── */
html.theme-new .positive {
    color: var(--green);
    font-weight: 600;
}
html.theme-new .negative {
    color: var(--red);
    font-weight: 600;
}
html.theme-new .summary-card .change.positive,
html.theme-new .summary-card .change.negative,
html.theme-new .positions-table td.positive,
html.theme-new .positions-table td.negative {
    padding: 2px 6px;
    border-radius: 2px;
    display: inline-block;
}
html.theme-new .summary-card .change.positive,
html.theme-new .positions-table td.positive {
    background: var(--green-bg);
}
html.theme-new .summary-card .change.negative,
html.theme-new .positions-table td.negative {
    background: var(--red-bg);
}

html.theme-new .perf-badge {
    border-radius: 2px;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    padding: 2px 8px;
}
html.theme-new .perf-badge.positive {
    background: var(--green-bg);
    color: var(--green);
    box-shadow: 0 0 0 1px rgba(34,210,124,0.3) inset;
}
html.theme-new .perf-badge.negative {
    background: var(--red-bg);
    color: var(--red);
    box-shadow: 0 0 0 1px rgba(255,92,92,0.3) inset;
}

/* ── Modals + forms ────────────────────────────────────────────────────── */
html.theme-new .modal {
    box-shadow: var(--shadow);
}
html.theme-new .modal-header {
    background: var(--grad-header);
    border-bottom: 1px solid var(--border-strong);
    padding: 16px 22px;
}
html.theme-new .modal-header h2,
html.theme-new .modal-header h3 {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
html.theme-new .modal-footer { border-top: 1px solid var(--border); }

html.theme-new .form-group label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 600;
}
html.theme-new .form-group input,
html.theme-new .form-group select,
html.theme-new input[type="text"],
html.theme-new input[type="password"],
html.theme-new input[type="email"],
html.theme-new input[type="number"],
html.theme-new input[type="search"],
html.theme-new select,
html.theme-new textarea {
    background: #0a1220;
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 13px;
}
html.theme-new .form-group input:focus,
html.theme-new .form-group select:focus,
html.theme-new input:focus,
html.theme-new select:focus,
html.theme-new textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(94,203,245,0.3);
    outline: none;
}

/* ── Hub (home) grid ───────────────────────────────────────────────────── */
html.theme-new .hub-welcome h1 {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 24px;
    color: var(--text-primary);
}
html.theme-new .hub-welcome p {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    color: var(--text-muted);
}
html.theme-new .hub-card {
    background: linear-gradient(180deg, #0c1426 0%, #0a1220 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}
html.theme-new .hub-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--grad-accent);
    opacity: 0.5;
}
html.theme-new .hub-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(94,203,245,0.4), 0 12px 32px rgba(0,0,0,0.5);
}
html.theme-new .hub-card:hover::before { opacity: 1; }
html.theme-new .hub-card-title {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 13px;
    font-weight: 600;
}
html.theme-new .hub-card-desc {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* ── Theme toggle control (hub header) ─────────────────────────────────── */
html.theme-new .theme-toggle,
.theme-toggle {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border, #30363d);
    border-radius: 3px;
    overflow: hidden;
    font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    background: rgba(255,255,255,0.02);
}
.theme-toggle button {
    background: transparent;
    color: var(--text-muted, #6e7681);
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.theme-toggle button:hover { color: var(--text-primary, #e6edf3); }
.theme-toggle button.active {
    background: var(--accent, #58a6ff);
    color: #fff;
}
html.theme-new .theme-toggle button.active {
    background: rgba(94,203,245,0.2);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(94,203,245,0.5) inset;
}
html.theme-new .theme-toggle { border-color: var(--border-strong); }

/* ── Login page ────────────────────────────────────────────────────────── */
html.theme-new .login-container,
html.theme-new .login-box,
html.theme-new .login-card {
    background: linear-gradient(180deg, #0c1426 0%, #0a1220 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    position: relative;
}
html.theme-new .login-card::before,
html.theme-new .login-box::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--grad-accent);
    opacity: 0.7;
}
html.theme-new .login-card h1,
html.theme-new .login-box h1,
html.theme-new .login-title {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

/* ── Misc shared components ────────────────────────────────────────────── */
html.theme-new .last-updated {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
html.theme-new .drag-select-info {
    font-family: var(--font-mono);
    background: #0a1220;
    border: 1px solid var(--border);
    border-radius: 2px;
}
html.theme-new .drag-select-info .drag-change.positive { color: var(--green); }
html.theme-new .drag-select-info .drag-change.negative { color: var(--red); }

html.theme-new .overlay-btn {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: 2px;
}

/* Scrollbars */
html.theme-new ::-webkit-scrollbar { width: 10px; height: 10px; }
html.theme-new ::-webkit-scrollbar-track { background: #05080f; }
html.theme-new ::-webkit-scrollbar-thumb {
    background: #1e2a44;
    border-radius: 2px;
    border: 2px solid #05080f;
}
html.theme-new ::-webkit-scrollbar-thumb:hover { background: #2b3c5e; }

/* Admin / blog / projects / generic tables fallback */
html.theme-new table { font-family: var(--font-mono); }
html.theme-new th {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 10px;
    color: var(--text-muted);
}

/* Section separators for any `.section-header` or `<h2>` at top level */
html.theme-new h2,
html.theme-new .section-header {
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 14px;
    color: var(--text-secondary);
    position: relative;
    padding-bottom: 8px;
    margin-bottom: 16px;
}
html.theme-new h2::after,
html.theme-new .section-header::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 40px; height: 2px;
    background: var(--grad-accent);
}
