/* ============================================================
   GoldAnalytics – app.css  (Dark Gold Theme + Light Override)
   ============================================================ */

/* ---------- CSS VARIABLES ---------- */
:root {
    --bg-primary:   #0a0a0f;
    --bg-secondary: #111118;
    --bg-card:      #16161f;
    --bg-input:     #1c1c27;
    --bg-hover:     #1f1f2e;
    --bg-active:    #1a1a2a;

    --accent:       #F5A623;
    --accent-dim:   #c48012;
    --accent-glow:  rgba(245,166,35,0.18);
    --accent-pale:  rgba(245,166,35,0.08);

    --text-primary: #e8e8f0;
    --text-secondary:#9999bb;
    --text-muted:   #5a5a7a;

    --border:       #252535;
    --border-light: #2e2e48;

    --success:  #00c896;
    --danger:   #ff4d6d;
    --warning:  #ffb800;
    --info:     #4da6ff;

    --sidebar-w: 240px;
    --topbar-h:  56px;
    --radius:    8px;
    --radius-lg: 14px;
    --transition: 0.18s ease;
    --font: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.55);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

[data-theme="light"] {
    --bg-primary:   #f0f0f5;
    --bg-secondary: #e8e8f0;
    --bg-card:      #ffffff;
    --bg-input:     #f8f8fc;
    --bg-hover:     #ececf5;
    --bg-active:    #e4e4f0;

    --text-primary: #1a1a2e;
    --text-secondary:#555570;
    --text-muted:   #9999bb;

    --border:       #dcdcec;
    --border-light: #e8e8f4;

    --accent-pale:  rgba(245,166,35,0.12);
    --accent-glow:  rgba(245,166,35,0.22);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dim); }

img { display: block; max-width: 100%; }

ul { list-style: none; }

input, select, textarea, button { font-family: var(--font); }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ============================================================
   LAYOUT – APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.sidebar__icon {
    font-size: 22px;
    color: var(--accent);
    line-height: 1;
}

.sidebar__name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar__name strong { color: var(--accent); }

.sidebar__nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 20px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background: var(--accent-pale);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 17px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar__footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

.sidebar__actions {
    display: flex;
    gap: 6px;
}

.sidebar__actions .btn { flex: 1; font-size: 12px; padding: 6px 8px; }

/* ---------- TOPBAR ---------- */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 90;
}

.topbar__left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-ticker {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-label { color: var(--accent); font-weight: 600; font-size: 11px; }
.ticker-price { font-weight: 700; }
.ticker-change { font-size: 12px; }
.ticker-change.up    { color: var(--success); }
.ticker-change.down  { color: var(--danger); }

/* ---------- MAIN CONTENT ---------- */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 24px;
}

/* ---------- HAMBURGER (mobile) ---------- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px; height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.hamburger span {
    display: block;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.1px;
}

.card__subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- STAT CARDS ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover::after { opacity: 1; }

.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); line-height: 1.1; }
.stat-change { font-size: 12px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-icon {
    position: absolute; right: 16px; top: 14px;
    font-size: 26px; opacity: 0.12;
}

/* ============================================================
   SIGNAL BADGE
   ============================================================ */
.signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.signal-badge.strong-buy  { background: rgba(0,200,150,0.15); color: #00c896; border: 1px solid rgba(0,200,150,0.3); }
.signal-badge.buy         { background: rgba(0,200,150,0.08); color: #00c896; border: 1px solid rgba(0,200,150,0.2); }
.signal-badge.neutral     { background: rgba(153,153,187,0.12); color: #9999bb; border: 1px solid rgba(153,153,187,0.25); }
.signal-badge.sell        { background: rgba(255,77,109,0.08); color: #ff4d6d; border: 1px solid rgba(255,77,109,0.2); }
.signal-badge.strong-sell { background: rgba(255,77,109,0.15); color: #ff4d6d; border: 1px solid rgba(255,77,109,0.3); }

/* Signal dot */
.signal-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.signal-dot.strong-buy, .signal-dot.buy     { background: var(--success); }
.signal-dot.neutral                          { background: var(--text-muted); }
.signal-dot.sell, .signal-dot.strong-sell   { background: var(--danger); }

/* ============================================================
   CONFIDENCE BAR
   ============================================================ */
.confidence-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.confidence-bar__fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ============================================================
   DIMENSION SCORES (Signal breakdown)
   ============================================================ */
.dimension-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dimension-label { width: 90px; flex-shrink: 0; font-size: 12px; }
.dimension-bar { flex: 1; height: 5px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.dimension-bar__fill { height: 100%; border-radius: 3px; }
.dimension-bar__fill.pos { background: var(--success); }
.dimension-bar__fill.neg { background: var(--danger); }
.dimension-bar__fill.neu { background: var(--text-muted); }
.dimension-score { width: 40px; text-align: right; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-wrap {
    position: relative;
    width: 100%;
}

#tv_chart_container iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

#mainChart {
    width: 100%;
    height: clamp(360px, calc(100vh - 420px), 720px);
    border-radius: var(--radius);
    background: var(--bg-card);
}

#volumeChart {
    width: 100%;
    height: 120px;
    border-radius: var(--radius);
    background: var(--bg-card);
    margin-top: 4px;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.interval-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-mono);
}

.interval-btn:hover, .interval-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

.indicator-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.indicator-toggle.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-pale);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.legend-item { display: flex; align-items: center; gap: 5px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.data-table td.mono { font-family: var(--font-mono); }
.data-table td.bold { font-weight: 600; color: var(--text-primary); }

.td-up   { color: var(--success) !important; font-weight: 600; }
.td-down { color: var(--danger)  !important; font-weight: 600; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.form-input, .form-select, .form-textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    width: 100%;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239999bb' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-textarea { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row--space { display: flex; justify-content: space-between; align-items: center; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-input { padding-right: 40px; }
.input-icon-btn {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 16px; padding: 2px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    font-family: var(--font);
    white-space: nowrap;
    text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}
.btn--primary:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    color: var(--bg-primary);
    box-shadow: var(--shadow-glow);
}

.btn--secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn--secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn--danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn--danger:hover:not(:disabled) {
    background: rgba(255,77,109,0.1);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn--sm { padding: 5px 12px; font-size: 12px; }
.btn--full { width: 100%; }
.btn--icon { padding: 7px; border-radius: 7px; }

/* ============================================================
   ALERTS & FLASH MESSAGES
   ============================================================ */
.flash, .alert {
    padding: 11px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
}

.flash--success, .alert--success { background: rgba(0,200,150,0.1); color: var(--success); border: 1px solid rgba(0,200,150,0.3); }
.flash--error,   .alert--error   { background: rgba(255,77,109,0.1); color: var(--danger); border: 1px solid rgba(255,77,109,0.3); }
.flash--warning, .alert--warning { background: rgba(255,184,0,0.1); color: var(--warning); border: 1px solid rgba(255,184,0,0.3); }
.flash--info,    .alert--info    { background: rgba(77,166,255,0.1); color: var(--info); border: 1px solid rgba(77,166,255,0.3); }

.error-list { padding-left: 18px; list-style: disc; }
.error-list li { margin-bottom: 3px; }

/* ============================================================
   AUTH LAYOUT
   ============================================================ */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 460px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    font-size: 42px;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 24px;
    font-weight: 300;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-title strong { color: var(--accent); font-weight: 700; }

.auth-tagline {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-md);
}

.card-heading    { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.card-subheading { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-footer-link { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 18px; }
.auth-footer-link a { color: var(--accent); }

.password-strength { font-size: 12px; font-weight: 600; min-height: 16px; margin-top: 2px; }

/* ============================================================
   CHECKBOX & RADIO
   ============================================================ */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ============================================================
   ERROR PAGES
   ============================================================ */
.error-page {
    text-align: center;
    padding: 60px 24px;
}

.error-code {
    font-size: 96px;
    font-weight: 900;
    font-family: var(--font-mono);
    color: var(--accent);
    line-height: 1;
    opacity: 0.8;
}

.error-msg {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 12px 0 8px;
}

.error-detail {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 28px;
    font-size: 14px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 7px;
    font-size: 13px; font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}

.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg-primary); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   SPINNER / LOADING
   ============================================================ */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(10,10,15,0.6);
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    z-index: 10;
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.badge--gold    { background: var(--accent-pale); color: var(--accent); border: 1px solid rgba(245,166,35,0.3); }
.badge--success { background: rgba(0,200,150,0.1); color: var(--success); border: 1px solid rgba(0,200,150,0.3); }
.badge--danger  { background: rgba(255,77,109,0.1); color: var(--danger); border: 1px solid rgba(255,77,109,0.3); }
.badge--neutral { background: rgba(153,153,187,0.1); color: var(--text-muted); border: 1px solid var(--border); }
.badge--info    { background: rgba(77,166,255,0.1); color: var(--info); border: 1px solid rgba(77,166,255,0.3); }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px; height: 22px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: absolute; inset: 0;
    background: var(--border-light);
    border-radius: 22px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-track::before {
    content: '';
    position: absolute;
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(18px); }

/* ============================================================
   RISK CALCULATOR SPECIFIC
   ============================================================ */
.risk-result-card {
    background: var(--accent-pale);
    border: 1px solid rgba(245,166,35,0.25);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.risk-result-card .stat-value { color: var(--accent); }

.kelly-meter {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.kelly-meter__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ============================================================
   BACKTEST SPECIFIC
   ============================================================ */
.backtest-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .backtest-summary { grid-template-columns: repeat(2, 1fr); }
}

.equity-chart-wrap {
    height: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* ============================================================
   ALERTS PAGE SPECIFIC
   ============================================================ */
.alert-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.alert-row:last-child { border-bottom: none; }

.alert-row__info { flex: 1; min-width: 0; }
.alert-row__type { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.8px; }
.alert-row__value { font-size: 14px; font-weight: 600; color: var(--text-primary); font-family: var(--font-mono); margin-top: 2px; }
.alert-row__note { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-log-row { font-size: 12px; font-family: var(--font-mono); }
.log-level-debug    { color: var(--text-muted); }
.log-level-info     { color: var(--info); }
.log-level-warning  { color: var(--warning); }
.log-level-error    { color: var(--danger); }
.log-level-critical { color: var(--danger); font-weight: 700; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.6);
    }

    .main-wrap { margin-left: 0; }
    .hamburger { display: flex; }

    .main-content { padding: 16px; }

    .form-row { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: 1fr 1fr; }

    #mainChart { height: 320px; }

    .auth-card { padding: 22px 18px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .chart-toolbar { gap: 5px; }
    .interval-btn { padding: 4px 8px; font-size: 11px; }
}

/* ============================================================
   PAGE TRANSITION
   ============================================================ */
.page-fade {
    animation: fadein 0.22s ease;
}

@keyframes fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tip] {
    position: relative;
    cursor: help;
}

[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 999;
    pointer-events: none;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-gold    { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.text-mono    { font-family: var(--font-mono); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-8   { gap: 8px; }
.flex-gap-12  { gap: 12px; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }

.overflow-hidden { overflow: hidden; }
.w-full { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ============================================================
   LAYOUT CLASS ALIASES  (main.php uses these names)
   ============================================================ */

/* Sidebar brand/logo bar */
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 22px; color: var(--accent); line-height: 1; flex-shrink: 0; }
.logo-text  { font-size: 17px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.logo-text strong { color: var(--accent); }

/* Sidebar toggle button */
.sidebar-toggle {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 18px; margin-left: auto; padding: 4px 6px;
    line-height: 1; transition: color var(--transition);
}
.sidebar-toggle:hover { color: var(--accent); }

/* Sidebar nav list */
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; list-style: none; }

/* Nav links (alias for .nav-item) */
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 20px; color: var(--text-secondary);
    font-size: 14px; font-weight: 500;
    transition: background var(--transition), color var(--transition);
    position: relative; text-decoration: none;
}
.nav-link:hover  { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-link.active { background: var(--accent-pale); color: var(--accent); }
.nav-link.active::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-label { /* text label inside nav-link */ }
.nav-badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; border-radius: 10px;
    padding: 1px 6px; min-width: 18px; text-align: center;
}

/* Sidebar footer */
.sidebar-footer  { padding: 14px 16px; border-top: 1px solid var(--border); }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions .btn { flex: 1; font-size: 12px; padding: 6px 8px; }

/* btn-icon alias */
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius);
    background: var(--bg-hover); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer; font-size: 16px;
    text-decoration: none; transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--border); color: var(--accent); text-decoration: none; }

/* Main wrapper alias */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* Topbar side aliases */
.topbar-left  { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Ticker aliases */
.ticker-symbol { color: var(--accent); font-weight: 600; font-size: 11px; }
.ticker-time   { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

/* Flash message close button */
.flash-close {
    background: none; border: none; cursor: pointer;
    color: inherit; opacity: 0.7; font-size: 14px; padding: 0 4px;
    line-height: 1; transition: opacity var(--transition);
}
.flash-close:hover { opacity: 1; }

/* Responsive overrides for aliases */
@media (max-width: 768px) {
    .main-wrapper { margin-left: 0; }
}
