/* =========================================================
   MoneyTrack - Tampilan (CSS)
   Ubah warna utama aplikasi cukup di bagian :root
   ========================================================= */
:root {
  --primary: #047857;
  --primary-dark: #065f46;
  --primary-soft: #d1fae5;
  --income: #16a34a;
  --expense: #dc2626;
  --warn: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  --app-width: 430px;
  color-scheme: light; /* aplikasi sengaja memakai tema terang */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #cbd5e1;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
body.no-scroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.app {
  max-width: var(--app-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 18px; }
.error { color: var(--expense); font-size: 13px; margin: 6px 0 10px; }

/* ---------- Tombol ---------- */
.btn {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  transition: transform .1s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #e2e8f0; }
.btn.danger { background: #fee2e2; color: var(--expense); }
.btn.outline { border: 1px solid var(--border); background: #fff; }
.link { color: var(--primary); font-weight: 600; font-size: 13px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; font-size: 22px; line-height: 1; box-shadow: var(--shadow);
}
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Form ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .filters input, .filters select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.field input:focus, .filters input:focus, .filters select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.money-input {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; background: #fff; padding-left: 12px;
}
.money-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.money-input > span { color: var(--muted); font-weight: 600; }
.field .money-input input { border: none; box-shadow: none; background: transparent; }
.money-input.big input { font-size: 24px; font-weight: 700; }

/* ---------- Halaman Masuk ---------- */
.auth { padding: 48px 24px 32px; text-align: center; min-height: 100vh; background: linear-gradient(180deg, var(--primary-soft), var(--bg) 45%); }
.auth-logo { font-size: 56px; }
.auth h1 { font-size: 28px; color: var(--primary-dark); margin: 4px 0; }
.auth-tabs { display: flex; background: #e2e8f0; border-radius: 12px; padding: 4px; margin: 28px 0 20px; }
.auth-tabs button { flex: 1; padding: 10px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.auth-form { text-align: left; }
.auth-hero { display: none; }
.notice { background: var(--primary-soft); color: var(--primary-dark); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.link-btn { display: block; margin: -6px 0 12px auto; color: var(--primary); font-weight: 600; font-size: 13px; }
.btn:disabled { opacity: .65; cursor: wait; }

/* Layar tunggu */
.loading {
  position: fixed; inset: 0; z-index: 80; background: rgba(241, 245, 249, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted);
}
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topbar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sync-state { font-size: 11.5px; color: var(--primary); font-weight: 600; }
.sync-state:empty { display: none; }
.note { margin-top: 22px; font-size: 12px; color: var(--muted); }

/* ---------- Kerangka aplikasi ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px 12px; background: var(--bg);
}
.topbar h2 { font-size: 20px; }
.content { padding: 0 16px 150px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  max-width: var(--app-width); margin: 0 auto;
  display: flex; background: #fff; border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); padding: 4px 0; border-radius: 10px; }
.bottom-nav button span { font-size: 20px; filter: grayscale(1); opacity: .7; }
.bottom-nav button.active { color: var(--primary); font-weight: 700; }
.bottom-nav button.active span { filter: none; opacity: 1; }

.fab-wrap {
  position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 11;
  max-width: var(--app-width); margin: 0 auto; padding: 0 18px;
  display: flex; justify-content: flex-end; pointer-events: none;
}
.fab {
  pointer-events: auto; width: 58px; height: 58px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 32px; line-height: 1;
  box-shadow: 0 8px 20px rgba(4, 120, 87, .4);
}
.fab:active { transform: scale(.94); }

/* ---------- Kartu ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h4 { font-size: 15px; margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.card-head h4 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.mini-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.mini-card small { color: var(--muted); font-size: 12px; display: block; }
.mini-card b { font-size: 17px; display: block; margin: 2px 0; overflow-wrap: anywhere; }
.mini-card span { font-size: 12px; color: var(--muted); }
.grid3 .mini-card { padding: 12px 10px; }
.grid3 .mini-card b { font-size: 14px; }

.hello { margin-bottom: 12px; }
.hello p { color: var(--muted); font-size: 14px; }
.hello h3 { font-size: 20px; }

.balance-card {
  background: linear-gradient(135deg, var(--primary), #0d9488);
  color: #fff; border-radius: 20px; padding: 20px; margin-bottom: 14px;
  box-shadow: 0 10px 24px rgba(4, 120, 87, .3);
}
.balance-card > span { opacity: .85; font-size: 13px; }
.balance-card > strong { display: block; font-size: 30px; margin: 2px 0 14px; overflow-wrap: anywhere; }
.balance-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance-row div { background: rgba(255, 255, 255, .15); border-radius: 12px; padding: 10px; min-width: 0; }
.balance-row small { display: block; font-size: 11.5px; opacity: .9; }
.balance-row b { font-size: 15px; overflow-wrap: anywhere; }

.banner { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.banner.info { background: #fef3c7; color: #92400e; }
.banner.danger { background: #fee2e2; color: #991b1b; }
.banner.success { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- Catat cepat ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-grid button {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.quick-grid button:active { background: var(--primary-soft); transform: scale(.96); }
.quick-grid .q-icon { font-size: 20px; }
.quick-grid .q-name { font-size: 12px; font-weight: 600; }
.quick-grid .q-amt { font-size: 11px; color: var(--muted); }

/* ---------- Progress anggaran ---------- */
.prog { margin-bottom: 14px; }
.prog:last-child { margin-bottom: 0; }
.prog-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.prog-head span:first-child { font-weight: 600; }
.prog-head span:last-child { color: var(--muted); text-align: right; }
.bar { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; border-radius: 99px; transition: width .4s; }
.fill.ok { background: var(--income); }
.fill.warn { background: var(--warn); }
.fill.over { background: var(--expense); }
.prog-foot { font-size: 12px; margin-top: 4px; }
.prog-foot.ok { color: var(--income); }
.prog-foot.warn { color: var(--warn); }
.prog-foot.over { color: var(--expense); font-weight: 600; }

/* ---------- Grafik batang ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 18px; }
.bars.dense { gap: 2px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-col .b { width: 100%; max-width: 28px; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 2px; position: relative; }
.bar-col .b.today { background: #f59e0b; }
.bar-col .b.empty { background: #e2e8f0; }
.bar-col .v { font-size: 9.5px; color: var(--muted); margin-bottom: 2px; white-space: nowrap; }
.bar-col .l { font-size: 11px; color: var(--muted); margin-top: 4px; height: 14px; }
.bars.dense .bar-col .l { font-size: 9px; }
.pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.pair .b { max-width: 14px; }
.pair .b.inc { background: var(--income); }
.pair .b.exp { background: var(--expense); }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* ---------- Daftar transaksi ---------- */
.tx-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 10px 4px; border-bottom: 1px solid #f1f5f9;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:active { background: #f8fafc; }
.tx-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tx-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amt { font-weight: 700; font-size: 14px; white-space: nowrap; }
.tx-amt.income { color: var(--income); }
.tx-amt.expense { color: var(--expense); }

.filters { margin-bottom: 10px; }
.filters input { margin-bottom: 8px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.filters select { padding: 9px 6px; font-size: 13px; }
.tx-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tx-summary div { background: #fff; border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow); min-width: 0; }
.tx-summary small { display: block; font-size: 11px; color: var(--muted); }
.tx-summary b { font-size: 13px; overflow-wrap: anywhere; }
.day-group { background: #fff; border-radius: var(--radius); padding: 6px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.day-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 8px 4px 4px; border-bottom: 1px solid #f1f5f9; }
.day-head b { color: var(--text); }

.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

/* ---------- Laporan ---------- */
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.month-nav strong { font-size: 16px; }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut { width: 130px; height: 130px; border-radius: 50%; flex-shrink: 0; position: relative; }
.donut::after { content: ""; position: absolute; inset: 26px; background: #fff; border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; font-size: 11px; text-align: center; color: var(--muted); }
.donut-center b { display: block; color: var(--text); font-size: 13px; }
.legend { flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; padding: 4px 0; gap: 6px; }
.legend-row span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-row b { white-space: nowrap; }
.insight { list-style: none; }
.insight li { padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13.5px; display: flex; gap: 10px; }
.insight li:last-child { border-bottom: none; }
.up { color: var(--expense); font-weight: 600; }
.down { color: var(--income); font-weight: 600; }

/* ---------- Profil ---------- */
.profile-head { text-align: center; padding: 10px 0 18px; }
.avatar { width: 76px; height: 76px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 32px; font-weight: 700; display: grid; place-items: center; margin: 0 auto 10px; }
.menu-list button { width: 100%; text-align: left; padding: 14px 4px; border-bottom: 1px solid #f1f5f9; display: flex; gap: 12px; align-items: center; font-weight: 500; }
.menu-list button:last-child { border-bottom: none; }
.menu-list button.danger-text { color: var(--expense); }

/* ---------- Form transaksi (bottom sheet) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s;
}
.sheet {
  width: 100%; max-width: var(--app-width); max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideUp .25s ease-out;
}
.sheet-handle { width: 44px; height: 5px; background: #cbd5e1; border-radius: 99px; margin: 0 auto 12px; }
.sheet h3 { font-size: 18px; margin-bottom: 14px; }
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; background: #f1f5f9; border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.type-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.type-toggle span { display: block; text-align: center; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.type-toggle input:checked + span { background: #fff; box-shadow: var(--shadow); }
.type-toggle input[value="expense"]:checked + span { color: var(--expense); }
.type-toggle input[value="income"]:checked + span { color: var(--income); }
.type-toggle input:focus-visible + span { outline: 2px solid var(--primary); }
.amt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.amt-chips button { padding: 6px 10px; background: #f1f5f9; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.amt-chips button:active { background: var(--primary-soft); }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-grid label { cursor: pointer; }
.cat-grid input { position: absolute; opacity: 0; pointer-events: none; }
.cat-grid span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  padding: 8px 4px; border: 2px solid var(--border); border-radius: 12px; font-size: 11.5px; font-weight: 600; min-height: 64px; justify-content: center;
}
.cat-grid span i { font-style: normal; font-size: 20px; }
.cat-grid input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.cat-grid input:focus-visible + span { outline: 2px solid var(--primary); }
.sheet-actions { display: flex; gap: 8px; margin-top: 6px; }
.sheet-actions .btn.primary { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; width: calc(100% - 32px); max-width: 398px;
  background: #0f172a; color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 13.5px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: fade .2s;
}
.toast button { color: #6ee7b7; font-weight: 700; padding: 2px 6px; white-space: nowrap; }

/* ---------- Dialog konfirmasi ---------- */
.dialog-backdrop { z-index: 70; align-items: center; padding: 16px; }
.dialog {
  width: 100%; max-width: 360px; background: #fff; border-radius: 18px; padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: slideUp .2s ease-out;
}
.dialog h3 { font-size: 17px; margin-bottom: 6px; }
.dialog p { font-size: 13.5px; margin-bottom: 12px; }
.dialog input, .dialog textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 12px; outline: none; background: #fff;
}
.dialog input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.dialog textarea { height: 140px; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; resize: vertical; white-space: pre; }
.dialog .sheet-actions .btn { flex: 1; }
.btn.danger-solid { background: var(--expense); color: #fff; }
.btn:focus-visible, .bottom-nav button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }

/* =========================================================
   TAMPILAN DESKTOP (layar lebar >= 900px)
   Menu bawah berubah jadi menu samping, isi halaman jadi 2 kolom
   ========================================================= */
.nav-brand { display: none; }

@media (min-width: 900px) {
  :root { --sidebar: 232px; }
  body { background: var(--bg); }
  .app { max-width: none; box-shadow: none; }

  /* Halaman masuk: promosi di kiri, kartu masuk di kanan */
  .auth-wrap:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
  .auth-hero {
    display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 56px 64px;
    background: linear-gradient(150deg, var(--primary-dark), var(--primary) 55%, #0d9488); color: #fff;
  }
  .hero-brand { font-weight: 800; font-size: 20px; }
  .auth-hero h1 { font-size: 42px; line-height: 1.12; max-width: 15ch; text-wrap: balance; }
  .auth-hero p { font-size: 17px; opacity: .9; max-width: 46ch; }
  .hero-points { list-style: none; display: grid; gap: 12px; margin-top: 6px; max-width: 470px; }
  .hero-points li { background: rgba(255, 255, 255, .12); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; }
  .hero-points span { opacity: .88; font-size: 14px; }
  .auth {
    align-self: center; justify-self: center; width: calc(100% - 64px); max-width: 440px; min-height: 0; margin: 40px 0;
    border-radius: 24px; background: var(--card); box-shadow: 0 10px 40px rgba(15, 23, 42, .08);
  }

  /* Menu samping */
  .bottom-nav {
    top: 0; bottom: 0; right: auto; width: var(--sidebar); max-width: none; margin: 0;
    flex-direction: column; gap: 4px; padding: 20px 14px;
    border-top: none; border-right: 1px solid var(--border);
  }
  .nav-brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: var(--primary-dark); padding: 4px 10px 22px; }
  .bottom-nav button {
    flex: none; flex-direction: row; gap: 12px; justify-content: flex-start;
    font-size: 14.5px; padding: 11px 12px; text-align: left;
  }
  .bottom-nav button:hover { background: var(--bg); }
  .bottom-nav button.active { background: var(--primary-soft); }
  .bottom-nav button span { font-size: 18px; }

  #main { margin-left: var(--sidebar); }
  .topbar { padding: 26px 36px 16px; }
  .topbar h2 { font-size: 24px; }
  .content { padding: 0 36px 110px; max-width: 1180px; }

  /* Tombol tambah: pojok kanan bawah */
  .fab-wrap { max-width: none; bottom: 32px; padding: 0 36px; }
  .fab { width: 62px; height: 62px; }
  .fab:hover { background: var(--primary-dark); }

  /* Beranda 2 kolom */
  #page-home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  #page-home > .hello, #page-home > .balance-card, #page-home > .banner { grid-column: 1 / -1; margin: 0; }
  #page-home > .grid2 { grid-column: 1 / -1; margin: 0; }
  #page-home > .card { margin: 0; }
  .balance-card { padding: 26px 30px; }
  .balance-card > strong { font-size: 38px; }
  .balance-row { max-width: 560px; }

  /* Anggaran: status di kiri, form di kanan */
  #page-budget:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  #budgetForm { margin: 0; }

  /* Laporan 2 kolom */
  #reportBody { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  #reportBody > .grid3 { grid-column: 1 / -1; margin: 0; }
  #reportBody > .card { margin: 0; }
  .month-nav { max-width: 420px; }

  /* Riwayat: filter sebaris */
  .filters { display: grid; grid-template-columns: 1.4fr 2fr; gap: 10px; }
  .filters input { margin: 0; }
  .tx-summary { max-width: 640px; }
  #txList { max-width: 820px; }

  /* Profil */
  #page-profile { max-width: 640px; }

  /* Form & dialog di tengah layar */
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 480px; border-radius: 22px; max-height: 90vh; }
  .sheet-handle { display: none; }

  .toast { left: calc(50% + var(--sidebar) / 2); bottom: 40px; }
  .quick-grid button:hover, .tx-item:hover { background: var(--bg); }
}

@media (min-width: 1280px) {
  #page-home { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
}

@media (max-width: 360px) {
  .balance-card > strong { font-size: 26px; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .filter-row select:last-child { grid-column: span 2; }
}
