#toast {
  --t-warna: var(--accent);
  --t-lembut: var(--accent-soft);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 280px;
  max-width: 360px;
  padding: 13px 15px 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 20, 30, .22);
  overflow: hidden;
}

#toast[data-nada="sukses"] { --t-warna: var(--success); --t-lembut: color-mix(in srgb, var(--success) 15%, transparent); }
#toast[data-nada="gagal"]  { --t-warna: var(--danger);  --t-lembut: color-mix(in srgb, var(--danger) 15%, transparent); }
#toast[data-nada="info"],
#toast[data-nada="netral"] { --t-warna: var(--accent);  --t-lembut: var(--accent-soft); }

.toast-ikon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--t-lembut);
  color: var(--t-warna);
}
.toast-ikon .icon { width: 19px; height: 19px; }

.toast-isi { display: flex; flex-direction: column; gap: 2px; padding-top: 1px; min-width: 0; }
.toast-isi strong { font-size: 13px; font-weight: 700; color: var(--text); }
.toast-isi span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  background: var(--t-warna);
  opacity: .55;
}
@keyframes toastbar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .toast-bar { animation: none !important; opacity: 0; }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; }

.modal-tirai {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, .5);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .18s ease;
}
.modal.show .modal-tirai { opacity: 1; }

.modal-kotak {
  position: relative;
  width: 100%;
  max-width: 288px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .32);
  padding: 0;
  overflow: hidden;
  text-align: center;
  transform: translateY(12px) scale(.97);
  opacity: 0;
  transition: transform .2s cubic-bezier(.16, 1, .3, 1), opacity .2s ease;
}
.modal.show .modal-kotak { transform: none; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .modal-tirai, .modal-kotak { transition: none; }
}

.modal-badan { padding: 22px 20px 18px; }

.modal-ikon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  margin: 0 auto 14px;
}
.modal-ikon .icon { width: 26px; height: 26px; }

.modal-judul { font-size: 17px; font-weight: 700; margin: 0 0 5px; }
.modal-pesan { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }

.modal-aksi { display: flex; border-top: 1px solid var(--line); }
.modal-aksi button {
  flex: 1;
  height: 48px;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.modal-aksi button:hover { background: var(--surface-2); }
.modal-aksi button + button { border-left: 1px solid var(--line); }
.modal-aksi [data-modal-ya] { color: var(--danger); font-weight: 700; }

.sidebar:not(.collapsed) .nav-item[data-tingkat="2"].active::before,
.sidebar:not(.collapsed) .nav-item[data-tingkat="3"].active::before { left: -1px; }

.sidebar:not(.collapsed) .nav-item[data-tingkat="2"] { width: calc(100% - 14px); }
.sidebar:not(.collapsed) .nav-item[data-tingkat="3"] { width: calc(100% - 28px); }

.masuk { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.masuk .card { width: 100%; max-width: 410px; padding: 28px 26px; backdrop-filter: blur(6px); background: color-mix(in srgb, var(--surface) 92%, transparent); }
.masuk .brand { margin-bottom: 20px; }
.masuk .brand-name { color: var(--ink); font-size: 19px; }
.masuk .brand-sub { color: var(--ink-faint); }
.masuk p.intro { margin: 0 0 20px; color: var(--ink-soft); font-size: 13.5px; }
.masuk .field { margin-bottom: 15px; }
.masuk button[type="submit"] { width: 100%; justify-content: center; }
.masuk .foot { margin-top: 18px; text-align: center; color: var(--ink-faint); font-size: 12px; }
.login-bg { background: #f3f5fa url("/login-img.png") center / cover no-repeat fixed; }
@media (max-width: 699px) { .login-bg { background-attachment: scroll; } }

.content > .card { margin-top: 16px; }
.kpis .card { margin-top: 0; }

.brand-fav { display: none; width: 28px; height: 28px; }
.sidebar.collapsed .brand-logo { display: flex; justify-content: center; width: 100%; }
.sidebar.collapsed .brand-full { display: none; }
.sidebar.collapsed .brand-fav { display: block; }

.kpis { align-items: stretch; }
.kpis > .card.kpi { height: 100%; }
.kpis > .card.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .delta { margin-top: auto; }

.pilih-daftar { margin-top: 12px; max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.pilih-baris { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; }
.pilih-baris + .pilih-baris { border-top: 1px solid var(--line); }
.pilih-baris:hover { background: var(--surface-2); }
.pilih-baris[hidden] { display: none; }
.pilih-baris input { width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.pilih-isi { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pilih-nama { font-weight: 600; font-size: 13px; }
.pilih-kode { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilih-pemegang { flex: none; font-size: 11.5px; color: var(--warning); font-weight: 700; }

/* overflow-x: hidden pada body dan .main membuat keduanya scroll container
   (overflow-y ikut auto) yang tidak pernah scroll, sehingga position: sticky
   di dalamnya tidak menempel. clip memotong luapan tanpa membuat scroll container. */
body, .main { overflow-x: clip; }

/* Total target per bulan per sub kegiatan dan kode akun: kolom kode, header, dan baris total
   tetap terlihat saat tabel digeser, supaya angka selalu terbaca dengan labelnya. */
.table-scroll.rekap-bulan { max-height: 400px; }
.rekap-bulan tbody th, .rekap-bulan tbody td { padding-top: 8px; padding-bottom: 8px; }
.rekap-bulan table { min-width: 1760px; border-collapse: separate; border-spacing: 0; }
.rekap-bulan th:first-child { position: sticky; left: 0; z-index: 1; min-width: 240px; max-width: 240px; background: var(--surface); border-right: 1px solid var(--line); }
.rekap-bulan thead th { position: sticky; top: 0; z-index: 2; }
.rekap-bulan thead th:first-child { z-index: 3; background: var(--surface-2); }
.rekap-bulan tbody th { font-weight: 400; text-align: left; }
.rekap-kode { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.rekap-nama { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rekap-bulan tr.rekap-sub th, .rekap-bulan tr.rekap-sub td { background: var(--surface-2); font-weight: 700; }
.rekap-bulan tr.rekap-sub .rekap-nama { font-weight: 600; color: var(--text); font-size: 12px; }
.rekap-bulan tr.rekap-akun th { padding-left: 32px; }
.rekap-bulan tr.rekap-akun .rekap-kode { font-weight: 600; }
.rekap-toggle { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer; border-radius: 6px; }
.rekap-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rekap-teks { flex: 1; min-width: 0; }
.rekap-teks > span { display: block; }
.rekap-panah { width: 7px; height: 7px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--duration-fast, 150ms); }
.rekap-toggle[aria-expanded="true"] .rekap-panah { transform: rotate(45deg); }
.rekap-jumlah { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.rekap-bulan tr[hidden] { display: none; }
.rekap-bulan td.nol { color: var(--muted); }
.rekap-bulan td.total { font-weight: 750; border-left: 1px solid var(--line); }
.rekap-bulan tfoot th, .rekap-bulan tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); font-weight: 750; font-size: 12px; padding: 12px 16px; border-top: 1px solid var(--line); border-bottom: 0; }
.rekap-bulan tfoot th:first-child { z-index: 3; text-align: left; }

/* surface-2 hampir sama dengan latar halaman dan header tabel, jadi baris yang
   di-hover tidak terlihat menyala. Tint aksen membedakannya di kedua tema. */
.table-scroll, table.grid { --hover-baris: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.table-scroll tbody tr:hover,
.rekap-bulan tbody tr:hover th:first-child { background: var(--hover-baris); }
table.grid tbody tr:hover td,
table.grid tbody tr:hover .rail,
table.grid tbody tr:hover .tepi { background: var(--hover-baris); }

/* Grid target: overflow-x membuat .grid-scroll jadi scroll container, jadi sticky
   thead hanya menempel kalau kontainernya sendiri yang scroll vertikal. Tinggi dibatasi
   ke viewport supaya header bulan selalu terlihat saat mengisi baris di bawahnya. */
.grid-scroll { position: relative; max-height: calc(100vh - 170px); overflow-y: auto; }
table.grid thead th { position: sticky; top: 0; z-index: 3; }
table.grid thead .rail, table.grid thead .tepi { top: 0; }
table.grid thead .rail { z-index: 5; }
table.grid thead .tepi { z-index: 4; }
table.grid thead th,
table.grid thead .rail,
table.grid thead .tepi {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}
@media (max-width: 999px) {
  table.grid thead .rail, table.grid thead .tepi { position: sticky; left: auto; right: auto; }
}

.pager-kiri { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.perhalaman { display: flex; align-items: center; gap: 8px; }
.perhalaman select { height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 8px; font-size: 12px; }

/* Rincian belanja menampilkan seluruh kolom tabel input: lebar, kolom aksi menempel di kanan. */
.belanja-lebar table { min-width: 3200px; }
.belanja-lebar td.teks-lebar { min-width: 220px; max-width: 320px; }
.belanja-lebar .aksi-lekat { position: sticky; right: 0; background: var(--surface); border-left: 1px solid var(--line); }
.belanja-lebar thead .aksi-lekat { background: var(--surface-2); z-index: 1; }
.belanja-lebar tbody tr:hover .aksi-lekat { background: var(--hover-baris); }
