/* Data Siswa LPK — dashboard admin padat, palet netral */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --accent: #4f46e5;
  --accent-h: #4338ca;
  --accent-soft: #eef2ff;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --ok: #15803d;   --ok-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7;
  --err: #b91c1c;  --err-bg: #fee2e2;
  --info: #1d4ed8; --info-bg: #dbeafe;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }

/* ------------------------------------------------------------- layout ----- */
body.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  /* Sidebar TIDAK boleh memotong menu: daftar menu (16 item) lebih tinggi dari
     layar pada laptop/ponsel sekali pun, jadi bagian header/footer dikunci dan
     daftar menunya yang bisa digulung (permintaan pemilik LPK 2026-10-15). */
  overflow: hidden;
  z-index: 40;
}

.brand { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), #7c3aed);
  color: #fff; font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #f8fafc; font-size: 13.5px; }
.brand-text small { color: var(--muted-2); font-size: 11px; }

.nav {
  padding: 8px;
  display: flex; flex-direction: column; gap: 1px;
  flex: 1 1 auto;
  /* min-height:0 wajib: tanpa itu anak flex tidak pernah mengecil dan daftar
     menu tetap terpotong di layar pendek. */
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.28) transparent;
}
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.26); border-radius: 999px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7.5px 10px; border-radius: 7px;
  color: #cbd5e1; font-size: 13px; font-weight: 500;
  flex: 0 0 auto;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #f1f5f9; text-decoration: none; }
.nav-link.is-active { background: var(--accent); color: #fff; }
.nav-link .ico { opacity: .9; flex: 0 0 auto; }
.nav-link span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700;
  flex: 0 0 auto;
}
.nav-link.is-active .nav-badge { background: #fff; color: var(--accent-h); }

.sidebar-foot { flex: 0 0 auto; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; }
.side-user { display: flex; flex-direction: column; line-height: 1.35; }
.side-user strong { color: #f1f5f9; font-size: 13px; }
.side-user small { color: var(--muted-2); font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 17px; }
.topbar-title p { font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.content { padding: 22px 22px 8px; flex: 1; }
.foot { padding: 16px 22px 22px; font-size: 11.5px; color: var(--muted-2); }

/* ------------------------------------------------------------ spacing ----- */
.section + .section, .grid + .grid, .card + .card, .grid + .card, .card + .grid, .section { margin-top: 20px; }
.grid { display: grid; gap: 16px; }
/* Grid item default-nya min-width:auto, sehingga tabel lebar di dalam kartu
   bisa memaksa kolom melebar melewati layar. min-width:0 + table-wrap
   (overflow-x:auto) membuat tabelnya menggulung sendiri, bukan merusak layout. */
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }

/* -------------------------------------------------------------- card ------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 13.5px; }
.card-head .hint { font-size: 11.5px; color: var(--muted); }
.card-body { padding: 14px; }
.card-body.tight { padding: 0; }
.card-body.scroll { max-height: 420px; overflow: auto; }

.stat { padding: 13px 14px; }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------- table ------ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.data th {
  text-align: left; padding: 9px 12px; background: var(--surface-2);
  color: #475569; font-weight: 650; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data .cell-strong { font-weight: 600; color: var(--text); }
table.data .cell-sub { font-size: 11.5px; color: var(--muted); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv th, table.kv td { padding: 7px 0; vertical-align: top; text-align: left; border-bottom: 1px dashed var(--surface-3); }
table.kv th { width: 42%; color: var(--muted); font-weight: 500; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------ badges ------ */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 650; line-height: 1.6; white-space: nowrap;
}
.badge-ok   { background: var(--ok-bg);   color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err  { background: var(--err-bg);  color: var(--err); }
.badge-sp1  { background: #fef3c7; color: #92400e; }
.badge-sp2  { background: #ffedd5; color: #9a3412; }
.badge-sp3  { background: #b91c1c; color: #fff; }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-mute { background: var(--surface-3); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent-h); }

/* matrix kelas × gakkou */
table.data.matrix th.m, table.data.matrix td.m { text-align: center; font-variant-numeric: tabular-nums; width: 120px; }
table.data.matrix td.zero { color: var(--muted-2); }
table.data.matrix tfoot td { border-top: 1px solid var(--border-2); background: var(--surface-2); }

.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #7c3aed); border-radius: 999px; }

/* ----------------------------------------------------------- buttons ------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px; border-radius: 7px; border: 1px solid transparent;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--text-2); border-color: var(--border-2);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--err); }
.btn-danger:hover { background: var(--err-bg); }
.btn-ghost { background: transparent; border-color: rgba(148,163,184,.35); color: inherit; }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.only-mobile { display: none; }

/* ------------------------------------------------------------- forms ------ */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }
.field > label { font-size: 11.5px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.field .help { font-size: 11.5px; color: var(--muted); }

input[type=text], input[type=date], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 7px;
}
textarea { resize: vertical; min-height: 68px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(79,70,229,.28); outline-offset: 0; border-color: var(--accent); }
select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px; }
input[type=file] { font-size: 12.5px; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filters .field { min-width: 150px; flex: 1 1 150px; }
.filters .field.wide { flex: 1 1 240px; }
.filters .acts { display: flex; gap: 8px; align-items: center; padding-bottom: 1px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.check input { width: auto; }
/* Beberapa kotak centang bertumpuk dalam satu isian (mis. keterangan nomor WA). */
.check-col { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 2px; }

/* ------------------------------------------------------------ alerts ------ */
.alert { padding: 10px 13px; border-radius: 7px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-ok   { background: var(--ok-bg);   color: #14532d; border-color: #bbf7d0; }
.alert-err  { background: var(--err-bg);  color: #7f1d1d; border-color: #fecaca; }
.alert-warn { background: var(--warn-bg); color: #78350f; border-color: #fde68a; }
.alert-info { background: var(--info-bg); color: #1e3a8a; border-color: #bfdbfe; }
.empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------- stepper ------- */
.stepper { display: flex; flex-wrap: wrap; gap: 10px; }
.step {
  flex: 1 1 120px; min-width: 120px;
  border: 1px solid var(--border); border-radius: 7px; padding: 9px 10px;
  background: var(--surface-2);
}
.step .step-name { font-size: 12px; font-weight: 650; margin-top: 5px; }
.step .step-date { font-size: 11px; color: var(--muted); }
.step.is-selesai { background: #f0fdf4; border-color: #bbf7d0; }
.step.is-proses  { background: #fffbeb; border-color: #fde68a; }
.step.is-gagal   { background: #fef2f2; border-color: #fecaca; }

.dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }
.dot-belum   { background: var(--muted-2); }
.dot-proses  { background: #f59e0b; }
.dot-selesai { background: #22c55e; }
.dot-gagal   { background: #ef4444; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 10px; font-size: 12.5px; }
.timeline .t-dot { margin-top: 5px; }
.timeline .t-body strong { display: block; font-weight: 600; }
.timeline .t-body span { color: var(--muted); font-size: 11.5px; }

.avatar {
  width: 76px; height: 76px; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--border); background: var(--surface-3);
}
.avatar-fallback {
  width: 76px; height: 76px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-h); font-size: 22px; font-weight: 700; border: 1px solid var(--border);
}
.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .dh-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.detail-head h2 { font-size: 19px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------- pagination ----- */
.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px 14px; }
.pager a, .pager span {
  padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2); background: var(--surface);
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager .is-current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; }
.pager .info { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding-right: 0; }

.stage-row { display: grid; grid-template-columns: 1.3fr 130px 140px 1fr; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--surface-3); }
.stage-row:last-of-type { border-bottom: 0; }
.stage-row .stage-title { font-size: 13px; font-weight: 600; }
.stage-row .stage-desc { font-size: 11.5px; color: var(--muted); }
.stage-head { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* ------------------------------------------------------------- peta ------- */
.map-frame { position: relative; width: 100%; padding-top: 56.25%; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ----------------------------------------------------------- login -------- */
body.login-page {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(79,70,229,.16), transparent 42%),
    radial-gradient(circle at 82% 88%, rgba(124,58,237,.16), transparent 45%),
    var(--bg);
}
.login-card { width: 100%; max-width: 380px; padding: 26px 24px; border-radius: 12px; }
.login-card h1 { font-size: 19px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.login-card .form-grid { margin-top: 20px; grid-template-columns: 1fr; }
.login-card .form-actions { flex-direction: column; align-items: stretch; }
.login-foot { margin-top: 16px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ----------------------------------------------------- panduan/manual ----- */
.toc-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.9; }
.toc-list a { color: var(--text-2); }
.toc-list a:hover { color: var(--accent); }
.manual-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.8; color: var(--text-2); }
.manual-list > li { margin-bottom: 6px; }
.manual-list code, p.help code, table.data code {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-size: 12px;
}
[id^="alur"], [id^="masuk"], [id^="data-siswa"], [id^="tahapan"], [id^="mcu"], [id^="kelas"],
[id^="nilai"], [id^="test"], [id^="poin"], [id^="dokumen"], [id^="keluarga"], [id^="jepang"],
[id^="laporan"], [id^="staf"], [id^="pengaturan"], [id^="sop"], [id^="tanya"] { scroll-margin-top: 80px; }
.card h4 { font-size: 13.5px; color: var(--text); }

/* --------------------------------------------------------- responsive ----- */
/* ----------------------------------------------------------- cetak -------- */
@media print {
  body.app { display: block; background: #fff; font-size: 11.5px; }
  .sidebar, .topbar, .foot, .no-print, .alert { display: none !important; }
  .main { display: block; }
  .content { padding: 0; }
  .card { border: 1px solid #cbd5e1; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .card + .card, .card + .grid, .grid + .card, .section { margin-top: 12px; }
  .card-head { background: #f1f5f9; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr 1fr; }
  table.data { font-size: 10.5px; }
  table.data th { background: #f1f5f9; }
  a { color: inherit; text-decoration: none; }
  .badge { border: 1px solid #94a3b8; background: #fff !important; color: #0f172a !important; }
  .toc-list { columns: 2; }
}

@media (max-width: 900px) {
  .only-mobile { display: inline-grid; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: 0 10px 30px rgba(15,23,42,.25);
    /* Di ponsel sidebar memakai tinggi layar penuh DINAMIS (10dvh) supaya daftar
       menu tetap bisa digulung walau bilah alamat peramban muncul/hilang. */
    height: 100dvh;
  }
  .sidebar.is-open { transform: translateX(0); }
  /* Menu lebih rapat di ponsel: seluruh 16 menu tetap terbaca tanpa gulung
     panjang, dan yang paling penting menu terbawah tidak lagi terpotong. */
  .nav { padding: 6px; }
  .nav-link { padding: 7px 9px; font-size: 12.5px; gap: 8px; }
  .brand { padding: 10px 12px; }
  .brand-mark { width: 30px; height: 30px; flex: 0 0 30px; font-size: 10.5px; }
  .sidebar-foot { padding: 8px 10px; gap: 6px; }
  .content { padding: 16px 14px 8px; }
  .topbar { padding: 10px 14px; }
  .foot { padding: 14px; }
  .stage-row { grid-template-columns: 1fr 1fr; }
  .stage-row .stage-desc { grid-column: 1 / -1; }
  table.data th, table.data td { padding: 8px 10px; }
}

/* Layar pendek (laptop kecil / ponsel mendatar): rapatkan menu supaya semua
   item terlihat, dan biarkan daftar menu yang menggulung bila masih kurang. */
@media (max-height: 760px) {
  .nav { padding: 6px; }
  .nav-link { padding: 6.5px 10px; font-size: 12.5px; }
  .brand { padding: 10px 14px; }
  .brand-text small { display: none; }
  .sidebar-foot { padding: 8px 12px; }
}

/* ==========================================================================
   Pantauan Siswa LPK — tambahan gaya khusus aplikasi angket & pemantauan
   ========================================================================== */

/* ---------------------------------------------- warna baris data matome ---- */
/* Kuning: kasus darurat · Pink: respon positif · Biru muda: negatif umum    */
table.data tbody tr.row-kuning > td { background: #fef9c3; }
table.data tbody tr.row-kuning:hover > td { background: #fef08a; }
table.data tbody tr.row-pink > td { background: #fce7f3; }
table.data tbody tr.row-pink:hover > td { background: #fbcfe8; }
table.data tbody tr.row-biru > td { background: #e0f2fe; }
table.data tbody tr.row-biru:hover > td { background: #bae6fd; }
table.data tbody tr.row-kuning > td:first-child { box-shadow: inset 3px 0 0 #eab308; }
table.data tbody tr.row-pink > td:first-child { box-shadow: inset 3px 0 0 #ec4899; }
table.data tbody tr.row-biru > td:first-child { box-shadow: inset 3px 0 0 #0ea5e9; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border-2); }

/* ------------------------------------------------- prioritas (bendera) ----- */
.badge.prioritas-merah  { background: #b91c1c; color: #fff; }
.badge.prioritas-oranye { background: #ea580c; color: #fff; }
.badge.prioritas-kuning { background: #eab308; color: #422006; }

.krisis-card { border-color: #fecaca; }
.krisis-card .card-head { background: #fef2f2; border-color: #fecaca; }
.krisis-item { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed #fecaca; }
.krisis-item:last-child { border-bottom: 0; }
.krisis-item .ki-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.krisis-item .ki-name { font-weight: 650; font-size: 13.5px; }
.krisis-item .ki-meta { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------- alert berkedip ---------- */
.blink {
  animation: blink-warn 1s steps(2, start) infinite;
  display: inline-block;
  font-weight: 700;
}
@keyframes blink-warn { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }

.alert-crisis {
  background: #fef2f2; color: #7f1d1d; border: 2px solid #ef4444;
  font-weight: 600; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}

/* ------------------------------------------------- countdown triwulan ----- */
.countdown { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; }
.countdown .cd-time { font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.countdown .cd-label { font-size: 12px; color: var(--muted); }
.persen-pill { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 700; }
.persen-pill small { font-weight: 500; color: var(--muted); font-size: 11px; }
.persen-low  { color: var(--err); }
.persen-mid  { color: var(--warn); }
.persen-high { color: var(--ok); }

/* Angka pada tabel capaian per tantou yang bisa diklik (jalan pintas ke daftar
   siswa kategori itu — permintaan pemilik LPK 2026-10-30). Angkanya diberi garis
   bawah putus-putus supaya terlihat bisa diklik tanpa membuat tabel ramai. */
table.data a.num-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  /* Area klik diperbesar tanpa menggeser angka: padding + margin negatif sama. */
  padding: 2px 5px;
  margin: -2px -5px;
  border-radius: 5px;
}
table.data a.num-link:hover { text-decoration-style: solid; background: var(--surface-2); }
table.data a.num-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
table.data a.num-link .persen-pill { text-decoration: inherit; }

/* -------------------------------------------------- riwayat & jawaban ------ */
table.qa { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.qa th { text-align: left; padding: 9px 12px; background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: #475569; border-bottom: 1px solid var(--border); }
table.qa td { padding: 9px 12px; border-bottom: 1px solid var(--surface-3); vertical-align: top; }
table.qa td.qa-q { width: 30%; color: var(--text-2); font-weight: 550; }
table.qa td.qa-a { white-space: pre-wrap; word-break: break-word; }
table.qa .ja { color: #334155; font-size: 12.5px; }
table.qa .qa-jp-id { color: var(--muted); font-size: 11.5px; display: block; }
.tag-periksa { display: inline-block; margin-top: 4px; font-size: 11px; color: #92400e; background: var(--warn-bg); border: 1px solid #fde68a; border-radius: 5px; padding: 1px 6px; }

.link-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-box input[type=text] { flex: 1 1 260px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.bubble { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.bubble.wa-ok { background: #f0fdf4; border-color: #bbf7d0; }
.bubble.wa-err { background: #fef2f2; border-color: #fecaca; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); font-size: 11.5px; color: var(--text-2); border: 1px solid var(--border); }
.chip.is-hit { background: #fee2e2; border-color: #fecaca; color: #7f1d1d; font-weight: 600; }

/* ------------------------------------------------------------ catatan ------ */
.note { font-size: 12px; color: var(--muted); }
.stepper-mini { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper-mini span { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }

/* --------------------------------------------------------- responsive ------ */
@media (max-width: 900px) {
  table.qa td.qa-q { width: 40%; }
  .countdown .cd-time { font-size: 21px; }
}

/* ---------------------------------------------- identitas LPK & logo ------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.logo-ubin { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.logo-pratinjau {
  flex: 0 0 168px; min-height: 84px; padding: 14px 16px;
  display: grid; place-items: center; text-align: center;
  border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2, #f8fafc);
}
.logo-pratinjau img { max-width: 150px; max-height: 62px; display: block; }
.logo-pratinjau .belum { font-size: 12px; color: var(--muted, #64748b); line-height: 1.45; }

/* ============================================================================
   Menu "Pratinjau Angket" (2026-10-12): susunan tombol uji coba + tabel
   percabangan. Sengaja netral & padat mengikuti gaya dasbor yang sudah dipakai.
   ========================================================================== */
.tumpuk { display: flex; flex-direction: column; gap: 8px; }
.tumpuk .btn { justify-content: flex-start; }

/* ============================================================================
   Rekap Tantou: siswa yang mengisi angket LEBIH DARI SEKALI (2026-10-30)
   - .sel-hijau  : latar hijau muda pada sel nama (penanda yang sama dengan
                   gaya sel Excel REKAP_GAYA_HIJAU / fill FF C6 EF CE);
   - .ubah-list  : daftar jawaban yang berubah (pertama → terbaru).
   ========================================================================== */
.sel-hijau { background: #c6efce; box-shadow: inset 0 0 0 1px #a7e0b4; border-radius: 4px; padding: 1px 4px; }
.ubah-list { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.5; }
.ubah-list li { margin-bottom: 3px; }
.ubah-list li strong { color: var(--text, #0f172a); }

/* ============================================================================
   Menu "Hutang & Piutang" (2026-11-05): rincian per orang pada satu sel tabel.
   Satu siswa bisa berhutang/meminjamkan ke beberapa orang, jadi rinciannya
   berupa daftar bernomor yang boleh membungkus (jangan nowrap — isinya teks
   bebas seperti "Kumiai · Budi · Rp 500.000").
   ========================================================================== */
.utang-list { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.55; white-space: normal; }
.utang-list li { margin-bottom: 3px; word-break: break-word; }
.utang-list li:last-child { margin-bottom: 0; }

/* ============================================================================
   Tombol "← Kembali" di topbar (2026-11-05) — muncul OTOMATIS di semua halaman
   bila ada halaman sebelumnya (lihat kembali_url() di inc/util.php). Filter
   yang sedang dipakai ikut terbawa karena query string referer dipakai utuh.
   ========================================================================== */
.btn-kembali { white-space: nowrap; }
@media (max-width: 560px) {
  /* Di ponsel tombol cukup ikon + kata "Kembali" agar tidak mendorong judul. */
  .btn-kembali { padding-left: 8px; padding-right: 8px; font-size: 11.5px; }
}

/* ============================================================================
   Daftar Kasus & Tindak Lanjut (2026-11-05): pembeda "sudah dibuka" (hijau)
   vs "belum dibuka" (kuning muda) pada nama siswa. Tanda disimpan per AKUN di
   tabel `kasus_cek`, jadi tetap ada setelah login lagi. `.sel-hijau` sudah ada
   (dipakai Rekap Tantou); `.sel-kuning` baru, dibuat lebih lembut supaya nama
   siswa tetap mudah dibaca.
   ========================================================================== */
.sel-kuning { background: #fef9c3; box-shadow: inset 0 0 0 1px #fde68a; border-radius: 4px; padding: 1px 4px; }

/* ============================================================================
   Notifikasi perubahan data siswa (2026-11-13) — ikon lonceng di POJOK KANAN
   topbar semua halaman, dengan panel daftar perubahan.
   Penting: `[hidden]` HARUS menang atas `display:flex/block` di bawah ini —
   kalau tidak, panel yang seharusnya tertutup akan selalu tampil (jebakan yang
   sudah pernah terjadi di aplikasi ini & arcadia-monreq).
   ========================================================================== */
[hidden] { display: none !important; }

.notif-wrap { position: relative; flex: 0 0 auto; }
.notif-btn { position: relative; }
.notif-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--accent); }
.notif-dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: inline-grid; place-items: center;
  border-radius: 999px; background: #dc2626; color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  box-shadow: 0 0 0 2px #fff;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 520px); overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
}
.notif-head { padding: 11px 13px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.notif-head strong { font-size: 13px; }
.notif-list { overflow-y: auto; overscroll-behavior: contain; }
.notif-item {
  display: flex; gap: 9px; padding: 9px 13px; border-bottom: 1px solid var(--surface-3);
  color: inherit; text-decoration: none; align-items: flex-start;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.is-baru { background: rgba(47, 125, 196, .07); }
.notif-item.is-baru .notif-nama::after {
  content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px;
  border-radius: 999px; background: #dc2626; vertical-align: middle;
}
.notif-ikon { flex: 0 0 auto; color: var(--muted); margin-top: 2px; }
.notif-isi { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.notif-nama { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-sub { font-size: 12px; color: var(--text-2); }
.notif-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 2px; }
.notif-kosong { padding: 16px 13px; font-size: 12.5px; color: var(--muted); }
.notif-foot {
  padding: 9px 13px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; background: var(--surface-2);
}
@media (max-width: 560px) {
  /* Di ponsel panel melebar mengikuti layar, tidak keluar dari topbar. */
  .notif-panel { position: fixed; top: 58px; left: 8px; right: 8px; width: auto; max-height: 72vh; }
}
