/* ==========================================================================
   SIPAS — Sistem Informasi Penilaian & Ujian Sekolah
   ========================================================================== */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e4e9f2;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-700: #3730a3;
  --primary-soft: #eef2ff;

  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;

  --sidebar: #0e1526;
  --sidebar-2: #141d33;
  --sidebar-text: #93a1bb;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 28px -18px rgba(15, 23, 42, .22);
  --shadow-lg: 0 20px 50px -20px rgba(15, 23, 42, .35);
  --ring: 0 0 0 3px rgba(79, 70, 229, .16);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.nowrap { white-space: nowrap; }
.t-center { text-align: center; }
.t-right { text-align: right; }
.fw-600 { font-weight: 600; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-2 { gap: 16px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: 264px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0b1120 100%);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  z-index: 60;
  border-right: 1px solid rgba(255, 255, 255, .04);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
}

.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #4338ca 55%, #312e81);
  color: #fff; flex: 0 0 auto;
  box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark .icon { width: 23px; height: 23px; }

.brand-text { min-width: 0; }
.brand-name {
  font-size: 17px; font-weight: 750; color: #fff; letter-spacing: .04em; line-height: 1.2;
}
.brand-sub {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #24304a; border-radius: 6px; }

.school-strip {
  margin: 0 4px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .05);
  font-size: 11.5px; line-height: 1.4;
  display: flex; gap: 8px; align-items: flex-start;
}
.school-strip .icon { color: #818cf8; margin-top: 1px; }
.school-strip b { color: #cbd5e1; font-weight: 600; display: block; }
.school-strip span { color: #64748b; }

.nav-label {
  padding: 14px 12px 6px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: #4b5a75;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 12px; margin-bottom: 2px;
  border-radius: 10px;
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  position: relative;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.nav-item .icon { color: #6b7c99; transition: color .15s; }
.nav-item:hover .icon { color: #a5b4fc; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, .22), rgba(99, 102, 241, .06));
  color: #fff;
}
.nav-item.active .icon { color: #a5b4fc; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 4px 4px 0; background: #818cf8;
}
.nav-badge {
  margin-left: auto;
  font-size: 10.5px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
  background: #ef4444; color: #fff;
}
.nav-badge.soft { background: rgba(129, 140, 248, .18); color: #c7d2fe; }

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.userbox {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .035);
}
.userbox .avatar { background: linear-gradient(135deg, #6366f1, #4338ca); }
.userbox-name { color: #e2e8f0; font-size: 13px; font-weight: 600; line-height: 1.3; }
.userbox-role { color: #64748b; font-size: 11px; text-transform: capitalize; }
.userbox form { margin-left: auto; }
.logout-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: transparent; color: #64748b; cursor: pointer;
}
.logout-btn:hover { background: rgba(239, 68, 68, .15); color: #fca5a5; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #64748b, #334155);
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  flex: 0 0 auto;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar.lg { width: 46px; height: 46px; font-size: 15px; }

.main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 11.5px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.mobile-btn {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  place-items: center; cursor: pointer;
}

.date-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted);
  padding: 7px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff;
}

.dropdown { position: relative; }
.dropdown > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 5px; border-radius: 10px;
  border: 1px solid transparent;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { background: var(--surface-2); border-color: var(--border); }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 220px; padding: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  z-index: 50;
}
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border-radius: 8px; border: 0; background: none;
  font-size: 13px; color: var(--text-2); text-align: left; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-head { padding: 10px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.dropdown-head b { display: block; font-size: 13px; }
.dropdown-head span { font-size: 11.5px; color: var(--muted); }

.content {
  flex: 1;
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 26px 28px 56px;
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5); z-index: 55;
  backdrop-filter: blur(2px);
}

/* --------------------------------------------------------------------------
   Page header
   -------------------------------------------------------------------------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { font-size: 23px; letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .icon { width: 12px; height: 12px; opacity: .6; }

/* --------------------------------------------------------------------------
   Cards & grids
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 650; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }
.card-body.flush { padding: 0; }
.card-foot {
  padding: 13px 18px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12.5px; color: var(--muted);
}

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.span-2 { grid-column: span 2; }
.grid .card + .card { margin-top: 0; }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 13px;
  box-shadow: var(--shadow-xs);
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--primary-soft); color: var(--primary);
}
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.blue { background: var(--info-soft); color: var(--info); }
.stat-icon.slate { background: var(--surface-3); color: var(--text-2); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 1px; }
.stat-foot { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  background: #fff; color: var(--text-2);
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: #fff; box-shadow: 0 6px 16px -8px rgba(79, 70, 229, .8);
}
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-outline { border-color: var(--border-strong); background: #fff; color: var(--text-2); }
.btn-outline:hover { background: var(--surface-2); border-color: #b6c2d6; color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; color: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.label .req { color: var(--danger); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }

.input, .select, textarea.input {
  width: 100%;
  padding: 9.5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted-2); }
.input:hover, .select:hover { border-color: #b6c2d6; }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
.input:disabled { background: var(--surface-3); color: var(--muted); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.55; }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.input-sm { padding: 6px 9px; font-size: 12.5px; border-radius: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 150px; margin-bottom: 0; }

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; }
.check input {
  width: 17px; height: 17px; margin: 1px 0 0;
  accent-color: var(--primary); cursor: pointer; flex: 0 0 auto;
}
.check span { line-height: 1.4; }
.check small { display: block; color: var(--muted); font-size: 11.5px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 9px; }
.check-card {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: 9px; cursor: pointer; font-size: 13px; background: #fff;
}
.check-card:hover { border-color: #a5b4fc; background: #fafaff; }
.check-card input { accent-color: var(--primary); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; border-radius: 20px; background: #cbd5e1;
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .18s; box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* Opsi jawaban di form soal */
.opsi-list { display: flex; flex-direction: column; gap: 8px; }
.opsi-row { display: flex; align-items: center; gap: 9px; }
.opsi-key {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 700;
}
.opsi-row input[type="radio"], .opsi-row input[type="checkbox"] {
  width: 17px; height: 17px; accent-color: var(--primary); flex: 0 0 auto;
}
.opsi-row .input { flex: 1; }
.opsi-row .btn-icon { color: var(--muted); }
.opsi-row .btn-icon:hover { color: var(--danger); background: var(--danger-soft); }

/* --------------------------------------------------------------------------
   Alerts, badges, chips
   -------------------------------------------------------------------------- */

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: 11px;
  font-size: 13px; margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert .icon { margin-top: 1px; }
.alert-ok { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-err { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--info-soft); border-color: #bae6fd; color: #075985; }
.alert-warn { background: var(--warning-soft); border-color: #fde68a; color: #92400e; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 650; letter-spacing: .01em;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge-ok { background: var(--success-soft); color: #047857; }
.badge-warn { background: var(--warning-soft); color: #92400e; }
.badge-danger { background: var(--danger-soft); color: #b91c1c; }
.badge-info { background: var(--info-soft); color: #0369a1; }
.badge-purple { background: var(--primary-soft); color: var(--primary-600); }
.badge-neutral { background: var(--surface-3); color: var(--muted); }
.badge-dot::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-2);
}
.chip .icon { width: 13px; height: 13px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding: 11px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-center { text-align: center; }
.table .row-title { font-weight: 600; color: var(--text); }
.table .row-sub { font-size: 11.5px; color: var(--muted); }
.table-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

.cell-2 { display: flex; align-items: center; gap: 10px; min-width: 160px; }

.nilai-pill {
  display: inline-flex; min-width: 48px; justify-content: center;
  padding: 3px 9px; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-2); font-size: 12.5px;
}
.nilai-pill.good { background: var(--success-soft); color: #047857; }
.nilai-pill.mid { background: var(--warning-soft); color: #92400e; }
.nilai-pill.bad { background: var(--danger-soft); color: #b91c1c; }

/* --------------------------------------------------------------------------
   Misc components
   -------------------------------------------------------------------------- */

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 13px;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted-2);
}
.empty-icon .icon { width: 26px; height: 26px; }
.empty h3 { font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 15px; }

.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; padding: 7px 11px; font-size: 12.5px; }
.toolbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 11px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab {
  padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-xs); }

.progress { height: 7px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; background: linear-gradient(90deg, #6366f1, #4338ca); transition: width .3s; }
.progress-bar.green { background: linear-gradient(90deg, #10b981, #059669); }
.progress-bar.amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-bar.red { background: linear-gradient(90deg, #ef4444, #dc2626); }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary);
}
.list-icon .icon { width: 16px; height: 16px; }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 13px; font-weight: 600; }
.list-sub { font-size: 11.5px; color: var(--muted); }

.bar-chart { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 42px; align-items: center; gap: 10px; font-size: 12px; }
.bar-label { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 9px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; background: var(--primary); }
.bar-fill.a { background: #10b981; }
.bar-fill.b { background: #6366f1; }
.bar-fill.c { background: #f59e0b; }
.bar-fill.d { background: #fb923c; }
.bar-fill.e { background: #ef4444; }
.bar-value { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

.sep { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

.score-hero {
  display: flex; align-items: center; gap: 22px;
  padding: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, #1e1b4b, #312e81 55%, #4338ca);
  color: #fff; position: relative; overflow: hidden;
}
.score-hero::after {
  content: ""; position: absolute; right: -60px; top: -80px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, .35), transparent 65%);
}
.score-hero .score-big { font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.score-hero .score-label { font-size: 12px; color: #c7d2fe; text-transform: uppercase; letter-spacing: .08em; }
.score-ring {
  width: 106px; height: 106px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  background: conic-gradient(#818cf8 var(--p, 0%), rgba(255, 255, 255, .12) 0);
  position: relative;
}
.score-ring::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  background: #1e1b4b;
}
.score-ring span { position: relative; font-size: 26px; font-weight: 800; }

.timer-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 10px;
  background: var(--surface-3); color: var(--text);
  font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 15px; letter-spacing: .03em;
}
.timer-pill .icon { color: var(--muted); }
.timer-pill.warning { background: var(--danger-soft); color: var(--danger); }
.timer-pill.warning .icon { color: var(--danger); animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.kbd {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }

.login-art {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #0e1526 0%, #1e1b4b 45%, #312e81 100%);
  color: #fff; padding: 54px 58px;
  display: flex; flex-direction: column;
}
.login-art::before {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  right: -180px; top: -160px;
  background: radial-gradient(circle, rgba(99, 102, 241, .45), transparent 62%);
}
.login-art::after {
  content: ""; position: absolute; width: 380px; height: 380px; border-radius: 50%;
  left: -160px; bottom: -170px;
  background: radial-gradient(circle, rgba(56, 189, 248, .22), transparent 65%);
}
.login-art > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 46px; height: 46px; }
.login-art h1 {
  color: #fff; font-size: 38px; line-height: 1.12; letter-spacing: -.03em;
  margin-top: auto; max-width: 460px;
}
.login-art h1 em { font-style: normal; color: #a5b4fc; }
.login-art p.lead { color: #a9b6d0; margin-top: 14px; max-width: 430px; font-size: 14px; }
.login-features { margin-top: 32px; display: grid; gap: 12px; max-width: 430px; }
.login-feature { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: #cbd5e1; }
.login-feature .fi {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); color: #a5b4fc;
  border: 1px solid rgba(255, 255, 255, .08);
}
.login-feature b { display: block; color: #e2e8f0; font-weight: 600; }
.login-feature span { color: #8494b5; font-size: 12px; }
.login-foot { margin-top: auto; padding-top: 30px; font-size: 11.5px; color: #64748b; }

.login-side {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 28px; background: var(--bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 34px 32px;
  box-shadow: var(--shadow);
}
.login-card .brand-mark { margin-bottom: 18px; }
.login-card h2 { font-size: 22px; letter-spacing: -.02em; }
.login-card .login-sub { color: var(--muted); font-size: 13px; margin-top: 5px; margin-bottom: 24px; }
.login-card .input { padding: 11px 13px; }
.login-meta { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 18px; font-size: 12px; }
.login-school { text-align: center; margin-top: 26px; font-size: 11.5px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Halaman ujian siswa
   -------------------------------------------------------------------------- */

body.exam-mode { background: #eef2f9; overscroll-behavior-y: contain; }

.exam-top {
  position: sticky; top: 0; z-index: 40;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  flex-wrap: wrap;
}
.exam-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.exam-top-title { min-width: 0; }
.exam-top-title b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 44vw; }
.exam-top-title span { font-size: 11.5px; color: var(--muted); }
.exam-top-right { display: flex; align-items: center; gap: 10px; }

.exam-wrap { max-width: 1180px; margin: 0 auto; padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) 274px; gap: 20px; align-items: start; }

.exam-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
  scroll-margin-top: 90px;
}
.exam-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.exam-no {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-600);
  font-weight: 700; font-size: 13px;
}
.exam-q { font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; }
.exam-q .skor { float: right; margin-left: 10px; font-size: 11px; color: var(--muted); }
.exam-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.opt:hover { border-color: #c7d2fe; background: #fbfbff; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .opt-key {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 700;
  transition: background .12s, color .12s;
}
.opt .opt-text { padding-top: 1px; line-height: 1.5; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt:has(input:checked) .opt-key { background: var(--primary); color: #fff; }
.opt:has(input:focus-visible) { box-shadow: var(--ring); }

.exam-answer textarea {
  width: 100%; min-height: 120px; resize: vertical;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; line-height: 1.6;
}
.exam-answer textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.exam-answer input[type="text"] {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px;
}
.exam-answer input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }

.save-state { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.save-state.saved { color: var(--success); }
.save-state.saving { color: var(--warning); }

.exam-nav {
  position: sticky; top: 86px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.exam-nav h3 { font-size: 13px; margin-bottom: 3px; }
.exam-nav .nav-sub { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.nav-num {
  aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
  font-size: 11.5px; font-weight: 650; cursor: pointer;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums;
}
.nav-num:hover { border-color: #a5b4fc; color: var(--primary); }
.nav-num.dijawab { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary-600); }
.nav-num.ragu { background: var(--warning-soft); border-color: #fcd34d; color: #92400e; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 10.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--surface-3); display: inline-block; }
.legend i.dijawab { background: #c7d2fe; }
.legend i.ragu { background: #fcd34d; }
.exam-nav .btn { margin-top: 14px; }

.exam-progress { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }

.exam-mobile-bar { display: none; }

.flag-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0; color: var(--muted);
  font-size: 11.5px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.flag-btn:hover { background: var(--warning-soft); color: var(--warning); }
.flag-btn.active { color: var(--warning); font-weight: 600; }

/* Kunci layar (fullscreen lock) ------------------------------------------- */

body.terkunci { overflow: hidden; }

.lock-screen {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 120% at 50% 0%, #1e293b 0%, #0b1220 70%);
}
.lock-card {
  width: 100%; max-width: 430px;
  background: #fff; border-radius: var(--radius-lg);
  padding: 28px 26px 22px; text-align: center;
  box-shadow: 0 32px 80px -28px rgba(2, 6, 23, .8);
}
.lock-icon {
  width: 58px; height: 58px; margin: 0 auto 16px;
  border-radius: 17px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-600);
}
.lock-icon svg { width: 27px; height: 27px; }
.lock-icon.danger { background: var(--danger-soft); color: var(--danger); }
.lock-card h2 { font-size: 17.5px; line-height: 1.35; margin-bottom: 8px; }
.lock-card p { font-size: 13px; line-height: 1.65; color: var(--muted); margin-bottom: 20px; }
.lock-card .btn { min-height: 44px; }
.lock-input {
  text-align: center; letter-spacing: .28em; font-size: 16px;
  margin-top: 8px; font-family: ui-monospace, Consolas, monospace;
}
.lock-error {
  margin-top: 10px; font-size: 12.5px; color: var(--danger);
  background: var(--danger-soft); border: 1px solid #fecaca;
  border-radius: 8px; padding: 8px 10px;
}
.lock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.lock-foot { margin-top: 16px; font-size: 11px; line-height: 1.6; color: var(--muted-2); }

@media (max-width: 480px) {
  .lock-card { padding: 22px 18px 18px; }
  .lock-card h2 { font-size: 16px; }
}

/* Mode fokus: pengganti layar penuh untuk browser tanpa Fullscreen API
   (mis. Safari iPhone). Halaman memenuhi viewport dan tetap dikunci. */
body.layar-penuh-semu {
  position: fixed; inset: 0;
  height: 100vh; height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}
body.layar-penuh-semu .exam-card { scroll-margin-top: 76px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-wrap { grid-template-columns: minmax(0, 1fr); }
  .exam-nav { position: static; order: -1; }
  .nav-grid { grid-template-columns: repeat(10, 1fr); }
}

@media (max-width: 1000px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .mobile-btn { display: grid; }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  /* Grid dua kolom dengan template inline ditumpuk agar tabel tidak terjepit. */
  .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 760px) {
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 0 16px; height: 60px; }
  .date-chip { display: none; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 20px; }
  .stat-value { font-size: 21px; }
  .card-head, .card-body { padding: 14px; }
  .toolbar { padding: 12px 14px; }
  .exam-top { padding: 10px 14px; }
  .exam-top-title b { max-width: 100%; font-size: 13px; }
  .exam-top-title span { display: none; }
  .exam-wrap { padding: 14px; }
  .exam-card { padding: 16px; }
  .nav-grid { grid-template-columns: repeat(8, 1fr); }
  .exam-nav { padding: 14px; }
  .login-card { padding: 26px 22px; }
  .score-hero { flex-direction: column; align-items: flex-start; gap: 14px; }
  .modal-card { max-width: 100%; }
}

@media (max-width: 520px) {
  .table th, .table td { padding: 9px 10px; }
  .stat { padding: 13px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .btn { padding: 9px 12px; }
  .topbar-title { font-size: 14px; }
}

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .btn, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* --------------------------------------------------------------------------
   Tambahan
   -------------------------------------------------------------------------- */

summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
details.card > summary { border-bottom: 1px solid transparent; }
details.card[open] > summary { border-bottom-color: var(--border); }
details.card > summary:hover { background: var(--surface-2); }

.hidden-sm { display: none; }
@media (min-width: 640px) { .hidden-sm { display: block; } }

.btn.copied { color: var(--success); }

.live-countdown { font-variant-numeric: tabular-nums; font-weight: 650; }
.live-countdown.warning { color: var(--danger); }

.table td .input-sm { max-width: 100%; }

.scroll-y { max-height: 420px; overflow-y: auto; }
.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}


