:root {
  --navy: #1f3a5f; --gold: #f4b400; --kuning: #ffe699; --kuning-b: #bf9000;
  --cash: #c6efce; --cash-t: #006100; --tf: #bdd7ee; --tf-t: #1f4e79;
  --belum: #ffc7ce; --belum-t: #9c0006; --abu: #ededed; --abu-t: #595959;
  --garis: #d6dce4; --zebra: #f5f8fc; --teks: #262626; --pudar: #7f7f7f; --bg: #fff;
  --now: #fff8e1;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--teks); font: 14px/1.4 Arial, Helvetica, sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }

/* bar atas */
.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 16px; min-height: 50px; flex-wrap: wrap; position: sticky; top: 0; z-index: 30; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { text-decoration: none; padding: 7px 12px; border-radius: 6px; color: #dfe7f1; font-weight: 600; }
.top nav a:hover { background: rgba(255,255,255,.1); }
.top nav a.on { background: var(--gold); color: #000; }
.who { font-size: 12px; color: #c9d4e2; }
main { padding: 14px 16px 40px; }

/* pilihan marketing / bulan */
.pilih { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 14px; }
.pilih label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; color: #666; }
.pilih select, .pilih .fix { font: 700 16px Arial, sans-serif; color: var(--navy); background: var(--kuning); border: 2px solid var(--kuning-b); border-radius: 4px; padding: 7px 10px; min-width: 190px; }
.pilih select.kecil { min-width: 90px; }
.pilih .fix { display: inline-block; }
.petunjuk { color: var(--pudar); font-size: 12px; font-style: italic; }
.kuning { background: var(--kuning); padding: 0 4px; font-style: normal; }

/* kotak ringkasan */
.kartu { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.k { padding: 8px 10px 10px; text-align: center; border-top: 4px solid; }
.k b { display: block; font-size: 10px; letter-spacing: .4px; }
.k span { display: block; font-size: 22px; font-weight: 700; margin: 2px 0; }
.k small { font-size: 12px; }
.k-aktif { background: #e8eef5; color: var(--navy); }
.k-cash { background: #e2f2e5; color: var(--cash-t); }
.k-tf { background: #ddebf7; color: var(--tf-t); }
.k-belum { background: #fde2e4; color: var(--belum-t); }
.k-off { background: var(--abu); color: var(--abu-t); }
.k-tagih { background: #fff2cc; color: #7f6000; }

.bantu { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
#cari { font: 14px Arial, sans-serif; padding: 7px 10px; border: 1px solid #b8c2cf; border-radius: 4px; width: 240px; }
.leg { display: flex; gap: 4px; margin-left: auto; }
.leg i { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 8px; border: 1px solid var(--garis); }
.leg .c { background: var(--cash); color: var(--cash-t); } .leg .t { background: var(--tf); color: var(--tf-t); }
.leg .x { background: var(--belum); color: var(--belum-t); } .leg .o { color: #a6a6a6; text-decoration: line-through; }

/* tabel */
.wrap { overflow: auto; max-height: calc(100vh - 120px); border: 1px solid var(--garis); }
.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.tbl th { background: var(--navy); color: #fff; font-weight: 700; padding: 8px 6px; text-align: center; white-space: nowrap; position: sticky; top: 0; z-index: 3; border-right: 1px solid #2d4d77; }
.tbl td { padding: 0 6px; height: 28px; border-bottom: 1px solid #e3e8ef; border-right: 1px solid #edf0f4; white-space: nowrap; }
.tbl tbody tr:nth-child(even) td { background: var(--zebra); }
.tbl tbody tr:hover td { background: #eef4fb; }
.tbl tfoot td { background: #e8eef5; font-weight: 700; position: sticky; bottom: 0; z-index: 2; border-top: 2px solid var(--navy); }

.bayar th.no, .bayar td.no { width: 46px; min-width: 46px; max-width: 46px; padding: 0 2px; }
.bayar td.no { text-align: center; color: var(--pudar); font-size: 12px; }
.bayar td.nm { font-weight: 700; min-width: 190px; }
.bayar td.tr { text-align: right; min-width: 90px; }
.bayar th.now { background: var(--gold); color: #000; }
.bayar td.b { text-align: center; min-width: 74px; cursor: pointer; font-weight: 700; user-select: none; }
.bayar tbody tr td.b.now { background: var(--now); }
.bayar tbody tr:not(.mati) td.b.now:empty { background: var(--belum); }
.bayar tbody tr td.b.c { background: var(--cash); color: var(--cash-t); }
.bayar tbody tr td.b.t { background: var(--tf); color: var(--tf-t); }
.bayar td.b:hover { outline: 2px solid var(--navy); outline-offset: -2px; }
.bayar td.pilih-aktif, .bayar td.mk.pilih-aktif { outline: 2px solid var(--gold); outline-offset: -2px; }
.bayar td.ket { color: var(--pudar); font-style: italic; font-size: 12px; min-width: 170px; }
.bayar td.mk { cursor: pointer; font-size: 12px; color: var(--navy); }
.bayar td.mk::after { content: ' ▾'; color: #9aa7b8; }
.bayar tr.mati td.nm, .bayar tr.mati td.tr, .bayar tr.mati td.nm input, .bayar tr.mati td.tr input { color: #a6a6a6; text-decoration: line-through; font-weight: 400; }
/* kolom kiri menempel saat geser ke kanan */
.bayar th.no, .bayar td.no { position: sticky; left: 0; z-index: 2; background: #fff; }
.bayar th.nm, .bayar td.nm { position: sticky; left: 46px; z-index: 2; background: #fff; border-right: 2px solid #c9d1db; }
.bayar thead th.no, .bayar thead th.nm { z-index: 4; background: var(--navy); }
.bayar tbody tr:nth-child(even) td.no, .bayar tbody tr:nth-child(even) td.nm { background: var(--zebra); }
.bayar tfoot td.no, .bayar tfoot td.nm { background: #e8eef5; }

input.ed { font: inherit; color: inherit; border: 1px solid transparent; background: transparent; width: 100%; padding: 3px 4px; border-radius: 3px; }
input.ed:hover { border-color: #c9d1db; background: #fff; }
input.ed:focus { border-color: var(--navy); background: #fff; outline: none; font-style: normal; }
td.tr input.ed { text-align: right; }
.tambah input { font: 13px Arial, sans-serif; width: 100%; padding: 4px 6px; border: 1px solid #9fb0c4; border-radius: 3px; }
.tambah td.tb-kiri { text-align: left; }

/* menu Cash / TF */
.menu { position: absolute; z-index: 50; background: #fff; border: 1px solid #b8c2cf; box-shadow: 0 6px 18px rgba(0,0,0,.18); border-radius: 6px; padding: 4px; display: flex; flex-direction: column; min-width: 130px; max-height: 320px; overflow: auto; }
.menu button { font: 700 14px Arial, sans-serif; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 4px; cursor: pointer; }
.menu button:hover { background: #eef2f7; }
.menu button.c { color: var(--cash-t); } .menu button.c:hover { background: var(--cash); }
.menu button.t { color: var(--tf-t); } .menu button.t:hover { background: var(--tf); }
.menu button.x { color: var(--belum-t); font-weight: 400; border-top: 1px solid #eee; }

/* rekap */
.judul-rekap { color: var(--navy); font-size: 18px; margin: 4px 0 10px; }
.rekap th { font-size: 11px; white-space: normal; min-width: 78px; }
.rekap th.st { background: #7f6000; }
.rekap th.abu { background: #7f7f7f; }
.rekap td.nm, .rekap th.nm { min-width: 140px; position: sticky; left: 0; z-index: 2; background: #fff; border-right: 2px solid #c9d1db; }
.rekap thead th.nm { z-index: 4; background: var(--navy); }
.rekap tbody tr:nth-child(even) td.nm { background: var(--zebra); }
.rekap tfoot td.nm { background: #e8eef5; z-index: 3; }
.rekap td.n { text-align: center; }
.rekap td.r { text-align: right; }
.rekap td.merah { color: #c00000; font-weight: 700; }
.rekap td.abu { color: var(--pudar); background: #f2f2f2 !important; }
.rekap td.minus { color: #fff; background: #c00000 !important; font-weight: 700; }
.rekap td.st { background: #fff2b3 !important; padding: 0 2px; }
.rekap input.stor { width: 92px; font: 13px Arial, sans-serif; color: #0000ff; text-align: right; border: 1px solid transparent; background: transparent; padding: 4px; }
.rekap input.stor:focus { border-color: #7f6000; background: #fff; outline: none; }

/* akun */
.akun-list input { font: 13px Arial, sans-serif; padding: 5px 7px; border: 1px solid #b8c2cf; border-radius: 3px; }
.akun-list td { height: 40px; }
.info { background: #e2f2e5; color: var(--cash-t); padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; display: inline-block; }

/* tombol & toast */
.btn { font: 700 14px Arial, sans-serif; background: var(--navy); color: #fff; border: 0; border-radius: 5px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: #2b4f7e; }
.btn.kecil { padding: 5px 12px; font-size: 13px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 30px); background: #1f3a5f; color: #fff; padding: 9px 16px; border-radius: 6px; opacity: 0; transition: .2s; z-index: 99; font-weight: 700; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #c00000; }

/* login */
.login-page { background: #eef2f7; min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { background: #fff; width: 100%; max-width: 420px; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(31,58,95,.15); }
.login-head { background: var(--navy); color: #fff; font-weight: 700; font-size: 18px; padding: 16px 20px; }
.login-box h2 { margin: 18px 20px 6px; color: var(--navy); font-size: 18px; }
.login-box p { margin: 0 20px 12px; color: #555; font-size: 13px; }
.login-box form { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: #555; }
.login-box input { font: 15px Arial, sans-serif; padding: 9px 10px; border: 1px solid #b8c2cf; border-radius: 5px; }
.login-box .btn { margin: 4px 20px 20px; }
.login-box form .btn { margin: 4px 0 0; }
.login-box .tbl { width: calc(100% - 40px); margin: 0 20px 14px; }
.login-box .tbl td { height: 26px; }
.err { background: var(--belum); color: var(--belum-t); padding: 8px 10px; border-radius: 4px; margin: 0 20px; font-size: 13px; }

/* kertas cetak */
.kertas { max-width: 820px; }
.kop h1 { font-size: 18px; color: var(--navy); margin: 0 0 6px; }
.kop-isi { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 13px; margin-bottom: 10px; }
.cetak th, .cetak td { border: 1px solid #8a8a8a; }
.cetak td.kop { border: 0; padding: 0 0 8px; height: auto; white-space: normal; background: #fff !important; }
.cetak th { position: static; }
.cetak td { height: 24px; }
.cetak td.no { text-align: center; width: 44px; }
.cetak td.tr { text-align: right; width: 100px; }
.cetak th.ck { width: 90px; }

@media (max-width: 760px) {
  .kartu { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .k { padding: 5px 4px 6px; border-top-width: 3px; }
  .k b { font-size: 9px; letter-spacing: 0; }
  .k span { font-size: 18px; margin: 0; }
  .k small { font-size: 10px; }
  .brand { font-size: 15px; }
  .top { gap: 8px; min-height: 44px; }
  .pilih { gap: 8px; }
  .pilih select, .pilih .fix { font-size: 14px; padding: 6px 8px; }
  .petunjuk { font-size: 11px; }
  .wrap { max-height: calc(100vh - 70px); }
  .top nav { order: 3; flex-basis: 100%; overflow-x: auto; padding-bottom: 6px; }
  .who { margin-left: auto; }
  .leg { margin-left: 0; }
  #cari { width: 100%; }
  .bayar td.nm { min-width: 130px; }
  .pilih label:first-child select, .pilih label:first-child .fix { min-width: 150px; }
  .pilih select, .pilih .fix { min-width: 0; }
  main { padding: 12px 10px 40px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm 10mm; }
  .top, .noprint, #toast { display: none !important; }
  main { padding: 0; }
  .kertas { max-width: none; }
  .cetak { font-size: 12px; }
  .cetak thead { display: table-header-group; }
  .cetak th { background: #1f3a5f !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cetak tbody tr:nth-child(even) td { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cetak tr { break-inside: avoid; }
}

/* judul daerah */
.bayar tr.grp td { background: #dde6f1 !important; height: 26px; padding: 0; border-bottom: 1px solid #b9c7d9; }
.bayar tr.grp td span { position: sticky; left: 0; display: inline-block; padding: 0 10px; font-weight: 700; font-size: 12px; color: var(--navy); letter-spacing: .3px; }
.bayar tr.grp td small { font-weight: 400; color: #5b6b80; margin-left: 6px; }
.bayar td.dr { min-width: 150px; font-size: 12px; }
.bayar tr.kilat td { animation: kilat 2s ease-out; }
@keyframes kilat { from { background: #ffe699; } }
#baru-daerah { width: 100%; }
#baru-simpan { white-space: nowrap; }
.tambah td { height: 36px; }
.cetak tr.grp td { background: #e4e9f0 !important; font-weight: 700; font-size: 11px; height: 20px; color: #1f3a5f; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* kunci bulan & hapus */
.bayar tbody tr td.b.kunci { cursor: not-allowed; opacity: .55; }
.bayar tbody tr td.b.kunci:hover { outline: none; }
.bayar td.hps, .bayar th.hps { width: 34px; min-width: 34px; text-align: center; padding: 0; }
button.hapus { border: 0; background: none; cursor: pointer; font-size: 14px; opacity: .35; padding: 4px; }
tr:hover button.hapus { opacity: .9; }
button.hapus:hover { background: #fde2e4; border-radius: 4px; }

.backup { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.hijau { background: #1e7b3a; } .btn.hijau:hover { background: #26934a; }
.wrap.bebas { max-height: none; }
.menu .info-isi { font-size: 11px; color: #5b6b80; padding: 6px 10px 7px; border-bottom: 1px solid #eee; margin-bottom: 2px; white-space: nowrap; }

/* kotak ringkasan bisa diklik */
.k[data-f] { cursor: pointer; transition: transform .1s, box-shadow .1s; user-select: none; }
.k[data-f]:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(31,58,95,.15); }
.k.dipilih { outline: 3px solid currentColor; outline-offset: -3px; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(31,58,95,.25); }
.saring-info { font-size: 13px; background: #fff2cc; border: 1px solid #e6c870; padding: 4px 8px; border-radius: 4px; }
.saring-info button { border: 0; background: #1f3a5f; color: #fff; border-radius: 3px; padding: 2px 8px; margin-left: 6px; cursor: pointer; font-size: 12px; }
.judul-rekap .kanan { float: right; font-size: 13px; }

.dobel td { height: 38px; }
.dobel tr.awal td { border-top: 2px solid #9fb0c4; }
.dobel td.r { text-align: right; }
.dobel td.ket { color: var(--pudar); font-style: italic; }
.dobel td.aksi { display: flex; gap: 6px; align-items: center; }
.dobel td.aksi form { margin: 0; }
.pudar { color: var(--pudar); }
.btn.abu { background: #6b7a8f; } .btn.merah { background: #c00000; } .btn.merah:hover { background: #a00000; }

.info.gagal { background: var(--belum); color: var(--belum-t); }
h3.sub { color: var(--navy); font-size: 15px; margin: 18px 0 8px; }
.tambah-akun { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: #f5f8fc; border: 1px solid var(--garis); padding: 12px; border-radius: 6px; }
.tambah-akun label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: #555; }
.tambah-akun input, .tambah-akun select { font: 14px Arial, sans-serif; padding: 7px 9px; border: 1px solid #b8c2cf; border-radius: 4px; min-width: 160px; }
.aksi-akun { display: flex; gap: 6px; align-items: center; height: 40px; }
.aksi-akun form { margin: 0; }
.akun-list td.r { text-align: right; color: var(--pudar); }
.btn.mati { background: #c9ced6; color: #fff; cursor: help; }
.btn.mati:hover { background: #b5bcc6; }

/* fee */
.bayar th.fee, .bayar td.fee { min-width: 78px; width: 78px; text-align: right; }
.bayar td.fee input.ed { color: #7f6000; text-align: right; }
.bayar td.fee input.ed::placeholder { color: #c0c6cf; }
.fee-massal { font-size: 12px; color: #555; display: inline-flex; align-items: center; gap: 4px; }
.fee-massal input { width: 100px; font: 13px Arial, sans-serif; padding: 5px 7px; border: 1px solid #b8c2cf; border-radius: 4px; }
.rekap th.fee-h { background: #7f6000; } .rekap th.fee-h small { font-weight: 400; opacity: .8; }
.rekap td.fee-c { background: #fff8e1 !important; color: #7f6000; font-weight: 700; }
