/* =========================================================================
   CBK HR Exam — design system
   One stylesheet for the applicant portal and HRDesk.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f2f0ec;
  --border: #e7e3dd;
  --border-strong: #d6d0c6;
  --text: #1c1915;
  --text-2: #565049;
  --text-3: #8a8379;

  --brand: #9b1b21;
  --brand-700: #7f141a;
  --brand-50: #fbf2f2;
  --brand-100: #f3dddd;
  --gold: #b0802a;
  --gold-50: #faf4e6;

  --success: #1d7a4e;
  --success-50: #ebf6f0;
  --warning: #9a5a06;
  --warning-50: #fdf4e3;
  --danger: #b42318;
  --danger-50: #fdefee;
  --info: #23589f;
  --info-50: #edf2fa;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(28, 25, 21, .05);
  --shadow-2: 0 1px 2px rgba(28, 25, 21, .04), 0 8px 24px -10px rgba(28, 25, 21, .12);
  --shadow-3: 0 2px 4px rgba(28, 25, 21, .05), 0 18px 40px -16px rgba(28, 25, 21, .22);
  --focus: 0 0 0 3px rgba(155, 27, 33, .18);

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

  --sidebar-w: 248px;
  --topbar-h: 56px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.012em; color: var(--text); }
h1 { font-size: clamp(22px, 2.6vw, 28px); }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; }
h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: var(--brand-100); }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* ---------- Utilities ---------- */
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 10px); }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.mono { font-family: var(--mono); font-size: .94em; letter-spacing: .01em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
[hidden] { display: none !important; }

.grid { display: grid; gap: var(--gap, 16px); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.grid-main-aside { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 900px) { .grid-main-aside { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border: 1px solid var(--btn-bd); border-radius: 8px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 560; font-size: 14px; white-space: nowrap;
  cursor: pointer; user-select: none;
  box-shadow: var(--shadow-1);
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { --btn-bg: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand-700); }
.btn-primary:hover { --btn-bg: var(--brand-700); }
.btn-danger { --btn-fg: var(--danger); --btn-bd: #ecc4c0; }
.btn-danger:hover { --btn-bg: var(--danger-50); }
.btn-danger-solid { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: #93190f; }
.btn-danger-solid:hover { --btn-bg: #93190f; }
.btn-ghost { --btn-bd: transparent; --btn-bg: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { --btn-bg: var(--surface-3); color: var(--text); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; gap: 6px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--btn-fg) transparent var(--btn-fg) transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text); }
.label .opt { font-weight: 450; color: var(--text-3); }
.hint { font-size: 12.5px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8379' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder, .textarea::placeholder { color: #a9a29a; }
.input:hover, .select:hover, .textarea:hover { border-color: #c4bdb2; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.input-lg { height: 48px; font-size: 16px; }
.input-code { font-family: var(--mono); letter-spacing: .06em; }
.form-grid { display: grid; gap: 16px 18px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } .form-grid > * { grid-column: 1 / -1; } }

.input-group { position: relative; }
.input-group .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-group .input { padding-left: 36px; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked { background: var(--success); }
.switch input:checked::after { transform: translateX(14px); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
@media (max-width: 600px) { .card-pad, .card-body { padding: 16px; } .card-head { padding: 14px 16px; } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid; font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert-danger { background: var(--danger-50); border-color: #f1cdca; color: #8a1c13; }
.alert-success { background: var(--success-50); border-color: #c7e6d5; color: #145a39; }
.alert-warning { background: var(--warning-50); border-color: #f0dcb2; color: #774504; }
.alert-info { background: var(--info-50); border-color: #cddbf0; color: #1c467f; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-50); color: var(--success); }
.badge-warning { background: var(--warning-50); color: var(--warning); }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-brand { background: var(--brand-50); color: var(--brand); }

/* ---------- Tables (become cards on phones) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr.is-link:hover td { background: #fcfbfa; }
.table .cell-strong { font-weight: 600; color: var(--text); }
.table .cell-actions { text-align: right; white-space: nowrap; }
@media (max-width: 760px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: 4px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; }
  .table td::before { content: attr(data-label); font-size: 12px; color: var(--text-3); font-weight: 550; flex: none; }
  .table td.cell-primary { display: block; padding-bottom: 6px; }
  .table td.cell-primary::before { display: none; }
  .table .cell-actions { justify-content: flex-end; padding-top: 8px; }
  .table .cell-actions::before { display: none; }
}

/* ---------- Segmented filters ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 99px; background: var(--surface);
  font-size: 13px; font-weight: 560; color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip .count { font-size: 11.5px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.chip[aria-pressed="true"] .count { color: #d9d3cb; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font-weight: 560; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }

/* ---------- Stats ---------- */
.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 8px; }
.stat-value { margin-top: 6px; font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-note { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.stat a { color: inherit; }
a.card { color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 44px; align-items: center; gap: 12px; font-size: 13px; }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; min-width: 2px; }
.bar-row .num { text-align: right; color: var(--text-2); }

.columns { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.column { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.column-bar { width: 100%; max-width: 42px; background: var(--brand-100); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.column:last-child .column-bar { background: var(--brand); }
.column-label { font-size: 11.5px; color: var(--text-3); }
.column-value { font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .icon { width: 28px; height: 28px; margin: 0 auto 10px; color: var(--text-3); }
.empty h3 { margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, #f8f7f4 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-row td { padding: 18px 16px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--text); color: #f4f1ec; border-radius: var(--r); box-shadow: var(--shadow-3); font-size: 13.5px; animation: toast-in .2s ease-out; }
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: #7fd3a7; }
.toast-error .icon { color: #f3a39b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 600px) { .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; } }

/* ---------- Inline confirmation ---------- */
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--danger-50); border: 1px solid #f1cdca; font-size: 13.5px; color: #8a1c13; }
.confirm .grow { min-width: 180px; }

/* ---------- Code chip ---------- */
.code-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); font-family: var(--mono); font-size: 13px; }
.code-chip .btn { height: 26px; }
.code-big { font-family: var(--mono); font-size: clamp(20px, 5vw, 26px); font-weight: 650; letter-spacing: .04em; padding: 14px 18px; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--border-strong); text-align: center; word-break: break-all; }

/* =========================================================================
   Public portal
   ========================================================================= */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.public-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; }
.public-header::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--brand) 0 70%, var(--gold) 70%); }
.public-header .inner { max-width: 1040px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand-logo { object-fit: contain; flex: none; }
img.avatar { object-fit: cover; background: var(--surface-3); }
.brand-name { font-weight: 680; font-size: 15px; letter-spacing: -.01em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.public-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 40px 20px 64px; }
.public-main.narrow { max-width: 720px; }
.public-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2); }
.footer-grid { max-width: 1040px; margin: 0 auto; padding: 36px 20px 28px; display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; gap: 28px 40px; }
.footer-grid p { max-width: 42ch; }
.footer-grid a { color: var(--text-2); }
.footer-grid a:hover { color: var(--brand); }
.footer-bottom { max-width: 1040px; margin: 0 auto; padding: 16px 20px 24px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; font-size: 12px; color: var(--text-3); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 22px; padding-top: 28px; } }
@media (max-width: 600px) { .public-main { padding: 24px 16px 48px; } .brand-sub { display: none; } }

.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; margin-bottom: 36px; }
.hero h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.025em; line-height: 1.1; }
.hero p.lead { margin-top: 14px; font-size: 16px; color: var(--text-2); max-width: 46ch; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; gap: 20px; } }


.steps { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-3); margin-bottom: 18px; flex-wrap: wrap; }
.steps .done { color: var(--success); }
.steps .current { color: var(--text); font-weight: 600; }
.steps .sep { width: 18px; height: 1px; background: var(--border-strong); }

.section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.section-title h2 { font-size: 15px; }
.section-title .eyebrow { margin-left: auto; }
.form-section + .form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }

.consent { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.consent summary { cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.consent summary::-webkit-details-marker { display: none; }
.consent summary .icon { transition: transform .15s; }
.consent[open] summary .icon { transform: rotate(90deg); }
.consent .body { padding: 0 14px 14px; font-size: 13px; color: var(--text-2); }
.consent ol { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Exam ---------- */
.exam-bar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.exam-bar .inner { max-width: 820px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.exam-bar .title { font-weight: 650; font-size: 14px; }
.timer { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; background: var(--surface-3); font-variant-numeric: tabular-nums; font-weight: 650; font-size: 15px; }
.timer.is-low { background: var(--danger-50); color: var(--danger); }
.progress { height: 4px; background: var(--surface-3); }
.progress > span { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.exam-main { max-width: 820px; margin: 0 auto; padding: 28px 20px 120px; }
.question { padding: 20px 22px; }
.question + .question { border-top: 1px solid var(--border); }
.question-head { display: flex; gap: 12px; margin-bottom: 14px; }
.question-no { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.question.is-answered .question-no { background: var(--brand-50); color: var(--brand); }
.question-text { font-size: 15.5px; font-weight: 560; padding-top: 3px; }
.options { display: grid; gap: 8px; padding-left: 40px; }
@media (max-width: 600px) { .options { padding-left: 0; } .question { padding: 18px 16px; } }
.option { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s; background: var(--surface); }
.option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.option input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); flex: none; cursor: pointer; }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.option.is-checked { border-color: var(--brand); background: var(--brand-50); }
.exam-footer { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.exam-footer .inner { max-width: 820px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.save-state { font-size: 12.5px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.page-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.page-dot { min-width: 32px; height: 32px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2); font-variant-numeric: tabular-nums; }
.page-dot.is-current { border-color: var(--text); background: var(--text); color: #fff; }
.page-dot.is-complete { border-color: #c7e6d5; background: var(--success-50); color: var(--success); }

.result-hero { text-align: center; padding: 36px 24px; }
.result-hero .mark { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; background: var(--success-50); color: var(--success); }
.result-hero .mark .icon { width: 26px; height: 26px; }
.result-hero p { margin-top: 8px; color: var(--text-2); max-width: 48ch; margin-left: auto; margin-right: auto; }

/* =========================================================================
   HRDesk shell
   ========================================================================= */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.sidebar-brand img { width: 32px; height: 32px; }
.sidebar-brand .name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.sidebar-brand .name span { color: var(--gold); }
.sidebar-brand .sub { font-size: 11.5px; color: var(--text-3); }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 560; font-size: 14px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand); }
.nav a[aria-current="page"] .icon { color: var(--brand); }
.nav .icon { color: var(--text-3); }
.sidebar-user { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold-50); color: #8a6420; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; background: var(--brand-50); color: var(--brand); }
.who-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--text); border-radius: 8px; padding: 4px; margin: -4px; }
.who-link:hover { background: var(--surface-3); text-decoration: none; }
.who-link[aria-current="page"] { background: var(--brand-50); }
.topbar-user { margin-left: auto; }
.topbar-user .avatar { width: 30px; height: 30px; font-size: 12px; }
.sidebar-user .who { min-width: 0; flex: 1; }
.sidebar-user .who strong { display: block; font-size: 13.5px; }
.sidebar-user .who span { font-size: 12px; color: var(--text-3); }

.topbar { display: none; }
.content { margin-left: var(--sidebar-w); min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; padding: 28px 32px 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 22px; }
.page-head p { margin-top: 4px; color: var(--text-2); }
.breadcrumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.breadcrumb:hover { color: var(--text); text-decoration: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-group { flex: 1 1 240px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

.scrim { display: none; }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-3); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(28, 25, 21, .35); }
  .topbar { display: flex; position: sticky; top: 0; z-index: 25; height: var(--topbar-h); align-items: center; gap: 10px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar img { width: 28px; height: 28px; }
  .topbar .name { font-weight: 700; }
  .topbar .name span { color: var(--gold); }
  .content { margin-left: 0; }
  .page { padding: 20px 16px 48px; }
}

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-side { background: #1f1714; color: #f3ede6; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 56px solid rgba(155, 27, 33, .35); }
.auth-side h1 { color: #fff; font-size: 30px; max-width: 16ch; }
.auth-side p { color: #cbbfb3; margin-top: 12px; max-width: 40ch; }
.auth-side .brand-name { color: #fff; }
.auth-side .brand-sub { color: #a99c90; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 360px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- Applicant profile ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; } }
.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 600px) { .score-grid { grid-template-columns: 1fr; } }
.score { border: 1px solid var(--border); border-radius: var(--r); padding: 14px; background: var(--surface-2); }
.score .value { font-size: 24px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.score .of { font-size: 13px; color: var(--text-3); font-weight: 500; }
.score.is-total { background: var(--surface); border-color: var(--border-strong); }
.mbti-letters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 600px) { .mbti-letters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pair { border: 1px solid var(--border); border-radius: var(--r); padding: 12px; background: var(--surface-2); font-size: 12.5px; }
.pair-row { display: flex; justify-content: space-between; gap: 8px; }
.pair-row strong { font-size: 15px; }
.pair-row .win { color: var(--brand); }
.pair-track { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin: 8px 0 6px; }
.pair-track span:first-child { background: var(--brand); }
.pair-track span:last-child { background: #d9c9b3; }
.type-mark { font-family: var(--mono); font-weight: 700; font-size: 22px; letter-spacing: .08em; color: var(--brand); }
.trait-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--text-2); }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 10px 0; position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 6px; top: 24px; bottom: -10px; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); margin-top: 4px; }
.timeline-dot.is-success { border-color: var(--success); background: var(--success-50); }
.timeline-dot.is-warning { border-color: var(--warning); background: var(--warning-50); }
.timeline-dot.is-info { border-color: var(--info); background: var(--info-50); }

@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .content { margin: 0; }
  body { background: #fff; }
}

/* ---------- Image cropper ---------- */
.cropper { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.cropper-stage {
  position: relative; width: min(280px, 100%); aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--r);
  cursor: grab; touch-action: none; user-select: none;
  background-color: #fff;
  background-image: linear-gradient(45deg, #ece8e2 25%, transparent 25%), linear-gradient(-45deg, #ece8e2 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #ece8e2 75%), linear-gradient(-45deg, transparent 75%, #ece8e2 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.cropper-stage.is-dragging { cursor: grabbing; }
.cropper-image { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.cropper-frame { position: absolute; inset: 0; pointer-events: none; box-shadow: 0 0 0 2px rgba(255,255,255,.9) inset; }
.cropper-frame.is-circle { border-radius: 50%; box-shadow: 0 0 0 9999px rgba(28,25,21,.45), 0 0 0 2px rgba(255,255,255,.9) inset; }
.cropper-frame.is-square { border-radius: 10px; }
.cropper-zoom { display: flex; align-items: center; gap: 10px; width: min(280px, 100%); color: var(--text-3); }
.cropper-zoom input { flex: 1; accent-color: var(--brand); }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2); text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-50); }
.dropzone .icon { width: 26px; height: 26px; color: var(--text-3); }
.logo-preview { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.logo-preview img { width: 40px; height: 40px; object-fit: contain; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }

/* ---------- Landing page ---------- */
.landing-hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(155, 27, 33, .07), transparent 60%),
    linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}
.landing-hero::after {
  content: ""; position: absolute; right: -140px; top: -160px; width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(155, 27, 33, .10); box-shadow: 0 0 0 60px rgba(155, 27, 33, .025), 0 0 0 120px rgba(155, 27, 33, .02);
  pointer-events: none;
}
.landing-inner { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 64px 20px 72px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-1); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-50); }
.hero-copy h1 { margin-top: 18px; font-size: clamp(32px, 4.6vw, 48px); line-height: 1.05; letter-spacing: -.03em; }
.hero-copy .lead { margin-top: 16px; font-size: 16.5px; line-height: 1.6; color: var(--text-2); max-width: 48ch; }
.hero-actions { margin-top: 28px; }
.hero-checks { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13.5px; color: var(--text-2); }
.hero-checks li { display: inline-flex; align-items: center; gap: 7px; }
.hero-checks .icon { color: var(--success); }

.journey { position: relative; }
.journey-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-3); padding: 22px; }
.journey-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.journey-steps { list-style: none; margin: 0; padding: 8px 0; }
.journey-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 14px; padding: 12px 0; position: relative; }
.journey-steps li:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 42px; bottom: -6px; width: 2px; background: var(--border); }
.journey-steps strong { display: block; font-size: 14px; }
.journey-steps span:not(.journey-dot) { font-size: 13px; color: var(--text-2); }
.journey-dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border); }
.is-done .journey-dot { background: var(--success-50); color: var(--success); border-color: #c7e6d5; }
.is-current .journey-dot { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.journey-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.footer-badge { width: 96px; height: auto; mix-blend-mode: multiply; }

.landing-main { padding-top: 56px; }
.section-head { margin-bottom: 18px; }
.section-head h2 { font-size: 22px; letter-spacing: -.02em; margin-top: 6px; }
.prep { padding: 22px; }
.prep h3 { margin: 14px 0 6px; }
.prep p { font-size: 13.5px; color: var(--text-2); }
.prep-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand); }
.faq-section { margin-top: 56px; }
.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.faq details + details { border-top: 1px solid var(--border); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--text-3); transition: transform .15s; flex: none; }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { padding: 0 20px 18px; color: var(--text-2); max-width: 70ch; }

@media (max-width: 860px) {
  .landing-inner { grid-template-columns: 1fr; gap: 40px; padding: 40px 16px 56px; }
}
@media (max-width: 600px) {
  .hero-actions .btn { flex: 1 1 100%; }
  .landing-main { padding-top: 40px; }
}

/* Empty message containers take no space */
[id$="-alert"]:empty { display: none; }

/* ---------- Searchable select (assets/js/combobox.js) ---------- */
.combo { position: relative; width: 100%; min-width: 0; }
.cluster > .combo, .toolbar > .combo { width: auto; flex: 1 1 170px; }
.combo-input { padding-right: 34px; cursor: text; text-overflow: ellipsis; }
.combo-caret { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); cursor: pointer; display: flex; }
.combo-input[aria-expanded="true"] + .combo-caret { transform: translateY(-50%) rotate(180deg); }
.combo-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-3);
  min-width: 200px;
}
.combo-option { padding: 8px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; line-height: 1.35; }
.combo-option.is-active { background: var(--surface-3); }
.combo-option[aria-selected="true"] { color: var(--brand); font-weight: 600; }
.combo-option mark { background: var(--brand-50); color: inherit; border-radius: 2px; padding: 0 1px; }
.combo-group { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.combo-empty { padding: 10px; font-size: 13.5px; color: var(--text-3); }

/* ---------- Row selection + bulk actions (App.BulkSelect) ---------- */
.table .cell-check { width: 44px; padding-right: 0; }
.row-check { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; margin: 0; vertical-align: middle; }
.table tbody tr.is-selected td { background: var(--brand-50); }
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: #fffaf3; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.bulk-bar[hidden] { display: none; }
.bulk-count { font-weight: 650; font-size: 13.5px; margin-right: auto; }
.bulk-bar .combo { flex: none; width: 220px; }
.bulk-bar [data-bulk-actions] { flex-wrap: nowrap; }
.table tbody tr { -webkit-tap-highlight-color: transparent; }
.table tbody tr.is-selected { background: var(--brand-50); }
@media (max-width: 760px) {
  .table td.cell-check { display: flex; justify-content: flex-start; padding-bottom: 4px; width: 100%; }
  .table tbody tr.is-selected td { background: transparent; }
  .table td.cell-check::before { content: none; }
  .bulk-count { width: 100%; }
  .bulk-bar [data-bulk-actions] { flex-wrap: wrap; }
  .bulk-bar .combo { flex: 1 1 160px; width: auto; }
}

/* ---------- Formatted text (RichText) and its editor (assets/js/rich-editor.js) ---------- */
.rich-text > * + * { margin-top: .6em; }
.rich-text p { margin: 0; }
.rich-text ul, .rich-text ol { margin: 0; padding-left: 1.3em; }
.rich-text li + li { margin-top: .2em; }
.rich-text a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.footer-grid .rich-text { max-width: 42ch; }

.rte { border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.rte:hover { border-color: #c4bdb2; }
.rte.is-focused { border-color: var(--brand); box-shadow: var(--focus); }
.rte.is-over { border-color: var(--danger); }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 8px 8px 0 0; }
.rte-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; }
.rte-btn:hover { background: var(--surface-3); color: var(--text); }
.rte-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.rte-btn[aria-pressed="true"] { background: var(--brand-50); color: var(--brand); }
.rte-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rte-linkbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: #fffaf3; color: var(--text-3); }
.rte-linkbar[hidden] { display: none; }
.rte-linkbar .input { height: 32px; flex: 1; min-width: 0; }
.rte-content { min-height: 96px; max-height: 320px; overflow-y: auto; padding: 10px 12px; font-size: 14.5px; line-height: 1.6; color: var(--text); outline: none; }
.rte-foot { display: flex; justify-content: flex-end; padding: 0 10px 6px; }
.rte-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rte.is-over .rte-count { color: var(--danger); font-weight: 600; }
@media (max-width: 600px) { .rte-linkbar { flex-wrap: wrap; } .rte-linkbar .input { flex-basis: 100%; } }
.rte-content:focus, .rte-content:focus-visible { outline: none; box-shadow: none; }

/* ---------- "Customize" panels: pick and order items (order-picker.js) ---------- */
.layout-panel { margin: 0 16px 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.layout-panel[hidden] { display: none; }
.layout-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.layout-panel-head h2 { font-size: 14px; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.order-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.order-item[draggable="true"] { cursor: grab; }
.order-item.is-off { background: transparent; border-style: dashed; color: var(--text-3); }
.order-item.is-dragging { opacity: .45; }
.order-item.is-drop-target { border-color: var(--brand); box-shadow: var(--focus); }
.order-grip { width: 16px; color: var(--text-3); display: flex; flex: none; }
.order-label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 13.5px; cursor: pointer; }
.layout-panel-foot { justify-content: flex-end; margin-top: 12px; --gap: 8px; }
@media (max-width: 600px) { .layout-panel { margin: 0 12px 12px; } .layout-panel-head { flex-direction: column; } }

/* ---------- Active / Inactive status (App.statusPill) — the same everywhere ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px;
  border-radius: 99px; font: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s;
}
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.is-active { background: var(--success-50); color: var(--success); }
.status-pill.is-inactive { background: var(--surface-3); color: var(--text-3); }
.status-pill.is-inactive::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
button.status-pill { cursor: pointer; }
button.status-pill.is-active:hover { border-color: #b9dcc9; background: #e1f1e8; }
button.status-pill.is-inactive:hover { border-color: var(--border-strong); color: var(--text-2); }
button.status-pill:focus-visible { outline: none; box-shadow: var(--focus); }
button.status-pill[aria-busy="true"] { opacity: .6; cursor: progress; }

/* ---------- Drop-down menu (export) ---------- */
.menu-wrap { position: relative; display: inline-flex; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 200px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-3);
}
.menu[hidden] { display: none; }
.menu [role="menuitem"] {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer;
}
.menu [role="menuitem"]:hover, .menu [role="menuitem"]:focus-visible { background: var(--surface-3); outline: none; }
.menu [role="menuitem"] .icon { color: var(--text-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Import panel ---------- */
.import-panel { margin-bottom: 20px; }
.import-steps { margin: 0; padding-left: 1.2em; color: var(--text-2); display: grid; gap: 4px; }
.import-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.import-table { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r); }
.import-table .table td:first-child, .import-table .table th:first-child { width: 70px; }

/* ---------- Dashboard: cards and charts in the user's order ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; grid-auto-flow: row dense; align-items: stretch; }
.dash-grid > .dash-stat { grid-column: span 2; }
.dash-grid > .dash-wide { grid-column: span 4; }
.dash-grid > .dash-narrow { grid-column: span 2; }
.dash-grid > .dash-full { grid-column: 1 / -1; }
#dashboard-capture .layout-panel { margin: 0 0 20px; background: var(--surface); }
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid > .dash-stat { grid-column: span 1; }
  .dash-grid > .dash-wide, .dash-grid > .dash-narrow { grid-column: 1 / -1; }
}
@media (max-width: 420px) { .dash-grid > .dash-stat { grid-column: 1 / -1; } }
/* Picture export (html2canvas) clips text inside overflow:hidden boxes: let it show */
.is-exporting .truncate { overflow: visible; text-overflow: clip; }

/* ---------- Sortable headers (table-sort.js) and headers that stay visible ---------- */
.th-sort {
  display: inline-flex; align-items: center; gap: 4px; margin: -4px -6px; padding: 4px 6px; border: 0; border-radius: 6px;
  background: transparent; font: inherit; color: inherit; cursor: pointer; white-space: nowrap;
}
.th-sort:hover { color: var(--text); background: var(--surface-3); }
.th-sort:focus-visible { outline: none; box-shadow: var(--focus); }
.th-sort .sort-icon { opacity: 0; transition: transform .15s, opacity .15s; }
.th-sort:hover .sort-icon { opacity: .45; }
.th-sort.is-active { color: var(--text); }
.th-sort.is-active .sort-icon { opacity: 1; color: var(--brand); }
.th-sort.is-asc .sort-icon { transform: rotate(180deg); }
/* On a computer the table box fits the screen and scrolls inside, so the header row stays in view */
@media (min-width: 761px) {
  .table-wrap { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
  .table thead th { box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; }
  .table thead th.cell-check { z-index: 2; }
  /* Controls scrolled or tabbed to stop below the pinned header row, not under it */
  .table tbody a, .table tbody button, .table tbody input { scroll-margin-top: 52px; }
}
/* Phones show rows as cards (no header row): sort with a picker instead */
.sort-mobile { display: none; }
@media (max-width: 760px) {
  .sort-mobile { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
  .sort-mobile .select { height: 36px; flex: 1; }
}

/* Registration done: exam codes */
.exam-code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }

/* Applicant page: emails sent; Data tools: backups and tasks */
.email-list, .data-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.email-list li + li, .data-list li + li { padding-top: 12px; border-top: 1px solid var(--border); }

/* Maintenance: how the form orders the list */
.order-mode .chip { height: 30px; padding: 0 12px; }
.order-mode [hidden] { display: none; }
.email-current { display: grid; gap: 4px; justify-items: start; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.email-stale { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; color: var(--text-3); }
.email-stale .icon { flex: none; margin-top: 1px; }

/* Dashboard: updates by itself */
.live-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.live-note:not(:empty)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-50); }

/* Data tools (IT account): load the old database, clear, backups */
.task-card { margin-bottom: 20px; }
.task-card[hidden] { display: none; }
.task-card .card-head h2 .icon { color: var(--brand); }
.task-spinner { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.task-log { list-style: none; margin: 0; padding: 10px 12px; max-height: 260px; overflow: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-log:empty { display: none; }
.preview-box { display: grid; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.data-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.restore-confirm { flex-basis: 100%; display: grid; gap: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--danger-50); border: 1px solid #f1cdca; color: #8a1c13; }
.restore-confirm .input { flex: 1 1 110px; width: auto; min-width: 0; }
.input-sm { height: 32px; font-size: 13px; }
.confirm-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.confirm-row .field { flex: 1 1 200px; max-width: 280px; }
.dropzone.is-disabled { pointer-events: none; opacity: .55; }
