/* ==========================================================================
   Asadel Company — Keuangan Rumah Tangga
   Presentation layer only (UI/UX).

   This file contains no data, no API calls and no business logic.
   It styles the existing pages of the app:
     - public/index.html     (Beranda — menu utama)
     - public/anggaran.html  (Anggaran Belanja Bulanan)
     - public/tabungan.html  (Tabungan)
     - public/transaksi.html (Tambah Transaksi)
     - public/laporan.html   (Laporan Keuangan)
     - public/login.html     (Masuk)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
    /* Surfaces */
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;

    /* Text */
    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    /* Lines */
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Brand — emerald green */
    --primary: #16a34a;
    --primary-hover: #15803d;
    --primary-dark: #14532d;
    --primary-soft: #ecfdf5;
    --primary-soft-border: rgba(22, 163, 74, 0.18);
    --primary-ring: rgba(22, 163, 74, 0.16);

    /* Status */
    --income: #15803d;
    --income-soft: #ecfdf5;
    --expense: #b91c1c;
    --expense-soft: #fef2f2;
    --warning: #92400e;
    --warning-soft: #fffbeb;
    --warning-border: #fde68a;

    /* Radius */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px -14px rgba(15, 23, 42, 0.16);
    --shadow-dock: 0 16px 40px -22px rgba(15, 23, 42, 0.3), 0 1px 2px rgba(15, 23, 42, 0.06);

    /* Typography */
    --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Layout */
    --shell: 880px;
    --gutter: 16px;
    --dock-space: calc(112px + env(safe-area-inset-bottom, 0px));
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    -webkit-text-size-adjust: 100%;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
dl,
dd,
figure {
    margin: 0;
}

h1,
h2,
h3 {
    line-height: 1.25;
    letter-spacing: -0.02em;
}

a {
    color: var(--primary-hover);
}

svg {
    display: block;
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Screen-reader only helper */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   3. App shell
   -------------------------------------------------------------------------- */

.app {
    width: 100%;
    max-width: var(--shell);
    margin: 0 auto;
    padding: 22px var(--gutter) var(--dock-space);
}

.app--narrow {
    max-width: 760px;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.brand-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background-color: var(--primary-dark);
    background-image: linear-gradient(150deg, #16a34a 0%, #14532d 70%);
    color: #ffffff;
    box-shadow: 0 12px 24px -16px rgba(20, 83, 45, 0.9);
}

.brand-mark svg {
    width: 22px;
    height: 22px;
}

.brand-text {
    min-width: 0;
    flex: 1 1 auto;
}

.brand-name {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-title {
    margin-top: 3px;
    font-size: clamp(1.3rem, 5.4vw, 1.65rem);
    font-weight: 750;
    letter-spacing: -0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   4. Layout blocks
   -------------------------------------------------------------------------- */

.dashboard {
    display: grid;
    gap: 18px;
}

.dashboard-col {
    display: grid;
    gap: 18px;
    align-content: start;
    min-width: 0;
}

.section {
    margin-top: 24px;
}

.dashboard-col > .section,
.dashboard-col > .section:first-child {
    margin-top: 0;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 2px 10px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.section-note {
    margin: 10px 2px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */

.card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.card-subtitle {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Balance / hero card ---------------------------------------------------- */

.card--balance {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border: 0;
    background-color: var(--primary-dark);
    background-image:
        radial-gradient(115% 130% at 100% 0%, rgba(34, 197, 94, 0.34) 0%, rgba(34, 197, 94, 0) 58%),
        linear-gradient(150deg, #166534 0%, #14532d 62%);
    color: #ffffff;
    box-shadow: 0 22px 44px -30px rgba(20, 83, 45, 0.95);
}

.balance-label {
    display: block;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.balance-amount {
    margin-top: 8px;
    font-size: clamp(1.9rem, 9vw, 2.45rem);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.035em;
    line-height: 1.05;
}

.balance-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-pill);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.4;
}

.balance-note svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
}

/* Statistic cards -------------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

/* Report totals: two cards per row on mobile, the third spans full width */
.stat-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-grid--three > :nth-child(3) {
    grid-column: 1 / -1;
}

.card--stat {
    display: grid;
    gap: 10px;
    align-content: start;
    padding: 15px;
}

.stat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.stat-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
}

.stat-icon svg {
    width: 16px;
    height: 16px;
}

.stat-icon--income {
    background: var(--income-soft);
    color: var(--income);
}

.stat-icon--expense {
    background: var(--expense-soft);
    color: var(--expense);
}

.stat-icon--neutral {
    background: var(--surface-muted);
    color: var(--text-soft);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 650;
}

.stat-amount {
    font-size: clamp(1.05rem, 4.8vw, 1.25rem);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

.stat-amount--income {
    color: var(--income);
}

.stat-amount--expense {
    color: var(--expense);
}

.card--stat.is-total {
    background: var(--surface-muted);
}

/* --------------------------------------------------------------------------
   6. Definition rows (period summary / totals)
   -------------------------------------------------------------------------- */

.rows {
    display: grid;
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.row:first-child {
    padding-top: 2px;
}

.row:last-child {
    padding-bottom: 2px;
    border-bottom: 0;
}

.row-label {
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 600;
}

.row-value {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.row-value--income {
    color: var(--income);
}

.row-value--expense {
    color: var(--expense);
}

.row--total {
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    border-bottom: 0;
}

.row--total .row-label {
    color: var(--text);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   7. Chips & badges
   -------------------------------------------------------------------------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: var(--primary-soft);
    border: 1px solid var(--primary-soft-border);
    border-radius: var(--radius-pill);
    color: var(--primary-dark);
    font-size: 0.73rem;
    font-weight: 650;
    white-space: nowrap;
}

.chip--muted {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   8. Transaction list
   -------------------------------------------------------------------------- */

.txn-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.txn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
}

.txn:first-child {
    padding-top: 2px;
}

.txn:last-child {
    padding-bottom: 2px;
    border-bottom: 0;
}

.txn-media {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: var(--surface-muted);
    border-radius: 12px;
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 700;
}

.txn-body {
    flex: 1;
    min-width: 0;
}

.txn-title {
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.txn-meta {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.txn-amount {
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.txn-amount--income {
    color: var(--income);
}

.txn-amount--expense {
    color: var(--expense);
}

/* --------------------------------------------------------------------------
   9. Empty states
   -------------------------------------------------------------------------- */

.empty-state {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 30px 20px 32px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 2px;
    background: var(--primary-soft);
    border-radius: 50%;
    color: var(--primary-hover);
}

.empty-icon svg {
    width: 24px;
    height: 24px;
}

.empty-title {
    font-size: 0.98rem;
    font-weight: 700;
}

.empty-text {
    max-width: 34ch;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.empty-action {
    margin-top: 14px;
}

/* --------------------------------------------------------------------------
   10. Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

.btn svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
}

.btn--primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 12px 24px -18px rgba(22, 163, 74, 0.95);
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--block {
    display: flex;
    width: 100%;
}

.btn:active {
    transform: translateY(1px);
}

.quick-action {
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   11. Forms
   -------------------------------------------------------------------------- */

.form {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field-label {
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.field-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.input,
.select,
.textarea {
    width: 100%;
    min-width: 0;
    padding: 13px 14px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.input {
    min-height: 50px;
}

.textarea {
    min-height: 112px;
    line-height: 1.55;
    resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-faint);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--border-strong);
}

.input:focus,
.input:focus-visible,
.select:focus,
.select:focus-visible,
.textarea:focus,
.textarea:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.select {
    min-height: 50px;
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2364748b'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='m6%209%206%206%206-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 17px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.input[type="date"] {
    cursor: pointer;
}

.input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.55;
    cursor: pointer;
}

.input[type="date"]:hover::-webkit-calendar-picker-indicator {
    opacity: 0.9;
}

/* Prominent amount field ------------------------------------------------- */

.amount-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition:
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.amount-field:hover {
    border-color: var(--border-strong);
}

.amount-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.amount-prefix {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.amount-input {
    flex: 1;
    min-width: 0;
    padding: 12px 0;
    background: transparent;
    border: 0;
    color: var(--text);
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    outline: none;
}

.amount-input::placeholder {
    color: var(--text-faint);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0;
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.amount-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Inline feedback (styled output of the existing script) ----------------- */

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--warning-soft);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-md);
    color: var(--warning);
    font-size: 0.85rem;
    line-height: 1.55;
}

.notice:empty {
    display: none;
}

/* --------------------------------------------------------------------------
   12. Bottom navigation (mobile-first)
   -------------------------------------------------------------------------- */

.bottom-nav {
    position: fixed;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: min(calc(100% - 24px), 460px);
    padding: 6px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    box-shadow: var(--shadow-dock);
    transform: translateX(-50%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 6px 4px;
    border-radius: 15px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}

.bottom-nav a svg {
    width: 21px;
    height: 21px;
}

.bottom-nav a:hover {
    background: var(--surface-muted);
    color: var(--primary-dark);
}

.bottom-nav a:active {
    transform: scale(0.985);
}

.bottom-nav a[aria-current="page"] {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* --------------------------------------------------------------------------
   13. Responsive — tablet
   -------------------------------------------------------------------------- */

@media (min-width: 700px) {

    :root {
        --gutter: 24px;
    }

    .app {
        padding-top: 32px;
    }

    .app-header {
        margin-bottom: 24px;
    }

    .card {
        padding: 22px;
    }

    .card--balance {
        padding: 26px;
    }

    .balance-note {
        margin-top: 18px;
        font-size: 0.78rem;
    }

    .section-head {
        margin-bottom: 12px;
    }

    .empty-state {
        padding: 38px 24px 40px;
    }

    .stat-grid--three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stat-grid--three > :nth-child(3) {
        grid-column: auto;
    }

    .bottom-nav {
        width: min(calc(100% - 32px), 420px);
    }
}

/* --------------------------------------------------------------------------
   14. Responsive — desktop (two column dashboard)
   -------------------------------------------------------------------------- */

@media (min-width: 960px) {

    .app {
        padding-top: 40px;
    }

    .dashboard {
        grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
        gap: 16px;
        align-items: start;
    }

    .dashboard-col {
        gap: 16px;
    }

    /* In the left rail the two statistic cards stack vertically */
    .dashboard .stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .txn-title {
        font-size: 0.95rem;
    }
}

/* --------------------------------------------------------------------------
   15. Preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* --------------------------------------------------------------------------
   16. Login & session UI
   -------------------------------------------------------------------------- */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px var(--gutter);
    background:
        radial-gradient(120% 80% at 50% -10%, rgba(22, 163, 74, 0.08) 0%, rgba(22, 163, 74, 0) 60%),
        var(--bg);
}

.auth-wrap {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    padding: 30px 24px 26px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-sm);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
}

.auth-title {
    text-align: center;
    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.auth-subtitle {
    margin: 6px 0 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.auth-foot {
    margin-top: 18px;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.75rem;
}

.form-error {
    padding: 11px 13px;
    background: var(--expense-soft);
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: var(--expense);
    font-size: 0.85rem;
    line-height: 1.45;
}

.form-error[hidden] {
    display: none;
}

/* Header: user chip + logout --------------------------------------------- */

.app-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
}

.user-name {
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 650;
    white-space: nowrap;
}

.logout-btn {
    min-height: 40px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 650;
    cursor: pointer;
    transition:
        background-color 0.16s ease,
        color 0.16s ease,
        border-color 0.16s ease;
}

.logout-btn:hover {
    background: var(--surface-muted);
    color: var(--text);
    border-color: var(--border-strong);
}

/* Compact header on small screens: hide the user name */
@media (max-width: 479px) {

    .user-name {
        display: none;
    }

    .user-chip {
        padding-right: 4px;
    }
}

/* --------------------------------------------------------------------------
   17. Beranda — menu tiles, summary group
   -------------------------------------------------------------------------- */

/* The first section under the header needs no extra top margin */
main > .section:first-child {
    margin-top: 0;
}

/* Quick action placed directly inside <main> */
main > .quick-action {
    margin-top: 22px;
}

.menu-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.menu-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 84px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    color: var(--text);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

.menu-card:hover {
    border-color: var(--primary-soft-border);
    box-shadow: var(--shadow-sm);
}

.menu-card:active {
    transform: translateY(1px);
}

.menu-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-hover);
}

.menu-icon svg {
    width: 23px;
    height: 23px;
}

.menu-body {
    flex: 1 1 auto;
    min-width: 0;
}

.menu-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.menu-desc {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.menu-arrow {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    color: var(--text-faint);
    transition: color 0.18s ease;
}

.menu-arrow svg {
    width: 16px;
    height: 16px;
}

.menu-card:hover .menu-arrow {
    color: var(--primary);
}

/* Chip used as an inline link */
.chip--link {
    text-decoration: none;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease;
}

.chip--link:hover {
    background: #dcfce7;
    border-color: rgba(22, 163, 74, 0.32);
}

/* Balance card grouped together with the statistic cards */
.summary {
    display: grid;
    gap: 12px;
    min-width: 0;
}

/* Tablet: kartu menu input berdampingan dua kolom */
@media (min-width: 700px) {

    .menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    /* Jumlah menu ganjil: kartu terakhir melebar penuh agar tidak menggantung. */
    .menu-grid > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .menu-card {
        min-height: 96px;
        padding: 20px;
    }
}

/* Desktop: balance card and statistic cards share one row */
@media (min-width: 960px) {

    .summary {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
        align-items: start;
    }

    .summary .stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* ==================== Komponen list dinamis (dirender oleh JS) ==================== */

.btn--sm {
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.btn--danger {
    background: var(--expense-soft);
    border-color: rgba(185, 28, 28, 0.22);
    color: var(--expense);
}

.btn--danger:hover,
.btn--danger:focus-visible {
    background: var(--expense);
    border-color: var(--expense);
    color: #ffffff;
}

.anggaran-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    margin-bottom: 10px;
}

.anggaran-info {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.anggaran-info strong {
    font-size: 0.92rem;
    letter-spacing: -0.01em;
}

.anggaran-info span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.kategori-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    margin-bottom: 10px;
}

.kategori-teks {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.kategori-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.kategori-nama {
    font-size: 0.9rem;
    font-weight: 600;
}

.kategori-angka {
    color: var(--text-soft);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}


/* --------------------------------------------------------------------------
   18. Back button & daftar tabungan
   -------------------------------------------------------------------------- */

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    /* margin-left negatif menyejajarkan ikon chevron dengan tepi konten,
       karena padding kiri tombol lebih kecil dari gutter halaman. */
    margin: -2px 0 16px -5px;
    padding: 5px 9px 5px 5px;
    background-color: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        background-color 0.16s ease,
        color 0.16s ease;
}

.back-btn svg {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
}

.back-btn:hover,
.back-btn:focus-visible {
    background-color: var(--surface-muted);
    color: var(--text);
}

.back-btn:active {
    color: var(--primary-dark);
}

/* `.back-btn` adalah inline-level box, jadi margin-nya tidak collapse dengan
   sibling berikut. Section yang langsung mengikutinya sudah punya margin-top
   24px; dinolkan supaya jaraknya seragam 16px seperti halaman ber-card. */
main > .back-btn + .section {
    margin-top: 0;
}

.chip--income {
    background: var(--income-soft);
    border-color: rgba(21, 128, 61, 0.18);
    color: var(--income);
}

.chip--expense {
    background: var(--expense-soft);
    border-color: rgba(185, 28, 28, 0.18);
    color: var(--expense);
}

.textarea--sm {
    min-height: 76px;
}

.tabungan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    margin-bottom: 10px;
}

.tabungan-info {
    display: grid;
    gap: 5px;
    justify-items: start;
    min-width: 0;
    flex: 1 1 auto;
}

.tabungan-info strong {
    font-size: 0.92rem;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.tabungan-catatan {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.tabungan-kanan {
    display: grid;
    justify-items: end;
    gap: 9px;
    flex: 0 0 auto;
}

.tabungan-nominal {
    font-size: 0.92rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tabungan-nominal--masuk {
    color: var(--income);
}

.tabungan-nominal--keluar {
    color: var(--expense);
}


/* --------------------------------------------------------------------------
   19. Sub menu laporan (tab)
   -------------------------------------------------------------------------- */

.subnav {
    display: flex;
    /* Jangan pernah memotong label: kalau tidak muat, tab turun ke baris berikut. */
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
}

.subnav-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: 0 14px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--text-soft);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}

/* Empat label tidak muat satu baris di ponsel: susun 2x2 agar semuanya terlihat
   tanpa perlu digeser. Di atas 420px kembali satu baris. */
@media (max-width: 420px) {

    .subnav {
        border-radius: var(--radius-lg);
    }

    .subnav-btn {
        flex: 1 1 calc(50% - 4px);
    }
}

.subnav-btn:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.subnav-btn.is-active {
    background: var(--primary);
    color: #ffffff;
}

.subnav-btn.is-active:hover {
    background: var(--primary-hover);
    color: #ffffff;
}

