*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --indigo: #4f46e5;
  --rose: #e11d48;
  --teal: #0d9488;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.04);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.65rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.5rem;
}

.brand-icon,
.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo.has-logo {
  background: #fff;
  padding: 2px;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.brand-logo.has-logo .brand-logo-img {
  display: block;
}

.brand-logo.has-logo .brand-logo-fallback {
  display: none;
}

.brand strong {
  display: block;
  font-size: 0.95rem;
  color: white;
}

.brand span {
  font-size: 0.75rem;
  color: #94a3b8;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding-left: 0.85rem;
}

.nav-menu-label {
  padding: 0.3rem 0.4rem 0.05rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.2;
}

.nav-menu-link {
  width: 100%;
  padding: 0.3rem 0.4rem;
  border: none;
  background: transparent;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.nav-menu-link:hover {
  background: var(--sidebar-hover);
  color: #f8fafc;
}

.nav-menu-link.active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.nav-menu-link:active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.brand-link {
  cursor: pointer;
}

.brand-link:hover {
  opacity: 0.92;
}

.nav-menu-link:focus {
  outline: none;
}

.nav-menu-link:focus-visible {
  outline: 2px solid rgba(147, 197, 253, 0.85);
  outline-offset: 2px;
}

a.nav-menu-link {
  text-decoration: none;
  display: block;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.4rem;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  line-height: 1.15;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.nav-btn:focus {
  outline: none;
}

.nav-btn:focus-visible {
  outline: 2px solid rgba(147, 197, 253, 0.85);
  outline-offset: 2px;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-btn.active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.nav-btn:active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

.nav-btn.nav-sub {
  padding: 0.22rem 0.4rem;
  font-size: 0.76rem;
  width: 100%;
}

.nav-btn.nav-sub svg {
  display: none;
}

a.nav-btn.nav-sub {
  text-decoration: none;
}

.panel.panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.alumni-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.alumni-list-head h2 {
  margin: 0;
}

.alumni-list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.alumni-filter-tahun,
.alumni-filter-sort {
  min-width: 9.5rem;
}

.sidebar-footer {
  padding: 1rem 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #64748b;
  font-size: 0.75rem;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.user-meta strong {
  display: block;
  color: #e2e8f0;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta span {
  display: block;
  color: #94a3b8;
  font-size: 0.7rem;
}

.logout-btn {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
}

.logout-btn svg {
  width: 17px;
  height: 17px;
}

.logout-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.main {
  flex: 1;
  margin-left: 220px;
  padding: 2rem 2.5rem;
  max-width: 1400px;
}

.topbar {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-switch {
  display: inline-flex;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.mode-switch a {
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4f46e5;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mode-switch a:hover { background: #e0e7ff; }

.mode-switch a.active { background: #4f46e5; color: #fff; }

.db-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

.db-status.mysql {
  background: #dcfce7;
  color: #166534;
}

.db-status.static {
  background: #fef3c7;
  color: #92400e;
}

.db-status.hidden {
  display: none;
}

.loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.loading.active {
  display: flex;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.app.loading-active .page {
  display: none !important;
}

.app.loading-active .page.active {
  display: block !important;
}

.topbar h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.indigo { background: #e0e7ff; color: #4f46e5; }
.stat-icon.rose { background: #ffe4e6; color: #e11d48; }
.stat-icon.teal { background: #ccfbf1; color: #0d9488; }

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.panel h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: -0.5rem 0 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 48px;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bar-track {
  height: 28px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #2563eb, #4f46e5);
  transition: width 0.6s ease;
  min-width: 4px;
}

.bar-value {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
}

.gender-chart {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.gender-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gender-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 500;
}

.gender-bar {
  height: 12px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.gender-fill.laki { background: #4f46e5; height: 100%; border-radius: 99px; }
.gender-fill.perempuan { background: #e11d48; height: 100%; border-radius: 99px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

select {
  padding: 0.65rem 2rem 0.65rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--surface);
  cursor: pointer;
}

.btn-outline {
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-outline:hover:not(:disabled) {
  background: #f8fafc;
}

.btn-outline:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-danger {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.update-app-panel {
  border: 1px solid #bfdbfe;
  background: #f8fbff;
}

.update-app-info {
  display: grid;
  gap: 0.35rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.92rem;
}

.update-app-info p {
  margin: 0;
}

.update-app-label {
  display: inline-block;
  min-width: 4.5rem;
  color: #64748b;
}

.update-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.update-app-output {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 12rem;
  overflow: auto;
}

.danger-panel {
  border: 1px solid #fecaca;
  background: #fffbfb;
}

.danger-panel h2 {
  color: #b91c1c;
}

.danger-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.danger-action-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #fee2e2;
  border-radius: 10px;
  background: #fff;
}

.danger-action-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

@media (max-width: 640px) {
  .danger-action-item {
    flex-direction: column;
    align-items: stretch;
  }

  .danger-action-item .btn-danger {
    width: 100%;
  }
}

.btn-primary {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.kelas-form-panel,
.kelas-page-panel {
  margin-bottom: 1.25rem;
}

.kelas-page-panel .kelas-form {
  margin-bottom: 0.5rem;
}

.kelas-tables-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.kelas-tingkat-block {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.kelas-tingkat-title {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.kelas-tingkat-10 {
  border-color: #93c5fd;
}

.kelas-tingkat-10 .kelas-tingkat-title {
  background: #dbeafe;
  color: #1e40af;
}

.kelas-tingkat-10 .kelas-table thead th {
  background: #eff6ff;
  color: #1e3a8a;
}

.kelas-tingkat-10 .kelas-table-wrap {
  border: none;
  border-radius: 0;
}

.kelas-tingkat-11 {
  border-color: #6ee7b7;
}

.kelas-tingkat-11 .kelas-tingkat-title {
  background: #d1fae5;
  color: #047857;
}

.kelas-tingkat-11 .kelas-table thead th {
  background: #ecfdf5;
  color: #065f46;
}

.kelas-tingkat-11 .kelas-table-wrap {
  border: none;
  border-radius: 0;
}

.kelas-tingkat-12 {
  border-color: #c4b5fd;
}

.kelas-tingkat-12 .kelas-tingkat-title {
  background: #ede9fe;
  color: #5b21b6;
}

.kelas-tingkat-12 .kelas-table thead th {
  background: #f5f3ff;
  color: #4c1d95;
}

.kelas-tingkat-12 .kelas-table-wrap {
  border: none;
  border-radius: 0;
}

.kelas-table-wrap {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.kelas-table {
  margin: 0;
}

.kelas-table th,
.kelas-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  text-align: center;
}

.kelas-table th:nth-child(2),
.kelas-table td:nth-child(2),
.kelas-table th:nth-child(6),
.kelas-table td:nth-child(6) {
  text-align: left;
}

.kelas-table thead th {
  background: #f8fafc;
  font-weight: 600;
}

.link-edit {
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.link-edit:hover {
  color: #1d4ed8;
}

.btn-aksi {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-aksi + .btn-aksi {
  margin-left: 0.35rem;
}

.btn-aksi:hover {
  background: #eff6ff;
  border-color: var(--primary);
}

.btn-aksi-catatan {
  color: #b45309;
}

.btn-aksi-catatan:hover {
  background: #fffbeb;
  border-color: #d97706;
}

/* Kolom preview foto di tabel Data Siswa */
.col-foto {
  width: 48px;
  text-align: center;
}

.siswa-foto-thumb {
  width: 38px;
  height: 50px;
  border-radius: 5px;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background: #f1f5f9;
  border: 1px solid var(--border);
}

img.siswa-foto-thumb {
  cursor: zoom-in;
  transition: transform 0.12s;
}

img.siswa-foto-thumb:hover {
  transform: scale(1.04);
}

.siswa-foto-none {
  color: #cbd5e1;
  font-size: 0.9rem;
}

.foto-zoom {
  cursor: zoom-in;
}

.foto-hover-preview {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  padding: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.35);
}

.foto-hover-preview.hidden {
  display: none;
}

.foto-hover-preview img {
  display: block;
  width: 150px;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1f5f9;
}

/* Lightbox pratinjau foto */
.foto-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.foto-lightbox.hidden {
  display: none;
}

.foto-lightbox img {
  max-width: min(90vw, 520px);
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  background: #fff;
}

/* Foto Siswa */
.foto-bulk-panel code {
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.foto-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}

.foto-card:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.foto-card.foto-uploading {
  opacity: 0.5;
  pointer-events: none;
}

.foto-thumb {
  aspect-ratio: 3 / 4;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.foto-placeholder {
  color: #cbd5e1;
}

.foto-placeholder svg {
  width: 46px;
  height: 46px;
}

.foto-meta {
  padding: 0.55rem 0.65rem 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
}

.foto-meta strong {
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.foto-meta span {
  font-size: 0.72rem;
  color: var(--muted, #64748b);
}

.foto-card-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem 0.65rem;
  margin-top: auto;
}

.foto-card-actions .btn-aksi {
  flex: 1;
  text-align: center;
}

.foto-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted, #64748b);
  padding: 1.5rem 0;
}

.foto-bulk-report {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  max-height: 260px;
  overflow-y: auto;
}

.foto-report-group h4 {
  margin: 0.4rem 0 0.3rem;
  font-size: 0.82rem;
}

.foto-report-group ul {
  margin: 0;
  padding-left: 0.5rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.foto-report-group li {
  font-size: 0.78rem;
  color: #475569;
}

.foto-report-group .ok {
  color: #059669;
  font-weight: 700;
}

.foto-report-group .err {
  color: #dc2626;
  font-weight: 700;
}

.kelas-form {
  display: grid;
  grid-template-columns: 140px minmax(280px, 2fr) minmax(220px, 1fr) auto;
  gap: 1rem;
  align-items: end;
}

.kelas-form-guru {
  grid-template-columns: minmax(360px, 2.5fr) minmax(200px, 1fr) auto;
}

.kelas-form-mutasi {
  grid-template-columns: minmax(360px, 2fr) minmax(220px, 1.2fr) auto;
}

.siswa-add-panel {
  margin-bottom: 1rem;
}

.siswa-add-panel.hidden {
  display: none !important;
}

.siswa-import-panel.hidden {
  display: none !important;
}

#siswa-list-view.hidden {
  display: none !important;
}

.siswa-add-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.siswa-add-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

#btn-toggle-tambah-siswa.active,
#btn-toggle-import-siswa.active {
  background: #4338ca;
}

.siswa-add-panel .template-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 1100px;
}

.siswa-add-panel .tpl-row-nama {
  grid-template-columns: 28px 200px minmax(520px, 1fr);
}

.siswa-add-panel .tpl-input-nama {
  min-width: 280px;
  max-width: 100%;
}

.siswa-add-panel .tpl-input-alamat-wali {
  min-width: 280px;
  min-height: 88px;
  max-width: 100%;
  resize: vertical;
}

.siswa-add-panel .tpl-row,
.siswa-add-panel .tpl-sub {
  display: grid;
  grid-template-columns: 28px 200px 1fr;
  gap: 10px;
  align-items: start;
}

.siswa-add-panel .tpl-row-2 {
  grid-template-columns: 28px 200px 1fr 28px 160px 120px;
}

.siswa-add-panel .tpl-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.siswa-add-panel .tpl-sub {
  grid-template-columns: 48px 152px 1fr;
  padding-left: 28px;
}

.siswa-add-panel .tpl-no {
  font-weight: 700;
  color: #334155;
  padding-top: 10px;
}

.siswa-add-panel .tpl-label,
.siswa-add-panel .tpl-sub-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  padding-top: 10px;
}

.siswa-add-panel .tpl-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  box-sizing: border-box;
}

.siswa-add-panel .tpl-inline {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 8px;
}

.siswa-add-panel .tpl-short {
  max-width: 180px;
}

@media (max-width: 768px) {
  .siswa-add-panel .tpl-row,
  .siswa-add-panel .tpl-sub,
  .siswa-add-panel .tpl-row-2,
  .siswa-add-panel .tpl-row-nama {
    grid-template-columns: 1fr;
  }

  .siswa-add-panel .tpl-sub {
    padding-left: 0;
  }

  .siswa-add-panel .tpl-no,
  .siswa-add-panel .tpl-label,
  .siswa-add-panel .tpl-sub-label {
    padding-top: 0;
  }

  .siswa-add-panel .tpl-inline {
    grid-template-columns: 1fr;
  }
}

.kelas-form-mutasi .field-wide {
  grid-column: span 1;
}

.kelas-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.kelas-form .field.field-wide {
  grid-column: span 2;
}

.kelas-form .field span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kelas-form .field input,
.kelas-form .field select {
  width: 100%;
  padding: 0.9rem 1rem;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  box-sizing: border-box;
}

.kelas-form .field input:focus,
.kelas-form .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.kelas-form-actions {
  display: flex;
  align-items: flex-end;
}

.mutasi-massal-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.mutasi-register-panel {
  overflow-x: auto;
}

#page-mutasi h2.mutasi-head-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #2563eb;
  margin-bottom: 0.75rem;
}

#page-mutasi .panel h2:not(.mutasi-head-title) {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.mutasi-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.mutasi-section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.kelas-form-mutasi-reg {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  margin-bottom: 1rem;
}

.kelas-form-mutasi-reg .field-wide {
  grid-column: span 2;
}

.kelas-form-mutasi-reg .kelas-form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.btn-save-red {
  background: #dc2626;
  min-height: 52px;
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
  border-radius: 10px;
  white-space: nowrap;
  color: #fff;
  border: none;
  cursor: pointer;
}

.btn-save-red:hover {
  background: #b91c1c;
}

.btn-save-red:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mutasi-tables {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mutasi-semester-block h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.mutasi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mutasi-table th,
.mutasi-table td {
  border: 1px solid #111;
  padding: 0.45rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.mutasi-table th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.mutasi-table-masuk thead th {
  background: #92d050;
}

.mutasi-table-keluar thead th {
  background: #f4b084;
}

.mutasi-table .col-no {
  width: 40px;
  text-align: center;
}

.mutasi-table .col-jns {
  width: 42px;
  text-align: center;
}

.mutasi-table .col-action {
  width: 56px;
  text-align: center;
}

.btn-mutasi-delete {
  border: none;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.15rem 0.35rem;
}

.btn-mutasi-delete:hover {
  text-decoration: underline;
}

.btn-save-green {
  background: #059669;
  min-height: 52px;
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
  border-radius: 10px;
  white-space: nowrap;
}

.btn-save-green:hover {
  background: #047857;
}

.btn-save-green:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-msg {
  margin-top: 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.form-msg.success {
  color: #059669;
  white-space: pre-line;
}

.form-msg.error {
  color: #e11d48;
  white-space: pre-line;
}

.pekerjaan-jenis-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.82rem;
  font: inherit;
}

.pekerjaan-jenis-panel {
  max-width: 420px;
  padding: 1rem 1.1rem;
}

.pekerjaan-jenis-panel h2 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.pekerjaan-jenis-panel .panel-desc {
  font-size: 0.78rem;
  margin: 0 0 0.65rem;
}

.pekerjaan-jenis-table-wrap {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.pekerjaan-jenis-table th,
.pekerjaan-jenis-table td {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}

.pekerjaan-jenis-table th:first-child,
.pekerjaan-jenis-table td:first-child {
  width: 36px;
  text-align: center;
}

.pekerjaan-jenis-table th:last-child,
.pekerjaan-jenis-table td:last-child {
  width: 64px;
  text-align: center;
}

.pekerjaan-jenis-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pekerjaan-jenis-panel .btn-primary.sm,
.pekerjaan-jenis-panel .btn-outline.sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.pekerjaan-jenis-panel .form-msg {
  font-size: 0.78rem;
  margin-top: 0.35rem;
}

.form-msg.hidden {
  display: none;
}

.sekolah-settings-grid {
  display: grid;
  grid-template-columns: 200px minmax(560px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.sekolah-settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.sekolah-settings-form .field {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: center;
}

.sekolah-settings-form .field span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.sekolah-settings-form .field input,
.sekolah-settings-form .field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  box-sizing: border-box;
}

.sekolah-settings-form .field textarea {
  min-height: 72px;
  resize: vertical;
}

.sekolah-settings-form .field.full {
  grid-column: auto;
}

.sekolah-settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.sekolah-settings-row .field {
  min-width: 0;
}

.sekolah-settings-form .btn-primary {
  margin-top: 0.25rem;
  align-self: flex-start;
}

.sekolah-logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.sekolah-logo-preview {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
}

.sekolah-logo-preview.hidden {
  display: none;
}

.sekolah-logo-empty {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem;
}

.sekolah-logo-empty.hidden {
  display: none;
}

@media (max-width: 768px) {
  .sekolah-settings-grid {
    grid-template-columns: 1fr;
  }

  .sekolah-settings-form .field {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .sekolah-settings-row {
    grid-template-columns: 1fr;
  }
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.import-filename {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.table-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.siswa-selected-info {
  color: var(--primary);
  font-weight: 500;
}

.data-table .col-check {
  width: 2.5rem;
  text-align: center;
  padding-left: 0.75rem;
  padding-right: 0.5rem;
}

.data-table .col-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table.compact td,
.data-table.compact th {
  padding: 0.6rem 0.875rem;
}

.data-table tfoot td {
  font-weight: 700;
  background: #f1f5f9;
  border-top: 2px solid var(--border);
}

.data-table tbody tr.rekap-tingkat-total td {
  font-weight: 700;
  border-top: 2px solid transparent;
  border-bottom: 1px solid transparent;
}

.data-table tbody tr.rekap-tingkat-10 td { background: #f5f7ff; }
.data-table tbody tr.rekap-tingkat-10.rekap-tingkat-total td {
  background: #e0e7ff;
  border-top-color: #a5b4fc;
  border-bottom-color: #c7d2fe;
  color: #312e81;
}

.data-table tbody tr.rekap-tingkat-11 td { background: #f0fdf4; }
.data-table tbody tr.rekap-tingkat-11.rekap-tingkat-total td {
  background: #bbf7d0;
  border-top-color: #4ade80;
  border-bottom-color: #86efac;
  color: #14532d;
}

.data-table tbody tr.rekap-tingkat-12 td { background: #fffbeb; }
.data-table tbody tr.rekap-tingkat-12.rekap-tingkat-total td {
  background: #fde68a;
  border-top-color: #fbbf24;
  border-bottom-color: #fcd34d;
  color: #78350f;
}

.data-table tbody tr.rekap-tingkat-other td { background: #f8fafc; }
.data-table tbody tr.rekap-tingkat-other.rekap-tingkat-total td {
  background: #e2e8f0;
  border-top-color: #94a3b8;
  border-bottom-color: #cbd5e1;
  color: #0f172a;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.l { background: #e0e7ff; color: #4338ca; }
.badge.p { background: #ffe4e6; color: #be123c; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  width: min(100%, 920px);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  padding: 1.25rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.1rem;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-form {
  grid-template-columns: 140px minmax(140px, 1fr) minmax(220px, 2fr) auto;
}

.modal-form .kelas-form-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-form .kelas-form-actions .btn-outline {
  min-height: 52px;
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  border-radius: 10px;
}

.daftar-kelas-modal-card {
  width: min(100%, 960px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.daftar-kelas-form .form-grid.two-col {
  margin-bottom: 0.75rem;
}

.daftar-kelas-ket-wrap {
  max-height: 340px;
  overflow: auto;
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.daftar-kelas-ket-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.daftar-kelas-ket-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

@media (max-width: 900px) {
  .kelas-form,
  .modal-form {
    grid-template-columns: 1fr 1fr;
  }

  .kelas-form-actions,
  .modal-form .kelas-form-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .kelas-form-actions .btn-save-green,
  .modal-form .kelas-form-actions .btn-outline {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .kelas-form,
  .modal-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 1rem;
  }

  .nav {
    width: 100%;
  }

  .main {
    margin-left: 0;
    padding: 1.25rem;
  }

  .sidebar-footer {
    padding: 0;
    border-top: none;
    margin-left: auto;
  }

  .sidebar-footer small { display: none; }

  .user-box { margin-bottom: 0; }
}
