/* Talent Assessment AI — internal tool, single-page styles.
   System font stack, calm palette, generous whitespace, no JS framework. */

:root {
  --bg: #f7f7f5;
  --bg-card: #ffffff;
  --bg-elev: #fbfbf9;
  --border: #e5e3dc;
  --text: #1d1d1f;
  --text-muted: #6a6a72;
  --accent: #2257ff;
  --accent-hover: #1c47d6;
  --strong-hire: #11824a;
  --recommend: #2257ff;
  --borderline: #b67c00;
  --fast-reject: #b3261e;
  --pill-bg: #f1efe9;
  --pill-text: #4a4a52;
  --code-bg: #f4f3ef;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.04), 0 4px 16px rgba(20, 20, 30, 0.05);
}

* { box-sizing: border-box; }

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── topbar ───────────────────────────────────────────────── */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 32px;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 16px; }
.brand .logo { font-size: 20px; color: var(--accent); }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--text-muted); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 6px; }
.nav a:hover { background: var(--bg-elev); color: var(--text); }

/* ── hero / cards ─────────────────────────────────────────── */
.hero { margin-bottom: 24px; }
.hero h1 { font-size: 28px; margin: 0 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.lede { color: var(--text-muted); margin: 0; max-width: 720px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.card.no-padding { padding: 0; overflow: hidden; }
.card h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; letter-spacing: -0.005em; }
.card.warn { background: #fff7f5; border-color: #f0d3cf; }
.card.warning-card { background: #fbf0d9; border-color: #f0dca5; }
.card.warning-card h2 { color: #6c4d00; }

/* X-ray view ────────────────────────────────────────────── */
.xray-header h1 { font-size: 22px; margin: 8px 0; }
.xray-task-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 14px;
}
.xray-task-tabs .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.xray-sheet { padding: 0; overflow: hidden; }
.xray-sheet-header { padding: 16px 22px; border-bottom: 1px solid var(--border); }
.xray-sheet-header h2 { margin: 0 0 4px; }
.xray-sheet-meta { font-size: 12px; }
.xray-cells > summary,
.xray-dedupe > summary {
  padding: 12px 22px;
  cursor: pointer;
  user-select: none;
  border-top: 1px solid var(--border);
  font-weight: 500;
  font-size: 14px;
}
.xray-cells > summary:hover,
.xray-dedupe > summary:hover { background: var(--bg-elev); }
.xray-cells-body {
  padding: 0 22px 18px;
  overflow-x: auto;
}
.xray-cell-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.xray-cell-table th,
.xray-cell-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.xray-cell-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.xray-cell-value {
  max-width: 480px;
  word-break: break-word;
  white-space: pre-wrap;
}
.trunc-flag {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10px;
  margin-left: 4px;
}
.dedupe-block {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.dedupe-block:last-child { border-bottom: none; }
.dedupe-values { margin-top: 6px; }
.dedupe-values > summary { cursor: pointer; padding: 4px 0; }
.card.empty { text-align: center; color: var(--text-muted); padding: 48px 24px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ── form ────────────────────────────────────────────────── */
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 20px; }
@media (max-width: 720px) { .form .row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.label-text { font-weight: 500; font-size: 13px; color: var(--text); }
.field input, .field select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { font-size: 12px; color: var(--text-muted); }

.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 20px;
}
.dropzone input { display: none; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #f5f7ff; }
.dropzone.has-file { border-color: var(--strong-hire); background: #f1fbf5; border-style: solid; }
.dropzone-icon { font-size: 28px; color: var(--text-muted); margin-bottom: 8px; }
.dropzone-text strong { display: block; font-size: 15px; }
.dropzone-text span { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.dropzone-filename { margin-top: 12px; font-size: 13px; font-weight: 500; color: var(--strong-hire); }

.actions { display: flex; align-items: center; gap: 16px; }
.note { color: var(--text-muted); font-size: 13px; }

.btn {
  display: inline-block;
  background: #fff;
  color: var(--text);
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-elev); border-color: #d4d2c8; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--bg-elev); border-color: var(--border); }

/* ── Library-edit: in-page help card + Insert-template button ── */
.help-card .lede { margin: 0 0 8px; }
.help-card-body p { margin: 4px 0; }
.help-card-body p strong { font-weight: 600; }
.help-list {
  margin: 4px 0 8px;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help-list .muted {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.help-examples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 6px 0 8px;
}
@media (max-width: 820px) {
  .help-examples { grid-template-columns: 1fr; }
}
.help-example {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  margin: 0;
  border: 1px solid var(--border);
  background: #fff;
}
.help-example.bad  { border-left: 3px solid #c47c7c; }
.help-example.good { border-left: 3px solid #6f9a6f; }

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── overlay spinner ─────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 20, 30, 0.35);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
/* The element-level `hidden` attribute would normally apply
   `display: none` via the UA stylesheet, but our `.overlay`
   selector has the same specificity and overrides it. Restore
   the intended behavior so the spinner stays out of sight until
   the form is actually submitted. */
.overlay[hidden] { display: none; }
.spinner-card {
  background: #fff;
  padding: 28px 32px;
  border-radius: 12px;
  display: flex; align-items: center; gap: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
  max-width: 520px;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bg-elev);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text strong { display: block; font-size: 15px; margin-bottom: 4px; }
.spinner-text span { color: var(--text-muted); font-size: 13px; }

/* Progress card — step label + bar + elapsed timer */
.spinner-card.progress-card { min-width: 460px; max-width: 560px; }
.progress-bar {
  height: 6px;
  background: var(--pill-bg);
  border-radius: 999px;
  margin: 10px 0 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease-out;
}
.progress-meta {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}
.progress-error {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fbe2e0;
  border: 1px solid #f0c1bd;
  border-radius: 8px;
  color: var(--fast-reject);
  font-size: 13px;
}
.progress-error a { color: var(--fast-reject); font-weight: 500; }
.progress-error .error-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.progress-error .error-actions .btn.primary { color: #fff; }
.progress-error .error-actions .btn { background: #fff; }
.progress-error .error-actions .btn.primary { background: var(--accent); border-color: var(--accent); }

/* ── report header ───────────────────────────────────────── */
.report-header { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 800px) {
  .report-header { grid-template-columns: 1fr 360px; align-items: start; }
}
.report-title h1 { font-size: 24px; margin: 0 0 8px; font-weight: 600; }
.meta-line { display: flex; gap: 14px; margin-bottom: 12px; }
.back-link { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--accent); }
.report-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
}
.tag.small { font-size: 11px; padding: 2px 8px; }

/* Ensemble status pill — color-coded by agreement between LLM runs */
.ensemble-tag { cursor: help; }
.ensemble-high     { background: #e0f5ea; color: var(--strong-hire); }
.ensemble-moderate { background: #fbf0d9; color: var(--borderline); }
.ensemble-low      { background: #fbe2e0; color: var(--fast-reject); }
.ensemble-fallback { background: #e6ecff; color: var(--recommend); }

.report-summary { display: flex; flex-direction: column; gap: 16px; }

.rec-badge {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  text-align: center;
}
.rec-badge.rec-strong-hire { background: #e0f5ea; color: var(--strong-hire); }
.rec-badge.rec-recommend { background: #e6ecff; color: var(--recommend); }
.rec-badge.rec-borderline { background: #fbf0d9; color: var(--borderline); }
.rec-badge.rec-fast-reject { background: #fbe2e0; color: var(--fast-reject); }

.gauges { display: flex; flex-direction: column; gap: 10px; }
.gauge { display: grid; grid-template-columns: 110px 1fr 80px; align-items: center; gap: 10px; }
.gauge-label { font-size: 12px; color: var(--text-muted); }
.gauge-bar { height: 6px; background: var(--pill-bg); border-radius: 999px; overflow: hidden; }
.gauge-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.gauge-fill.confidence { background: var(--borderline); }
.gauge-value { font-size: 13px; font-weight: 500; text-align: right; }
.gauge-value .muted { font-weight: 400; color: var(--text-muted); }

.downloads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.downloads .btn {
  text-align: center;
  white-space: nowrap;
}
/* Primary submission download spans the full width; secondary `.md` and
   `.json` buttons live side-by-side below — keeps the right column compact
   without truncating any text. */
.downloads .btn.primary {
  grid-column: 1 / -1;
}

/* ── summary & bullets ───────────────────────────────────── */
.summary { margin: 0; }
.bullet-list { margin: 0; padding-left: 18px; }
.bullet-list li { margin-bottom: 4px; }
.bullet-list.compact { padding-left: 16px; }
.muted { color: var(--text-muted); }

/* ── per-task details ────────────────────────────────────── */
.task {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  background: var(--bg-elev);
}
.task[open] { background: #fff; }
.task summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 70px 1fr 72px;
  align-items: center;
  gap: 14px;
  user-select: none;
}
.task summary::-webkit-details-marker { display: none; }
.task-id { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; color: var(--accent); }
.task-title { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-score {
  text-align: center;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pill-bg);
  font-size: 13px;
}
.task-score.score-0, .task-score.score-1 { background: #fbe2e0; color: var(--fast-reject); }
.task-score.score-2 { background: #fbf0d9; color: var(--borderline); }
.task-score.score-3 { background: #e6ecff; color: var(--recommend); }
.task-score.score-4, .task-score.score-5 { background: #e0f5ea; color: var(--strong-hire); }

.task-body { padding: 0 16px 16px; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.task-meta .task-xray-link { margin-left: auto; font-size: 12px; padding: 4px 10px; }

/* ── X-ray modal (per-task drill-down inside report page) ── */
.xray-modal {
  width: min(1100px, 95vw);
  max-width: 95vw;
  max-height: 90vh;
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.xray-modal::backdrop {
  background: rgba(20, 20, 30, 0.45);
  backdrop-filter: blur(2px);
}
.xray-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.xray-modal-header h2 { margin: 0; font-size: 16px; }
.xray-modal-actions { display: flex; gap: 8px; }
.xray-modal-body {
  padding: 18px 22px;
  max-height: calc(90vh - 56px);
  overflow-y: auto;
}
.xray-modal-body .xray-sheet { margin-bottom: 14px; box-shadow: none; }
.xray-modal-body .xray-sheet:last-child { margin-bottom: 0; }
.meta-pill {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-weight: 500;
}
.meta-pill.ok { background: #e0f5ea; color: var(--strong-hire); }
.meta-pill.warn { background: #fbf0d9; color: var(--borderline); }
.meta-pill.alt { background: #e6ecff; color: var(--recommend); }

/* Content-status banner — shown when a task wasn't readable. The whole
   task card gets a left-border tint so it stands out in the long list. */
.task.task-status-missing,
.task.task-status-unreadable {
  border-left: 3px solid var(--borderline);
}
.content-status-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: #fbf0d9;
  border: 1px solid #f0dca5;
  color: #6c4d00;
}
.content-status-banner.content-status-unreadable {
  background: #fbe2e0;
  border-color: #f0c1bd;
  color: #5e1612;
}

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.kv:first-of-type { border-top: none; }
.kv .k { font-size: 12px; color: var(--text-muted); font-weight: 500; padding-top: 2px; }
.formula {
  background: var(--code-bg);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}

/* ── feedback section ────────────────────────────────────── */
.feedback { background: #fbfaf6; }
.feedback-header { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.feedback-header h2 { margin: 0; }
.feedback-tone {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-text);
}
.feedback-tone.tone-encouraging { background: #e0f5ea; color: var(--strong-hire); }
.feedback-tone.tone-neutral { background: #e6ecff; color: var(--recommend); }
.feedback-tone.tone-regretful { background: #fbe2e0; color: var(--fast-reject); }
.feedback-body { margin-top: 16px; }
.feedback-body p { margin: 0 0 10px; }
.feedback-body ul { padding-left: 20px; margin: 0 0 12px; }

/* ── history table ───────────────────────────────────────── */
/* The parent `.card.no-padding` is set to allow horizontal scrolling as a
   safety net: if a candidate name is still long after extraction (or on
   narrow viewports), the table scrolls instead of clipping right-hand
   columns like Rubric and Evaluated. */
.card.no-padding:has(> .history-table) { overflow-x: auto; }
.history-table {
  width: 100%;
  min-width: 760px;  /* keeps all 7 cols readable; below this we scroll */
  border-collapse: collapse;
  font-size: 14px;
}
.history-table th, .history-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.history-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.history-table tbody tr:hover { background: var(--bg-elev); }
.history-table tr.clickable-row { cursor: pointer; }
.candidate-name {
  font-weight: 500;
  /* Cap the candidate cell so a stubbornly-long name truncates with … rather
     than pushing every other column off-screen. */
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.candidate-name a {
  color: var(--text);
  text-decoration: none;
}
.candidate-name a:hover { color: var(--accent); }
.rec-pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 500;
}
.rec-pill.rec-strong-hire { background: #e0f5ea; color: var(--strong-hire); }
.rec-pill.rec-recommend { background: #e6ecff; color: var(--recommend); }
.rec-pill.rec-borderline { background: #fbf0d9; color: var(--borderline); }
.rec-pill.rec-fast-reject { background: #fbe2e0; color: var(--fast-reject); }
.mini-bar { width: 80px; height: 4px; background: var(--pill-bg); border-radius: 999px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.mini-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.actions-col { white-space: nowrap; }
.actions-col .btn { margin-left: 4px; }

/* ── error page ──────────────────────────────────────────── */
.error-card h1 { color: var(--fast-reject); font-size: 22px; margin: 0 0 8px; }
.error-detail {
  background: #fbe2e0;
  border: 1px solid #f0c1bd;
  border-radius: 8px;
  padding: 16px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0 20px;
  color: #5e1612;
}

/* ── library ─────────────────────────────────────────────── */
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.hero-row > div { flex: 1; }

.library-group { padding: 0; overflow: hidden; }
.library-group-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.library-group-header h2 { margin: 0; }
.library-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.library-table th, .library-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.library-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 500; }
.library-table tbody tr:last-child td { border-bottom: none; }
.library-table tbody tr:hover { background: var(--bg-elev); }
.library-table .row-active { background: #f1fbf5; }
.library-table .row-active:hover { background: #e5f4ec; }
.library-name a { color: var(--text); font-weight: 500; text-decoration: none; }
.library-name a:hover { color: var(--accent); }
.small { font-size: 12px; }

.btn.danger { color: var(--fast-reject); border-color: #f0c1bd; }
.btn.danger:hover { background: #fbe2e0; }

.rationale-card {
  background: #f1f5ff;
  border: 1px solid #d6dffa;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 14px;
}

/* ── sliders ─────────────────────────────────────────────── */
.slider-field { display: flex; flex-direction: column; gap: 6px; }
.slider-field .label-text {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 500;
  font-size: 13px;
}
.slider-value {
  font-size: 13px;
  background: var(--pill-bg);
  padding: 2px 10px;
  border-radius: 999px;
  min-width: 52px;
  text-align: center;
  color: var(--text);
}
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.slider-field input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--pill-bg);
  border-radius: 999px;
  outline: none;
  margin: 4px 0;
}
.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
}
.slider-field input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
}

/* Threshold inline warning */
.threshold-warn {
  font-size: 12px;
  color: var(--fast-reject);
  background: #fbe2e0;
  border: 1px solid #f0c1bd;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 4px;
}

.checkbox-row { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.checkbox-row input { flex-shrink: 0; }
.checkbox-row.inline-checkbox { font-size: 13px; }

/* ── Editor: hero ────────────────────────────────────────── */
.editor-hero {
  margin-bottom: 24px;
}
.editor-hero h1 {
  font-size: 26px;
  margin: 0 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.editor-hero-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.editor-hero .lede {
  max-width: 720px;
}

/* ── Editor: two-column sticky layout ────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 960px) {
  .editor-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.editor-sidebar {
  position: sticky;
  top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  /* Thin scrollbar prevents Windows / Linux default scrollbars from
     eating the sidebar width and breaking the grid layout. */
  scrollbar-width: thin;
  scrollbar-color: #c8c8c0 transparent;
}
.editor-sidebar::-webkit-scrollbar { width: 8px; }
.editor-sidebar::-webkit-scrollbar-track { background: transparent; }
.editor-sidebar::-webkit-scrollbar-thumb {
  background: #c8c8c0;
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.editor-sidebar::-webkit-scrollbar-thumb:hover { background: #a8a8a0; background-clip: content-box; }
@media (max-width: 960px) {
  .editor-sidebar { position: static; max-height: none; }
}

.sidebar-section {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-section:last-of-type { border-bottom: none; }
.sidebar-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 4px;
  font-weight: 600;
}

.sidebar-actions {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}
.btn.block {
  display: block;
  width: 100%;
  text-align: center;
}

/* ── Weight total badge ──────────────────────────────────── */
.weight-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.weight-badge strong {
  font-size: 22px;
  min-width: 56px;
}
.weight-badge.ok {
  background: #e0f5ea;
  border-color: #b6e5cb;
  color: var(--strong-hire);
}
.weight-badge.warn {
  background: #fbf0d9;
  border-color: #f0dca5;
  color: var(--borderline);
}
.weight-badge.bad {
  background: #fbe2e0;
  border-color: #f0c1bd;
  color: var(--fast-reject);
}

/* ── Editor: main content ────────────────────────────────── */
.editor-main {
  min-width: 0;          /* allow shrinking inside grid */
}

.rationale-card {
  background: #f1f5ff;
  border: 1px solid #d6dffa;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.55;
}

/* Task group accordion ─────────────────────────────────────── */
.task-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.task-group.secondary {
  background: var(--bg-elev);
  box-shadow: none;
}
.task-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  user-select: none;
  font-weight: 500;
}
.task-group > summary::-webkit-details-marker { display: none; }
.task-group-toggle {
  display: inline-block;
  width: 12px;
  transition: transform 0.15s;
  color: var(--text-muted);
  font-size: 11px;
}
.task-group[open] > summary .task-group-toggle { transform: rotate(90deg); }
.task-group-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.task-group-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-group-meta {
  font-size: 12px;
  font-weight: 400;
  flex-shrink: 0;
}
.task-group-body {
  padding: 0 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Criterion card (inside a task group) ────────────────── */
.criterion-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.criterion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.criterion-header .task-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: #e6ecff;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}
.title-input {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.title-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
}
.title-input:hover { background: #fff; }

.criterion-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 8px 0;
}
.slider-field.inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}
@media (max-width: 720px) {
  .criterion-controls { grid-template-columns: 1fr; gap: 12px; }
}

.criterion-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.criterion-card .field textarea,
.criterion-card .field input,
.criterion-card .field select,
.editor-sidebar .field input,
.editor-sidebar .field textarea {
  width: 100%;
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  resize: vertical;
}
.criterion-card .field textarea:focus,
.criterion-card .field input:focus,
.criterion-card .field select:focus,
.editor-sidebar .field input:focus,
.editor-sidebar .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.criterion-card .field .hint.inline {
  display: inline;
  margin-left: 6px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Raw assignment data (3rd-level toggle) ──────────────── */
.raw-data-toggle {
  background: transparent;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.raw-data-toggle > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  padding: 4px 0;
}
.raw-data-toggle > summary::-webkit-details-marker { display: none; }
.raw-data-toggle > summary:hover { color: var(--text); }
.raw-toggle-icon {
  display: inline-block;
  width: 10px;
  font-size: 10px;
  transition: transform 0.15s;
}
.raw-data-toggle[open] > summary .raw-toggle-icon {
  transform: rotate(90deg);
}
.raw-data-body {
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
}
.raw-data-body .label-text { font-size: 12px; }
.raw-data-body textarea,
.raw-data-body input,
.raw-data-body select {
  font-size: 13px !important;
  background: #fff;
}

/* ── sign-in page ────────────────────────────────────────── */
.signin-wrap { display: flex; justify-content: center; padding: 32px 0; }
.signin-card { max-width: 480px; width: 100%; text-align: center; padding: 32px; }
.signin-card h1 { font-size: 22px; margin: 0 0 8px; }
.signin-card .lede { margin-bottom: 24px; }
#clerk-sign-in { display: flex; justify-content: center; }

/* ── footer ──────────────────────────────────────────────── */
.footer {
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
}

blockquote {
  margin: 0;
  padding: 12px 16px;
  border-left: 3px solid var(--fast-reject);
  background: #fff7f5;
  color: var(--text);
}
