:root {
  --navy: #263471;
  --navy-deep: #1c2859;
  --navy-dark: #141c3e;
  --navy-mid: #3a4cad;
  --navy-light: #e9ecf8;
  --orange: #f68a1e;
  --orange-light: #fff1e0;
  --orange-dark: #b85f05;
  --ok: #166534;
  --ok-light: #e8f5ec;
  --cream: #fdf8ef;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red: #dc2626;
  --red-light: #fef2f2;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-mid); }

/* ─── LOGIN PAGE ─── */

.login-page {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo { display: block; width: 190px; height: auto; margin: 0 auto 14px; }

.sidebar-logo { width: 42px; height: 42px; flex-shrink: 0; display: block; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.login-header svg {
  display: block;
  margin: 0 auto 16px;
}

.login-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.login-footer a {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.login-footer a:hover { color: var(--navy); }

/* ─── SIDEBAR ─── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy-deep);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand svg { display: block; flex-shrink: 0; }

.sidebar-brand-name {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.sidebar-brand-role {
  font-size: 0.75rem;
  opacity: 0.6;
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.sidebar-link.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  box-shadow: inset 3px 0 0 var(--orange);
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-icon svg { display: block; width: 18px; height: 18px; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 4px;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
}

.sidebar-user-role {
  font-size: 0.6875rem;
  opacity: 0.6;
}

.sidebar-link-logout { color: rgba(255,255,255,0.5); }
.sidebar-link-logout:hover { background: rgba(220,38,38,0.15); color: #fca5a5; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ─── MAIN ─── */

.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 50;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  background: var(--gray-600);
  border-radius: 1px;
  transition: transform 0.2s;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user-name {
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-weight: 500;
}

.topbar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy-light);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8125rem;
}

.content {
  padding: 24px;
  max-width: 1200px;
}

/* ─── STATS GRID ─── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.stat-card-icon.bg-navy { background: var(--navy-light); color: var(--navy); }
.stat-card-icon.bg-teal { background: #e3f4f1; color: #0f766e; }
.stat-card-icon.bg-plum { background: #f1ecfb; color: #6d3fc0; }
.stat-card-icon.bg-orange { background: var(--orange-light); color: var(--orange); }

.stat-card-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-card-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* ─── CARDS ─── */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-900);
}

.card-body { padding: 20px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-2 .card { margin-bottom: 0; }

/* ─── TABLES ─── */

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

.table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gray-200);
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

.table-actions {
  display: flex;
  gap: 6px;
}

/* ─── BADGES ─── */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-aktif, .badge-diterima { background: var(--ok-light); color: var(--ok); }
.badge-nonaktif, .badge-ditolak { background: var(--red-light); color: var(--red); }
.badge-lulus { background: var(--blue-light); color: var(--blue); }
.badge-baru { background: var(--orange-light); color: var(--orange-dark); }
.badge-lunas { background: var(--ok-light); color: var(--ok); }
.badge-belum { background: var(--orange-light); color: var(--orange-dark); }

/* ─── BUTTONS ─── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover { background: var(--gray-50); border-color: var(--gray-400); color: var(--gray-700); }

.btn svg { display: block; width: 16px; height: 16px; }

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

.btn-primary:hover { background: var(--navy-mid); border-color: var(--navy-mid); color: var(--white); }

.btn-danger {
  background: var(--white);
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover { background: var(--red-light); }

.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-block { width: 100%; justify-content: center; padding: 10px 16px; }

/* ─── FORMS ─── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(38,52,113,0.12);
}

.form-group input:disabled,
.form-group select:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ─── ALERTS ─── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success { background: var(--ok-light); color: var(--ok); }
.alert-error { background: var(--red-light); color: var(--red); }

.alert-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  line-height: 1;
}

.alert-close:hover { opacity: 1; }

/* ─── TOOLBAR ─── */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.toolbar-search input,
.toolbar-search select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--white);
}

.toolbar-search input { flex: 1; min-width: 0; }

.toolbar-search input:focus,
.toolbar-search select:focus {
  outline: none;
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(38,52,113,0.12);
}

/* ─── DETAIL GRID ─── */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item { display: flex; flex-direction: column; gap: 2px; }

.detail-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 0.875rem;
  color: var(--gray-800);
}

/* ─── PAGINATION ─── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  background: var(--white);
}

.pagination a:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-700); }

.pagination .active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ─── UTILITY ─── */

.text-muted { color: var(--gray-400); }

/* ─── COMMON (missing helpers) ─── */

.small { font-size: 0.75rem; }
.inline-form { display: inline; }
.btn-secondary { background: var(--gray-100); }
.btn-icon { display: inline-flex; }
.btn-icon svg { width: 16px; height: 16px; }

.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--gray-500);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-icon-only svg { width: 16px; height: 16px; display: block; }
.btn-icon-only:hover { background: var(--gray-100); color: var(--navy); }
.btn-icon-only.btn-danger { border-color: transparent; color: var(--gray-400); }
.btn-icon-only.btn-danger:hover { background: var(--red-light); color: var(--red); }

.table .actions { white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card-actions { display: flex; gap: 8px; }
.card-header .small { margin-top: 2px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 16px;
}
.form-group-full { grid-column: 1 / -1; }
.checkbox-label { display: flex !important; align-items: center; gap: 8px; cursor: pointer; font-weight: 500 !important; }
.checkbox-label input { width: auto !important; }

.search-input { position: relative; flex: 1; min-width: 0; display: flex; }
.search-input input { width: 100%; padding-left: 34px !important; }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--gray-400);
  pointer-events: none;
}
.search-icon svg { width: 16px; height: 16px; display: block; }
.toolbar-label { font-size: 0.75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; }
.toolbar > .text-muted { font-size: 0.8125rem; flex: 1; }

.empty-state { text-align: center; padding: 32px 16px; color: var(--gray-600); }
.empty-state p + p, .empty-state p + .btn { margin-top: 8px; }

/* ─── PRINT ─── */

.print-header { display: none; }

@media print {
  .print-header { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid var(--orange); }
  .print-header img { height: 64px; width: auto; }
  .print-header-name { font-size: 16pt; font-weight: 800; color: var(--navy); letter-spacing: 0.04em; }
  .print-header-title { font-size: 11pt; font-weight: 600; color: var(--gray-700); }
  .print-header-date { font-size: 8pt; color: var(--gray-500); }
  .sidebar, .topbar, .no-print, .sticky-actions, .alert, .sidebar-overlay { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; }
  .table-responsive { overflow: visible; }
  .skor-input, .mini-input { border: none; background: none; padding: 0; width: auto; }
  .nilai-table .col-nama { position: static; }
}

/* ─── RESPONSIVE ─── */

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-user-name { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-card-number { font-size: 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar-search { flex-wrap: wrap; }
  .detail-grid { grid-template-columns: 1fr; }
  .table { font-size: 0.8125rem; }
  .table th, .table td { padding: 8px 10px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-search { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 20px; }
}
