/* ==========================================================================
   KONTEN BARU (mengikuti dashboard asli)
   ========================================================================== */

.kartu__judulBaris {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.kartu__judulBaris h3 {
  font-size: 1.1rem;
  font-weight: 800;
}

.kartu__kepala--blok {
  align-items: flex-start;
}

.kartu__kepala--blok>div:first-child {
  flex: 1;
  min-width: 12rem;
}

.kisi-stat--3 {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.baris-atas {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.7rem;
}

.baris-tarif {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.baris-aksi {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.lbl {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

.inp--auto {
  width: auto;
  min-width: 8rem;
}

.inp--angka {
  width: 7.5rem;
}

.tbl--gelap {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.tbl--gelap:hover {
  background: #1e293b;
}

.ta-r {
  text-align: right;
}

.ta-c {
  text-align: center;
}

.teks-kecil {
  font-size: 0.62rem;
  color: var(--abu-2);
  font-weight: 600;
}

.sel-aksi {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.tabel--lebar {
  /* Dulu 880px tetap: di laptop tabelnya melebar keluar kartu dan
     terpotong. Sekarang mengikuti lebar kotaknya. */
  min-width: 0;
  width: 100%;
}

.pil--ungu {
  background: #f3e8ff;
  color: #6b21a8;
}

/* ---- tombol status di tabel ---- */

.tbl-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 0.5rem;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.32rem 0.55rem;
  min-height: 34px;
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.tbl-status:hover {
  background: #f8fafc;
}

.tbl-status.terima {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #047857;
}

.tbl-status.terima:hover {
  background: #a7f3d0;
}

.tbl-status.belum {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.tbl-status.hapus {
  background: #fff;
  border-color: #fecaca;
  color: #b91c1c;
}

.tbl-status.hapus:hover {
  background: #fef2f2;
}

/* ---- rincian ---- */

.rincian {
  border-top: 1px solid #fef3c7;
  padding-top: 0.9rem;
  margin-top: 0.3rem;
}

.rincian summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--navy);
  padding: 0.4rem 0;
}

.rincian summary:hover {
  color: var(--oranye-dk);
}

/* ---- jadwal: slot ---- */

.tabel-jadwal {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 5px;
  text-align: center;
}

.tabel-jadwal th {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--abu);
  padding: 0.3rem;
}

.tabel-jadwal tbody th {
  background: #fef3c7;
  color: #92400e;
  border-radius: 0.45rem;
  font-size: 0.66rem;
  white-space: nowrap;
}

.slot {
  min-height: 68px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.55rem;
  padding: 0.25rem;
  display: grid;
  gap: 2px;
  align-content: start;
  position: relative;
}

.slot--isi {
  background: #fffbeb;
  border-style: solid;
  border-color: #fcd34d;
}

.slot--penuh {
  background: #fef3c7;
  border-color: #f59e0b;
}

.slot__murid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.2rem;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 0.35rem;
  padding: 0.2rem 0.3rem;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--navy);
  text-align: left;
  width: 100%;
  cursor: pointer;
  overflow: hidden;
}

.slot__murid span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot__murid small {
  color: var(--abu-2);
  font-size: 0.55rem;
  flex-shrink: 0;
}

.slot__murid:hover {
  border-color: #ef4444;
  background: #fef2f2;
}

.slot__tambah {
  border: none;
  background: none;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.1rem;
  cursor: pointer;
  border-radius: 0.3rem;
  min-height: 22px;
}

.slot__tambah:hover {
  background: #f1f5f9;
  color: var(--oranye);
}

.ringkas-baris {
  font-size: 0.72rem;
  color: var(--abu);
  padding: 0.7rem 0;
  border-top: 1px solid #fef3c7;
}

.beban-blok h4 {
  font-size: 0.82rem;
  font-weight: 800;
  margin: 0.6rem 0;
}

.kisi-beban {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.kartu-beban {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.6rem;
  padding: 0.5rem 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
}

.kartu-beban b {
  font-weight: 800;
}

.kartu-beban span {
  color: var(--abu);
  font-weight: 700;
  font-size: 0.62rem;
}

/* ---- legend tentor ---- */

.legenda--rapi {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.chip-tentor {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--navy);
}

.chip-tentor b {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  font-size: 0.56rem;
}

.chip-tentor.redup {
  opacity: 0.5;
  text-decoration: line-through;
}

/* ---- presensi matriks ---- */

.kode-legenda {
  background: #fef3c7;
  border-radius: 0.7rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.66rem;
  font-weight: 700;
  color: #92400e;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}

/* Legenda kode tentor di dalam kotak legenda presensi. */
.legenda-kode {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #92400e;
}

.legenda-kode b {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  padding: 0 0.2rem;
  display: inline-grid;
  place-items: center;
  font-size: 0.56rem;
}

/* Pemisah baris: warna di atas, daftar kode tentor di bawahnya. */
.legenda-pisah {
  flex-basis: 100%;
  height: 0;
}

.gulir--matriks {
  overflow-x: auto;
}

.tabel--matriks {
  border-collapse: collapse;
  min-width: 0;
  font-size: 0.62rem;
}

.tabel--matriks th {
  background: #fef3c7;
  color: #92400e;
  padding: 0.3rem 0.2rem;
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  position: static;
}

.tabel--matriks th small {
  font-size: 0.5rem;
  font-weight: 600;
  opacity: 0.7;
}

.tabel--matriks th.kolom-tgl {
  min-width: 21px;
}

.tabel--matriks th.minggu {
  background: #fee2e2;
  color: #991b1b;
}

.tabel--matriks td {
  padding: 1px;
  border: 1px solid #f8fafc;
  text-align: center;
}

.tabel--matriks td.minggu {
  background: #fef2f2;
}

.tabel--matriks td.sticky-kiri,
.tabel--matriks th.sticky-kiri {
  position: sticky;
  left: 0;
  background: #fff;
  text-align: left;
  padding: 0.3rem 0.45rem;
  min-width: 0;
  width: 7.5rem;
  z-index: 2;
  border-right: 1px solid #fef3c7;
}

.tabel--matriks th.sticky-kiri {
  background: #fef3c7;
  z-index: 3;
}

.pc {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 0.3rem;
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  color: #475569;
  background: #f8fafc;
  padding: 0;
  /* Kode tentor di sel hadir harus terbaca jelas di atas warna hijau. */
  line-height: 1;
  letter-spacing: -0.02em;
}

.pc:hover {
  outline: 2px solid var(--oranye);
}

.c-h {
  background: #a7f3d0;
  color: #065f46;
}

.c-i {
  background: #fef08a;
  color: #854d0e;
}

.c-a {
  background: #fca5a5;
  color: #991b1b;
}

.c-l {
  background: #e2e8f0;
  color: #475569;
}

/* Kolom Program di matriks presensi & rekap per murid. */
.tabel--matriks td.kolom-program {
  text-align: left;
  padding: 0.2rem 0.35rem;
  white-space: nowrap;
}

.pil--program {
  background: #ede9fe;
  color: #5b21b6;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  display: inline-block;
}

.rekap-murid {
  padding-top: 1rem;
  border-top: 1px solid #fef3c7;
  display: grid;
  gap: 0.6rem;
}

.rekap-murid h3 {
  font-size: 0.9rem;
  font-weight: 800;
}

/* ---- kartu sempit ---- */

.kartu--sempit {
  max-width: 32rem;
}

.kartu--sempit h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.9rem;
}

/* ---- responsif ---- */

@media (min-width: 640px) {
  .kisi-beban {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .kisi-beban {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media print {

  .sisi,
  .utama__kepala,
  .tbl,
  .tbl-status,
  .baris-aksi,
  .rincian {
    display: none !important;
  }

  .utama {
    margin-left: 0 !important;
  }

  body {
    background: #fff;
  }
}

/* ==========================================================================
   HP: PANEL DIJADIKAN NYAMAN DIJARI (ditambahkan setelah audit 320-414px)
   Aturan: tidak ada horizontal scroll di seluruh halaman; hanya tabel data
   dan matriks presensi yang bergulir di dalam kotaknya sendiri.
   ========================================================================== */

@media (max-width: 799px) {

  /* ---- jadwal: tabel 6 hari diganti daftar per hari ---- */
  .gulir:has(> .tabel-jadwal) {
    overflow: visible;
  }

  .tabel-jadwal--hp {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .tabel-jadwal--hp tbody {
    display: block;
  }

  .tabel-jadwal--hp .jadwal-hp-hari {
    display: block;
  }

  .tabel-jadwal--hp .jadwal-hp-hari>td {
    display: block;
    padding: 0;
  }

  .tabel-jadwal--hp thead,
  .tabel-jadwal--hp .jam-lbl {
    display: none;
  }

  .jadwal-hari {
    background: #fff;
    border: 1px solid #f1e6d2;
    border-radius: 0.8rem;
    padding: 0.6rem 0.65rem;
    margin-bottom: 0.6rem;
  }

  .jadwal-hari__kepala {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
  }

  .jadwal-hari__kepala b {
    font-size: 0.82rem;
    color: var(--navy);
    font-weight: 800;
  }

  .jadwal-hari__kepala small {
    font-size: 0.66rem;
    color: var(--abu-2);
    font-weight: 700;
  }

  .jadwal-baris {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-top: 1px dashed #f1e6d2;
  }

  .jadwal-baris:first-of-type {
    border-top: none;
  }

  .jadwal-baris .jam-lbl {
    display: block;
    flex: 0 0 3rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: #92400e;
    background: #fef3c7;
    border-radius: 0.4rem;
    padding: 0.3rem 0;
    text-align: center;
  }

  .jadwal-baris .slot {
    flex: 1;
    min-height: 44px;
    min-width: 0;
  }

  .jadwal-baris .slot__murid {
    min-height: 40px;
    font-size: 0.72rem;
    padding: 0.3rem 0.45rem;
  }

  .jadwal-baris .slot__murid span {
    font-size: 0.72rem;
  }

  .slot__tambah {
    position: absolute;
    inset: 0;
    font-size: 1.1rem;
    min-height: 44px;
    opacity: 0.55;
  }

  .slot--isi .slot__tambah,
  .slot--penuh .slot__tambah {
    display: none;
  }

  /* ---- matriks presensi: kolom nama+tentor tetap menempel, sel lebih besar ---- */
  .tabel--matriks th,
  .tabel--matriks td {
    padding: 0.2rem;
  }

  .tabel--matriks .pc {
    width: 34px;
    height: 34px;
    font-size: 0.7rem;
    border-radius: 0.45rem;
  }

  .tabel--matriks .sticky-kiri {
    min-width: 6.2rem;
    max-width: 6.2rem;
  }

  /* ---- tabel data umum: kolom aksi tidak menekan isi, font nyaman ---- */
  .tabel td,
  .tabel th {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    white-space: nowrap;
  }

  .tabel td:first-child,
  .tabel-td-nama {
    white-space: normal;
  }

  /* ---- tombol status jadi target jempol ---- */
  .tbl-status,
  .tbl--kecil,
  .pc,
  .slot__murid {
    min-height: 44px;
  }

  .tbl-status {
    padding: 0.5rem 0.7rem;
    font-size: 0.72rem;
  }

  .baris-aksi {
    gap: 0.45rem;
  }

  .baris-aksi .tbl {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* ---- judul ganda: judul di isi cukup untuk desktop ---- */
  .tab>.kartu__kepala--blok h3:first-child {
    display: none;
  }

  .kartu__judulBaris h3 {
    display: none;
  }

  .kartu__kepala--blok>div>.bantu {
    margin-top: 0;
  }

  /* ---- statistik dan kartu: padding hemat, angka tidak meluber ---- */
  .stat span {
    font-size: 1.35rem;
  }

  .stat b {
    font-size: 0.72rem;
  }

  /* ---- header: subjudul boleh turun baris, tombol simpan jangan memakan judul ---- */
  .utama__kepala>div:nth-child(2) {
    min-width: 0;
    flex: 1;
  }

  .utama__kepala h2 {
    font-size: 1rem;
    line-height: 1.15;
  }

  .utama__kepala small {
    font-size: 0.66rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 399px) {
  .tabel--matriks .pc {
    width: 30px;
    height: 30px;
  }

  .utama__kepala {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
    gap: 0.5rem;
  }

  .isi {
    padding: 0.65rem;
  }

  .kartu {
    padding: 0.7rem;
  }
}

/* ---- kolom catatan pada matriks presensi ---- */

.kolom-catatan {
  /* Dulu 9-14rem tetap: di laptop kolom ini memakan ruang sampai tabel
     matriks melebar 1148px dan separuhnya terpotong. Sekarang boleh
     menyusut mengikuti sisa ruang. */
  min-width: 0;
  width: 8rem;
  max-width: 12rem;
  text-align: left;
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -6px 0 8px -8px rgba(15, 23, 42, 0.25);
}

thead .kolom-catatan {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.62rem;
}

.inp--catatan {
  width: 100%;
  min-width: 7rem;
  height: 34px;
  padding: 0.25rem 0.45rem;
  font-size: 0.68rem;
  border-radius: 0.4rem;
}

@media (max-width: 799px) {
  .kolom-catatan {
    min-width: 0;
    width: 7rem;
    max-width: 7rem;
  }

  .inp--catatan {
    min-height: 40px;
    height: 40px;
    font-size: 0.72rem;
  }
}

/* ============ TABEL PANEL DI LAYAR SEMPIT ============ */
/* Di HP, tabel dengan banyak kolom (rekap, murid, presensi) pasti lebih
   lebar dari layar. Sebelumnya header tabel membungkus jadi tinggi
   sementara isinya tetap nowrap, sehingga tabel melebar keluar kartu
   tanpa bisa digeser. Perbaikannya: header juga nowrap supaya tabel
   utuh, lalu GULIR yang bekerja di dalam kartu. Tidak ada yang
   terpotong, semua kolom tetap bisa dicapai. */
@media (max-width: 799px) {
  .gulir {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .gulir>.tabel {
    /* Tabel boleh lebih lebar dari kartu -- inilah yang digeser. */
    width: max-content;
    min-width: 100%;
  }

  .tabel th,
  .tabel td {
    white-space: nowrap;
  }

  /* Kolom nama pada tabel data tetap boleh turun baris supaya tidak
     selebar layar sendirian. */
  .tabel td small,
  .tabel .teks-kecil {
    white-space: normal;
  }

  /* Matriks presensi: nama murid nempel kiri, catatan nempel kanan. */
  .tabel--matriks {
    width: max-content;
    min-width: 0;
  }

  .tabel--matriks td.sticky-kiri,
  .tabel--matriks th.sticky-kiri {
    position: sticky;
    left: 0;
    z-index: 2;
  }

  .tabel--matriks .kolom-catatan {
    position: sticky;
    right: 0;
    z-index: 2;
  }
}