/* Tema: peach/oranye lembut, kartu kaca, aksen gelap — mengikuti referensi desain */
:root {
  --bg1: #fbd9c6; --bg2: #ecebee; --bg3: #e4e6ec;
  --kartu: rgba(255,255,255,.62); --kartu-solid: #ffffff; --garis: rgba(30,35,64,.09);
  --teks: #1e2340; --redup: #7b8095; --judul: #1f2447;
  --utama: #ee7c4d; --utama2: #f6a574; --utama-gelap: #d9632f; --utama-lembut: rgba(238,124,77,.14);
  --ok: #1f9d6b; --ok-bg: #dff5ea; --err: #d6455d; --err-bg: #fde4e8; --warn: #e8993a; --warn-bg: #fdf0dc;
  --gelap1: #2b2b2e; --gelap2: #3a3a3f; --bayang: 0 10px 30px rgba(60,40,30,.08);
  --r: 22px; --r-kecil: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.5 "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--teks);
  background: radial-gradient(1200px 700px at -5% -10%, var(--bg1) 0%, transparent 60%),
              radial-gradient(900px 600px at 105% 110%, #f3d7cb 0%, transparent 55%),
              linear-gradient(160deg, var(--bg2), var(--bg3));
  background-attachment: fixed;
}
a { color: var(--utama-gelap); }
h1 { font-size: 2.1rem; line-height: 1.15; margin: 0 0 .9rem; color: var(--judul); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0 0 .9rem; color: var(--judul); font-weight: 700; }
.muted { color: var(--redup); }
small.muted { display: block; margin-top: .25rem; }

/* ---------- kerangka ---------- */
.app { display: flex; min-height: 100vh; padding: 14px; gap: 14px; }
.sidebar {
  width: 250px; flex-shrink: 0; position: sticky; top: 14px; height: calc(100vh - 28px); overflow-y: auto;
  background: linear-gradient(180deg, rgba(255,214,190,.75), rgba(255,255,255,.45));
  border: 1px solid rgba(255,255,255,.7); border-radius: 28px; backdrop-filter: blur(14px);
  box-shadow: var(--bayang); display: flex; flex-direction: column; padding: 1rem .8rem;
}
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 800; color: var(--judul); padding: .35rem .5rem 1.1rem; }
.brand .logo { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg, var(--utama2), var(--utama-gelap)); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 14px rgba(238,124,77,.4); }
.brand .logo svg { width: 22px; height: 22px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--redup); }
.sidebar nav { flex: 1; }
.grup { padding: 1rem .7rem .35rem; font-size: .78rem; color: var(--redup); font-weight: 600; }
.item { display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 14px; color: #6d7185; text-decoration: none; font-weight: 600; margin-bottom: 2px; transition: .15s; }
.item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .8; }
.item:hover { background: rgba(255,255,255,.55); color: var(--judul); }
.item.aktif { background: #fff; color: var(--judul); box-shadow: 0 6px 16px rgba(60,40,30,.1); }
.item.aktif svg { color: var(--utama-gelap); opacity: 1; }
.panel-keluar { margin-top: .75rem; padding: .75rem; border-radius: 16px; background: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

.konten { flex: 1; min-width: 0; width: 100%; padding: .4rem 1rem 1.5rem; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.chip-user { display: flex; align-items: center; gap: .65rem; padding: .4rem .9rem .4rem .45rem; background: var(--kartu); border: 1px solid rgba(255,255,255,.7); border-radius: 18px; box-shadow: var(--bayang); font-weight: 600; }
.chip-user .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--utama2), var(--utama-gelap)); color: #fff; display: grid; place-items: center; font-weight: 700; }
.chip-user small { display: block; font-weight: 500; font-size: .72rem; color: var(--redup); line-height: 1.1; }
.btn.menu-toggle { display: none; margin-right: auto; }

.kartu { background: var(--kartu); border: 1px solid rgba(255,255,255,.75); border-radius: var(--r); padding: 1.25rem 1.4rem; margin-bottom: 1rem; box-shadow: var(--bayang); backdrop-filter: blur(10px); }
.kartu.gelap { color: #f3f1ee; background: radial-gradient(420px 220px at 100% 0%, rgba(238,124,77,.45), transparent 60%), linear-gradient(160deg, var(--gelap2), var(--gelap1)); border-color: rgba(255,255,255,.08); }
.kartu.gelap h2 { color: #fff; }
.kartu.gelap .muted { color: #b9b4ae; }
.judul-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.judul-bar h1 { margin: 0; }

/* ---------- tombol & form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.05rem; border: 1px solid var(--garis); background: rgba(255,255,255,.8); color: var(--teks); border-radius: 13px; cursor: pointer; font: inherit; font-weight: 600; text-decoration: none; line-height: 1.25; transition: .15s; }
.btn:hover { background: #fff; box-shadow: 0 4px 12px rgba(60,40,30,.1); }
.btn.utama { background: linear-gradient(135deg, var(--utama2), var(--utama)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(238,124,77,.35); }
.btn.utama:hover { background: linear-gradient(135deg, var(--utama), var(--utama-gelap)); }
.btn.bahaya { color: var(--err); }
.btn.bahaya:hover { background: var(--err-bg); border-color: transparent; }
.btn.hijau { background: var(--ok); color: #fff; border-color: transparent; }
.btn.kecil { padding: .28rem .7rem; font-size: .84rem; border-radius: 10px; }
.btn.blok { width: 100%; padding: .75rem; }
.btn[disabled], .btn.memuat { opacity: .65; pointer-events: none; }

.form label { display: block; margin-bottom: .85rem; font-weight: 600; font-size: .9rem; color: var(--judul); }
.form label.cek, label.cek { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid rgba(30,35,64,.22); border-radius: 13px; background: #fff; color: var(--teks); font: inherit; font-weight: 500; margin-top: .3rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--utama2); outline-offset: 0; background: #fff; }
input[type=checkbox] { accent-color: var(--utama); width: 17px; height: 17px; }
.wajib { color: var(--err); }
.dua-kolom { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.aksi-form { display: flex; gap: .6rem; margin-top: .6rem; flex-wrap: wrap; }
.filter { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.filter input, .filter select { width: auto; min-width: 150px; margin-top: 0; }
.filter .inl { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 500; font-size: .88rem; color: var(--redup); }
.filter .inl input { margin-top: 0; }
form.inline { display: inline; }

/* ---------- tabel ---------- */
.tabel-wrap { overflow-x: auto; background: var(--kartu); border: 1px solid rgba(255,255,255,.75); border-radius: var(--r); box-shadow: var(--bayang); }
.kartu .tabel-wrap { border: 0; box-shadow: none; background: transparent; margin-bottom: .75rem; }
.tabel { width: 100%; border-collapse: collapse; }
.tabel th, .tabel td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--garis); vertical-align: top; }
.tabel th { font-size: .78rem; color: var(--redup); font-weight: 600; white-space: nowrap; }
.tabel tr:last-child td { border-bottom: 0; }
.tabel tbody tr:hover { background: rgba(255,255,255,.5); }
.tabel .aksi { white-space: nowrap; text-align: right; }
.tabel .kanan { text-align: right; white-space: nowrap; }
.tabel .kosong { text-align: center; color: var(--redup); padding: 1.8rem; }
.tabel tfoot td { font-weight: 700; background: rgba(255,255,255,.5); }
.lencana { display: inline-block; padding: .12rem .65rem; border-radius: 99px; background: rgba(30,35,64,.08); font-size: .76rem; font-weight: 600; }
.lencana.ya, .lencana.lunas { background: var(--ok-bg); color: var(--ok); }
.lencana.cicilan { background: var(--warn-bg); color: #b9741b; }
.lencana.belum, .lencana.batal { background: var(--err-bg); color: var(--err); }
.pager { display: flex; gap: 1rem; align-items: center; margin: .75rem 0; }
.json { font: 12px/1.4 ui-monospace, Consolas, monospace; word-break: break-all; margin-top: .3rem; max-width: 520px; }
.bar { height: 8px; border-radius: 99px; background: rgba(30,35,64,.08); overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--utama2), #e86a8a); }

/* ---------- dashboard ---------- */
.statistik { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
.stat { display: flex; align-items: center; gap: .9rem; background: var(--kartu); border: 1px solid rgba(255,255,255,.75); border-radius: var(--r); padding: 1rem 1.2rem; box-shadow: var(--bayang); color: var(--redup); font-weight: 500; font-size: .85rem; }
.stat .ikon { width: 46px; height: 46px; border-radius: 50%; background: var(--utama-lembut); color: var(--utama-gelap); display: grid; place-items: center; flex-shrink: 0; }
.stat .ikon svg { width: 22px; height: 22px; }
.stat span { display: block; font-size: 1.45rem; font-weight: 800; color: var(--judul); line-height: 1.15; }
.stat.peringatan .ikon { background: var(--err-bg); color: var(--err); }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; }

/* ---------- detail santri ---------- */
.profil { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.foto { width: 120px; height: 150px; object-fit: cover; border-radius: 18px; border: 1px solid var(--garis); }
.kosong-foto { display: flex; align-items: center; justify-content: center; color: var(--redup); font-size: .8rem; background: rgba(255,255,255,.6); }
.detail { display: grid; grid-template-columns: 160px 1fr; gap: .35rem 1rem; margin: 0; flex: 1; min-width: 260px; }
.detail dt { color: var(--redup); font-weight: 500; }
.detail dd { margin: 0; font-weight: 600; }
.gambar-blok { border: 1.5px dashed rgba(30,35,64,.18); border-radius: 16px; padding: .85rem; margin-bottom: .75rem; }
.pratinjau { display: block; max-height: 90px; max-width: 100%; margin: .5rem 0; background: #fff; border: 1px solid var(--garis); border-radius: 8px; }
.ringkas { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.ringkas div { font-size: .82rem; color: var(--redup); }
.ringkas b { display: block; font-size: 1.2rem; color: var(--judul); }
.ringkas .merah b { color: var(--err); }
.ringkas .hijau b { color: var(--ok); }
.dim { opacity: .55; text-decoration: line-through; }
.hidden { display: none; }

/* ---------- login ---------- */
body.tamu { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.kartu-login { width: 100%; max-width: 410px; background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.85); border-radius: 30px; padding: 2.1rem; box-shadow: 0 24px 60px rgba(90,50,30,.15); backdrop-filter: blur(18px); }
.kartu-login label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.brand-besar { display: flex; align-items: center; gap: .8rem; font-size: 1.2rem; font-weight: 800; color: var(--judul); margin-bottom: 1.6rem; }
.brand-besar .logo { width: 50px; height: 50px; border-radius: 16px; background: linear-gradient(135deg, var(--utama2), var(--utama-gelap)); display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px rgba(238,124,77,.4); }
.brand-besar .logo svg { width: 26px; height: 26px; }
.brand-besar small { display: block; font-weight: 500; font-size: .8rem; color: var(--redup); }

/* ---------- popup / modal / toast ---------- */
.modal-lapis { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: rgba(30,28,40,.42); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; }
.modal-lapis.tampil { opacity: 1; }
.modal { width: 100%; max-width: 410px; background: #fff; border-radius: 28px; padding: 2rem 1.8rem 1.5rem; text-align: center; box-shadow: 0 30px 80px rgba(30,20,10,.35); transform: translateY(14px) scale(.96); transition: transform .25s cubic-bezier(.2,.9,.3,1.3); position: relative; overflow: hidden; }
.modal-lapis.tampil .modal { transform: none; }
.modal .lingkar { width: 82px; height: 82px; border-radius: 50%; margin: 0 auto 1.1rem; display: grid; place-items: center; }
.modal .lingkar svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.modal .lingkar.ok { background: var(--ok-bg); color: var(--ok); }
.modal .lingkar.error { background: var(--err-bg); color: var(--err); }
.modal .lingkar.tanya { background: var(--warn-bg); color: var(--warn); }
.modal .lingkar.bahaya { background: var(--err-bg); color: var(--err); }
.modal .lingkar.keluar { background: var(--utama-lembut); color: var(--utama-gelap); }
.modal .lingkar.info { background: var(--utama-lembut); color: var(--utama-gelap); }
.modal .lingkar svg path, .modal .lingkar svg circle { stroke-dasharray: 60; stroke-dashoffset: 60; animation: gambar .55s .15s ease forwards; }
@keyframes gambar { to { stroke-dashoffset: 0; } }
.modal h3 { margin: 0 0 .4rem; font-size: 1.3rem; color: var(--judul); }
.modal p { margin: 0 0 1.3rem; color: var(--redup); }
.modal ul { text-align: left; margin: 0 0 1.2rem; padding-left: 1.2rem; color: var(--teks); }
.modal ul li { margin-bottom: .25rem; }
.modal .tombol { display: flex; gap: .6rem; justify-content: center; }
.modal .tombol .btn { flex: 1; padding: .7rem; }
.modal .waktu { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--ok); width: 100%; transform-origin: left; animation: habis linear forwards; }
@keyframes habis { to { transform: scaleX(0); } }
.modal-lapis.error .modal .waktu { display: none; }

/* ---------- responsif ---------- */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app { padding: 8px; }
  .sidebar { position: fixed; left: -280px; top: 8px; z-index: 50; transition: left .22s; height: calc(100% - 16px); background: linear-gradient(180deg, #ffd9c3, #fff); }
  .sidebar.buka { left: 8px; }
  .btn.menu-toggle { display: inline-flex; }
  .konten { padding: .3rem .4rem 1rem; }
  .detail { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
}
@media print { body { background: #fff; } .sidebar, .topbar, .btn, .filter { display: none !important; } .konten { padding: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .modal .lingkar svg path, .modal .lingkar svg circle { stroke-dashoffset: 0; } }

/* ---------- menu dropdown (grup) ---------- */
.grup-menu { margin-bottom: 2px; }
.grup-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.grup-menu > summary::-webkit-details-marker { display: none; }
.grup-menu > summary span { flex: 1; }
.grup-menu .panah { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .18s; opacity: .6; margin-right: 4px; }
.grup-menu[open] > summary .panah { transform: rotate(45deg); }
.grup-menu > summary.induk-aktif { color: var(--judul); }
.grup-menu > summary.induk-aktif svg { color: var(--utama-gelap); opacity: 1; }
.grup-menu .anak { margin: 2px 0 6px 1.45rem; padding-left: .55rem; border-left: 2px solid rgba(30,35,64,.1); }
.item.sub { padding: .45rem .7rem; font-size: .92rem; font-weight: 600; }
.item.sub svg { width: 16px; height: 16px; }
.sidebar nav { overflow-y: auto; }

/* ---------- formulir selebar halaman (kolom otomatis) ---------- */
.kartu.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 1.5rem; align-items: start; }
.kartu.form > h2, .kartu.form > .aksi-form, .kartu.form > small, .kartu.form > p, .kartu.form > .gambar-blok,
.kartu.form > .dua-kolom, .kartu.form > .tabel-wrap, .kartu.form > details, .kartu.form > .ringkas, .kartu.form > div { grid-column: 1 / -1; }
.kartu.form > label.cek { align-self: end; padding-bottom: .9rem; }
.form > .kartu { width: 100%; }
.kartu-login .form, .kartu-login form { display: block; }
.dua-kolom { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tabel-wrap .tabel { min-width: 640px; }

/* ---------- hub laporan ---------- */
.grid-kartu { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.menu-kartu { display: block; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; margin-bottom: 0; }
.menu-kartu:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(60,40,30,.14); }
.menu-kartu .ikon { width: 44px; height: 44px; border-radius: 14px; background: var(--utama-lembut); color: var(--utama-gelap); display: grid; place-items: center; margin-bottom: .7rem; }
.menu-kartu .ikon svg { width: 22px; height: 22px; }
.menu-kartu h2 { margin-bottom: .3rem; }
.menu-kartu p { margin: 0; }

/* kolom nomor urut */
.tabel th.no, .tabel td.no { width: 52px; text-align: center; color: var(--muted, #7b8095); white-space: nowrap; }

/* pencarian santri + filter kelas */
.cari-santri .baris-cari { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; }
.cari-santri .baris-cari label { margin: 0; min-width: 180px; }
.cari-santri .baris-cari label.lebar { flex: 1 1 320px; }
.cari-santri .baris-cari .btn { align-self: flex-end; }
.hasil-cari { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.hasil-cari li.kosong { grid-column: 1 / -1; color: var(--redup); }
.hasil-cari a { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .85rem; border-radius: 14px; background: rgba(255,255,255,.7); border: 1px solid rgba(30,35,64,.08); text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.hasil-cari a:hover, .hasil-cari a:focus-visible { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(238,124,77,.18); border-color: #ee7c4d; }
.hasil-cari a b { font-size: .98rem; }
.hasil-cari a span { font-size: .8rem; color: var(--redup); }
input.combo { min-width: 170px; }

/* combobox: kotak yang bisa diketik + daftar turun */
.combo-wrap { position: relative; display: block; min-width: 190px; }
.combo-wrap > input { width: 100%; padding-right: 2.4rem; margin-top: 0; }
.combo-wrap .combo-panah { position: absolute; right: .9rem; top: 50%; width: 0; height: 0; margin-top: -2px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid #1e2340; cursor: pointer; transition: transform .15s; }
.combo-wrap.terbuka .combo-panah { transform: rotate(180deg); }
.combo-daftar { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); min-width: 260px; max-height: 340px; overflow: auto; margin: 0; padding: .35rem; list-style: none; background: #fff; border: 1px solid rgba(30,35,64,.12); border-radius: 16px; box-shadow: 0 18px 40px rgba(30,35,64,.22); }
.combo-daftar[hidden] { display: none; }
.combo-daftar li { padding: .5rem .75rem; border-radius: 11px; cursor: pointer; display: flex; flex-direction: column; gap: .05rem; }
.combo-daftar li b { font-size: .95rem; font-weight: 600; color: #1e2340; }
.combo-daftar li span { font-size: .8rem; color: #7b8095; }
.combo-daftar li.aktif, .combo-daftar li:hover { background: rgba(238,124,77,.14); }
.combo-daftar li.kosong { cursor: default; color: #7b8095; }
.combo-daftar li.kosong:hover { background: none; }
.filter .combo-wrap { min-width: 220px; }
.cari-santri.js-combo .hasil-cari, .cari-santri.js-combo .baris-cari > .btn { display: none; }
.cari-santri.js-combo .baris-cari label.lebar { flex: 1 1 360px; }

/* pesan WhatsApp */
pre.pesan-wa { white-space: pre-wrap; background: #e9fbe3; border-radius: 14px; padding: .7rem .9rem; margin: .4rem 0 0; font-family: inherit; font-size: .88rem; max-width: 380px; }
