/* ============================================================
   ExpenseFlow — application stylesheet
   ============================================================ */

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --primary-bg: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #4f46e5;
    --radius: 10px;
    --card-bg: #ffffff;
    --text-secondary: #64748b;
    --hover: #f8fafc;
    --shadow: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, .12);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-soft: #1e1b4b;
    --primary-bg: #1e1b4b;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;
    --sidebar-bg: #020617;
    --sidebar-text: #94a3b8;
    --sidebar-active: #6366f1;
    --card-bg: #1e293b;
    --text-secondary: #94a3b8;
    --hover: #253449;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .2);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, .4);
}



/* ── Notification dropdown ────────────────────────────────────── */
.notification-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: .5rem;
    width: 360px; max-height: 420px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    z-index: 50; display: none;
}
.notification-dropdown.show { display: block; }
.notification-dropdown .nd-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: .9rem;
}
.notification-dropdown .nd-item {
    display: flex; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border);
    font-size: .88rem; transition: background .15s;
}
.notification-dropdown .nd-item:last-child { border-bottom: none; }
.notification-dropdown .nd-item:hover { background: var(--bg); }
.notification-dropdown .nd-item.unread { background: var(--primary-soft); }
.notification-dropdown .nd-icon {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .95rem;
}
.notification-dropdown .nd-body { flex: 1; min-width: 0; }
.notification-dropdown .nd-msg { line-height: 1.4; }
.notification-dropdown .nd-time { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }
.notification-dropdown .nd-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: .9rem; }

/* Theme toggle button */
.theme-toggle {
    border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
    width: 38px; height: 38px; font-size: 1.1rem; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.theme-toggle:hover { background: var(--bg); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.theme-option { transition: border-color .15s, background .15s; }
.theme-option:hover { background: var(--bg) !important; }
.theme-option:active { transform: scale(0.97); }
.theme-option:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }

.muted { color: var(--text-muted); }
.small { font-size: .85em; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------------------------------------ layout */

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

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .2px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: .95rem;
    flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: .5rem .75rem 1rem; overflow-y: auto; }

.nav-section {
    margin: 1.1rem .5rem .35rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .55rem .8rem;
    margin: 2px 0;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: .93rem;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-link-btn { font-family: inherit; }

.sidebar-footer { padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .08); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .4rem .75rem;
}

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}

.avatar-sm { width: 30px; height: 30px; font-size: .8rem; }

.sidebar-user-meta { min-width: 0; }
.sidebar-user-name { color: #fff; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .75rem; color: #64748b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}

.page-title { font-size: 1.2rem; font-weight: 700; margin: 0; flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.icon-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    width: 38px; height: 38px;
    font-size: 1rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { background: var(--bg); }

.content { padding: 1.5rem; flex: 1; }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-narrow { max-width: 720px; }

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

.card-title { font-size: 1.02rem; font-weight: 700; margin: 0; }

.card-body { padding: 1.25rem; }

.card-footer { padding: .8rem 1.25rem; border-top: 1px solid var(--border); }

.card-divider { border-top: 1px solid var(--border); margin: 1.1rem 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }

.chart-body { padding: 1rem 1.25rem .75rem; }

/* ------------------------------------------------------------- stats */

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
}

.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.stat-value { font-size: 1.55rem; font-weight: 800; margin: .25rem 0; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .82rem; color: var(--text-muted); }

/* ------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }

.table th {
    text-align: left;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    padding: .7rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    white-space: nowrap;
}

.table td { padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }

.empty-cell { text-align: center; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); }

.table-actions { display: flex; gap: .35rem; justify-content: flex-end; align-items: center; }

.user-cell { display: flex; align-items: center; gap: .6rem; }

/* ------------------------------------------------------------ buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .95rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: .9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    line-height: 1.2;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
[data-theme="dark"] .btn-danger { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .btn-danger:hover { background: #7f1d1d; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: .3rem .6rem; font-size: .8rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .5rem; }

.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------- forms */

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: .84rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-control {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

textarea.form-control { resize: vertical; }

.form-control-sm { padding: .3rem .55rem; font-size: .85rem; width: auto; }

select.form-control { cursor: pointer; }

.form-hint { font-size: .8rem; color: var(--text-muted); margin: .3rem 0 0; }

.field-error { color: var(--danger); font-size: .82rem; margin: .3rem 0 0; }

.form-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }

.checkbox-row { display: flex; align-items: center; gap: .55rem; margin: .3rem 0; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.checkbox-row label { margin: 0; font-weight: 500; }

.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 4rem; }

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    padding: .3rem .5rem;
    border-radius: 6px;
}

.password-toggle:hover { background: var(--primary-soft); }

.color-input-wrap { display: flex; gap: .5rem; align-items: center; }
.color-input { width: 52px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.color-hex { flex: 1; }

.inline-form { display: inline-flex; gap: .35rem; align-items: center; }

.budget-form { gap: .4rem; }
.budget-input { width: 110px; }

.rate-form { gap: .4rem; flex-wrap: wrap; }
.rate-form .symbol-input { width: 58px; }
.rate-form .rate-input { width: 96px; }

/* ------------------------------------------------------------- badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary-dark);
    white-space: nowrap;
}

.badge-success { background: #ecfdf5; color: #047857; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-danger { background: #fef2f2; color: #b91c1c; }
.badge-info { background: #f0f9ff; color: #0369a1; }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }
.badge-admin { background: #f5f3ff; color: #6d28d9; }
.badge-book { background: #ecfeff; color: #0e7490; }
[data-theme="dark"] .badge-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: #451a03; color: #fde68a; }
[data-theme="dark"] .badge-danger { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-info { background: #0c4a6e; color: #7dd3fc; }
[data-theme="dark"] .badge-muted { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .badge-admin { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .badge-book { background: #083344; color: #67e8f9; }

/* A full-width spacer row between book groups in the daily-book report */
.table tr.book-divider td {
    padding: 0;
    border-top: 2px dashed var(--border);
    border-bottom: 2px dashed var(--border);
    background: var(--bg);
    line-height: 2px;
}

/* ── Comprehensive dark mode overrides ─────────────────────────── */
[data-theme="dark"] .form-control { background: var(--bg); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(129,140,248,.2); }
[data-theme="dark"] .page-link { background: var(--surface); color: var(--text); }
[data-theme="dark"] .page-link.current { background: var(--primary); color: #fff; }
[data-theme="dark"] .btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn-ghost:hover { background: var(--border); color: var(--text); }
[data-theme="dark"] .table th { background: var(--surface); }
[data-theme="dark"] .table tbody tr:hover { background: var(--surface); }
[data-theme="dark"] code { background: var(--surface); }
[data-theme="dark"] .badge { background: var(--primary-soft); color: var(--primary); }
[data-theme="dark"] .progress { background: var(--border); }
[data-theme="dark"] .stat-card { background: var(--surface); }
[data-theme="dark"] .cat-card { background: var(--surface); }
[data-theme="dark"] .auth-body { background: linear-gradient(160deg, #1e1b4b 0%, #0f172a 55%, #1e293b 100%); }
[data-theme="dark"] .auth-card { background: var(--surface); }
[data-theme="dark"] .filter-bar { background: var(--surface); }
[data-theme="dark"] .sidebar-backdrop.show { background: rgba(0, 0, 0, .7); }
[data-theme="dark"] .error-detail { background: var(--surface); }
[data-theme="dark"] .amount.income-amount, [data-theme="dark"] .income-amount { color: #34d399; }
[data-theme="dark"] .expense-amount { color: #f87171; }
[data-theme="dark"] .amount { color: var(--text); }
[data-theme="dark"] .token-display { background: #0f172a; color: #a5f3fc; }
[data-theme="dark"] .color-input { background: var(--bg); }
[data-theme="dark"] .support-bell { color: var(--text-muted); }

/* ------------------------------------------------------------- alerts */

.alert {
    padding: .8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: .92rem;
    border: 1px solid transparent;
}

.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
[data-theme="dark"] .alert-success { background: #052e16; border-color: #065f46; color: #6ee7b7; }
[data-theme="dark"] .alert-error { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .alert-info { background: #0c4a6e; border-color: #075985; color: #7dd3fc; }
[data-theme="dark"] .alert-warning { background: #451a03; border-color: #78350f; color: #fde68a; }

.alert-list { margin: .35rem 0 0; padding-left: 1.1rem; }

/* ---------------------------------------------------------- pagination */

.pagination { display: flex; gap: .3rem; flex-wrap: wrap; }

.page-link {
    min-width: 32px;
    padding: .3rem .55rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-align: center;
    font-size: .85rem;
    text-decoration: none;
}

.page-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-link.current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.page-link.disabled { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------ progress */

.progress {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    min-width: 90px;
    margin-bottom: .2rem;
}

.progress-bar { height: 100%; border-radius: 999px; background: var(--success); transition: width .4s ease; }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.ok { background: var(--success); }

/* ------------------------------------------------------------- charts */

.chart { width: 100%; height: auto; max-height: 300px; }

.donut-row { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.donut-chart { width: 210px; flex-shrink: 0; }

.legend { flex: 1; min-width: 180px; }

.legend-item { display: flex; align-items: center; gap: .5rem; padding: .28rem 0; font-size: .88rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.legend-name { flex: 1; }
.legend-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- filter */

.filter-bar { padding: 1rem 1.25rem .25rem; }
.filter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; align-items: end; }
.filter-actions .btn-row { padding-bottom: .5rem; }
.filter-actions label { visibility: hidden; }

.export-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* ------------------------------------------------------------ category */

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

.cat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    background: var(--surface);
}

.cat-card-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.cat-dot { width: 12px; height: 12px; }
.cat-name { font-weight: 700; flex: 1; }
.cat-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-muted); margin-bottom: .8rem; }
.cat-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.merge-form select { max-width: 130px; }

/* --------------------------------------------------------------- auth */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eef2ff 0%, #f1f5f9 55%, #f8fafc 100%);
    padding: 1.5rem;
}

.auth-wrap { width: 100%; max-width: 420px; }

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 1.9rem 1.9rem 1.5rem;
}

.auth-title { font-size: 1.25rem; margin-bottom: .35rem; }
.auth-subtitle { color: var(--text-muted); font-size: .92rem; margin-bottom: 1.1rem; }

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 1.1rem;
    font-size: .88rem;
}

.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .8rem; color: var(--text-muted); }

/* ------------------------------------------------------------ errors */

.error-box { text-align: center; padding: .75rem 0; }

.error-code {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: .6rem;
}

.error-box h1 { font-size: 1.3rem; margin-bottom: .5rem; }
.error-box p { color: var(--text-muted); }

.error-detail {
    background: var(--bg);
    padding: .75rem;
    border-radius: 8px;
    font-size: .75rem;
    text-align: left;
    overflow-x: auto;
    margin: 1rem 0;
}

/* ----------------------------------------------------------- env list */

.env-list { display: grid; gap: .6rem; margin: 0 0 1rem; }
.env-list div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--border); padding-bottom: .45rem; }
.env-list dt { color: var(--text-muted); }
.env-list dd { margin: 0; font-weight: 600; text-align: right; }

/* --------------------------------------------------------- responsive */

@media (max-width: 1100px) {
    .filter-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
        width: 260px;
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .5);
        z-index: 35;
    }

    .icon-btn { display: inline-flex; }
    .stat-grid, .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .content { padding: 1rem; }
    .topbar { padding: .7rem 1rem; }
    .stat-grid, .stat-grid-4, .filter-grid { grid-template-columns: 1fr; }
    .filter-actions .btn-row { padding-bottom: .25rem; }
    .donut-chart { width: 100%; display: flex; justify-content: center; }
}

/* ---------------------------------------------------------- income styles */
.amount.income-amount, .income-amount { color: #047857; }
.expense-amount { color: #b91c1c; }
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin: 1.5rem 0 .6rem;
}
.section-heading h2 { font-size: 1.15rem; margin: 0; color: var(--text); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; width: 100%; }
.tab-row { flex-wrap: wrap; }
.tab-row .btn { border-radius: 999px; }

/* ---------------------------------------------------- profile API tokens */
.form-inline { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin: 0; }
.form-inline .form-group label { margin-bottom: .3rem; }
.token-display {
    display: block;
    margin: .6rem 0;
    padding: .55rem .8rem;
    background: #0f172a;
    color: #a5f3fc;
    border-radius: 6px;
    font-size: .9rem;
    word-break: break-all;
}
.empty-state { color: var(--text-muted); font-size: .95rem; padding: .75rem 0; }

/* ── Virus Scanner dark mode ───────────────────────────────── */
[data-theme="dark"] .scanner-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .btn-scan { background: #6d28d9; color: #f5f3ff; }
[data-theme="dark"] .btn-scan:hover { background: #7c3aed; }
[data-theme="dark"] .quarantine-file { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .25); }
