:root {
    --bg: #0a0a0b;
    --bg-elevated: #0f1011;
    --panel: #16171a;
    --panel-hover: #1b1c1f;
    --border: #24262a;
    --border-soft: #1c1e21;
    --text: #edeef0;
    --text-dim: #9a9ba3;
    --text-faint: #6b6c74;
    --emerald: #10b981;
    --emerald-dim: rgba(16, 185, 129, 0.12);
    --gold: #d4af37;
    --gold-dim: rgba(212, 175, 55, 0.12);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

::selection { background: var(--emerald-dim); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    font-size: 14.5px;
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--emerald); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: #34d399; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* ---------- Layout ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex-shrink: 0;
    padding: 22px 14px;
    border-right: 1px solid var(--border-soft);
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    padding: 6px 10px 26px;
}

.sidebar .brand .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    box-shadow: 0 0 0 3px var(--emerald-dim);
    flex-shrink: 0;
}

.sidebar nav { display: flex; flex-direction: column; gap: 1px; }

.sidebar nav .nav-group-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 14px 10px 6px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dim);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar nav a:hover { background: var(--panel); color: var(--text); }

.sidebar nav a.active {
    background: var(--panel);
    color: var(--text);
}

.sidebar nav a.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    border-radius: 0 3px 3px 0;
    background: var(--emerald);
}

.sidebar .signout {
    margin-top: auto;
    padding-top: 18px;
}

.sidebar .signout button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    width: 100%;
    font-size: 0.85rem;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.sidebar .signout button:hover { background: var(--panel); color: var(--text); border-color: var(--text-faint); }

.main { flex: 1; padding: 36px 44px; max-width: 1320px; }

.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.015em; }
.page-subtitle { color: var(--text-dim); font-size: 0.88rem; margin-top: 4px; }

/* ---------- Cards ---------- */

.cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    min-width: 190px;
    flex: 1;
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--border-soft); }

.card .label {
    color: var(--text-dim); font-size: 0.76rem; font-weight: 600;
    letter-spacing: 0.02em; margin-bottom: 8px;
}
.card .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.card .value.positive { color: var(--emerald); }
.card .value.negative { color: var(--red); }
.card .value.gold { color: var(--gold); }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; margin-bottom: 28px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border-soft); font-size: 0.87rem; }
th {
    color: var(--text-faint); font-weight: 600; font-size: 0.72rem;
    letter-spacing: 0.05em; text-transform: uppercase; padding-bottom: 12px;
}
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--panel); }
tbody tr:last-child td { border-bottom: none; }
tr.rank-1 td { color: var(--gold); font-weight: 600; }

/* ---------- Badges ---------- */

.badge {
    padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
    letter-spacing: 0.01em; display: inline-block;
}
.badge.ok { background: var(--emerald-dim); color: var(--emerald); }
.badge.warn { background: var(--red-dim); color: var(--red); }

/* ---------- Forms ---------- */

.input, select.input, input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 0.87rem;
    font-family: inherit;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-dim);
}
input::placeholder { color: var(--text-faint); }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; border-radius: var(--radius-sm);
    padding: 9px 16px; font-weight: 600; font-size: 0.86rem; font-family: inherit;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: transform 0.08s ease, filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--emerald); color: #04140f; }
.btn-primary:hover { filter: brightness(1.08); color: #04140f; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel); color: var(--text); border-color: var(--text-faint); }

.btn-outline-emerald { background: transparent; border: 1px solid var(--border); color: var(--emerald); }
.btn-outline-emerald:hover { background: var(--emerald-dim); border-color: var(--emerald); color: var(--emerald); }

.btn-outline-red { background: transparent; border: 1px solid var(--border); color: var(--red); }
.btn-outline-red:hover { background: var(--red-dim); border-color: var(--red); color: var(--red); }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

/* ---------- Login ---------- */

.login-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; width: 100%;
    background: radial-gradient(600px 400px at 50% 0%, rgba(16,185,129,0.06), transparent 70%), var(--bg);
}
.login-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 44px 40px; width: 340px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-card .brand-mark {
    display: flex; align-items: center; gap: 9px; margin-bottom: 28px;
}
.login-card .brand-mark .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--gold));
    box-shadow: 0 0 0 4px var(--emerald-dim);
}
.login-card h1 { font-size: 1.15rem; font-weight: 700; }
.login-card p.hint { margin: 4px 0 24px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card button { width: 100%; margin-top: 4px; }

.error { color: var(--red); font-size: 0.85rem; margin-bottom: 14px; background: var(--red-dim); padding: 9px 12px; border-radius: var(--radius-sm); }
.hint { color: var(--text-dim); font-size: 0.85rem; }

.section-title {
    font-size: 0.95rem; font-weight: 600; color: var(--text);
    margin: 32px 0 14px; letter-spacing: -0.01em;
}
.section-title.gold { color: var(--gold); }

/* ---------- Misc ---------- */

details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
