/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  overflow-x: hidden; min-height: 100dvh; -webkit-font-smoothing: antialiased;
}
:root {
  --primary: #1E3A5F; --primary-light: #2D5A8E; --primary-dark: #0F2440;
  --secondary: #3B82F6;
  --bg: #F1F5F9; --surface: #FFFFFF; --surface2: #F8FAFC;
  --text: #0F172A; --text2: #475569; --text3: #94A3B8;
  --border: #E2E8F0; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --radius: 12px; --radius-sm: 8px; --radius-full: 9999px;
  --nav-height: 64px; --header-height: 56px;
  --success: #10B981; --warning: #F59E0B; --danger: #EF4444; --info: #3B82F6;
  --success-bg: #ECFDF5; --warning-bg: #FFFBEB; --danger-bg: #FEF2F2; --info-bg: #EFF6FF;
  --transition: .2s ease;
}
[data-theme="dark"] {
  --bg: #0F172A; --surface: #1E293B; --surface2: #334155;
  --text: #F1F5F9; --text2: #94A3B8; --text3: #64748B;
  --border: #334155; --shadow: 0 1px 3px rgba(0,0,0,.3);
}
[data-tingkat="paud"] { --primary: #F59E0B; --primary-light: #FBBF24; --primary-dark: #B45309; --secondary: #F59E0B; }
[data-tingkat="tk"] { --primary: #10B981; --primary-light: #34D399; --primary-dark: #047857; --secondary: #10B981; }
[data-tingkat="sd"] { --primary: #3B82F6; --primary-light: #60A5FA; --primary-dark: #1D4ED8; --secondary: #3B82F6; }
[data-tingkat="smp"] { --primary: #EF4444; --primary-light: #F87171; --primary-dark: #B91C1C; --secondary: #EF4444; }
[data-theme="dark"][data-tingkat="paud"] { --bg: #1C1917; --surface: #292524; --surface2: #44403C; }
[data-theme="dark"][data-tingkat="tk"] { --bg: #022C22; --surface: #064E3B; --surface2: #065F46; }
[data-theme="dark"][data-tingkat="sd"] { --bg: #0F172A; --surface: #1E3A5F; --surface2: #1E40AF; }
[data-theme="dark"][data-tingkat="smp"] { --bg: #1F0F0F; --surface: #3B1F1F; --surface2: #5C2A2A; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text3); border-radius: 4px; }

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; } .text-sm { font-size: .875rem; } .text-xs { font-size: .75rem; }
.text-2xl { font-size: 1.5rem; } .text-xl { font-size: 1.25rem; } .text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; } .font-medium { font-weight: 500; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); } .text-warning { color: var(--warning); }
.text-danger { color: var(--danger); } .text-info { color: var(--info); }
.text-muted { color: var(--text2); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); touch-action: manipulation;
  user-select: none; -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { padding: 6px 12px; font-size: .8125rem; min-height: 36px; }
.btn-lg { padding: 14px 24px; font-size: 1rem; min-height: 52px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon.btn-sm { width: 36px; height: 36px; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: .8125rem; font-weight: 600;
  color: var(--text2); margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font-size: .9375rem; font-family: inherit;
  transition: border var(--transition), box-shadow var(--transition);
  min-height: 44px; -webkit-appearance: none; appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15);
}
.form-input::placeholder { color: var(--text3); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.form-select optgroup { font-weight: 600; color: var(--text); }
.form-select option { color: var(--text); }
.form-inline { display: flex; gap: 8px; align-items: flex-end; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }
.form-input.error { border-color: var(--danger); }

/* ===== SEARCH INPUT ===== */
.search-box {
  position: relative; width: 100%;
}
.search-box input {
  width: 100%; padding: 10px 14px 10px 40px; border: 1.5px solid var(--border);
  border-radius: var(--radius-full); background: var(--surface);
  color: var(--text); font-size: .875rem; font-family: inherit;
  transition: all var(--transition); min-height: 44px;
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,.15); }
.search-box .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-size: 1rem; pointer-events: none;
}

/* ===== CARD ===== */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: all var(--transition);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-body { color: var(--text2); font-size: .875rem; line-height: 1.6; }
.card:active { transform: scale(.99); }

/* ===== BADGE ===== */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px;
  border-radius: var(--radius-full); font-size: .75rem; font-weight: 600;
  gap: 4px; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
[data-theme="dark"] .badge-success { background: rgba(16,185,129,.15); }
[data-theme="dark"] .badge-warning { background: rgba(245,158,11,.15); }
[data-theme="dark"] .badge-danger { background: rgba(239,68,68,.15); }
[data-theme="dark"] .badge-info { background: rgba(59,130,246,.15); }

/* ===== STATUS ABSENSI ===== */
.status-hadir { background: #D1FAE5; color: #065F46; }
.status-sakit { background: #FEF3C7; color: #92400E; }
.status-izin { background: #DBEAFE; color: #1E40AF; }
.status-alpha { background: #FEE2E2; color: #991B1B; }
.status-terlambat { background: #FFEDD5; color: #9A3412; }
[data-theme="dark"] .status-hadir { background: rgba(16,185,129,.15); color: #6EE7B7; }
[data-theme="dark"] .status-sakit { background: rgba(245,158,11,.15); color: #FCD34D; }
[data-theme="dark"] .status-izin { background: rgba(59,130,246,.15); color: #93C5FD; }
[data-theme="dark"] .status-alpha { background: rgba(239,68,68,.15); color: #FCA5A5; }
[data-theme="dark"] .status-terlambat { background: rgba(249,115,22,.15); color: #FDBA74; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { position: sticky; top: 0; z-index: 1; }
th {
  text-align: left; padding: 10px 8px; font-weight: 600;
  color: var(--text2); font-size: .75rem; text-transform: uppercase;
  letter-spacing: .05em; background: var(--surface); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px 8px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ===== LIST ===== */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition); touch-action: manipulation;
}
.list-item:active { transform: scale(.99); background: var(--surface2); }
.list-item .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; color: #fff; flex-shrink: 0;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .info .name { font-weight: 600; font-size: .9375rem; color: var(--text); }
.list-item .info .sub { font-size: .8125rem; color: var(--text2); margin-top: 2px; }
.list-item .action { flex-shrink: 0; }

/* ===== HEADER ===== */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: var(--header-height); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,.85);
}
[data-theme="dark"] .app-header { background: rgba(30,41,59,.85); }
.app-header .title { font-size: 1.125rem; font-weight: 700; color: var(--text); }
.app-header .subtitle { font-size: .75rem; color: var(--text2); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--surface); border-top: 1px solid var(--border);
  height: var(--nav-height); display: flex; align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,.9);
}
[data-theme="dark"] .bottom-nav { background: rgba(30,41,59,.9); }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; color: var(--text3); transition: all var(--transition);
  font-size: .625rem; font-weight: 600; text-decoration: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  min-height: 56px; padding: 8px 0; position: relative; border: none; background: none;
}
.nav-item .nav-icon { font-size: 1.5rem; line-height: 1; }
.nav-item .nav-label { font-size: .625rem; margin-top: 1px; }
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 20px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary);
}
.nav-item:active { transform: scale(.92); }

/* ===== PAGE CONTAINER ===== */
.main-content {
  padding-top: var(--header-height); padding-bottom: calc(var(--nav-height) + 24px);
  min-height: 100dvh;
}
.page { display: none; padding: 16px; max-width: 640px; margin: 0 auto; animation: fadeIn .25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.login-page .login-card {
  width: 100%; max-width: 400px; padding: 32px 24px;
  background: rgba(255,255,255,.95); border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
[data-theme="dark"] .login-card { background: var(--surface); }
.login-page .logo-area {
  text-align: center; margin-bottom: 24px;
}
.login-page .logo-icon {
  width: 72px; height: 72px; border-radius: 20px;
  background: var(--primary); display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 2rem; color: #fff; margin-bottom: 12px;
}
.login-page h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.login-page p { font-size: .875rem; color: var(--text2); margin-top: 4px; }
.login-page .guru-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.login-page .guru-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all var(--transition); touch-action: manipulation;
}
.login-page .guru-option:active { transform: scale(.99); }
.login-page .guru-option.selected { border-color: var(--primary); background: rgba(30,58,95,.05); }
.login-page .guru-option .thumb {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: .875rem;
}
.login-page .guru-option .guru-name { font-weight: 600; font-size: .9375rem; color: var(--text); }
.login-page .guru-option .guru-role { font-size: .8125rem; color: var(--text2); }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-card {
  padding: 14px; border-radius: var(--radius-sm); text-align: center;
}
.stat-card .stat-num { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat-card .stat-label { font-size: .75rem; color: var(--text2); margin-top: 2px; }

/* ===== FORM MODAL / SHEET ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5); display: none;
  align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-sheet {
  background: var(--surface); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px; max-height: 90dvh; overflow-y: auto;
  padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
  animation: slideUp .3s ease;
}
.modal-sheet .modal-handle {
  width: 36px; height: 4px; border-radius: 4px; background: var(--text3);
  margin: 0 auto 16px;
}
.modal-sheet .modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ===== ABSENSI GRID ===== */
.absensi-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.absensi-item:last-child { border-bottom: none; }
.absensi-item .siswa-info { flex: 1; min-width: 0; }
.absensi-item .siswa-info .nama { font-weight: 600; font-size: .875rem; }
.absensi-item .siswa-info .nis { font-size: .6875rem; color: var(--text2); }
.status-btn-group { display: flex; gap: 3px; }
.status-btn {
  width: 36px; height: 32px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: .75rem; font-weight: 700; font-family: inherit;
  transition: all var(--transition); touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); padding: 0;
}
@media (max-width: 400px) {
  .absensi-item { flex-wrap: wrap; gap: 6px; }
  .absensi-item .siswa-info { flex: 1 1 100%; }
  .status-btn-group { flex: 1; justify-content: flex-end; }
}
.status-btn:active { transform: scale(.93); }
.status-btn.active-h { background: #D1FAE5; border-color: #059669; color: #065F46; }
.status-btn.active-s { background: #FEF3C7; border-color: #D97706; color: #92400E; }
.status-btn.active-i { background: #DBEAFE; border-color: #2563EB; color: #1E40AF; }
.status-btn.active-a { background: #FEE2E2; border-color: #DC2626; color: #991B1B; }
.status-btn.active-t { background: #FFEDD5; border-color: #EA580C; color: #9A3412; }
[data-theme="dark"] .status-btn { background: var(--surface2); border-color: var(--border); color: var(--text2); }
[data-theme="dark"] .status-btn.active-h { background: rgba(16,185,129,.15); border-color: #059669; color: #6EE7B7; }
[data-theme="dark"] .status-btn.active-s { background: rgba(245,158,11,.15); border-color: #D97706; color: #FCD34D; }
[data-theme="dark"] .status-btn.active-i { background: rgba(59,130,246,.15); border-color: #2563EB; color: #93C5FD; }
[data-theme="dark"] .status-btn.active-a { background: rgba(239,68,68,.15); border-color: #DC2626; color: #FCA5A5; }
[data-theme="dark"] .status-btn.active-t { background: rgba(249,115,22,.15); border-color: #EA580C; color: #FDBA74; }

/* ===== CHECKBOX ===== */
.siswa-check {
  width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--text3);
  accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
  -webkit-appearance: none; appearance: none;
  transition: all var(--transition); position: relative;
  background: var(--surface);
}
.siswa-check:checked {
  background: var(--primary); border-color: var(--primary);
}
.siswa-check:checked::after {
  content: '✓'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); color: #fff; font-size: 12px; font-weight: 700;
}
.list-item.selected { background: rgba(59,130,246,.06); border-color: var(--primary); }
[data-theme="dark"] .list-item.selected { background: rgba(59,130,246,.12); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text2);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: .9375rem; margin-bottom: 16px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; top: calc(var(--header-height) + 8px); left: 16px; right: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  padding: 12px 16px; border-radius: var(--radius-sm);
  color: #fff; font-size: .875rem; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: slideDown .3s ease; pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== LOADING ===== */
.loading-spinner {
  display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite;
}
.loading-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; flex-direction: column; gap: 12px; color: var(--text2);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SECTION ===== */
.section-title {
  font-size: .875rem; font-weight: 700; color: var(--text2);
  margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .05em;
}

/* ===== SWITCH ===== */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; gap: 12px;
}
.switch-row label { flex: 1; font-size: .9375rem; font-weight: 500; }
.switch {
  width: 48px; height: 28px; border-radius: 14px; background: var(--text3);
  cursor: pointer; position: relative; transition: background var(--transition);
  flex-shrink: 0; border: none;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  transition: transform var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on::after { transform: translateX(20px); }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  padding: 6px 14px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: .8125rem; font-weight: 500; color: var(--text2);
  cursor: pointer; white-space: nowrap; transition: all var(--transition);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.filter-chip:active { transform: scale(.95); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== CALENDAR GRID ===== */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.cal-header { text-align: center; font-size: .75rem; font-weight: 600; color: var(--text2); padding: 4px; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: .875rem; cursor: pointer;
  transition: all var(--transition); position: relative; touch-action: manipulation;
}
.cal-day:active { transform: scale(.9); }
.cal-day.today { font-weight: 800; color: var(--primary); }
.cal-day.selected { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.other-month { color: var(--text3); }
.cal-day .dot {
  position: absolute; bottom: 4px; width: 6px; height: 6px;
  border-radius: 50%; left: 50%; transform: translateX(-50%);
}
.cal-day .dot.h { background: var(--success); }
.cal-day .dot.s { background: var(--warning); }
.cal-day .dot.a { background: var(--danger); }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden;
}
.progress-bar .fill { height: 100%; border-radius: 4px; transition: width .5s ease; }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

/* ===== CHART CONTAINER ===== */
.chart-wrap {
  width: 100%; max-height: 250px; position: relative;
}
.chart-wrap canvas { width: 100% !important; max-height: 250px; }

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .main-content { padding: 16px 24px; padding-top: calc(var(--header-height) + 16px); padding-bottom: 24px; max-width: 960px; margin: 0 auto; }
  .bottom-nav { max-width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .page { padding: 0; }
  .modal-sheet { border-radius: 20px; max-width: 480px; margin-bottom: 40px; }
  .modal-overlay { align-items: center; }
}

@media (min-width: 1024px) {
  .bottom-nav { max-width: 480px; }
}

/* ===== ROLE-BASED VISIBILITY ===== */
[data-user-role="teacher"] .admin-only { display: none !important; }

/* ===== DAILY SETUP ===== */
.daily-setup {
  position: fixed; inset: 0; z-index: 250;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.daily-setup.hidden { display: none; }
.daily-setup-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border-radius: var(--radius);
  padding: 32px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

/* ===== ABSENSI SETUP OVERLAY ===== */
.abs-setup-overlay {
  display: flex;
  align-items: center; justify-content: center;
  padding: 32px 0; min-height: 50dvh;
}
.abs-setup-overlay.hidden { display: none; }
.abs-setup-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border-radius: var(--radius);
  padding: 32px 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
