/* ============================================================
   SIAKAD - Design System
   Clean & Light | Inspired by Google Classroom
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ------ CSS Variables (Friendly & Calm Colorful Palette) ------ */
:root {
  /* Brand & Accents */
  --primary:        #4f46e5;       /* Friendly Indigo */
  --primary-dark:   #4338ca;
  --primary-light:  #eef2ff;
  --primary-subtle: #e0e7ff;
  
  --secondary:      #0d9488;       /* Calm Ocean Teal */
  --secondary-light:#f0fdfa;
  
  --success:        #10b981;       /* Calm Mint Emerald */
  --success-dark:   #059669;
  --success-light:  #ecfdf5;
  
  --warning:        #f59e0b;       /* Warm Honey Amber */
  --warning-dark:   #d97706;
  --warning-light:  #fffbeb;
  
  --danger:         #f43f5e;       /* Soft Rose Coral */
  --danger-dark:    #e11d48;
  --danger-light:   #fff1f2;
  
  --info:           #0284c7;       /* Soft Sky Blue */
  --info-light:     #f0f9ff;

  --purple:         #8b5cf6;       /* Soft Lavender */
  --purple-light:   #f5f3ff;

  --pink:           #ec4899;       /* Soft Candy Pink */
  --pink-light:     #fdf2f8;

  --teal:           #14b8a6;       /* Soft Mint Teal */
  --teal-light:     #f0fdfa;

  /* Neutrals (Slate-tinted) */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --white: #ffffff;
  --sidebar-width: 264px;
  --header-height: 64px;
  --border-radius: 14px;
  --border-radius-sm: 9px;
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 18px -2px rgba(15,23,42,.08), 0 2px 6px -1px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px -4px rgba(15,23,42,.12), 0 4px 12px -2px rgba(15,23,42,.06);
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Aliases */
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
}

/* ------ Reset & Base ------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }

/* ------ Layout ------ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ------ Sidebar ------ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 0 0 24px rgba(15,23,42,.03);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
}
.sidebar-brand .brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
  flex-shrink: 0;
}
.sidebar-brand .brand-name {
  font-size: 17px; font-weight: 800; color: var(--gray-800);
  letter-spacing: -0.3px; line-height: 1.2;
}
.sidebar-brand .brand-sub {
  font-size: 11px; color: var(--gray-500); margin-top: 2px;
}
.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 14px 0;
}
.nav-section-title {
  font-size: 10.5px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 10px 22px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 14px; margin: 3px 12px;
  border-radius: 10px;
  color: var(--gray-600); font-weight: 500; font-size: 13.5px;
  cursor: pointer; transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--gray-100); color: var(--gray-900);
  transform: translateX(2px);
}
.nav-item.active {
  background: var(--primary-light); color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--primary-subtle);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px;
  background: linear-gradient(180deg, #6366f1, #4f46e5); border-radius: 0 4px 4px 0;
}
.nav-item i { font-size: 18px; width: 20px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--primary);
  color: white; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
}
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: #fafbfe;
}
.sidebar-user {
  display: flex; align-items: center; gap: 11px;
}
.sidebar-user .user-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,.25);
}
.sidebar-user .user-name {
  font-weight: 600; font-size: 13px; color: var(--gray-800);
  line-height: 1.2;
}
.sidebar-user .user-role {
  font-size: 11px; color: var(--gray-500); text-transform: capitalize;
}
.sidebar-user .logout-btn {
  margin-left: auto; color: var(--gray-400); font-size: 18px;
  padding: 6px; border-radius: 8px; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-user .logout-btn:hover { color: var(--danger); background: var(--danger-light); }

/* ------ Main Content ------ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ------ Top Header ------ */
.top-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 32px;
  position: sticky; top: 0; z-index: 50;
  gap: 16px;
  box-shadow: 0 1px 4px rgba(15,23,42,.03);
}
.header-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--gray-600); font-size: 22px; padding: 6px;
}
.header-title {
  font-size: 17px; font-weight: 700; color: var(--gray-800); flex: 1;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--gray-200);
  background: var(--white); cursor: pointer; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  transition: var(--transition);
}
.header-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.header-date {
  font-size: 12.5px; color: var(--gray-500); font-weight: 500;
  background: var(--gray-50); padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--gray-200);
}

/* ------ Page Content ------ */
.page-content {
  padding: 30px 32px;
  flex: 1;
}
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.3px; }
.page-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------ Cards ------ */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #ffffff;
}
.card-title {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* ------ Stat Cards (Calm & Colorful Glow) ------ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
  cursor: default;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: transparent;
  transition: var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: #cbd5e1;
}
.stat-icon {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
}
.stat-icon.blue   { background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: #4f46e5; border: 1px solid #c7d2fe; }
.stat-icon.green  { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; border: 1px solid #a7f3d0; }
.stat-icon.yellow { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #d97706; border: 1px solid #fde68a; }
.stat-icon.purple { background: linear-gradient(135deg, #f5f3ff, #ede9fe); color: #7c3aed; border: 1px solid #ddd6fe; }
.stat-icon.red    { background: linear-gradient(135deg, #fff1f2, #ffe4e6); color: #e11d48; border: 1px solid #fecdd3; }
.stat-icon.teal   { background: linear-gradient(135deg, #f0fdfa, #ccfbf1); color: #0d9488; border: 1px solid #99f6e4; }

.stat-info { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--gray-800); line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--gray-500); margin-top: 6px; font-weight: 500; }
.stat-change {
  font-size: 11.5px; font-weight: 600; margin-top: 4px;
}
.stat-change.up   { color: var(--success-dark); }
.stat-change.down { color: var(--danger-dark); }

/* ------ Buttons (Friendly Modern Gradients) ------ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--border-radius-sm);
  font-size: 13px; font-weight: 600; border: none; cursor: pointer;
  transition: var(--transition); text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
.btn i { font-size: 16px; }
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700) !important;
}
.btn-secondary:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
  color: var(--gray-900) !important;
}
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}
.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  transform: translateY(-1px);
}
.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: translateY(-1px);
}
.btn-outline {
  background: #ffffff; border: 1.5px solid var(--gray-300);
  color: var(--gray-700) !important;
}
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--gray-900) !important; }
.btn-outline-primary {
  background: #ffffff; border: 1.5px solid #c7d2fe;
  color: var(--primary) !important;
}
.btn-outline-primary:hover { background: var(--primary-light); border-color: #a5b4fc; color: var(--primary-dark) !important; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-sm i { font-size: 14px; }
.btn-icon {
  width: 34px; height: 34px; padding: 0;
  justify-content: center; border-radius: 8px;
}
.btn-icon i { font-size: 16px; margin: 0; }

/* ------ Badges (Calm Pastel Pills) ------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
}
.badge-primary   { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }
.badge-success   { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-danger    { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.badge-warning   { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-info      { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
.badge-purple    { background: #f5f3ff; color: #5b21b6; border: 1px solid #ddd6fe; }
.badge-teal      { background: #f0fdfa; color: #115e59; border: 1px solid #99f6e4; }
.badge-gray      { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }
.badge-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }

/* Status badges */
.badge-hadir  { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-izin   { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
.badge-sakit  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-alpa   { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.badge-bolos  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* ------ Tables ------ */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse;
}
.table th {
  background: var(--gray-50); padding: 12px 16px;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200); white-space: nowrap;
}
.table td {
  padding: 13px 16px; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700); vertical-align: middle;
}
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; }

/* ------ Forms ------ */
.form-group { margin-bottom: 20px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 3px; }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  font-size: 14px; color: var(--gray-800);
  background: var(--white); transition: var(--transition);
  font-family: inherit; outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.form-control:disabled { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235f6368' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }

/* File Upload */
.file-upload-area {
  border: 2px dashed var(--gray-300); border-radius: var(--border-radius);
  padding: 40px 24px; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--gray-50);
}
.file-upload-area:hover, .file-upload-area.dragover {
  border-color: var(--primary); background: var(--primary-light);
}
.file-upload-area i { font-size: 40px; color: var(--gray-400); margin-bottom: 12px; }
.file-upload-area.has-file i { color: var(--primary); }
.file-upload-area p { color: var(--gray-600); font-size: 14px; }
.file-upload-area small { color: var(--gray-400); font-size: 12px; }

/* ------ Alerts ------ */
.alert {
  padding: 14px 18px; border-radius: var(--border-radius-sm);
  margin-bottom: 20px; display: flex; align-items: flex-start; gap: 12px;
  font-size: 13px; font-weight: 500;
}
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #1e7e34; border-left: 4px solid var(--success); }
.alert-danger  { background: var(--danger-light);  color: #c0392b; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #856404; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--info-light);    color: #1557b0; border-left: 4px solid var(--info); }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: 0.6; font-size: 18px; padding: 0; line-height: 1; }
.alert-close:hover { opacity: 1; }

/* ------ Attendance Grid ------ */
.attendance-table .status-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gray-200);
  background: var(--white); cursor: pointer; font-size: 14px; font-weight: 700;
  transition: var(--transition); display: inline-flex; align-items: center; justify-content: center;
}
.attendance-table .status-btn:hover { transform: scale(1.1); }
.attendance-table .status-btn[data-status="hadir"] { border-color: var(--success); color: var(--success); }
.attendance-table .status-btn[data-status="hadir"].active { background: var(--success); color: white; }
.attendance-table .status-btn[data-status="izin"]  { border-color: var(--info);    color: var(--info); }
.attendance-table .status-btn[data-status="izin"].active  { background: var(--info);    color: white; }
.attendance-table .status-btn[data-status="sakit"] { border-color: var(--warning); color: var(--warning); }
.attendance-table .status-btn[data-status="alpa"]  { border-color: var(--danger);  color: var(--danger); }
.attendance-table .status-btn[data-status="alpa"].active  { background: var(--danger);  color: white; }
.attendance-table .status-btn[data-status="bolos"] { border-color: #ea580c; color: #ea580c; }
.attendance-table .status-btn[data-status="bolos"].active { background: #ea580c; color: white; }

/* ------ Empty State ------ */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--gray-500);
}
.empty-state i { font-size: 56px; color: var(--gray-300); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--gray-400); }

/* ------ Modal ------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--white); border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(0.95) translateY(10px); transition: var(--transition);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 600; color: var(--gray-800); }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: var(--gray-500); padding: 4px; border-radius: 6px; transition: var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-800); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ------ Tabs ------ */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  color: var(--gray-500); border: none; background: none; cursor: pointer;
  position: relative; transition: var(--transition);
}
.tab-btn:hover { color: var(--gray-800); }
.tab-btn.active { color: var(--primary); }
.tab-btn.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--primary); border-radius: 2px 2px 0 0;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ------ Pagination ------ */
.pagination { display: flex; gap: 6px; align-items: center; }
.pagination .page-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--gray-300);
  background: var(--white); color: var(--gray-600); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; transition: var(--transition);
}
.pagination .page-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination .page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ------ Filter Bar ------ */
.filter-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-bottom: 20px; padding: 16px 20px;
  background: var(--white); border-radius: var(--border-radius-sm);
  border: 1px solid var(--gray-200);
}
.filter-bar .form-control { width: auto; min-width: 160px; padding: 8px 12px; font-size: 13px; }
.filter-bar .form-select { width: auto; min-width: 160px; padding: 8px 36px 8px 12px; font-size: 13px; }

/* ------ Progress Bar ------ */
.progress { height: 8px; background: var(--gray-200); border-radius: 20px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 20px; transition: width .5s ease;
}
.progress-bar.blue  { background: var(--primary); }
.progress-bar.green { background: var(--success); }
.progress-bar.red   { background: var(--danger); }

/* ------ Login Page ------ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8f9fa 0%, #e8f0fe 50%, #e6f4ea 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--white); border-radius: 20px;
  box-shadow: 0 20px 60px rgba(60,64,67,.15), 0 8px 24px rgba(60,64,67,.08);
  width: 100%; max-width: 440px; overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, var(--primary) 0%, #4285f4 100%);
  padding: 36px 40px 32px; text-align: center; color: white;
}
.login-logo {
  width: 72px; height: 72px; background: rgba(255,255,255,.2);
  border-radius: 20px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; letter-spacing: -1px;
}
.login-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-header p { font-size: 13px; opacity: 0.8; }
.login-body { padding: 36px 40px 32px; }
.login-footer {
  text-align: center; padding: 0 40px 28px;
  font-size: 12px; color: var(--gray-400);
}

/* ------ Rekap Chart Container ------ */
.chart-container { position: relative; height: 240px; }

/* ------ Content & Page Headers ------ */
.content-header, .page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.content-title, .page-title {
  font-size: 22px; font-weight: 700; color: var(--gray-800);
  line-height: 1.3;
}
.content-sub, .page-subtitle {
  font-size: 13px; color: var(--gray-500); margin-top: 4px;
}
.content-actions, .page-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}

/* ------ Tables & Overflow ------ */
.table-wrapper, .table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ------ Responsive Breakpoints ------ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    box-shadow: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }
  .header-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    font-size: 24px;
  }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: block !important;
  }
  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .app-layout {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .top-header {
    padding: 0 14px;
    height: 56px;
    gap: 10px;
  }
  .header-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-date { display: none; }
  .page-content {
    padding: 16px 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .content-header, .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }
  .content-title, .page-title {
    font-size: 18px;
  }
  .content-actions, .page-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .content-actions .btn, .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  .stat-card {
    padding: 14px;
    gap: 10px;
  }
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border-radius: 10px;
  }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; margin-top: 2px; }

  .card {
    max-width: 100%;
    overflow: hidden;
  }
  .card-header {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .card-header .badge, .card-header .btn {
    align-self: flex-start;
  }
  .card-body { padding: 16px 14px; }
  .card-footer {
    padding: 14px 16px;
    flex-direction: column;
    gap: 10px;
  }
  .card-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Responsive Grid elements */
  .form-row,
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(240px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(240px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(220px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(220px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(200px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(180px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(180px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(140px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fit, minmax(140px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fill, minmax(280px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(280px, 1fr))"],
  div[style*="grid-template-columns:repeat(auto-fill,minmax(280px,1fr))"],
  div[style*="grid-template-columns: repeat(auto-fill,minmax(280px,1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Table styling on mobile */
  .table-responsive, .table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0;
  }
  .table th, .table td {
    padding: 10px 12px;
    font-size: 12px;
  }
  .score-input {
    width: 80px !important;
    font-size: 14px !important;
  }

  /* Filter bar on mobile */
  .filter-bar, form[style*="flex-wrap:wrap"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .filter-bar form {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .filter-bar .form-control,
  .filter-bar .form-select,
  form[style*="flex-wrap:wrap"] select,
  form[style*="flex-wrap:wrap"] input,
  form[style*="flex-wrap:wrap"] button,
  form[style*="flex-wrap:wrap"] > div {
    width: 100% !important;
    min-width: 100% !important;
  }

  /* Modal on Mobile */
  .modal-overlay, .modal-backdrop {
    padding: 10px;
  }
  .modal {
    max-height: 94vh;
    border-radius: 14px;
    margin: 0;
  }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-footer {
    padding: 12px 16px;
    flex-direction: column;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Attendance & Penilaian Mobile Table Transformation */
  .penilaian-table table,
  .penilaian-table thead,
  .penilaian-table tbody,
  .penilaian-table th,
  .penilaian-table tr,
  .attendance-table table,
  .attendance-table thead,
  .attendance-table tbody,
  .attendance-table th,
  .attendance-table tr {
    display: block !important;
  }

  .penilaian-table thead,
  .attendance-table thead {
    display: none !important;
  }

  .penilaian-table tbody,
  .attendance-table tbody {
    padding: 12px;
    display: block !important;
  }

  .penilaian-table tbody tr.penilaian-row,
  .attendance-table tbody tr.attendance-row {
    background: var(--white);
    border: 1.5px solid var(--gray-200) !important;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
  }

  .penilaian-table td,
  .attendance-table td {
    padding: 0 !important;
    border: none !important;
    display: flex !important;
    align-items: center;
    width: 100% !important;
    justify-content: flex-start;
  }

  .penilaian-table td.col-num,
  .attendance-table td.col-num {
    display: none !important;
  }

  .penilaian-table td.col-nis,
  .attendance-table td.col-nis {
    font-size: 11px;
    color: var(--gray-500);
  }

  .penilaian-table td.col-name,
  .attendance-table td.col-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
  }

  .penilaian-table td.col-gender,
  .attendance-table td.col-gender {
    align-self: flex-start;
  }

  .penilaian-table .score-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start !important;
  }

  .penilaian-table .score-input {
    width: 110px !important;
    height: 44px;
    font-size: 16px !important;
    text-align: center;
    font-weight: 700;
    border-radius: 8px;
  }

  .penilaian-table .badge-grade {
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 8px;
    min-width: 40px;
    text-align: center;
  }

  .penilaian-table td.col-note input,
  .attendance-table td.col-note input {
    width: 100% !important;
    height: 42px;
    font-size: 13px !important;
    padding: 8px 12px;
    border-radius: 8px;
  }

  .attendance-table .status-group {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
  }

  .attendance-table .status-btn {
    width: 100% !important;
    height: 44px !important;
    font-size: 15px !important;
    font-weight: 700;
    border-radius: 8px;
  }

  /* Login page on Mobile */
  .login-page { padding: 14px; }
  .login-header { padding: 24px 20px 20px; }
  .login-body { padding: 24px 20px 20px; }
}

@media (max-width: 480px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .content-title, .page-title {
    font-size: 17px;
  }
  .table-actions {
    flex-direction: column;
    gap: 4px;
  }
  .table-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ------ Print Optimization ------ */
@media print {
  .sidebar, .top-header, .sidebar-overlay,
  .content-actions, .page-actions, .btn,
  .filter-bar, form[style*="flex-wrap:wrap"] {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .page-content {
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ------ Animations ------ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }

.page-content { animation: fadeIn 0.3s ease; }
.card { animation: fadeIn 0.3s ease; }

/* ------ Scrollbar ------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ------ Utilities ------ */
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: #f29900; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ------ Nav Dropdown (Master Data) ------ */
.nav-dropdown { }
.nav-dropdown-toggle {
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  margin: 2px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--gray-600);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  width: calc(100% - 24px);
}
.nav-dropdown-toggle:hover { background: var(--gray-100); color: var(--gray-800); }
.nav-dropdown-arrow {
  margin-left: auto;
  font-size: 16px !important;
  width: auto !important;
  transition: transform 0.2s ease;
}
.nav-dropdown.open .nav-dropdown-arrow { transform: rotate(180deg); }
.nav-dropdown-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.nav-dropdown.open .nav-dropdown-menu { max-height: 400px; }
.nav-item.nav-sub {
  padding-left: 48px;
  font-size: 13px;
  margin: 1px 12px;
}
.nav-item.nav-sub i { font-size: 15px; }

