/* =========================================================
   Design tokens — MI Baitussa'adah
   Arah v3: "kartu berwarna, santai" — rel navigasi terang & tenang,
   keceriaan dipusatkan di kartu konten (kelas/statistik/anak),
   bentuk lebih membulat, tipografi judul yang ramah (Baloo 2).
   ========================================================= */
:root {
  --bg: #F5F7F4;
  --surface: #FFFFFF;
  /* Rel navigasi (sidebar/bottom-nav) — terang, disiplin, bukan tempat warna-warni */
  --rail-bg: #FFFFFF;
  --rail-border: #E7EBE4;
  --rail-text: #313A33;
  --rail-text-muted: #8B948C;
  --rail-active-bg: #E5F5EC;
  /* Banner besar (hero login/beranda publik) — satu tempat yang boleh berani gelap */
  --sidebar-bg: #0B4A38;
  --sidebar-bg-2: #0F7A5C;
  --sidebar-bg-active: rgba(255,255,255,0.14);
  --sidebar-text: #DCEFE5;
  --sidebar-text-muted: #8FC2AB;
  --primary: #129169;
  --primary-dark: #0A3D2E;
  --primary-soft: #E3F3EC;
  --accent: #D69A2D;
  --accent-dark: #A97A1F;
  --accent-soft: #FBEED2;
  --text: #1B211D;
  --text-muted: #5C665F;
  --border: #E1E7E0;
  --success-bg: #E4F2E9; --success-text: #1E6B3F;
  --warning-bg: #FBF0DD; --warning-text: #92650F;
  --danger-bg: #FBE7E7;  --danger-text: #A3312F;
  --neutral-bg: #ECEEEC; --neutral-text: #4B534F;
  /* Palet "kartu kelas" — dipakai bergilir di kartu statistik, kartu anak, kartu
     profil sekolah, dsb. supaya terasa berwarna & santai seperti daftar kelas. */
  --tile-1: #12A594; --tile-1-soft: #E1F5F2;
  --tile-2: #E8664F; --tile-2-soft: #FBE7E2;
  --tile-3: #D69A2D; --tile-3-soft: #FBEED2;
  --tile-4: #7C6FE0; --tile-4-soft: #EBE8FC;
  --tile-5: #2F8FD1; --tile-5-soft: #E4F0FA;
  /* Warna identitas cepat per role — dipakai di badge kecil, bukan tema penuh,
     supaya tetap satu identitas brand tapi tiap portal terasa dibedakan sekilas. */
  --role-admin: #7C6FE0;
  --role-guru: #12A594;
  --role-wali: #D69A2D;
  --role-siswa: #2F8FD1;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-soft: 0 2px 10px rgba(11,74,56,0.06);
  --shadow-card: 0 6px 20px rgba(11,74,56,0.09);
  --font-heading: 'Baloo 2', 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; margin: 0 0 4px; color: var(--primary-dark); }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
p { margin: 0 0 12px; }
a { color: var(--primary); }

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ---------------------------------------------------------
   Shell: sidebar + main
   --------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--rail-bg);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--rail-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px 24px;
  border-bottom: 1px solid var(--rail-border);
  margin-bottom: 12px;
}

.sidebar-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  color: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(214,154,45,0.3);
  overflow: hidden;
}
.sidebar-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }

.sidebar-brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  color: var(--primary-dark);
}
.sidebar-brand-text small { display: block; color: var(--rail-text-muted); font-size: 11px; font-family: var(--font-body); font-weight: 500; }

.sidebar-notif-bar {
  margin: 0 14px 14px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--rail-active-bg);
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 13px; font-weight: 700;
  transition: background .15s ease;
}
.sidebar-notif-bar:hover { background: var(--tile-1-soft); }
.notif-pill {
  background: var(--danger-text);
  color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 999px;
  display: none;
  align-items: center; justify-content: center; padding: 0 5px;
}
.notif-pill.show { display: inline-flex; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 0 12px 3px;
  border-radius: 12px;
  color: var(--rail-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, transform 0.15s ease;
  width: calc(100% - 24px);
}
.sidebar-link .icon-chip {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--neutral-bg);
  color: var(--rail-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-link:hover { background: var(--bg); transform: translateX(2px); }
.sidebar-link.active {
  background: var(--rail-active-bg);
  color: var(--primary-dark);
  font-weight: 700;
}
.sidebar-link.active .icon-chip { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 16px 22px 0;
  border-top: 1px solid var(--rail-border);
  font-size: 13px;
}
.sidebar-user-name { color: var(--text); font-weight: 700; }
.sidebar-user-role { margin-bottom: 12px; }

.role-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #fff;
}
.role-chip.role-admin { background: var(--role-admin); }
.role-chip.role-guru  { background: var(--role-guru); }
.role-chip.role-wali  { background: var(--role-wali); color: #3A2A05; }
.role-chip.role-siswa { background: var(--role-siswa); }
.sidebar-logout {
  background: none;
  border: 1.5px solid var(--rail-border);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}
.sidebar-logout:hover { background: var(--danger-bg); border-color: var(--danger-bg); color: var(--danger-text); }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px;
  max-width: 980px;
}

/* ---------------------------------------------------------
   Alerts
   --------------------------------------------------------- */
.alert-success, .alert-error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
}
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error   { background: var(--danger-bg); color: var(--danger-text); }

/* ---------------------------------------------------------
   Forms
   --------------------------------------------------------- */
label { display: block; margin-top: 16px; font-size: 13.5px; font-weight: 600; color: var(--text); }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  margin-top: 6px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,122,92,0.14);
}

button[type="submit"], .btn-primary {
  margin-top: 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  box-shadow: 0 3px 10px rgba(15,122,92,0.22);
  transition: background 0.15s ease, transform 0.1s ease;
}
button[type="submit"]:hover, .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
button[type="submit"]:active, .btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 8px 17px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; margin-top: 14px; }
th, td { padding: 12px 14px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--border); }
th { color: var(--primary-dark); font-weight: 700; font-size: 12px; letter-spacing: .01em; background: var(--primary-soft); }
th:first-child { border-radius: 12px 0 0 12px; }
th:last-child { border-radius: 0 12px 12px 0; }
tr:last-child td { border-bottom: none; }
tr:not(:first-child):hover td { background: var(--bg); }

/* ---------------------------------------------------------
   Status badges
   --------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-text); }

/* ---------------------------------------------------------
   Child card (dashboard wali)
   --------------------------------------------------------- */
.child-card {
  border: 1px solid var(--border);
  border-left: 5px solid var(--tile-1);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
/* Tiap anak dapat warna berbeda kalau wali punya lebih dari satu anak */
.child-card:nth-of-type(5n+2) { border-left-color: var(--tile-2); }
.child-card:nth-of-type(5n+3) { border-left-color: var(--tile-3); }
.child-card:nth-of-type(5n+4) { border-left-color: var(--tile-4); }
.child-card:nth-of-type(5n+5) { border-left-color: var(--tile-5); }
.child-card h3 { margin-bottom: 4px; }
.child-card .kelas-tag { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; }
.child-card h4 { margin-top: 20px; margin-bottom: 0; }

.announcement-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.announcement-item:last-child { border-bottom: none; }
.announcement-date { color: var(--text-muted); font-size: 12.5px; }

/* ---------------------------------------------------------
   Login page
   --------------------------------------------------------- */
.login-shell {
  display: flex;
  min-height: 100vh;
}
.login-hero {
  flex: 1.1;
  background: linear-gradient(160deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 160%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 64px;
  position: relative;
  overflow: hidden;
}
.login-seal {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  background: #fff;
  color: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  overflow: hidden;
}
.login-seal img { width: 100%; height: 100%; object-fit: contain; display: block; }
.login-hero h1 { color: #fff; font-size: 34px; max-width: 380px; line-height: 1.25; }
.login-hero p { color: var(--sidebar-text-muted); max-width: 360px; font-size: 15px; margin-top: 12px; }
.login-hero-ring {
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  border: 1px solid rgba(214,154,45,0.35);
}
.login-hero-ring::before {
  content: '';
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  border: 1px solid rgba(214,154,45,0.22);
}

.login-form-panel {
  flex: 0.9;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-form-box { width: 100%; max-width: 340px; }
.login-form-box h2 { margin-bottom: 6px; }
.login-form-box .page-subtitle { margin-bottom: 24px; }

@media (max-width: 860px) {
  .login-shell { flex-direction: column; }
  .login-hero { padding: 40px 32px; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .app-main { padding: 24px; }
}

/* ---------------------------------------------------------
   Website publik (beranda sekolah)
   --------------------------------------------------------- */
.public-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.public-navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 15.5px;
  line-height: 1.2;
}
.public-navbar-brand .sidebar-mark {
  width: 38px;
  height: 38px;
}
.public-navbar-right { display: flex; align-items: center; gap: 18px; }
.public-navbar-links { display: flex; align-items: center; }
.public-navbar-links a {
  color: var(--text);
  text-decoration: none;
  margin-left: 26px;
  font-size: 14px;
  font-weight: 500;
}
.public-navbar-links a:hover { color: var(--primary); }
.btn-login {
  background: var(--primary);
  color: #fff !important;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 13.5px;
}
.public-nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--primary-dark);
  flex-shrink: 0;
}
.public-nav-toggle svg { width: 20px; height: 20px; }

.public-hero {
  background:
    linear-gradient(160deg, rgba(11,74,56,0.92) 0%, rgba(15,122,92,0.90) 160%),
    url('../img/hero-depan-sekolah.jpg') center 65% / cover no-repeat;
  color: #fff;
  padding: 96px 56px 100px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.public-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  color: var(--sidebar-text);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 22px;
  position: relative;
  z-index: 1;
}
.public-hero-badge svg { width: 14px; height: 14px; }
.public-hero h1 { color: #fff; font-size: 42px; max-width: 680px; margin: 0 auto 18px; position: relative; z-index: 1; }
.public-hero p { color: var(--sidebar-text-muted); max-width: 540px; margin: 0 auto 32px; font-size: 16px; position: relative; z-index: 1; }
.public-hero-actions { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; position: relative; z-index: 1; }
.public-hero .btn-primary { margin-top: 0; padding: 13px 30px; font-size: 15px; box-shadow: 0 10px 24px rgba(0,0,0,0.22); }
.btn-outline-light {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 13px 26px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(255,255,255,0.4);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-outline-light:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.7); }
.public-hero-ring {
  position: absolute;
  left: -140px;
  top: -140px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 1px solid rgba(214,154,45,0.28);
}
.public-hero-ring-2 {
  position: absolute;
  right: -100px;
  bottom: -160px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
}

.public-section {
  padding: 72px 56px;
  max-width: 1080px;
  margin: 0 auto;
}
.public-section-eyebrow {
  display: block;
  text-align: center;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.public-section h2 { font-size: 26px; text-align: center; margin-bottom: 8px; }
.public-section-subtitle { text-align: center; color: var(--text-muted); max-width: 560px; margin: 0 auto 40px; font-size: 14.5px; }

.public-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.public-card {
  border: 1px solid var(--border);
  border-top: 4px solid var(--tile-1);
  border-radius: var(--radius-lg);
  padding: 26px;
  background: var(--surface);
}
.public-grid .public-card:nth-of-type(5n+2) { border-top-color: var(--tile-2); }
.public-grid .public-card:nth-of-type(5n+3) { border-top-color: var(--tile-3); }
.public-grid .public-card:nth-of-type(5n+4) { border-top-color: var(--tile-4); }
.public-grid .public-card:nth-of-type(5n+5) { border-top-color: var(--tile-5); }
.public-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: var(--tile-1-soft); color: var(--tile-1);
}
.public-card-icon svg { width: 22px; height: 22px; }
.public-grid .public-card:nth-of-type(5n+2) .public-card-icon { background: var(--tile-2-soft); color: var(--tile-2); }
.public-grid .public-card:nth-of-type(5n+3) .public-card-icon { background: var(--tile-3-soft); color: var(--tile-3); }
.public-grid .public-card:nth-of-type(5n+4) .public-card-icon { background: var(--tile-4-soft); color: var(--tile-4); }
.public-card h3 { margin-bottom: 8px; }
.public-card p { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.6; }

.public-section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* Galeri kegiatan sekolah */
.public-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.public-gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}
.public-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.public-gallery-item:hover img { transform: scale(1.06); }
.public-gallery-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 14px 12px;
  background: linear-gradient(0deg, rgba(11,74,56,0.88) 0%, rgba(11,74,56,0.0) 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
}

.public-contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: center;
}
.public-contact-card {
  padding: 24px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg);
}
.public-contact-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.public-contact-icon svg { width: 20px; height: 20px; }
.public-contact-grid h4 { margin-bottom: 6px; }
.public-contact-grid p { color: var(--text-muted); font-size: 14px; }

.public-footer {
  background: var(--sidebar-bg);
  color: var(--sidebar-text-muted);
  padding: 30px 24px;
  font-size: 13px;
}
.public-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.public-footer-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-heading); font-weight: 700; font-size: 14.5px; }
.public-footer-brand .sidebar-mark { width: 30px; height: 30px; }
.public-footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.public-footer-links a { color: var(--sidebar-text-muted); text-decoration: none; font-size: 13px; }
.public-footer-links a:hover { color: #fff; }
.public-footer-copy { width: 100%; text-align: center; padding-top: 18px; margin-top: 6px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; }

@media (max-width: 860px) {
  .public-navbar { padding: 12px 18px; }
  .public-nav-toggle { display: flex; }
  .public-navbar-links {
    position: fixed;
    top: 65px; left: 0; right: 0;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 18px 18px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
    z-index: 39;
  }
  .public-navbar-links.open { max-height: 320px; opacity: 1; padding: 10px 18px 20px; }
  .public-navbar-links a {
    margin-left: 0;
    padding: 13px 4px;
    border-bottom: 1px dashed var(--border);
    font-size: 15px;
  }
  .public-navbar-links a:last-child { border-bottom: none; }
  .public-hero { padding: 56px 22px 64px; }
  .public-hero h1 { font-size: 27px; }
  .public-section { padding: 48px 22px; }
  .public-grid, .public-contact-grid { grid-template-columns: 1fr; }
  .public-gallery { grid-template-columns: repeat(2, 1fr); }
  .public-footer-inner { flex-direction: column; text-align: center; justify-content: center; }
  .public-footer-links { justify-content: center; }
}

@media (max-width: 400px) {
  .public-hero h1 { font-size: 23px; }
  .public-hero-badge { font-size: 11.5px; padding: 6px 13px; }
}

/* =========================================================
   REVISI v2 — Dashboard cards, progress bar, pesan, notifikasi,
   tombol export, tabel responsif, dan navigasi mobile (bottom nav)
   ========================================================= */

/* ---------------------------------------------------------
   Dashboard summary cards
   --------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--tile-1);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
/* Kartu statistik bergilir warna, seperti daftar kelas — satu warna per posisi */
.stat-grid .stat-card:nth-of-type(5n+2) { border-top-color: var(--tile-2); }
.stat-grid .stat-card:nth-of-type(5n+3) { border-top-color: var(--tile-3); }
.stat-grid .stat-card:nth-of-type(5n+4) { border-top-color: var(--tile-4); }
.stat-grid .stat-card:nth-of-type(5n+5) { border-top-color: var(--tile-5); }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; font-weight: 700; }
.stat-card .stat-value { font-family: var(--font-heading); font-size: 30px; font-weight: 700; color: var(--primary-dark); margin-top: 4px; }
.stat-card .stat-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.dashboard-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-top: 20px;
  box-shadow: var(--shadow-soft);
}
.dashboard-section h3 { margin-bottom: 12px; }
.dashboard-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.quick-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.quick-links a.btn-secondary { text-decoration: none; }

/* ---------------------------------------------------------
   Progress bar (perkembangan tahfiz)
   --------------------------------------------------------- */
.progress-wrap { margin: 10px 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.progress-track { width: 100%; height: 10px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 999px; }

/* ---------------------------------------------------------
   Tombol Export Excel
   --------------------------------------------------------- */
.btn-export {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 10px rgba(169,122,31,0.28);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-export:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(169,122,31,0.34); }
.btn-export:active { transform: translateY(0); }
.btn-export:disabled { opacity: .6; cursor: wait; transform: none; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 12px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-row > div { min-width: 140px; flex: 1; }
.filter-row label { margin-top: 0; }

/* ---------------------------------------------------------
   Notifikasi
   --------------------------------------------------------- */
.notif-bell { position: relative; display: inline-flex; }
.notif-dot {
  position: absolute; top: -4px; right: -6px;
  background: var(--danger-text); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.notif-item { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-item:last-child { border-bottom: none; }
.notif-item .notif-judul { font-weight: 600; }
.notif-item .notif-waktu { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.notif-item.unread { background: var(--success-bg); border-radius: var(--radius-sm); padding-left: 8px; padding-right: 8px; }

/* ---------------------------------------------------------
   Pesan / Komunikasi (chat sederhana)
   --------------------------------------------------------- */
.pesan-shell { display: flex; gap: 18px; margin-top: 16px; min-height: 420px; }
.pesan-kontak-list { width: 260px; flex-shrink: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.pesan-kontak-item {
  display: block; width: 100%; text-align: left; padding: 12px 16px; border: none; background: none;
  border-bottom: 1px solid var(--border); cursor: pointer; font-family: var(--font-body); font-size: 13.5px; color: var(--text);
}
.pesan-kontak-item:last-child { border-bottom: none; }
.pesan-kontak-item:hover, .pesan-kontak-item.active { background: var(--success-bg); }
.pesan-kontak-item .kontak-nama { font-weight: 600; }
.pesan-kontak-item .kontak-sub { color: var(--text-muted); font-size: 12px; }
.pesan-kontak-item .kontak-badge {
  display: inline-block; background: var(--danger-text); color: #fff; border-radius: 999px;
  font-size: 10.5px; padding: 1px 7px; margin-left: 6px;
}

.pesan-chat-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.pesan-chat-header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
.pesan-chat-body { flex: 1; padding: 16px 18px; overflow-y: auto; max-height: 420px; }
.pesan-bubble { max-width: 75%; padding: 9px 14px; border-radius: 14px; margin-bottom: 10px; font-size: 13.5px; line-height: 1.4; }
.pesan-bubble.masuk { background: var(--neutral-bg); color: var(--text); border-bottom-left-radius: 4px; }
.pesan-bubble.keluar { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.pesan-bubble .pesan-waktu { display: block; font-size: 10.5px; opacity: .7; margin-top: 4px; }
.pesan-chat-form { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.pesan-chat-form textarea { margin-top: 0; resize: none; }
.pesan-chat-form button { margin-top: 0; white-space: nowrap; }

/* ---------------------------------------------------------
   Navigasi mobile: bottom nav + "Lainnya" sheet
   --------------------------------------------------------- */
.bottom-nav { display: none; }
.more-sheet-overlay { display: none; }
.hamburger-toggle { display: none; }

@media (max-width: 860px) {
  .app-main { padding: 18px 16px 84px; }
  .sidebar { display: none; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--rail-bg);
    border-top: 1px solid var(--rail-border);
    z-index: 50;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--rail-text-muted);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 700;
    padding: 6px 2px;
    margin: 0 3px;
    border-radius: 12px;
    border: none; background: none; font-family: var(--font-body); cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .bottom-nav-item .icon {
    font-size: 18px; line-height: 1;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    transition: background 0.15s ease;
  }
  .bottom-nav-item.active { color: var(--primary-dark); background: var(--rail-active-bg); }
  .bottom-nav-item.active .icon { background: var(--primary); color: #fff; }

  .more-sheet-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(14,61,46,0.45); z-index: 60;
  }
  .more-sheet-overlay.open { display: block; }
  .more-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    padding: 18px 8px calc(18px + env(safe-area-inset-bottom));
    max-height: 70vh; overflow-y: auto;
  }
  .more-sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 999px; margin: 0 auto 14px; }
  .more-sheet a, .more-sheet button.more-sheet-link {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 16px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-size: 14.5px; font-weight: 500;
    border: none; background: none; width: 100%; text-align: left; font-family: var(--font-body); cursor: pointer;
  }
  .more-sheet-icon {
    width: 30px; height: 30px; flex-shrink: 0;
    border-radius: 9px;
    background: var(--primary-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
  }
  .more-sheet a:hover, .more-sheet button.more-sheet-link:hover { background: var(--bg); }
  .more-sheet .sidebar-user-name { padding: 8px 16px 0; font-weight: 600; }
  .more-sheet .sidebar-user-role { padding: 0 16px 10px; color: var(--text-muted); font-size: 12px; text-transform: capitalize; }

  /* Tabel jadi kartu bertumpuk di layar sempit */
  table.table-stack { border: none; }
  table.table-stack thead { display: none; }
  table.table-stack tr:first-child { display: none; }
  table.table-stack tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 6px 4px;
  }
  table.table-stack td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
    border-bottom: 1px dashed var(--border);
  }
  table.table-stack td:last-child { border-bottom: none; }
  table.table-stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
  }

  .dashboard-grid-2 { grid-template-columns: 1fr; }
  .pesan-shell { flex-direction: column; }
  .pesan-kontak-list { width: 100%; max-height: 200px; overflow-y: auto; }
  .filter-row > div { min-width: 100%; }
}

/* ---------------------------------------------------------
   Modal konfirmasi kustom (pengganti window.confirm())
   --------------------------------------------------------- */
.confirm-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(11,74,56,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.confirm-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 26px 22px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(11,74,56,0.25);
}
.confirm-modal-message { font-size: 14.5px; color: var(--text); line-height: 1.5; margin: 0; }
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.btn-confirm-danger {
  background: var(--danger-text);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-confirm-danger:hover { opacity: .88; }

/* ---------------------------------------------------------
   Ukuran ikon SVG di berbagai kontainer nav
   --------------------------------------------------------- */
.icon-chip svg { width: 16px; height: 16px; }
.bottom-nav-item .icon svg { width: 18px; height: 18px; }
.more-sheet-icon svg { width: 16px; height: 16px; }
.notif-bell svg { width: 18px; height: 18px; }
.sidebar-notif-bar svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 2px; }
.sidebar-logout svg, .more-sheet-link svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------------------------------------------------------
   Toast / snackbar
   --------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast {
  background: var(--primary-dark);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(11,74,56,0.28);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--primary-dark); }
.toast-error { background: var(--danger-text); }

@media (max-width: 860px) {
  .toast-container {
    left: 16px; right: 16px; bottom: 78px;
    max-width: none;
  }
}

/* ---------------------------------------------------------
   Pagination tabel
   --------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.pagination-info { font-size: 12.5px; color: var(--text-muted); }
.pagination .btn-secondary:disabled { opacity: .45; cursor: default; }
.pagination .btn-secondary:disabled:hover { border-color: var(--border); color: var(--text); background: var(--surface); }

/* ---------------------------------------------------------
   Kotak tampilan password baru (modal reset password)
   --------------------------------------------------------- */
.password-reveal-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--primary-soft);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  color: var(--primary-dark);
  user-select: all;
}

/* =========================================================
   REVISI v4 — HP kecil (≤400px) + sistem animasi "app-like"
   ========================================================= */

/* --- Penyesuaian ekstra untuk layar sangat sempit --- */
@media (max-width: 400px) {
  h1 { font-size: 22px; }
  h2 { font-size: 19px; }
  .app-main { padding: 14px 12px 84px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
  .stat-card { padding: 14px 14px; }
  .stat-card .stat-value { font-size: 24px; }
  .dashboard-section { padding: 16px 16px; }
  .login-hero { padding: 32px 20px; }
  .login-hero h1, .public-hero h1 { font-size: 24px; }
  .public-hero { padding: 44px 18px; }
  .quick-links { gap: 8px; }
  .quick-links a.btn-secondary { flex: 1 1 calc(50% - 8px); text-align: center; }
  .bottom-nav-item { font-size: 9.5px; }
  .bottom-nav-item .icon { width: 26px; height: 26px; }
}

/* --- Hormati pengguna yang mematikan animasi di sistemnya --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* --- Entrance animation: konten utama muncul halus saat halaman dibuka --- */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.app-main > * { animation: fadeSlideUp 0.35s ease both; }
.app-main > *:nth-child(1) { animation-delay: 0s; }
.app-main > *:nth-child(2) { animation-delay: 0.04s; }
.app-main > *:nth-child(3) { animation-delay: 0.08s; }
.app-main > *:nth-child(4) { animation-delay: 0.12s; }
.app-main > *:nth-child(n+5) { animation-delay: 0.16s; }

.stat-card, .public-card, .dashboard-section, .child-card {
  animation: fadeSlideUp 0.4s ease both;
}
.stat-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-grid .stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: 0.20s; }
.stat-grid .stat-card:nth-child(5) { animation-delay: 0.25s; }

/* --- Feedback saat kartu/tombol disentuh (khas app mobile) --- */
.stat-card, .public-card, .child-card, .dashboard-section,
.btn-secondary, .btn-primary, .bottom-nav-item, .more-sheet a,
.more-sheet button.more-sheet-link, .sidebar-link {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn-primary:active, .btn-secondary:active, .bottom-nav-item:active,
.stat-card:active, .public-card:active, .child-card:active {
  transform: scale(0.97);
}

/* --- Indikator aktif bottom-nav yang "hidup" --- */
.bottom-nav-item .icon {
  transition: background 0.25s cubic-bezier(.34,1.56,.64,1), color 0.2s ease, transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.bottom-nav-item.active .icon { transform: translateY(-2px) scale(1.06); }
.bottom-nav-item.active { animation: navPop 0.3s ease; }
@keyframes navPop {
  0% { transform: translateY(2px); }
  60% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

/* --- Notifikasi bell: getar halus saat ada notif baru --- */
@keyframes bellRing {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}
.notif-bell.has-new { animation: bellRing 0.6s ease; }
.notif-dot { animation: pulseDot 1.6s ease-in-out infinite; }
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(211,60,60,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(211,60,60,0); }
}

/* --- Skeleton loading: ganti teks "Memuat..." dengan efek shimmer --- */
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--neutral-bg) 25%, #f5f5f3 37%, var(--neutral-bg) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  margin-bottom: 8px;
}
.skeleton-line.short { width: 55%; }
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* --- Progress bar & badge: transisi angka/lebar yang halus --- */
.progress-fill { transition: width 0.5s ease; }
.badge { transition: transform 0.15s ease; }

/* --- Transisi antar-halaman via fetch/klik link (opsional, dipakai app.js) --- */
.page-transition-out { animation: fadeSlideDown 0.15s ease forwards; }
@keyframes fadeSlideDown {
  to { opacity: 0; transform: translateY(6px); }
}
