/* ==========================================================================
   MMPI App — RSUD Kawali
   Stylesheet tunggal untuk halaman peserta (publik) dan halaman admin.

   Isi:
   1. Token desain (warna, tipografi, radius)
   2. Dasar (reset, tipografi, utilitas)
   3. Komponen umum (panel, tombol, form, alert, badge, tabel)
   4. Halaman masuk (token peserta & login admin)
   5. Halaman peserta (header, stepper, form, lembar jawaban, selesai)
   6. Halaman admin (sidebar, dashboard, tabel, detail)
   7. Ikon (dibuat otomatis, lihat bagian paling bawah)
   ========================================================================== */

/* ---------- 1. Token desain ---------- */
:root {
  --ink: #122127;
  --ink-2: #384950;
  --muted: #55676e;

  --canvas: #f2f5f5;
  --surface: #ffffff;
  --line: #dde5e6;
  --line-strong: #c3cfd1;

  --brand: #0b6b6a;
  --brand-hover: #085554;
  --brand-deep: #072f33;
  --brand-tint: #e4f1f0;
  --brand-tint-2: #cce5e3;

  --danger: #b42318;
  --danger-bg: #fdeceb;
  --danger-line: #f3c6c1;
  --success: #0a6b45;
  --success-bg: #e6f4ec;
  --success-line: #bfe3cf;
  --warn: #8a5a00;
  --warn-bg: #fff4d9;
  --warn-line: #f0d9a3;

  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 8px;

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono",
    monospace;

  --focus: 0 0 0 3px rgba(11, 107, 106, 0.22);
}

/* ---------- 2. Dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.0625rem; font-weight: 650; }
h3 { font-size: 0.9375rem; font-weight: 650; }
p { margin: 0 0 0.75em; }
a { color: var(--brand); }
strong { font-weight: 650; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

[hidden] { display: none !important; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.code,
.token-display {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--brand-hover);
  background: var(--brand-tint);
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- 3. Komponen umum ---------- */

/* Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
}
.panel + .panel { margin-top: 20px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 16px; flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.panel-head p { margin: 2px 0 0; }
.panel-body { padding: 22px; }
.panel-title { margin-bottom: 4px; }

/* Ikon (lihat bagian 7 untuk definisi bentuknya) */
.ico {
  display: inline-block;
  width: 20px; height: 20px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1;
  color: #fff;
  background: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: var(--r-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn .ico { width: 18px; height: 18px; }
.btn[disabled], .btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.btn[disabled]:hover, .btn:disabled:hover {
  background: var(--brand); border-color: var(--brand);
}
.btn-outline { background: var(--surface); color: var(--brand); border-color: var(--line-strong); }
.btn-outline:hover { background: var(--brand-tint); border-color: var(--brand); }
.btn-outline[disabled]:hover, .btn-outline:disabled:hover {
  background: var(--surface); border-color: var(--line-strong);
}
.btn-secondary { background: var(--ink-2); border-color: var(--ink-2); }
.btn-secondary:hover { background: var(--ink); border-color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-sm .ico { width: 16px; height: 16px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-block { width: 100%; }

/* Form */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
label, .label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.req { color: var(--danger); margin-left: 2px; }

input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
select, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font: inherit; font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #7d8f94; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: #9fb0b3;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
}

/* Upload file */
.dropzone {
  padding: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: #f8fbfb;
}
input[type="file"] { width: 100%; font: inherit; font-size: 14px; color: var(--ink-2); }
input[type="file"]::file-selector-button {
  margin-right: 14px;
  min-height: 36px;
  padding: 0 14px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--brand);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--brand-tint); border-color: var(--brand); }

/* Grid form & seksi */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}
.form-grid .form-group { margin-bottom: 0; }
.span-2 { grid-column: 1 / -1; }

.form-section { border: 0; margin: 0 0 30px; padding: 0; min-width: 0; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section legend {
  padding: 0; margin-bottom: 14px;
  font-size: 15px; font-weight: 650; color: var(--ink);
}

.form-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 12px;
  margin-top: 28px; padding-top: 22px;
  border-top: 1px solid var(--line);
}

/* Pilihan bentuk kartu (jenis kelamin) */
.choice-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-card { position: relative; margin: 0; font-weight: 500; cursor: pointer; }
.choice-card input {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.choice-card span {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.12s, background-color 0.12s;
}
.choice-card span::before {
  content: "";
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.choice-card:hover span { border-color: #9fb0b3; }
.choice-card input:checked + span { border-color: var(--brand); background: var(--brand-tint); font-weight: 600; }
.choice-card input:checked + span::before {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 3px var(--brand-tint);
  background: var(--brand);
}
.choice-card input:focus-visible + span { box-shadow: var(--focus); border-color: var(--brand); }

/* Alert */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 18px; padding: 12px 14px;
  font-size: 14px; line-height: 1.5;
  border: 1px solid; border-radius: var(--r-md);
}
.alert::before {
  content: "";
  flex: 0 0 18px; height: 18px; margin-top: 2px;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}
.alert-body { flex: 1; min-width: 0; }
.alert p:last-child { margin-bottom: 0; }
.alert-error   { --i: var(--i-a-error);   background: var(--danger-bg);  border-color: var(--danger-line);  color: #8a1c12; }
.alert-success { --i: var(--i-a-success); background: var(--success-bg); border-color: var(--success-line); color: #085a3a; }
.alert-warn    { --i: var(--i-a-warn);    background: var(--warn-bg);    border-color: var(--warn-line);    color: #6f4700; }
.alert-info    { --i: var(--i-a-info);    background: var(--brand-tint); border-color: var(--brand-tint-2); color: #0a4f4e; }
.panel > .alert:last-child { margin-bottom: 0; }

/* Badge status */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  font-size: 12.5px; font-weight: 600; line-height: 1.5;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-active, .badge-completed { background: var(--success-bg); color: var(--success); }
.badge-used, .badge-pending { background: #e9eeef; color: var(--ink-2); }
.badge-expired { background: var(--danger-bg); color: var(--danger); }
.badge-in_progress { background: var(--warn-bg); color: var(--warn); }

/* Chip jawaban */
.chip {
  display: inline-block; padding: 2px 10px;
  font-size: 13px; font-weight: 600;
  border-radius: 8px;
}
.chip-yes { background: var(--brand-tint); color: var(--brand-hover); }
.chip-no { background: #e9eeef; color: var(--ink-2); }

/* Tabel */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  padding: 11px 16px;
  text-align: left; white-space: nowrap;
  font-size: 12.5px; font-weight: 650; color: var(--muted);
  background: #f7fafa;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 13px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafcfc; }
@media (min-width: 761px) {
  table.data th:first-child, table.data td:first-child { padding-left: 22px; }
  table.data th:last-child, table.data td:last-child { padding-right: 22px; }
}
table.data .nowrap { white-space: nowrap; }
table.data .num { width: 64px; color: var(--muted); font-variant-numeric: tabular-nums; }
table.data .cell-actions { text-align: right; white-space: nowrap; }
table.data td.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
table.data .strong { font-weight: 600; }

.table-scroll { overflow: auto; }
@media (min-width: 961px) {
  .table-scroll { max-height: 68vh; }
  .table-scroll table.data th { position: sticky; top: 0; z-index: 1; }
}

/* Toolbar (pencarian) */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.search { position: relative; flex: 1 1 240px; max-width: 380px; }
.search .ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.search input:not([type="radio"]):not([type="checkbox"]):not([type="file"]) { padding-left: 40px; }
.toolbar .count { margin-left: auto; font-size: 13px; color: var(--muted); }

/* Kartu bertumpuk di layar kecil */
@media (max-width: 760px) {
  table.stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 6px 0; border: 0; text-align: right;
  }
  table.stack td::before {
    content: attr(data-label);
    flex-shrink: 0; text-align: left;
    font-size: 13px; font-weight: 600; color: var(--muted);
  }
  table.stack tbody tr:hover td { background: transparent; }
  table.stack td.cell-primary { justify-content: flex-start; padding-bottom: 8px; font-size: 16px; text-align: left; }
  table.stack td.cell-primary::before { content: none; }
  table.stack td.cell-actions { justify-content: flex-end; padding-top: 10px; }
  table.stack td.cell-actions::before { content: none; }
  table.stack td.empty { display: block; text-align: center; padding: 28px 8px; }
  table.stack td.empty::before { content: none; }
}

/* Daftar kunci–nilai */
.kv { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); margin: 0; }
.kv dt, .kv dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv dt { font-size: 13.5px; color: var(--muted); }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
@media (max-width: 520px) {
  .kv { grid-template-columns: 1fr; }
  .kv dt { padding-bottom: 0; border-bottom: 0; }
  .kv dd { padding-top: 2px; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: max-content;
  max-width: min(92vw, 520px);
  padding: 12px 18px;
  font-size: 14px; line-height: 1.45; color: #fff;
  background: var(--ink);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(7, 47, 51, 0.25);
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #7f1d15; }

/* ---------- 4. Halaman masuk (token peserta & login admin) ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 42%) minmax(0, 1fr);
}
.auth-side {
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px clamp(28px, 5vw, 64px);
  color: #cfe3e2;
  background: var(--brand-deep);
}
.auth-side .brand { color: #fff; }
.auth-side .brand-mark { background: rgba(255, 255, 255, 0.12); }
.auth-side .brand-text small { color: #9cc3c1; }
.auth-intro h2 { color: #fff; font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.auth-intro > p { color: #b7d3d1; max-width: 38ch; margin-bottom: 28px; }
.auth-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.auth-steps li { display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; }
.auth-steps .n {
  width: 32px; height: 32px; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.35); border-radius: 50%;
}
.auth-steps strong { display: block; color: #fff; font-weight: 600; }
.auth-steps span.d { display: block; font-size: 13.5px; color: #a8c8c6; }
.auth-foot { margin: 0; font-size: 13px; color: #8db4b2; }

.auth-panel { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card > p { color: var(--muted); margin-bottom: 24px; }
.token-input {
  min-height: 56px !important;
  font-family: var(--mono) !important;
  font-size: 19px !important;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}
.token-input::placeholder { letter-spacing: 0.08em; font-weight: 500; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-side { padding: 18px 20px; gap: 0; }
  .auth-intro, .auth-foot { display: none; }
  .auth-panel { align-items: start; padding-top: 32px; }
}

/* ---------- 5. Halaman peserta ---------- */

/* Merek */
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  color: #fff; background: var(--brand);
  border-radius: 11px;
}
.brand-mark .ico { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15.5px; font-weight: 700; letter-spacing: -0.005em; }
.brand-text small { font-size: 12.5px; color: var(--muted); }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner {
  max-width: 780px; margin: 0 auto; padding: 13px 20px;
  display: flex; align-items: center; justify-content: space-between;
}

.shell { max-width: 780px; margin: 32px auto 72px; padding: 0 20px; }
.shell-test { max-width: 880px; }
body.test-page .site-header-inner { max-width: 880px; }

.page-intro { margin-bottom: 24px; }
.page-intro h1 { margin-bottom: 6px; }
.page-intro p { color: var(--muted); margin: 0; }

/* Stepper — urutan langkah yang nyata, jadi memakai nomor */
.steps { list-style: none; margin: 0 0 28px; padding: 0; display: flex; align-items: center; }
.steps li {
  flex: 1; display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.steps li:last-child { flex: 0 0 auto; }
.steps li:not(:last-child)::after {
  content: ""; flex: 1; height: 2px; margin: 0 14px;
  background: var(--line); border-radius: 2px;
}
.steps .dot {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: var(--surface);
  border: 2px solid var(--line-strong); border-radius: 50%;
}
.steps .dot .ico { width: 16px; height: 16px; }
.steps li.current { color: var(--ink); }
.steps li.current .dot { color: #fff; background: var(--brand); border-color: var(--brand); }
.steps li.done { color: var(--ink-2); }
.steps li.done .dot { color: var(--brand); background: var(--brand-tint); border-color: var(--brand); }
.steps li.done::after { background: var(--brand); }
@media (max-width: 520px) {
  .steps li:not(.current) .lbl { display: none; }
  .steps li:not(:last-child)::after { margin: 0 10px; }
}

/* Lembar jawaban */
.test-bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}
@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))) {
  .test-bar { background: rgba(255, 255, 255, 0.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
.test-bar-inner { max-width: 880px; margin: 0 auto; padding: 11px 20px 12px; }
.progress-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 7px; font-size: 13.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.progress-meta .count strong { font-size: 16px; color: var(--ink); }
.progress-meta .right { display: flex; align-items: baseline; gap: 14px; }
.save-status { min-width: 70px; text-align: right; font-size: 13px; }
.save-status.is-error { color: var(--danger); font-weight: 600; }
.progress { height: 8px; overflow: hidden; background: #e2eaea; border-radius: 999px; }
.progress-fill {
  width: 0; height: 100%;
  background: var(--brand); border-radius: 999px;
  transition: width 0.2s ease;
}

.test-intro { margin-bottom: 20px; }
.test-intro h1 { margin-bottom: 8px; }
.test-intro p { margin: 0; color: var(--ink-2); max-width: 64ch; }

.statements {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.statement-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center; gap: 8px 16px;
  padding: 16px 22px 16px 0;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 4px 0 0 transparent;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.statement-row:last-child { border-bottom: 0; }
.statement-row .num {
  justify-self: end; padding-right: 4px;
  font-size: 13px; font-weight: 650; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.statement-row .text { font-size: 16px; line-height: 1.6; max-width: 64ch; }
.statement-row.answered { box-shadow: inset 4px 0 0 var(--brand); }
.statement-row.answered .num { color: var(--brand); }
.statement-row.missing { background: var(--warn-bg); box-shadow: inset 4px 0 0 #d69e2e; }
.statement-row.missing .num { color: var(--warn); }

/* Kontrol Ya / Tidak — warna netral, bukan hijau/merah, agar tidak terkesan benar/salah */
.answers { display: flex; gap: 10px; }
.choice { position: relative; display: block; margin: 0; cursor: pointer; }
.choice input {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.choice span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 96px; height: 46px; padding: 0 18px;
  font-size: 15px; font-weight: 600; color: var(--ink-2);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.choice:hover input:not(:checked) + span { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-hover); }
.choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice input:checked + span { color: #fff; }
.choice input:checked + span::before {
  content: ""; width: 15px; height: 15px;
  background-color: currentColor;
  -webkit-mask: var(--i-check) center / contain no-repeat;
  mask: var(--i-check) center / contain no-repeat;
}
.choice-yes input:checked + span { background: var(--brand); border-color: var(--brand); }
.choice-no input:checked + span { background: var(--ink-2); border-color: var(--ink-2); }

.submit-bar {
  position: sticky; bottom: 0; z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(7, 47, 51, 0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.submit-bar-inner {
  max-width: 880px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}
.show-sm { display: none; }
.submit-bar .remaining { margin-right: auto; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .statement-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start; gap: 10px 12px;
    padding: 16px;
  }
  .statement-row .num { justify-self: start; min-width: 30px; padding: 3px 0 0; }
  .statement-row .text { font-size: 16px; }
  .statement-row .answers { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .choice span { min-width: 0; height: 48px; }
  .submit-bar .remaining { display: none; }
  .submit-bar-inner { padding: 10px 16px; gap: 10px; }
  .submit-bar .btn { padding: 0 14px; }
  .submit-bar #submitBtn { flex: 1; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
}

/* Selesai */
.panel-done { text-align: center; padding: 44px 28px; }
.done-icon {
  width: 64px; height: 64px; margin: 0 auto 20px;
  display: grid; place-items: center;
  color: var(--success); background: var(--success-bg);
  border-radius: 50%;
}
.done-icon .ico { width: 30px; height: 30px; }
.panel-done h1 { margin-bottom: 8px; }
.panel-done p { max-width: 44ch; margin-left: auto; margin-right: auto; }
.done-token {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 12px 0 20px; padding: 8px 14px;
  background: #f7fafa; border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: 14px;
}

/* ---------- 6. Halaman admin ---------- */
body.admin-body { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: 256px; height: 100vh; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  color: #c6dcdb;
  background: var(--brand-deep);
}
.sidebar .brand { color: #fff; padding: 4px 8px 22px; }
.sidebar .brand-mark { background: rgba(255, 255, 255, 0.12); }
.sidebar .brand-text small { color: #9cc3c1; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a, .side-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  font-size: 14.5px; font-weight: 500;
  color: #c6dcdb; text-decoration: none;
  border-radius: var(--r-md);
  transition: background-color 0.12s, color 0.12s;
}
.side-nav a:hover, .side-logout:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.side-nav a.active { color: #fff; font-weight: 600; background: rgba(255, 255, 255, 0.14); }
.side-nav a:focus-visible, .side-logout:focus-visible { outline-color: #fff; }

.side-foot { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.side-user { display: flex; align-items: center; gap: 12px; padding: 8px 12px 10px; }
.avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
  background: #1c5a5c; border-radius: 50%;
}
.side-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.side-user-text small { font-size: 12px; color: #8db4b2; }
.side-user-text strong { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout:hover { color: #ffd0ca; }

.mobile-bar { display: none; }
.sidebar-overlay { display: none; }

.admin-main { flex: 1; min-width: 0; }
.page { max-width: 1160px; margin: 0 auto; padding: 36px 36px 72px; }

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-header .lede { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 12px;
  font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none;
}
.back-link:hover { color: var(--brand); }
.back-link .ico { width: 16px; height: 16px; }

.grid-2 {
  display: grid; gap: 20px; align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-2 > .panel + .panel { margin-top: 0; }
.stack-gap > * + * { margin-top: 20px; }

/* Ringkasan angka: satu strip, bukan kartu-kartu terpisah */
.stats {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px;
  margin-bottom: 22px; overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.stat { grid-column: span 2; padding: 18px 22px; background: var(--surface); }
.stat:nth-child(n + 4) { grid-column: span 3; }
.stat-value {
  display: block;
  font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.stat-sub { display: block; font-size: 12.5px; color: var(--muted); }
@media (min-width: 1240px) {
  .stat, .stat:nth-child(n + 4) { grid-column: span 1; }
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat:nth-child(n + 4) { grid-column: span 1; padding: 16px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-value { font-size: 1.7rem; }
}

.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.split > .panel + .panel { margin-top: 0; }

.action-list { list-style: none; margin: 0; padding: 0; }
.action-list li + li { border-top: 1px solid var(--line); }
.action-list a {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 22px;
  color: inherit; text-decoration: none;
  transition: background-color 0.12s;
}
.action-list a:hover { background: #f7fafa; }
.action-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--brand); background: var(--brand-tint);
  border-radius: 11px;
}
.action-text { flex: 1; min-width: 0; }
.action-text strong { display: block; font-weight: 600; }
.action-text span { display: block; font-size: 13.5px; color: var(--muted); }
.action-list .chev { color: var(--line-strong); }
.action-list a:hover .chev { color: var(--brand); }

.meter { height: 10px; overflow: hidden; background: #e2eaea; border-radius: 999px; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter-figures {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 14px 0 10px; font-variant-numeric: tabular-nums;
}
.meter-figures strong { font-size: 1.5rem; letter-spacing: -0.01em; }
.meter-note { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }

/* Token */
.token-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.token-chips .code { font-size: 14.5px; padding: 5px 11px; background: rgba(255, 255, 255, 0.7); color: #085a3a; }
.inline-form { display: flex; gap: 8px; max-width: 340px; }
.inline-form input:not([type="radio"]):not([type="checkbox"]):not([type="file"]) { min-height: 36px; padding: 6px 12px; font-size: 14px; }

/* Detail peserta */
.detail-title { display: flex; align-items: center; gap: 12px 14px; flex-wrap: wrap; }
.answer-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.inline-status {
  margin: 0; padding: 12px 22px;
  font-size: 14px;
  color: #0a4f4e; background: var(--brand-tint);
  border-bottom: 1px solid var(--brand-tint-2);
}
.inline-status:empty { display: none; }
.inline-status.is-ok { color: #085a3a; background: var(--success-bg); border-color: var(--success-line); }
.inline-status.is-err { color: #8a1c12; background: var(--danger-bg); border-color: var(--danger-line); }

/* ---------- Responsif umum ---------- */
@media (max-width: 1100px) {
  .split, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  body.admin-body { display: block; }

  .mobile-bar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    color: #fff; background: var(--brand-deep);
  }
  .mobile-bar .brand { color: #fff; }
  .mobile-bar .brand-mark { width: 34px; height: 34px; background: rgba(255, 255, 255, 0.12); }
  .mobile-bar .brand-text small { color: #9cc3c1; }
  .menu-btn {
    width: 42px; height: 42px; display: grid; place-items: center;
    color: #fff; background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22); border-radius: var(--r-md);
    cursor: pointer;
  }
  .menu-btn:hover { background: rgba(255, 255, 255, 0.1); }
  .menu-btn:focus-visible { outline-color: #fff; }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(288px, 86vw); height: 100vh; height: 100dvh;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 8px 0 30px rgba(3, 20, 22, 0.35); }
  .sidebar-overlay {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 35;
    background: rgba(5, 25, 28, 0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.nav-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .page { padding: 24px 20px 56px; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 1.45rem; }

  .shell { margin: 20px auto 56px; padding: 0 14px; }
  .panel { padding: 20px 18px; border-radius: 14px; }
  .panel-flush { padding: 0; }
  .panel-head { padding: 16px 18px; }
  .panel-body { padding: 18px; }
  .toolbar { padding: 12px 18px; }
  .inline-status { padding: 12px 18px; }
  .action-list a { padding: 14px 18px; }
  .page { padding: 20px 14px 48px; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }

  /* 16px mencegah iOS memperbesar layar saat kolom diisi */
  input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea { font-size: 16px; }

  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .page-header .btn { width: 100%; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .inline-form { max-width: none; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar .count { margin-left: 0; }
}

@media (max-width: 420px) {
  .submit-bar-inner { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .submit-bar .btn { padding: 0 12px; font-size: 13.5px; }
  .submit-bar #jumpBtn .ico { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- 7. Ikon ---------- */
:root {
  --i-grid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E");
  --i-key: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='m10.85 12.15 8.4-8.4'/%3E%3Cpath d='m17 6 3 3'/%3E%3Cpath d='m14 9 2 2'/%3E%3C/svg%3E");
  --i-users: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c0-3.6 2.9-6 6.5-6s6.5 2.4 6.5 6'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8'/%3E%3Cpath d='M18 14.3c2.2.7 3.5 2.6 3.5 5.7'/%3E%3C/svg%3E");
  --i-list: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h8l4 4v14H6z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 12h6M9 16h6'/%3E%3C/svg%3E");
  --i-logout: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E");
  --i-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  --i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E");
  --i-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5'/%3E%3Cpath d='m12 19-7-7 7-7'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19.5 7'/%3E%3C/svg%3E");
  --i-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5 15V6a2 2 0 0 1 2-2h9'/%3E%3C/svg%3E");
  --i-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='m7 11 5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E");
  --i-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4.5v15l12-7.5z'/%3E%3C/svg%3E");
  --i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --i-upload: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E");
  --i-jump: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='m6 13 6 6 6-6'/%3E%3C/svg%3E");
  --i-clipboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2.5'/%3E%3Cpath d='M9 4.5h6'/%3E%3Cpath d='m9 13 2.2 2.2L15.5 11'/%3E%3C/svg%3E");
  --i-a-error: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v5'/%3E%3Cpath d='M12 16.2v.01'/%3E%3C/svg%3E");
  --i-a-success: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12.2 3 3 5-6'/%3E%3C/svg%3E");
  --i-a-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 21.5 20h-19z'/%3E%3Cpath d='M12 10v4.5'/%3E%3Cpath d='M12 17.4v.01'/%3E%3C/svg%3E");
  --i-a-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5'/%3E%3Cpath d='M12 7.6v.01'/%3E%3C/svg%3E");
}
.ico-grid { --i: var(--i-grid); }
.ico-key { --i: var(--i-key); }
.ico-users { --i: var(--i-users); }
.ico-list { --i: var(--i-list); }
.ico-logout { --i: var(--i-logout); }
.ico-menu { --i: var(--i-menu); }
.ico-search { --i: var(--i-search); }
.ico-chevron { --i: var(--i-chevron); }
.ico-back { --i: var(--i-back); }
.ico-check { --i: var(--i-check); }
.ico-copy { --i: var(--i-copy); }
.ico-download { --i: var(--i-download); }
.ico-play { --i: var(--i-play); }
.ico-plus { --i: var(--i-plus); }
.ico-upload { --i: var(--i-upload); }
.ico-jump { --i: var(--i-jump); }
.ico-clipboard { --i: var(--i-clipboard); }

