:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1e2536;
  --muted: #6b7488;
  --line: #e2e6ef;
  --brand: #2b5ce6;
  --brand-dk: #1f47b8;
  --ok: #1f9d55;
  --ok-bg: #e6f6ec;
  --err: #d64545;
  --err-bg: #fdeaea;
  --warn-bg: #fff6e0;
  --special: #f0f2f8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20,30,60,.08), 0 6px 18px rgba(20,30,60,.05);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.sm { font-size: .85rem; }
.mt { margin-top: .8rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Topbar */
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1.2rem; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; gap: .6rem;
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand small { display: block; color: var(--muted); font-weight: 400; }
.logo {
  background: var(--brand); color: #fff; font-weight: 700; letter-spacing: .5px;
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
}
.versi-switch { display: flex; align-items: center; gap: .35rem; margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .25rem .5rem; }
.versi-switch select { width: auto; border: none; background: transparent; font-weight: 700; color: var(--brand-dk); padding: .2rem; }
.versi-ico { font-size: 1rem; }
.versi-manage { text-decoration: none; color: var(--muted); font-size: 1.1rem; padding: 0 .2rem; }
.versi-manage:hover { color: var(--brand); }
.row-aktif { background: #eef4ff; }
.sep { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

nav { display: flex; gap: .2rem; flex-wrap: wrap; }
nav a {
  color: var(--ink); padding: .45rem .7rem; border-radius: 8px; font-weight: 500;
}
nav a:hover { background: var(--bg); text-decoration: none; }
nav a.active { background: var(--brand); color: #fff; }

main { max-width: 1180px; margin: 1.4rem auto; padding: 0 1.2rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem; }

/* Panels & layout */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem;
}
.panel.warn { background: var(--warn-bg); border-color: #f0d98a; }
.grid-2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.2rem; align-items: start; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: .6rem; align-items: center; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: .2rem; color: var(--ink);
}
.card:hover { text-decoration: none; border-color: var(--brand); }
.card .num { font-size: 2rem; font-weight: 700; color: var(--brand); line-height: 1; }
.card .lbl { color: var(--muted); font-size: .85rem; }

.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin: .35rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 20px;
  padding: .35rem .8rem; color: var(--ink); font-weight: 500;
}
.chip:hover { border-color: var(--brand); text-decoration: none; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: .1rem; }
input, select {
  font: inherit; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.form-col { display: flex; flex-direction: column; gap: .7rem; }
.form-col button { align-self: flex-start; }
.chk-inline { display: flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--ink); }
.chk-inline input { width: auto; }
.form-row { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; }
.form-row label { flex: 1; }
.filter label { display: flex; align-items: center; gap: .5rem; margin: 0; }
.filter select { width: auto; }
.filter-multi { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.filter-multi label { flex-direction: column; align-items: flex-start; gap: .1rem; font-size: .78rem; color: var(--muted); }

/* Ringkasan JP di Penugasan */
.jp-summary { background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 8px;
  padding: .55rem .8rem; margin-bottom: .8rem; font-size: .92rem; }
.jp-summary.over { background: var(--err-bg); border-color: #f0c0c0; }
.jp-summary .jp-num { font-weight: 800; font-size: 1.1rem; color: var(--brand-dk); }
.jp-summary.over .jp-num { color: var(--err); }
.jp-summary .jp-cap { color: var(--muted); }
.jp-foot td { background: #f5f7fb; font-weight: 700; border-top: 2px solid var(--line); }
.cell-sel { padding: .3rem .35rem; min-width: 120px; }
.rk-no { color: var(--muted); text-align: center; width: 34px; }
td.ctr { text-align: center; }
td.ctr input { width: auto; }

/* Komparasi kelas selevel */
.badge.warn-badge { background: var(--err-bg); color: var(--err); }
.beda-chip { background: #fff3cd; padding: 0 .3rem; border-radius: 4px; }
.komparasi { border-collapse: collapse; width: 100%; min-width: 420px; }
.komparasi th, .komparasi td { border: 1px solid var(--line); padding: .4rem .55rem; text-align: center; }
.komparasi th { background: var(--brand); color: #fff; }
.komparasi td:first-child, .komparasi td:nth-child(2) { text-align: left; }
.komparasi .row-beda { background: #fff8e1; }
.komparasi .jp-nil { color: #ccc; }
.komparasi .txt-beda { color: var(--err); }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: .5rem .9rem; border-radius: 8px;
  display: inline-flex; align-items: center; gap: .3rem; line-height: 1;
}
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dk); }
.btn.danger { color: var(--err); border-color: #f0c0c0; }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn.sm { padding: .3rem .55rem; font-size: .82rem; }
form { display: inline; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
table.tight th, table.tight td { padding: .3rem .35rem; }
.badge { background: #eef2ff; color: var(--brand-dk); border-radius: 6px; padding: .1rem .4rem; font-size: .8rem; font-weight: 700; }
.badge.alt { background: #eafaf1; color: var(--ok); }

/* Flash */
.flash-wrap { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .6rem .9rem; border-radius: 8px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }

/* Jam pelajaran */
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.2rem; }
.day h2 { border-bottom: 2px solid var(--brand); padding-bottom: .3rem; }
tr.jenis-istirahat, tr.jenis-ibadah, tr.jenis-upacara,
tr.jenis-doa, tr.jenis-mentoring, tr.jenis-ekskul { background: var(--special); }
tr.jenis-ibadah { background: #eaf3ff; }
.add-slot { display: flex; gap: .3rem; margin-top: .6rem; flex-wrap: wrap; align-items: center; }
.add-slot input, .add-slot select { width: auto; }
/* Tabel jam (satu hari per tab, lebar penuh) */
.jam-table { width: 100%; }
.jam-table .slot-num { color: var(--muted); font-weight: 700; text-align: center; width: 1.6rem; }
.actions-inline { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.actions-inline form { display: inline-flex; }
.actions-inline .btn.sm { padding: .12rem .45rem; }
.actions-inline select { width: auto; font-size: .8rem; padding: .1rem .2rem; }
table.tight input, table.tight select { max-width: 100%; box-sizing: border-box; }

/* Jadwal editor */
.jadwal-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .jadwal-layout { grid-template-columns: 1fr; } }
.grid-jadwal { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.day-col h3 { margin: 0 0 .4rem; text-align: center; font-size: .95rem; padding: .3rem; background: var(--brand); color: #fff; border-radius: 8px; }
.slot-cell {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .45rem; margin-bottom: .4rem; min-height: 58px; cursor: pointer; position: relative;
}
.slot-cell:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.slot-cell .t { font-size: .68rem; color: var(--muted); }
.slot-cell .mp { font-weight: 700; margin-top: .15rem; }
.slot-cell .gr { font-size: .78rem; color: var(--brand-dk); }
.slot-cell.filled { background: #f2f6ff; border-color: #c6d6ff; }
.slot-cell.locked { background: #fff6e0; border-color: #f0c96b; box-shadow: inset 0 0 0 1px #f0c96b; }
.slot-cell.blocked { background: repeating-linear-gradient(45deg, #eceff5, #eceff5 6px, #e2e6ef 6px, #e2e6ef 12px); border-color: #c3c9d6; color: #7a8296; }
.slot-cell.blocked .mp { font-weight: 700; }
.slot-cell.blocked .gr { font-size: .72rem; color: #7a8296; }
.slot-cell .lock-badge { position: absolute; top: 2px; left: 5px; font-size: .7rem; }
.slot-cell.special { background: var(--special); cursor: default; text-align: center; }
.slot-cell.special .lbl { font-weight: 700; color: var(--muted); margin-top: .4rem; }
.slot-cell .num { position: absolute; top: 3px; right: 6px; font-size: .65rem; color: var(--muted); }

.sidebar h2 { margin-bottom: .3rem; }
.rk-item { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.rk-item .rk-count { font-weight: 700; }
.rk-item.done .rk-count { color: var(--ok); }
.rk-item.over .rk-count { color: var(--err); }

.loading { padding: 2rem; text-align: center; color: var(--muted); }

/* Generate panel */
.gen-panel { background: #f7faff; border-color: #cfe0ff; }
.gen-form { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.gen-form b { color: var(--brand-dk); }
.inline { display: inline; margin: 0; }
.inline select { width: auto; }

/* Kapasitas */
.kapasitas { margin-bottom: .3rem; }
.kap-row { display: flex; justify-content: space-between; padding: .25rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.kap-row b.over { color: var(--err); }
.kap-warn { background: var(--err-bg); color: var(--err); border-radius: 8px; padding: .4rem .6rem; margin-top: .5rem; font-size: .82rem; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,28,50,.45); display: grid; place-items: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 1.3rem; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box h3 { margin: 0 0 1rem; }
.field { margin-bottom: .9rem; }
.field label { margin-bottom: .3rem; }
.guru-check { display: flex; flex-direction: column; gap: .35rem; max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; }
.guru-check label { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 500; margin: 0; cursor: pointer; }
.guru-check input { width: auto; }
.guru-check .hint { color: var(--muted); font-weight: 400; font-size: .8rem; }
.modal-actions { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; }
.modal-actions .spacer { flex: 1; }
.modal-error { background: var(--err-bg); color: var(--err); padding: .5rem .7rem; border-radius: 8px; font-size: .85rem; margin-top: .5rem; }
.modal-error.hidden { display: none; }
.lock-field { background: #fff6e0; border: 1px solid #f0d98a; border-radius: 8px; padding: .5rem .7rem; }
.lock-label { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 600; margin: 0; cursor: pointer; }
.lock-label input { width: auto; }
.lock-field small { display: block; margin-top: .2rem; }

/* Loader progres generate */
.gen-box { width: min(460px, 92vw); text-align: center; }
.progress { height: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: .3rem 0; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #4f7df0); transition: width .3s ease; }
.gen-percent { font-weight: 800; font-size: 1.3rem; color: var(--brand-dk); }
.gen-result { margin-top: .8rem; padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; text-align: left; }
.gen-result.ok { background: var(--ok-bg); color: var(--ok); }
.gen-result.warn { background: var(--warn-bg); color: #8a6d00; }
.gen-result.hidden, .hidden { display: none; }

/* Jadwal lengkap (tabs + grid) */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 2px solid var(--line); }
.tab-btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); border-bottom: none;
  background: #fff; color: var(--muted); padding: .55rem 1.1rem; border-radius: 8px 8px 0 0; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.day-title { display: none; }

/* Mode "menyamping": tampilkan tabel lebar semua hari, sembunyikan tab */
.wide-only { display: none; }
body.allday .tabs, body.allday .tab-panel { display: none; }
body.allday .wide-only { display: block; }
.wide-title { font-size: 1rem; margin: .3rem 0 .5rem; }

/* Tabel lebar (semua hari sejajar) — kompak */
.wide-block { margin-bottom: 1rem; }
.wide-grid .cetak-note { white-space: pre-line; text-align: left; vertical-align: top;
  background: var(--special); font-size: .78rem; line-height: 1.3; padding: .4rem .5rem; }
.wide-grid .note-head { width: 46mm; }
/* Panel "Pengaturan cetak" (menu Lengkap) — tata letak rapi */
.catatan-edit { display: block; }
.catatan-edit .ce-head { margin-bottom: .8rem; }
.catatan-edit .ce-head .muted { display: block; margin-top: .1rem; }
.catatan-edit .ce-grid { display: flex; flex-wrap: wrap; gap: .8rem 1rem; }
.catatan-edit .ce-field { flex: 1 1 260px; min-width: 0; display: flex;
  flex-direction: column; gap: .25rem; margin: 0; }
.catatan-edit .ce-lbl { font-size: .82rem; font-weight: 600; color: var(--ink); }
.catatan-edit textarea, .catatan-edit input { width: 100%; box-sizing: border-box;
  font: inherit; padding: .4rem .5rem; }
.catatan-edit textarea { resize: vertical; min-height: 2.4rem; }
.catatan-edit .ce-actions { margin-top: .9rem; }
.wide-grid { font-size: .7rem; min-width: unset; }
.wide-grid th, .wide-grid td { padding: .1rem .14rem; }
.wide-grid .day-head { background: var(--brand); color: #fff; }
.wide-grid .cls-head { background: #eef2ff; color: var(--brand-dk); font-size: .58rem; white-space: nowrap; }
.wide-grid .col-jam { min-width: 66px; font-size: .64rem; white-space: nowrap; text-align: left; padding: .18rem .3rem; }
.wide-grid .col-jam .jk { font-weight: 700; line-height: 1.1; }
.wide-grid .col-jam .time { font-size: .56rem; color: var(--muted); line-height: 1.1; }
.wide-grid .cell { min-width: 40px; }
.wide-grid .cell .mp { font-weight: 700; line-height: 1.05; }
.wide-grid .cell .gr { font-size: .6rem; color: var(--brand-dk); line-height: 1.05; }
.wide-grid .special { background: var(--special); font-weight: 700; color: var(--muted); letter-spacing: .3px; }
.wide-grid .empty-cell { background: #fafbfd; }

/* Pilih kelas */
.kelas-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.kelas-pick label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-weight: 500; color: var(--ink); }
.kelas-pick input { width: auto; }
.kelas-pick .allcheck { font-weight: 700; }
.table-scroll { overflow-x: auto; }
.full-grid { border-collapse: collapse; width: 100%; min-width: 720px; }
.full-grid th, .full-grid td { border: 1px solid var(--line); text-align: center; padding: .35rem .3rem; vertical-align: middle; }
.full-grid thead th { background: var(--brand); color: #fff; white-space: nowrap; }
.full-grid tfoot .total-row td { background: #eef2ff; font-weight: 700; }
.full-grid .col-jam { background: #f5f7fb; font-size: .72rem; white-space: nowrap; text-align: left; padding: .35rem .5rem; min-width: 96px; }
.full-grid .col-jam .jk { font-weight: 700; color: var(--ink); }
.full-grid .col-jam .time { color: var(--muted); }
.full-grid .cell { min-width: 74px; }
.full-grid .cell .mp { font-weight: 700; color: var(--ink); }
.full-grid .cell .gr { font-size: .78rem; color: var(--brand-dk); }
.full-grid .cell .gr.none { color: #ccc; }
.full-grid .special-row .special-cell { background: var(--special); font-weight: 700; color: var(--muted); letter-spacing: .5px; }
.full-grid .special-row .col-jam { background: var(--special); }

/* Switch, legenda, rekap */
.switch { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 600; color: var(--ink); cursor: pointer; }
.switch input { width: auto; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: 1rem; padding: .6rem .8rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.legend.hidden { display: none; }
.lg-item { padding: .1rem .45rem; border-radius: 5px; font-weight: 700; font-size: .8rem; color: #1e2536; cursor: pointer; border: 2px solid transparent; user-select: none; }
.lg-item:hover { box-shadow: 0 0 0 2px rgba(20,30,60,.15); }
.lg-item.active { border-color: #1e2536; box-shadow: 0 0 0 2px rgba(20,30,60,.25); }
/* Fokus 1 guru di Jadwal Lengkap */
.full-grid .cell.cell-dim { opacity: .12; }
.full-grid .cell.cell-hi { outline: 2px solid rgba(20,30,60,.55); outline-offset: -2px; }

/* Kotak blok pelajaran. Setiap sel pelajaran punya sisi kiri/kanan tebal;
   sisi atas/bawah hanya bila TIDAK tersambung ke sel bermapel sama (termasuk
   sambungan lewat istirahat). Jadi: blok utuh = kotak, blok dipotong istirahat
   = ⊓ (atas) + ⊔ (bawah), 1 JP sendiri = kotak penuh. */
.full-grid .cell.blk { border-left: 3px solid #111; border-right: 3px solid #111;
  border-top: 0; border-bottom: 0; }
.full-grid .cell.blk.blk-t { border-top: 3px solid #111; }
.full-grid .cell.blk.blk-b { border-bottom: 3px solid #111; }

/* Halaman keterangan (guru & mapel) — dipakai di layar (menyamping) & cetak */
.ref-page { margin-top: 1.2rem; }
.ref-h { margin: 0 0 .4rem; font-size: 1rem; color: var(--brand-dk); }
.ref-cols { display: flex; flex-wrap: wrap; gap: 1.2rem 2.5rem; align-items: flex-start; }
.ref-col { flex: 1 1 320px; min-width: 260px; }
.ref-table { width: 100%; border-collapse: collapse; }
.ref-table th, .ref-table td { border: 1px solid var(--line); padding: .25rem .5rem; text-align: left; font-size: .85rem; }
.ref-table th { background: #eef2ff; color: var(--brand-dk); }
.ref-swatch { display: inline-block; width: 30px; height: 14px; border-radius: 3px; border: 1px solid #999; vertical-align: middle; }
.cetak-judul { white-space: pre-line; }
.cetak-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: .3rem 2rem; margin-top: .6rem; font-size: .85rem; }
/* Watermark DRAFT (diagonal) — tampil saat toggle Draft aktif */
.watermark { display: none; position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-38deg); font-size: 24vw; font-weight: 900;
  color: rgba(20,30,60,.12); letter-spacing: .08em; white-space: nowrap;
  pointer-events: none; z-index: 999; }
body.draft.allday .watermark { display: block; }  /* preview layar saat Menyamping */
.rekap { border-collapse: collapse; width: 100%; min-width: 520px; }
.rekap th, .rekap td { border: 1px solid var(--line); text-align: center; padding: .35rem .5rem; }
.rekap thead th { background: var(--brand); color: #fff; }
.rekap .rk-lab { text-align: left; font-weight: 600; background: #f5f7fb; white-space: nowrap; }

/* Print pages */
body.print { background: #fff; padding: 1.5rem; }
.print-head { text-align: center; margin-bottom: 1rem; }
.print-head h1 { margin: 0; font-size: 1.4rem; letter-spacing: 1px; }
.print-head h2 { margin: .2rem 0 .6rem; font-size: 1.05rem; color: var(--muted); font-weight: 600; }
.print-grid { border: 2px solid #333; }
.print-grid th, .print-grid td { border: 1px solid #999; text-align: center; padding: .35rem; }
/* latar sel (warna guru) & header ikut tercetak */
.print-grid th, .print-grid .cell, .print-grid .special {
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-grid th { background: #eef2ff; }
.print-grid .col-jam { width: 46px; font-weight: 700; background: #f5f7fb; }
.print-grid .time { font-size: .7rem; color: #666; }
.print-grid .mp { font-weight: 700; }
.print-grid .gr { font-size: .8rem; color: var(--brand-dk); }
.print-grid .empty { color: #ccc; }
.print-grid .special { background: #f0f2f8; }
.print-grid .special .lbl { font-weight: 700; color: #555; }
.print-note { text-align: center; color: var(--muted); font-size: .8rem; margin-top: .8rem; }
/* Keterangan mapel & guru di halaman Cetak */
.print-legend { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1rem;
  font-size: .82rem; page-break-inside: avoid; }
.print-legend .pl-col { flex: 1 1 260px; min-width: 220px; }
.print-legend ul { margin: .35rem 0 0; padding: 0; list-style: none; columns: 2; }
.print-legend li { margin: .12rem 0; break-inside: avoid; }
.pl-sw { display: inline-block; width: 20px; height: 11px; border: 1px solid #999;
  border-radius: 2px; vertical-align: middle; margin-right: .2rem;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Cetak per-kelas / per-guru: jadwal (atas) + keterangan (bawah) muat 1 halaman A4 */
@media print {
  .print-head { margin: 0 0 3mm; }
  .print-head h1 { font-size: 15pt; margin: 0; letter-spacing: .5px; }
  .print-head h2 { font-size: 11pt; margin: 1mm 0 0; }
  .print-grid { font-size: 9pt; page-break-inside: avoid; }
  .print-grid th, .print-grid td { padding: 1.5px 3px; }
  .print-grid .col-jam { width: 34px; }
  .print-grid .time { font-size: 6.5pt; }
  .print-grid .mp { font-size: 9pt; line-height: 1.05; }
  .print-grid .gr { font-size: 8pt; line-height: 1.05; }
  .print-legend { margin-top: 3mm; font-size: 8.5pt; page-break-inside: avoid; }
  .print-legend ul { columns: 2; }
  .print-note { margin-top: 2mm; font-size: 7.5pt; }
}
@media print {
  .no-print, .topbar, .foot { display: none !important; }
  body.print { padding: 0; }
  main { max-width: none; margin: 0; padding: 0; }

  /* Jadwal Lengkap: A4 TEGAK. Sen-Sel-Rab ½ atas, Kam-Jum ½ bawah.
     Kolom lebih sedikit per tabel -> huruf bisa jauh lebih besar & terbaca. */
  @page { size: A4 portrait; margin: 4mm 12mm; }  /* atas-bawah 4mm, kiri-kanan 12mm */
  .tabs, .tab-panel, .kelas-pick, .legend, .panel { display: none !important; }
  .wide-only { display: block !important; }
  .wide-title { font-size: 9pt; text-align: center; margin: 0 0 1.5mm; }
  .wide-block { page-break-inside: avoid; margin-bottom: 2mm; }
  .table-scroll { overflow: visible !important; }
  .wide-grid { font-size: 8pt; width: 100%; table-layout: fixed; line-height: 1; }
  .wide-grid th, .wide-grid td { padding: 0.4px 1.5px; border: 0.4pt solid #999;
    text-align: center; word-break: break-word; }
  .wide-grid .cls-head { font-size: 7pt; }
  .wide-grid .col-jam { width: 15mm; font-size: 6.5pt; text-align: left;
    white-space: normal; line-height: 1.02; }
  .wide-grid .col-jam .jk { font-weight: 700; }
  .wide-grid .col-jam .time { font-size: 5.5pt; }
  .wide-grid .cell .mp { font-weight: 700; line-height: 1; }
  .wide-grid .cell .gr { font-size: 6.5pt; line-height: 1; }
  .wide-grid tr { page-break-inside: avoid; }
  /* Fokus guru hanya utk layar; cetak selalu tampil penuh */
  .wide-grid .cell.cell-dim { opacity: 1 !important; }
  .wide-grid .cell.cell-hi { outline: none !important; }
  /* Keterangan: sel yang membentang di baris jam sore Jumat (kolom kanan) */
  .wide-grid .cetak-note { width: 40mm; font-size: 6.5pt; line-height: 1.2;
    padding: 1mm; white-space: pre-line; text-align: left; vertical-align: top;
    background: #f2f4f9; }
  .wide-grid .note-head { width: 40mm; font-size: 5.5pt; }
  /* Halaman ke-2: daftar guru & mapel */
  .ref-page { page-break-before: always; margin-top: 0; }
  .ref-page .wide-title { font-size: 11pt; margin: 0 0 3mm; }
  .ref-h { font-size: 9pt; margin: 0 0 1.5mm; }
  .ref-cols { display: flex; gap: 8mm; align-items: flex-start; }
  .ref-col { flex: 1; }
  .ref-table th, .ref-table td { font-size: 8pt; padding: 0.6mm 1.6mm; border: 0.4pt solid #999; }
  .ref-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ref-swatch { width: 14mm; height: 3.6mm; border: 0.4pt solid #999;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Watermark DRAFT diagonal di setiap halaman cetak (position:fixed berulang) */
  body.draft .watermark { display: block; font-size: 96pt; color: rgba(0,0,0,.14);
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Judul custom (tengah atas) & footer (dibuat pada / versi) */
  .cetak-judul { font-size: 12pt; font-weight: 800; line-height: 1.15; margin: 0 0 2mm; }
  .cetak-footer { display: flex; justify-content: center; gap: 14mm; margin-top: 2.5mm;
    font-size: 8pt; }
  /* Cetak warna: pastikan latar (hari, kelas, warna guru) ikut tercetak */
  .wide-grid .day-head, .wide-grid .cls-head, .wide-grid .special,
  .wide-grid .cell[data-guru], .cetak-note {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

/* Penugasan: setelan override (⚙) per baris */
.pen-adv-row td { background: var(--special); padding: .15rem .5rem; border-top: none; }
.pen-adv-row details > summary { cursor: pointer; font-size: .82rem; list-style: none;
  user-select: none; padding: .1rem 0; }
.pen-adv-row details > summary::-webkit-details-marker { display: none; }
.pen-adv-row details > summary::before { content: "▸ "; color: var(--muted); }
.pen-adv-row details[open] > summary::before { content: "▾ "; }
.pen-adv-grid { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: .35rem 0 .5rem;
  align-items: center; }
.pen-adv-grid label { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; }
.tri-sel { font-size: .8rem; padding: .1rem .2rem; }

/* Kotak warna guru (menu Guru) — lebarkan agar warnanya terlihat jelas */
.warna-input { display: inline-block; width: 100px; min-width: 100px; height: 30px;
  padding: 2px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
  vertical-align: middle; background: none; box-sizing: border-box; }
.warna-input::-webkit-color-swatch-wrapper { padding: 0; }
.warna-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.warna-input::-moz-color-swatch { border: none; border-radius: 4px; }

/* Batasan jam guru */
.jam-row td { background: var(--special); padding: .3rem .6rem; }
.jam-row details > summary { cursor: pointer; font-weight: 600; font-size: .85rem;
  list-style: none; user-select: none; padding: .15rem 0; }
.jam-row details > summary::-webkit-details-marker { display: none; }
.jam-row details > summary::before { content: "▸ "; color: var(--muted); }
.jam-row details[open] > summary::before { content: "▾ "; }
.jam-grid { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin: .3rem 0 .5rem; }
.jam-day { display: flex; align-items: center; gap: .25rem;
  border: 1px solid var(--line); border-radius: 8px; padding: .3rem .5rem; background: #fff; }
.jam-day-name { display: inline-flex; align-items: center; gap: .25rem;
  font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer;
  padding-right: .4rem; margin-right: .1rem; border-right: 1px solid var(--line); }
.jam-day-name input { margin: 0; }
.jam-chip { display: inline-flex; align-items: center; gap: .12rem; font-size: .8rem;
  cursor: pointer; }
.jam-chip input { margin: 0; }
.jam-day.locked { opacity: .45; background: var(--special); }
.jam-day.locked .jam-day-name,
.jam-day.locked .jam-chip { cursor: not-allowed; }

/* ---- Auth: login, userbox, akun ---- */
.userbox { display: flex; align-items: center; gap: .45rem; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .25rem .5rem; }
.userbox .user-ico { font-size: 1rem; }
.userbox .user-name { font-weight: 600; }
.role-badge { font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; padding: .1rem .4rem; border-radius: 6px; }
.role-badge.admin { background: var(--brand); color: #fff; }
.role-badge.user { background: #e6f6ec; color: var(--ok); }

.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.6rem 1.8rem; width: min(92vw, 360px); }
.login-head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; }
.login-head small { display: block; color: var(--muted); font-weight: 400; }
.login-form { display: flex; flex-direction: column; gap: .8rem; }
.login-form label { display: flex; flex-direction: column; gap: .25rem;
  font-weight: 600; font-size: .9rem; }
.login-form button { margin-top: .4rem; justify-content: center; }

/* Akun: layout kolom & form kecil */
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.stack label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; }
.stack button { align-self: flex-start; }
.inline-form { display: inline-block; position: relative; }
.inline-form > summary { list-style: none; cursor: pointer; }
.inline-form > summary::-webkit-details-marker { display: none; }
.pop-form { position: absolute; right: 0; z-index: 5; margin-top: .3rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: .5rem; display: flex; gap: .3rem; width: 220px; }

/* ---- Impor Excel bar ---- */
.import-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: #eef4ff; border: 1px solid #cfe0ff; border-radius: var(--radius);
  padding: .6rem .9rem; margin-bottom: 1rem; }
.import-bar .ib-ico { font-size: 1.2rem; }
.import-bar .ib-txt { flex: 1; min-width: 200px; font-size: .9rem; color: var(--ink); }
.import-bar .ib-form { display: flex; align-items: center; gap: .4rem; margin: 0; }
.import-bar input[type=file] { width: auto; max-width: 210px; font-size: .82rem;
  background: #fff; padding: .3rem; }
