:root {
    --bg: #0B0F14;
    --surface: #121821;
    --surface-2: #1A222E;
    --surface-3: #232E3C;
    --outline: #2C3A4B;
    --accent: #00E5A0;
    --info: #3DA9FC;
    --warn: #FFB020;
    --danger: #FF5C5C;
    --purple: #7C5CFF;
    --text: #E9EEF5;
    --muted: #9AA7B8;
    --dim: #5E6B7C;
    --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 18px; }

input, select, textarea {
    background: var(--surface-2); border: 1px solid var(--outline); color: var(--text);
    border-radius: 10px; padding: 11px 13px; font-size: 14px; outline: none; width: 100%;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label.field { display: block; }
label.field > span { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; }

button {
    cursor: pointer; border: none; border-radius: 10px; padding: 11px 16px;
    font-size: 14px; font-weight: 600; transition: filter .15s, background .15s;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-ghost { background: var(--surface-3); color: var(--text); }
.btn-outline { background: transparent; color: var(--muted); border: 1px solid var(--outline); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,92,92,.4); }
.full { width: 100%; }

/* ---------- gate ---------- */
.gate { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.gate-card {
    background: var(--surface); border: 1px solid var(--outline); border-radius: 18px;
    padding: 30px; width: 100%; max-width: 420px;
}
.gate-card h1 { margin: 0 0 4px; color: var(--accent); font-size: 26px; }
.gate-card .field { margin-top: 16px; }
.gate-card button { margin-top: 20px; }

/* ---------- shell ---------- */
.topbar {
    display: flex; align-items: center; gap: 14px; padding: 12px 18px;
    background: var(--surface); border-bottom: 1px solid var(--outline);
    position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.brand { color: var(--accent); font-weight: 800; letter-spacing: .3px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 9px; }
.tabs button:hover { background: var(--surface-2); }
.tabs button.active { background: var(--surface-3); color: var(--accent); }
.spacer { flex: 1; }
.view { padding: 20px; max-width: 1180px; margin: 0 auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- KPIs ---------- */
.section-title { color: var(--dim); text-transform: uppercase; letter-spacing: .6px; font-size: 12px; font-weight: 700; margin: 24px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.kpi {
    background: var(--surface-2); border: 1px solid var(--outline); border-radius: var(--radius);
    padding: 18px; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); opacity: .8; }
.kpi.info::before { background: var(--info); }
.kpi.warn::before { background: var(--warn); }
.kpi.purple::before { background: var(--purple); }
.kpi.danger::before { background: var(--danger); }
.kpi .label { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.kpi .value { font-size: 28px; font-weight: 800; margin-top: 6px; }
.kpi .cap { color: var(--muted); font-size: 13px; margin-top: 2px; }

.card { background: var(--surface-2); border: 1px solid var(--outline); border-radius: var(--radius); padding: 18px; }
.bar { background: var(--surface-3); border-radius: 8px; height: 12px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, rgba(0,229,160,.55), var(--accent)); border-radius: 8px; }
.prog-row { margin: 14px 0; }
.prog-row .top { display: flex; justify-content: space-between; }

/* ---------- chips ---------- */
.chip { display: inline-block; padding: 4px 11px; border-radius: 50px; font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ---------- data list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.rec {
    background: var(--surface-2); border: 1px solid var(--outline); border-radius: var(--radius);
    padding: 14px 16px; display: flex; align-items: center; gap: 14px; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.rec:hover { border-color: var(--accent); background: var(--surface-3); }
.rec .main { flex: 1; min-width: 0; }
.rec .title { font-weight: 700; font-size: 15px; }
.rec .meta { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.rec .right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.rec .amount { font-weight: 800; color: var(--accent); }
.empty { color: var(--dim); text-align: center; padding: 40px; }

/* ---------- modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
    align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
    background: var(--surface); border: 1px solid var(--outline); border-radius: 18px;
    width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--outline); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head .x { background: transparent; color: var(--muted); font-size: 20px; padding: 4px 10px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 16px 20px; display: flex; gap: 10px; border-top: 1px solid var(--outline); position: sticky; bottom: 0; background: var(--surface); }
.modal-foot .btn-primary { flex: 1; }

.toast {
    position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
    background: var(--surface-3); color: var(--text); padding: 11px 18px; border-radius: 12px;
    border: 1px solid var(--outline); z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}

@media (max-width: 560px) {
    .topbar { gap: 8px; padding: 10px 12px; }
    .view { padding: 14px; }
    .tabs button { padding: 7px 10px; font-size: 13px; }
}
