/* ============================================================
   Sangpati LMS — Design System (tanpa build step)
   Nuansa super-app mobile: kartu bulat, hero gradien, chip,
   bottom-nav, FAB, soft shadow. Palet dari logo sekolah.
   ============================================================ */

:root {
  /* Warna (override via <style id="theme"> dari pengaturan) */
  --theme_primary: #409c2d;
  --theme_deep: #0a2915;
  --theme_accent: #a5df1a;
  --theme_gold: #eeb51e;
  --theme_bg: #f6f8f1;
  --theme_radius: 20px;
  --font_heading: Fraunces;
  --font_body: 'Plus Jakarta Sans';

  /* Turunan */
  --p: var(--theme_primary);
  --d: var(--theme_deep);
  --ink: #0d1b12;
  --muted: #6b7c70;
  --line: #e4ebe5;
  --surface: #ffffff;
  --bg: var(--theme_bg);
  --danger: #d64545;
  --warn: #e8a13c;
  --info: #2f6fed;

  --r-lg: var(--theme_radius);
  --r-md: 16px;
  --r-sm: 11px;
  --sh-1: 0 2px 8px rgba(10, 41, 21, .06);
  --sh-2: 0 8px 24px rgba(10, 41, 21, .10);
  --sh-3: 0 18px 44px rgba(10, 41, 21, .16);

  --sidebar-w: 264px;
  --topbar-h: 66px;
  --bottomnav-h: 66px;
  --font-fallback: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font_body), var(--font-fallback);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font_heading), Georgia, serif; line-height: 1.25; margin: 0 0 .4em; color: var(--d); }
h1 { font-size: 1.55rem; } h2 { font-size: 1.28rem; } h3 { font-size: 1.08rem; }
a { color: var(--p); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.d-none{display:none!important}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ============ Layout aplikasi ============ */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: linear-gradient(175deg, var(--d), #071f11 70%);
  color: #d7e6d9; padding: 18px 14px; overflow-y: auto; z-index: 60;
  display: flex; flex-direction: column; gap: 4px;
  transition: transform .22s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px; padding: 6px 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,.10); margin-bottom: 12px;
}
.sidebar .brand img, .sidebar .brand .brand-fallback {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover;
  background: linear-gradient(135deg, var(--p), var(--theme_accent));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px;
}
.sidebar .brand b { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.sidebar .brand span { font-size: 11.5px; color: #9db8a3; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #7c9b85; margin: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 13px;
  color: #cfe0d3; font-size: 14px; font-weight: 500; transition: .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar form .nav-item { min-height: 44px; align-items: center; }
.nav-item.active { background: linear-gradient(135deg, var(--p), #2f7a21); color: #fff; box-shadow: 0 6px 18px rgba(64,156,45,.35); }
.nav-item .ic { width: 20px; text-align: center; opacity: .95; }
.nav-item .badge-count { margin-left: auto; background: var(--theme_gold); color: #3a2b00; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  background: rgba(246,248,241,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.topbar .page-title {
  font-weight: 700; font-size: 16.5px; color: var(--d);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; line-height: 1.25;
}
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer;
  font-size: 17px; color: var(--d); transition: .15s; position: relative;
}
.icon-btn:hover { border-color: var(--p); color: var(--p); }
.avatar {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--p), var(--d)); color: #fff; font-weight: 700; font-size: 14px;
}
.menu-toggle { display: none; }

.content { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; flex: 1; padding-bottom: 96px; }

/* ============ Bottom nav (mobile) ============ */
.bottom-nav { display: none; }
.fab {
  display: none; position: fixed; right: 18px; bottom: calc(var(--bottomnav-h) + 16px); z-index: 70;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--p), var(--d)); color: #fff; font-size: 26px;
  box-shadow: 0 12px 30px rgba(64,156,45,.45); transition: transform .15s;
}
.fab:active { transform: scale(.93); }
/* Sembunyikan FAB bila halaman sudah menampilkan aksi cepat (hindari menutupi konten) */
.main:has(.quick-grid) ~ .fab { display: none; }

/* ============ Komponen ============ */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--d) 0%, #0e3a1e 55%, var(--p) 140%);
  color: #fff; padding: 26px 26px 30px; box-shadow: var(--sh-2);
  margin-bottom: 22px;
}
.hero::after {
  content: ""; position: absolute; right: -50px; top: -60px; width: 240px; height: 240px;
  background:
    radial-gradient(circle at 30% 30%, rgba(165,223,26,.30), transparent 60%),
    conic-gradient(from 0deg, transparent 0 40deg, rgba(238,181,30,.22) 40deg 80deg, transparent 80deg 160deg,
                   rgba(255,255,255,.09) 160deg 200deg, transparent 200deg 280deg, rgba(165,223,26,.18) 280deg 320deg, transparent 320deg);
  border-radius: 50%; pointer-events: none;
}
.hero .greet { font-size: 13px; opacity: .82; letter-spacing: .04em; }
.hero h1 { color: #fff; margin: 4px 0 8px; font-size: 1.5rem; }
.hero .sub { font-size: 13.5px; opacity: .85; max-width: 560px; }
.hero-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero-chips .chip-h {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600;
}
@media (max-width: 640px) {
  /* Chip hero: bungkus 2 baris (jangan terpotong tepi) */
  .hero-chips { flex-wrap: wrap; gap: 7px; }
  .hero-chips .chip-h { font-size: 11.5px; padding: 6px 11px; max-width: 100%; }
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-1);
}
.card + .card { margin-top: 16px; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card .card-head h3 { margin: 0; }

.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; display: flex; gap: 13px; align-items: flex-start; box-shadow: var(--sh-1);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stat-card .ic {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px;
  background: color-mix(in srgb, var(--p) 14%, #fff); color: var(--p); flex: none;
}
.stat-card .ic.gold { background: #fdf3dc; color: #b8860b; }
.stat-card .ic.info { background: #e7efff; color: var(--info); }
.stat-card .ic.danger { background: #fdeaea; color: var(--danger); }
.stat-card .val { font-size: 22px; font-weight: 800; color: var(--d); line-height: 1.15; }
.stat-card .lbl { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-card .delta { font-size: 11.5px; font-weight: 700; margin-top: 4px; }
.delta.up { color: #1d9e4c; } .delta.down { color: var(--danger); }

/* Quick actions grid (ala aplikasi dompet) */
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .quick-grid { gap: 9px; } }
@media (max-width: 480px) { .quick-grid { gap: 8px; } }
.qa {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 13px 6px 12px; text-align: center; cursor: pointer; transition: .15s; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  min-width: 0; overflow: hidden;
}
.qa:hover { transform: translateY(-3px); box-shadow: var(--sh-2); text-decoration: none; border-color: color-mix(in srgb, var(--p) 40%, var(--line)); }
.qa .ic {
  width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 14px; display: grid; place-items: center;
  font-size: 19px; flex: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--p) 18%, #fff), color-mix(in srgb, var(--theme_gold) 22%, #fff));
  color: var(--d);
}
/* Label: tengah, tinggi tetap 2 baris → semua kartu sejajar & simetris */
.qa span {
  font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--d);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  min-height: calc(2 * 1.3em); /* 2 baris */
  width: 100%; text-align: center;
  overflow-wrap: break-word; word-break: normal; hyphens: manual;
}
@media (min-width: 721px) { .qa { padding: 15px 8px 14px; } .qa span { font-size: 12.5px; } }
@media (max-width: 480px) {
  .qa { padding: 11px 4px 10px; }
  .qa .ic { width: 40px; height: 40px; margin-bottom: 7px; font-size: 17px; }
  .qa span { font-size: 11.5px; }
}

/* Chips filter */
.chip-group { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 7px 15px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.chip:hover { border-color: var(--p); color: var(--p); }
.chip.active { background: var(--d); border-color: var(--d); color: #fff; }

/* Tabel */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.8px; }
table.tbl th {
  text-align: left; padding: 12px 14px; background: #f1f6f1; color: var(--d);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fafcfa; }
table.tbl input, table.tbl select { min-width: 90px; }

/* List card (baris info) */
.list-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px;
  border-bottom: 1px solid var(--line); transition: .12s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #fafcfa; }
.list-row .ic {
  width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  font-size: 18px; background: color-mix(in srgb, var(--p) 13%, #fff); color: var(--p);
}
.list-row .body { flex: 1; min-width: 0; }
.list-row .body b { display: block; font-size: 14.2px; color: var(--d); }
.list-row .body span { font-size: 12.6px; color: var(--muted); }
.list-row .amt { font-weight: 800; color: var(--d); font-size: 14.5px; text-align: right; }

/* Badge status */
.badge {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px;
  padding: 3px 11px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.badge.ok { background: #e4f7ea; color: #14713a; }
.badge.pending { background: #fdf3dc; color: #8a6100; }
.badge.bad { background: #fdeaea; color: #a32121; }
.badge.info { background: #e7efff; color: #1d4fc4; }
.badge.neutral { background: #eef2ee; color: var(--muted); }
.badge.purple { background: #f1e9ff; color: #5b32c4; }

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 14px; border: 0; cursor: pointer;
  font-size: 14.5px; font-weight: 700; transition: .15s; text-decoration: none !important;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--p), color-mix(in srgb, var(--p) 65%, var(--d))); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--p) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-dark { background: var(--d); color: #fff; }
.btn-light { background: var(--surface); color: var(--d); border: 1.5px solid var(--line); }
.btn-light:hover { border-color: var(--p); color: var(--p); }
.btn-danger { background: #fdeaea; color: var(--danger); border: 1px solid #f5c2c2; }
.btn-gold { background: linear-gradient(135deg, var(--theme_gold), #d99a12); color: #3a2b00; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 11px; }
.btn-block { width: 100%; }

/* Form */
.form-group { margin-bottom: 15px; }
.form-group > label { display: block; font-size: 13px; font-weight: 700; color: var(--d); margin-bottom: 6px; }
.form-group .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* Form
   Catatan: <input> tanpa atribut type = type teks bawaan browser.
   :where() dipakai agar spesifisitas selector ini tetap rendah —
   aturan khusus (mis. ikon login .identifier-wrap) tetap menang. */
input:not(:where([type=checkbox],[type=radio],[type=submit],[type=button],[type=file],[type=hidden],[type=color],[type=range])),
.input, select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 13px;
  font-size: 14.5px; font-family: inherit; background: #fbfdfb; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input[type=color], input[type=range], input[type=checkbox], input[type=radio], input[type=file] {
  width: auto; accent-color: var(--p); font-family: inherit;
}
input[type=color] { min-width: 42px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input[type=range] { min-width: 80px; padding: 0; border: 0; box-shadow: none; background: transparent; }
input[type=file] { max-width: 100%; font-size: 13px; }
input[type=checkbox], input[type=radio] { min-height: 18px; min-width: 18px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--p); box-shadow: 0 0 0 4px color-mix(in srgb, var(--p) 15%, transparent);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #9aaba0; }
textarea { min-height: 110px; resize: vertical; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .form-group { margin-bottom: 0; flex: 1 1 170px; min-width: 160px; }
.inline-form .form-group > label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inline-form .btn { flex: 0 0 auto; }
@media (max-width: 640px) {
  .inline-form { flex-direction: column; align-items: stretch; gap: 10px; }
  .inline-form .form-group { min-width: 0; width: 100%; }
  .inline-form .btn { width: 100%; }
}

/* Toast */
.toast-wrap { position: fixed; right: 18px; top: 78px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--d); color: #fff; border-radius: 14px; padding: 13px 17px;
  font-size: 13.8px; font-weight: 600; box-shadow: var(--sh-3); min-width: 250px; max-width: 380px;
  animation: slideIn .25s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast.ok { background: linear-gradient(135deg, #1d9e4c, #14713a); }
.toast.err { background: linear-gradient(135deg, #d64545, #a32121); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal / bottom sheet */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(7,31,17,.55); backdrop-filter: blur(3px);
  z-index: 150; display: none; align-items: center; justify-content: center; padding: 18px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--sh-3); animation: pop .2s ease;
  padding: 22px;
}
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .modal-title { font-weight: 800; font-size: 16.5px; color: var(--d); margin-bottom: 14px; }
@media (max-width: 560px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 24px 24px 0 0; max-height: 92vh; animation: sheetUp .25s ease; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Empty state */
.empty { text-align: center; padding: 44px 18px; color: var(--muted); }
.empty .ic { font-size: 44px; opacity: .5; margin-bottom: 10px; }
.empty b { display: block; color: var(--d); font-size: 15.5px; margin-bottom: 4px; }

/* Pagination */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span.cur {
  min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--d);
}
.pager span.cur { background: var(--d); color: #fff; border-color: var(--d); }

/* Login */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 22px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(165,223,26,.22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(238,181,30,.20), transparent 55%),
    linear-gradient(160deg, var(--d), #071f11 65%);
}
.auth-card {
  width: 100%; max-width: 430px; background: rgba(255,255,255,.97); border-radius: 28px;
  padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.auth-card .logo-line { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-card .logo-line .mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--p), var(--theme_accent)); color: #fff; font-weight: 900; font-size: 22px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--p) 40%, transparent);
}
.auth-card h1 { font-size: 1.35rem; margin: 0; }
.auth-card .tag { font-size: 12.5px; color: var(--muted); }
.identifier-wrap { position: relative; }
.identifier-wrap .prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px; pointer-events: none;
}
.identifier-wrap input { padding-left: 42px; }
.demo-box { background: #f1f6f1; border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; font-size: 12.3px; color: var(--muted); margin-top: 16px; line-height: 1.7; }
.demo-box code { background: #fff; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; }

/* Segmented control */
.seg { display: inline-flex; background: #eef2ee; border-radius: 13px; padding: 4px; gap: 4px; }
.seg button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; transition: .15s;
}
.seg button.active { background: #fff; color: var(--d); box-shadow: var(--sh-1); }

/* PWA install banner — muncul otomatis di mobile saat browser mendukung */
.pwa-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottomnav-h) + 14px);
  z-index: 190; display: flex; align-items: center; gap: 10px;
  background: var(--d); color: #fff; border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px; padding: 12px 12px 12px 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  transform: translateY(140%); opacity: 0; transition: transform .3s ease, opacity .3s ease;
}
.pwa-banner.show { transform: translateY(0); opacity: 1; }
.pwa-banner-ic { font-size: 24px; flex: none; }
.pwa-banner-txt { flex: 1; min-width: 0; line-height: 1.3; }
.pwa-banner-txt b { display: block; font-size: 13.5px; }
.pwa-banner-txt span { font-size: 11.5px; opacity: .85; }
.pwa-banner-txt b, .pwa-banner-txt span b { color: var(--theme_accent); }
.pwa-banner-act {
  flex: none; border: 0; cursor: pointer; border-radius: 12px; padding: 9px 15px;
  background: linear-gradient(135deg, var(--theme_accent), var(--p)); color: #0a2915;
  font-weight: 800; font-size: 13px;
}
.pwa-banner-x {
  flex: none; border: 0; background: rgba(255,255,255,.12); color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 13px;
}
@media (max-width: 480px) {
  .pwa-banner { gap: 8px; padding: 11px 10px; align-items: flex-start; }
  .pwa-banner-ic { font-size: 21px; margin-top: 2px; }
  .pwa-banner-txt { padding-right: 18px; }
  .pwa-banner-txt b { font-size: 12.5px; }
  .pwa-banner-txt span { font-size: 10.5px; line-height: 1.35; }
  .pwa-banner-act { padding: 8px 10px; font-size: 11.5px; margin-top: 2px; }
  .pwa-banner-x { position: absolute; top: 5px; right: 5px; width: 23px; height: 23px; font-size: 11px; }
}
@media (max-width: 640px) {
  .pwa-banner { bottom: calc(var(--bottomnav-h) + 10px); }
}
@media (min-width: 1024px) {
  .pwa-banner { left: auto; right: 20px; max-width: 430px; bottom: 20px; }
}

/* Statistik versi mobile — cegah angka/label keluar kartu, susun vertikal rapi */
.stat-card { min-width: 0; }
.stat-card > div:last-child { min-width: 0; flex: 1; }
.stat-card .val { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.stat-card .lbl { min-width: 0; overflow-wrap: break-word; line-height: 1.3; }
@media (max-width: 640px) {
  .stat-card { gap: 9px; padding: 13px 11px; align-items: flex-start; }
  .stat-card .ic { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
  .stat-card .val { font-size: clamp(15px, 4.5vw, 19px); line-height: 1.15; }
  .stat-card .lbl { font-size: 11.5px; }
}
.sched-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; min-width: 780px; }
.sched-col h4 { font-size: 12.5px; background: var(--d); color: #fff; padding: 8px; border-radius: 10px; text-align: center; margin: 0 0 8px; font-family: inherit; }
.sched-item {
  background: linear-gradient(135deg, color-mix(in srgb, var(--p) 12%, #fff), #fff);
  border: 1px solid color-mix(in srgb, var(--p) 30%, var(--line));
  border-radius: 12px; padding: 9px 11px; margin-bottom: 8px; font-size: 12.5px;
}
.sched-item b { display: block; color: var(--d); font-size: 13px; }
.sched-item .waktu { color: var(--muted); font-size: 11.5px; }

/* Kalender */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { font-size: 11.5px; font-weight: 800; color: var(--muted); text-align: center; padding: 6px 0; }
.cal-day {
  aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; position: relative;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; cursor: default;
}
.cal-day.muted { opacity: .35; background: transparent; border-color: transparent; }
.cal-day.today { background: var(--d); color: #fff; border-color: var(--d); }
.cal-day.has-event { border-color: var(--theme_gold); background: #fffbef; }
.cal-day.has-event::after {
  content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--theme_gold);
}
.cal-day.holiday { background: #fdeaea; border-color: #f5c2c2; }

/* Chart container */
.chart-box { position: relative; height: 300px; }

/* Presensi quick buttons */
.att-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.att-btns label {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: .12s;
}
.att-btns input { display: none; }
.att-btns label.on-h { background: #e4f7ea; border-color: #7ed49a; color: #14713a; }
.att-btns label.on-i { background: #e7efff; border-color: #9db9f7; color: #1d4fc4; }
.att-btns label.on-s { background: #fdf3dc; border-color: #ecca7c; color: #8a6100; }
.att-btns label.on-a { background: #fdeaea; border-color: #f0a0a0; color: #a32121; }

/* Skor input */
.score-input { width: 74px; text-align: center; padding: 8px 6px; font-weight: 700; }

/* Dokumen cetak (di layar) */
.doc-sheet {
  background: #fff; max-width: 210mm; margin: 0 auto; padding: 14mm;
  box-shadow: var(--sh-2); border: 1px solid var(--line); font-size: 13px;
}
.print-toolbar {
  display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap;
  padding: 12px 14px;
  background: #eef2ee; border-radius: 14px; margin-bottom: 16px; position: sticky; top: 74px; z-index: 40;
  max-width: 100%;
}
.print-toolbar .btn { flex: 0 1 auto; }
.print-toolbar .small { flex: 1 1 100%; text-align: center; }
@media (max-width: 640px) {
  .print-toolbar { position: static; }
  .print-toolbar .small { display: none; } /* hemat ruang; tombol tetap jelas */
}

/* Kartu pelajar */
.idcard-wrap { perspective: 1200px; }
.idcard {
  width: 85.6mm; min-height: 54mm; border-radius: 4mm; overflow: hidden; position: relative;
  background: #fff; box-shadow: var(--sh-3); font-size: 11px; border: 1px solid var(--line);
}
.idcard .card-head-band {
  background: linear-gradient(135deg, var(--d), var(--p)); color: #fff;
  padding: 7px 10px; display: flex; align-items: center; gap: 8px;
}
.idcard .card-head-band b { font-size: 11.5px; line-height: 1.2; display: block; }
.idcard .card-body { padding: 8px 10px; display: flex; gap: 9px; }
.idcard .photo {
  width: 17mm; height: 22mm; border-radius: 3px; object-fit: cover; border: 1px solid var(--line);
  background: #eef2ee; display: grid; place-items: center; font-weight: 800; color: var(--muted); flex: none;
}
.idcard dl { margin: 0; font-size: 10.5px; }
.idcard dl div { display: flex; gap: 5px; margin-bottom: 2px; }
.idcard dl dt { color: var(--muted); min-width: 52px; }
.idcard dl dd { margin: 0; font-weight: 700; color: var(--d); }
.idcard .card-foot {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 5px 10px;
  background: color-mix(in srgb, var(--theme_gold) 20%, #fff);
  font-size: 8.5px; display: flex; justify-content: space-between; align-items: center;
}
.idcard .qr { position: absolute; right: 8px; top: 38%; }

/* Elemen kartu absolut (dipakai IdCardRenderer & desainer) */
.idc-el { position: absolute; overflow: hidden; }
.idc-text { display: flex; align-items: center; padding: 0 1mm; white-space: nowrap; }
.idc-photo { display: grid; place-items: center; font-weight: 800; font-size: 6mm; color: var(--muted); }
.idc-el svg { width: 100%; height: 100%; display: block; }

/* Showcase kartu (portal siswa): tampil penuh, proporsional, di tengah */
.card-showcase { text-align: center; }
.card-showcase .idcard-wrap { display: flex; justify-content: center; }
.idcard--screen { margin: 4px auto; }
@media (max-width: 640px) {
  /* Di ponsel: kartu lebar maksimal tapi tetap proporsional (rasio 85.6×54mm) */
  .idcard--screen {
    width: 100%;
    max-width: 400px;
    min-height: 0;
    aspect-ratio: 85.6 / 54;
    transform: none;
    box-shadow: var(--sh-2);
  }
  .idcard--screen .card-body { padding: 6px 9px; gap: 8px; }
  .idcard--screen .photo { width: 15mm; height: 20mm; }
  .idcard--screen dl div { margin-bottom: 1px; }
  .idcard--screen dl dt { min-width: 46px; }
  .idcard--screen .qr { width: 20%; height: auto; right: 7px; }
}

/* Responsive: mobile */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; display: none; }
  .scrim.open { display: block; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; padding-bottom: 0; }
  .content { padding: 16px 14px calc(var(--bottomnav-h) + 86px); }
  .topbar { padding: 0 12px; gap: 8px; height: 58px; }
  .topbar .page-title { font-size: 14.5px; }
  .topbar .icon-btn, .topbar .avatar { width: 36px; height: 36px; border-radius: 12px; flex: none; }
  .hero { padding: 20px 18px 22px; border-radius: 20px; }
  .hero h1 { font-size: 1.28rem; }
  .stat-card .val { font-size: 19px; }
  .card { padding: 16px; border-radius: 18px; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottomnav-h);
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    z-index: 80; justify-content: space-around; align-items: center; padding: 0 6px;
    box-shadow: 0 -8px 30px rgba(10,41,21,.10);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1;
    font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 7px 2px; text-decoration: none;
  }
  .bottom-nav a .ic { font-size: 21px; line-height: 1; }
  .bottom-nav a.active { color: var(--p); }
  .fab { display: grid; place-items: center; }

  /* Tabel jadi kartu di layar sempit (data-label pattern) */
  table.tbl.responsive thead { display: none; }
  table.tbl.responsive tbody tr {
    display: block; background: var(--surface); border: 1px solid var(--line);
    border-radius: 14px; margin-bottom: 10px; padding: 6px 4px;
  }
  table.tbl.responsive tbody td {
    display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed var(--line);
    padding: 8px 12px; text-align: right;
  }
  table.tbl.responsive tbody tr td:last-child { border-bottom: 0; }
  table.tbl.responsive tbody td::before {
    content: attr(data-label); font-weight: 700; color: var(--muted); font-size: 12px;
    text-align: left; flex: none;
  }
  .inline-form { flex-direction: column; align-items: stretch; }
  .print-toolbar { position: static; flex-wrap: wrap; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .print-toolbar, .toast-wrap, .scrim { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; }
  .doc-sheet { box-shadow: none; border: 0; max-width: none; padding: 0; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
