/* Billing Journal — Mobile UI ala Figma (Mobile Financial Tracking UI)
   Tema: indigo/ungu, kartu putih, latar abu terang, mobile-first 430px */

:root {
  --indigo: #4F46E5;
  --indigo-2: #6366F1;
  --indigo-3: #818CF8;
  --indigo-50: #EEF2FF;
  --indigo-100: #E0E7FF;
  --indigo-200: #C7D2FE;
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --border: #F3F4F6;
  --line: #E5E7EB;
  --text: #111827;
  --muted: #9CA3AF;
  --soft: #6B7280;
  --green: #10B981;
  --green-bg: #ECFDF5;
  --red: #DC2626;
  --red-bg: #FEF2F2;
}

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

body {
  background: #E5E7EB;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.phone {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(17, 24, 39, .08);
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Flash messages */
.flash-wrap { max-width: 430px; margin: 0 auto; padding: 12px 16px 0; }
.flash { border-radius: 14px; padding: 12px 16px; font-size: 14px; margin-bottom: 8px; }
.flash.success { background: #D1FAE5; color: #065F46; }
.flash.error { background: #FEE2E2; color: #991B1B; }
.flash.info { background: var(--indigo-100); color: #3730A3; }

/* Bottom navigation (persis Figma: Dashboard | Scan | Upload) */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 430px);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 10px 32px calc(18px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  text-decoration: none; padding: 4px 6px;
}
.nav-item.active { color: var(--indigo); }
.nav-center { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: -20px; }
.nav-center button {
  width: 56px; height: 56px; border-radius: 17.6px;
  background: var(--indigo); color: #fff; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 20px rgba(79, 70, 229, .35);
  transition: transform .12s;
}
.nav-center button:active { transform: scale(.92); }
.nav-center-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.nav-center-label.active { color: var(--indigo); }

.app-main { padding-bottom: 120px; }
.app-main.plain { padding-bottom: 32px; }

/* Dashboard header */
.dash-head { padding: 56px 20px 20px; display: flex; justify-content: space-between; align-items: center; }
.greet { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.name { font-size: 20px; font-weight: 600; color: var(--text); margin-top: 2px; }
.avatar {
  width: 44px; height: 44px; border-radius: 9999px;
  background: var(--indigo); color: #fff; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: .03em;
  box-shadow: 0 0 0 4px var(--indigo-100);
  transition: transform .12s;
}
.avatar:active { transform: scale(.94); }
.avatar-ghost {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  margin-right: 10px;
}
.dash-actions { display: flex; align-items: center; }

/* Tombol Geek (akses /animation) — hanya untuk user yang di-grant */
.geek-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 229, 255, 0.08);
  color: #00d5f2;
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
  margin-right: 8px;
}
.geek-btn:hover { background: rgba(0, 229, 255, 0.18); box-shadow: 0 0 12px rgba(0, 229, 255, 0.35); }

/* Varian tombol Geek di halaman login (lebar penuh) */
.geek-btn-login {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
  padding: 11px 12px;
  font-size: 12px;
  letter-spacing: 2px;
  text-decoration: none;
}

/* Hero card anggaran */
.hero {
  position: relative; margin: 0 20px 20px;
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  border-radius: 24px; padding: 20px; color: #fff; overflow: hidden;
  box-shadow: 0 16px 32px rgba(79, 70, 229, .28);
}
.orb-a { position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(99, 102, 241, .35); }
.orb-b { position: absolute; bottom: -32px; left: -32px; width: 128px; height: 128px; border-radius: 50%; background: rgba(67, 56, 202, .45); }
.hero .rel { position: relative; }
.hero-label { font-size: 11px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--indigo-200); margin-bottom: 8px; }
.hero-amount { font-size: 42px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin-bottom: 20px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-cell { background: rgba(255, 255, 255, .12); border-radius: 16px; padding: 14px; }
.hero-cell .lbl { font-size: 11px; color: var(--indigo-200); margin-bottom: 6px; font-weight: 500; }
.hero-cell .val { font-size: 15px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Tabs filter */
.tabs { margin: 0 20px 20px; display: flex; background: rgba(243, 244, 246, .9); border-radius: 16px; padding: 4px; gap: 4px; }
.tab {
  flex: 1; padding: 10px 0; font-size: 13px; font-weight: 500; border-radius: 12px;
  color: var(--muted); text-align: center; text-decoration: none; transition: all .2s;
}
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tab:not(.active):hover { color: #4B5563; }

/* Section & transaksi */
.section { padding: 0 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.section-action { font-size: 12px; font-weight: 600; color: var(--indigo-2); background: none; border: 0; cursor: pointer; text-decoration: none; }
.txn {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.txn-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.txn-icon.receipt { background: var(--indigo-50); color: var(--indigo-2); }
.txn-icon.bank { background: #F9FAFB; color: #9CA3AF; }
.txn-icon.income { background: var(--green-bg); color: var(--green); }
.txn-icon.manual { background: #F3F4F6; color: #6B7280; }
.txn-body { flex: 1; min-width: 0; }
.txn-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.txn-name { text-decoration: none; display: block; }
.txn-date { font-size: 12px; color: var(--muted); margin-top: 2px; }
.txn-amt { font-size: 14px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; flex-shrink: 0; }
.txn-amt.expense { color: var(--text); }
.txn-amt.income { color: var(--green); }
.txn-actions { display: flex; gap: 2px; flex-shrink: 0; }
.txn-act { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; }
.txn-act:hover { background: var(--indigo-50); color: var(--indigo-2); }
.txn-act.danger:hover { background: #FEE2E2; color: #DC2626; }

/* Kartu struk tersimpan (menu Struk) */
.receipt-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  text-decoration: none; color: inherit;
}
.receipt-thumb {
  width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
}
.receipt-thumb-ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--indigo-50); color: var(--indigo-2);
}
.receipt-body { flex: 1; min-width: 0; }
.receipt-store { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.receipt-note { font-size: 12px; color: var(--muted); margin-top: 2px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-total { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.receipt-arrow { color: #C4C9D2; flex-shrink: 0; }

/* ── Multi-mata uang & ekspor ─────────────────────────────── */
.cur-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--indigo-2);
  background: rgba(99, 102, 241, .12);
  border: 1px solid rgba(99, 102, 241, .25);
  border-radius: 8px;
  padding: 1px 7px;
  vertical-align: middle;
}
.hero-home {
  font-size: 18px;
  font-weight: 700;
  color: #A5B4FC;
  margin-top: 2px;
}
.receipt-home {
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo-2);
  white-space: nowrap;
}
.conv-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(99, 102, 241, .08);
  border: 1px dashed rgba(99, 102, 241, .35);
  border-radius: 12px;
}
.conv-preview .lbl { font-size: 12px; color: var(--muted); }
.conv-preview .val { font-size: 15px; font-weight: 700; color: var(--indigo-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rate-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.conv-item .c-name { font-weight: 400; }
.export-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 14px;
  flex-wrap: wrap;
}
.export-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-right: auto;
}

/* Ringkasan bagian bawah struk (Subtotal/SrvChg/GST/Rounding/Total2) */
.summary-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0;
}
.summary-line .lbl { font-size: 13px; color: var(--text); }
.summary-line .val { font-size: 14px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.summary-line input {
  width: 110px; text-align: right; border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; font-size: 14px; color: var(--text);
  background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.summary-line input:focus { outline: 2px solid var(--indigo-2); border-color: transparent; }

/* Empty state */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .icon { font-size: 40px; margin-bottom: 10px; }
.empty p { font-size: 14px; }

/* Page header sub-halaman */
.page-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 14px; }
.back-btn {
  width: 38px; height: 38px; border-radius: 12px; background: #fff;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: #374151; text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); flex-shrink: 0;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--muted); }

.card { background: #fff; border-radius: 20px; padding: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); margin: 0 20px 16px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* Form */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #4B5563; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 12px 14px; font-size: 15px; color: var(--text); outline: none;
  transition: border .15s, box-shadow .15s; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
select.input-warn { border-color: #e67e22 !important; box-shadow: 0 0 0 1px #e67e22; }
.item-row.low-conf { outline: 1px dashed #e67e22; background: rgba(230, 126, 34, .06); border-radius: 12px; }
.item-row.low-conf input { border-color: rgba(230, 126, 34, .55); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Tombol */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; border-radius: 16px; padding: 15px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .12s, background .15s; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 8px 16px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: #4338CA; }
.btn-ghost { background: #fff; color: #4B5563; border: 1px solid var(--line); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; border-radius: 12px; display: inline-flex; }
.btn-row { display: flex; gap: 10px; margin: 0 20px 24px; }
.btn-row .btn { flex: 1; }

/* Kotak upload */
.upload-box {
  border: 2px dashed #D1D5DB; border-radius: 20px; padding: 26px 16px;
  text-align: center; background: #fff; cursor: pointer; transition: all .15s;
}
.upload-box:hover { border-color: var(--indigo-2); background: var(--indigo-50); }
.upload-box .icon { font-size: 26px; margin-bottom: 8px; color: var(--indigo-2); }
.upload-box .t1 { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-box .t2 { font-size: 12px; color: var(--muted); margin-top: 4px; }
.upload-box input[type=file] { display: none; }
.photo-preview { margin-top: 12px; }
.photo-preview img { width: 100%; max-height: 240px; object-fit: contain; border-radius: 14px; background: #F3F4F6; }
.btn-block { width: 100%; justify-content: center; }
.linkish { color: var(--indigo-2); font-size: 13px; cursor: pointer; text-decoration: underline; }

/* Baris dinamis (item) — 2 baris per item: nama + Qty×@harga=amount */
.item-row { margin-bottom: 10px; }
.item-row.txn-row { display: grid; grid-template-columns: 96px 1fr 110px 34px; gap: 8px; align-items: center; }
.item-row input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 10px 12px; font-size: 14px; color: var(--text); outline: none; font-family: inherit;
}
.item-row input:focus { border-color: var(--indigo-2); }
.item-name-line { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.item-name-line input { flex: 1; }
.item-calc-line { display: flex; gap: 6px; align-items: center; }
.item-calc-line input[name="item_qty[]"] { width: 64px; flex: none; text-align: center; }
.item-calc-line input[name="item_price[]"] { flex: 1.4; min-width: 0; text-align: right; }
.item-calc-line input[name="item_amount[]"] { flex: 1.2; min-width: 0; text-align: right; font-weight: 600; background: var(--indigo-50); }
.item-calc-line .op { color: var(--soft); font-size: 14px; font-weight: 600; flex: none; }
.row-remove {
  width: 34px; height: 40px; border-radius: 10px; border: 1px solid #FECACA;
  background: var(--red-bg); color: var(--red); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.add-row {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none;
  color: var(--indigo-2); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0;
}
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 0; border-top: 1px dashed var(--line); margin-top: 8px; }
.total-row .lbl { font-size: 13px; font-weight: 600; color: var(--soft); }
.total-row .amt { font-size: 19px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Chip mata uang & peringatan */
.cur-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--indigo-50); color: var(--indigo); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 600; margin: 0 20px 14px;
}
.cur-warn { background: #FEF3C7; color: #92400E; border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 0 20px 16px; }
.cur-warn a { color: #92400E; font-weight: 700; }
.notice { border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 0 20px 16px; }
.notice.ok { background: var(--green-bg); color: #065F46; }
.notice.warn { background: #FEF3C7; color: #92400E; }

/* Modal lembar bawah (tambah pemasukan) */
.modal-overlay { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(17, 24, 39, .5); align-items: flex-end; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-sheet { width: min(100%, 430px); background: #fff; border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
.modal-sheet h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: 0; font-size: 18px; color: var(--muted); cursor: pointer; }

/* Detail */
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: 0; }
.detail-row .k { color: var(--muted); }
.detail-row .v { font-weight: 600; text-align: right; }

/* Detail item 4 kolom: nama | qty | @harga | amount */
.detail-item-head, .detail-item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 46px 74px 84px; gap: 6px;
  align-items: center; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.detail-item-head { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.detail-item-row .c-name { overflow-wrap: anywhere; }
.detail-item-row .c-qty, .detail-item-row .c-price, .detail-item-row .c-amt { text-align: right; font-variant-numeric: tabular-nums; }
.detail-item-row .c-amt { font-weight: 600; }

/* Halaman login/register */
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-logo {
  width: 64px; height: 64px; border-radius: 20px; background: var(--indigo); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 24px rgba(79, 70, 229, .35); margin-bottom: 16px;
}
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; text-align: center; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 24px; box-shadow: 0 4px 20px rgba(0, 0, 0, .06); }
.auth-links { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }
.auth-links a { color: var(--indigo); font-weight: 600; text-decoration: none; }

/* Pemilih bahasa kecil (halaman masuk) */
.lang-form { margin-bottom: 18px; }
.lang-form select {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: 13px; color: var(--text); outline: none; cursor: pointer;
}

/* Lencana status (admin / nonaktif) */
.badge {
  display: inline-block; border-radius: 999px; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; margin-left: 6px; vertical-align: middle;
}
.badge-admin { background: var(--indigo-50); color: var(--indigo); }
.badge-off { background: #FEE2E2; color: var(--red); }
.badge-geek { background: rgba(0, 229, 255, 0.12); color: #00b7d6; }

/* Tombol toggle Geek di User Management (btn-geek-on = sudah di-grant) */
.btn-geek-on {
  background: rgba(0, 229, 255, 0.15);
  color: #00b7d6;
  border-color: rgba(0, 229, 255, 0.5);
}

/* ── Spinner OCR + kunci form saat pemrosesan ─────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bjspin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes bjspin { to { transform: rotate(360deg); } }

form.is-processing input,
form.is-processing button,
form.is-processing select,
form.is-processing textarea {
  pointer-events: none;
  opacity: .55;
}

/* ── Superadmin ─────────────────────────────────────────────── */
/* Default = mobile: kartu bertumpuk seperti template lain.
   Media query (min-width) = desktop: container lebar + tabel. */

body.superadmin-page .phone {
  max-width: 430px;
  transition: max-width .2s ease;
}

.sa-main { padding-bottom: 32px; }
.sa-head { flex-wrap: wrap; }
.sa-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--indigo-50); color: var(--indigo);
  border-radius: 999px; padding: 5px 10px; white-space: nowrap;
}
.sa-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 16px; }
.sa-card {
  background: #fff; border-radius: 18px; padding: 14px 14px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); border: 1px solid var(--border);
}
.sa-card-ico { font-size: 18px; margin-bottom: 6px; }
.sa-card-lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.sa-card-val { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sa-card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sa-card-accent { background: var(--indigo); color: #fff; }
.sa-card-accent .sa-card-lbl, .sa-card-accent .sa-card-sub { color: rgba(255, 255, 255, .75); }
.sa-card-income { background: var(--green-bg); }
.sa-card-income .sa-card-lbl { color: #047857; }
.sa-card-expense { background: var(--red-bg); }
.sa-card-expense .sa-card-lbl { color: var(--red); }

.sa-table-card { overflow: hidden; }
.sa-table-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sa-note { font-size: 10px; color: var(--muted); }

/* Tabel hanya untuk desktop (≥768px) */
.sa-table-wrap { display: none; }
.sa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sa-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sa-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sa-table tr:last-child td { border-bottom: 0; }
.sa-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sa-table .num .sa-sub { display: block; font-size: 10px; color: var(--muted); }
.sa-table .sa-inc { color: #047857; font-weight: 600; }
.sa-table .sa-exp { color: var(--red); font-weight: 600; }
.sa-table .sa-dt { font-size: 12px; white-space: nowrap; }
.sa-table .sa-never { font-size: 11px; color: var(--muted); font-style: italic; }
.sa-row-off { opacity: .55; }
.sa-row-admin td { background: var(--indigo-50); }

.sa-user { display: flex; align-items: center; gap: 10px; }
.sa-avatar {
  width: 36px; height: 36px; border-radius: 12px; background: var(--indigo);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.sa-user-body { display: flex; flex-direction: column; min-width: 0; }
.sa-username { font-weight: 700; font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; }
.sa-fullname { font-size: 11px; color: var(--muted); }

/* Daftar kartu untuk mobile (layout sama dgn template lain) */
.sa-mobile-list { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.sa-mobile-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.sa-mobile-off { opacity: .6; }
.sa-mobile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sa-mobile-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; }
.sa-mobile-full { font-size: 12px; color: var(--muted); margin-top: 1px; }
.sa-mobile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sa-cell { background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.sa-cell-lbl { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.sa-cell-val { font-size: 13px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sa-cell-val .sa-sub { font-size: 10px; color: var(--muted); font-weight: 400; }
.sa-inc { color: #047857; }
.sa-exp { color: var(--red); }
.sa-empty { font-size: 13px; color: var(--muted); padding: 10px 0; }
.sa-footnote { font-size: 11px; color: var(--muted); text-align: center; padding: 0 20px 24px; line-height: 1.5; }

/* Desktop: container lebar + tabel */
@media (min-width: 768px) {
  body.superadmin-page .phone { max-width: 1080px; }
  .sa-cards { grid-template-columns: repeat(6, 1fr); padding: 0 24px 20px; }
  .sa-card { padding: 18px 16px 14px; }
  .sa-card-val { font-size: 24px; }
  .sa-table-wrap { display: block; overflow-x: auto; margin-top: 6px; }
  .sa-mobile-list { display: none; }
  .sa-head { padding: 28px 24px 18px; }
  .sa-table-card { margin: 0 24px 16px; padding: 20px; }
  .sa-footnote { padding: 0 24px 28px; }
}

/* Layar sangat kecil: kartu 2 kolom tetap nyaman */
@media (max-width: 360px) {
  .sa-cards { grid-template-columns: 1fr; }
  .sa-mobile-grid { grid-template-columns: 1fr; }
}

/* ── Banner status paket di dashboard ── */
.plan-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  border-radius: 12px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; line-height: 1.4;
}
.plan-banner-trial { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; }
.plan-banner-pro { background: #fef9c3; border: 1px solid #fde047; color: #713f12; }
.plan-banner-usage { opacity: .85; }
.plan-banner-cta { margin-left: auto; font-weight: 800; color: #1d4ed8; text-decoration: none; white-space: nowrap; }
.plan-banner-pro .plan-banner-cta { color: #b45309; }

/* ── Badge plan + aksi cepat superadmin ── */
.badge-plan { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 800; }
.badge-trial { background: #e0e7ff; color: #3730a3; }
.badge-pro { background: #fef3c7; color: #92400e; }
.badge-legacy { background: #d1fae5; color: #065f46; }
.sa-plan-actions { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.sa-mini { border: 1px solid #d1d5db; background: #fff; color: #374151; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; cursor: pointer; }
.sa-mini:hover { border-color: #6366f1; color: #4f46e5; }

/* ══════════════════════════════════════════════════════════════
   Modul Mutasi Bank (Alurkas) — daftar, ringkasan, rincian
   ══════════════════════════════════════════════════════════════ */
.kv { display: flex; justify-content: space-between; align-items: center;
      gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--soft); }
.kv > b { font-weight: 600; text-align: right; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.bank-card { display: block; background: var(--card); border: 1px solid var(--border);
      border-radius: 16px; padding: 16px; margin: 0 16px 12px; text-decoration: none;
      color: inherit; box-shadow: 0 1px 2px rgba(17, 24, 39, .04); }
.bank-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bank-name { font-size: 15px; font-weight: 700; }
.bank-acct { font-size: 12px; color: var(--muted); }
.bank-meta { font-size: 12px; color: var(--soft); margin-top: 4px; }
.bank-amounts { display: flex; gap: 14px; margin-top: 10px; font-size: 13px; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
      margin: 0 16px 14px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
      padding: 12px 10px; text-align: center; }
.stat .v { font-size: 14px; font-weight: 700; margin-top: 4px; }
.stat .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.txn-list { margin-top: 4px; }
.txn-row-plain { display: flex; justify-content: space-between; gap: 10px;
      padding: 10px 0; border-bottom: 1px dashed var(--line); }
.txn-row-plain:last-child { border-bottom: 0; }
.txn-left { min-width: 0; }
.txn-right { text-align: right; white-space: nowrap; font-weight: 600; font-size: 13px; }
.txn-desc { font-size: 13px; line-height: 1.35; word-break: break-word; }
.txn-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 16px 12px; }
.chip { font-size: 11px; padding: 5px 10px; border-radius: 999px; background: var(--indigo-50);
      color: var(--indigo); border: 1px solid var(--indigo-100); text-decoration: none; }
.chip.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.chip .n { opacity: .7; margin-left: 4px; }

.filter-form { display: flex; gap: 8px; margin: 0 16px 12px; }
.filter-form input[type=text] { flex: 1; border: 1px solid var(--line); border-radius: 12px;
      padding: 10px 12px; font-size: 13px; background: var(--card); }
.filter-form button { border: 0; border-radius: 12px; background: var(--indigo);
      color: #fff; padding: 0 16px; font-weight: 600; font-size: 13px; }

/* ══════════════════════════════════════════════════════════════
   TAMPILAN FLEKSIBEL — LAYAR BESAR (tablet 8" s/d monitor 21")
   Tema TIDAK berubah: warna (indigo/ungu), font, dan gaya kartu sama.
   Yang menyesuaikan hanya lebar, kolom, dan jarak.
   ══════════════════════════════════════════════════════════════ */

/* Pembungkus aksi (dulu margin inline) — bisa diatur per ukuran layar */
.form-actions { margin: 0 20px 24px; }
.settings-links { margin: 0 20px 16px; }
.hero-slim { margin: 0 20px 16px; }

/* Daftar user admin: nama + tombol aksi boleh turun baris (semua ukuran layar) */
body.admin-page .detail-row { flex-wrap: wrap; }
body.admin-page .detail-row .v { flex-wrap: wrap; justify-content: flex-end; }

/* ── ≥768px : tablet & desktop kecil (8"–11") ────────────────── */
@media (min-width: 768px) {
  .phone { max-width: 1000px; }
  .nav { width: min(100%, 1000px); padding-left: 40px; padding-right: 40px; }
  .flash-wrap { max-width: 1000px; padding: 16px 32px 0; }

  /* Modal jadi kartu di tengah layar (bukan lembar bawah) */
  .modal-overlay { align-items: center; padding: 24px; }
  .modal-sheet { width: min(100%, 520px); border-radius: 24px; }

  /* Jarak tepi kiri/kanan lebih lega */
  .dash-head, .page-head { padding-left: 32px; padding-right: 32px; }
  .dash-head { padding-top: 32px; padding-bottom: 22px; }
  .page-head { padding-top: 28px; padding-bottom: 16px; }
  .section { padding-left: 32px; padding-right: 32px; }
  .hero, .tabs, .cur-chip, .cur-warn, .notice, .plan-banner,
  .card, .btn-row, .export-row, .chips, .filter-form, .stat-grid,
  .bank-card, .form-actions, .settings-links, .hero-slim {
    margin-left: 32px; margin-right: 32px;
  }
  .card { padding: 22px; }
  .sa-footnote { padding-left: 32px; padding-right: 32px; }

  /* Skala teks ikut menyesuaikan */
  .page-title { font-size: 22px; }
  .name { font-size: 24px; }
  .hero-amount { font-size: 48px; }

  /* Aktivitas terbaru dashboard → dua kolom */
  .section { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
             gap: 8px 14px; align-content: start; }
  .section-head, .section > .empty { grid-column: 1 / -1; }
  .section .txn { margin-bottom: 0; }

  /* Ringkasan bank → 3 kolom, lebih lega */
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 16px 12px; }
  .stat .v { font-size: 18px; }
  .stat .k { font-size: 11px; }

  /* Daftar baris mutasi bank → dua kolom */
  .txn-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }

  /* Rincian struk: kolom angka lebih lega */
  .detail-item-head, .detail-item-row { grid-template-columns: minmax(0, 1fr) 56px 100px 120px; }

  /* Halaman daftar → kartu mengalir beberapa kolom otomatis */
  body.bank-page .app-main,
  body.receipts-page .app-main,
  body.bankupload-page .app-main {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px; padding: 0 32px 120px; align-content: start;
  }
  body.settings-page .app-main {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 16px; padding: 0 32px 32px; align-content: start;
  }
  body.bank-page .app-main > .page-head,
  body.receipts-page .app-main > .page-head,
  body.bankupload-page .app-main > .page-head,
  body.settings-page .app-main > .page-head,
  body.admin-page .app-main > .page-head { grid-column: 1 / -1; padding: 28px 0 12px; }

  body.bank-page .app-main > .stat-grid,
  body.receipts-page .app-main > .export-row,
  body.bankupload-page .app-main > .notice,
  body.settings-page .app-main > .settings-links,
  body.settings-page .app-main > .btn-row { grid-column: 1 / -1; margin: 0; }

  body.bank-page .app-main > .empty,
  body.receipts-page .app-main > .empty { grid-column: 1 / -1; }

  body.bank-page .bank-card,
  body.receipts-page .receipt-card,
  body.bankupload-page .card,
  body.settings-page .card,
  body.admin-page .card { margin: 0; }

  /* Form simpan pada unggah mutasi ikut masuk grid */
  body.bankupload-page .app-main > form { display: contents; }

  /* Halaman rincian: kartu lebar + tombol hapus sejajar */
  body.bankdetail-page .card,
  body.receiptdetail-page .card { margin: 0 32px 16px; padding: 22px; }
  body.bankdetail-page .chips,
  body.bankdetail-page .filter-form { margin: 0 32px 12px; }
  body.bankdetail-page .form-actions,
  body.bankupload-page .form-actions,
  body.receiptdetail-page .form-actions,
  body.scan-page .form-actions { margin: 0 32px 24px; }
  body.receiptdetail-page .hero-slim { margin: 0 32px 16px; }

  /* Pemindai struk (scan) → kartu dua kolom */
  body.scan-page .cur-chip, body.scan-page .cur-warn { margin: 0 32px 12px; }
  body.scan-page form#scanForm {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px; padding: 0 32px 24px; align-items: start;
  }
  body.scan-page form#scanForm > .card { margin: 0; }
  body.scan-page form#scanForm > .form-actions { grid-column: 1 / -1; margin: 0; }

  /* Superadmin: lebar wadah disamakan */
  body.superadmin-page .phone { max-width: 1000px; }
}

/* ── ≥900px : banner dashboard (angka besar kiri, rincian kanan) ── */
@media (min-width: 900px) {
  .hero { padding: 26px 28px; }
  body.dash-page .hero .rel {
    display: grid; align-items: center;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 440px); column-gap: 28px;
  }
  body.dash-page .hero-label { grid-column: 1; }
  body.dash-page .hero-amount { grid-column: 1; margin-bottom: 0; }
  body.dash-page .hero-grid { grid-column: 2; grid-row: 1 / span 2; }
}

/* ── ≥1024px : daftar user admin dua kolom (form | daftar user) ─ */
@media (min-width: 1024px) {
  body.admin-page .app-main {
    display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.35fr);
    gap: 16px; padding: 0 32px 40px; align-content: start;
  }
  body.admin-page .app-main > .page-head { grid-column: 1 / -1; padding: 28px 0 12px; }
  body.admin-page .card { margin: 0; }
}

/* ── ≥1200px : desktop & monitor besar (13"–21") ─────────────── */
@media (min-width: 1200px) {
  .phone { max-width: 1240px; }
  .nav { width: min(100%, 1240px); }
  .flash-wrap { max-width: 1240px; }
  body.superadmin-page .phone { max-width: 1240px; }
  .hero-amount { font-size: 54px; }
  body.bank-page .app-main,
  body.receipts-page .app-main,
  body.bankupload-page .app-main { grid-template-columns: repeat(auto-fill, minmax(370px, 1fr)); gap: 16px; }
}

/* ── ≥1500px : layar sangat besar (18"–21") ──────────────────── */
@media (min-width: 1500px) {
  .phone { max-width: 1360px; }
  .nav { width: min(100%, 1360px); }
  .flash-wrap { max-width: 1360px; }
  body.superadmin-page .phone { max-width: 1360px; }
}
