:root {
  --navy: #16305c;
  --navy-dark: #0a1a33;
  --navy-light: #2d539a;
  --accent: #2f6fed;
  --accent-hover: #1d54d1;
  --accent-2: #6d5ce8;
  --accent-light: #eef3ff;
  --bg: #f3f5f9;
  --card: #ffffff;
  --surface-alt: #f8fafc;
  --surface-sunken: #eef1f7;
  --surface-strong: #e2e8f0;
  --border: #dde3ee;
  --border-strong: #b9c3d6;
  --text: #10182b;
  --text-2: #364152;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --true-bg: #dbeafe;
  --true-border: #3b82f6;
  --true-text: #1e40af;
  --false-bg: #fef2f2;
  --false-border: #f87171;
  --false-text: #b91c1c;
  --ok-bg: #f0fdf4;
  --ok-text: #15803d;
  --ok-border: #86efac;
  --warn-bg: #fffbeb;
  --warn-text: #92400e;
  --warn-border: #fcd34d;
  --navy-text: var(--navy);
  --err-line: #fecaca;
  --info-bg: #eff6ff;
  --info-line: #bfdbfe;
  --warn-line: #fde68a;
  color-scheme: light;
  --focus-ring: 0 0 0 3px rgba(47,111,237,.16);
  --shadow-xs: 0 1px 2px rgba(16,24,43,.04);
  --shadow-sm: 0 1px 2px rgba(16,24,43,.06), 0 1px 3px rgba(16,24,43,.06);
  --shadow-md: 0 4px 10px rgba(16,24,43,.06), 0 2px 4px rgba(16,24,43,.05);
  --shadow-lg: 0 12px 28px rgba(16,24,43,.1), 0 4px 10px rgba(16,24,43,.06);
  --shadow-xl: 0 24px 56px rgba(16,24,43,.18), 0 8px 18px rgba(16,24,43,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 160ms cubic-bezier(.4,0,.2,1);
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--border-strong) transparent; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 14px rgba(0,0,0,.28), 0 1px 3px rgba(0,0,0,.2);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-header .header-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}
.logo-icon {
  flex: none;
  width: 38px; height: 38px; border-radius: 9px;
  background: rgba(255,255,255,.14);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: .5px;
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
}
.app-header h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .1px; }
.app-header p { margin: 2px 0 0; font-size: 11.5px; color: rgba(255,255,255,.55); }
.header-user {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.header-user .who { font-size: 13px; line-height: 1.35; text-align: right; color: rgba(255,255,255,.85); }
.header-user .who .role-badge {
  display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.16); font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.18);
}
.header-user button {
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.18); font-size: 13px; padding: 6px 14px;
  border-radius: var(--radius-sm);
}
.header-user button:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ===== LAYOUT ===== */
.container { max-width: 1240px; margin: 0 auto; padding: 24px 24px 72px; }

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 20px;
  animation: cardIn .2s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.card h2 {
  margin: 0 0 18px; font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 10px; color: var(--text);
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.card h3 { font-size: 11px; margin: 22px 0 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; font-size: 13px; font-weight: 700; flex: none;
  box-shadow: 0 2px 6px rgba(47,111,237,.32);
}

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 20px;
}
.form-grid label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); font-weight: 700; gap: 6px; text-transform: uppercase; letter-spacing: .06em; }
.form-grid input, .form-grid select, .form-grid textarea {
  font: inherit; font-size: 14px; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); background: var(--surface-alt);
  box-sizing: border-box; transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  font-weight: 400;
}
.form-grid select { height: 40px; padding-top: 0; padding-bottom: 0; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--focus-ring); background: var(--card);
}
.form-grid input:hover:not(:focus), .form-grid select:hover:not(:focus) { border-color: var(--border-strong); }
/* Form "Tambah Pengguna Baru" (Admin): Nama Lengkap, Username, Password, Peran, dan Jabatan dalam
   satu baris pada layar lebar — beberapa field sengaja lebih sempit (lihat au-fullname dkk).
   Institusi tetap full-width (grid-column:1/-1, baris sendiri di bawahnya) seperti form-grid biasa. */
.admin-user-form-row { grid-template-columns: 1.4fr 1fr 1.1fr 118px .85fr 1.1fr; }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px;
}
.progress-wrap { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); min-width: 220px; flex: 1; }
.progress-bar { flex: 1; height: 10px; background: var(--surface-strong); border-radius: 999px; overflow: hidden; min-width: 120px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0%; transition: width .35s ease; border-radius: 999px; }
.toolbar-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
button {
  font: inherit; cursor: pointer; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); padding: 8px 16px; color: var(--text-2); font-weight: 600; font-size: 13px;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  touch-action: manipulation;
}
button:hover { background: var(--surface-sunken); border-color: var(--border-strong); }
button:active { background: var(--surface-strong); transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff; border-color: transparent;
  padding: 11px 28px; font-size: 15px; border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(47,111,237,.3), 0 1px 2px rgba(47,111,237,.18);
  font-weight: 700;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #16409e 100%);
  box-shadow: 0 6px 18px rgba(47,111,237,.4), 0 2px 4px rgba(47,111,237,.2);
  border-color: transparent;
  transform: translateY(-1px);
}
.btn-primary:active { background: #16409e; box-shadow: 0 1px 4px rgba(47,111,237,.32); transform: translateY(1px); }
.btn-danger { color: var(--false-text); border-color: var(--err-line); background: var(--false-bg); }
.btn-danger:hover { background: var(--false-bg); border-color: var(--false-border); }
.btn-small { padding: 5px 10px; font-size: 12px; }

/* ===== INFO BLOCKS ===== */
.legend {
  font-size: 13px; color: var(--text-2); margin-bottom: 16px; padding: 12px 16px;
  background: var(--surface-alt); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  line-height: 1.65;
}

/* ===== ANSWER GRID ===== */
.answer-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  max-height: 640px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}
.entry-col { display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.item-cell {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 5px; font-size: 12px; background: var(--card);
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
}
.item-cell:hover { border-color: var(--accent); background: var(--accent-light); }
.item-cell .item-num { font-weight: 700; color: var(--text-2); width: 28px; text-align: right; }
.item-input {
  width: 26px; height: 22px; padding: 0; text-align: center; font-weight: 700;
  font-size: 12px; border: 1px solid var(--border); border-radius: 3px; background: var(--card);
  color: var(--muted-light); cursor: pointer; transition: all var(--transition);
}
.item-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.item-input.state-true { background: var(--true-bg); border-color: var(--true-border); color: var(--true-text); font-weight: 800; }
.item-input.state-false { background: var(--false-bg); border-color: var(--false-border); color: var(--false-text); font-weight: 800; }

/* ===== Camera monitoring ===== */
.cam-monitor-widget { position: fixed; bottom: 16px; right: 16px; z-index: 50; text-align: center; }
.cam-monitor-widget video { width: 120px; height: 90px; border-radius: 8px; background: #111; object-fit: cover; border: 2px solid var(--navy); display: block; box-shadow: var(--shadow-lg); }
.cam-monitor-status { font-size: 11px; margin-top: 4px; background: var(--card); padding: 2px 8px; border-radius: 4px; display: inline-block; box-shadow: var(--shadow-sm); }
.cam-summary-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-alt); font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.cam-summary-box .cam-risk-ok { color: var(--ok-text); font-weight: 700; }
.cam-summary-box .cam-risk-warn { color: var(--false-text); font-weight: 700; }
.cam-events-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.cam-event-card { border: 1px solid var(--border); border-radius: 6px; padding: 6px; font-size: 11px; background: var(--card); box-shadow: var(--shadow-xs); }
.cam-event-card img { width: 100%; border-radius: 4px; display: block; margin-bottom: 4px; background: #111; }
.cam-event-card .cam-event-type { font-weight: 700; }
.cam-event-card .cam-event-type.movement { color: var(--warn-text); }
.cam-event-card .cam-event-type.absence_start { color: var(--false-text); }
.cam-event-card .cam-event-type.absence_end { color: var(--ok-text); }
.cam-event-card .cam-event-type.baseline { color: var(--navy-text); }
.cam-event-card .cam-event-type.camera_unavailable { color: var(--muted); }

/* ===== ACTION BAR ===== */
.action-bar { text-align: center; margin: 28px 0; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ===== TABS ===== */
.tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 2px solid var(--border); margin-bottom: 20px;
}
.tab {
  border: 1.5px solid transparent; border-bottom: none; border-radius: 7px 7px 0 0;
  background: transparent; color: var(--muted); padding: 9px 18px; font-weight: 600; font-size: 13px;
  position: relative; bottom: -2px; transition: color var(--transition), background var(--transition);
  cursor: pointer;
}
.tab:hover { color: var(--accent); background: var(--accent-light); border-color: transparent; }
.tab.active {
  background: var(--card); border-color: var(--border) var(--border) var(--card);
  color: var(--accent); box-shadow: 0 -2px 0 0 var(--accent);
}
.tab-panel.active { animation: fadeSlideIn .18s ease; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.tab-panel { display: none; }

/* ===== TABLES ===== */
.score-table, .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.score-table th, .score-table td, .data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--surface-sunken); text-align: left; }
.score-table th, .data-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; background: var(--surface-alt); border-bottom: 1px solid var(--border); }
.score-table td.code-cell { font-weight: 700; color: var(--navy-text); white-space: nowrap; }
.score-table tbody tr:hover, .data-table tbody tr:hover { background: var(--surface-alt); }
.data-table { margin-bottom: 16px; }
.data-table td.mono { font-family: 'SFMono-Regular', Consolas, monospace; }
/* Wraps a wide .data-table (many columns + an action cell forced to nowrap) so it scrolls
   horizontally inside the card instead of its action buttons spilling out past the card's white
   background — seen on Hasil Tes tables once "Perlu Dianalisa" pushed them past 10 columns. */
.table-scroll-x { overflow-x: auto; }
/* Stacks a results-table row's action buttons (Lihat/Hapus Analisa/Hapus etc.) vertically,
   one under another, instead of side by side — keeps the action cell narrow so the row doesn't
   push the table wider than its card. */
.action-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
/* A row of buttons inside .action-stack — e.g. "Lihat"/"Hapus" side by side, with "Hapus
   Analisa" stacked below as its own full row. */
.action-row { display: flex; flex-direction: row; gap: 6px; }

/* ===== MINI BARS ===== */
.bar-mini { display: inline-block; width: 80px; height: 8px; background: var(--surface-strong); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar-mini-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }
.bar-mini-fill.t-elevated, .bar-mini-fill.t-high { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.bar-mini-fill.t-low { background: linear-gradient(90deg, #94a3b8, var(--muted)); }

/* ===== BADGES ===== */
.t-badge, .status-pill {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  background: var(--surface-strong); color: var(--text-2); border: 1px solid transparent;
}
.t-badge.t-normal, .status-pill.ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.t-badge.t-elevated, .status-pill.warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }
.t-badge.t-high, .status-pill.danger { background: var(--false-bg); color: var(--false-text); border-color: var(--err-line); }
.status-pill.info { background: var(--info-bg); color: var(--navy-text); border-color: var(--info-line); }
.status-pill.muted { background: var(--surface-alt); color: var(--muted); border-color: var(--border); }
.t-badge.t-low { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); }

/* "Sudah Dicetak" checklist — green check in a box once Cetak Laporan has been clicked. */
.print-badge-ok {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 5px; background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border);
  font-size: 13px; font-weight: 700; line-height: 1;
}
.print-badge-empty { color: var(--muted-light); font-size: 13px; }

/* Sortable results-table column headers (click the label to toggle ascending/descending). The
   clickable/arrow styling lives on .th-sort-label (a span wireSortableTableHeaders wraps the
   header text in), not the <th> itself, so a <th> can also hold a search input underneath
   (.th-search-input) without that input becoming part of the sort click target. */
.data-table th.sortable-th { white-space: nowrap; }
.data-table th .th-sort-label { cursor: pointer; user-select: none; }
.data-table th .th-sort-label:hover { color: var(--accent); }
.data-table th .th-sort-label::after { content: '\2195'; margin-left: 5px; opacity: .35; font-size: 11px; }
.data-table th.sort-asc .th-sort-label::after { content: '\2191'; opacity: 1; }
.data-table th.sort-desc .th-sort-label::after { content: '\2193'; opacity: 1; }

/* Per-column search box, placed directly under a sortable column's label (requested: Nama
   Peserta, sized to the column but able to hold a long name — overflow is handled by the
   column's own natural width, same as any other table cell). */
.data-table th .th-search-input {
  display: block; width: 100%; max-width: 100%; box-sizing: border-box; margin-top: 6px;
  font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: normal;
  padding: 5px 7px; border: 1.5px solid var(--border); border-radius: 5px;
  background: var(--card); color: var(--text); white-space: normal;
}
.data-table th .th-search-input:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}

/* ===== K-INFO ===== */
.k-info {
  font-size: 13px; color: var(--navy-text); margin: -4px 0 16px; padding: 12px 14px;
  background: var(--info-bg); border: 1px solid var(--info-line); border-radius: 8px; line-height: 1.6;
}

/* ===== EXTRA SECTIONS ===== */
.extra-indices { margin-top: 24px; }
.extra-section {
  margin-bottom: 16px; padding: 16px 18px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px;
}
.extra-section h3 { margin: 0 0 10px; font-size: 13px; color: var(--navy-text); font-weight: 700; }
.extra-section p { margin: 0 0 10px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.extra-section p:last-child { margin-bottom: 0; }
.extra-section ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.extra-index-result { font-weight: 700; color: var(--navy-text); }
.extra-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.extra-table th, .extra-table td { padding: 8px 10px; border-bottom: 1px solid var(--surface-sunken); text-align: left; }
.extra-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; background: var(--surface-alt); }

#profile-chart, .profile-chart { width: 100%; display: block; }

/* ===== DISCLAIMER ===== */
.disclaimer {
  font-size: 12px; color: var(--muted); background: var(--warn-bg); border: 1px solid var(--warn-line);
  padding: 12px 14px; border-radius: 8px; margin-top: 14px; line-height: 1.6;
}

/* ===== NOTICES ===== */
.notice {
  font-size: 13px; padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; line-height: 1.5;
}
.notice.ok { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }
.notice.err { background: var(--false-bg); color: var(--false-text); border: 1px solid var(--err-line); }
.notice.info { background: var(--info-bg); color: var(--navy-text); border: 1px solid var(--info-line); }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }

footer { text-align: center; font-size: 12px; color: var(--muted); padding: 24px; line-height: 1.7; }
footer code { background: var(--surface-strong); padding: 1px 5px; border-radius: 4px; }

/* ===== LOGIN ===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 65%, #061224 100%);
  position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 25% 40%, rgba(47,111,237,.2) 0%, transparent 55%),
              radial-gradient(ellipse at 75% 70%, rgba(109,92,232,.14) 0%, transparent 50%);
}
.auth-card {
  position: relative; z-index: 1;
  background: var(--card); border-radius: var(--radius-lg); padding: 36px; width: 100%; max-width: 420px;
  box-shadow: 0 28px 72px rgba(0,0,0,.36), 0 8px 24px rgba(0,0,0,.2);
  overflow: hidden;
  animation: cardIn .28s cubic-bezier(.2,.8,.2,1);
}
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.auth-card .logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; margin-top: 6px; }
.auth-card .logo-icon {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff; width: 46px; height: 46px; font-size: 17px; font-weight: 800;
  border-radius: 10px; box-shadow: 0 4px 12px rgba(22,48,92,.32);
}
.auth-card h1 { font-size: 19px; margin: 0; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.auth-card p.sub { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.auth-card label { font-size: 11px; color: var(--muted); font-weight: 700; display: flex; flex-direction: column; gap: 6px; text-transform: uppercase; letter-spacing: .06em; }
.auth-card input, .auth-card select {
  font: inherit; font-size: 14px; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt); color: var(--text); transition: all var(--transition);
  font-weight: 400;
}
.auth-card input:focus, .auth-card select:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); background: var(--card);
}
.auth-card .btn-primary { width: 100%; margin-top: 6px; padding: 13px; }
.auth-card .token-login { display:flex; flex-direction:column; gap:12px; margin-top:22px; }
.auth-card .token-login input { text-transform:uppercase; letter-spacing:.14em; font-weight:700; text-align:center; font-size:17px; }
.auth-card .auth-sep { display:flex; align-items:center; gap:10px; margin:22px 0 0; font-size:11px; color:var(--muted); font-weight:700; text-transform:uppercase; letter-spacing:.06em; }
.auth-card .auth-sep::before, .auth-card .auth-sep::after { content:''; flex:1; height:1px; background:var(--border); }
.demo-accounts {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); line-height: 1.85;
}
.demo-accounts strong { color: var(--text-2); display: block; margin-bottom: 4px; }
.demo-accounts code { background: var(--surface-sunken); padding: 1px 6px; border-radius: 4px; color: var(--navy-text); font-size: 11px; font-family: 'SFMono-Regular', Consolas, monospace; }

/* ===== SUBNAV ===== */
.subnav {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px;
  background: var(--card); padding: 6px; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.subnav button { border-radius: 7px; padding: 8px 18px; border-color: transparent; background: transparent; color: var(--muted); font-size: 13px; }
.subnav button:hover { background: var(--surface-sunken); color: var(--text); border-color: transparent; }
.subnav button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(47,111,237,.28);
}

/* ===== EXAM ===== */
.exam-wrap { max-width: 700px; margin: 0 auto; }
.exam-card { text-align: center; padding: 8px 0; }
.exam-progress-text { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.exam-question {
  font-size: 19px; line-height: 1.65; margin: 28px 0 32px; min-height: 96px;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 28px; background: var(--surface-alt); border-radius: var(--radius);
  border: 1.5px solid var(--border); color: var(--text); text-align: center;
  animation: fadeSlideIn .22s ease;
}
.report-paper { background: #fff; color: #1a1a1a; border-radius: var(--radius-sm); padding: 6px 8px 8px; } /* kertas terang tetap, seperti laporan cetak */
.exam-question u { text-decoration: underline; text-decoration-color: var(--accent); padding: 0 2px; }
@keyframes qSlideNext { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes qSlidePrev { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: translateX(0); } }
.exam-question.q-next { animation: qSlideNext .22s ease; }
.exam-question.q-prev { animation: qSlidePrev .22s ease; }
.qa-text u, .modal-qa-item .qa-text u { text-decoration: underline; text-decoration-color: var(--accent); padding: 0 2px; }
.exam-options { display: flex; gap: 16px; justify-content: center; margin-bottom: 20px; }
.exam-options button {
  min-width: 150px; padding: 18px 24px; font-size: 17px; border-radius: var(--radius);
  font-weight: 700; border-width: 2px; transition: all var(--transition);
}
.exam-options button:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.exam-options button:active { transform: translateY(0) scale(.98); }
.exam-options button.active-true { background: var(--true-bg); border-color: var(--true-border); color: var(--true-text); box-shadow: 0 4px 12px rgba(59,130,246,.2); }
.exam-options button.active-false { background: var(--false-bg); border-color: var(--false-border); color: var(--false-text); box-shadow: 0 4px 12px rgba(239,68,68,.2); }
.exam-nav { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.exam-token-input {
  font: inherit; font-size: 20px; letter-spacing: .18em; text-align: center; text-transform: uppercase;
  padding: 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); width: 100%; margin: 16px 0;
  font-weight: 700; color: var(--navy-text); background: var(--surface-alt); transition: all var(--transition);
}
.exam-token-input:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); background: var(--card);
}
.token-code { font-family: 'SFMono-Regular', Consolas, monospace; font-weight: 800; letter-spacing: .08em; }

/* ===== FIELD ROW ===== */
.field-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.field-row label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); font-weight: 700; gap: 6px; text-transform: uppercase; letter-spacing: .06em; }
.field-row input, .field-row select {
  height: 40px; font: inherit; font-size: 14px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt);
  box-sizing: border-box; transition: border-color var(--transition), box-shadow var(--transition);
}
.field-row input:focus, .field-row select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); background: var(--card);
}
.field-row button { height: 40px; padding: 0 18px; font-size: 14px; box-sizing: border-box; align-self: flex-end; }

/* ===== QA LIST ===== */
.qa-list {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 640px; overflow-y: auto; padding: 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-alt);
}
.qa-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; background: var(--card);
  transition: background var(--transition);
}
.qa-item:hover { background: var(--surface-alt); }
.qa-item .qa-num { flex: none; width: 42px; text-align: right; font-weight: 700; color: var(--muted); }
.qa-item .qa-text { flex: 1; line-height: 1.5; }
.qa-item .qa-options { display: flex; gap: 6px; flex: none; }
.qa-item .qa-options button { min-width: 48px; padding: 6px 12px; }
.qa-item .qa-options button.active-true { background: var(--true-bg); border-color: var(--true-border); color: var(--true-text); }
.qa-item .qa-options button.active-false { background: var(--false-bg); border-color: var(--false-border); color: var(--false-text); }
.qa-item.answered-true { background: var(--true-bg); border-color: var(--true-border); }
.qa-item.answered-false { background: var(--false-bg); border-color: var(--false-border); }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 640px) {
  /* Header items no longer fit on one 62px-tall row (logo + title + lang toggle + theme
     button + user info + Ubah Password + Keluar) — without wrapping, the row overflows off
     the right edge and "Keluar" ends up outside the viewport with no way to reach it. Wrapping
     the user/action buttons onto their own full-width row keeps every button reachable. */
  .app-header .header-inner { gap: 10px; flex-wrap: wrap; height: auto; padding: 10px 0; }
  .app-header h1 { font-size: 14px; }
  .app-header p { display: none; }
  .header-user { width: 100%; margin-left: 0; justify-content: flex-end; flex-wrap: wrap; }
  .container { padding: 16px 16px 60px; }
  .card { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .subnav { gap: 6px; }
  .subnav button { padding: 7px 12px; font-size: 12px; }
  .exam-question { font-size: 17px; padding: 18px; }
  .exam-options { flex-direction: column; gap: 12px; }
  .exam-options button { min-width: unset; width: 100%; padding: 16px; }
  .btn-primary { padding: 11px 20px; font-size: 14px; }
  .tabs { gap: 0; }
  .tab { padding: 8px 12px; font-size: 12px; }
}

@media print {
  .no-print { display: none !important; }
  .answer-grid { max-height: none; overflow: visible; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .app-header { background: var(--navy) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============ PRINT REPORT (4-page formatted output) ============ */
@page { size: A4; margin: 12mm; }

#print-report-root {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 720px;
  background: #fff;
  color: #1a1a1a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
#print-report-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.print-page {
  position: relative;
  padding-bottom: 10px;
}
.print-page + .print-page { margin-top: 24px; }
.print-page canvas { width: 100%; height: auto; display: block; }

/* --- Cover page (page 1) --- */
.print-title-block {
  text-align: center;
  border: 2px solid #1e3a5f;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 6px;
}
/* Stempel kerahasiaan di sudut kanan atas setiap halaman cetak. Garis + teks merah (tetap terbaca bila latar tidak dicetak). */
.print-secret {
  display: inline-block; border: 1.5px solid #dc2626; border-radius: 3px; background: #fee2e2; color: #dc2626;
  font-size: 11px; font-weight: 800; letter-spacing: .14em; line-height: 1; padding: 3px 7px;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-title-block { position: relative; }
.print-title-block .print-secret { position: absolute; top: 8px; right: 8px; }
.print-running-header .print-secret { margin-left: 10px; }
.print-title-block .print-title {
  font-size: 18px; font-weight: 800; letter-spacing: .04em; color: #1e3a5f; margin: 0;
  text-transform: uppercase;
}
.print-title-block .print-subtitle {
  font-size: 10px; color: #64748b; margin: 2px 0 0; letter-spacing: .06em;
}
.print-cover-info {
  width: 100%; border-collapse: collapse; margin-bottom: 6px; font-size: 12px;
}
.print-cover-info th, .print-cover-info td {
  border: 1px solid #cbd5e1; padding: 3px 8px; text-align: left;
}
.print-cover-info th {
  width: 130px; background: #f1f5f9; font-weight: 700; color: #334155;
}

/* --- Running header + info box (pages 2-4) --- */
.print-running-header {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid #1e3a5f; padding-bottom: 4px; margin-bottom: 8px;
}
.print-running-header .print-running-title {
  font-size: 13px; font-weight: 800; color: #1e3a5f; text-transform: uppercase; letter-spacing: .03em;
}
.print-running-header .print-running-page {
  font-size: 11px; color: #64748b;
}
.print-info-box {
  width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 12px;
  border: 1px solid #1e3a5f;
}
.print-info-box caption {
  text-align: left; font-weight: 800; font-size: 11px; letter-spacing: .06em;
  background: #1e3a5f; color: #fff; padding: 5px 10px; text-transform: uppercase;
}
.print-info-box th, .print-info-box td {
  border: 1px solid #cbd5e1; padding: 5px 9px; text-align: left; font-weight: 400;
}
.print-info-box th {
  width: 18%; background: #f8fafc; font-weight: 700; color: #334155; white-space: nowrap;
}

.print-profile-table {
  width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 10.5px;
  border: 1px solid #1e3a5f;
}
.print-profile-table caption {
  text-align: left; font-weight: 800; font-size: 11px; letter-spacing: .06em;
  background: #1e3a5f; color: #fff; padding: 5px 10px; text-transform: uppercase;
}
.print-profile-table th, .print-profile-table td {
  border: 1px solid #cbd5e1; padding: 2px 7px; text-align: left; font-weight: 400;
}
.print-profile-table th {
  width: 15%; background: #f8fafc; font-weight: 700; color: #334155; white-space: nowrap;
}
.print-profile-table td { width: 35%; }

/* --- Score sections --- */
.print-section { margin-bottom: 12px; }
.print-section h3 {
  font-size: 13px; margin: 0 0 8px; color: #1e3a5f; text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid #cbd5e1; padding-bottom: 4px;
}

/* Per-scale Raw/T score boxes under each print chart, horizontally
   aligned to the chart's plotted x-positions (leftPad/rightPad in
   drawPrintChart correspond to the left/right margin below). */
.print-chart-scores {
  display: flex; justify-content: space-between;
  margin: 2px 12px 0 38px;
}
.print-chart-scorebox {
  flex: 0 1 auto; min-width: 15px; max-width: 38px;
  border: 1px solid #cbd5e1; border-radius: 3px; overflow: hidden;
  text-align: center; font-size: 6.5px; line-height: 1.5;
}
.print-chart-scorebox div { padding: 0 1px; }
.print-chart-scorebox .pcs-name { font-weight: 700; background: #eef2f7; color: #1e3a5f; }
.print-chart-scorebox .pcs-raw { border-top: 1px solid #e2e8f0; color: #475569; }
/* Blok grafik cetak: lebar menyesuaikan jumlah skala (lihat printChartWidthPct), di tengah halaman. */
.print-chart-block { margin: 0 auto; }
.report-chart-wrap { margin-top: 18px; }
.report-chart-wrap canvas { width: 100%; display: block; }
.report-chart-wrap .print-chart-scorebox { font-size: 11px; }
.report-chart-wrap .print-chart-info { font-size: 11px; }
.print-chart-info { font-size: 9px; color: #475569; margin-top: 2px; }
.print-chart-scorebox .pcs-t { border-top: 1px solid #e2e8f0; font-weight: 700; color: #1e3a5f; }

/* Page 1 (cover) is compacted to fit title through analyst signature on one A4 sheet */
.print-cover .print-section { margin-bottom: 5px; }
.print-cover .print-section h3 { margin: 0 0 2px; padding-bottom: 1px; }

.print-recommendation {
  border: 1px solid #cbd5e1; border-radius: 4px; padding: 10px 12px; background: #f8fafc;
}
.print-recommendation h3 { border-bottom: none; }
.print-recommendation .print-rec-text { font-size: 12px; white-space: pre-wrap; line-height: 1.6; }

/* --- Extra analysis sections (page 1: Sikap, Kapasitas Mental, Profil Klinis, OCEAN) --- */
.print-extra-section p { font-size: 11.5px; line-height: 1.3; margin: 0 0 2px; }
.print-extra-section sup, .extra-section sup { line-height: 0; }
.print-extra-section ul { font-size: 11.5px; line-height: 1.25; margin: 0 0 2px; padding-left: 18px; }
.print-extra-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-bottom: 2px; }
.print-extra-table th, .print-extra-table td { border: 1px solid #cbd5e1; padding: 2px 6px; text-align: left; }
.print-extra-table th { background: #f1f5f9; font-weight: 700; color: #334155; }


@media print {
  body.printing-report > *:not(#print-report-root) { display: none !important; }
  body.printing-report #print-report-root {
    position: static; left: auto; top: auto; width: auto;
  }
  .print-page { page-break-after: always; }
  .print-page:last-child { page-break-after: auto; }
}

/* ============ PRINT ANSWER SHEET (landscape, Reference1.png-style) ============ */
#print-answersheet-root {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  color: #000;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.ansheet-title { text-align: center; font-size: 16px; font-weight: 700; margin-bottom: 10px; letter-spacing: .5px; }
.ansheet-formtable { width: 100%; border-collapse: collapse; font-size: 11px; margin-bottom: 4px; }
.ansheet-formtable td { padding: 2px 0; vertical-align: bottom; }
.ansheet-formtable td.ansheet-label { white-space: nowrap; padding-right: 4px; }
.ansheet-formtable td.ansheet-colon { width: 10px; padding-right: 6px; }
.ansheet-formtable td.ansheet-value { border-bottom: 1px solid #000; padding-right: 24px; min-width: 110px; }
.ansheet-formtable td.ansheet-gap { width: 18px; }
.ansheet-doubleline { border: none; border-top: 3px double #000; margin: 8px 0 10px; }
.ansheet-grid { display: flex; gap: 6px; }
.ansheet-col { display: flex; flex-direction: column; gap: 1px; }
.ansheet-item { display: flex; align-items: center; gap: 2px; font-size: 7.5px; line-height: 1; white-space: nowrap; }
.ansheet-num { width: 20px; text-align: right; margin-right: 2px; font-size: 7.5px; }
.ansheet-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 11px; height: 11px; border-radius: 50%; border: 1px solid #000;
  font-size: 8px; line-height: 1; font-weight: 700;
}
.ansheet-circle.ansheet-filled { background: #9a9a9a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

@media print {
  body.printing-answersheet > *:not(#print-answersheet-root) { display: none !important; }
  body.printing-answersheet #print-answersheet-root {
    position: static; left: auto; top: auto;
  }
}

/* ===== Language Toggle ===== */
.lang-toggle {
  display: flex; align-items: center; gap: 4px; margin-right: 10px;
}
.lang-toggle button {
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.18); padding: 4px 11px; font-size: 12px; border-radius: 999px;
}
.lang-toggle button.active { background: rgba(255,255,255,.25); color: #fff; font-weight: 700; border-color: rgba(255,255,255,.3); }
.lang-toggle button:hover { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.25); }

/* ===== Answer Review Modal ===== */
.answer-review-modal {
  position: fixed; inset: 0; background: rgba(10,16,30,.62); z-index: 999;
  display: flex; flex-direction: column; backdrop-filter: blur(3px);
  animation: fadeSlideIn .18s ease;
}
.answer-review-modal .modal-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-dark)); color: #fff;
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; flex: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.answer-review-modal .modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.answer-review-modal .modal-content {
  background: var(--card); flex: 1; overflow-y: auto; padding: 16px 20px;
}
.answer-review-modal .modal-footer {
  background: var(--surface-alt); padding: 14px 20px; display: flex; gap: 10px;
  border-top: 1px solid var(--border); flex: none;
  box-shadow: 0 -2px 8px rgba(0,0,0,.04);
}
.modal-qa-list { display: flex; flex-direction: column; gap: 3px; }
.modal-qa-item {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; background: var(--card);
  transition: background var(--transition);
}
.modal-qa-item:hover { background: var(--surface-alt); }
.modal-qa-item.answered-true { background: var(--true-bg); border-color: var(--true-border); }
.modal-qa-item.answered-false { background: var(--false-bg); border-color: var(--false-border); }
.modal-qa-item .qa-num { flex: none; width: 36px; font-weight: 700; color: var(--muted); text-align: right; padding-top: 2px; }
.modal-qa-item .qa-text { flex: 1; line-height: 1.5; }
.modal-qa-item .qa-btns { display: flex; gap: 5px; flex: none; }
.modal-qa-item .qa-btns button { min-width: 44px; padding: 4px 10px; font-size: 12px; }
.modal-qa-item .qa-btns button.active-true { background: var(--true-bg); border-color: var(--true-border); color: var(--true-text); }
.modal-qa-item .qa-btns button.active-false { background: var(--false-bg); border-color: var(--false-border); color: var(--false-text); }

/* ===== Print Conclusion/Suggestion block ===== */
.print-conclusion-block { margin-top: 6px; border: 1px solid #cbd5e1; border-radius: 4px; padding: 7px 10px; background: #f8fafc; }
.print-conclusion-block h3 { font-size: 12px; margin: 0 0 4px; color: #1e3a5f; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #cbd5e1; padding-bottom: 3px; }
.print-sig-block { margin-top: 8px; font-size: 12px; }

/* ===== Timer ===== */
#runner-timer-wrap {
  text-align: center; margin: 10px 0 6px; font-size: 16px; font-weight: 700;
  color: var(--navy-text); padding: 8px 20px; display: inline-block;
  background: var(--surface-sunken); border-radius: 999px; border: 1px solid var(--border);
}
#runner-timer-wrap.warning {
  color: var(--false-text); background: var(--false-bg); border-color: var(--err-line);
  animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.65} }

/* ===== LOADING SPINNER ===== */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(47,111,237,.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.loading-overlay {
  position: fixed; inset: 0; background: rgba(243,245,249,.85); z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 14px; color: var(--muted); backdrop-filter: blur(3px);
}

/* ===== EMPTY STATES ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-state-icon {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--surface-sunken); display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--muted-light); opacity: .9;
}
.empty-state h3 { margin: 0 0 6px; font-size: 15px; color: var(--text-2); font-weight: 600; }
.empty-state p { margin: 0; font-size: 13px; line-height: 1.6; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease; pointer-events: auto;
  max-width: 360px; text-align: center;
}
.toast.toast-ok { background: #166534; }
.toast.toast-err { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== STAT CARDS (admin db section) ===== */
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat-card strong { display: block; font-size: 28px; font-weight: 800; color: var(--navy-text); line-height: 1.2; }
.stat-card span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; display: block; }

/* ===== ANSWER REVIEW MODAL — better close button ===== */
.modal-close-btn {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  color: #fff; width: 30px; height: 30px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  flex: none;
}
.modal-close-btn:hover { background: rgba(255,255,255,.25); }

/* ===== ADMIN PANEL TRANSITION ===== */
.admin-panel { animation: fadeIn .15s ease; }
.role-view { animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SECTION DIVIDER ===== */
.section-divider {
  border: none; border-top: 1px solid var(--border); margin: 20px 0;
}

/* ===== ADMIN RESULTS - action buttons ===== */
.action-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== UNANSWERED PANEL ===== */
#runner-unanswered-panel {
  background: var(--warn-bg); border-color: var(--warn-border) !important;
  border-radius: 8px;
}

/* ===== RESPONDENT INFO (read-only display) ===== */
.resp-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 20px; margin-bottom: 16px;
}
.resp-info-item { font-size: 13px; }
.resp-info-item .label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.resp-info-item .value { color: var(--text); font-weight: 500; }

/* ===== EXAM STAGE TRANSITION ===== */
#runner-stage-token, #runner-stage-info, #runner-stage-exam, #runner-stage-done {
  animation: fadeIn .2s ease;
}

/* ===== FOOTER ===== */
footer {
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* ===== DARK MODE (layar saja; laporan cetak tetap terang) =====
   Otomatis mengikuti sistem; tombol tema menyetel <html data-theme="light|dark">. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #5b8cff; --accent-hover: #4378f0; --accent-light: #16233f;
    --bg: #0b1220; --card: #121a2b; --surface-alt: #162033; --surface-sunken: #0e1626; --surface-strong: #243049;
    --border: #26324a; --border-strong: #3a4a68;
    --text: #e6ebf5; --text-2: #b7c2d6; --muted: #8a98b0; --muted-light: #66758f;
    --true-bg: #14264a; --true-border: #4a7fe0; --true-text: #9ec0ff;
    --false-bg: #2a1618; --false-border: #b04a4a; --false-text: #ff9a9a;
    --ok-bg: #0f2a1a; --ok-text: #86efac; --ok-border: #1f6b3a;
    --warn-bg: #2d2410; --warn-text: #fcd34d; --warn-border: #7a5a12;
    --navy-text: #9ec0ff;
    --err-line: #5a2626; --info-bg: #11233f; --info-line: #1e3a66; --warn-line: #6b5314;
    --focus-ring: 0 0 0 3px rgba(91,140,255,.28);
    --shadow-xs: 0 1px 2px rgba(0,0,0,.35);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 10px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 28px rgba(0,0,0,.5), 0 4px 10px rgba(0,0,0,.35);
    --shadow-xl: 0 24px 56px rgba(0,0,0,.6), 0 8px 18px rgba(0,0,0,.4);
  }
  :root:not([data-theme="light"]) .exam-options button.active-true { box-shadow: 0 4px 12px rgba(91,140,255,.25); }
  :root:not([data-theme="light"]) .btn-danger:hover { background: var(--false-bg); }
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --accent: #5b8cff; --accent-hover: #4378f0; --accent-light: #16233f;
    --bg: #0b1220; --card: #121a2b; --surface-alt: #162033; --surface-sunken: #0e1626; --surface-strong: #243049;
    --border: #26324a; --border-strong: #3a4a68;
    --text: #e6ebf5; --text-2: #b7c2d6; --muted: #8a98b0; --muted-light: #66758f;
    --true-bg: #14264a; --true-border: #4a7fe0; --true-text: #9ec0ff;
    --false-bg: #2a1618; --false-border: #b04a4a; --false-text: #ff9a9a;
    --ok-bg: #0f2a1a; --ok-text: #86efac; --ok-border: #1f6b3a;
    --warn-bg: #2d2410; --warn-text: #fcd34d; --warn-border: #7a5a12;
    --navy-text: #9ec0ff;
    --err-line: #5a2626; --info-bg: #11233f; --info-line: #1e3a66; --warn-line: #6b5314;
    --focus-ring: 0 0 0 3px rgba(91,140,255,.28);
    --shadow-xs: 0 1px 2px rgba(0,0,0,.35);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
    --shadow-md: 0 4px 10px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 28px rgba(0,0,0,.5), 0 4px 10px rgba(0,0,0,.35);
    --shadow-xl: 0 24px 56px rgba(0,0,0,.6), 0 8px 18px rgba(0,0,0,.4);
  }
  :root[data-theme="dark"] .exam-options button.active-true { box-shadow: 0 4px 12px rgba(91,140,255,.25); }
  :root[data-theme="dark"] .btn-danger:hover { background: var(--false-bg); }
}
.theme-btn {
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.18);
  width: 34px; height: 34px; padding: 0; border-radius: 999px; font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; margin-right: 10px;
}
.theme-btn:hover { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.25); }
.auth-theme { position: absolute; top: 16px; right: 16px; margin: 0; z-index: 2; }
@media print { :root { color-scheme: light; } }
@media print { html.runner-no-print body * { visibility: hidden !important; } }
