/* ============================================================================
   Lab Match: survey wizard components (owner: survey).
   Every class is lm- prefixed; colors only through warm-lab.css tokens, so the
   light and dark themes both work without extra rules. Breakpoints mirror
   warm-lab.css (1280 / 900 / 600).
   ========================================================================== */

.lm-survey [hidden] { display: none !important; }
.lm-survey { max-width: 880px; color: var(--ink); scroll-margin-top: 24px; }

/* --- Progress + step indicator ------------------------------------------------ */
.lm-head { margin-bottom: 8px; }
.lm-progress { font-family: var(--mono); font-size: 13px; color: var(--faint); letter-spacing: .02em; margin: 0 0 6px; }
.lm-steps { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.lm-steps li { flex: 1 1 0; min-width: 0; }
.lm-stepbtn { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0; margin: 0;
  background: none; border: 0; cursor: pointer; }
.lm-stepbtn:disabled { cursor: default; }
.lm-stepbar { display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--line); transition: background .2s, height .2s; }
.lm-stepbtn.lm-done .lm-stepbar { background: var(--teal-line); }
.lm-stepbtn:not(:disabled):hover .lm-stepbar { background: var(--teal); }
.lm-stepbtn[aria-current="step"] .lm-stepbar { background: var(--teal); height: 6px; }

/* --- Step ------------------------------------------------------------------------ */
.lm-step-title { font-size: clamp(26px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.025em; line-height: 1.15;
  color: var(--ink); margin: 24px 0 0; scroll-margin-top: 24px; }
.lm-step-title:focus { outline: none; }
.lm-step-title:focus-visible { outline: none; }   /* script-only focus target (tabindex -1), not a Tab stop */
.lm-intro { font-size: 17px; line-height: 1.6; color: var(--muted); max-width: 60ch; margin: 12px 0 0; }

.lm-q { border: 0; margin: 40px 0 0; padding: 0; min-width: 0; scroll-margin-top: 24px; }
.lm-prompt { display: block; float: none; width: 100%; padding: 0; margin: 0 0 14px; font-size: 18px; font-weight: 700;
  line-height: 1.4; color: var(--ink); letter-spacing: -.005em; max-width: 64ch; }
.lm-help { font-family: var(--mono); font-size: 13px; color: var(--faint); margin: -6px 0 12px; }
/* q.help: a plain supportive line under the prompt (readable size, AAA contrast) */
.lm-hint { font-size: 15px; line-height: 1.5; color: var(--muted); margin: -8px 0 14px; max-width: 60ch; }
.lm-sublabel { display: block; font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 8px; padding: 0; }
.lm-note { font-size: 14px; line-height: 1.5; color: var(--faint); margin: 8px 0 0; max-width: 60ch; }

/* --- Pill options (radios + checkboxes; same language as .fchip) --------------- */
.lm-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.lm-opt { position: relative; display: inline-flex; max-width: 100%; cursor: pointer; }
.lm-opt-input, .lm-cell .lm-opt-input, .lm-seg-opt .lm-opt-input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.lm-opt-input:disabled { cursor: not-allowed; }
.lm-opt-pill { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 18px 10px 12px;
  border: 1px solid var(--rule-dark); border-radius: 22px; background: var(--bg); color: var(--muted);
  font-size: 15px; line-height: 1.35; transition: border-color .15s, background .15s, color .15s; }
.lm-opt-mark { position: relative; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--rule-dark);
  border-radius: 50%; background: var(--bg); }
.lm-opts-multi .lm-opt-mark { border-radius: 4px; }
.lm-opt:hover .lm-opt-input:not(:disabled):not(:checked) + .lm-opt-pill { border-color: var(--ink); color: var(--ink); }
.lm-opt-input:checked + .lm-opt-pill { background: var(--pill-bg); border-color: var(--pill-bg); color: var(--pill-fg); font-weight: 600; }
.lm-opt-input:checked + .lm-opt-pill .lm-opt-mark,
.lm-opt-input:checked + .lm-cell-pill .lm-opt-mark { background: var(--pill-fg); border-color: var(--pill-fg); }
/* the check mark (shape, not just color, shows the selected state) */
.lm-opt-input:checked + .lm-opt-pill .lm-opt-mark::after,
.lm-opt-input:checked + .lm-cell-pill .lm-opt-mark::after {
  content: ""; position: absolute; left: 50%; top: 45%; width: 5px; height: 9px;
  border: solid var(--pill-bg); border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }
.lm-opt-input:focus-visible + .lm-opt-pill,
.lm-opt-input:focus-visible + .lm-cell-pill,
.lm-opt-input:focus-visible + .lm-seg-pill { outline: 2px solid var(--teal); outline-offset: 3px; }
.lm-opt-input:disabled + .lm-opt-pill { border-style: dashed; color: var(--faint); background: var(--panel2); }
.lm-opt-input:disabled + .lm-opt-pill .lm-opt-mark { background: var(--panel2); }

.lm-other { margin-top: 14px; max-width: 420px; }

/* --- Likert grid (one DOM; wide = table, narrow = stacked pills) ---------------- */
.lm-grid { --lm-label-col: minmax(200px, 1.5fr); }
.lm-grid-head, .lm-grid-row { display: grid; grid-template-columns: var(--lm-label-col) repeat(var(--lm-cols, 5), minmax(0, 1fr));
  gap: 8px; align-items: center; }
.lm-grid-head { padding-bottom: 10px; align-items: end; }
.lm-grid-col { font-size: 13px; line-height: 1.35; color: var(--muted); text-align: center; }
.lm-grid-row { padding: 6px 0; border-top: 1px solid var(--line); }
.lm-grid-row:last-child { border-bottom: 1px solid var(--line); }
.lm-row-label { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.35; padding-right: 8px; }
.lm-cell { position: relative; display: flex; justify-content: center; cursor: pointer; }
.lm-cell-pill { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px;
  border-radius: 999px; border: 1px solid transparent; color: var(--muted); font-size: 14px; transition: background .15s; }
.lm-cell .lm-opt-mark { width: 22px; height: 22px; }
.lm-cell:hover .lm-cell-pill { background: var(--panel2); }
.lm-cell .lm-opt-input:checked + .lm-cell-pill .lm-opt-mark { background: var(--pill-bg); border-color: var(--pill-bg); }
.lm-cell .lm-opt-input:checked + .lm-cell-pill .lm-opt-mark::after { border-color: var(--pill-fg); }
/* the scale label stays in the accessible name; visible only when rows stack */
.lm-cell-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* --- Slider (5-point segmented radios) -------------------------------------------- */
.lm-scale { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.lm-anchor { font-size: 14px; line-height: 1.4; color: var(--muted); }
.lm-anchor-left { text-align: right; }
.lm-anchor-right { text-align: left; }
.lm-seg { display: flex; gap: 6px; }
.lm-seg-opt { position: relative; display: flex; cursor: pointer; }
.lm-seg-pill { display: flex; align-items: center; justify-content: center; width: 52px; min-height: 48px;
  border: 1px solid var(--rule-dark); border-radius: 999px; background: var(--bg); color: var(--muted);
  font-family: var(--mono); font-size: 15px; transition: border-color .15s, background .15s; }
.lm-seg-opt:hover .lm-opt-input:not(:checked) + .lm-seg-pill { border-color: var(--ink); color: var(--ink); }
.lm-seg-opt .lm-opt-input:checked + .lm-seg-pill { background: var(--pill-bg); border-color: var(--pill-bg); color: var(--pill-fg);
  font-weight: 600; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--pill-bg); }

/* --- Text inputs ------------------------------------------------------------------ */
.lm-input, .lm-textarea { display: block; width: 100%; max-width: 640px; font: inherit; font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg); border: 1px solid var(--rule-dark); border-radius: 8px; padding: 11px 14px; min-height: 48px; }
.lm-textarea { min-height: 120px; resize: vertical; }
.lm-input:focus, .lm-textarea:focus { border-color: var(--teal); }
.lm-input::placeholder, .lm-textarea::placeholder { color: var(--faint); }
.lm-under { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; max-width: 640px; }
.lm-under .lm-note { flex: 1; }
.lm-count { font-family: var(--mono); font-size: 12px; color: var(--faint); margin: 8px 0 0; white-space: nowrap; }

/* --- Consent + course checkboxes (native, tinted) --------------------------------- */
.lm-check-input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--teal); cursor: pointer; }
.lm-consent { display: flex; align-items: flex-start; gap: 14px; min-height: 44px; padding: 16px 18px; max-width: 720px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.lm-consent:hover { border-color: var(--rule-dark); }
.lm-consent-text { font-size: 16px; line-height: 1.55; color: var(--ink); }

/* --- Transcript ------------------------------------------------------------------- */
.lm-q-file_client_parsed { border: 1px dashed var(--rule-dark); border-radius: 8px; padding: 24px 26px; }
.lm-privacy { font-size: 15px; font-weight: 400; color: var(--muted); line-height: 1.6; }
.lm-file-row { margin-top: 4px; }
.lm-file { font: inherit; font-size: 14px; color: var(--muted); min-height: 44px; max-width: 100%; }
.lm-file::file-selector-button { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule-dark); border-radius: 999px; padding: 11px 18px; margin-right: 12px; min-height: 44px; cursor: pointer; }
.lm-file::file-selector-button:hover { border-color: var(--ink); }
.lm-paste-toggle { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; margin-top: 10px; }
.lm-paste { display: grid; gap: 10px; justify-items: start; margin-top: 14px; }
.lm-status { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.lm-status:empty { margin: 0; }
.lm-tr-review { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
.lm-courses { display: grid; max-height: 380px; overflow: auto; border-top: 1px solid var(--line); }
.lm-course { display: grid; grid-template-columns: auto 7.5em minmax(0, 1fr); gap: 12px; align-items: center;
  min-height: 44px; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.lm-course .lm-check-input { margin: 0; }
.lm-course-code { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.lm-course-title { font-size: 15px; color: var(--muted); }
.lm-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; }
.lm-row-actions .mono-link, .lm-tr-done .mono-link { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; }
.pill.sm:disabled { background: var(--panel2); color: var(--faint) !important; cursor: default; }
.lm-done-text { font-size: 16px; color: var(--ink); margin: 0 0 10px; }
.lm-done-text:focus { outline: none; }
.lm-course-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 14px; }
.lm-math { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 14px; padding: 14px 18px;
  border-left: 3px solid var(--teal); background: var(--panel2); border-radius: 0 8px 8px 0; }
.lm-math-text { margin: 0; font-size: 15px; color: var(--ink); flex: 1 1 280px; }
.lm-math-text:focus { outline: none; }

/* --- Errors ----------------------------------------------------------------------- */
.lm-err { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: 14px; font-weight: 600; color: var(--pink); }
.lm-err::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px;
  border: 1.5px solid currentColor; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; }
.lm-invalid .lm-input, .lm-invalid .lm-textarea, .lm-invalid .lm-consent { border-color: var(--pink); }
.lm-invalid .lm-grid-row, .lm-invalid .lm-seg-pill { border-color: var(--pink); }
.lm-invalid .lm-opt-input:not(:checked) + .lm-opt-pill { border-color: var(--pink); }
.lm-errsum { margin: 24px 0 0; padding: 16px 20px; border: 1px solid var(--pink); border-left-width: 4px; border-radius: 8px; max-width: 720px; }
.lm-errsum:focus { outline: none; }
.lm-errsum:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.lm-errsum-title { margin: 0 0 8px; font-weight: 700; color: var(--ink); font-size: 16px; }
.lm-errsum-list { margin: 0; padding-left: 20px; }
.lm-errsum-list li { margin: 4px 0; }
.lm-errsum-link { display: inline-block; padding: 6px 0; color: var(--pink); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }
.lm-errsum-link:hover { color: var(--coral); }

/* --- Footer nav ------------------------------------------------------------------- */
.lm-nav { display: flex; align-items: center; gap: 16px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.lm-back { background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; }
.lm-next { margin-left: auto; }

/* --- Responsive -------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .lm-survey { max-width: 820px; }
}
@media (max-width: 900px) {
  .lm-q { margin-top: 32px; }
  .lm-grid { --lm-label-col: minmax(150px, 1.2fr); }
  .lm-q-file_client_parsed { padding: 20px; }
}
@media (max-width: 600px) {
  .lm-prompt { font-size: 17px; }
  .lm-opt, .lm-opt-pill { width: 100%; }
  .lm-grid-head { display: none; }
  .lm-grid-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; }
  .lm-row-label { flex: 1 0 100%; padding: 0 0 2px; }
  .lm-cell { flex: 1 1 calc(50% - 4px); justify-content: stretch; }
  .lm-cell-pill { justify-content: flex-start; padding: 8px 14px 8px 10px; border-color: var(--rule-dark); border-radius: 22px; }
  .lm-cell:hover .lm-cell-pill { background: var(--bg); border-color: var(--ink); }
  .lm-cell .lm-opt-mark { width: 18px; height: 18px; }
  .lm-cell-text { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  .lm-cell .lm-opt-input:checked + .lm-cell-pill { background: var(--pill-bg); border-color: var(--pill-bg); color: var(--pill-fg); font-weight: 600; }
  .lm-cell .lm-opt-input:checked + .lm-cell-pill .lm-opt-mark { background: var(--pill-fg); border-color: var(--pill-fg); }
  .lm-cell .lm-opt-input:checked + .lm-cell-pill .lm-opt-mark::after { border-color: var(--pill-bg); }
  .lm-scale { grid-template-columns: 1fr 1fr; grid-template-areas: "l r" "s s"; gap: 10px 12px; }
  .lm-anchor-left { grid-area: l; text-align: left; }
  .lm-anchor-right { grid-area: r; text-align: right; }
  .lm-seg { grid-area: s; }
  .lm-seg-opt { flex: 1 1 0; }
  .lm-seg-pill { width: 100%; }
  .lm-course { grid-template-columns: auto minmax(0, 1fr); }
  .lm-course-title { grid-column: 2; }
  .lm-q-file_client_parsed { padding: 18px 16px; }
  .lm-nav { flex-direction: column-reverse; align-items: stretch; }
  .lm-next { margin-left: 0; width: 100%; }
  .lm-back { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .lm-stepbar, .lm-opt-pill, .lm-cell-pill, .lm-seg-pill { transition: none; }
}
