:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e8ecf4;
  --primary: #4f6df5;
  --primary-soft: #eaeefe;
  --ok: #059669;
  --ok-soft: #dcfce9;
  --bad: #dc2626;
  --bad-soft: #fee9e9;
  --warn-soft: #fff6dc;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 41, 59, .04), 0 8px 24px rgba(30, 41, 59, .05);
  --foot-h: 40px;
}
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: var(--foot-h); font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
code { background: #eef1f8; padding: 1px 6px; border-radius: 6px; font-size: .92em; }
h1 { font-size: 1.6rem; margin: 0 0 .4rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; font-weight: 700; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; font-weight: 700; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); color: var(--text); }
.brand { color: var(--text); text-decoration: none; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #6f86ff, var(--primary)); color: #fff; box-shadow: 0 4px 12px rgba(79, 109, 245, .35); }
.nav { display: flex; flex-wrap: wrap; gap: 0; }
.nav a { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; padding: 7px 7px; border-radius: 10px; font-size: .85rem; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.nav a:hover { background: var(--primary-soft); color: var(--primary); }
.nav-out { color: var(--bad) !important; }
.nav-out:hover { background: var(--bad-soft) !important; }
.ico { flex: none; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--foot-h); display: flex; align-items: center; justify-content: center; background: var(--card); border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.narrow { max-width: 520px; margin: 24px auto; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.hero h1 { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .93rem; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #d9dfeb; border-radius: 10px; background: #fff; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 109, 245, .15); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
legend { font-weight: 600; font-size: .93rem; padding: 0 4px; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0; }
.inline-form label { display: flex; align-items: center; gap: 6px; }
.inline-form input[type=number] { width: 80px; }
.input-sm { width: 130px; padding: 5px 8px; font-size: .85rem; }
.code-input { text-transform: uppercase; letter-spacing: 1px; font-size: 1.1rem; }

.btn { display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; box-shadow: 0 4px 12px rgba(79, 109, 245, .25); transition: transform .12s, filter .15s, box-shadow .15s; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 6px 12px; font-size: .86rem; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; border-radius: 12px; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-info { background: var(--primary-soft); color: var(--primary); }
.impersonate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.impersonate form { margin: 0; }
.checks { list-style: none; padding: 0; }
.checks .ok { color: var(--ok); }
.checks .bad { color: var(--bad); }

.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.table tbody tr:hover td { background: #f8f9fe; }
.table td.ok { color: var(--ok); font-weight: 600; }
.table tr.flag td { background: var(--warn-soft); }
.table-scroll { overflow-x: auto; }
.sus td:not(:first-child), .sus th:not(:first-child) { text-align: center; width: 44px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.badge-open { background: var(--ok-soft); color: var(--ok); }
.badge-closed { background: #eceff5; color: var(--muted); }

.access { text-align: right; }
.access-code { font-size: 1.8rem; font-weight: 800; letter-spacing: 3px; color: var(--primary); font-family: ui-monospace, Consolas, monospace; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 12px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 600; font-size: .92rem; border-radius: 10px 10px 0 0; transition: color .15s, background .15s; }
.tabs a:hover { background: var(--primary-soft); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.bar-cell { width: 35%; }
.bar { background: #eceff5; border-radius: 99px; height: 10px; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #7f94ff, var(--primary)); border-radius: 99px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-n { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-l { color: var(--muted); font-size: .88rem; }

/* Tes siswa */
.instructions { background: var(--primary-soft); padding: 14px 16px; border-radius: 12px; font-size: .95rem; }
.band-block { margin-bottom: 18px; }
.band-title { background: var(--primary); color: #fff; display: inline-block; padding: 5px 16px; border-radius: 99px; font-size: 1rem; }
.cluster { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.word-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: var(--primary-soft); color: var(--primary); padding: 4px 12px; border-radius: 99px; font-weight: 600; }
.def-row { display: grid; grid-template-columns: 1fr 180px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); }
.def { font-size: 1rem; }
.submit-bar { position: sticky; bottom: var(--foot-h); display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 -6px 24px rgba(30, 41, 59, .08); }
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; position: static; }
  .nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .card { padding: 16px; overflow-x: auto; }
  h1 { font-size: 1.35rem; }
}
@media (max-width: 560px) {
  .def-row { grid-template-columns: 1fr; gap: 4px; }
  .access { text-align: left; }
}

/* Kartu kode siswa */
.code-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.code-card { background: var(--card); border: 1px dashed #a5b0c5; border-radius: 12px; padding: 12px; }
.code-card .code { font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; font-weight: 800; letter-spacing: 1px; margin: 4px 0; }
.plan p { margin: .3rem 0; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: min(480px, calc(100% - 32px)); color: var(--text); box-shadow: 0 24px 60px rgba(30, 41, 59, .25); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
.choice { display: grid; gap: 12px; margin-top: 8px; }
.choice .btn { text-align: center; }

@media print {
  .topbar, .foot, .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .code-cards { grid-template-columns: repeat(3, 1fr); }
  .code-card { break-inside: avoid; }
}
