/* =====================================================================
 *  Smart Family Finance — Design System (DALAM APLIKASI)
 *  Tema gelap glassmorphism, selaras dengan landing page (itomjie).
 * ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0b0b16;
    --violet: #7c3aed; --violet-2: #8b5cf6; --indigo: #4f46e5; --accent: #a78bfa;

    --text: #ffffff; --muted: rgba(255, 255, 255, .64); --muted-2: rgba(255, 255, 255, .40);
    --glass: rgba(255, 255, 255, .05); --glass-2: rgba(255, 255, 255, .09);
    --stroke: rgba(255, 255, 255, .12); --stroke-soft: rgba(255, 255, 255, .06);

    /* Alias agar inline style lama (var(--surface) dll) tetap serasi */
    --surface: rgba(255, 255, 255, .05);
    --surface-2: rgba(255, 255, 255, .08);
    --border: rgba(255, 255, 255, .12);

    --primary: #7c3aed; --primary-600: #4f46e5; --primary-50: rgba(124, 58, 237, .18);
    --income: #34d399; --income-bg: rgba(52, 211, 153, .15);
    --expense: #fb7185; --expense-bg: rgba(251, 113, 133, .15);
    --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .15);

    --radius: 16px; --radius-sm: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-md: 0 24px 60px rgba(0, 0, 0, .5);
    --grad: linear-gradient(135deg, var(--violet), var(--indigo));
    --focus: 0 0 0 3px rgba(124, 58, 237, .45);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font); background: var(--bg); color: var(--text);
    font-size: 15px; line-height: 1.5; color-scheme: dark; -webkit-font-smoothing: antialiased;
}
/* Cahaya latar khas itomjie */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(55% 45% at 12% 0%, rgba(124, 58, 237, .26), transparent 60%),
        radial-gradient(50% 45% at 92% 4%, rgba(59, 130, 246, .18), transparent 60%),
        radial-gradient(45% 40% at 82% 96%, rgba(236, 72, 153, .12), transparent 60%);
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .2em; font-weight: 700; }
.muted { color: var(--muted); }
.text-income { color: var(--income); }
.text-expense { color: var(--expense); }
.text-right { text-align: right; } .text-center { text-align: center; } .nowrap { white-space: nowrap; }

/* --------------------------- Layout --------------------------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 244px; background: rgba(10, 10, 20, .55); backdrop-filter: blur(20px);
    border-right: 1px solid var(--stroke); color: var(--muted); display: flex; flex-direction: column;
    padding: 18px 14px; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .25s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; }
.brand-logo { font-size: 28px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    background: var(--grad); box-shadow: 0 8px 20px rgba(99, 76, 224, .5); }
.brand-text strong { display: block; color: #fff; font-size: 16px; line-height: 1.1; }
.brand-text small { color: var(--muted-2); font-size: 12px; letter-spacing: .5px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1 0 auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 500; font-size: 14.5px; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--glass-2); color: #fff; }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(99, 76, 224, .4); }
.nav-ico { font-size: 18px; width: 22px; text-align: center; }
.nav-item.logout { margin-top: 8px; color: #fca5a5; }
.nav-item.logout:hover { background: rgba(251, 113, 133, .14); color: #fecaca; }

.main { flex: 1; margin-left: 244px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 66px; background: rgba(11, 11, 22, .55); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--stroke); display: flex; align-items: center; gap: 14px; padding: 0 24px;
    position: sticky; top: 0; z-index: 30;
}
.page-title { font-size: 19px; margin: 0; flex: 1; }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; background: var(--grad);
    color: #fff; display: grid; place-items: center; font-weight: 700; background-position: center; overflow: hidden;
}
.user-name { font-weight: 600; font-size: 14px; }
.content { padding: 24px; max-width: 1240px; width: 100%; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 35; }
.sidebar-backdrop.show { display: block; }

/* Fokus (keyboard / D-pad) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible { outline: none; box-shadow: var(--focus); }

/* --------------------------- Buttons -------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 16px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font-family: inherit; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: filter .15s, background .15s, transform .1s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px rgba(99, 76, 224, .4); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--glass-2); color: #fff; border-color: var(--stroke); }
.btn-ghost:hover { background: rgba(255, 255, 255, .15); }
.btn-danger { background: rgba(251, 113, 133, .16); color: #fecdd3; border-color: rgba(251, 113, 133, .45); }
.btn-danger:hover { background: rgba(251, 113, 133, .26); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-icon { padding: 7px 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------------------- Cards --------------------------------- */
.card { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius);
    box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--stroke-soft); }
.card-head h3 { margin: 0; font-size: 16px; } .card-head .spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.dash-2col { grid-template-columns: 2fr 1fr; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.page-actions .spacer { flex: 1; }

/* ------------------------- Stat cards ------------------------------- */
.stat { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); backdrop-filter: blur(12px); position: relative; overflow: hidden; }
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; margin-bottom: 12px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 800; margin-top: 2px; letter-spacing: -.5px; }
.stat-sub { font-size: 12.5px; margin-top: 6px; }
.bg-green { background: var(--income-bg); } .bg-red { background: var(--expense-bg); }
.bg-indigo { background: var(--primary-50); } .bg-amber { background: var(--warn-bg); }

/* ---------------------------- Tables -------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 12px 16px; text-align: left; }
.tbl thead th { background: rgba(255, 255, 255, .03); color: var(--muted); font-weight: 600; font-size: 12.5px;
    text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--stroke); }
.tbl tbody tr { border-bottom: 1px solid var(--stroke-soft); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .03); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cat-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 999px;
    font-size: 13px; font-weight: 600; background: var(--glass-2); border: 1px solid var(--stroke-soft); }
.badge-income { background: var(--income-bg); color: var(--income); }
.badge-expense { background: var(--expense-bg); color: var(--expense); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { background: var(--glass); border: 1px solid var(--stroke); border-radius: 8px; cursor: pointer;
    width: 32px; height: 32px; display: grid; place-items: center; font-size: 14px; color: #fff; transition: background .15s, border-color .15s; }
.icon-btn:hover { background: var(--glass-2); }
.icon-btn.danger:hover { background: var(--expense-bg); border-color: var(--expense); }

/* ----------------------------- Forms -------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .72); }
.field input, .field select, .field textarea, .input, .select {
    font-family: inherit; font-size: 14.5px; color: var(--text);
    padding: 10px 12px; border: 1px solid var(--stroke); border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .04); width: 100%; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--muted-2); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus {
    outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 58, 237, .25); }
.field select option, .select option { background: #14141f; color: #fff; }
.field input:disabled, .input:disabled { opacity: .6; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-size: 12px; color: var(--muted); }

.segment { display: inline-flex; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.segment button { border: none; background: none; padding: 8px 16px; border-radius: 8px; cursor: pointer;
    font-family: inherit; font-weight: 600; font-size: 14px; color: var(--muted); }
.segment button.active { background: var(--glass-2); color: #fff; }
.segment button.active.income { color: var(--income); } .segment button.active.expense { color: var(--expense); }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-opt { width: 38px; height: 38px; border: 1px solid var(--stroke); border-radius: 9px; background: var(--glass); font-size: 19px; cursor: pointer; }
.emoji-opt.active { border-color: var(--violet); background: var(--primary-50); }
.color-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.color-opt { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-opt.active { border-color: #fff; }

/* ----------------------------- Alerts ------------------------------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-error { background: var(--expense-bg); color: #fecdd3; border-color: rgba(251, 113, 133, .35); }
.alert-info { background: var(--primary-50); color: #ddd6fe; border-color: rgba(124, 58, 237, .35); }

/* ---------------------------- Progress ------------------------------ */
.progress { height: 9px; background: rgba(255, 255, 255, .08); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .4s; }
.progress.over > span { background: var(--expense); }

/* ----------------------------- Modal -------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(4, 4, 12, .7); backdrop-filter: blur(4px); z-index: 60;
    display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
body.modal-open { overflow: hidden; }
.modal { background: #14141f; border: 1px solid var(--stroke); border-radius: var(--radius); width: 100%; max-width: 520px;
    box-shadow: var(--shadow-md); animation: pop .18s ease; margin: auto 0; }
.modal-sm { max-width: 400px; } .modal-lg { max-width: 720px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--stroke-soft); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .close { margin-left: auto; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--stroke-soft); display: flex; justify-content: flex-end; gap: 10px; }

/* ----------------------------- Toast -------------------------------- */
.toast-box { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; background: #14141f; border: 1px solid var(--stroke);
    border-left: 4px solid var(--income); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
    font-size: 14px; font-weight: 500; min-width: 240px; max-width: 360px; color: #fff;
    transform: translateX(120%); transition: transform .3s ease; }
.toast.show { transform: translateX(0); }
.toast-error { border-left-color: var(--expense); }

/* --------------------------- Empty state ---------------------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .emoji { font-size: 46px; display: block; margin-bottom: 10px; }
.empty h3 { color: var(--text); }
.loading { text-align: center; padding: 40px; color: var(--muted); }

.item-list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--stroke-soft); }
.list-row:last-child { border-bottom: none; }
.list-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.list-main { flex: 1; min-width: 0; } .list-main .t { font-weight: 600; } .list-main .s { font-size: 12.5px; color: var(--muted); }

.goal-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.goal-card { padding: 18px; }
.goal-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.goal-amount { display: flex; justify-content: space-between; font-size: 13px; margin: 10px 0 6px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .select, .filters .input { width: auto; min-width: 130px; }

/* =====================================================================
 *  Halaman AUTH (login / daftar / verifikasi) — dark glass
 * ===================================================================== */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-wrap {
    width: 100%; max-width: 940px; display: grid; grid-template-columns: 1fr 1fr;
    background: var(--glass); border: 1px solid var(--stroke); border-radius: 26px; overflow: hidden;
    box-shadow: var(--shadow-md); backdrop-filter: blur(16px);
}
.auth-brand { background: linear-gradient(160deg, rgba(124, 58, 237, .55), rgba(79, 70, 229, .4)); padding: 46px 40px; display: flex; align-items: center; }
.auth-brand-inner { color: #fff; }
.auth-logo { font-size: 46px; margin-bottom: 14px; }
.auth-brand h1 { font-size: 26px; font-weight: 800; }
.auth-brand p { color: rgba(255, 255, 255, .82); margin: 6px 0 22px; }
.auth-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-features li { color: rgba(255, 255, 255, .9); font-size: 14.5px; }
.auth-form-side { padding: 44px 40px; display: flex; align-items: center; }
.auth-card { width: 100%; }
.auth-card h2 { font-size: 23px; font-weight: 800; }
.auth-card .muted { display: block; margin: 6px 0 18px; }
.auth-switch { margin-top: 16px; font-size: 14px; color: var(--muted); text-align: center; }
.auth-switch a { color: var(--accent); font-weight: 600; }

/* --------------------------- Utilities ------------------------------ */
.hidden { display: none !important; }
.flex { display: flex; } .items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-0 { margin-bottom: 0; } .w-full { width: 100%; }

/* --------------------------- Responsive ----------------------------- */
@media (max-width: 900px) { .cols-2, .cols-3, .dash-2col { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .auth-wrap { grid-template-columns: 1fr; max-width: 460px; } .auth-brand { display: none; } }
@media (max-width: 780px) {
    .sidebar { transform: translateX(-100%); } .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; } .hamburger { display: block; } .content { padding: 16px; }
    .user-name { display: none; } .grid-2 { grid-template-columns: 1fr; }
}
