/**
 * resources/css/editor.css
 * ApplyRole — the document editor: rail, panel, canvas, prompt bar.
 *
 * Loaded only on the editor and library pages, not sitewide. It is the largest
 * stylesheet in the product and every other page would carry it for nothing.
 *
 * Every value comes from tokens.css. There are no hex codes in this file — the
 * same rule app.css follows, and the reason a dark mode or a rebrand is a change
 * to one file rather than a search across six.
 *
 * LAYOUT: a three-column grid at desktop width, stacked below it. The canvas is
 * the one that scrolls; the rail and panel are sticky, because losing your place
 * in a nine-panel editor every time you scroll the document is the difference
 * between an inspector and a form.
 */

/* ── Shell ───────────────────────────────────────────────────────────────── */

.editor {
  --editor-bar: 52px;
  --prompt-h: 60px;

  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h));
  background: var(--bg);
  overflow: hidden;
}

.editor__bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--editor-bar);
  padding: 0 var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.editor__back {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.editor__back:hover { color: var(--ink); }

.editor__title { flex: 1 1 auto; min-width: 0; }

.editor__titleinput {
  width: 100%;
  max-width: 420px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-1);
  padding: var(--sp-1) var(--sp-2);
  font: inherit;
  font-weight: 600;
  color: var(--ink);
}
.editor__titleinput:hover { border-color: var(--line-2); }
.editor__titleinput:focus { border-color: var(--brand); background: var(--bg); outline: none; }

.editor__status { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.editor__status[data-state="saving"] { color: var(--info); }
.editor__status[data-state="error"]  { color: var(--late); font-weight: 600; }

.editor__tools { display: flex; align-items: center; gap: var(--sp-2); flex: none; }

.editor__tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 1rem;
  list-style: none;
}
.editor__tool:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand-line); }
.editor__tool:disabled { opacity: .35; cursor: default; }
.editor__tool::-webkit-details-marker { display: none; }

.editor__menu { position: relative; }
.editor__menupanel {
  position: absolute; right: 0; top: calc(100% + var(--sp-2));
  width: 320px; z-index: 40;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  box-shadow: var(--sh-3);
  padding: var(--sp-2);
}

.editor__body {
  /* Wider tracks than the app default: the rail and panel float as rounded
     cards over the workspace (the reference look), so the tracks carry the
     card plus its breathing room. Scoped here — the rest of the app keeps
     the token values. */
  --rail-w: 86px;
  --panel-w: 352px;

  display: grid;
  grid-template-columns: var(--rail-w) var(--panel-w) 1fr;
  flex: 1 1 auto;
  min-height: 0;
  /* The panel column animates between its width and nothing — the slide the
     collapse control promises. Grid tracks have been animatable in every
     evergreen browser for years; anywhere they are not, the panel simply
     appears and disappears, which is still correct. */
  transition: grid-template-columns .28s ease;
}

/* Folded: rail and canvas only. A URL state (?panel=off), not just a class —
   editor.php renders it directly so it survives reload and works without JS. */
.editor--collapsed .editor__body { grid-template-columns: var(--rail-w) 0 1fr; }
.editor--collapsed .panel { border-right: 0; padding-right: 0; }

/* ── Rail ────────────────────────────────────────────────────────────────── */

/*
 * A FLOATING ROUNDED DOCK, NOT A FULL-HEIGHT STRIP. The rail is a pill of
 * icons that is only as tall as its icons, hovering over the workspace with
 * its own corners and shadow — the grammar of CapCut/Figma-class editors this
 * was modelled on. The grid track (.rail) is just the gutter; the visible
 * object is .rail__list.
 */
.rail {
  background: transparent;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-2) var(--sp-3) var(--sp-3);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail__list {
  list-style: none; margin: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1);
}

.rail__item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 56px;
  padding: 8px 0 6px;
  color: var(--muted);
  text-decoration: none;
  border-radius: calc(var(--r-3) - 6px);
}
.rail__item:hover { background: var(--brand-soft); color: var(--ink-2); }
.rail__item.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.rail__icon { line-height: 0; }
.rail__icon svg { width: 20px; height: 20px; display: block; }
.rail__label { font-size: 9px; font-weight: 500; letter-spacing: .02em; text-align: center; }

/* Three states, never a percentage. See editor.php for why. */
.rail__state {
  position: absolute; top: 5px; right: 9px;
  width: 6px; height: 6px; border-radius: 50%;
  border: 1px solid var(--faint);
}
.rail__state--empty    { background: transparent; }
.rail__state--partial  { background: var(--due); border-color: transparent; }
.rail__state--complete { background: var(--ok); border-color: transparent; }

/* ── Panel ───────────────────────────────────────────────────────────────── */

/*
 * The panel is the rail's companion card: same corners, same shadow, floating
 * beside the dock rather than fused to it. The grid track (.panel) is the
 * gutter and the clipping window for the slide; the card is .panel__pane.
 */
.panel {
  background: transparent;
  display: flex; flex-direction: column;
  min-height: 0;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) 0;
  /* Both needed for the slide: min-width so the grid track can actually reach
     zero, overflow so the content is clipped on the way rather than squashed. */
  min-width: 0;
  overflow: hidden;
}

.panel__pane {
  display: flex; flex-direction: column; min-height: 0; height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.panel__pane[hidden] { display: none; }

/* Fixed to the track's open width so the content keeps its shape and slides
   out of view during the collapse instead of reflowing at every frame. */
.panel__pane { width: calc(var(--panel-w) - var(--sp-3)); }

.panel__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.panel__title {
  flex: 1 1 auto; margin: 0;
  font-size: .95rem; font-weight: 600;
  color: var(--ink);
}

/* The fold control, top-right of the panel like every editor people know. */
.panel__collapse {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--r-1);
  border: 1px solid transparent;
  color: var(--muted); text-decoration: none;
  line-height: 0;
}
.panel__collapse svg { width: 16px; height: 16px; }
.panel__collapse:hover { background: var(--brand-soft); color: var(--ink-2); border-color: var(--brand-line); }
/* The chevron points at the rail; in RTL the rail is on the other side. */
[dir="rtl"] .panel__collapse span { display: inline-block; transform: scaleX(-1); }

.panel__scroll { overflow-y: auto; padding: var(--sp-4); flex: 1 1 auto; }

/* ── Live character counters ─────────────────────────────────────────────── */

/* Hidden until the field is focused; sticky once a field is nearly full.
   display:block always (layout space reserved would jump) — visibility via
   height so the panel does not reflow every focus change. */
.charcount {
  display: block;
  height: 0;
  overflow: hidden;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: height .12s ease;
}
.charcount.is-visible,
.charcount.is-sticky { height: 15px; margin-top: 2px; }
.charcount.is-warn { color: var(--due-ink); font-weight: 600; }

/* ── Cursor character ────────────────────────────────────────────────────── */

/* The text caret writes in the brand colour — a small signature that the
   editor is alive. */
.panel input, .panel textarea, .editor__titleinput, .promptbar__input {
  caret-color: var(--brand);
}

/* Over an editable canvas region the pointer becomes a small pen: "this is
   yours to write". Inline SVG cursor with the hotspot at the nib; `text` is
   the fallback for engines that refuse SVG cursors. */
.canvas__paper [data-editable] {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22"><path d="M3 19l1.2-4.2L15.4 3.6a2 2 0 0 1 2.8 0l.2.2a2 2 0 0 1 0 2.8L7.2 17.8Z" fill="%236c63ff" stroke="white" stroke-width="1.6" stroke-linejoin="round"/></svg>') 3 19, text;
}

/* Groups: two or three labelled clusters per panel, never one wall of inputs. */
.group { margin-bottom: var(--sp-5); }
.group:last-child { margin-bottom: 0; }

/* The photo row in the Profile panel: preview beside its controls. */
.photorow { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-4); }
.photorow__preview {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.photorow__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photorow__preview svg { width: 26px; height: 26px; }
.photorow__controls { flex: 1 1 auto; min-width: 0; }
.photorow__choose { cursor: pointer; }
.photorow__controls .btn { margin-right: var(--sp-1); }
.photorow__controls .field__hint { margin-top: var(--sp-2); }

.group__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }

.group__title {
  margin: 0 0 var(--sp-3);
  font-size: .82rem; font-weight: 700; color: var(--ink);
}
.group__title--toggle { cursor: pointer; }

.group__count {
  font-size: var(--fs-xs); color: var(--muted);
  background: var(--bg); border-radius: var(--r-pill);
  padding: 1px var(--sp-2);
}

.group__note { margin: 0 0 var(--sp-3); font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.group__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.group__cost { font-size: var(--fs-xs); color: var(--muted); }

.group--collapsed > summary { list-style: none; }
.group--collapsed > summary::-webkit-details-marker { display: none; }
.group--collapsed > summary::before { content: "▸ "; color: var(--faint); }
.group--collapsed[open] > summary::before { content: "▾ "; }

.group--danger { border-top: 1px solid var(--line); padding-top: var(--sp-4); }
.group--danger .group__title { color: var(--late); }

/* ── Fields ──────────────────────────────────────────────────────────────── */

.field { margin-bottom: var(--sp-3); }
.field__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.field__label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); margin-bottom: var(--sp-1); }

.field__ai {
  border: 0; background: transparent; cursor: pointer;
  font-size: .8rem; line-height: 1;
  padding: 2px 4px; border-radius: var(--r-1);
  opacity: .55;
}
.field__ai:hover { opacity: 1; background: var(--brand-soft); }

.field__input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-1);
  background: var(--bg);
  font: inherit; font-size: .88rem;
  color: var(--ink);
}
.field__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: var(--surface);
}
.field__input--area { resize: vertical; min-height: 62px; line-height: 1.5; }
.field__input--sm { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); }

.field__hint  { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.field__error { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--late); }

.field--check .field__checkline {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .86rem; color: var(--ink-2); cursor: pointer;
}

/* A field whose canvas element is currently highlighted. */
.field.is-linked .field__input { border-color: var(--brand); }

/* ── Repeater ────────────────────────────────────────────────────────────── */

.repeater__empty { margin: 0 0 var(--sp-3); font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.repeater__list  { list-style: none; margin: 0 0 var(--sp-2); padding: 0; }
.repeater__item  { margin-bottom: var(--sp-2); }
.repeater__item.is-dragging { opacity: .45; }

.repeater__entry {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--surface);
  overflow: hidden;
}
.repeater__entry[open] { border-color: var(--brand-line); box-shadow: var(--sh-1); }

.repeater__summary {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  list-style: none;
}
.repeater__summary::-webkit-details-marker { display: none; }
.repeater__summary:hover { background: var(--bg); }
.repeater__summary--add { color: var(--brand); font-weight: 600; }

.repeater__grip { color: var(--faint); cursor: grab; font-size: .9rem; flex: none; }
.repeater__grip:active { cursor: grabbing; }

.repeater__lines { display: flex; flex-direction: column; min-width: 0; }
.repeater__primary   { font-size: .86rem; font-weight: 600; color: var(--ink);
                       overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repeater__secondary { font-size: var(--fs-xs); color: var(--muted);
                       overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.repeater__body { padding: var(--sp-3); border-top: 1px solid var(--line); }
.repeater__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-3); }
.repeater__cell { grid-column: 1 / -1; }
.repeater__cell--half { grid-column: span 1; }

.repeater__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px dashed var(--line);
}
.repeater__remove { display: flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-xs); color: var(--late); margin-left: auto; }

/* Bullets */
.bullets { margin-top: var(--sp-3); }
.bullets__list { list-style: none; margin: 0; padding: 0; }
.bullets__row { display: flex; align-items: flex-start; gap: var(--sp-1); margin-bottom: var(--sp-1); }
.bullets__grip { color: var(--faint); cursor: grab; padding-top: 8px; font-size: .8rem; }
.bullets__input {
  flex: 1 1 auto; resize: vertical;
  padding: var(--sp-2); border: 1px solid var(--line-2);
  border-radius: var(--r-1); background: var(--bg);
  font: inherit; font-size: .84rem; line-height: 1.45;
}
.bullets__input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.bullets__ai, .bullets__remove {
  border: 0; background: transparent; cursor: pointer; color: var(--faint);
  padding: var(--sp-1); line-height: 1;
}
.bullets__ai:hover { color: var(--brand); }
.bullets__remove:hover { color: var(--late); }
.bullets__row--new .bullets__input { border-style: dashed; }

/* ── Appearance controls ─────────────────────────────────────────────────── */

.swatches { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch__chip {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px var(--line-2);
}
.swatch.is-active .swatch__chip, .swatch input:focus-visible + .swatch__chip { border-color: var(--ink); }
.swatch__name { font-size: 9px; color: var(--muted); }

.segmented {
  display: flex; margin-bottom: var(--sp-3);
  border: 1px solid var(--line-2); border-radius: var(--r-1); overflow: hidden;
}
.segmented__opt { flex: 1 1 0; text-align: center; cursor: pointer; }
.segmented__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented__label {
  display: block; padding: var(--sp-2) var(--sp-1);
  font-size: var(--fs-xs); color: var(--muted);
  border-right: 1px solid var(--line-2);
}
.segmented__opt:last-child .segmented__label { border-right: 0; }
.segmented__opt.is-active .segmented__label { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.segmented__label--serif { font-family: var(--font-serif); }
.segmented__label--mono  { font-family: var(--font-mono); }

.sectionlist { list-style: none; margin: 0 0 var(--sp-3); padding: 0; }
.sectionlist__row {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border: 1px solid var(--line);
  border-radius: var(--r-1); margin-bottom: var(--sp-1);
  background: var(--surface);
}
.sectionlist__grip { color: var(--faint); cursor: grab; }
.sectionlist__toggle { display: flex; align-items: center; gap: var(--sp-2); flex: 1 1 auto; font-size: .84rem; cursor: pointer; }
.sectionlist__count { font-size: var(--fs-xs); color: var(--faint); }
.sectionlist__move { border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: .7rem; padding: 2px; }
.sectionlist__move:hover { color: var(--ink); }
.sectionlist__add { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; }

/* Skills */
.tags__group { margin-bottom: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 1px dashed var(--line); }
.tags__list { list-style: none; margin: var(--sp-2) 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.tag2 {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-1) 2px var(--sp-2);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--bg);
}
.tag2__name { border: 0; background: transparent; font: inherit; font-size: .82rem; width: 8ch; min-width: 4ch; }
.tag2__name:focus { outline: none; }
.tag2__level { border: 0; background: transparent; font-size: var(--fs-xs); color: var(--muted); }
.tag2__remove { display: inline-flex; cursor: pointer; color: var(--faint); }
.tag2__remove input { position: absolute; opacity: 0; }
.tag2__remove:hover { color: var(--late); }

/* ── Template gallery ────────────────────────────────────────────────────── */

.gallery__group { margin-bottom: var(--sp-4); }
.gallery__grid, .gallerypage__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--sp-2);
}
.gallerypage__grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-4); }

.tcard {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-2); text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--surface); cursor: pointer;
  transition: border-color .12s var(--ease), transform .12s var(--ease);
}
.tcard:hover { border-color: var(--brand); transform: translateY(-1px); }
.tcard.is-active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.tcard--large { padding: var(--sp-3); }

.tcard__thumb {
  aspect-ratio: 1 / 1.414;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: 12%;
  display: flex; flex-direction: column; gap: 6%;
  overflow: hidden;
}
.tcard__bar { height: 7%; border-radius: 2px; background: var(--brand); }
.tcard__bar--sub { width: 55%; height: 4%; background: var(--faint); }
.tcard__block { height: 4%; border-radius: 2px; background: var(--line-2); }
.tcard__block--short { width: 62%; }

/* Miniatures that actually differ per template, so the grid is a choice rather
   than twelve identical grey rectangles. */
.tcard__thumb--corporate, .tcard__thumb--leftrail { flex-direction: row; padding: 0; gap: 0; }
.tcard__thumb--corporate::before, .tcard__thumb--leftrail::before {
  content: ""; width: 34%; background: var(--brand-soft); flex: none;
}
.tcard__thumb--leftrail::before { background: var(--brand); }
.tcard__thumb--executive { align-items: center; }
.tcard__thumb--executive .tcard__bar { width: 70%; }
.tcard__thumb--minimalist { padding-left: 32%; }
.tcard__thumb--bold .tcard__bar--name { height: 16%; background: var(--brand); }
.tcard__thumb--timeline { padding-left: 18%; border-left: 3px solid var(--brand); }
.tcard__thumb--infographic .tcard__block { height: 8%; background: var(--brand); border-radius: 999px; }

.tcard__name { display: block; font-size: .8rem; font-weight: 700; color: var(--ink); margin: 0; }
.tcard__desc { display: block; font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; margin: var(--sp-1) 0 0; }
.tcard__meta { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin: var(--sp-2) 0 0; }

.tcard__ats, .tcard__pages, .tcard__photo {
  font-size: 10px; padding: 1px var(--sp-1);
  border-radius: var(--r-pill); background: var(--bg); color: var(--muted);
}
.tcard__ats--excellent { background: var(--ok-bg); color: var(--ok); }
.tcard__ats--good      { background: var(--info-bg); color: var(--info); }
.tcard__ats--moderate  { background: var(--due-bg); color: var(--due-ink); }

.tcard__current { font-size: 10px; color: var(--brand); font-weight: 700; }
.gallery__note { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }

/* ── Analysis ────────────────────────────────────────────────────────────── */

.scorebox { display: flex; align-items: center; gap: var(--sp-3); }
.score { position: relative; width: 72px; height: 72px; flex: none; }
.score__track { fill: none; stroke: var(--line); stroke-width: 7; }
.score__fill {
  fill: none; stroke: var(--brand); stroke-width: 7; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
}
/* A magnitude ramp, not a traffic light — the written band beside it carries the
   judgement, so nothing here depends on telling red from green. */
.score--fair .score__fill { stroke: var(--brand-2); }
.score--weak .score__fill { stroke: var(--brand-3); }
.score__num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: var(--ink);
}
.scorebox__title { margin: 0; font-size: .9rem; text-transform: capitalize; }
.scorebox__sub   { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks__row { display: flex; gap: var(--sp-2); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.checks__row:last-child { border-bottom: 0; }
.checks__icon {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.checks__row--fail .checks__icon { background: var(--due-bg); color: var(--due-ink); }
.checks__row--pass .checks__icon { background: var(--ok-bg); color: var(--ok); }
.checks__body { display: flex; flex-direction: column; gap: 2px; }
.checks__label  { font-size: .82rem; font-weight: 600; color: var(--ink); }
.checks__detail { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }

.stats { margin: 0; }
.stats__row { display: flex; justify-content: space-between; padding: var(--sp-1) 0; font-size: .82rem; }
.stats__row dt { color: var(--muted); }
.stats__row dd { margin: 0; font-weight: 600; }
.stats__flag {
  font-size: 10px; padding: 0 var(--sp-1); border-radius: var(--r-pill);
  background: var(--due-bg); color: var(--due-ink); font-weight: 400;
}

/* ── Import ──────────────────────────────────────────────────────────────── */

.dropzone__area {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  padding: var(--sp-5) var(--sp-3);
  border: 2px dashed var(--line-2); border-radius: var(--r-2);
  background: var(--bg); cursor: pointer; text-align: center;
  margin-bottom: var(--sp-3);
}
.dropzone__area:hover, .dropzone.is-over .dropzone__area {
  border-color: var(--brand); background: var(--brand-soft);
}
.dropzone__icon   { font-size: 1.6rem; }
.dropzone__prompt { font-size: .86rem; color: var(--ink-2); }
.dropzone__types  { font-size: var(--fs-xs); color: var(--muted); }
.dropzone__input  { position: absolute; opacity: 0; width: 0; height: 0; }

.plainlist { margin: 0; padding-left: var(--sp-4); font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.55; }
.plainlist li { margin-bottom: var(--sp-2); }

.notice { padding: var(--sp-3); border-radius: var(--r-1); font-size: var(--fs-xs); line-height: 1.5; }
.notice--warn { background: var(--due-bg); color: var(--due-ink); }
.notice--info { background: var(--info-bg); color: var(--info); }
.notice__title { margin: 0 0 var(--sp-1); font-weight: 700; }
.notice__body  { margin: 0 0 var(--sp-2); }

/* ── Settings / sharing ──────────────────────────────────────────────────── */

.sharebox { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-2); }
.sharebox__url {
  flex: 1 1 auto; min-width: 0;
  padding: var(--sp-2); border: 1px solid var(--line-2); border-radius: var(--r-1);
  background: var(--bg); font: inherit; font-size: var(--fs-xs); color: var(--ink-2);
}
.sharebox__stat { margin: 0 0 var(--sp-3); font-size: var(--fs-xs); color: var(--muted); }

/* ── Canvas ──────────────────────────────────────────────────────────────── */

.canvas { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }

.canvas__scroll { flex: 1 1 auto; overflow: auto; padding: var(--sp-4); }

.canvas__stage {
  width: fit-content; margin: 0 auto;
  transform: scale(var(--zoom, 1));
  transform-origin: top center;
  transition: transform .15s var(--ease);
}

.canvas__paper { position: relative; }

/* ── The ATS scan beam ──────────────────────────────────────────────────────
   While the ATS check is actually running — added by scanBeam() on request
   start, removed when the response lands — a thin sky-blue light sweeps the
   page top to bottom, the way a flatbed scanner reads a sheet. It is an
   honest indicator, not theatre: it exists exactly as long as the request
   does. The glow trails UPWARD, so the region the beam has passed reads as
   "read" and the sweep direction is unmistakable. */
.canvas__scanbeam {
  position: absolute; left: 0; right: 0; top: 0;
  height: 3px;
  pointer-events: none;
  z-index: 6;
  background: linear-gradient(90deg,
    transparent, rgba(86,183,255,.85) 16%,
    #b8e4ff 50%,
    rgba(86,183,255,.85) 84%, transparent);
  box-shadow:
    0 0 10px 2px rgba(86,183,255,.55),
    0 0 32px 8px rgba(86,183,255,.28);
  animation: lp-scanbeam 2.4s cubic-bezier(.37,.12,.63,.88) infinite;
  transition: opacity .25s var(--ease);
}
.canvas__scanbeam::after {
  content: '';
  /* Sits above the beam line — the wake of light where the scanner has been. */
  position: absolute; left: 0; right: 0; bottom: 100%;
  height: 84px;
  background: linear-gradient(to top, rgba(86,183,255,.14), transparent);
}
.canvas__scanbeam.is-leaving { opacity: 0; }

@keyframes lp-scanbeam {
  0%   { top: 0; }
  100% { top: calc(100% - 3px); }
}

/* Nothing visible at rest. A document covered in handles looks like a wireframe,
   and people judge their CV by how it looks while they are writing it. */
.canvas__paper [data-editable] { outline: 1px solid transparent; border-radius: 2px; }
.canvas__paper [data-editable]:hover { outline-color: var(--brand-line); background: var(--brand-soft); }
.canvas__paper [data-editable].is-highlighted {
  outline: 2px solid var(--brand);
  animation: lp-flash 1.2s var(--ease);
}
@keyframes lp-flash {
  0%   { background: var(--brand-soft); }
  100% { background: transparent; }
}

.canvas__breaks { position: absolute; inset: 0; pointer-events: none; }

/*
 * The break drawn as the print margins it represents. @page gives every
 * printed page 12mm top and bottom, so the marker shows that whitespace as a
 * translucent band fading in above the line and out below it — the sheet ends
 * softly instead of a dashed hairline slicing through a paragraph. The text
 * underneath stays faintly visible: the canvas is one flowing sheet and
 * pretending otherwise would hide content mid-edit.
 */
.canvas__break {
  position: absolute; left: 0; right: 0;
  height: 34px;
  transform: translateY(-17px);
  background: linear-gradient(
    color-mix(in srgb, var(--bg) 0%, transparent),
    color-mix(in srgb, var(--bg) 88%, transparent) 38%,
    var(--bg) 50%,
    color-mix(in srgb, var(--bg) 88%, transparent) 62%,
    color-mix(in srgb, var(--bg) 0%, transparent)
  );
}
.canvas__break::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1px dashed var(--faint);
}
.canvas__break::after {
  content: attr(data-label);
  position: absolute; right: var(--sp-2); top: 50%;
  transform: translateY(-50%);
  font-size: 10px; color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px var(--sp-2);
}

.canvas__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--line); background: var(--surface);
  flex: none;
}
.canvas__pages { margin: 0; display: flex; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }
.canvas__expected { color: var(--faint); }
/* --due-ink, not --due: amber as TEXT on a light panel is unreadable — the
   tokens file's own rule. */
[data-page-current].is-over { color: var(--due-ink); font-weight: 600; }

.canvas__zoom { display: flex; align-items: center; gap: var(--sp-1); }
.canvas__zoombtn, .canvas__zoomlevel {
  border: 1px solid var(--line); background: transparent; border-radius: var(--r-1);
  color: var(--ink-2); cursor: pointer; padding: 2px var(--sp-2); font-size: var(--fs-xs);
}
.canvas__zoombtn:hover, .canvas__zoomlevel:hover { background: var(--brand-soft); }

.canvas__overflow {
  position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--brand-line); border-radius: var(--r-pill);
  box-shadow: var(--sh-2);
  font-size: var(--fs-xs); max-width: 90%;
}
.canvas__overflowtext { margin: 0; color: var(--ink-2); }
.canvas__dismiss { border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 1rem; line-height: 1; }

/* ── Prompt bar ──────────────────────────────────────────────────────────── */

.promptbar {
  display: flex; align-items: center; gap: var(--sp-2);
  height: var(--prompt-h); flex: none;
  padding: 0 var(--sp-4);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.promptbar__spark { font-size: 1rem; }
.promptbar__input {
  flex: 1 1 auto; min-width: 0;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--bg); font: inherit; font-size: .88rem;
}
.promptbar__input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.promptbar__credits {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); color: var(--muted); white-space: nowrap;
}

.suggestions {
  position: fixed; right: var(--sp-4); bottom: calc(var(--prompt-h) + var(--sp-3));
  width: min(420px, 92vw); max-height: 60vh; overflow: auto; z-index: 60;
  background: var(--surface);
  border: 1px solid var(--brand-line); border-radius: var(--r-3);
  box-shadow: var(--sh-3);
  padding: var(--sp-3);
}

/* AI proposes, the user commits. A suggestion is rendered as a diff with two
   buttons; nothing here ever writes to the document by itself. */
.diff { border: 1px solid var(--line); border-radius: var(--r-1); margin-bottom: var(--sp-2); overflow: hidden; }
.diff__old { padding: var(--sp-2); background: var(--late-bg); color: var(--ink-2); font-size: .82rem; text-decoration: line-through; }
.diff__new { padding: var(--sp-2); background: var(--ok-bg); color: var(--ink); font-size: .82rem; }
.diff__why { padding: var(--sp-1) var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }
.diff__actions { display: flex; gap: var(--sp-1); padding: var(--sp-2); border-top: 1px solid var(--line); }

/* A rewrite that introduced a figure the original did not have. Never hidden,
   never silently applied — see Ai\Task::unsupportedFigures(). */
.diff__warn {
  padding: var(--sp-1) var(--sp-2);
  background: var(--due-bg); color: var(--due-ink);
  font-size: var(--fs-xs); font-weight: 600;
}

/* ── Library ─────────────────────────────────────────────────────────────── */

.library { max-width: 1080px; margin: 0 auto; padding: var(--sp-5) var(--sp-4); }
.library__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.library__title { margin: 0; font-size: 1.5rem; }
.library__sub { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); color: var(--muted); }
.library__actions form { display: flex; gap: var(--sp-2); }
.library__filters { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }

.doclist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-4); }

.doccard {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--surface); overflow: hidden;
  transition: border-color .12s var(--ease), transform .12s var(--ease), box-shadow .12s var(--ease);
}
.doccard:hover { border-color: var(--brand-line); transform: translateY(-2px); box-shadow: var(--sh-2); }
.doccard__link { position: absolute; inset: 0; z-index: 1; }

.doccard__thumb {
  aspect-ratio: 1 / 1.1; background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 14%; display: flex; flex-direction: column; gap: 8%;
}

/* The documents-page card shows the document itself (see templates/documents/
   index.php): the tcard live-frame machinery, on the doccard's own proportions.
   These override the flex layout above so the scaled page fills the box. */
.doccard__thumb.tcard__thumb--live {
  padding: 0; display: block; gap: 0;
  background: var(--surface);
}

/* The honest empty state: the render behind it is blank paper, this says why. */
.doccard__blank {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  text-align: center;
  font-size: var(--fs-xs); color: var(--muted);
}
.doccard__bar { height: 8%; border-radius: 2px; background: var(--doc-accent, var(--brand)); }
.doccard__bar--short { width: 52%; height: 5%; background: var(--faint); }
.doccard__block { height: 5%; border-radius: 2px; background: var(--line-2); }

.doccard__body { padding: var(--sp-3); flex: 1 1 auto; }
.doccard__title { margin: 0; font-size: .95rem; }
.doccard__meta { margin: var(--sp-1) 0 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); }
.doccard__type { font-weight: 600; color: var(--brand); }
.doccard__type--letter { color: var(--orange-ink); }   /* --s2 is a series fill, 2.97:1 as text */
.doccard__shared { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); color: var(--info); }

.doccard__actions { display: flex; gap: var(--sp-1); padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--line); position: relative; z-index: 2; }
.doccard__menu { position: relative; margin-left: auto; }
.doccard__menupanel {
  position: absolute; right: 0; bottom: calc(100% + var(--sp-1)); z-index: 30;
  min-width: 170px; padding: var(--sp-1);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-2); box-shadow: var(--sh-2);
}
.doccard__menuitem {
  display: block; width: 100%; text-align: left;
  padding: var(--sp-2); border: 0; background: transparent;
  font: inherit; font-size: var(--fs-xs); color: var(--ink-2);
  text-decoration: none; border-radius: var(--r-1); cursor: pointer;
}
.doccard__menuitem:hover { background: var(--brand-soft); color: var(--brand); }

/* Empty state */
.starters { padding: var(--sp-5) 0; }
.starters__title { margin: 0 0 var(--sp-4); font-size: 1.05rem; text-align: center; color: var(--ink-2); }
.starters__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); }

.starter {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-3);
  background: var(--surface);
}
.starter__icon  { font-size: 1.6rem; }
.starter__title { margin: 0; font-size: .95rem; }
.starter__body  { margin: 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; flex: 1 1 auto; }
.starter__file  { cursor: pointer; }

.empty--panel { padding: var(--sp-4); text-align: center; }
.empty--panel .empty__title { margin: 0 0 var(--sp-2); font-weight: 700; font-size: .9rem; }
.empty--panel .empty__body  { margin: 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; }

/* ── Preview / share page ────────────────────────────────────────────────── */

.preview { min-height: 100vh; background: var(--bg); }
.preview__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.preview__back { color: var(--muted); text-decoration: none; font-size: var(--fs-xs); }
.preview__brand { display: flex; flex-direction: column; }
.preview__by   { font-weight: 700; }
.preview__kind { font-size: var(--fs-xs); color: var(--muted); }
.preview__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.preview__promo { margin: 0; padding: var(--sp-2); text-align: center; font-size: var(--fs-xs); color: var(--muted); }
/* The stage holds a real A4 sheet now (see .doc in document-templates.css) —
   it must never squeeze it. Small screens get the whole sheet scaled down
   (zoom keeps layout size, so it stays centred), and anything in between can
   scroll; the sheet's own proportions are not negotiable. */
.preview__stage { padding: var(--sp-4); display: flex; justify-content: center; overflow-x: auto; }
.preview__paper { box-shadow: var(--sh-3); flex-shrink: 0; }

@media (max-width: 880px) { .preview__paper { zoom: 0.62; } }
@media (max-width: 560px) { .preview__paper { zoom: 0.45; } }

/* The EDITOR canvas is the one surface that must NOT get the sheet's
   min-height: paginate() in editor.js counts pages from the paper's measured
   height, and a forced 297mm floor would report "2 pages" on a one-page CV.
   The canvas communicates page shape its own way — break markers and the
   page counter — so its paper stays content-height. */
.canvas__stage .doc { min-height: 0; }
.preview__foot { padding: var(--sp-4); text-align: center; }
.preview__note { margin: 0; font-size: var(--fs-xs); color: var(--muted); }

/* ── Exports ─────────────────────────────────────────────────────────────── */

.exports { max-width: 620px; margin: 0 auto; }
.exports--compact { max-width: none; }
.exports__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.exports__title { margin: 0; font-size: 1.2rem; }
.exports__back { font-size: var(--fs-xs); color: var(--muted); text-decoration: none; }
.exports__list { list-style: none; margin: 0; padding: 0; }
.exports__row { margin-bottom: var(--sp-2); }

.exports__link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--surface); color: var(--ink);
}
.exports__link:hover { border-color: var(--brand); background: var(--brand-soft); }
.exports__link--off { opacity: .6; background: var(--bg); }
.exports__link--off:hover { border-color: var(--line); background: var(--bg); }

.exports__ext {
  flex: none; width: 42px; height: 42px; border-radius: var(--r-1);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
}
/* An unavailable format still has to be readable — knowing WHICH one is off is the
   whole content of the row. --muted on --line measured 4.18:1, and the parent's
   opacity:.6 takes the rendered figure lower still. */
.exports__link--off .exports__ext { background: var(--line); color: var(--ink-2); }
.exports__text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.exports__label { font-size: .9rem; font-weight: 600; }
.exports__blurb { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.exports__go { color: var(--faint); }
.exports__aside { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.exports__asidetitle { margin: 0 0 var(--sp-2); font-size: .9rem; color: var(--ink); }
.exports__filename code { font-size: .95em; background: var(--bg); padding: 1px 4px; border-radius: 3px; }

/* ── Standalone gallery page ─────────────────────────────────────────────── */

.gallerypage { max-width: 1080px; margin: 0 auto; padding: var(--sp-5) var(--sp-4); }
.gallerypage__head { text-align: center; margin-bottom: var(--sp-5); }
.gallerypage__title { margin: 0; font-size: 1.6rem; }
.gallerypage__sub { max-width: 60ch; margin: var(--sp-2) auto 0; color: var(--muted); font-size: .92rem; line-height: 1.6; }
.gallerypage__switch { display: flex; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.gallerypage__group { margin-bottom: var(--sp-5); }
.gallerypage__grouptitle { font-size: 1rem; margin: 0 0 var(--sp-3); }

.atsnote {
  max-width: 68ch; margin: 0 auto var(--sp-5);
  padding: var(--sp-4); background: var(--brand-soft);
  border-radius: var(--r-3); font-size: .88rem; line-height: 1.65; color: var(--ink-2);
}
.atsnote__title { margin: 0 0 var(--sp-2); font-size: .95rem; color: var(--ink); }
.atsnote p { margin: 0 0 var(--sp-2); }
.atsnote p:last-child { margin-bottom: 0; }

/* ── Narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .editor { height: auto; overflow: visible; }
  .editor__body { grid-template-columns: var(--rail-w) 1fr; }

  /* The canvas moves below the panel rather than shrinking to unreadability.
     A phone-width document preview is not useful; a phone-width panel is. */
  .canvas { grid-column: 1 / -1; border-top: 1px solid var(--line); min-height: 70vh; }
  .panel { padding-right: var(--sp-3); }

  /* No grid track to animate here — the panel fills its row, so folded just
     means gone, and the canvas moves up. */
  .panel__pane { width: auto; }
  .editor--collapsed .panel { display: none; }
}

@media (max-width: 640px) {
  .editor__body { grid-template-columns: 1fr; }

  /* The rail becomes a horizontal dock. Same links, same order, same states. */
  .rail { overflow-x: auto; padding: var(--sp-2) var(--sp-3); }
  .rail__list { flex-direction: row; width: max-content; }
  .rail__item { flex: none; }
  .panel { padding: 0 var(--sp-3) var(--sp-3); }
  .rail__state { top: 5px; right: 9px; }

  .repeater__grid { grid-template-columns: 1fr; }
  .editor__titleinput { max-width: none; }
  .promptbar { padding: 0 var(--sp-2); }
  .promptbar__credits { display: none; }

  /*
   * THE TOP BAR MUST NOT CLIP ITS OWN CONTROLS. At phone width the row —
   * back link, title, saved-note, undo/redo, Preview, menu, Save — is wider
   * than the screen, and a fixed-height no-wrap bar simply cut Preview and
   * the menu off the right edge: present in the DOM, unreachable by thumb.
   * Wrapping onto a second line costs 40px of height; losing the Preview
   * button cost the whole feature. The saved-note is the one thing DROPPED
   * rather than wrapped — its information ("✓ saved") is already implied by
   * the Save button's idle state, and it is the widest passenger.
   */
  .editor__bar { flex-wrap: wrap; height: auto; min-height: var(--editor-bar);
                 padding-top: var(--sp-2); padding-bottom: var(--sp-2); row-gap: var(--sp-1); }
  .editor__status { display: none; }
  .editor__tools { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  /* The dropdown hangs from a wrapped row now — pin it to the screen edge. */
  .editor__menupanel { right: var(--sp-2); left: auto; max-width: calc(100vw - 2 * var(--sp-2)); }

  /*
   * THE PAGE SCALES, IT NEVER REFLOWS. Left to max-width alone, a phone squeezed
   * the A4 page to 380px and the two-column templates collapsed to a word per
   * line — a document that looked broken while being perfectly fine on paper.
   * So on small screens the paper keeps its true print width and the existing
   * zoom mechanism shrinks it to fit, exactly like holding a printed page
   * further away. What you see is what the PDF is — at every screen size.
   */
  [data-document-root] .doc { width: 210mm; max-width: 210mm; }
  .canvas__stage { transform-origin: top left; }
  /* The true-width paper must not push the grid open: the canvas track shrinks,
     the scroll container clips, the page never pans. min-width:auto is the grid
     default and it is the whole bug. */
  .canvas, .canvas__scroll { min-width: 0; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .canvas__stage, .doccard, .tcard, .editor__body { transition: none; }
  .canvas__paper [data-editable].is-highlighted { animation: none; }
  /* Belt to the JS braces: scanBeam() never creates the beam under reduced
     motion, and if it somehow did, it would not move. */
  .canvas__scanbeam { animation: none; display: none; }
}

/* ── Version history ────────────────────────────────────────────────────────
   A list, not a table. Each row is one moment somebody might want back, and the
   restore control is a real form button rather than a link — see the panel. */
.versions { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: 2px; }
.versions__row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-1);
  background: var(--surface-2);
}
.versions__what { min-width: 0; flex: 1; }
.versions__when { display: block; font-size: var(--fs-sm); font-weight: 600; }
.versions__meta { font-size: var(--fs-xs); color: var(--muted); }
.versions__act  { margin: 0; flex: none; }
.versions__current {
  font-size: var(--fs-xs); font-weight: 700; color: var(--brand);
  background: var(--brand-soft); padding: 2px var(--sp-2); border-radius: 999px; flex: none;
}

/* ── The read-only AI answers ───────────────────────────────────────────────
   score_ats, check_grammar and prep_interview return a report rather than
   replacement text. They had a box waiting for them in the analysis panel and
   nothing had ever written to it, so none of this had ever needed styling —
   which is its own tell.

   Everything here is a token. The score band reuses the pipeline status colours
   rather than inventing a fourth palette, and the two that carry text on a tinted
   background use the -ink variants, because --due at 2.00:1 on --due-bg is a
   marker colour and not a text colour. */
.analysis__result {
  margin-top: var(--sp-3); padding: var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-2);
}
.analysis__result[hidden] { display: none; }

.report__score {
  display: flex; align-items: baseline; gap: var(--sp-2);
  padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line);
}
.report__number { font-size: 2rem; line-height: 1; font-weight: 800; color: var(--ink); }
.report__outof  { font-size: var(--fs-xs); color: var(--muted); }
.report__band {
  margin-left: auto; font-size: var(--fs-xs); font-weight: 700;
  text-transform: capitalize; padding: 2px var(--sp-2); border-radius: 999px;
}
.report__score--strong .report__band { background: var(--ok-bg);    color: var(--ok); }
.report__score--good   .report__band { background: var(--info-bg);  color: var(--info); }
.report__score--fair   .report__band { background: var(--due-bg);   color: var(--due-ink); }
.report__score--weak   .report__band { background: var(--late-bg);  color: var(--late); }

.report__note  { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); }
.report__block { margin-top: var(--sp-4); }
.report__h {
  margin: 0 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.report__list, .report__checks, .report__issues, .report__qs, .report__gaps {
  list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2);
}
.report__item { font-size: var(--fs-sm); line-height: 1.5; color: var(--ink-2); }

.report__tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.report__tags .report__item {
  font-size: var(--fs-xs); padding: 2px var(--sp-2); border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-2);
}

.report__check {
  display: grid; grid-template-columns: auto 1fr; gap: 2px var(--sp-2);
  font-size: var(--fs-sm); line-height: 1.5;
}
.report__mark  { grid-row: span 2; font-weight: 800; }
.report__check--pass .report__mark { color: var(--ok); }
.report__check--fail .report__mark { color: var(--late); }
.report__label  { font-weight: 600; color: var(--ink); }
.report__detail { font-size: var(--fs-xs); color: var(--muted); }

.report__fixes { margin: 0; padding-left: var(--sp-4); display: grid; gap: var(--sp-2); }
.report__fix   { font-size: var(--fs-sm); line-height: 1.5; color: var(--ink-2); }
.report__fix--high { font-weight: 600; color: var(--ink); }

.report__issue {
  display: grid; gap: 2px; padding: var(--sp-2);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-1);
}
.report__type {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}
.report__issue--error .report__type   { color: var(--late); }
.report__issue--warning .report__type { color: var(--due-ink); }
.report__excerpt { font-size: var(--fs-sm); line-height: 1.5; color: var(--ink); }
.report__fixto   { font-size: var(--fs-sm); line-height: 1.5; color: var(--ok); font-weight: 600; }
.report__why     { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.report__clean   { margin: 0; font-size: var(--fs-sm); color: var(--ok); font-weight: 600; }

.report__q, .report__gap {
  display: grid; gap: 2px; padding: var(--sp-2);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-1);
}
.report__qtext { font-size: var(--fs-sm); font-weight: 600; line-height: 1.5; color: var(--ink); }

.group__note--warn {
  padding: var(--sp-2); border-radius: var(--r-1);
  background: var(--due-bg); color: var(--due-ink); font-weight: 600;
}

/* ── Import: which kind of document ────────────────────────────────────────
   Two radios rather than a select, because there are exactly two answers and a
   select hides the second one behind a click. The default is CV because that is
   what most people import; the alternative has to be visible without opening
   anything or nobody discovers letters can be imported at all.                */

.starter__choice {
  display: flex;
  gap: .5rem;
  margin: 0 0 .6rem;
}

.starter__radio {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .8125rem;
  cursor: pointer;
  background: var(--surface);
}

.starter__radio:hover { border-color: var(--brand-line); }
.starter__radio:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}
.starter__radio:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── Import, once the library is not empty ─────────────────────────────── */

.importmore { margin: 0 0 1.25rem; }

.importmore__toggle {
  display: inline-block;
  list-style: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  color: var(--brand);
  padding: .3rem 0;
}
.importmore__toggle::-webkit-details-marker { display: none; }
.importmore__toggle::marker { content: ''; }
.importmore__toggle:hover { text-decoration: underline; }
.importmore__toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.importmore__form {
  margin-top: .75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.importmore__file { display: block; margin: 0 0 .75rem; font-size: .875rem; }
.importmore__note { margin: .6rem 0 0; font-size: .75rem; color: var(--muted); }

/* ── Live template previews ───────────────────────────────────────────────
   The card used to hold five grey bars. It now holds the person's own
   document, rendered by documents/thumb.php through the same Renderer the
   PDF export uses.

   SCALED, NOT RESIZED. The iframe is laid out at a real page width (794px,
   A4 at 96dpi) and then transformed down, so the proportions are the ones
   that will print. Letting it reflow at card width would preview a document
   nobody is going to produce — the line breaks, the widow control and the
   page-fill would all be wrong, and those are exactly what somebody is
   judging when they look at a template.                                    */

.tcard__thumb--live {
  position: relative;
  aspect-ratio: 1 / 1.414;
  /* --surface, not a literal white: the rendered page is paper, and paper is the
     one surface in the product that must follow the token if the palette ever
     gains a dark mode. tests/doctemplates asserts no hex outside tokens.css. */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: 0;
  display: block;
  overflow: hidden;
}

.tcard__frame {
  /* A4 at 96dpi. The scale below is set from the card's own width, so the
     page fills the card whatever the grid does at this breakpoint. */
  width: 794px;
  height: 1123px;
  border: 0;
  transform-origin: 0 0;
  transform: scale(0.26);
  /* Pointer events off: the card is the click target, and a click that landed
     inside the iframe would do nothing and feel broken. */
  pointer-events: none;
}

/* The curated colour each template was designed around, shown on its card. */
.tcard__accentdot {
  position: absolute; top: 6px; right: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--tcard-accent, var(--brand));
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

/* The design they are already using, called out on its own card. */
.tcard__using {
  position: absolute;
  top: .5rem; right: .5rem;
  z-index: 2;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--brand);
  color: var(--surface);
}

@media (max-width: 900px) {
  .tcard__frame { transform: scale(0.22); }
}

/* ─── Experience-level picker ──────────────────────────────────────────────
   The coloured segmented control drawn over every level <select>. The select
   stays the real control (focusable, posts the value); the bar is pointer
   sugar. .lvl__native shrinks the select to a sliver that still shows a focus
   ring, so keyboard users can see where they are without two visible controls
   fighting for the same meaning. */

.lvl {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  vertical-align: middle;
}

.lvl__native {
  width: 1px;
  height: 1.25rem;
  opacity: 0;
  padding: 0;
  margin: 0;
  border: 0;
}
.lvl__native:focus-visible {
  width: auto;
  opacity: 1;
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
/* While the native select has focus, the decorative bar steps back. */
.lvl__native:focus-visible + .lvl .lvl__bar { opacity: .45; }

.lvl__bar {
  display: inline-flex;
  gap: 2px;
  cursor: pointer;
}

.lvl__seg {
  width: 18px;
  height: 8px;
  border-radius: 2px;
  background: var(--line-2);
  transition: background .12s ease, transform .12s ease;
}
.lvl__seg:first-child { border-radius: 6px 2px 2px 6px; }
.lvl__seg:last-child  { border-radius: 2px 6px 6px 2px; }

.lvl__seg--under { background: color-mix(in srgb, var(--lvl-c) 22%, transparent); }
.lvl__seg--on {
  background: var(--lvl-c);
  transform: scaleY(1.35);
}
.lvl__bar:hover .lvl__seg:not(.lvl__seg--on):not(.lvl__seg--under) {
  background: color-mix(in srgb, var(--muted) 25%, transparent);
}

.lvl__word {
  font-size: var(--fs-xs);
  font-weight: 700;
  min-width: 5.5em;
}
.lvl__word--unset { color: var(--muted); font-weight: 500; }

/* Inside a skill tag row the picker sits tight; in the language repeater cell
   it takes the field's own line. */
.tag2 .lvl { margin-left: auto; }
.field .lvl { margin-top: .375rem; }

@media (max-width: 640px) {
  .lvl__seg { width: 14px; }
  .lvl__word { min-width: 4.5em; }
}

/* ─── Gallery: industry alignment ──────────────────────────────────────────
   The chip row that replaces LiveCareer's blocking modal, and the matched
   strip it feeds. Alignment is a link, not state: it lives in the URL. */

.gallerypage__industries {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin-top: .875rem;
}

.gallerypage__indlabel {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  margin-right: .25rem;
}

.gallerypage__group--matched {
  background: var(--brand-soft, #f1efff);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.gallerypage__groupsub {
  margin: -.35rem 0 1rem;
  font-size: var(--fs-sm);
  color: var(--muted);
  max-width: 56ch;
}

.tcard__suits {
  display: inline-block;
  padding: .12rem .55rem;
  border-radius: 999px;
  background: var(--brand-soft, #f1efff);
  color: var(--brand, #6c63ff);
  font-weight: 700;
}
