:root {
    color-scheme: light dark;

    --bg: #f2f2f7;
    --blob-1: rgba(10, 132, 255, 0.16);
    --blob-2: rgba(100, 210, 255, 0.16);
    --blob-3: rgba(255, 159, 10, 0.10);

    --surface: rgba(255, 255, 255, 0.78);
    --surface-solid: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-highlight: rgba(255, 255, 255, 0.6);

    --primary: #007AFF;
    --accent-grad: linear-gradient(135deg, #0A84FF, #64D2FF);

    --income: #34C759;
    --expense: #FF3B30;
    --text: #1c1c1e;
    --text-muted: #8e8e93;
    --border: rgba(60, 60, 67, 0.29);
    --danger: #FF3B30;
    --warn: #FF9F0A;
    --ok: #34C759;

    --fill: rgba(60, 60, 67, 0.06);
    --fill-strong: rgba(60, 60, 67, 0.12);

    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 13px;

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.16);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #000000;
        --blob-1: rgba(10, 132, 255, 0.22);
        --blob-2: rgba(100, 210, 255, 0.14);
        --blob-3: rgba(255, 159, 10, 0.12);

        --surface: rgba(28, 28, 30, 0.78);
        --surface-solid: #1c1c1e;
        --glass-border: rgba(255, 255, 255, 0.14);
        --glass-highlight: rgba(255, 255, 255, 0.09);

        --primary: #0A84FF;
        --accent-grad: linear-gradient(135deg, #0A84FF, #64D2FF);

        --income: #30D158;
        --expense: #FF453A;
        --text: #f5f5f7;
        --text-muted: #98989d;
        --border: rgba(84, 84, 88, 0.6);
        --danger: #FF453A;
        --warn: #FF9F0A;
        --ok: #30D158;

        --fill: rgba(118, 118, 128, 0.24);
        --fill-strong: rgba(118, 118, 128, 0.36);

        --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.65);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000;
    --blob-1: rgba(10, 132, 255, 0.22);
    --blob-2: rgba(100, 210, 255, 0.14);
    --blob-3: rgba(255, 159, 10, 0.12);

    --surface: rgba(28, 28, 30, 0.78);
    --surface-solid: #1c1c1e;
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-highlight: rgba(255, 255, 255, 0.09);

    --primary: #0A84FF;
    --accent-grad: linear-gradient(135deg, #0A84FF, #64D2FF);

    --income: #30D158;
    --expense: #FF453A;
    --text: #f5f5f7;
    --text-muted: #98989d;
    --border: rgba(84, 84, 88, 0.6);
    --danger: #FF453A;
    --warn: #FF9F0A;
    --ok: #30D158;

    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.65);
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
    background: var(--bg);
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    position: relative;
    transition: background-color .3s ease, color .3s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 12% 6%, var(--blob-1), transparent 40%),
        radial-gradient(circle at 88% 14%, var(--blob-2), transparent 40%),
        radial-gradient(circle at 25% 96%, var(--blob-3), transparent 38%),
        var(--bg);
    transition: background-color .3s ease;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
input, select { font-family: inherit; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    backdrop-filter: blur(26px) saturate(180%);
    box-shadow: 0 1px 0 var(--border);
    padding: calc(var(--safe-top) + 16px) 20px 14px;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.topbar-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex-shrink: 0;
}
.topbar-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-toggle {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--fill);
    color: var(--primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, transform .15s ease;
}
.theme-toggle:active { background: var(--fill-strong); transform: scale(0.92); }

.content {
    padding: 18px 16px calc(118px + var(--safe-bottom));
    max-width: 480px;
    margin: 0 auto;
}

.card {
    background: var(--surface);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md), inset 0 1px 0 var(--glass-highlight);
    animation: fadeInUp .35s cubic-bezier(.25,.8,.35,1) both;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.card-title i { color: var(--primary); font-size: 14px; }

.section-title {
    font-size: 13px;
    font-weight: 700;
    margin: 22px 6px 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Bottom nav — floating glass capsule */
.bottomnav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + var(--safe-bottom));
    z-index: 20;
    display: flex;
    background: var(--surface);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 26px;
    padding: 8px 6px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-highlight);
}
.bottomnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0 2px;
}
.bottomnav-icon-wrap {
    width: 42px;
    height: 30px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), background .25s ease, box-shadow .25s ease;
}
.bottomnav-item i { font-size: 17px; }
.bottomnav-item.active { color: var(--primary); }
.bottomnav-item.active .bottomnav-icon-wrap {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(10, 132, 255, .38);
    transform: translateY(-2px);
}

/* Period toggle (segmented control) */
.period-toggle {
    position: relative;
    display: flex;
    background: var(--fill);
    border-radius: 14px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 4px;
}
.period-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: 0;
    background: var(--surface-solid);
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: transform .32s cubic-bezier(.34,1.56,.64,1), width .32s cubic-bezier(.34,1.56,.64,1);
    z-index: 0;
}
.period-btn {
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .2s ease;
}
.period-btn.active { color: var(--primary); font-weight: 700; }

/* Donut */
.donut-wrap {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 14px auto;
    filter: drop-shadow(0 10px 22px rgba(10, 132, 255, 0.18));
}
.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.donut-center-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.donut-center-value { font-size: 21px; font-weight: 800; margin-top: 3px; letter-spacing: -0.01em; }

.donut-legend { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; padding: 3px 4px; margin: 0 -4px; border-radius: 8px; transition: background .15s ease; }
.legend-item:active { background: var(--fill); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(127,127,127,0.06); }
.legend-name { flex: 1; color: var(--text); font-weight: 500; }
.legend-value { color: var(--text-muted); font-weight: 600; }

/* Summary grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.summary-item {
    background: var(--surface);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 15px;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp .35s cubic-bezier(.25,.8,.35,1) both;
}
.summary-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}
.summary-label i {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: var(--fill);
    color: var(--text-muted);
}
.summary-value { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.income-color { background: color-mix(in srgb, var(--income) 16%, transparent) !important; color: var(--income) !important; }
.expense-color { background: color-mix(in srgb, var(--expense) 16%, transparent) !important; color: var(--expense) !important; }

/* Hero balance */
.hero-balance {
    background: var(--accent-grad);
    color: #fff;
    position: relative;
    overflow: hidden;
    border: none;
}
.hero-balance::before, .hero-balance::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    pointer-events: none;
}
.hero-balance::before { width: 180px; height: 180px; top: -90px; right: -50px; }
.hero-balance::after { width: 120px; height: 120px; bottom: -70px; left: -30px; background: rgba(255,255,255,0.10); }
.hero-balance-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.hero-balance-label {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 7px;
}
.hero-balance-toggle {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 14px;
    transition: background .15s ease, transform .15s ease;
}
.hero-balance-toggle:active { background: rgba(255, 255, 255, 0.32); transform: scale(0.92); }
.hero-balance-value {
    position: relative;
    z-index: 1;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 12px;
    font-variant-numeric: tabular-nums;
}
.hero-balance-caption {
    position: relative;
    z-index: 1;
    font-size: 12px;
    opacity: 0.85;
    margin: 6px 0 0;
}

/* Donut interaction hint */
.donut-hint { text-align: center; margin: 2px 0 4px; }

/* Kontribusi per pelaku */
.kontribusi-list { display: flex; flex-direction: column; gap: 4px; }
.kontribusi-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.kontribusi-item:last-child { border-bottom: none; }
.kontribusi-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kontribusi-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.kontribusi-nama { font-size: 14px; font-weight: 700; }
.kontribusi-detail { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 8px; }
.kontribusi-detail .income-color-text { color: var(--income); font-weight: 600; }
.kontribusi-detail .expense-color-text { color: var(--expense); font-weight: 600; }
.kontribusi-net { font-size: 14px; font-weight: 800; white-space: nowrap; }

/* Progress */
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--fill);
    border-radius: 8px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 8px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress-fill.status-ok { background: var(--ok); }
.progress-fill.status-warn { background: var(--warn); }
.progress-fill.status-over { background: var(--danger); }
.progress-percent { font-size: 13px; font-weight: 800; color: var(--text); min-width: 40px; text-align: right; }
.progress-caption { font-size: 12.5px; color: var(--text-muted); margin: 9px 0 0; font-weight: 500; }
.hint-text { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }

/* Alokasi rows */
.alokasi-row { margin-bottom: 16px; }
.alokasi-row:last-child { margin-bottom: 0; }
.alokasi-row-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; font-weight: 500; }

/* Buttons */
.btn {
    border: none;
    border-radius: 16px;
    padding: 13px 18px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(10, 132, 255, .32); }
.btn-primary:active { box-shadow: 0 3px 10px rgba(10, 132, 255, .28); }
.btn-secondary { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.btn-secondary:active { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.btn-block { width: 100%; margin-top: 10px; }
.btn-logout-fixed {
    width: 100%;
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    border: none;
    margin-bottom: 8px;
}

/* FAB */
.fab {
    position: fixed;
    right: 20px;
    bottom: calc(100px + var(--safe-bottom));
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 21px;
    box-shadow: 0 12px 26px rgba(10, 132, 255, .4), inset 0 1px 0 rgba(255,255,255,.4);
    z-index: 15;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.fab:active { transform: scale(0.92); }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: none;
    align-items: flex-end;
    z-index: 30;
}
.modal.open { display: flex; }
.modal-sheet {
    background: var(--surface);
    -webkit-backdrop-filter: blur(26px) saturate(180%);
    backdrop-filter: blur(26px) saturate(180%);
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 28px 28px 0 0;
    padding: 12px 20px calc(20px + var(--safe-bottom));
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25), inset 0 1px 0 var(--glass-highlight);
    animation: sheetUp .35s cubic-bezier(.32,.72,0,1);
    border: 1px solid var(--glass-border);
    border-bottom: none;
}
@keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-handle {
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: var(--fill-strong);
    margin: 6px auto 14px;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-header h2 { font-size: 18px; margin: 0; font-weight: 800; }
.modal-close {
    background: var(--fill);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 14px;
    color: var(--text-muted);
}

.modal-form { display: flex; flex-direction: column; gap: 6px; }
.modal-form label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 8px; }
.modal-form input, .modal-form select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    font-size: 15px;
    background: var(--fill);
    color: var(--text);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.modal-form input:focus, .modal-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.tipe-toggle { display: flex; gap: 10px; margin-bottom: 6px; }
.tipe-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.tipe-option:has(input:checked) {
    border-color: var(--primary);
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.tipe-option input { accent-color: var(--primary); }

/* Transaksi list */
.transaksi-list { list-style: none; margin: 0; padding: 0; }
.transaksi-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}
.transaksi-item:last-child { border-bottom: none; }
.transaksi-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.transaksi-icon.income { background: color-mix(in srgb, var(--income) 16%, transparent); color: var(--income); }
.transaksi-icon.expense { background: color-mix(in srgb, var(--expense) 16%, transparent); color: var(--expense); }
.transaksi-icon.tabungan { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.transaksi-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.transaksi-kategori { font-size: 14px; font-weight: 700; }
.transaksi-meta { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaksi-nominal { font-size: 14px; font-weight: 800; white-space: nowrap; }
.transaksi-nominal.income { color: var(--income); }
.transaksi-nominal.expense { color: var(--expense); }
.transaksi-nominal.tabungan { color: var(--primary); }
.transaksi-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 10px;
    transition: background .15s ease;
}
.transaksi-delete:active { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

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

/* Target */
.target-card-header { display: flex; align-items: center; justify-content: space-between; }
.target-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 10px;
    transition: background .15s ease;
}
.target-delete:active { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* Settings */
.settings-list { list-style: none; margin: 0 0 12px; padding: 0; }
.settings-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.settings-list li:last-child { border-bottom: none; }
.settings-list-name { flex: 1; font-weight: 500; }
.input-persen {
    width: 58px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px;
    text-align: center;
    background: var(--fill);
    color: var(--text);
    font-weight: 700;
}
.icon-btn { background: none; border: none; color: var(--text-muted); padding: 8px; border-radius: 10px; transition: background .15s ease; }
.icon-btn:active { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.inline-form { display: flex; gap: 8px; }
.inline-form input, .inline-form select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    font-size: 14px;
    background: var(--fill);
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.saran-list { margin: 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.saran-list li {
    position: relative;
    padding: 12px 14px 12px 16px;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.alert { padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; font-weight: 600; }
.alert-error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* Login page */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
    position: relative;
}
.login-theme-toggle {
    position: fixed;
    top: calc(16px + var(--safe-top));
    right: 16px;
}
.login-card {
    background: var(--surface);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 36px 26px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-highlight);
    animation: fadeInUp .4s cubic-bezier(.25,.8,.35,1) both;
}
.login-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: block;
    object-fit: cover;
    margin: 0 auto 16px;
    box-shadow: 0 10px 24px rgba(10, 132, 255, .32);
}
.login-card h1 { font-size: 21px; margin: 0 0 4px; font-weight: 800; letter-spacing: -0.01em; }
.login-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 22px; }
.login-form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-form label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.login-form input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px;
    font-size: 15px;
    background: var(--fill);
    color: var(--text);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* Dompet */
.dompet-grid { display: flex; flex-direction: column; gap: 2px; }
.dompet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.dompet-item:last-child { border-bottom: none; }
.dompet-nama { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.dompet-saldo { font-size: 15px; font-weight: 800; }

/* Event */
.event-flyer {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
}
.event-flyer-detail { aspect-ratio: 16 / 10; }
.event-card { display: block; cursor: pointer; }
.event-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.event-card-top .card-title { margin-bottom: 0; flex: 1; min-width: 0; }
.badge { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.badge-berjalan { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge-selesai { background: var(--fill); color: var(--text-muted); }
.event-card-sisa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.event-card-sisa strong { font-size: 15px; }

.event-action-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.event-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.event-mini-row:last-child { border-bottom: none; }
.event-mini-nama { display: block; font-size: 14px; font-weight: 700; }

/* Upload bukti */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
    cursor: pointer;
}
.upload-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}
.ocr-status {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 6px 2px 0;
    min-height: 14px;
}
.ocr-status.ocr-loading {
    color: var(--primary);
}
.ocr-status.ocr-loading::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--primary);
    animation: ocrPulse 1s ease-in-out infinite;
}
@keyframes ocrPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}
.bukti-thumb-link { flex-shrink: 0; }
.bukti-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Laporan event (print-friendly) */
.laporan-header { text-align: center; margin-bottom: 20px; }
.laporan-header h1 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 6px; }
.laporan-header h2 { font-size: 20px; margin: 0 0 6px; }
.laporan-header p { font-size: 13px; color: var(--text-muted); margin: 2px 0; }
.laporan-section-title { font-size: 14px; font-weight: 700; margin: 20px 0 10px; }

.laporan-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
    margin: 18px 0 4px;
}
.laporan-stat {
    background: var(--fill);
    border-radius: var(--radius-sm);
    padding: 10px 8px;
    text-align: center;
}
.laporan-stat-label { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.laporan-stat-value { display: block; font-size: 13px; font-weight: 800; word-break: break-word; }

.laporan-rows { display: flex; flex-direction: column; }
.laporan-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.laporan-row:last-child { border-bottom: none; }
.laporan-row-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.laporan-row-date { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.laporan-row-keterangan { font-size: 13.5px; font-weight: 600; word-break: break-word; }
.laporan-row-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.laporan-row-nominal { font-size: 13.5px; font-weight: 800; white-space: nowrap; }

.laporan-total-akhir {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid var(--text);
    font-size: 15px;
    font-weight: 700;
}
.laporan-total-akhir strong { font-size: 19px; }
.laporan-footer { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 24px; }

@media print {
    .topbar, .bottomnav, .fab, .no-print { display: none !important; }
    .content { padding: 0 !important; max-width: 100% !important; }
    body::before { display: none !important; }
    .laporan-print-area {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border: none !important;
        backdrop-filter: none !important;
    }
    .laporan-print-area .laporan-stat { background: #f2f2f7 !important; }
    .laporan-print-area .laporan-row,
    .laporan-print-area .laporan-total-akhir { border-color: #ccc !important; }
    .laporan-print-area .laporan-header p,
    .laporan-print-area .laporan-row-date,
    .laporan-print-area .laporan-stat-label,
    .laporan-print-area .laporan-footer { color: #666 !important; }
}
