:root {
    --bg:            #0f172a;
    --surface:       #1e293b;
    --surface-2:     #273549;
    --border:        #334155;
    --accent:        #6366f1;
    --accent-light:  #818cf8;
    --text:          #e2e8f0;
    --muted:         #94a3b8;
    --success:       #10b981;
    --danger:        #ef4444;
    --warning:       #f59e0b;
    --radius:        10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: inherit; }

/* ── Navbar ── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 58px;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1.15rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    white-space: nowrap;
}

.navbar-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.nav-link:hover  { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); background: var(--surface-2); }

/* ── Main content ── */
.content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary   { background: var(--accent);    color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--accent-light); }

.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent-light); }

.btn-danger    { background: var(--danger);    color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }

label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input, select, textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
input[type="date"]  { color-scheme: dark; }
textarea { resize: vertical; min-height: 72px; }

/* ── Amount colors ── */
.amount-positive { color: var(--success); font-weight: 600; }
.amount-negative { color: var(--danger);  font-weight: 600; }
.amount-zero     { color: var(--muted); }

/* ── List items ── */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.list-item:last-child { border-bottom: none; }

/* ── Tabs ── */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.6rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s;
}
.tab.active    { color: var(--accent);  border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }

/* ── Page header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; }

/* ── Auth ── */
.auth-container {
    max-width: 420px;
    margin: 4rem auto;
    padding: 0 1rem;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.auth-title {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.4rem;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-subtitle {
    text-align: center;
    color: var(--muted);
    margin-bottom: 1.75rem;
    font-size: 0.9rem;
}

/* ── Alerts ── */
.alert {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.35);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.35); color: #6ee7b7; }

/* ── Loading / empty ── */
.loading     { text-align: center; color: var(--muted); padding: 3rem; }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-state h3 { margin-bottom: 0.4rem; color: var(--text); font-size: 1.1rem; }

/* ── Avatar ── */
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* ── Grid ── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

/* ── Back link ── */
.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1.25rem;
}
.back-link:hover { color: var(--text); }

/* ── Split preview ── */
.split-preview {
    background: var(--surface-2);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin-top: 0.5rem;
}
.split-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.88rem;
}

/* ── Balance rows ── */
.balance-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.balance-row:last-child { border-bottom: none; }

/* ── Category badge ── */
.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--surface-2);
    color: var(--muted);
}

/* ── Section heading ── */
.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .content      { padding: 1rem; }
    .page-header  { flex-direction: column; align-items: flex-start; }
    .navbar       { gap: 0.75rem; padding: 0 1rem; }
    .navbar-links { gap: 0; }
}
