:root {
  --bg: #667eea;
  --bg-grad: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card: #ffffff;
  --ink: #2b2d42;
  --muted: #8d99ae;
  --brand: #5d7290;        /* slate-blue (GAS primary/tab aktif) */
  --brand-d: #4a5d78;      /* slate lebih gelap untuk hover */
  --brand-accent: #667eea; /* periwinkle untuk aksen bar/progress */
  --green: #2a9d8f;
  --red: #e63946;
  --blue: #457b9d;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(40, 30, 80, .15);
  --shadow-soft: 0 4px 16px rgba(40, 30, 80, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Google Sans", "Roboto", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card {
  background: var(--card); width: 100%; max-width: 400px; padding: 38px 34px;
  border-radius: 24px; box-shadow: 0 18px 50px rgba(30, 20, 70, .35); text-align: center;
}
.auth-card h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; padding: 11px; border: none; background: #eef0f6; border-radius: 12px;
  font-size: 15px; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--brand); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
input, select, textarea {
  font-family: inherit; font-size: 15px; padding: 12px 14px;
  border: 1.5px solid #e2e5ee; border-radius: 12px; background: #fbfcfe; color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(102,126,234,.15); }

/* ---------- buttons ---------- */
.btn {
  border: none; border-radius: 50px; padding: 11px 20px; font-size: 15px; font-weight: 600;
  transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(93,114,144,.35); }
.btn.primary:hover { background: var(--brand-d); }
.btn.ghost { background: #eef0f6; color: var(--ink); }
.btn.ghost:hover { background: #e2e5ee; }
.btn.small { padding: 7px 14px; font-size: 13px; border-radius: 50px; }
.btn.xs { padding: 5px 11px; font-size: 12px; border-radius: 50px; line-height: 1.2; }
.btn.icon { flex: 0 0 auto; padding: 0 16px; font-size: 22px; font-weight: 700; line-height: 1; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
/* tombol + hijau bulat (Pemasukan / Pengeluaran) */
.btn.add-plus { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 24px; font-weight: 700; line-height: 1; background: #2ecc71; color: #fff; box-shadow: 0 4px 14px rgba(46,204,113,.35); display: inline-flex; align-items: center; justify-content: center; }
.btn.add-plus:hover { background: #27ae60; }
/* Setup Akun: Nama + Bank + Saldo Awal + tombol dalam satu baris (laptop/tablet) */
.add-row.ar-akun { flex-wrap: nowrap; }
.add-row.ar-akun > input#a-name { flex: 1 1 160px; min-width: 0; }
.add-row.ar-akun > select#a-type { flex: 0 0 130px; min-width: 0; }
.add-row.ar-akun > input#a-open { flex: 1 1 140px; min-width: 0; }
.add-row.ar-akun > .btn.icon { flex: 0 0 auto; }
/* Setup Pengeluaran Tetap: Nama + Grup + Jumlah + Akun + tombol dalam satu baris (laptop/tablet) */
.add-row.ar-fs { flex-wrap: nowrap; }
.add-row.ar-fs > input#fs-name { flex: 1 1 160px; min-width: 0; }
.add-row.ar-fs > select#fs-group { flex: 0 0 130px; min-width: 0; }
.add-row.ar-fs > input#fs-amt { flex: 0 0 120px; min-width: 0; }
.add-row.ar-fs > select#fs-acc { flex: 0 1 150px; min-width: 0; }
.add-row.ar-fs > .btn.icon { flex: 0 0 auto; }
/* baris tambah: input fleksibel + tombol ikon di samping */
.add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 14px; }
.add-row > input { flex: 1 1 120px; min-width: 0; }
.add-row > select { flex: 0 1 auto; min-width: 0; }
.add-row > .btn.icon { flex: 0 0 auto; }
/* input tanggal/ bulan: tampilan konsisten rounded di semua ukuran */
input[type="date"], input[type="month"] {
  -webkit-appearance: none; appearance: none;
  background: #fff; border: 1px solid #dfe3ee; border-radius: 12px;
  padding: 9px 12px; font: inherit; color: var(--ink); box-sizing: border-box;
}
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
.btn.danger { background: #ffe3e5; color: var(--red); }
.btn.danger:hover { background: #ffd2d6; }
/* filter pengeluaran — satu baris kompak */
.tx-filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -4px 0 14px; padding: 8px 12px;
  background: #f6f7fb; border: 1px solid #eef0f6; border-radius: 14px;
}
.tx-filter-bar .tx-filter-title { font-weight: 700; font-size: 14px; color: var(--ink); margin-right: 2px; }
.tx-filter-bar input[type="date"], .tx-filter-bar select {
  padding: 6px 10px; font-size: 13px; border: 1px solid #dfe3ec; border-radius: 10px; background: #fff; color: var(--ink); font-family: inherit;
}
.tx-filter-bar input[type="date"] { width: auto; }
.tx-filter-bar select { max-width: 170px; }
.btn.green { background: #ddf3ef; color: var(--green); }
.btn.ok { background: #e6f4ea; color: var(--green); }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 22px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px); box-shadow: var(--shadow-soft); position: sticky; top: 0; z-index: 5;
}
.brand { font-size: 20px; font-weight: 700; }
.top-setup-btn { background: none; border: none; padding: 6px; cursor: pointer; color: var(--muted); display: flex; align-items: center; border-radius: 8px; }
.top-setup-btn:hover { background: #f0f2f6; }
.top-setup-btn .top-ico svg { width: 20px; height: 20px; }
.spacer { flex: 1; }
.user { color: var(--muted); font-weight: 600; cursor: pointer; }
.month-picker { display: flex; align-items: center; gap: 6px; }
.month-input { width: auto; }

.nav {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 22px 0;
  max-width: 1100px; margin: 0 auto;
}
.nav-btn {
  border: none; background: rgba(255,255,255,.75); border-radius: 50px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; color: #4a5570; box-shadow: var(--shadow-soft);
}
.nav-btn.active { background: var(--brand); color: #fff; }
.nav-btn .nav-ico { display: inline-flex; align-items: center; margin-right: 6px; vertical-align: middle; }
.nav-btn .nav-ico svg { width: 18px; height: 18px; }
.nav-btn[data-view="account"] { display: none; }

/* --- Total Wealth tile (desktop) --- */
.wealth-tile { background: linear-gradient(135deg, #a8e6cf, #d4edda); border-radius: 16px; padding: 18px 22px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; color: #2d6a4f; box-shadow: 0 2px 10px rgba(40,52,90,.06); }
.wealth-label { font-size: 15px; font-weight: 600; opacity: .85; }
.wealth-amount { font-size: 26px; font-weight: 700; }

main { padding: 22px; max-width: 1100px; margin: 0 auto; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 22px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .cols-3 { grid-template-columns: 1fr; } }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* group list (clean rows) */
.group-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.group-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #fbfcfe; border: 1px solid #eef0f6; border-radius: 12px; padding: 9px 12px; }
.group-list li.empty { justify-content: center; color: var(--muted); background: transparent; border-style: dashed; font-size: 13px; }
.group-list .g-name { font-size: 15px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-list .g-actions { display: flex; gap: 6px; flex-shrink: 0; }
.group-list .g-actions .btn { padding: 5px 11px; font-size: 13px; line-height: 1; }
.cat-label { margin: 14px 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

/* overview spacing: jarak antara baris atas (tiles) dan baris bawah (cards) */
.overview-top { margin-bottom: 22px; }
@media (max-width: 860px) { .overview-top { margin-bottom: 16px; } }
.tile { background: #fbfcfe; border: 1.5px solid #eef0f6; border-radius: 14px; padding: 16px; box-shadow: var(--shadow-soft); }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.tile.good .value { color: var(--green); }
.tile.bad .value { color: var(--red); }
.tile.warn .value { color: var(--brand-d); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eef0f6; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* weekly bars */
.week-row { display: grid; grid-template-columns: 70px 1fr 90px; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar { height: 18px; background: #eef0f6; border-radius: 10px; overflow: hidden; position: relative; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-accent); border-radius: 10px; }
.bar.over > span { background: var(--red); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.survival { background: #ffe8d6; color: #bc6c25; }
.pill.optional { background: #cdeac0; color: #386641; }
.pill.culture { background: #d6e2e9; color: #3d5a80; }
.pill.extra { background: #ffe5ec; color: #c9184a; }

/* grouping per-tanggal di daftar pengeluaran — SATU table, lebar kolom konsisten */
.tx-list { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.tx-list td { padding: 9px 12px; border-bottom: 1px solid #eef0f6; vertical-align: middle; }
.tx-list tr:last-child td { border-bottom: none; }
.tx-group-head td { padding: 0; border: none; }
.tx-group-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 6px; padding: 8px 14px;
  background: linear-gradient(135deg, rgba(102,126,234,.12), rgba(118,75,162,.12));
  border-left: 4px solid var(--brand); border-radius: 12px;
}
.tx-group-date { font-weight: 700; font-size: 15px; color: var(--ink); }
.tx-group-meta { font-size: 13px; color: var(--muted); font-weight: 600; }
.tx-group-total { font-weight: 700; color: var(--brand-d); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; margin-bottom: 12px; }
.form-label-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.msg { margin-top: 12px; font-size: 14px; min-height: 18px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }
.muted { color: var(--muted); }
.right { text-align: right; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(40, 30, 80, .45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: var(--card); border-radius: 22px; padding: 26px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(30, 20, 70, .4); max-height: 90vh; overflow: auto; }
.modal-box h3 { margin: 0 0 16px; font-weight: 700; }
.modal-box .form-row { grid-template-columns: 1fr; }

/* charts */
.chart-wrap { margin-top: 10px; }
.barh { display: grid; grid-template-columns: 90px 1fr 100px; align-items: center; gap: 10px; margin-bottom: 8px; }
.barh .bl { color: var(--muted); font-size: 13px; }
.barh .bt { height: 22px; background: #eef0f6; border-radius: 11px; overflow: hidden; }
.barh .bt > span { display: block; height: 100%; border-radius: 11px; background: var(--brand-accent); }
.barh .bv { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; }
.year-card { background:#fbfcfe; border:1.5px solid #eef0f6; border-radius:14px; padding:16px; cursor:pointer; box-shadow: var(--shadow-soft); }
.year-card:hover { border-color: var(--brand-accent); }
.year-card .ym { font-weight:700; }
.year-card .yn { font-size:20px; font-weight:700; margin-top:6px; }
.year-card.good .yn { color: var(--green); }
.year-card.bad .yn { color: var(--red); }
a.muted { color: var(--muted); }

/* ---- section description ---- */
.section-desc { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.section-desc b { color: var(--ink); font-weight: 600; }

/* ---- tutorial ---- */
.tut-list { display: flex; flex-direction: column; gap: 12px; }
.tut-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px; background: #fbfcfe; border: 1px solid #eef0f6; border-radius: 14px; }
.tut-num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.tut-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--ink); }
.tut-desc { font-size: 14px; color: var(--muted); line-height: 1.55; }
.tut-desc b { color: var(--ink); font-weight: 600; }

/* ---- saved accounts (quick switch) ---- */
.remember { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin: 2px 0 4px; user-select: none; }
.remember input { width: 16px; height: 16px; accent-color: var(--brand); }
.saved-accounts { margin-top: 16px; border-top: 1px dashed #e2e6ef; padding-top: 14px; }
.sa-label { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.sa-item { display: flex; gap: 8px; margin-bottom: 8px; }
.sa-btn { flex: 1; text-align: left; padding: 11px 14px; border-radius: 12px; border: 1px solid #e2e6ef; background: #fff; color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.sa-btn:hover { border-color: var(--brand); background: #f5f6fd; }
.sa-del { flex: 0 0 auto; width: 42px; border-radius: 12px; border: 1px solid #f3d4d4; background: #fff5f5; color: var(--red); cursor: pointer; font-size: 14px; }
.sa-del:hover { background: #ffecec; }

/* --- DASHBOARD (hero + tabungan) --- */
.dash-hero { background: linear-gradient(135deg, #a8e6cf 0%, #d4edda 100%); color: #2d6a4f; border-radius: 20px; padding: 22px 20px; margin: 6px 0 16px; }
.hero-label { font-size: 13px; opacity: .9; font-weight: 500; }
.hero-bal { font-size: 30px; font-weight: 700; margin: 4px 0 14px; letter-spacing: .3px; }
.hero-row { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero-stat { font-size: 13px; opacity: .92; display: inline-flex; align-items: center; gap: 6px; }
.hero-stat b { font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-inc { background: #9bffd0; }
.dot-exp { background: #ffce9b; }
.dash-save { margin-bottom: 16px; }
.dash-save h2 { font-size: 15px; margin: 0 0 12px; }
.save-item { margin-bottom: 14px; }
.save-item:last-child { margin-bottom: 0; }
.save-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.save-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.save-amt { font-size: 13px; font-weight: 700; color: var(--brand); }
.save-bar { height: 9px; border-radius: 6px; background: #eef1f7; overflow: hidden; }
.save-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg,#28a06b,#1f8f7d); }
.save-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* --- Profil --- */
.profile-card { max-width: 460px; margin: 0 auto; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 4px; background: var(--brand); color: #fff; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.danger-text { color: var(--red); border-color: #f3d4d4; }
.danger-text:hover { background: #fff5f5; }
/* toast notifikasi */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #2b3550; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(20,28,46,.25); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #e74c3c; }

/* mobile app shell: default tersembunyi, baru muncul di @media HP */
.nav-toggle, .mobile-bar, .mobile-fab-menu, .nav-backdrop { display: none; }

/* ============================================================
   MOBILE — iPhone maksimal, tanpa elemen kepotong / zoom
   Tabel lebar berubah jadi kartu bertumpuk (label : nilai).
   ============================================================ */
@media (max-width: 640px) {
  /* --- topbar rapi & tidak berdesakan --- */
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px 10px; }
  .brand { font-size: 17px; }
  .spacer { display: none; }
  .user { font-size: 13px; margin-left: auto; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #logout { padding: 8px 14px; font-size: 14px; }
  .month-picker { order: 5; width: 100%; justify-content: center; }
  .month-input { flex: 1; min-width: 0; }

  /* --- nav: wrap 2 baris, semua tab kelihatan tanpa geser --- */
  .nav { flex-wrap: wrap; overflow: visible; padding: 12px 14px 4px; gap: 6px; justify-content: center; }
  .nav-btn { flex: 0 0 auto; padding: 9px 13px; font-size: 12.5px; }

  /* --- ruang & kartu lebih padat --- */
  main { padding: 14px; }
  .card { padding: 16px; border-radius: 14px; margin-bottom: 14px; }
  .card h2 { font-size: 16px; }

  /* --- grid & tiles --- */
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .tile { padding: 13px; }
  .tile .value { font-size: 19px; }

  /* --- form input jadi satu kolom penuh --- */
  .form-row { grid-template-columns: 1fr; }
  .add-row { flex-direction: column; align-items: stretch; }
  .add-row > input, .add-row > select { flex: 1 1 auto; width: 100%; }
  .add-row > .btn.icon { width: 100%; padding: 11px; font-size: 18px; border-radius: 12px; }
  /* Akun setup: HP stack ke bawah (terlalu sempit kalau 1 baris); laptop/tablet tetap 1 baris (lihat base .add-row.ar-akun) */
  .add-row.ar-akun { flex-direction: column; align-items: stretch; flex-wrap: wrap; }
  .add-row.ar-akun > input#a-name,
  .add-row.ar-akun > select#a-type,
  .add-row.ar-akun > input#a-open { flex: 1 1 auto; width: 100%; }
  .add-row.ar-akun > .btn.icon { width: 100%; padding: 11px; font-size: 18px; border-radius: 12px; height: 44px; }
  /* Setup Pengeluaran Tetap HP: stack ke bawah */
  .add-row.ar-fs { flex-direction: column; align-items: stretch; flex-wrap: wrap; }
  .add-row.ar-fs > input#fs-name,
  .add-row.ar-fs > select#fs-group,
  .add-row.ar-fs > input#fs-amt,
  .add-row.ar-fs > select#fs-acc { flex: 1 1 auto; width: 100%; }
  .add-row.ar-fs > .btn.icon { width: 100%; padding: 11px; font-size: 18px; border-radius: 12px; height: 44px; }

  /* input tanggal native di HP: rounded, full-width, gak kotak/boxy */
  input[type="date"], input[type="month"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; max-width: none; box-sizing: border-box;
    background: #fff; border: 1px solid #dfe3ee; border-radius: 12px;
    padding: 11px 12px; font: inherit; color: var(--ink);
  }
  input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }

  /* --- filter pengeluaran HP: grid 2 kolom rapi, full-width --- */
  .tx-filter-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; }
  .tx-filter-bar .tx-filter-title { grid-column: 1 / -1; }
  .tx-filter-bar > input[type="date"],
  .tx-filter-bar > select { width: 100%; max-width: none; min-width: 0; }
  .tx-filter-bar .muted { display: none; }
  .tx-filter-bar .btn.xs { grid-column: 1 / -1; width: 100%; padding: 9px; font-size: 13px; }

  /* --- TABEL DATA jadi kartu bertumpuk (label : nilai) --- */
  table.stack-mobile, table.stack-mobile tbody, table.stack-mobile tr, table.stack-mobile td { display: block; width: 100%; }
  table.stack-mobile thead { display: none; }
  table.stack-mobile tr { background: #fbfcfe; border: 1px solid #eef0f6; border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  table.stack-mobile td { border: none; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  table.stack-mobile td:not(:last-child) { border-bottom: 1px dashed #eef0f6; }
  table.stack-mobile td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 13px; text-align: left; flex: 0 0 auto; }
  table.stack-mobile td.row-actions { justify-content: flex-end; }
  table.stack-mobile td.row-actions::before { content: attr(data-label); margin-right: auto; }
  table.stack-mobile .muted[colspan] { text-align: center; }

  /* --- daftar pengeluaran (tx-list) jadi kartu bertumpuk --- */
  .tx-list { table-layout: auto; }
  .tx-list colgroup { display: none; }
  .tx-list, .tx-list tbody, .tx-list tr, .tx-list td { display: block; width: 100%; }
  .tx-list tr:not(.tx-group-head) { background: #fbfcfe; border: 1px solid #eef0f6; border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .tx-list tr:not(.tx-group-head) td { border: none; padding: 6px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .tx-list tr:not(.tx-group-head) td:not(:last-child) { border-bottom: 1px dashed #eef0f6; }
  .tx-list tr:not(.tx-group-head) td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 13px; text-align: left; flex: 0 0 auto; }
  .tx-list td.row-actions { justify-content: flex-end; }
  .tx-list .tx-group-head { background: none; border: none; padding: 0; margin: 0; }
  .tx-list .tx-group-head td { padding: 0; }
  .tx-list .tx-group-head td::before { display: none; }
  .tx-group-row { flex-wrap: wrap; gap: 4px; }

  /* aksi (edit/hapus) tombol sedikit lebih besar biar mudah ditekan */
  .row-actions .btn, .g-actions .btn { padding: 7px 12px; font-size: 14px; }

  /* --- MOBILE APP SHELL: bottom bar + FAB (pattern app syg) --- */
  .nav-toggle { display: inline-flex; order: -1; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: none; border-radius: 50%;
    background: rgba(255,255,255,.25); color: #fff; font-size: 20px; cursor: pointer; border: 1px solid rgba(255,255,255,.3); }
  .nav { display: none; }
  .nav.open { display: flex; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 60;
    flex-direction: column; flex-wrap: nowrap; justify-content: center; gap: 10px; padding: 24px;
    background: #fff; overflow-y: auto; }
  .nav.open .nav-btn { flex: 0 0 auto; width: 100%; padding: 16px; font-size: 16px; text-align: left; }
  .nav.open .nav-btn[data-view="account"] { display: flex; }
  .nav-backdrop { display: none; }
  .nav-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(20,28,46,.45); z-index: 55; }
  /* sembunyikan menu atas bulan/user di HP (ganti oleh bottom bar + topbar ramping) */
  .topbar .month-picker, .topbar .spacer, .topbar .user, #logout { display: none; }
  .topbar { position: sticky; top: 0; z-index: 40; background: #fff; box-shadow: 0 1px 0 #eef0f6; }
  /* beri ruang bawah biar konten gak ketutup bottom bar (FAB menu bisa lebih tinggi) */
  main { padding-bottom: 100px; }

  /* bottom bar melayang */
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: none; height: 78px; z-index: 50;
    background: #fff; border-top: 1px solid #e6e9f2; border-radius: 0;
    box-shadow: 0 -4px 18px rgba(40,52,90,.12);
    align-items: stretch; justify-content: space-around; padding: 0; }
  .mb-btn { flex: 1 1 0; border: none; background: transparent; border-radius: 0;
    font-size: 22px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); padding: 6px 2px; min-width: 0; }
  .mb-btn .mb-lbl { font-size: 11px; font-weight: 600; line-height: 1; color: inherit; }
  .mb-btn .mb-ico { font-size: 24px; line-height: 1; }
  .mb-btn .mb-ico svg { width:22px; height:22px; }
  .mb-btn.active { color: var(--brand); }
  /* FAB tengah melayang, lebih tinggi dari bar */
  .mb-fab { flex: 0 0 auto; width: 60px; height: 60px; margin: 0 4px; margin-top: -16px; border: none; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: 24px; font-weight: 300; line-height: 1; cursor: pointer;
    box-shadow: 0 6px 18px rgba(93,114,144,.5); display: flex; align-items: center; justify-content: center; transition: transform .15s ease; }
  .mb-fab svg { width:24px; height:24px; }
  .mb-fab.open { transform: rotate(45deg); }
  /* menu FAB melayang ke atas */
  .mobile-fab-menu { display: none; }
  .mobile-fab-menu.open { display: flex; position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px;
    width: calc(100% - 36px); max-width: 440px; z-index: 49; flex-direction: column; gap: 10px; align-items: stretch; }
  .fab-item { padding: 14px 18px; border: none; border-radius: 16px; background: #fff; box-shadow: 0 4px 16px rgba(40,52,90,.18);
    font-size: 15px; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; display:flex; align-items:center; gap:8px; }
  .fab-item .mb-ico svg { width:20px; height:20px; vertical-align:middle; }

  /* dashboard grid (Hello! + nama + ikon) */
  .dash { padding: 20px 4px 8px; }
  .dash-actions { display: flex; gap: 8px; margin-bottom: 14px; }
  .dash-action { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; backdrop-filter: blur(4px); }
  .dash-action .dash-ico-sm svg { width:20px; height:20px; }
  .dash-greet { font-size: 26px; font-weight: 700; color: #fff; }
  .dash-name { font-size: 18px; font-weight: 600; color: rgba(255,255,255,.85); margin-bottom: 22px; }
  .dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .dash-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
  .dash-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 18px 8px; background: #fff; border: 1px solid #eef0f6; border-radius: 16px; cursor: pointer; box-shadow: 0 2px 8px rgba(40,52,90,.05); }
  .dash-card:active { transform: scale(.97); }
  .dash-ico { font-size: 28px; }
  .dash-ico svg { width:32px; height:32px; }
  .dash-lbl { font-size: 13px; font-weight: 600; color: var(--ink); }
}

/* --- Pricing & Account --- */
.pricing-wrap { max-width: 800px; margin: 0 auto; padding: 12px 4px; }
.pricing-header { text-align: center; margin-bottom: 18px; }
.pricing-header h2 { font-size: 22px; margin: 0 0 6px; }
.usage-bar { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; justify-content: center; }
.usage-item { display: flex; align-items: center; gap: 8px; font-size: 13px; background: #fff; padding: 8px 14px; border-radius: 12px; box-shadow: 0 1px 4px rgba(40,52,90,.08); }
.usage-label { font-weight: 600; color: var(--ink); min-width:50px; }
.usage-bar-track { width: 80px; height: 6px; background: #eef0f6; border-radius: 4px; overflow: hidden; }
.usage-fill { height: 100%; background: var(--brand); border-radius: 4px; }
.usage-count { font-weight: 700; color: var(--muted); min-width: 40px; text-align: right; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan-card { background: #fff; border: 1px solid #eef0f6; border-radius: 16px; padding: 20px 16px; text-align: center; box-shadow: 0 2px 8px rgba(40,52,90,.05); position: relative; }
.plan-card.featured { border-color: var(--brand); box-shadow: 0 4px 20px rgba(93,114,144,.2); }
.plan-card.current { border-color: var(--green); background: #f4fbf7; }
.plan-badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 12px; border-radius: 10px; letter-spacing: .5px; }
.plan-name { font-size: 18px; font-weight: 700; margin: 6px 0 10px; color: var(--ink); }
.plan-price { font-size: 26px; font-weight: 700; color: var(--brand); }
.plan-price span { font-size: 13px; font-weight: 400; color: var(--muted); }
.plan-price-alt { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.plan-feats { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; font-size: 13px; }
.plan-feats li { padding: 4px 0; }
.acct-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f2f6; font-size: 14px; }
.acct-row:last-child { border-bottom: none; }
.acct-row span:first-child { color: var(--muted); }
.acct-row span:last-child { font-weight: 600; }
.pill.status-trial { background: #fff3e0; color: #e67e22; }
.pill.status-active { background: #e8fdf0; color: var(--green); }
.pill.status-expired { background: #fee8e8; color: var(--red); }
.pill.status-pending { background: #e3f2fd; color: #1976d2; }

/* --- Review --- */
.review-summary { display: flex; gap: 14px; margin-bottom: 20px; }
.rev-stat { flex: 1; background: #f8fafc; border-radius: 12px; padding: 14px 16px; text-align: center; border: 1px solid #eef0f6; }
.rev-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.rev-val { font-size: 18px; font-weight: 700; color: var(--ink); }
.rev-val.bad { color: var(--red); }

/* --- Trial Banner --- */
.trial-banner { background: #fff8e1; border: 1px solid #ffe082; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.trial-banner.expired { background: #ffebee; border-color: #ef9a9a; }
.trial-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.trial-bar { height: 5px; background: #ffe082; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.trial-fill { height: 100%; background: #f57c00; border-radius: 4px; }
.trial-info { color: #795548; font-size: 12px; line-height: 1.4; }
.trial-banner.expired .trial-info { color: #c62828; }
