/* Absensi Terpadu MI Miftahul Ulum — mengikuti DESIGN.md "Serambi Akademik Miftahul Ulum" */
:root {
  --bg: #F1F6F3; --surface: #FFFFFF; --surface-2: #F7FAF8; --ink: #14231B; --muted: #56665D; --line: #DDE7E1; --line-2: #C9D6CE;
  --green: #0F5132; --green-2: #1F8A57; --pine: #0A3323; --mint: #E6F2EB; --gold: #D4A017; --gold-soft: #FBF1D3;
  --hadir-bg: #DCFCE7; --hadir: #166534; --hadir-solid: #16A34A;
  --sakit-bg: #FEF9C3; --sakit: #854D0E; --sakit-solid: #CA8A04;
  --ijin-bg: #DBEAFE; --ijin: #1D4ED8; --ijin-solid: #2563EB;
  --alpa-bg: #FEE2E2; --alpa: #991B1B; --alpa-solid: #DC2626;
  --pasif-bg: #E0E7FF; --pasif: #4338CA; --pasif-solid: #4F46E5;
  --r-card: 16px; --r-ctl: 10px; --sh: 0 4px 20px -2px rgba(15, 81, 50, .06), 0 2px 6px -1px rgba(0, 0, 0, .03);
  --sh-pop: 0 10px 30px -4px rgba(10, 51, 35, .16);
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --side: 260px; --top: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--green); }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--green-2); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Ikon ---------- */
.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 16px; height: 16px; }

/* ---------- Login ---------- */
#layarMasuk { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, #DCEBE2, transparent 70%), var(--bg); }
.kartu-masuk { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh); padding: 36px 32px 28px; }
.logo-masuk { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; color: #fff; background: linear-gradient(160deg, var(--green-2), var(--pine)); }
.logo-masuk .i { width: 30px; height: 30px; }
.kartu-masuk h1 { text-align: center; margin: 0; font-size: 26px; letter-spacing: -.02em; }
.kartu-masuk .sub { text-align: center; color: var(--muted); margin: 4px 0 24px; }
.kartu-masuk .bantuan { margin-top: 18px; background: var(--mint); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--green); display: flex; gap: 10px; }

/* ---------- Kerangka aplikasi ---------- */
#aplikasi { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 40; display: flex; flex-direction: column; color: #EAF4EE;
  background: linear-gradient(180deg, var(--green-2) 0%, #136B41 38%, var(--pine) 100%); padding: 16px 12px; overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255, 255, 255, .14); margin-bottom: 12px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--green); display: grid; place-items: center; overflow: hidden; flex: none; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand b { display: block; font-size: 16px; line-height: 1.2; color: #fff; }
.brand span { font-size: 12.5px; opacity: .8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(241, 246, 243, .84); text-decoration: none; font-size: 14.5px; font-weight: 500; min-height: 44px; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.on { background: #fff; color: var(--green); font-weight: 600; }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav .grup { margin: 14px 12px 4px; font-size: 12px; opacity: .65; }
.side-bawah { margin-top: auto; padding-top: 16px; }
.side-akun { background: rgba(0, 0, 0, .16); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.side-akun b { display: block; font-size: 14px; color: #fff; }
.side-akun span { font-size: 12px; opacity: .75; }
.side-akun button { margin-left: auto; background: rgba(255, 255, 255, .12); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.main { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: rgba(241, 246, 243, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 17px; font-weight: 600; }
.chip-ta { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.chip-hari { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.topbar .kanan { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.topbar .btn-menu { display: none; }
.konten { padding: 24px 28px 120px; max-width: 1440px; width: 100%; }
.halaman { animation: muncul .18s ease-out; }
@keyframes muncul { from { opacity: .4; } to { opacity: 1; } }
.tabbar { display: none; }

/* ---------- Komponen dasar ---------- */
.kepala { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 20px; }
.kepala h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.2; }
.kepala p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.kepala .aksi { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kartu { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh); padding: 20px; }
.kartu + .kartu { margin-top: 16px; }
.kartu h3 { margin: 0 0 4px; font-size: 17px; }
.kartu .ket { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.baris { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sp { flex: 1; }
.mt { margin-top: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: #fff; color: var(--green); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--bg); }
.btn.utama { background: var(--green); border-color: var(--green); color: #fff; }
.btn.utama:hover { background: #136B41; }
.btn.emas { background: var(--gold); border-color: var(--gold); color: #2A1E00; }
.btn.bahaya { color: var(--alpa); border-color: #F3C3C3; }
.btn.hantu { border-color: transparent; background: transparent; }
.btn.kecil { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.ikon { width: 40px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .putar { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: putar .7s linear infinite; }
@keyframes putar { to { transform: rotate(360deg); } }

label.f { display: block; font-size: 14px; font-weight: 500; margin-bottom: 14px; }
label.f > span { display: block; margin-bottom: 6px; }
label.f small { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
.in, select.in, textarea.in { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: #fff; }
textarea.in { min-height: 96px; resize: vertical; line-height: 1.5; }
.in:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(31, 138, 87, .15); }
.in.kecil { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.in.angka { width: 72px; text-align: center; }
.cari { position: relative; }
.cari .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.cari .in { padding-left: 38px; }
.cek { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.cek input { width: 20px; height: 20px; accent-color: var(--green); }

/* Kontrol tersegmen (Hadir / Sakit / Ijin / Alpa) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; min-height: 34px; min-width: 52px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg button.on[data-v="Hadir"], .seg button.on[data-v="Aktif"] { background: var(--hadir-solid); }
.seg button.on[data-v="Sakit"] { background: var(--sakit-solid); }
.seg button.on[data-v="Ijin"] { background: var(--ijin-solid); }
.seg button.on[data-v="Alpa"], .seg button.on[data-v="Lainnya"] { background: var(--alpa-solid); }
.seg button.on[data-v="Pasif"] { background: var(--pasif-solid); }
.seg.besar button { min-height: 44px; padding: 0 20px; font-size: 14.5px; }
.seg.netral button.on { background: var(--green); }

/* Tombol status hari KBM (elemen paling khas aplikasi) */
.hari-kbm { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; min-width: 280px; }
.hari-kbm button { border: 0; border-radius: 10px; padding: 10px 14px; text-align: left; background: transparent; cursor: pointer; color: var(--muted); }
.hari-kbm button b { display: block; font-size: 15px; color: var(--ink); }
.hari-kbm button small { font-size: 12px; }
.hari-kbm button.on[data-v="Aktif"] { background: var(--green); color: #D7EEDF; }
.hari-kbm button.on[data-v="Pasif"] { background: var(--pasif-solid); color: #E5E8FF; }
.hari-kbm button.on b { color: #fff; }

/* Lencana status */
.pil { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pil::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pil.polos::before { display: none; }
.pil.Hadir, .pil.Aktif, .pil.Terkirim, .pil.ok { background: var(--hadir-bg); color: var(--hadir); }
.pil.Sakit, .pil.Antri, .pil.peringatan { background: var(--sakit-bg); color: var(--sakit); }
.pil.Ijin, .pil.info { background: var(--ijin-bg); color: var(--ijin); }
.pil.Alpa, .pil.Lainnya, .pil.Gagal { background: var(--alpa-bg); color: var(--alpa); }
.pil.Pasif { background: var(--pasif-bg); color: var(--pasif); }
.pil.Libur, .pil.Batal, .pil.abu { background: #E8EDEA; color: #4B5A52; }
.pil.Istighosah { background: var(--gold-soft); color: #7A5A00; border: 1px dashed #C9A23A; }
.pil.Evenan { background: #fff; color: var(--green); border: 1px solid var(--line-2); }
.kode { display: inline-grid; place-items: center; min-width: 40px; height: 28px; padding: 0 6px; border-radius: 8px; background: var(--mint); color: var(--green); font: 700 12.5px var(--mono); }

/* Kartu statistik */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .lbl { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .ang { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .ang small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat.gelap { background: linear-gradient(160deg, #12603C, var(--pine)); color: #fff; border-color: transparent; }
.stat.gelap .lbl, .stat.gelap .ang small { color: #CFE6D8; }
.stat.ungu .ang { color: var(--pasif); }
.bar { height: 8px; border-radius: 99px; background: #E6EEE9; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green-2); border-radius: 99px; transition: width .3s; }

/* Kepala sambutan beranda */
.sambut { border-radius: 20px; color: #fff; padding: 26px 28px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; background: linear-gradient(120deg, #17794A 0%, #0F5132 55%, var(--pine) 100%); position: relative; overflow: hidden; }
.sambut::after { content: ''; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .05); }
.sambut h1 { margin: 6px 0 4px; font-size: 28px; letter-spacing: -.02em; }
.sambut p { margin: 0; color: #CFE6D8; }
.sambut .tgl { margin-left: auto; background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 12px 16px; text-align: right; position: relative; z-index: 1; }
.sambut .tgl b { display: block; font-size: 17px; }
.peran-pil { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .14); color: #E3F2E9; margin-right: 6px; }

/* Tabel */
.tabel-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12.5px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid #EEF3F0; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #F7FAF8; }
table.t td.num, table.t th.num { text-align: center; font-variant-numeric: tabular-nums; }
table.t tr.sorot td { background: #FFFBEA; }
table.t tr.merah td { background: #FFF5F5; }

/* Matriks rekap guru (W-04) */
.matriks th, .matriks td { text-align: center; padding: 8px 6px !important; font-variant-numeric: tabular-nums; }
.matriks th:first-child, .matriks td:first-child { text-align: left; padding-left: 12px !important; position: sticky; left: 0; background: inherit; z-index: 1; }
.matriks thead th { background: #E8F2EC; color: var(--green); }
.matriks td.kosong { background: repeating-linear-gradient(135deg, #F1F4F2 0 4px, #E4EAE6 4px 6px); }
.matriks td.tid { font-weight: 700; background: #F4F8F5; }
.matriks td.berita { text-align: left; font: 12.5px var(--mono); white-space: nowrap; min-width: 260px; }
.matriks tr.weekend td { background: #EDF1EF; color: #6A7A71; font-weight: 600; }
.matriks tr.libur td { background: #F3F0FF; color: var(--pasif); font-weight: 600; }
.matriks tr.belum td { color: #A4B0A9; }
.matriks tr.pasif td:first-child { box-shadow: inset 4px 0 var(--pasif-solid); }
.matriks tfoot td { font-weight: 700; border-top: 2px solid var(--green); }
.matriks tfoot tr.jumlah td { background: var(--green); color: #fff; font-size: 15px; }
.matriks tfoot tr.pasif td { background: var(--pasif-bg); color: var(--pasif); }
.matriks tfoot tr.aktif td { background: var(--hadir-bg); color: var(--hadir); }

/* Daftar absen (kartu di HP, tabel di laptop) */
.daftar { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 52px minmax(180px, 1.4fr) 70px auto minmax(160px, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #EEF3F0; }
.item:last-child { border-bottom: 0; }
.item.sorot { background: #FFFBEA; }
.item.merah { background: #FFF5F5; }
.item .nama b { display: block; font-weight: 600; }
.item .nama span { font-size: 13px; color: var(--muted); }
.item .jam { text-align: center; font-weight: 600; }
.item .jam small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.siswa .item { grid-template-columns: 40px minmax(180px, 1.6fr) auto minmax(160px, 1fr); }
.panel-ganti { grid-column: 1 / -1; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 4px; }
.panel-ganti .bar-ganti { display: grid; grid-template-columns: minmax(0, 1.4fr) 110px 40px; gap: 8px; margin-top: 8px; }
.kuota { font-size: 13px; font-weight: 600; }

.bilah-simpan { position: sticky; bottom: 0; z-index: 20; margin: 20px -28px -120px; padding: 14px 28px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); backdrop-filter: blur(6px); display: flex; gap: 10px; align-items: center; }
.bilah-simpan .info { font-size: 13.5px; color: var(--muted); }
.titik { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sakit-solid); margin-right: 8px; }
.titik.ok { background: var(--hadir-solid); }

.berita-box { background: var(--mint); border: 1px solid #CFE3D7; border-radius: 12px; padding: 14px 16px; font: 600 14px var(--mono); color: var(--green); word-break: break-word; }
.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-size: 14px; }
.banner.emas { background: var(--gold-soft); border: 1px dashed #D9B44A; color: #5C4300; }
.banner.merah { background: #FFF1F1; border: 1px solid #F6C8C8; color: var(--alpa); }
.banner.biru { background: #EEF4FF; border: 1px solid #CBD9FB; color: #1E3A8A; }
.banner.hijau { background: var(--mint); border: 1px solid #CFE3D7; color: var(--green); }

.tab { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 0 16px; min-height: 40px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab button.on { background: var(--green); border-color: var(--green); color: #fff; }

.daftar-keg { display: flex; flex-direction: column; gap: 10px; }
.keg { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-decoration: none; color: inherit; }
.keg:hover { border-color: var(--line-2); background: #FBFDFC; }
.keg .tglbox { width: 56px; min-height: 56px; border-radius: 12px; background: var(--green); color: #fff; display: grid; place-items: center; text-align: center; line-height: 1.1; flex: none; padding: 6px 0; }
.keg .tglbox b { font-size: 20px; display: block; }
.keg .tglbox small { font-size: 11.5px; }
.keg.istighosah .tglbox { background: #5C4300; }
.keg h4 { margin: 0 0 2px; font-size: 15.5px; }

.pilih-laporan { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.pilih-laporan button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 92px; }
.pilih-laporan button b { font-size: 14.5px; }
.pilih-laporan button span { font-size: 12.5px; color: var(--muted); }
.pilih-laporan button.on { border: 2px solid var(--green); background: var(--mint); padding: 13px; }

.dropzone { border: 2px dashed var(--line-2); border-radius: 14px; background: var(--surface-2); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; display: block; }
.dropzone:hover { border-color: var(--green-2); color: var(--green); }
.galeri { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.galeri figure { margin: 0; position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); aspect-ratio: 4 / 3; display: grid; place-items: center; }
.galeri img { width: 100%; height: 100%; object-fit: cover; }
.galeri figure button { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, .92); color: var(--alpa); cursor: pointer; display: grid; place-items: center; }

/* Grafik SVG */
.grafik { width: 100%; height: auto; display: block; }
.grafik text { font: 11.5px var(--sans); fill: var(--muted); }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Kalender hari khusus */
.kalender { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kalender .hd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.kalender button { min-height: 54px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 4px; text-align: left; font-size: 13px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.kalender button.ahad { color: var(--alpa); background: #FBFCFB; }
.kalender button.Libur { background: #ECEFED; }
.kalender button.Istighosah { background: var(--gold-soft); border-style: dashed; border-color: #D9B44A; }
.kalender button.Pasif, .kalender button.Hari.Berduka { background: var(--pasif-bg); }
.kalender button small { font-size: 10.5px; line-height: 1.2; color: var(--muted); overflow: hidden; }
.kalender button.hari-ini { border: 2px solid var(--green); }

/* Kerangka (skeleton) & kosong */
.skel { background: linear-gradient(90deg, #EAF0EC 25%, #F4F7F5 50%, #EAF0EC 75%); background-size: 200% 100%; animation: kilau 1.2s infinite; border-radius: 10px; }
@keyframes kilau { to { background-position: -200% 0; } }
.kosong { text-align: center; padding: 40px 16px; color: var(--muted); }
.kosong .i { width: 40px; height: 40px; color: #9DB5A7; margin-bottom: 8px; }
.kosong b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* Toast & modal */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sh-pop); font-size: 14px; display: flex; gap: 10px; align-items: center; animation: naik .2s ease-out; width: 100%; }
.toast.ok { background: #14532D; } .toast.galat { background: #991B1B; } .toast.info { background: #1E3A8A; }
@keyframes naik { from { transform: translateY(8px); opacity: 0; } }
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, 94vw); max-height: 90vh; box-shadow: var(--sh-pop); color: var(--ink); }
dialog.modal::backdrop { background: rgba(17, 24, 39, .45); }
.modal-k { padding: 20px 22px 6px; display: flex; align-items: center; gap: 12px; }
.modal-k h3 { margin: 0; font-size: 18px; }
.modal-i { padding: 10px 22px; max-height: 64vh; overflow-y: auto; }
.modal-b { padding: 14px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.wa-bubble { background: #E7F8EC; border-radius: 4px 14px 14px 14px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; border: 1px solid #CDEBD6; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--alpa); color: #fff; text-align: center; font-size: 13.5px; padding: 6px; }
#muatAwal { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 200; color: var(--green); }

/* ---------- Responsif ---------- */
@media (max-width: 1180px) {
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 48px minmax(0, 1fr) 64px; }
  .item .seg-wrap, .item .ket-wrap, .item .aksi-wrap { grid-column: 2 / -1; }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sh-pop); }
  body.menu-buka .sidebar { transform: none; }
  body.menu-buka::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .main { margin-left: 0; }
  .topbar .btn-menu { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .konten { padding: 16px 16px 140px; }
  .bilah-simpan { margin: 16px -16px -140px; padding: 12px 16px calc(12px + 64px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); grid-auto-flow: column; grid-auto-columns: 1fr; }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; }
  .tabbar .on { color: var(--green); font-weight: 600; }
  #toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kepala h1 { font-size: 22px; }
  .kepala .aksi { margin-left: 0; width: 100%; }
  .sambut { padding: 20px; } .sambut h1 { font-size: 22px; } .sambut .tgl { margin-left: 0; text-align: left; }
  .stat .ang { font-size: 26px; }
  .kartu { padding: 16px; }
  .item, .siswa .item { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 12px; gap: 8px 10px; }
  .siswa .item .seg-wrap, .siswa .item .ket-wrap { grid-column: 1 / -1; }
  .item .seg-wrap, .item .ket-wrap, .item .aksi-wrap { grid-column: 1 / -1; }
  .seg { width: 100%; } .seg button { flex: 1; min-width: 0; padding: 0 6px; min-height: 40px; }
  .hari-kbm { min-width: 0; width: 100%; }
  .panel-ganti .bar-ganti { grid-template-columns: minmax(0, 1fr) 84px 40px; }
  .topbar h2 { font-size: 15.5px; } .chip-ta { display: none; }
  .kartu-masuk { padding: 28px 20px 22px; }
}

/* ---------- Cetak / PDF ---------- */
#cetak { display: none; }
@media print {
  body { background: #fff; }
  #aplikasi, #layarMasuk, #toast, .offline { display: none !important; }
  #cetak { display: block; color: #000; font: 11pt/1.35 var(--sans); }
  .kop { display: flex; align-items: center; gap: 14px; border-bottom: 3px double #0F5132; padding-bottom: 8px; margin-bottom: 12px; }
  .kop img { width: 64px; height: 64px; object-fit: contain; }
  .kop h1 { margin: 0; font-size: 17pt; } .kop p { margin: 0; font-size: 10pt; }
  #cetak h2 { text-align: center; font-size: 13pt; margin: 6px 0 2px; } #cetak .periode { text-align: center; margin: 0 0 10px; }
  #cetak table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  #cetak th, #cetak td { border: 1px solid #555; padding: 3px 4px; text-align: center; }
  #cetak td.kiri, #cetak th.kiri { text-align: left; }
  #cetak tr.gelap td { background: #DDE7E1 !important; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #cetak tr.weekend td { background: #EEE !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #cetak td.kosong { background: #F2F2F2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ttd { display: flex; justify-content: flex-end; margin-top: 18px; page-break-inside: avoid; }
  .ttd div { text-align: center; min-width: 220px; } .ttd .ruang { height: 64px; }
}
