:root {
  --bg: #f3f6f9;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #64748b;
  --line: #dde3ea;
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-soft: #e0f2f1;
  --accent: #1d4ed8;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: Consolas, "Courier New", monospace; }
.pre { white-space: pre-wrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px;
  background: var(--primary); color: var(--primary-ink);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 1.1rem; letter-spacing: .5px; }
.brand small { display: block; opacity: .85; font-size: .78rem; }
.logo {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: #fff; color: var(--primary); font-weight: 800; font-size: 1.2rem;
}
#nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
#nav a, #nav button {
  color: #fff; text-decoration: none; padding: 7px 12px; border-radius: 7px;
  font-size: .92rem; background: transparent; border: 0; cursor: pointer; font-family: inherit;
}
#nav a:hover, #nav button:hover { background: rgba(255, 255, 255, .15); }
#nav a.active { background: rgba(255, 255, 255, .22); font-weight: 600; }
#nav .role-chip {
  background: rgba(0, 0, 0, .18); padding: 4px 10px; border-radius: 99px; font-size: .78rem; margin-left: 6px;
}

/* ---------- Layout ---------- */
#app { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card h3 { margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.sticky { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font: inherit; font-size: .92rem;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #b8c3cf; background: #f8fafc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.lg { padding: 12px 20px; font-size: 1rem; }
.btn.sm { padding: 4px 9px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }

label.field { display: block; }
label.field > span { display: block; font-size: .85rem; font-weight: 600; color: #334155; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99d5cf; border-color: var(--primary); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.gray { background: #eef2f6; color: #475569; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 26px 10px 8px; }
.hero h1 { font-size: 1.9rem; }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.role-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px 22px;
  text-align: left; cursor: pointer; box-shadow: var(--shadow); font: inherit; color: inherit;
  transition: transform .12s, border-color .12s;
}
.role-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.role-card .ic { font-size: 2rem; margin-bottom: 10px; }
.role-card h3 { margin-bottom: 6px; }
.role-card p { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- Station cards ---------- */
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.st-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow);
}
.st-card.off { opacity: .55; }
.st-card .code { font-weight: 800; color: var(--primary); font-size: 1.05rem; }
.st-card h4 { margin: 0; font-size: 1rem; }
.st-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.st-card .actions { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 6px; }
.st-card.clickable { cursor: pointer; }
.st-card.clickable:hover { border-color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 7px 9px; vertical-align: middle; }
.tbl th { background: #f1f5f9; font-weight: 600; text-align: left; }
.tbl tbody tr:hover { background: #fafcfd; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Blueprint */
.bp th, .bp td { text-align: center; }
.bp td:first-child, .bp th:first-child { text-align: left; }
.bp .check { color: var(--primary); font-weight: 800; font-size: 1.15rem; }
.bp .sub { font-weight: 400; font-size: .8rem; color: var(--muted); display: block; }
.bp .cov-ok { color: var(--ok); font-weight: 600; }
.bp .cov-bad { color: var(--danger); font-weight: 600; }
.diag {
  position: relative; min-width: 170px; height: 64px; padding: 0 !important;
  background: linear-gradient(to top right, #f1f5f9 calc(50% - 1px), var(--line) 50%, #f1f5f9 calc(50% + 1px)) !important;
}
.diag .t { position: absolute; top: 6px; right: 8px; font-size: .78rem; font-weight: 700; }
.diag .b { position: absolute; bottom: 6px; left: 8px; font-size: .78rem; font-weight: 700; }

/* ---------- Soal (student) ---------- */
.exam-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.exam-head .code { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.timer {
  font-family: Consolas, monospace; font-weight: 700; font-size: 2.4rem; letter-spacing: 1px;
  padding: 4px 16px; border-radius: 10px; background: var(--primary-soft); color: var(--primary);
  min-width: 150px; text-align: center;
}
.timer.sm { font-size: 1.6rem; min-width: 110px; }
.timer.warn { background: var(--warn-soft); color: var(--warn); }
.timer-xl { font-size: 4rem; padding: 8px 28px; min-width: 260px; }
.pengawas-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.bar { display: inline-block; width: calc(100% - 44px); height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar span { display: block; height: 100%; background: var(--primary); }
/* Toggle geser (slider switch) untuk centang blueprint */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .knob { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: background .15s; cursor: pointer; }
.switch .knob::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .knob { background: var(--primary); }
.switch input:checked + .knob::before { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid #99d5cf; outline-offset: 2px; }
.slider-field { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.slider-field input[type=range] { flex: 1; accent-color: var(--primary); min-width: 80px; }
.slider-field output { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.timer.pindah {background: #dbeafe; color: #1e40af; }
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.timer-wrap [data-timer-label] { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.timer.over {background: var(--danger-soft); color: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.soal { font-size: 1.05rem; }
.soal ol { padding-left: 22px; margin: 0; }
.soal ol li { margin-bottom: 6px; }
.doc {
  background: #fffdf5; border: 1px solid #eadfb8; border-radius: 8px; padding: 14px 16px;
  font-family: Consolas, "Courier New", monospace; font-size: .9rem; white-space: pre-wrap; overflow-x: auto;
}
.answer-box textarea { min-height: 220px; font-size: 1rem; }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.key { background: #eff6ff; border: 1px dashed #93c5fd; border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: .92rem; }

details.sect { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; }
details.sect + details.sect { margin-top: 8px; }
details.sect summary { cursor: pointer; font-weight: 600; }
details.sect[open] summary { margin-bottom: 8px; }

/* ---------- Rubrik (penguji) ---------- */
.rub-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff; }
.rub-item.done { border-color: #99d5cf; }
.rub-item .rub-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rub-item .rub-head .aspek { font-weight: 600; }
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.level {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: pointer; background: #fafbfc;
  font: inherit; font-size: .82rem; text-align: left; color: var(--ink); line-height: 1.35;
}
.level b { display: block; font-size: .95rem; margin-bottom: 3px; }
.level:hover { border-color: var(--primary); }
.level.sel { background: var(--primary); border-color: var(--primary); color: #fff; }
.global { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.scorebar {
  position: sticky; bottom: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .08); flex-wrap: wrap;
}
.scorebar .big { font-size: 1.8rem; font-weight: 800; color: var(--primary); }

/* ---------- Editor ---------- */
.rub-edit { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fbfcfd; }
.rub-edit .desc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.rub-edit .desc-grid textarea { min-height: 70px; font-size: .85rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 9px 14px; cursor: pointer; font: inherit; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* ---------- Modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: #fff; border-radius: 12px; width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px 18px; overflow: auto; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow);
}

/* ---------- Tambahan versi Laravel ---------- */
.level input { position: absolute; opacity: 0; pointer-events: none; }
label.level { display: block; position: relative; }
.level:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }
.rub-item:has(input:checked) { border-color: #99d5cf; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.inline { display: inline; }
.login-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.login-card { width: min(420px, 100%); }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; }
nav[role=navigation] svg { width: 18px; height: 18px; }
#nav form { display: inline; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Sidebar ---------- */
:root { --sb-lebar: 252px; --sb-mini: 72px; }
body.has-sidebar .main { margin-left: var(--sb-lebar); transition: margin-left .2s; min-height: 100vh; }
.sidebar-mini body.has-sidebar .main { margin-left: var(--sb-mini); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-lebar); z-index: 40;
  display: flex; flex-direction: column; gap: 6px; padding: 14px 12px;
  background: linear-gradient(170deg, #0b3b38 0%, #0f5f59 55%, #0f766e 100%);
  color: #e6fffb; box-shadow: 2px 0 18px rgba(2, 44, 41, .25); transition: width .2s, transform .2s;
}
.sidebar-mini .sidebar { width: var(--sb-mini); }
.sidebar-mini .sb-label { display: none; }
.sb-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 6px 10px; }
.sb-brand strong { display: block; font-size: 1.15rem; letter-spacing: .5px; }
.sb-brand small { display: block; font-size: .72rem; opacity: .75; line-height: 1.3; }
.sidebar .logo { flex: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.sb-sesi {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .08); font-size: .8rem; line-height: 1.3;
}
.sb-sesi .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; margin: 0 4px; }
.sb-sesi.on .dot { background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .25); animation: denyut 2s infinite; }
@keyframes denyut { 50% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } }
.sb-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.sb-grup { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; opacity: .55; padding: 12px 10px 4px; }
.sb-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: #d5f5f1; text-decoration: none; font-size: .92rem; transition: background .15s, color .15s;
}
.sb-item:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.sb-item.active { background: #fff; color: #0f5f59; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.sb-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: #5eead4; }
.sb-ikon { width: 26px; text-align: center; font-size: 1.1rem; flex: none; }
.sidebar-mini .sb-item { justify-content: center; }
/* Menu soal peserta */
.sb-soal { padding: 7px 10px; }
.sb-soal-teks { flex: 1; min-width: 0; line-height: 1.2; }
.sb-soal-teks b { display: block; font-size: .88rem; }
.sb-soal-teks small { display: block; font-size: .72rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-status { font-weight: 800; }
.sb-no {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: .82rem; font-weight: 800;
  background: rgba(255, 255, 255, .14); color: #fff; border: 2px solid rgba(255, 255, 255, .35);
}
.sb-no.st-draf { background: #f59e0b; border-color: #fbbf24; color: #fff; }
.sb-no.st-terkirim { background: #22c55e; border-color: #4ade80; color: #fff; }
.sb-item.active .sb-no { border-color: #0f766e; }
.sb-rehat { opacity: .7; cursor: default; }
.sb-rehat:hover { background: transparent; }
.sb-no.st-istirahat { background: rgba(251, 191, 36, .25); border-color: rgba(251, 191, 36, .6); font-size: .78rem; }
.st-card.istirahat { background: #fffbeb; border-style: dashed; border-color: #fcd34d; }
.tahap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tahap-grid .tahap { padding: 8px 10px; }
.tahap-pratinjau { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); line-height: 1.9; }
@media (max-width: 960px) { .tahap-grid { grid-template-columns: minmax(0, 1fr); } }
/* Tahapan timer */
.tahap-baris { display: flex; flex-wrap: wrap; gap: 6px; }
.tahap { padding: 4px 10px; border-radius: 8px; border-left: 4px solid; background: #f8fafc; }
.tahap em { font-style: normal; color: var(--muted); }
.t-masuk_awal { border-color: #64748b; } .t-baca { border-color: #2563eb; } .t-masuk { border-color: #7c3aed; }
.t-ujian { border-color: #0f766e; } .t-pindah { border-color: #d97706; }
.timer[data-fase=baca] { background: #dbeafe; color: #1e40af; }
.timer[data-fase=masuk], .timer[data-fase=masuk_awal] { background: #ede9fe; color: #6d28d9; }
.timer.bel { animation: blink 1s steps(2) infinite; }
.suara-btn { border: 0; background: rgba(15, 118, 110, .12); color: var(--primary); border-radius: 99px; padding: 2px 10px; font: inherit; font-size: .75rem; cursor: pointer; }
.suara-btn.on { background: var(--primary); color: #fff; }
.sb-item.active .sb-no.st-belum { background: #0f766e; }
.sb-user {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .18);
}
.sb-user .sb-label { flex: 1; min-width: 0; }
.sb-user b { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user small { display: block; font-size: .72rem; opacity: .75; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #5eead4, #14b8a6); color: #053b37; font-weight: 800;
}
.sb-keluar, .sb-ciut, .sb-buka {
  border: 0; cursor: pointer; font: inherit; color: inherit; background: rgba(255, 255, 255, .12);
  border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center;
}
.sb-keluar:hover, .sb-ciut:hover { background: rgba(255, 255, 255, .22); }
.sidebar-mini .sb-user { flex-direction: column; padding: 8px 4px; }
.sb-ciut { position: absolute; right: -14px; top: 22px; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #0f5f59; box-shadow: var(--shadow); font-weight: 700; }
.sidebar-mini .sb-ciut { transform: rotate(180deg); }
.mobilebar { display: none; }
.sb-overlay { display: none; }
body.tamu .main { margin: 0; }

/* ---------- Bank soal: langkah, stase, paket ---------- */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; text-decoration: none;
  background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: .9rem;
}
.pill:hover { border-color: var(--primary); }
.pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pill-tag { font-size: .72rem; padding: 1px 7px; border-radius: 99px; background: rgba(15, 118, 110, .12); color: var(--primary); font-weight: 700; }
.pill.active .pill-tag { background: rgba(255, 255, 255, .22); color: #fff; }
.pill-n { font-size: .74rem; padding: 1px 8px; border-radius: 99px; background: #eef2f6; color: #475569; font-weight: 700; }
.pill.active .pill-n { background: rgba(255, 255, 255, .25); color: #fff; }
.step-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-no {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; font-weight: 800;
}
.step-no.sm { width: 24px; height: 24px; font-size: .8rem; }
.rubrik-ringkas { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.rubrik-prog { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); }
.rubrik-prog > div { flex: 1; }
.prog-kode { font-size: 1.3rem; font-weight: 800; color: #fff; background: var(--primary); padding: 6px 12px; border-radius: 10px; }
.rubrik-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rubrik-sel { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.chip { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 99px; background: #eef2f6; color: #334155; margin: 1px 2px 1px 0; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-bad { background: var(--danger-soft); color: var(--danger); }
.tab-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; text-decoration: none; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600;
}
.tab-link.active { color: var(--primary); border-color: var(--primary); }
.stase-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stase-col { background: #eaf3f2; border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.stase-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 6px; }
.stase-head > div { flex: 1; }
.stase-no {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: #0f766e; color: #fff; font-weight: 800;
}
.stase-no.sm { width: 22px; height: 22px; border-radius: 6px; font-size: .75rem; }
.soal-card { background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 5px; border-left: 4px solid var(--primary); }
.soal-card.off { border-left-color: #cbd5e1; opacity: .75; }
.soal-card .code { font-weight: 800; color: var(--primary); }
.soal-judul { font-weight: 600; font-size: .93rem; line-height: 1.35; }
.soal-card .meta { display: flex; gap: 4px; flex-wrap: wrap; }
.soal-card .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.stase-kosong { font-size: .85rem; color: var(--muted); text-align: center; padding: 16px 8px; border: 2px dashed #c7dcd9; border-radius: 10px; }
.stase-tambah { justify-content: center; border-style: dashed; background: transparent; }
.paket-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.paket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.paket-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--primary); }
.paket-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.paket-stase { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.paket-stase li { display: flex; align-items: center; gap: 8px; font-size: .86rem; padding: 4px 6px; border-radius: 8px; background: #f8fafc; }
.paket-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* Popover sederhana berbasis <details> */
details.pop { position: relative; display: inline-block; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; right: 0; z-index: 30; width: 320px; margin-top: 6px; }
.pop-wide { width: min(520px, 90vw); }

/* ---------- Aksi massal TUK (pengawas pusat) ---------- */
.aksi-tuk {
  position: sticky; top: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: #e6f2f1; border: 1px solid #b6dcd7;
}
.aksi-tuk input[type=datetime-local], .aksi-tuk select { width: auto; padding: 4px 8px; font-size: .85rem; }
#tbl-tuk tbody tr:has(input[data-tuk]:checked) { background: #eefaf8; }

/* ---------- Halaman ujian: kolom soal & jawaban digulir masing-masing ---------- */
.ujian-gulir { align-items: stretch; margin-bottom: 0; }
.ujian-gulir .kolom-gulir {
  height: var(--tinggi-gulir, calc(100vh - 200px)); overflow-y: auto; overscroll-behavior: contain;
  margin-bottom: 0; scrollbar-width: thin; scrollbar-color: #94c9c3 transparent;
}
/* Bayangan di tepi atas/bawah bila masih ada isi yang bisa digulir */
.ujian-gulir .kolom-gulir {
  background:
    linear-gradient(#fff 30%, rgba(255, 255, 255, 0)) top / 100% 36px no-repeat local,
    linear-gradient(rgba(255, 255, 255, 0), #fff 70%) bottom / 100% 36px no-repeat local,
    radial-gradient(farthest-side at 50% 0, rgba(15, 23, 42, .18), transparent) top / 100% 14px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(15, 23, 42, .18), transparent) bottom / 100% 14px no-repeat scroll;
  background-color: #fff;
}
.kolom-gulir::-webkit-scrollbar { width: 10px; }
.kolom-gulir::-webkit-scrollbar-thumb { background: #94c9c3; border-radius: 99px; border: 2px solid #fff; }
.kolom-gulir::-webkit-scrollbar-thumb:hover { background: #0f766e; }
/* Tab tetap terlihat di atas kolom saat digulir */
.tabs-lekat { position: sticky; top: -18px; z-index: 5; background: #fff; margin: -18px -20px 14px; padding: 8px 20px 0; }
.ujian-gulir .soal h3 { position: sticky; top: -18px; background: #fff; padding: 6px 0 4px; margin: 0; z-index: 2; }
@media (max-width: 960px) {
  /* Di layar kecil kembali ke gulir halaman biasa */
  .ujian-gulir .kolom-gulir { height: auto; overflow: visible; }
}

/* ---------- Lembar kerja tabel ---------- */
.lk { display: flex; flex-direction: column; gap: 8px; }
.lk-tbl th { background: #e6f2f1; font-size: .82rem; text-align: center; vertical-align: middle; }
.lk-tbl td { padding: 3px 4px; }
.lk-tbl input, .lk-tbl select { border: 1px solid transparent; border-radius: 6px; padding: 6px 7px; font-size: .88rem; background: #fbfdfd; min-width: 90px; }
.lk-tbl input:hover, .lk-tbl select:hover { border-color: #cbd5e1; }
.lk-tbl input:focus, .lk-tbl select:focus { border-color: var(--primary); background: #fff; }
.lk-tbl input:disabled, .lk-tbl select:disabled { background: transparent; color: var(--ink); opacity: 1; }
.lk-tbl select { min-width: 165px; }
.lk-no { width: 40px;text-align: center; color: var(--muted); font-weight: 600; }
.lk-aksi { width: 34px; text-align: center; }
.lk-aksi .icon-btn { font-size: 1.2rem; }

/* ---------- Lampiran PDF ---------- */
.pdf-box { display: flex; flex-direction: column; gap: 8px; }
.pdf-daftar { gap: 6px; }
.pdf-frame { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }

/* ---------- Simulasi SIMRS ---------- */
.simrs { border: 1px solid #94a3b8; border-radius: 10px; overflow: hidden; background: #fff; }
.simrs-bar {
  background: #1e3a8a; color: #fff; padding: 8px 12px;
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9rem;
}
.simrs-body { padding: 12px; background: #f1f5f9; }
.simrs fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 10px; background: #fff; }
.simrs legend { font-weight: 700; font-size: .88rem; color: #1e3a8a; padding: 0 6px; }
.simrs input, .simrs select { padding: 6px 8px; font-size: .9rem; }
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.fgrid .wide { grid-column: span 2; }
.req { color: var(--danger); font-style: normal; }
.kib {
  width: 330px; max-width: 100%; border-radius: 12px; padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, #0f766e, #0e7490); box-shadow: var(--shadow);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.kib-head { font-weight: 700; font-size: .95rem; }
.kib-head small { display: block; font-weight: 400; font-size: .7rem; letter-spacing: 1px; opacity: .9; }
.kib-rm { font-family: Consolas, monospace; font-size: 1.7rem; font-weight: 800; letter-spacing: 2px; margin: 10px 0 2px; }
.kib-nama { font-weight: 700; text-transform: uppercase; }
.kib-meta { font-size: .78rem; opacity: .95; margin-top: 2px; }
.kib-foot { font-size: .68rem; margin-top: 10px; opacity: .85; font-style: italic; }
.sep { border: 1px solid #334155; padding: 10px 12px; font-size: .82rem; background: #fff; }
.sep-head { text-align: center; border-bottom: 1px solid #334155; padding-bottom: 6px; margin-bottom: 6px; }
.sep table td { padding: 1px 6px 1px 0; vertical-align: top; }
.gelang {
  display: flex; width: 330px; max-width: 100%; border: 1px solid #cbd5e1; border-radius: 22px; overflow: hidden;
  background: #fff; font-size: .8rem; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.gelang-strip { width: 26px; background: var(--gelang); flex: none; }
.gelang-isi { padding: 8px 12px; line-height: 1.4; }
.simrs[data-menu=ranap] .simrs-bar { background: #6d28d9; }
.simrs[data-menu=ugd] .simrs-bar { background: #b91c1c; }
.simrs-menu { display: flex; gap: 2px; background: #e2e8f0; padding: 4px 4px 0; flex-wrap: wrap; }
.simrs-menu button {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer;
  font: inherit; font-size: .9rem; color: #334155;
}
.simrs-menu button:hover:not(:disabled) { background: #f1f5f9; }
.simrs-menu button.active { background: #f1f5f9; color: #1e3a8a; font-weight: 700; }
.simrs[data-menu=ranap] .simrs-menu button.active { color: #6d28d9; }
.simrs[data-menu=ugd] .simrs-menu button.active { color: #b91c1c; }
.cek-ok { color: var(--ok); font-weight: 700; }
.cek-no { color: var(--danger); font-weight: 700; }
@media (max-width: 960px) { .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stase-grid, .rubrik-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  /* Sidebar menjadi menu geser */
  body.has-sidebar .main, .sidebar-mini body.has-sidebar .main { margin-left: 0; }
  .sidebar, .sidebar-mini .sidebar { width: var(--sb-lebar); transform: translateX(-105%); }
  .sidebar-mini .sb-label { display: initial; }
  .sidebar-mini .sb-item { justify-content: flex-start; }
  .sidebar-mini .sb-user { flex-direction: row; padding: 10px; }
  .sb-ciut { display: none; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .mobilebar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20;
    padding: 10px 14px; background: #0f5f59; color: #fff;
  }
  .mobilebar .brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; flex: 1; }
  .mobilebar .logo { width: 30px; height: 30px; font-size: 1rem; }
  .sb-buka { width: 36px; height: 36px; font-size: 1.2rem; }
  .stase-grid, .rubrik-grid { grid-template-columns: minmax(0, 1fr); }
  .split, .grid-2, .grid-3, .role-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; max-height: none; }
  .levels, .global, .rub-edit .desc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  #app { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .timer { font-size: 1.8rem; }
}

/* ---------- Print ---------- */
@media print {
  .no-print, .topbar, .sidebar, .mobilebar, .btn, .tabs, .scorebar button { display: none !important; }
  body.has-sidebar .main { margin-left: 0 !important; }
  body { background: #fff; }
  #app { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* Pemilih batch di sidebar */
.sb-batch { display: flex; flex-direction: column; gap: 4px; margin: 0 12px 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.08); color: inherit; }
.sb-batch select { width: 100%; padding: 4px 6px; font-size: .82rem; border-radius: 6px; }
.sb-batch .sb-tidak-aktif { color: #fbbf24; font-weight: 600; }
.sidebar-mini .sb-batch { display: none; }

/* ---------- Sidebar: tata ulang proporsional (huruf & jarak) ---------- */
:root { --sb-lebar: 248px; --sb-mini: 68px; }
.sidebar { gap: 4px; padding: 12px 10px 10px; }
.sb-brand { gap: 10px; padding: 2px 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, .10); margin-bottom: 4px; }
.sb-brand strong { font-size: 1.02rem; letter-spacing: .4px; }
.sb-brand small { font-size: .68rem; opacity: .7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sidebar .logo { width: 34px; height: 34px; font-size: 1rem; }
.sb-batch { margin: 2px 2px 2px; padding: 7px 9px; gap: 3px; border-radius: 9px; }
.sb-batch .small { font-size: .68rem; text-transform: uppercase; letter-spacing: .8px; opacity: .75; }
.sb-batch select { font-size: .8rem; padding: 5px 6px; background: rgba(255, 255, 255, .95); color: #0f3d3a; border: 0; }
.sb-sesi { margin: 0 2px; padding: 6px 9px; font-size: .76rem; border-radius: 9px; }
.sb-sesi .sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav { gap: 1px; margin-top: 2px; padding-right: 2px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 6px; }
.sb-grup {
  display: flex; align-items: center; gap: 8px; font-size: .64rem; font-weight: 700; letter-spacing: 1.1px; opacity: .62;
  padding: 10px 10px 3px;
}
.sb-grup::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .14); }
.sb-item { gap: 10px; padding: 6px 9px; border-radius: 9px; font-size: .845rem; line-height: 1.25; min-height: 34px; }
.sb-ikon {
  width: 26px; height: 26px; display: grid; place-items: center; font-size: .95rem; border-radius: 7px;
  background: rgba(255, 255, 255, .08);
}
.sb-item.active .sb-ikon { background: #ccfbf1; }
.sb-item.active::before { left: -10px; top: 7px; bottom: 7px; }
.sb-item .sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user { padding: 8px; gap: 8px; border-radius: 10px; margin-top: 2px; }
.sb-user b { font-size: .82rem; }
.sb-user small { font-size: .68rem; }
.avatar { width: 30px; height: 30px; font-size: .85rem; }
.sb-keluar { width: 30px; height: 30px; }
.sb-soal { padding: 5px 9px; }
.sb-soal-teks b { font-size: .82rem; }
.sb-soal-teks small { font-size: .68rem; }
.sb-no { width: 24px; height: 24px; font-size: .76rem; border-radius: 7px; }
@media (max-height: 820px) {
  .sb-item { padding: 4px 9px; min-height: 29px; font-size: .82rem; }
  .sb-batch { padding: 5px 8px; }
  .sb-sesi { padding: 4px 9px; }
  .sb-ikon { width: 24px; height: 24px; }
  .sb-grup { padding: 7px 10px 2px; }
  .sb-brand small { display: none; }
}
/* Ruang stase: identitas peserta di kepala halaman ujian */
.ruang-peserta {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; min-width: 240px;
  background: var(--primary-soft, #e0f2f1); border: 1px solid rgba(15, 118, 110, .25); position: relative;
}
.ruang-peserta b { font-size: 1.05rem; }
.ruang-peserta.kosong { background: #fff7ed; border-color: #fdba74; }
.ruang-peserta details summary { cursor: pointer; color: var(--primary); }
