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

:root {
    --bg: #14171c;
    --panel: #1b2027;
    --panel-border: rgba(255, 255, 255, 0.07);
    --text: #e9ecf1;
    --text-muted: #8a93a3;
    --accent: #e4b429;
    --accent-dim: #8f701e;
    --positive: #3fb98a;
    --negative: #e0575b;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.gauge-positive { color: var(--positive); }
.gauge-negative { color: var(--negative); }

/* ---------- Top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 32px;
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    background: rgba(20, 23, 28, 0.92);
    backdrop-filter: blur(6px);
    z-index: 10;
}

.topbar-brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 1.05rem;
}

.topbar-brand::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 8px;
    box-shadow: 0 0 8px var(--accent);
}

.topbar-total {
    margin-left: auto;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.topbar-total-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.topbar-total-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.05rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #1a1305; }
.btn-primary:hover { background: #edc247; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--panel-border); }
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.18); }

.btn-danger { background: transparent; color: var(--negative); border-color: rgba(224, 87, 91, 0.4); }
.btn-danger:hover { background: rgba(224, 87, 91, 0.1); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---------- Layout ---------- */
.dashboard {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 80px;
    display: grid;
    gap: 24px;
}

.dashboard-narrow { max-width: 640px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.panel h2 { margin: 0 0 4px; font-size: 1.1rem; }
.panel-sub { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 16px; }

/* ---------- Hero / Gauge ---------- */
.hero {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: center;
    gap: 32px;
}

.gauge-wrap { position: relative; text-align: center; }

.gauge { width: 100%; max-width: 240px; overflow: visible; }

.gauge-track {
    fill: none;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 14;
    stroke-linecap: round;
}

.gauge-zone-neg {
    fill: none;
    stroke: var(--negative);
    stroke-opacity: 0.55;
    stroke-width: 14;
    stroke-linecap: round;
}

.gauge-zone-pos {
    fill: none;
    stroke: var(--positive);
    stroke-opacity: 0.55;
    stroke-width: 14;
    stroke-linecap: round;
}

.gauge-needle {
    transform-origin: 120px 130px;
    transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-needle line {
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(228, 180, 41, 0.6));
}

.gauge-hub { fill: var(--accent); }

.gauge-readout {
    margin-top: -18px;
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 600;
}

.gauge-readout-label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 2px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 32px;
    margin: 0;
}

.hero-stats dt {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.hero-stats dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 600;
}

.hint {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 4px 0 0;
}

/* ---------- Search ---------- */
.search-row { display: flex; gap: 10px; }

.search-row input {
    flex: 1;
}

#search-result { margin-top: 16px; }

.quote-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.quote-card-main { display: flex; align-items: baseline; gap: 14px; }
.quote-ticker { font-weight: 600; letter-spacing: 0.02em; }
.quote-price { font-size: 1.1rem; }
.quote-card-meta { color: var(--text-muted); font-size: 0.8rem; flex-basis: 100%; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.holdings-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--panel-border);
}

.holdings-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.holdings-table tr:last-child td { border-bottom: none; }

.cell-name { font-weight: 500; }
.note { margin-left: 6px; color: var(--text-muted); cursor: help; }
.cell-actions { text-align: right; }

.empty-state { color: var(--text-muted); padding: 24px 0; text-align: center; }

/* ---------- Forms ---------- */
label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

input[type="text"],
input[type="password"] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 11px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(228, 180, 41, 0.18);
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 16px;
}

.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------- Auth pages ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 36px;
}

.auth-brand {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.auth-card h1 { font-size: 1.4rem; margin: 0 0 6px; }
.auth-sub { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 20px; }
.auth-form button { width: 100%; margin-top: 6px; justify-content: center; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.alert-error { background: rgba(224, 87, 91, 0.12); color: #f2a2a5; border: 1px solid rgba(224, 87, 91, 0.3); }
.alert-info { background: rgba(228, 180, 41, 0.1); color: var(--accent); border: 1px solid rgba(228, 180, 41, 0.3); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .hero { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .topbar { padding: 14px 18px; }
    .dashboard { padding: 24px 16px 60px; }
}

@media (prefers-reduced-motion: reduce) {
    .gauge-needle { transition: none; }
}
