:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 12.5px; }

/* ---------- umum ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h3 { margin: 0 0 12px; font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
label.check { font-weight: 400; display: flex; align-items: center; gap: 8px; margin-top: 12px; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
textarea { resize: vertical; }
select[multiple] { min-height: 96px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .12s, background .12s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-danger-ghost { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger-ghost:hover { background: #fef2f2; }
.btn-block { width: 100%; margin-top: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.row-gap { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head-row h3 { margin: 0; }
.filter { width: auto; min-width: 140px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-top: 12px; font-size: 14px; }
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-gray { background: #e2e8f0; color: #334155; }
.badge-blue { background: #dbeafe; color: var(--primary-dark); }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #b45309; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 32px; }
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 { margin: 8px 0 2px; font-size: 22px; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.brand-logo {
  width: 46px; height: 46px; margin: 0 auto;
  border-radius: 12px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
}

/* ---------- layout app ---------- */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
@media (max-width: 820px) { .app { grid-template-columns: 1fr; } }
.sidebar {
  background: #0f172a; color: #e2e8f0; padding: 18px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px;
}
.sidebar-title { font-weight: 700; }
.sidebar-sub { font-size: 12px; color: #94a3b8; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  text-align: left; background: transparent; border: none; color: #cbd5e1;
  font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-logout { margin-top: 8px; color: #fca5a5; }

.main { padding: 26px 30px; max-width: 1100px; width: 100%; }
.main h2 { margin: 0 0 18px; }

/* ---------- statistik ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-num { font-size: 30px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 13px; }
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { width: 44px; font-weight: 700; }
.bar-track { flex: 1; background: var(--border); border-radius: 999px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.bar-num { width: 60px; text-align: right; color: var(--muted); font-size: 13px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.list-item-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.list-item-title { font-weight: 600; }
.list-item-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; white-space: pre-wrap; }
.list-actions { display: flex; gap: 6px; flex-shrink: 0; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* soal review */
.review-item { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #fff; }
.review-q { font-weight: 600; margin-bottom: 8px; }
.review-opt { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 14px; }
.review-opt input { width: auto; }
.review-opt .lbl { font-weight: 700; width: 18px; }
.review-explain { margin-top: 8px; }

/* ---------- taker ---------- */
.taker { min-height: 100vh; display: flex; flex-direction: column; }
.taker-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 22px; background: #0f172a; color: #fff; position: sticky; top: 0; z-index: 20;
}
.taker-title { font-weight: 700; }
.taker-timer { font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 800; padding: 4px 14px; border-radius: 8px; background: #1e293b; }
.taker-timer.warn { background: var(--warn); color: #fff; }
.taker-timer.danger { background: var(--danger); color: #fff; animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: .5; } }
.taker-body { flex: 1; padding: 22px; max-width: 820px; width: 100%; margin: 0 auto; }
.result-body { max-width: 900px; }
.taker-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 22px; background: #fff; border-top: 1px solid var(--border); position: sticky; bottom: 0;
}
.taker-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.taker-nav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 700; }
.taker-nav button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.taker-nav button.done { background: #dbeafe; border-color: #93c5fd; color: var(--primary-dark); }

.q-card { margin-bottom: 16px; }
.opt-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.opt-row:hover { background: #f8fafc; }
.opt-row.selected { border-color: var(--primary); background: #eff6ff; }
.opt-row.correct { border-color: var(--success); background: #f0fdf4; }
.opt-row.wrong { border-color: var(--danger); background: #fef2f2; }
.opt-row input { width: auto; margin-top: 4px; }

.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.overlay-box { max-width: 420px; text-align: center; width: 90%; }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 340px;
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
