/* ==========================================================================
   Pengawalan — gaya bersama
   Palet mengikuti proyek ekobis: kertas hangat, aksen hijau tua.
   ========================================================================== */

:root {
  --bg: #F3F1EB;
  --surface: #FFFFFF;
  --surface-sunken: #EDEAE1;
  --text-primary: #26241F;
  --text-secondary: #6B6858;
  --text-muted: #97927F;
  --border: #DEDAD0;
  --border-strong: #C7C2B3;
  --accent: #2C5A54;
  --accent-soft: #E1EBE8;
  --accent2: #6B4C7A;
  --accent2-soft: #EBE4EE;
  --success: #4C7A48;
  --success-soft: #E3EDE1;
  --warn: #A2721F;
  --warn-soft: #F3E7D2;
  --danger: #A23B2E;
  --danger-soft: #F5E2DE;
  --radius: 10px;
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1A17;
    --surface: #242320;
    --surface-sunken: #1F1E1B;
    --text-primary: #EDEAE1;
    --text-secondary: #A8A497;
    --text-muted: #7C7869;
    --border: #3A382F;
    --border-strong: #4C4939;
    --accent: #7FB7AC;
    --accent-soft: #263532;
    --accent2: #C3A2D3;
    --accent2-soft: #302838;
    --success: #92BE86;
    --success-soft: #26301F;
    --warn: #E4B66C;
    --warn-soft: #362B18;
    --danger: #E08874;
    --danger-soft: #38221D;
  }
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: var(--font-sans); font-size: 0.9375rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- rangka ---------- */
.app { max-width: 1100px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.app.narrow { max-width: 760px; }

.masthead {
  padding-bottom: 1.1rem;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.masthead-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.masthead-sub { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.3rem; max-width: 52ch; }
.masthead-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ---------- rangka: menu samping + isi ----------
   Menu di samping supaya daftar yang panjang (mentor punya 11 menu) tidak
   memakan tinggi layar. Di layar lebar bisa diciutkan jadi ikon saja;
   di HP menjadi laci yang dibuka dengan tombol di kiri atas. */
:root { --sb-w: 240px; --sb-w-ciut: 68px; }
.shell { display: flex; min-height: 100vh; }
.konten { flex: 1 1 auto; min-width: 0; }

.sidebar {
  position: sticky; top: 0; height: 100vh; flex: none; z-index: 50;
  width: var(--sb-w); display: flex; flex-direction: column;
  background: var(--surface); border-right: 0.5px solid var(--border);
  overflow: hidden; transition: width .18s ease;
}
.sb-head {
  display: flex; align-items: center; gap: 0.5rem; min-height: 60px;
  padding: 0.8rem 0.75rem 0.8rem 1rem; border-bottom: 0.5px solid var(--border);
}
.sb-brand { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.sb-logo {
  width: 34px; height: 34px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--surface);
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
}
.sb-judul { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.sb-tombol {
  width: 34px; height: 34px; flex: none; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border: 0.5px solid var(--border-strong); background: var(--surface); color: var(--text-secondary);
}
.sb-tombol:hover { background: var(--surface-sunken); color: var(--text-primary); }
.sb-tombol .ikon { width: 18px; height: 18px; transition: transform .18s ease; }
.sb-tutup-tombol { display: none; }

.sb-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0.6rem;
  display: flex; flex-direction: column; gap: 2px;
}
.sb-grup {
  padding: 0.95rem 0.7rem 0.35rem; white-space: nowrap;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted);
}
.sb-link {
  display: flex; align-items: center; gap: 0.75rem; min-height: 42px;
  padding: 0.55rem 0.7rem; border-radius: 9px; white-space: nowrap;
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
}
.sb-link:hover { background: var(--surface-sunken); color: var(--text-primary); }
.sb-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sb-link .ikon { width: 20px; height: 20px; flex: none; }
.sb-foot { border-top: 0.5px solid var(--border); padding: 0.6rem; display: flex; flex-direction: column; gap: 2px; }
.sb-siapa { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-siapa b { font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; }
.sb-siapa small { font-size: 0.72rem; color: var(--text-muted); }

.mobilebar, .sb-backdrop { display: none; }

/* Menu diciutkan jadi ikon saja — hanya di layar lebar. Pilihan ini
   diingat browser, jadi tetap ciut saat pindah halaman. */
@media (min-width: 901px) {
  html.sb-ciut .sidebar { width: var(--sb-w-ciut); }
  html.sb-ciut .sb-judul, html.sb-ciut .sb-teks, html.sb-ciut .sb-grup span { display: none; }
  html.sb-ciut .sb-head { flex-direction: column; gap: 0.6rem; padding: 0.75rem 0.5rem; }
  html.sb-ciut .sb-brand { flex: none; }
  html.sb-ciut .sb-tombol .ikon { transform: rotate(180deg); }
  html.sb-ciut .sb-grup { padding: 0.55rem 0.4rem; }
  html.sb-ciut .sb-grup::before { content: ""; display: block; height: 0.5px; background: var(--border); }
  html.sb-ciut .sb-link { justify-content: center; padding: 0.55rem 0; }
}

/* HP dan tablet: menu jadi laci dari kiri. */
@media (max-width: 900px) {
  .shell { display: block; }
  .mobilebar {
    display: flex; align-items: center; gap: 0.75rem; min-height: 54px;
    position: sticky; top: 0; z-index: 40; padding: 0.55rem 1rem;
    background: var(--surface); border-bottom: 0.5px solid var(--border);
  }
  .mobilebar-judul {
    font-family: var(--font-display); font-weight: 700; font-size: 1rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; height: auto;
    width: min(84vw, 300px); transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(20, 18, 14, 0.25);
  }
  html.sb-buka .sidebar { transform: none; }
  html.sb-buka .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(20, 18, 14, 0.45); }
  html.sb-buka body { overflow: hidden; }
  .sb-ciut-tombol { display: none; }
  .sb-tutup-tombol { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sb-tombol .ikon { transition: none; }
}

/* ---------- kartu ---------- */
.card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.card-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin-bottom: 0.15rem; }
.card-sub { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.9rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ---------- angka besar ---------- */
.stat { background: var(--surface); border: 0.5px solid var(--border); border-radius: 12px; padding: 0.95rem 1.05rem; }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-top: 0.35rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-note { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.3rem; }
.stat.is-good .stat-value { color: var(--success); }
.stat.is-bad .stat-value { color: var(--danger); }
.stat.is-warn .stat-value { color: var(--warn); }
.stat.is-accent .stat-value { color: var(--accent); }

/* ---------- lencana ---------- */
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 5px; letter-spacing: 0.02em; white-space: nowrap;
}
.badge-a { background: var(--warn-soft); color: var(--warn); }
.badge-b { background: var(--accent-soft); color: var(--accent); }
.badge-c { background: var(--accent2-soft); color: var(--accent2); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--danger-soft); color: var(--danger); }
.badge-mute { background: var(--surface-sunken); color: var(--text-muted); }

/* ---------- tabel ---------- */
.tablewrap { overflow-x: auto; border: 0.5px solid var(--border); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.875rem; }
th {
  text-align: left; padding: 0.7rem 0.9rem; background: var(--surface-sunken);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); font-weight: 700; border-bottom: 0.5px solid var(--border); white-space: nowrap;
}
td { padding: 0.7rem 0.9rem; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-sunken); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-masuk { color: var(--success); font-weight: 600; }
.t-keluar { color: var(--danger); font-weight: 600; }
.t-muted { color: var(--text-muted); font-size: 0.8125rem; }

/* ---------- formulir ---------- */
.form label { display: block; font-size: 0.8125rem; color: var(--text-secondary); margin: 0.75rem 0 0.3rem; font-weight: 600; }
.form label:first-child { margin-top: 0; }
.form input[type="text"], .form input[type="date"], .form input[type="number"],
.form input[type="email"], .form input[type="password"], .form select, .form textarea {
  width: 100%; padding: 0.55rem 0.7rem; border: 0.5px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface-sunken); color: var(--text-primary);
}
.form textarea { min-height: 72px; resize: vertical; line-height: 1.55; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form .row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.form .hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; font-weight: 400; }
.form .check { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; font-size: 0.875rem; }
.form .check input { width: auto; }

/* ---------- kode akun ---------- */
.kode {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted); background: var(--surface-sunken);
  padding: 1px 5px; border-radius: 4px; letter-spacing: 0.02em;
}

/* ---------- hitungan bertingkat ---------- */
.ledger { border: 0.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.ledger-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.6rem 0.9rem; font-size: 0.875rem;
  border-bottom: 0.5px solid var(--border);
}
.ledger-row:last-child { border-bottom: none; }
.ledger-row b { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.ledger-row.total { background: var(--surface-sunken); font-weight: 600; }
.ledger-row.total span { font-weight: 600; }

/* ---------- wawancara audit ----------
   Dibuka pendamping di HP sambil berhadapan dengan murid: pertanyaannya
   harus terbaca sekali lirik, tanpa perlu memicingkan mata. */
.polos { border: 0; padding: 0; margin: 0; min-width: 0; }

.aturan, .petunjuk {
  margin: 0.6rem 0 0; padding-left: 1.2rem;
  font-size: 0.875rem; color: var(--text-secondary); line-height: 1.55;
}
.aturan li, .petunjuk li { margin-bottom: 0.35rem; }

.lapis-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1rem; }
.lapis-nav a {
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
  padding: 0.4rem 0.8rem; border-radius: 999px;
  border: 0.5px solid var(--border-strong); background: var(--surface); color: var(--text-secondary);
}
.lapis-nav a.partial { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.lapis-nav a.done { background: var(--success-soft); color: var(--success); border-color: transparent; }

.pembuka {
  font-family: var(--font-display); font-size: 1.05rem; font-style: italic; line-height: 1.5;
  border-left: 2px solid var(--accent2); background: var(--accent2-soft); color: var(--text-primary);
  padding: 0.75rem 1rem; border-radius: 0 10px 10px 0;
}
.pembuka small {
  display: block; margin-bottom: 0.3rem;
  font-family: var(--font-sans); font-style: normal; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent2);
}

.q { padding: 1rem 0; border-bottom: 0.5px solid var(--border); }
.q-digali {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.q-tanya {
  font-family: var(--font-display); font-size: 1.12rem; line-height: 1.45;
  margin: 0.3rem 0 0.5rem; color: var(--text-primary); text-wrap: pretty;
}
.q-baca {
  font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5;
  margin-bottom: 0.6rem; padding-left: 0.7rem; border-left: 2px solid var(--border-strong);
}

.form .tanda {
  display: flex; align-items: flex-start; gap: 0.55rem;
  margin: 0.55rem 0 0; padding: 0.6rem 0.75rem; border-radius: 8px;
  background: var(--surface-sunken); color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
}
.form .tanda input { width: 18px; height: 18px; margin: 0.1rem 0 0; flex: none; accent-color: var(--accent); }
.form .tanda-benar input { accent-color: var(--success); }
.form .tanda-merah { background: var(--warn-soft); color: var(--warn); }
.form .tanda-merah input { accent-color: var(--warn); }
.form .tanda-gugur { background: var(--danger-soft); color: var(--danger); }
.form .tanda-gugur input { accent-color: var(--danger); }

.skala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 0.35rem; }
.form .skala label { position: relative; display: block; margin: 0; cursor: pointer; }
.skala input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.skala span {
  display: flex; align-items: center; justify-content: center; height: 46px;
  border-radius: 10px; border: 0.5px solid var(--border-strong); background: var(--surface-sunken);
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--text-secondary);
}
.skala label:hover span { background: var(--surface); color: var(--text-primary); }
.skala input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.skala input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.skala-jangkar {
  display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.35rem;
  font-size: 0.72rem; color: var(--text-muted); line-height: 1.4;
}
.skala-jangkar span:last-child { text-align: right; }

.saran-oto {
  margin-top: 0.9rem; padding: 0.75rem 0.9rem; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-size: 0.875rem;
}
.saran-oto b { font-family: var(--font-display); font-size: 1.3rem; }

/* ---------- laporan laba rugi ---------- */
.lr { min-width: 0; font-size: 0.875rem; }
.lr th, .lr td { padding: 0.5rem 0.75rem; }
.lr td.num, .lr th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lr td.indent { padding-left: 1.3rem; }
.lr .lr-bagian td {
  background: var(--surface-sunken); padding-top: 0.65rem;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}
.lr .lr-sub td { font-weight: 600; }
.lr .lr-laba td { font-weight: 700; background: var(--accent-soft); }
.lr .lr-bersih td { font-weight: 700; font-size: 0.95rem; background: var(--accent); color: var(--surface); }
.lr .lr-lalu { color: var(--text-muted); }
.lr .lr-kosong td { color: var(--text-muted); font-style: italic; }
.lr tbody tr.lr-bersih:hover td { background: var(--accent); }

@media print {
  .sidebar, .mobilebar, .sb-backdrop, .masthead-actions, .btn, .flash { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .stat { border: 0.5px solid #ccc; box-shadow: none; break-inside: avoid; }
  .app { max-width: none; padding: 0; }
}

/* ---------- panel lipat ---------- */
details > summary {
  cursor: pointer; list-style: none; font-size: 0.8125rem; font-weight: 600;
  color: var(--text-secondary); padding: 0.5rem 0; display: flex; align-items: center; gap: 0.4rem;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; color: var(--text-muted); font-size: 0.7rem; }
details[open] > summary::before { content: "▾"; }
details > summary:hover { color: var(--text-primary); }
details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- pemilih masuk / keluar ---------- */
/* Keputusan terpenting saat mencatat, jadi diberi porsi paling besar. */
.jenispick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 0.35rem; }
.jenispick label { position: relative; display: block; cursor: pointer; }
.jenispick input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.jenispick span {
  display: block; padding: 0.7rem 0.5rem; border-radius: 10px; text-align: center;
  border: 0.5px solid var(--border-strong); background: var(--surface-sunken);
  color: var(--text-secondary); font-weight: 600; font-size: 0.9375rem;
  transition: background .13s, color .13s, border-color .13s;
}
.jenispick label:hover span { background: var(--surface); color: var(--text-primary); }
.jenispick label.masuk input:checked + span {
  background: var(--success); border-color: var(--success); color: var(--surface);
}
.jenispick label.keluar input:checked + span {
  background: var(--danger); border-color: var(--danger); color: var(--surface);
}
.jenispick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- pemilih kategori ---------- */
/* Tombol yang terlihat semua sekaligus. Dropdown terlalu samar untuk
   murid yang baru pertama kali mencatat, apalagi lewat layar HP. */
.katset { margin-top: 0.35rem; }
.katset[hidden] { display: none; }
.katgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; }
.katgrid label { position: relative; display: block; cursor: pointer; }
.katgrid input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.katgrid span {
  display: block; padding: 0.5rem 0.6rem; border-radius: 8px;
  border: 0.5px solid var(--border-strong); background: var(--surface-sunken);
  color: var(--text-secondary); font-size: 0.8125rem; font-weight: 500;
  line-height: 1.3; text-align: center; transition: background .13s, color .13s, border-color .13s;
}
.katgrid label:hover span { background: var(--surface); color: var(--text-primary); }
.katgrid input:checked + span {
  background: var(--accent); border-color: var(--accent); color: var(--surface);
  font-weight: 600;
}
.katgrid input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Kategori yang paling sering luput dicatat diberi warna berbeda. */
.katgrid label.penting span { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.katgrid label.penting input:checked + span { background: var(--warn); border-color: var(--warn); color: var(--surface); }

.btn {
  height: 38px; padding: 0 1.1rem; border-radius: var(--radius); border: none;
  background: var(--accent); color: var(--surface); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-size: 0.875rem; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface); color: var(--text-secondary); border: 0.5px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text-primary); filter: none; }
.btn-danger { background: var(--danger); }
.btn-sm { height: 30px; padding: 0 0.7rem; font-size: 0.78rem; }
.btn-row { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- pemberitahuan ---------- */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.1rem; font-size: 0.875rem; border: 0.5px solid; }
.flash-ok { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.flash-err { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.flash ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); font-size: 0.875rem; }
.empty strong { display: block; color: var(--text-secondary); margin-bottom: 0.3rem; font-size: 0.9375rem; }

/* ---------- catatan panduan ---------- */
.note {
  border-left: 2px solid var(--accent); background: var(--surface-sunken);
  padding: 0.75rem 0.95rem; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 1rem;
}
.note.warn { border-left-color: var(--warn); }
.note.bad { border-left-color: var(--danger); }
.note b { color: var(--text-primary); }

/* ---------- bilah kemajuan ---------- */
.bar { height: 7px; border-radius: 4px; background: var(--surface-sunken); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-fill.good { background: var(--success); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.bad { background: var(--danger); }

/* ---------- rentetan mencatat ---------- */
.streak { display: flex; align-items: baseline; gap: 0.4rem; }
.streak-num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.streak-unit { font-size: 0.8125rem; color: var(--text-secondary); }
.dots { display: flex; gap: 3px; margin-top: 0.55rem; flex-wrap: wrap; }
.dot { width: 9px; height: 9px; border-radius: 2px; background: var(--surface-sunken); border: 0.5px solid var(--border); }
.dot.on { background: var(--success); border-color: var(--success); }
.dot.today { outline: 1.5px solid var(--accent); outline-offset: 1px; }

/* ---------- grafik batang mini ---------- */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 54px; margin-top: 0.6rem; }
.spark-col { flex: 1; background: var(--accent-soft); border-radius: 2px 2px 0 0; min-height: 3px; position: relative; }
.spark-col.zero { background: var(--danger-soft); }
.spark-labels { display: flex; gap: 4px; margin-top: 0.3rem; }
.spark-labels span { flex: 1; font-size: 0.6rem; color: var(--text-muted); text-align: center; }

/* ---------- daftar murid di dashboard mentor ---------- */
.murid-row { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; align-items: center; padding: 0.85rem 0; border-bottom: 0.5px solid var(--border); }
.murid-row:last-child { border-bottom: none; }
.murid-nama { font-weight: 600; }
.murid-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
.murid-sinyal { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- masuk ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.login-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: 14px; padding: 1.75rem; width: 100%; max-width: 380px; }
.login-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.login-sub { font-size: 0.8125rem; color: var(--text-secondary); margin: 0.35rem 0 1.25rem; }

/* ==========================================================================
   LAYAR HP
   Murid Jalur A hampir semuanya hanya punya HP, dan sebagian besar baru
   pertama kali mencatat. Layar sempit tidak boleh jadi alasan tambahan
   untuk berhenti.
   ========================================================================== */
@media (max-width: 640px) {
  .app { padding: 1.25rem 1rem 3rem; }
  .form .row2 { grid-template-columns: 1fr; }
  .masthead-title { font-size: 1.35rem; }

  /* iOS memperbesar halaman sendiri kalau font kolom isian di bawah 16px.
     Sekali itu terjadi, murid harus mencubit layar tiap kali mengetik. */
  .form input, .form select, .form textarea,
  input[type="text"], input[type="number"], input[type="date"],
  input[type="email"], input[type="password"], select, textarea {
    font-size: 16px;
  }

  /* Sasaran sentuh minimal ±46px — jempol bukan kursor. */
  .btn { height: 46px; padding: 0 1.2rem; }
  .btn-sm { height: 40px; }
  .btn-row { gap: 0.6rem; }
  .btn-row .btn { flex: 1 1 auto; }

  .katgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .katgrid span {
    min-height: 48px; padding: 0.6rem 0.5rem; font-size: 0.875rem;
    display: flex; align-items: center; justify-content: center;
  }
  .jenispick { gap: 10px; }
  .jenispick span { padding: 1rem 0.5rem; font-size: 1rem; }


  .masthead { gap: 0.75rem; }
  .masthead-actions { width: 100%; }
  .masthead-actions .btn { flex: 1 1 auto; }

  .card { padding: 1rem; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .stat { padding: 0.75rem 0.85rem; }
  .stat-value { font-size: 1.25rem; }

  /* ---------- tabel jadi kartu ----------
     Menggeser tabel ke samping untuk melihat nominal adalah cara tercepat
     membuat murid berhenti membuka buku kasnya. Di layar sempit tiap baris
     dipecah jadi kartu bertumpuk. */
  .tablewrap.cards { border: none; background: transparent; overflow: visible; box-shadow: none; }
  .tablewrap.cards table { display: block; width: 100%; min-width: 0; }
  .tablewrap.cards thead { display: none; }
  .tablewrap.cards tbody { display: block; }
  /* Flex kolom supaya sel utama bisa dinaikkan ke atas kartu tanpa
     mengubah urutan kolom di layar lebar. */
  .tablewrap.cards tr {
    display: flex; flex-direction: column; background: var(--surface);
    border: 0.5px solid var(--border); border-radius: 10px;
    padding: 0.7rem 0.9rem; margin-bottom: 0.6rem;
  }
  .tablewrap.cards tbody tr:hover { background: var(--surface); }
  .tablewrap.cards td {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 0.9rem; padding: 0.28rem 0; border: none; text-align: right;
  }
  .tablewrap.cards td[data-label]::before {
    content: attr(data-label);
    flex: none; text-align: left;
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-muted); font-weight: 700;
  }
  /* Sel kosong — misalnya kolom "Keluar" pada baris pemasukan. */
  .tablewrap.cards td:empty { display: none; }
  /* Sel utama tampil penuh di baris pertama kartu. */
  .tablewrap.cards td.lead {
    order: -1; display: block; text-align: left; font-size: 0.9375rem;
    padding-bottom: 0.5rem; margin-bottom: 0.35rem;
    border-bottom: 0.5px solid var(--border);
  }
  .tablewrap.cards td.lead::before { display: none; }
  .tablewrap.cards td[colspan] { display: block; text-align: left; }
  .tablewrap.cards td[colspan]::before { display: none; }
}
