/* ==========================================================================
   RUMAH HEBAT — PANEL ADMIN
   ========================================================================== */

:root {
  --oranye: #e67e22;
  --oranye-dk: #d35400;
  --navy: #1e293b;
  --abu: #64748b;
  --abu-2: #94a3b8;
  --krem: #fffbeb;
  --garis: #fde68a;
  --hijau: #059669;
  --merah: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--krem);
  color: var(--navy);
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
img { display: block; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ===================== TOMBOL ===================== */

.tbl {
  border: none;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.7rem;
  border: 1px solid #e2e8f0;
  min-height: 40px;
  transition: background 140ms, transform 140ms;
}

.tbl:hover { background: #f8fafc; }
.tbl:active { transform: scale(0.97); }

.tbl--oranye { background: var(--oranye); border-color: var(--oranye); color: #fff; }
.tbl--oranye:hover { background: var(--oranye-dk); }

.tbl--kecil { font-size: 0.72rem; padding: 0.4rem 0.75rem; min-height: 34px; }
.tbl--lebar { width: 100%; min-height: 48px; font-size: 0.9rem; }
.tbl--bahaya { color: var(--merah); border-color: #fecaca; }
.tbl--bahaya:hover { background: #fef2f2; }

/* ===================== MASUK ===================== */

/* --------------------------------------------------------------------------
   Layar masuk — mengikuti dashboard asli: foto latar digelapkan, kartu putih,
   kepala kartu gradasi oranye berisi logo.
   -------------------------------------------------------------------------- */

.masuk {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #0f172a;
  overflow: hidden;
}

.masuk__latar {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.masuk__latar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.5) blur(1px);
  transform: scale(1.05);
}

.masuk__latar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgb(2 6 23 / 82%), rgb(15 23 42 / 70%) 45%, rgb(2 44 34 / 70%));
}

.masuk__kartu {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 25rem;
  background: #fff;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 25px 60px rgb(2 6 23 / 55%);
  border: 1px solid rgb(255 255 255 / 20%);
}

.masuk__kepala {
  background: linear-gradient(135deg, var(--oranye), var(--oranye-dk));
  color: #fff;
  text-align: center;
  padding: 2rem 1.6rem 1.6rem;
}

.masuk__logoKotak {
  width: 4rem;
  height: 4rem;
  background: #fff;
  border: 2px solid rgb(255 255 255 / 40%);
  border-radius: 1rem;
  margin: 0 auto 0.75rem;
  padding: 0.35rem;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgb(0 0 0 / 20%);
}

.masuk__logoKotak img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.masuk__kartu h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.masuk__sub {
  font-size: 0.72rem;
  color: #ffedd5;
  margin-top: 0.15rem;
}

.masuk__kartu form {
  padding: 1.5rem 1.6rem 0.5rem;
}

.masuk__kartu label {
  display: block;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.masuk__kartu input {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.8rem;
  margin-bottom: 0.9rem;
  min-height: 48px;
}

.masuk__kartu input:focus {
  outline: none;
  border-color: var(--oranye);
  box-shadow: 0 0 0 3px rgb(230 126 34 / 15%);
}

.masuk__galat {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.6rem 0.8rem;
  border-radius: 0.7rem;
  margin: 0 0 0.9rem;
}

.masuk__balik {
  display: block;
  margin: 0 1.6rem 1.5rem;
  font-size: 0.75rem;
  color: var(--abu);
  text-decoration: none;
  text-align: center;
}

.masuk__balik:hover { color: var(--oranye); }

/* ===================== PANEL ===================== */

.panel {
  display: flex;
  min-height: 100vh;
}

/* ---------- sisi ---------- */

.sisi {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: #fff;
  border-right: 1px solid #fde68a;
  padding: 1rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 200ms ease;
}

.sisi.buka { transform: translateX(0); }

.sisi__merek {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.4rem 0.9rem;
  border-bottom: 1px solid #fef3c7;
}

.sisi__logoKotak {
  width: 38px;
  height: 38px;
  border-radius: 0.7rem;
  background: #fff;
  border: 1px solid #fde68a;
  display: grid;
  place-items: center;
  padding: 2px;
  flex-shrink: 0;
}

.sisi__logoKotak img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: contain;
}
.sisi__merek b { display: block; font-size: 0.86rem; }
.sisi__merek small { font-size: 0.64rem; color: var(--abu-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.sisi__nav { display: flex; flex-direction: column; gap: 0.15rem; overflow-y: auto; }

.nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: none;
  background: none;
  border-radius: 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--abu);
  text-align: left;
  min-height: 42px;
}

.nav:hover { background: #fffbeb; color: var(--navy); }
.nav.on { background: var(--navy); color: #fff; }

.ik {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  background: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  opacity: 0.85;
}

.ik[data-ik="rumah"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 3 10v11h6v-6h6v6h6V10z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 3 10v11h6v-6h6v6h6V10z'/%3E%3C/svg%3E"); }
.ik[data-ik="murid"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0 2c-4.4 0-8 2-8 6h16c0-4-3.6-6-8-6z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0 2c-4.4 0-8 2-8 6h16c0-4-3.6-6-8-6z'/%3E%3C/svg%3E"); }
.ik[data-ik="kalender"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2v3M17 2v3M3 8h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2v3M17 2v3M3 8h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"); }
.ik[data-ik="ceklis"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E"); }
.ik[data-ik="kotak"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v2l10 6 10-6V6a2 2 0 0 0-2-2zM2 10v8a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8l-10 6z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v2l10 6 10-6V6a2 2 0 0 0-2-2zM2 10v8a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8l-10 6z'/%3E%3C/svg%3E"); }
.ik[data-ik="uang"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-1.2c-1.5-.3-2.5-1.2-2.6-2.6h1.8c.1.6.7 1 1.7 1 .9 0 1.4-.4 1.4-1 0-.5-.4-.8-1.6-1.1-1.9-.4-3.1-1-3.1-2.6 0-1.3 1-2.2 2.4-2.5V6h2v1.2c1.4.3 2.3 1.2 2.4 2.4h-1.8c-.1-.5-.6-.9-1.5-.9-.8 0-1.3.4-1.3.9 0 .5.4.8 1.7 1.1 2 .4 3 1.1 3 2.7 0 1.4-1 2.3-2.5 2.6z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-1.2c-1.5-.3-2.5-1.2-2.6-2.6h1.8c.1.6.7 1 1.7 1 .9 0 1.4-.4 1.4-1 0-.5-.4-.8-1.6-1.1-1.9-.4-3.1-1-3.1-2.6 0-1.3 1-2.2 2.4-2.5V6h2v1.2c1.4.3 2.3 1.2 2.4 2.4h-1.8c-.1-.5-.6-.9-1.5-.9-.8 0-1.3.4-1.3.9 0 .5.4.8 1.7 1.1 2 .4 3 1.1 3 2.7 0 1.4-1 2.3-2.5 2.6z'/%3E%3C/svg%3E"); }
.ik[data-ik="grafik"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20V10h4v10zm6 0V4h4v16zm6 0v-7h4v7z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20V10h4v10zm6 0V4h4v16zm6 0v-7h4v7z'/%3E%3C/svg%3E"); }
.ik[data-ik="jam"] { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 11h-5v-2h3V6h2z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 11h-5v-2h3V6h2z'/%3E%3C/svg%3E"); }

.notif {
  margin-left: auto;
  background: var(--oranye);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  font-style: normal;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sisi__kaki {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid #fef3c7;
  display: grid;
  gap: 0.4rem;
}

.sisi__tautan { font-size: 0.72rem; font-weight: 700; color: var(--abu); text-decoration: none; padding: 0.4rem; }
.sisi__tautan:hover { color: var(--oranye); }
.sisi__keluar {
  border: 1px solid #fecaca;
  background: #fff;
  color: var(--merah);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 0.6rem;
}

/* ---------- utama ---------- */

.utama {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.utama__kepala {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgb(255 251 235 / 96%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--garis);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.utama__menu {
  width: 40px;
  height: 40px;
  border-radius: 0.7rem;
  border: 1px solid #fde68a;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.utama__kepala h2 { font-size: 1.05rem; }
.utama__kepala small { font-size: 0.66rem; color: var(--abu); }

.utama__kanan {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pil-tanggal {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--abu);
  background: #fff;
  border: 1px solid #fde68a;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

#tblSimpan { background: var(--oranye); border-color: var(--oranye); color: #fff; }
#tblSimpan.dirty { animation: denyut 1.4s ease-in-out infinite; }

@keyframes denyut {
  50% { box-shadow: 0 0 0 6px rgb(230 126 34 / 20%); }
}

.isi { padding: 1rem; display: grid; gap: 1rem; }

.tab { display: none; gap: 1rem; }
.tab.on { display: grid; }

/* ---------- kartu ---------- */

.kartu {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 1.1rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.kartu__kepala {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.kartu__kepala h3 { font-size: 0.9rem; }
.kartu__kepala small { font-size: 0.68rem; color: var(--abu-2); margin-left: auto; }

.kartu__aksi {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.kisi-dua { display: grid; gap: 1rem; }

/* ---------- statistik ---------- */

.kisi-stat {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}

.stat {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 1rem;
  padding: 0.9rem;
}

.stat b {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--abu-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat span {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
  margin: 0.15rem 0;
}

.stat small { font-size: 0.66rem; color: var(--abu); }
.stat--oranye span { color: var(--oranye-dk); }
.stat--hijau span { color: var(--hijau); }
.stat--merah span { color: var(--merah); }
.stat--navy span { color: var(--navy); }

/* ---------- tabel ---------- */

.gulir { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tabel {
  width: 100%;
  border-collapse: collapse;
  /* Dulu min-width 640px: tabel di dalam kartu dua kolom (dasbor) lebih
     lebar dari kartunya sehingga isinya terpotong di laptop. Sekarang
     tabel mengikuti lebar kotak; kalau layar benar-benar sempit, gulir
     horizontal di pembungkusnya yang bekerja. */
  min-width: 0;
}

.tabel th {
  background: #fef3c7;
  /* Dipaksa sekarang juga, tanpa nowrap: judul kolom boleh turun baris
     supaya tabel sempit tidak melebar keluar kartu. */
  white-space: normal;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #92400e;
  text-align: left;
  padding: 0.6rem 0.7rem;
  position: sticky;
  top: 0;
}

.tabel td {
  padding: 0.5rem 0.55rem;
  font-size: 0.72rem;
  border-top: 1px solid #fef3c7;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.tabel tbody tr:hover { background: #fffdf5; }

.tabel .kosong {
  text-align: center;
  color: var(--abu-2);
  font-style: italic;
  padding: 1.6rem;
}

/* ---------- input ---------- */

.inp {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fff;
  min-height: 38px;
  min-width: 0;
  color: var(--navy);
}

.inp:focus { outline: none; border-color: var(--oranye); box-shadow: 0 0 0 3px rgb(230 126 34 / 14%); }
.inp--kecil { font-size: 0.72rem; padding: 0.3rem 0.55rem; min-height: 34px; }

.bantu { font-size: 0.7rem; color: var(--abu); margin: 0 0 0.8rem; }
.bantu b { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 0.66rem; }

/* ---------- lencana ---------- */

.pil {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pil--ungu { background: #f3e8ff; color: #6b21a8; }
.pil--oranye { background: #ffedd5; color: #b45309; }
.pil--hijau { background: #d1fae5; color: #047857; }
.pil--merah { background: #fee2e2; color: #b91c1c; }
.pil--abu { background: #f1f5f9; color: #475569; }

/* ---------- jadwal ---------- */

.jadwal-kisi {
  display: grid;
  grid-template-columns: 70px repeat(6, minmax(120px, 1fr));
  min-width: 820px;
  gap: 4px;
}

.jadwal-kisi > div { font-size: 0.68rem; }

.jadwal-kepala {
  background: #1e293b;
  color: #fff;
  font-weight: 800;
  font-size: 0.62rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem;
  border-radius: 0.5rem;
  text-align: center;
}

.jadwal-kolom { background: #fef3c7; color: #92400e; }

.jadwal-sel {
  min-height: 66px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.3rem;
  display: grid;
  gap: 2px;
  align-content: start;
}

.jadwal-sel.ada { background: #fffbeb; border-style: solid; border-color: #fcd34d; }

.kartu-murid-kecil {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 0.4rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  gap: 0.2rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kartu-murid-kecil:hover { border-color: var(--oranye); }
.kartu-murid-kecil small { color: var(--abu-2); font-weight: 700; font-size: 0.56rem; }

/* ---------- presensi ---------- */

.c-h { background: #a7f3d0; color: #065f46; }
.c-i { background: #fef08a; color: #854d0e; }
.c-a { background: #fca5a5; color: #991b1b; }
.c-l { background: #e2e8f0; color: #475569; }

.pc {
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  color: inherit;
}

/* ---------- daftar pendaftar ---------- */

.masuk-item {
  border: 1px solid #fde68a;
  background: #fffdf5;
  border-radius: 0.9rem;
  padding: 0.8rem;
  margin-bottom: 0.6rem;
}

.masuk-item__atas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.masuk-item__atas b { font-size: 0.84rem; }

.masuk-item dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.6rem;
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
}

.masuk-item dt { color: var(--abu-2); font-weight: 700; }
.masuk-item dd { margin: 0; color: var(--navy); }

.masuk-item__aksi { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------- kosong ---------- */

.kosong-pesan {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--abu-2);
  font-size: 0.8rem;
}

/* ---------- tombol status ---------- */

.tbl-status {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 0.5rem;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.3rem 0.55rem;
  min-height: 30px;
}

.tbl-status.lunas { background: #d1fae5; border-color: #6ee7b7; color: #047857; }
.tbl-status.belum { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

/* ---------- tirai / form ---------- */

.tirai {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgb(15 23 42 / 55%);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.tirai__kartu {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1.2rem;
  width: 100%;
  max-width: 30rem;
  max-height: 92vh;
  overflow: hidden; /* yang menggulir #tiraiIsi, bukan kartunya */
  padding: 1.4rem;
  box-shadow: 0 25px 60px rgb(15 23 42 / 30%);
}

/* Isi form yang menggulir sendiri, supaya tombol X dan judul tetap di tempat.
   min-height: 0 wajib — tanpa itu anak flex tidak mau mengecil dan
   scroll-nya pindah lagi ke kartu (X hilang saat isi digulir). */
#tiraiIsi {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.15rem;
}

.tirai__kartu h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-right: 2.6rem; /* ruang untuk tombol X, judul panjang tidak menabraknya */
}

.tirai__tutup {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: var(--abu);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form { display: grid; gap: 0.7rem; }

.form label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}

.form input,
.form select {
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.7rem;
  min-height: 44px;
  margin-top: 0.2rem;
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--oranye);
  box-shadow: 0 0 0 3px rgb(230 126 34 / 14%);
}

.form__kaki { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.form__kaki .tbl { flex: 1; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.75rem 1.2rem;
  border-radius: 0.8rem;
  box-shadow: 0 12px 30px rgb(15 23 42 / 30%);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms, transform 220ms;
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast.tampil { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--galat { background: #b91c1c; }

/* ---------- responsif ---------- */

@media (min-width: 640px) {
  .kisi-stat { grid-template-columns: repeat(4, 1fr); }
  .isi { padding: 1.25rem; }
}

@media (min-width: 1024px) {
  .sisi { transform: translateX(0); }
  .utama { margin-left: 240px; }
  .utama__menu { display: none; }
  .isi { padding: 1.5rem; }
  .kisi-dua { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   PERBAIKAN LEBAR (jangan sampai tabel lebar mendorong kartu)
   ========================================================================== */

.kartu,
.tab,
.isi,
.utama {
  min-width: 0;
}

.tabel,
.jadwal-kisi {
  max-width: none;
}

/* Di layar sempit, tanggal disembunyikan supaya judul tidak terhimpit */
@media (max-width: 559px) {
  .pil-tanggal { display: none; }
  .utama__kepala h2 { font-size: 0.95rem; }
  .kartu__kepala { row-gap: 0.45rem; }
  .kartu__kepala small { margin-left: 0; }
  .kartu__aksi { margin-left: 0; width: 100%; }
  .kartu__aksi .inp { flex: 1; min-width: 8rem; }
  .isi { padding: 0.85rem; }
  .kartu { padding: 0.85rem; }
}

/* Target sentuh minimal 40px untuk semua tombol yang bisa diklik */
.tbl--kecil { min-height: 40px; }
.sisi__keluar { min-height: 40px; }
.tbl-status { min-height: 36px; }

/* ---------- legenda warna presensi ---------- */
.warna {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.warna-h { background: #a7f3d0; }
.warna-i { background: #fef08a; }
.warna-a { background: #fca5a5; }
.warna-l { background: #e2e8f0; }
.warna-k { background: #fff; border-style: dashed; border-color: #cbd5e1; }

/* Keterangan kecil di bawah label form */
.bantu-kecil {
  display: block;
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--abu-2, #64748b);
  line-height: 1.4;
}
