:root {
  --hijau: #0e3b2e;
  --hijau-2: #0a2e24;
  --hijau-muda: #e8f3ee;
  --aksen: #f0b429;
  --aksen-tua: #c78f14;
  --bg: #f2f5f3;
  --kartu: #ffffff;
  --teks: #1c2b26;
  --teks-2: #5c6f67;
  --garis: #e3e9e5;
  --masuk: #157f4d;
  --keluar: #c0392b;
  --kk: #8155c7;
  --radius: 14px;
  --bayangan: 0 1px 2px rgba(16, 40, 32, .06), 0 4px 14px rgba(16, 40, 32, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--teks); font-size: 15px;
}
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 50;
  background: linear-gradient(180deg, var(--hijau), var(--hijau-2));
  color: #dfe9e4; display: flex; flex-direction: column; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--aksen);
  color: var(--hijau); font-weight: 800; display: flex; align-items: center;
  justify-content: center; font-size: 16px; letter-spacing: .5px;
}
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: .8px; color: #fff; }
.brand-sub { font-size: 11.5px; color: #9fb8ad; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; text-decoration: none; color: #c7d7cf; font-size: 14px;
}
.nav a svg { opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(240, 180, 41, .14); color: var(--aksen); font-weight: 600; }
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-chip { font-size: 13px; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.logout { font-size: 12.5px; color: #9fb8ad; text-decoration: none; }
.logout:hover { color: var(--aksen); }

.main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  background: var(--kartu); border-bottom: 1px solid var(--garis);
  position: sticky; top: 0; z-index: 30;
}
.burger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--teks); }
.page-title { font-size: 19px; margin: 0; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 22px 24px 48px; max-width: 1480px; width: 100%; }

.backdrop { display: none; position: fixed; inset: 0; background: rgba(10, 25, 20, .45); z-index: 40; }

/* ---------- kartu & grid ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 18px; }
.card {
  background: var(--kartu); border-radius: var(--radius); box-shadow: var(--bayangan);
  padding: 16px 18px; border: 1px solid var(--garis);
}
.card .label { font-size: 12.5px; color: var(--teks-2); letter-spacing: .3px; margin-bottom: 6px; display:flex; align-items:center; gap:6px; }
.card .nilai { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .nilai.plus { color: var(--masuk); }
.card .nilai.minus { color: var(--keluar); }
.card .sub { font-size: 12px; color: var(--teks-2); margin-top: 4px; }
.card.aksen { border-left: 4px solid var(--aksen); }

.panel { background: var(--kartu); border: 1px solid var(--garis); border-radius: var(--radius);
  box-shadow: var(--bayangan); margin-bottom: 18px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--garis);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15.5px; margin: 0; font-weight: 700; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px 18px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- form ----------
   flex-wrap + min-width per kolom: input tidak pernah lebih sempit dari
   teks yang diketik; di layar sempit otomatis turun baris. */
.form-grid { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12.5px; color: var(--teks-2); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0; padding: 10px 12px; border: 1.5px solid var(--garis);
  border-radius: 10px; font: inherit; font-size: 14.5px; background: #fff; color: var(--teks);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--hijau); box-shadow: 0 0 0 3px rgba(14, 59, 46, .12);
}
.c1 { flex: 1 1 90px; }
.c2 { flex: 2 1 150px; }
.c3 { flex: 3 1 200px; }
.c4 { flex: 4 1 250px; }
.c6 { flex: 6 1 320px; }
.c12 { flex: 1 1 100%; }
.form-aksi { flex: 1 1 100%; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--teks-2); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px;
  border-radius: 10px; border: 1.5px solid transparent; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
  background: var(--hijau); color: #fff;
}
.btn:hover { background: var(--hijau-2); }
.btn.aksen { background: var(--aksen); color: var(--hijau-2); }
.btn.aksen:hover { background: var(--aksen-tua); }
.btn.putih { background: #fff; color: var(--teks); border-color: var(--garis); }
.btn.putih:hover { border-color: var(--hijau); }
.btn.kecil { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.bahaya { background: #fff; color: var(--keluar); border-color: #f1d2ce; }
.btn.bahaya:hover { background: #fdf1ef; }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 9px 10px; border-bottom: 1px solid var(--garis); text-align: left; vertical-align: top; }
table.t th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--teks-2);
  background: #fafcfb; position: sticky; top: 0; white-space: nowrap; z-index: 2;
}
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t td.wrap { min-width: 150px; max-width: 420px; overflow-wrap: anywhere; }
table.t tr:hover td { background: #f7faf8; }
table.t tr.subtotal td { background: var(--hijau-muda); font-weight: 700; }
table.t tr.total td { background: var(--hijau); color: #fff; font-weight: 700; position: sticky; bottom: 0; }
table.t tr.total td.num { color: #fff; }
.plus { color: var(--masuk); } .minus { color: var(--keluar); }
td.aksi, th.aksi { white-space: nowrap; width: 1%; }
td.aksi form { display: inline; }

.badge { display: inline-block; padding: 2.5px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.masuk { background: #e3f4ea; color: var(--masuk); }
.badge.keluar { background: #fcebe8; color: var(--keluar); }
.badge.kk { background: #efe8fb; color: var(--kk); }
.badge.netral { background: #eef1ef; color: var(--teks-2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 10px; color: #fff; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: masuk .25s ease; max-width: 340px; }
.toast.ok { background: var(--hijau); border-left: 4px solid var(--aksen); }
.toast.err { background: var(--keluar); }
@keyframes masuk { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- login ---------- */
.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--hijau) 0%, var(--hijau-2) 60%), var(--hijau); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px;
  padding: 32px 30px; box-shadow: 0 18px 60px rgba(0, 0, 0, .35); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-logo { width: 46px; height: 46px; font-size: 18px; }
.login-brand h1 { font-size: 17px; margin: 0; letter-spacing: .6px; }
.login-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--teks-2); }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.login-err { background: #fcebe8; color: var(--keluar); padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; margin-bottom: 14px; }

/* ---------- dashboard chart ---------- */
.chart-arus { width: 100%; height: auto; display: block; }
.bar-masuk { fill: var(--masuk); } .bar-keluar { fill: #e5a49b; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--teks-2); padding: 4px 0 0; flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.hbar { display: grid; grid-template-columns: 170px 1fr 120px; gap: 8px; align-items: center;
  padding: 5px 0; font-size: 13px; }
.hbar .nama { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--teks-2); }
.hbar .track { display: block; background: #eef2ef; border-radius: 6px; height: 14px; overflow: hidden; }
.hbar .isi { display: block; height: 100%; background: linear-gradient(90deg, var(--hijau), #1d6b50); border-radius: 6px; }
.hbar .angka { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 640px) { .hbar { grid-template-columns: 110px 1fr 100px; } }

/* ---------- filter bar ---------- */
.filterbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.filterbar .field { min-width: 130px; }
.filterbar .field.grow { flex: 1; min-width: 180px; }

/* ---------- kas kecil ---------- */
.saldo-strip { display: flex; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--garis); }
.saldo-strip .item { font-size: 13px; color: var(--teks-2); }
.saldo-strip .item b { display: block; font-size: 17px; color: var(--teks); font-variant-numeric: tabular-nums; }

/* ---------- misc ---------- */
.muted { color: var(--teks-2); }
.right { text-align: right; }
.mb0 { margin-bottom: 0; }
.scroll-sticky-first th:first-child, .scroll-sticky-first td:first-child {
  position: sticky; left: 0; background: #fff; z-index: 3;
}
.scroll-sticky-first th:first-child { z-index: 4; background: #fafcfb; }
.scroll-sticky-first tr.subtotal td:first-child { background: var(--hijau-muda); }
.scroll-sticky-first tr.total td:first-child { background: var(--hijau); }
.empty { padding: 36px 16px; text-align: center; color: var(--teks-2); }
.empty b { display: block; font-size: 15px; color: var(--teks); margin-bottom: 4px; }

@media (max-width: 920px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 258px; }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; }
  .main { margin-left: 0; }
  .burger { display: inline-flex; }
  .content { padding: 16px 14px 42px; }
  .topbar { padding: 12px 14px; }
}
