:root {
  --biru: #00a5cf;
  --biru-tua: #0a68b4;
  --teks: #1c2430;
  --abu: #6b7686;
  --garis: #e8ecf1;
  --latar: #f2f5f9;
  --hijau: #0f9d58;
  --merah: #e53935;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: #dde3ea;
  color: var(--teks);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}
body.kunci { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Satu kolom selebar HP, di tengah layar kalau dibuka di PC */
.layar {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--latar);
  position: relative;
}
#layar-utama { padding-bottom: 110px; }

/* ----- Form & tombol ----- */
label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--abu); }
label input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  border: 1.5px solid var(--garis); border-radius: 12px; background: #fff;
  font-size: 16px; font-weight: 400; color: var(--teks);
}
label input:focus { outline: none; border-color: var(--biru); }
label input[type="file"] { font-size: 14px; padding: 10px; }
.wajib { color: var(--merah); }

.btn-utama {
  width: 100%; padding: 14px; border: 0; border-radius: 14px;
  background: var(--biru); color: #fff; font-size: 16px; font-weight: 700;
}
.btn-utama:disabled { background: #c5ced9; cursor: not-allowed; }
.btn-sekunder {
  display: block; width: 100%; padding: 13px; border: 1.5px solid var(--garis);
  border-radius: 14px; background: #fff; font-weight: 600; text-align: center; text-decoration: none;
}
.btn-bahaya { color: var(--merah); border-color: #f5c6c4; }
.btn-kecil {
  padding: 6px 14px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.2); color: #fff; font-size: 13px; font-weight: 600;
}
.btn-link { border: 0; background: none; padding: 4px; color: var(--biru-tua); font-weight: 600; }
.error {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px;
  background: #fdecea; color: #b71c1c; font-size: 13px; white-space: pre-line;
}

svg.ikon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ----- Login ----- */
.login {
  display: flex; flex-direction: column; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, var(--biru), var(--biru-tua));
}
.login h1 { margin: 0 0 4px; color: #fff; font-size: 30px; }
.login .sub { margin: 0 0 24px; color: rgba(255,255,255,.85); }
.kartu-login { padding: 20px; border-radius: 20px; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.18); }

/* ----- Beranda ----- */
.kartu { background: #fff; border-radius: 18px; box-shadow: 0 2px 10px rgba(20,40,70,.07); }
.kepala {
  padding: calc(16px + env(safe-area-inset-top)) 16px 70px;
  background: linear-gradient(160deg, var(--biru), var(--biru-tua));
  color: #fff; border-radius: 0 0 28px 28px;
}
.kepala-atas { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }

.kartu-saldo { position: relative; margin: -48px 16px 0; padding: 16px; }
.baris-saldo { display: flex; justify-content: space-between; align-items: center; }
.label { font-size: 13px; color: var(--abu); }
.saldo { margin-top: 2px; font-size: 28px; font-weight: 800; }
.ikon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--latar); }
.ikon-btn svg { width: 20px; height: 20px; }
.coret { display: none; }
.tertutup .coret { display: block; }

.aksi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--garis); }
.aksi-item { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; font-size: 13px; font-weight: 600; }

.bulat { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; font-size: 20px; font-weight: 800; }
.bulat svg { width: 22px; height: 22px; }
.bulat.hijau { background: var(--hijau); }
.bulat.merah { background: var(--merah); }
.bulat.biru { background: var(--biru); }
.bulat.besar { width: 64px; height: 64px; font-size: 30px; }
.hijau-teks { color: var(--hijau); }
.merah-teks { color: var(--merah); }

.dua-kolom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 16px 0; }
.mini { padding: 12px 14px; }
.angka { margin-top: 4px; font-size: 16px; font-weight: 700; }

.judul-baris { display: flex; justify-content: space-between; align-items: center; margin: 20px 16px 8px; }
.judul-baris h2 { margin: 0; font-size: 16px; }

/* ----- Daftar transaksi ----- */
.daftar { margin: 0 16px; overflow: hidden; }
.kosong { margin: 0; padding: 28px 16px; text-align: center; color: var(--abu); }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--garis); background: #fff; text-align: left;
}
.item:last-child { border-bottom: 0; }
.item:active { background: var(--latar); }
.item-tengah { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-uraian { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-kecil { font-size: 12px; color: var(--abu); }
.item-kanan { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.nominal { font-weight: 700; }
.judul-tgl { padding: 10px 14px 6px; background: var(--latar); font-size: 12px; font-weight: 700; color: var(--abu); }

/* ----- Riwayat ----- */
.kepala-polos { padding: calc(16px + env(safe-area-inset-top)) 16px 8px; }
.kepala-polos h1 { margin: 0 0 4px; font-size: 22px; }
.filter { display: grid; grid-template-columns: 1fr 150px; gap: 8px; margin: 0 16px 12px; }
.filter input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--garis); border-radius: 12px; background: #fff; font-size: 15px; }

/* ----- Navigasi bawah ----- */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -4px 18px rgba(20,40,70,.1);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border: 0; background: none; color: var(--abu); font-size: 12px; font-weight: 600; }
.nav-item svg { width: 24px; height: 24px; }
.nav-item.aktif { color: var(--biru-tua); }
.nav-tambah {
  justify-self: center; display: grid; place-items: center; width: 58px; height: 58px; margin-top: -30px;
  border: 4px solid #fff; border-radius: 50%; background: var(--biru); color: #fff;
  box-shadow: 0 6px 16px rgba(0,165,207,.45);
}
.nav-tambah svg { width: 28px; height: 28px; }

/* ----- Bottom sheet ----- */
.lapisan { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(10,20,35,.5); }
.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 30;
  width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 24px 24px 0 0; animation: naik .22s ease-out;
}
@keyframes naik { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.pegangan { width: 40px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: #d3dae3; }
.sheet h2 { margin: 0 0 14px; font-size: 18px; text-align: center; }

.segmen { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 16px; padding: 4px; border-radius: 14px; background: var(--latar); }
.segmen button { padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--abu); font-weight: 700; }
.segmen button.aktif { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); color: var(--teks); }
#sheet-tambah[data-tipe="masuk"] .segmen button.aktif { color: var(--hijau); }
#sheet-tambah[data-tipe="keluar"] .segmen button.aktif { color: var(--merah); }

.nominal-wrap { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 8px 0 20px; }
.nominal-wrap span { font-size: 22px; font-weight: 700; color: var(--abu); }
.nominal-wrap input {
  width: 100%; max-width: 260px; padding: 4px 0; border: 0; border-bottom: 2px solid var(--garis);
  background: none; outline: none; font-size: 36px; font-weight: 800; text-align: center;
}
.nominal-wrap input:focus { border-bottom-color: var(--biru); }

/* ----- Detail ----- */
.detail-atas { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 16px; }
.nominal-besar { font-size: 30px; font-weight: 800; }
.rincian { padding: 4px 16px; background: var(--latar); box-shadow: none; }
.baris-detail { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--garis); }
.baris-detail:last-child { border-bottom: 0; }
.baris-detail span:last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.bukti { margin: 14px 0; }
.bukti img { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 14px; background: var(--latar); }
.aksi-detail { display: grid; gap: 10px; margin-top: 8px; }

/* ----- Toast ----- */
.toast {
  position: fixed; left: 50%; bottom: 100px; z-index: 50; max-width: 90%;
  padding: 10px 16px; border-radius: 999px; background: #1c2430; color: #fff; font-size: 14px;
  opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .25s;
}
.toast.tampil { opacity: 1; transform: translate(-50%, 0); }

/* ================= Pengaturan ================= */
.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--latar); overflow-y: auto; }
.overlay-isi { max-width: 480px; margin: 0 auto; padding-bottom: 40px; }
.btn-link.rata-kiri { padding-left: 0; }

.menu { margin: 8px 16px 0; overflow: hidden; }
.menu-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; border: 0; border-bottom: 1px solid var(--garis); background: #fff;
  text-align: left; font-weight: 600;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:active { background: var(--latar); }
.menu-item small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--abu); }
.menu-item.bahaya { color: var(--merah); }
.form-menu { padding: 14px 16px 4px; border-bottom: 1px solid var(--garis); background: var(--latar); }

/* ================= Edit massal ================= */
select { font: inherit; color: inherit; }

.massal { display: flex; flex-direction: column; overflow: hidden; }
.massal-kepala {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: #fff; box-shadow: 0 1px 0 var(--garis);
}
.btn-simpan-kecil {
  padding: 9px 14px; border: 0; border-radius: 999px; background: var(--biru); color: #fff;
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.btn-simpan-kecil:disabled { background: #c5ced9; cursor: not-allowed; }
.massal-alat { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 4px; }
.massal-alat .btn-sekunder { display: inline-block; width: auto; padding: 8px 12px; font-size: 14px; }
.massal-catatan { margin: 4px 12px 8px; line-height: 1.45; }
.massal .error { margin: 0 12px 8px; max-height: 130px; overflow: auto; }
.massal-gulir { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--garis); background: #fff; }

.tabel-massal { width: 100%; min-width: 800px; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
.tabel-massal th {
  position: sticky; top: 0; z-index: 2; padding: 8px 6px; background: #eef2f7;
  border-bottom: 1px solid var(--garis); text-align: left; font-size: 12px; color: var(--abu);
}
.tabel-massal .kol-no { width: 56px; }
.tabel-massal .kol-tgl { width: 150px; }
.tabel-massal .kol-jenis { width: 100px; }
.tabel-massal .kol-nom { width: 140px; text-align: right; }
.tabel-massal .kol-saldo { width: 130px; text-align: right; }
.tabel-massal .kol-aksi { width: 48px; }
.tabel-massal td { padding: 3px 4px; border-bottom: 1px solid var(--garis); vertical-align: middle; }
.tabel-massal td.no { text-align: center; font-size: 12px; color: var(--abu); }

.sel {
  width: 100%; padding: 8px; border: 1.5px solid transparent; border-radius: 8px;
  background: transparent; font: inherit; color: inherit;
}
.sel:hover { border-color: var(--garis); }
.sel:focus { outline: none; border-color: var(--biru); background: #fff; }
.sel.kanan { text-align: right; }
.sel:disabled { opacity: .7; }

.tabel-massal td.sel-saldo { padding-right: 10px; text-align: right; white-space: nowrap; color: var(--abu); }
.tabel-massal td.sel-saldo.basi { opacity: .4; }
.btn-tong { padding: 6px; border: 0; background: none; color: var(--abu); font-size: 15px; }

.tabel-massal tr.berubah td { background: #fff8e1; }
.tabel-massal tr.baru td { background: #e8f7ee; }
.tabel-massal tr.dihapus td { background: #fdecea; }
.tabel-massal tr.dihapus .sel { text-decoration: line-through; }
.tabel-massal tr.salah td { background: #fdecea; }
.tabel-massal tr.salah .sel { border-color: var(--merah); }

/* ================= Edit massal: bukti & filter bulan ================= */
.massal-alat input[type="month"] {
  padding: 8px 10px; border: 1.5px solid var(--garis); border-radius: 10px; background: #fff; font-size: 14px;
}
.tabel-massal { min-width: 920px; }
.tabel-massal .kol-bukti { width: 132px; }
.tabel-massal td.sel-bukti { white-space: nowrap; }
.klip { padding: 6px 8px; border: 1.5px solid var(--garis); border-radius: 8px; background: #fff; font-size: 13px; }
.klip-x { padding: 6px; border: 0; background: none; color: var(--abu); font-size: 15px; }

/* ================= Edit massal: pratinjau bukti ================= */
.pratinjau {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10,20,35,.55);
}
.pratinjau-kartu { width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; padding: 16px; border-radius: 18px; background: #fff; }
.pratinjau-kartu .item-kecil { margin: 4px 0 0; }
.pratinjau-aksi { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pratinjau-aksi .btn-utama, .pratinjau-aksi .btn-sekunder { width: auto; padding: 10px 14px; }