:root {
  --ink: #1F1B3A;
  --muted: #635F82;
  --indigo: #4F46E5;
  --violet: #8B5CF6;
  --in: #0E9F6E;
  --out: #E02424;
  --line: #E1E4EC;
  --line-soft: rgba(99, 95, 130, .12);
  --card-bg: rgba(255, 255, 255, 0.62);
  --card-brd: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 40px -24px rgba(49, 34, 110, 0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }

body {
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #F3F0FF;
  background-image:
    radial-gradient(900px 600px at 8% -8%, rgba(139, 92, 246, 0.26), transparent 62%),
    radial-gradient(760px 520px at 96% 4%, rgba(79, 70, 229, 0.20), transparent 60%),
    radial-gradient(800px 620px at 50% 108%, rgba(56, 189, 248, 0.14), transparent 62%),
    linear-gradient(160deg, #F6F3FF 0%, #EEE9FF 52%, #F7F2FF 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.bg-orb { position: fixed; border-radius: 50%; filter: blur(80px); opacity: .42; pointer-events: none; z-index: 0; }
.orb-1 { width: 420px; height: 420px; top: -140px; left: -100px; background: #C4B5FD; }
.orb-2 { width: 360px; height: 360px; top: 22%; right: -140px; background: #A5B4FC; }
.orb-3 { width: 380px; height: 380px; bottom: -180px; left: 38%; background: #FBCFE8; }

.wrap { width: min(1240px, 100% - 40px); margin-inline: auto; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 12px 0;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand strong { display: block; font-size: .98rem; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); font-size: .73rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  box-shadow: 0 10px 22px -12px rgba(79, 70, 229, .9);
}

.nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  display: inline-block;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .16s ease;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); background: rgba(255,255,255,.78); }
.nav-link.is-active {
  color: var(--indigo);
  background: rgba(255,255,255,.95);
  border-color: rgba(79, 70, 229, .18);
  box-shadow: 0 8px 18px -14px rgba(79,70,229,.9);
}

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu:not([open]) .menu-panel { display: none; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 250px;
  padding: 16px;
  display: grid;
  gap: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--card-brd);
  box-shadow: 0 24px 48px -26px rgba(49, 34, 110, .5);
}
.menu-form { display: grid; gap: 8px; }
.menu-form label { font-size: .76rem; font-weight: 600; color: var(--muted); }
.menu-form input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(99, 95, 130, .22);
  background: #fff;
  font: inherit;
  font-size: .88rem;
}
.menu-link {
  padding-top: 10px;
  border-top: 1px solid rgba(99, 95, 130, .14);
  color: var(--out);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Layout ---------- */
.main { padding: 28px 0 12px; position: relative; z-index: 1; display: grid; gap: 22px; }
/* Grid item tidak boleh dipaksa selebar isinya: tanpa ini tabel lebar (mis. tabel
   penerima dengan kolom keuangan & validasi) membuat kartu melebar keluar layar
   dan .table-scroll tidak pernah bisa digeser di HP. */
.main > * { min-width: 0; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero h1 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -0.025em; }
.hero p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.hint { color: var(--muted); font-size: .76rem; }
.opt { font-weight: 400; color: #9b97b5; }

.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--card-brd);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2 { margin: 0 0 16px; font-size: 1.02rem; letter-spacing: -0.01em; }

/* ---------- Bank tabs ---------- */
.bank-tabs {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}
.bank-tabs::-webkit-scrollbar { height: 6px; }
.bank-tabs::-webkit-scrollbar-thumb { background: rgba(99,95,130,.25); border-radius: 999px; }

.bank-tab {
  flex: 0 0 auto;
  display: grid;
  gap: 1px;
  padding: 9px 15px;
  border-radius: 11px 11px 4px 4px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid rgba(99, 95, 130, .2);
  transition: .15s ease;
}
.bank-tab:hover { background: rgba(255,255,255,.92); }
.bank-tab-name { font-size: .84rem; font-weight: 700; white-space: nowrap; letter-spacing: -0.01em; }
.bank-tab-meta { font-size: .71rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bank-tab.is-active {
  background: #fff;
  border-bottom-color: var(--indigo);
  box-shadow: 0 8px 18px -18px rgba(49,34,110,.9);
}
.bank-tab.is-active .bank-tab-meta { color: var(--indigo); }
.bank-tab-add {
  display: flex;
  align-items: center;
  color: var(--indigo);
  font-size: .8rem;
  font-weight: 700;
  border-style: dashed;
  border-color: rgba(79, 70, 229, .4);
  background: rgba(255,255,255,.45);
}

/* ---------- Kelola kelompok (di halaman Bank) ---------- */
.kelompok-manage { margin-top: 20px; display: grid; gap: 14px; }
.kelompok-manage h2 { margin: 0; }
.kelompok-manage > p { margin: 0; line-height: 1.6; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1 1 200px; }
.form-inline .form-actions { padding-top: 0; }

/* ---------- Jumlah dana per kelompok rekening ---------- */
.kelompok-card { display: grid; gap: 18px; }
.kelompok-card h2 { margin: 0 0 4px; }
.kelompok-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.kelompok-item {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 18px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 30px -26px rgba(49, 34, 110, .8);
}
.kelompok-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.kelompok-value { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; word-break: break-word; }
.kelompok-meta { font-size: .74rem; color: var(--muted); }
.kelompok-daftar { font-size: .72rem; color: var(--muted); line-height: 1.5; }
.rekening-list { list-style: none; margin: 4px 0 0; padding: 8px 0 0; display: grid; gap: 6px; border-top: 1px dashed rgba(99, 95, 130, .22); }
.rekening-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rekening-nama { font-size: .78rem; font-weight: 500; }
.rekening-uang { font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kelompok-total {
  color: #fff;
  background: linear-gradient(135deg, rgba(79, 70, 229, .95), rgba(139, 92, 246, .92));
  border-color: rgba(255, 255, 255, .35);
  box-shadow: 0 18px 34px -22px rgba(79, 70, 229, .95);
}
.kelompok-total .kelompok-label,
.kelompok-total .kelompok-meta,
.kelompok-total .kelompok-daftar { color: rgba(255, 255, 255, .86); }
.kelompok-total .rekening-list { border-top-color: rgba(255, 255, 255, .35); }
.kelompok-total .rekening-nama, .kelompok-total .rekening-uang { color: #fff; font-size: .8rem; }
.kelompok-total .kelompok-value { color: #fff; font-size: 1.4rem; }
.kelompok-total .value-in { color: #D1FAE5; }
.kelompok-total .value-out { color: #FEE2E2; }

/* ---------- Filter tanggal ---------- */
.filter-card { padding: 16px 18px; }
.filter-form { display: grid; gap: 12px; }
.filter-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.filter-title strong { font-size: .9rem; }
.filter-fields { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-field { display: grid; gap: 5px; }
.filter-field > span { font-size: .74rem; font-weight: 600; color: var(--muted); }
.filter-field input[type="date"] { width: auto; min-width: 168px; padding: 9px 12px; font-size: .86rem; }
.filter-buttons { display: flex; gap: 8px; margin-left: auto; }
.filter-presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, .22);
  background: rgba(255, 255, 255, .82);
  color: var(--indigo);
  font-size: .76rem;
  font-weight: 600;
  text-decoration: none;
  transition: .15s ease;
  white-space: nowrap;
}
.pill:hover { background: rgba(79, 70, 229, .1); }
.pill.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border-color: transparent;
  box-shadow: 0 10px 20px -14px rgba(79, 70, 229, .95);
}
.filter-note { font-size: .76rem; color: var(--muted); }
.filter-note strong { color: var(--ink); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* ---------- Baris kartu kedua: akumulasi semua bank ---------- */
.stats-block { display: grid; gap: 10px; }
.stats-caption {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0 4px;
}
.stats-caption-judul {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--indigo);
}
.stats-caption-sub { font-size: .74rem; color: var(--muted); }
/* Kartu akumulasi memakai gaya yang sama; diberi aksen tipis agar mudah dibedakan. */
.stats-semua .stat { border-color: rgba(79, 70, 229, .18); }
.stats-semua .stat-saldo {
  background: linear-gradient(135deg, rgba(30, 27, 75, .95), rgba(79, 70, 229, .92));
}
.stat { display: grid; gap: 6px; padding: 18px; }
.stat-label { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.25rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; word-break: break-word; }
.stat-sub { font-size: .74rem; color: var(--muted); }
.stat-saldo {
  background: linear-gradient(135deg, rgba(79,70,229,.94), rgba(139,92,246,.92));
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.stat-saldo .stat-label, .stat-saldo .stat-sub { color: rgba(255,255,255,.85); }
.stat-saldo .stat-value { color: #fff; }

.value-in { color: var(--in); }
.value-out { color: var(--out); }
.dim { color: #BFC5D2; }

/* ---------- Lembar ala Excel ---------- */
.sheet-card { padding: 0; overflow: hidden; scroll-margin-top: 74px; }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-head h2 { margin: 0 0 4px; font-size: 1.05rem; }
.sheet-head p { margin: 0; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sheet-card .flash { margin: 14px 20px 0; }

/* ---------- Kotak lengkapi admin massal (di atas lembar) ---------- */
.masal-form {
  margin: 14px 20px 0;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(243, 240, 255, .55);
}
.masal-info { display: grid; gap: 3px; font-size: .84rem; }
.masal-fields { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.masal-fields .filter-field { flex: 0 0 auto; min-width: 190px; max-width: 240px; }
.masal-fields select { padding: 8px 10px; font-size: .84rem; }
.masal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.masal-hitung { align-self: center; margin-left: auto; }

.sheet-form { margin: 0; }
.sheet-scroll { overflow-x: auto; }

table.sheet {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.92);
  font-size: .86rem;
}
table.sheet col.col-pilih { width: 44px; }
table.sheet col.col-no { width: 40px; }

/* Kolom centang (aksi massal) */
table.sheet th.th-pilih,
table.sheet td.cell-pilih {
  width: 44px;
  text-align: center;
  padding: 6px 4px;
}
table.sheet input.pilih-baris,
#pilih-semua-kepala {
  width: 18px;
  height: 18px;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--indigo);
  cursor: pointer;
}
table.sheet col.col-tgl { width: 108px; }
table.sheet col.col-uang { width: 140px; }
table.sheet col.col-penerima { width: 190px; }
table.sheet col.col-ket { width: 200px; }
table.sheet col.col-admin { width: 130px; }
table.sheet col.col-aksi { width: 110px; }

table.sheet th,
table.sheet td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: middle;
  text-align: left;
}
table.sheet thead th {
  background: #EDF0F7;
  color: #56607A;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
table.sheet th.corner,
table.sheet td.cell-no {
  width: 40px;
  text-align: center;
  background: #F4F6FA;
  color: #98A0B3;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  position: sticky;
  left: 0;
  z-index: 1;
}
table.sheet thead th.corner { z-index: 3; }
table.sheet .th-aksi { text-align: center; }

/* baris input = seperti sel aktif di Excel */
table.sheet tr.input-row td { background: #FFFCF0; }
table.sheet tr.input-row td:focus-within { background: #fff; }
table.sheet tr.input-row input,
table.sheet tr.input-row select {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 7px;
  border-radius: 6px;
  font: inherit;
  font-size: .85rem;
  color: var(--ink);
}
table.sheet tr.input-row input:focus,
table.sheet tr.input-row select:focus {
  outline: none;
  border-color: var(--indigo);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
table.sheet tr.input-row input::placeholder { color: #B9BECE; }

table.sheet tbody tr.row-in td { background: #F7FCFA; }
table.sheet tbody tr.row-out td { background: #FFFAFA; }
table.sheet tbody tr:hover td { background: #FFFFFF; }

table.sheet tfoot td {
  background: #EDF0F7;
  font-weight: 700;
  border-top: 2px solid #C8CEDC;
  font-size: .82rem;
}
table.sheet .blank-cell { text-align: center; color: var(--muted); padding: 22px 10px; background: #fff; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.ta-right { text-align: right; }
/* tabel lembar memakai selektor berelemen, jadi perataan kanan perlu spesifisitas lebih */
table.sheet td.ta-right, table.sheet th.ta-right { text-align: right; }
table.sheet tfoot td { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
table.sheet td.cell-aksi, table.sheet th.th-aksi { text-align: center; }
.cell-aksi .btn { padding: 6px 12px; font-size: .78rem; }
.cell-aksi .inline-form { margin-left: 6px; }

/* ---------- Kolom PENERIMA / PENGIRIM di lembar ---------- */
/* Baris yang belum diisi penerima/pengirimnya: pilih langsung di kolomnya
   (tanpa centang & tanpa kotak lengkapi massal). */
table.sheet td.cell-penerima .form-penerima { margin: 0; }
table.sheet select.pilih-penerima {
  width: 100%;
  padding: 5px 8px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--indigo);
  border: 1px dashed rgba(79, 70, 229, .5);
  border-radius: 8px;
  background: #FFFDF6;
  cursor: pointer;
}
table.sheet select.pilih-penerima:hover { background: #fff; border-style: solid; }
table.sheet select.pilih-penerima:focus {
  outline: none;
  border-style: solid;
  border-color: var(--indigo);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
table.sheet .form-penerima.is-saving { opacity: .55; }

/* Baris yang baru saja diisi dari kolom penerima/pengirim + posisi scroll-nya. */
table.sheet tbody tr.row-saved td { background: #ECFDF5; }
table.sheet tbody tr[id^="baris-"] { scroll-margin-top: 74px; }

/* ---------- Baris yang BELUM dihitung (penerima/pengirim kosong) ---------- */
/* Aturan: baris seperti ini tidak dijumlahkan ke saldo / uang masuk / uang keluar /
   selisih sampai kolom penerima/pengirimnya diisi, jadi ditandai kuning. */
table.sheet tbody tr.row-nohitung td { background: #FFF8E6; }
table.sheet tbody tr.row-nohitung td:first-child { box-shadow: inset 3px 0 0 #F0B429; }
table.sheet tbody tr.row-nohitung.row-saved td { background: #ECFDF5; }
.hint-nohitung {
  display: block;
  margin-top: 3px;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: #A16207;
  white-space: nowrap;
}
.nohitung-note { color: #A16207; font-weight: 600; }
.stat-sub.nohitung-note { font-weight: 600; }
.foot-nohitung { font-size: .7rem; font-weight: 600; color: #A16207; }
.nohitung-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 20px 0;
  padding: 10px 14px;
  border: 1px solid rgba(240, 180, 41, .45);
  border-radius: 12px;
  background: #FFF8E6;
  font-size: .8rem;
  color: #8A5A03;
}
.nohitung-bar .btn { flex: 0 0 auto; }
.nohitung-teks { display: grid; gap: 2px; flex: 1 1 320px; }
.nohitung-teks em { font-style: normal; color: #6B4A08; }
.nohitung-aksi { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* ---------- Tombol "Simpan semua" untuk penerima/pengirim tertunda ---------- */
.simpan-info { font-size: .74rem; color: #8A5A03; }
.simpan-info.is-aktif { color: #6D28D9; font-weight: 700; }

.sheet-simpan {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 20px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 70, 229, .22);
  border-radius: 12px;
  background: rgba(243, 240, 255, .7);
  font-size: .82rem;
}
.sheet-simpan-teks { flex: 1 1 260px; color: var(--ink); }
.sheet-simpan .btn { flex: 0 0 auto; }
.sheet-simpan .btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Baris yang pilihan penerima/pengirimnya sudah diisi tapi belum disimpan. */
table.sheet tbody tr.row-dipilih td { background: #EEF2FF; }
table.sheet tbody tr.row-dipilih td:first-child { box-shadow: inset 3px 0 0 var(--indigo); }
/* Baris yang dicentang untuk aksi massal. */
table.sheet tbody tr.row-tercentang td { background: #EEF7FF; }
table.sheet tbody tr.row-tercentang td:first-child { box-shadow: inset 3px 0 0 #0284C7; }
table.sheet tbody tr.row-tercentang.row-nohitung td { background: #F1F7E8; }

/* Tombol yang belum bisa dipakai (mis. Terapkan admin sebelum ada yang dicentang). */
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.masal-aksi-hitung { font-variant-numeric: tabular-nums; }
.row-riwayat td { background: #FAFAFF; font-style: italic; }
.row-riwayat .rek-name { font-style: normal; }

.sheet-hint { margin: 0; padding: 14px 20px 18px; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.sheet-hint a { color: var(--indigo); font-weight: 600; text-decoration: none; }
.sheet-hint a:hover { text-decoration: underline; }

/* ---------- Form ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field > label, .field > .label { font-size: .8rem; font-weight: 600; color: var(--muted); }

input[type="text"], input[type="date"], input[type="month"], input[type="password"],
input[type="search"], select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(99, 95, 130, .22);
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  transition: .16s ease;
}
select { padding-block: 10px; }
input:focus, select:focus {
  outline: none;
  border-color: rgba(79, 70, 229, .6);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
  background: #fff;
}
.form-actions { display: flex; gap: 10px; padding-top: 4px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: .87rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: .16s ease;
  white-space: nowrap;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  box-shadow: 0 14px 26px -16px rgba(79, 70, 229, .95);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 30px -16px rgba(79,70,229,1); }
.btn-ghost {
  color: var(--ink);
  background: rgba(255,255,255,.85);
  border-color: rgba(99, 95, 130, .2);
}
.btn-ghost:hover { background: #fff; }
.btn-sm { padding: 8px 14px; font-size: .82rem; }

/* ---------- Layout 2 kolom (halaman master) ---------- */
.layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }

.table-head { display: grid; gap: 10px; margin-bottom: 14px; }
.table-head h2 { margin: 0; }

.table-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: left;
  padding: 10px 12px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid rgba(99, 95, 130, .16);
  white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid rgba(99, 95, 130, .1); vertical-align: top; }
.table tbody tr:hover { background: rgba(255,255,255,.6); }

.rek-name { display: block; font-weight: 600; }
.catatan { display: block; font-size: .76rem; color: var(--muted); margin-top: 2px; }

.inline-form { display: inline; }
.link-aksi {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--indigo);
  text-decoration: none;
  cursor: pointer;
}
.link-aksi + .inline-form,
.inline-form + .link-aksi,
.link-aksi + .link-aksi { margin-left: 10px; }
.link-aksi:hover { text-decoration: underline; }
.link-aksi.danger { color: var(--out); }

.empty-row { padding: 24px 4px; text-align: center; }
.empty-state { display: grid; gap: 12px; justify-items: start; padding: 30px; }
.empty-state h2 { margin: 0; }

.flash { padding: 12px 15px; border-radius: 12px; font-size: .86rem; font-weight: 500; border: 1px solid transparent; }
.flash-ok { color: #08543C; background: rgba(16, 185, 129, .14); border-color: rgba(16, 185, 129, .28); }
.flash-err { color: #8C1C1C; background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .26); }
.flash-warn { color: #8A5A03; background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .3); }

/* ---------- Halaman Penerima: kolom KEUANGAN & VALIDASI ---------- */
.keuangan-form { margin: 0; }
table.table-keuangan { min-width: 820px; }
table.table-keuangan th.th-keuangan,
table.table-keuangan th.th-validasi { white-space: nowrap; }
table.table-keuangan td.cell-keuangan { width: 140px; }
table.table-keuangan td.cell-validasi { width: 190px; }
table.table-keuangan .input-keuangan {
  width: 100%;
  min-width: 118px;
  padding: 7px 9px;
  font-size: .84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-radius: 9px;
  border: 1px solid rgba(79, 70, 229, .3);
  background: #FFFDF6;
}
table.table-keuangan .input-keuangan:focus {
  outline: none;
  border-color: var(--indigo);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.badge-valid,
.badge-selisih,
.badge-kosong {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-valid { color: #08543C; background: rgba(16, 185, 129, .16); border: 1px solid rgba(16, 185, 129, .3); }
.badge-selisih { color: #8C1C1C; background: rgba(239, 68, 68, .13); border: 1px solid rgba(239, 68, 68, .28); }
.badge-kosong { color: #6B7280; background: rgba(148, 163, 184, .16); border: 1px solid rgba(148, 163, 184, .3); }
.selisih-nilai { display: block; margin-top: 3px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-validasi .catatan { display: block; font-size: .66rem; }
table.table-keuangan tbody tr.row-selisih td { background: #FFF8F8; }
table.table-keuangan tbody tr.row-valid td { background: #F6FDFA; }

.keuangan-card { display: grid; gap: 14px; }
.keuangan-card textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(99, 95, 130, .22);
  background: rgba(255, 255, 255, .92);
  font: inherit;
  font-size: .86rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}
.keuangan-card textarea:focus {
  outline: none;
  border-color: rgba(79, 70, 229, .6);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
  background: #fff;
}
.keuangan-hint { margin: 0; }
.keuangan-aksi {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0 4px;
}
.stat-validasi .valid-mix { font-size: 1rem; }

/* ---------- Halaman Backup & Restore ---------- */
.bk-card { display: grid; gap: 14px; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.bk-item {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .7);
}
.bk-label { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.bk-item strong { font-size: .95rem; }
.bk-sub { font-size: .72rem; color: var(--muted); }
.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.badge-status.is-on { color: #08543C; background: rgba(16, 185, 129, .16); border: 1px solid rgba(16, 185, 129, .3); }
.badge-status.is-off { color: #6B7280; background: rgba(148, 163, 184, .16); border: 1px solid rgba(148, 163, 184, .3); }
.badge-status.is-fail { color: #8C1C1C; background: rgba(239, 68, 68, .13); border: 1px solid rgba(239, 68, 68, .28); }
.bk-form { display: grid; gap: 12px; }
.bk-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.bk-form .field { display: grid; gap: 6px; }
.bk-form .field .label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.bk-check { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; }
.bk-check input { width: 18px; height: 18px; accent-color: var(--indigo); margin-top: 1px; }
.bk-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.bk-note {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(79, 70, 229, .2);
  background: rgba(243, 240, 255, .6);
  font-size: .82rem;
  line-height: 1.55;
}
.bk-note.is-warn { border-color: rgba(240, 180, 41, .45); background: #FFF8E6; color: #7A4E02; }
.bk-copy { display: flex; gap: 8px; }
.bk-copy input { flex: 1 1 auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.bk-detail { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.bk-detail summary { cursor: pointer; font-weight: 600; font-size: .84rem; color: var(--indigo); }
.bk-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: .82rem; }
.bk-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.7); }
.bk-list-num { list-style: decimal; padding-left: 22px; }
.bk-list-num li { display: list-item; background: none; padding: 2px 0; }
.mono-kecl { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; word-break: break-all; }
.btn.danger { color: var(--out); }

/* ---------- Halaman Dana Harian ---------- */
.form-subjudul { margin-top: 22px !important; }
table.table-dana { min-width: 860px; }
table.table-dana td.cell-keuangan { width: 150px; }
table.table-dana td.cell-validasi { width: 240px; }
table.table-dana tbody tr.row-valid td { background: #F6FDFA; }
table.table-dana tbody tr.row-selisih td { background: #FFF8F8; }
.tanggal-pilih-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tanggal-pilih-form label { font-size: .76rem; font-weight: 600; color: var(--muted); }
.tanggal-pilih-form input[type="date"] {
  width: auto;
  min-width: 150px;
  padding: 8px 11px;
  font-size: .84rem;
}
#saldo-bank { scroll-margin-top: 74px; }
#lembar-dana { scroll-margin-top: 74px; }
.flash a { color: inherit; font-weight: 700; }

/* ---------- Login ---------- */
.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: min(390px, 100%); padding: 32px 28px; display: grid; gap: 16px; text-align: center; }
.login-card h1 { margin: 0; font-size: 1.32rem; letter-spacing: -0.02em; }
.login-card > p { margin: 0; font-size: .87rem; }
.login-card .form { gap: 14px; text-align: left; }
.login-card .field > label { text-align: left; }
.login-card .brand-mark { justify-self: center; width: 52px; height: 52px; border-radius: 15px; font-size: 1.4rem; }
.btn-block { width: 100%; }
.center { text-align: center; }

.footer { position: relative; z-index: 1; padding: 22px 0 30px; color: var(--muted); font-size: .78rem; }

/* ---------- Responsif ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .wrap { width: min(100%, 100% - 20px); }
  .filter-card { padding: 14px; }
  .filter-fields { gap: 10px; }
  .filter-field { flex: 1 1 140px; }
  .filter-field input[type="date"] { width: 100%; min-width: 0; }
  .filter-buttons { margin-left: 0; width: 100%; }
  .filter-buttons .btn { flex: 1 1 auto; }
  .main { padding-top: 20px; gap: 18px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 16px; }
  .sheet-card { padding: 0; }
  .sheet-head { padding: 14px 14px; }
  .sheet-hint { padding: 12px 14px 16px; }
  .masal-form { margin: 12px 14px 0; padding: 12px; }
  .masal-fields .filter-field { flex: 1 1 100%; min-width: 0; max-width: none; }
  .masal-actions { width: 100%; }
  .masal-actions .btn { flex: 1 1 auto; }
  .masal-hitung { margin-left: 0; }
  table.sheet col.col-pilih { width: 48px; }
  table.sheet th.th-pilih,
  table.sheet td.cell-pilih { width: 48px; padding: 8px 4px; }
  table.sheet input.pilih-baris,
  #pilih-semua-kepala { width: 22px; height: 22px; }
  .nohitung-bar { margin: 10px 12px 0; padding: 10px 12px; }
  .nohitung-aksi { width: 100%; }
  .nohitung-aksi .btn { flex: 1 1 auto; }
  /* di HP label tombol sudah memuat jumlahnya, jadi teks penghitung disembunyikan
     agar banner tidak memakan layar */
  .nohitung-aksi .simpan-info { display: none; }
  .nohitung-teks em { font-size: .74rem; }
  .sheet-simpan { margin: 0 12px; padding: 12px; }
  .sheet-simpan .btn { width: 100%; }
  .sheet-simpan .simpan-info { display: none; }
  .topbar-inner { gap: 8px; }
  .brand > span { display: none; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }
  .nav { gap: 2px; }
  .nav-link { padding: 7px 9px; font-size: .76rem; }
  .menu-panel { width: min(240px, calc(100vw - 32px)); }
  .hero h1 { font-size: 1.35rem; }
  .hero .btn { padding: 9px 14px; font-size: .82rem; }
  .bank-tabs { gap: 7px; }
  .bank-tab { padding: 8px 12px; }
  .bank-tab-name { font-size: .8rem; }
  .bank-tab-meta { font-size: .68rem; }
}

/* ============================================================
 * KIT: tabel biasa (WAJIB di semua app VibeCoder)
 *
 * table.table dipakai banyak halaman (backup.php, admin, bank, tracking,
 * sales, pelanggan) tetapi dulu TANPA gaya sama sekali: padding sel 1px, tanpa
 * garis, tanpa gulir -> teks menempel dan tabel memaksa halaman melebar.
 * ============================================================ */
table.table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, .94);
  font-size: .84rem;
}
table.table th,
table.table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(99, 95, 130, .14);
}
table.table th {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #56607A;
  background: #EDF0F7;
  white-space: nowrap;
}
table.table tbody tr:hover { background: rgba(79, 70, 229, .04); }
table.table td.ta-right,
table.table th.ta-right { text-align: right; }
table.table td.nowrap { white-space: nowrap; }
table.table .blank-cell { text-align: center; color: var(--muted); padding: 18px 10px; }
table.table tbody tr:last-child td { border-bottom: 0; }
