/* =====================================================================
   SIPANDAI — Sistem Informasi Pantauan Data dan Aktivitas Santri Ibrahim
   Tema: hijau zamrud & emas (selaras logo PPTQ Ibrahim)
   ===================================================================== */
:root {
  --primary: #0f766e;
  --primary-600: #0d9488;
  --primary-700: #115e59;
  --primary-900: #083d38;
  --primary-50: #ecfdf8;
  --primary-100: #ccfbef;
  --gold: #c8962b;
  --gold-50: #fdf6e3;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e3e8e7;
  --success: #059669; --success-50: #ecfdf5;
  --warning: #d97706; --warning-50: #fffbeb;
  --orange: #ea580c;  --orange-50: #fff7ed;
  --danger: #dc2626;  --danger-50: #fef2f2;
  --info: #2563eb;    --info-50: #eff6ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px -8px rgba(15, 23, 42, .12);
  --shadow-lg: 0 20px 40px -16px rgba(15, 23, 42, .25);
  --sidebar-w: 264px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.xs { font-size: .74rem; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; align-items: center; gap: .75rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Layout aplikasi ---------------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  background: linear-gradient(175deg, #064e3b 0%, #0b3f3a 55%, #082f2b 100%);
  color: #d1fae5; display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .06;
  background-image: radial-gradient(circle at 20% 10%, #fff 1px, transparent 1.5px);
  background-size: 22px 22px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); position: relative; z-index: 1; }
.brand img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 12px; padding: 3px; }
.brand-name { font-weight: 800; font-size: 1.15rem; color: #fff; letter-spacing: .5px; }
.brand-sub { font-size: .72rem; color: #a7f3d0; line-height: 1.3; }
.nav { flex: 1; overflow-y: auto; padding: 14px 12px; position: relative; z-index: 1; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; color: #6ee7b7; opacity: .7; padding: 14px 12px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
  color: #d1fae5; border-radius: 10px; font-weight: 500; font-size: .9rem; position: relative;
}
.nav a i { width: 20px; text-align: center; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav .count { margin-left: auto; background: var(--gold); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; color: #fff; font-size: .85rem; }
.sidebar-foot .who span { font-size: .72rem; color: #a7f3d0; }
.sidebar-foot a { color: #fecaca; padding: 8px; border-radius: 8px; }
.sidebar-foot a:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(243,246,245,.85); backdrop-filter: blur(10px);
  padding: 14px 28px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 1.2rem; font-weight: 800; }
.topbar .crumb { font-size: .78rem; color: var(--muted); }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; background: var(--surface); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 10px; font-size: 1.05rem; color: var(--text); cursor: pointer; }
.chip-date { background: var(--surface); border: 1px solid var(--border); padding: 7px 12px; border-radius: 10px; font-size: .8rem; color: var(--text-2); font-weight: 600; }
.content { padding: 8px 28px 40px; flex: 1; }
.footer-note { padding: 18px 28px; font-size: .75rem; color: var(--muted); text-align: center; }
.overlay { position: fixed; inset: 0; background: rgba(2,6,23,.45); z-index: 55; display: none; }
.overlay.show { display: block; }

/* ---------------- Kartu & grid ---------------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(15,23,42,.04); margin-bottom: 20px; }
.card-header { padding: 16px 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-header h2 i, .card-header h3 i { color: var(--primary); }
.card-header .tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

/* Stat tile */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; border: 1px solid rgba(15,23,42,.04); }
.stat .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; }
.stat .num { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat .lbl { font-size: .78rem; color: var(--muted); font-weight: 500; }
.ico-green { background: var(--primary-50); color: var(--primary); }
.ico-gold { background: var(--gold-50); color: var(--gold); }
.ico-blue { background: var(--info-50); color: var(--info); }
.ico-red { background: var(--danger-50); color: var(--danger); }
.ico-orange { background: var(--orange-50); color: var(--orange); }
.ico-purple { background: #f5f3ff; color: #7c3aed; }

/* Hero sapaan */
.hero-card {
  background: linear-gradient(120deg, var(--primary-900) 0%, var(--primary) 65%, #14b8a6 130%);
  color: #fff; border-radius: 20px; padding: 24px 26px; margin-bottom: 20px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.hero-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(200,150,43,.35), transparent 70%);
}
.hero-card h2 { font-size: 1.35rem; font-weight: 800; margin-bottom: 4px; position: relative; z-index: 1; }
.hero-card p { color: #ccfbef; margin: 0; position: relative; z-index: 1; font-size: .9rem; }
.hero-card .hero-row { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-card .avatar { border: 3px solid rgba(255,255,255,.6); }
.hero-card .pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); padding: 4px 11px; border-radius: 99px; font-size: .76rem; margin: 8px 6px 0 0; }
.ayat-quote { font-size: .8rem; color: #a7f3d0; margin-top: 10px !important; font-style: italic; }

/* ---------------- Tombol ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  border: 1.5px solid transparent; font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer; transition: all .15s ease;
  text-decoration: none; white-space: nowrap; line-height: 1.3;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #a97c1e; color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef2f1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-soft-danger { background: var(--danger-50); color: var(--danger); }
.btn-soft-danger:hover { background: #fee2e2; color: #b91c1c; }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5a; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- Badge ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.badge-success { background: var(--success-50); color: #047857; }
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-warning { background: var(--warning-50); color: #b45309; }
.badge-orange { background: var(--orange-50); color: #c2410c; }
.badge-danger { background: var(--danger-50); color: #b91c1c; }
.badge-info { background: var(--info-50); color: #1d4ed8; }
.badge-muted { background: #f1f5f9; color: #475569; }
.badge-gold { background: var(--gold-50); color: #92400e; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------------- Tabel ---------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; padding: 12px 16px; background: #f8faf9; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid #eef2f1; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfb; }
.table .person { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.table .person b { display: block; font-weight: 700; color: var(--text); }
.table .person small { color: var(--muted); font-size: .76rem; }

/* ---------------- Form ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: 6px; color: var(--text-2); }
.field .req { color: var(--danger); }
.field .hint { font-size: .75rem; color: var(--muted); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff;
  font: inherit; font-size: .9rem; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; }
.input-icon .input { padding-left: 38px; }
.input-icon .toggle-pw { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); background: #fbfdfc; }
.toolbar .input { width: auto; min-width: 150px; padding: 8px 12px; font-size: .85rem; }
.toolbar .search { flex: 1; min-width: 200px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.seg { display: inline-flex; background: #eef2f1; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { display: none; }
.seg span { display: inline-block; padding: 7px 14px; border-radius: 8px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

.photo-upload { display: flex; align-items: center; gap: 18px; }
.photo-upload .preview { width: 96px; height: 96px; border-radius: 20px; overflow: hidden; background: #f1f5f9; display: grid; place-items: center; flex-shrink: 0; border: 2px dashed #cbd5e1; }
.photo-upload .preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload .preview .avatar { border-radius: 0; width: 100% !important; height: 100% !important; }

/* ---------------- Alert ---------------- */
.alert { padding: 12px 16px; border-radius: 12px; font-size: .88rem; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert i { margin-top: 3px; }
.alert-success { background: var(--success-50); color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: var(--danger-50); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-50); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-50); color: #1e3a8a; border-color: #bfdbfe; }
.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast-wrap .alert { box-shadow: var(--shadow-lg); margin: 0; animation: toastIn .3s ease; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 16px; overflow-x: auto; }
.tabs a { padding: 13px 14px; font-weight: 600; font-size: .87rem; color: var(--muted); border-bottom: 2.5px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------------- Avatar ---------------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; font-weight: 800; }
.avatar-lg { border-radius: 22px; }

/* ---------------- Kosong ---------------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty i { font-size: 2.4rem; color: #cbd5e1; margin-bottom: 12px; display: block; }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; }

/* ---------------- Progres ---------------- */
.progress { height: 8px; background: #e8eeec; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-600), #34d399); border-radius: 99px; }
.progress.gold > span { background: linear-gradient(90deg, var(--gold), #f3c969); }
.ring { --p: 0; --size: 120px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), #e6ecea 0); }
.ring::before { content: ""; position: absolute; inset: 11px; background: #fff; border-radius: 50%; }
.ring > div { position: relative; text-align: center; line-height: 1.1; }
.ring b { font-size: 1.5rem; font-weight: 800; display: block; }
.ring small { font-size: .7rem; color: var(--muted); }

/* Peta 30 juz */
.juz-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.juz { aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center; font-size: .78rem; font-weight: 700; position: relative; cursor: default;
  background: #eef2f1; color: #94a3b8; border: 1px solid #e2e8f0; }
.juz[data-l="1"] { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.juz[data-l="2"] { background: #6ee7b7; color: #064e3b; border-color: #34d399; }
.juz[data-l="3"] { background: #10b981; color: #fff; border-color: #059669; }
.juz[data-l="4"] { background: var(--primary-700); color: #fff; border-color: var(--primary-900); box-shadow: inset 0 0 0 2px rgba(200,150,43,.8); }
.juz-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .74rem; color: var(--muted); margin-top: 12px; }
.juz-legend span { display: inline-flex; align-items: center; gap: 5px; }
.juz-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------------- Daftar item ---------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid #eef2f1; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow b { display: block; font-size: .9rem; }
.list-item .meta { font-size: .77rem; color: var(--muted); }
.icon-circle { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }
.tl-item.danger::before { border-color: var(--danger); }
.tl-item.warning::before { border-color: var(--warning); }
.tl-item.orange::before { border-color: var(--orange); }

.info-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; font-size: .88rem; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; font-weight: 600; }

.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

.announce { border-left: 4px solid var(--primary); background: var(--primary-50); padding: 14px 16px; border-radius: 0 12px 12px 0; margin-bottom: 12px; }
.announce.penting { border-color: var(--gold); background: var(--gold-50); }
.announce h4 { font-size: .95rem; margin-bottom: 4px; }
.announce .body { font-size: .87rem; color: var(--text-2); white-space: pre-line; }

.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination .dots { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; font-weight: 600; font-size: .85rem; color: var(--text-2); border: 1px solid var(--border); background: #fff; padding: 0 8px; }
.pagination .dots { border: 0; background: none; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------- Modal ---------------- */
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); }
dialog.modal::backdrop { background: rgba(2,6,23,.5); backdrop-filter: blur(2px); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.05rem; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- Navigasi bawah (HP) ---------------- */
.bottom-nav { display: none; }

/* ---------------- Responsif ---------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  .content { padding: 6px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .chip-date { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat .num { font-size: 1.3rem; }
  .card-header, .card-body { padding: 14px 16px; }
  .toolbar { padding: 12px 16px; }
  .toolbar .input { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .toolbar .search { flex-basis: 100%; }
  .topbar .crumb { display: none; }
  .table th, .table td { padding: 10px 12px; }
  .hero-card { padding: 20px; }
  .info-list { grid-template-columns: 1fr; gap: 2px; }
  .info-list dd { margin-bottom: 8px; }
  .juz-grid { grid-template-columns: repeat(6, 1fr); }
  .topbar h1 { font-size: 1.05rem; }
  .hide-sm { display: none !important; }
  /* Portal wali: navigasi bawah */
  .has-bottom-nav .content { padding-bottom: 96px; }
  .has-bottom-nav .menu-btn { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff;
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(15,23,42,.06);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .67rem; color: var(--muted); padding: 6px 2px; font-weight: 600; position: relative; }
  .bottom-nav a i { font-size: 1.15rem; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav .count { position: absolute; top: 0; right: 22%; background: var(--danger); color: #fff; border-radius: 99px; font-size: .6rem; padding: 0 5px; }
}

/* ---------------- Cetak ---------------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11.5pt; }
  .sidebar, .topbar, .bottom-nav, .no-print, .footer-note, .toast-wrap { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .print-only { display: block; }
  a { color: inherit; }
  .table th { background: #f1f5f1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .juz, .badge, .progress > span, .hero-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.kop { display: flex; align-items: center; gap: 16px; border-bottom: 3px double #0f766e; padding-bottom: 12px; margin-bottom: 18px; }
.kop img { width: 70px; height: 70px; object-fit: contain; }
.kop h2 { font-size: 1.2rem; color: var(--primary-900); }
.kop p { margin: 0; font-size: .8rem; color: var(--muted); }
.ttd { display: flex; justify-content: flex-end; margin-top: 36px; }
.ttd div { text-align: center; min-width: 220px; font-size: .9rem; }
.ttd .space { height: 70px; }
