/* Resume Builder page styles. Section numbers like (1.2) refer to
   docs/ui-audit.md. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --sunken: #efeee8;
  --ink: #1d1f1b;
  --muted: #6b6f66;
  --line: #dddcd4;
  --accent: #3d6b4f;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --danger: #a33a2e;
  --warn-bg: #fbf1d9;
  --warn-ink: #6b4d0c;
  --warn: #b7791f;
  --page-edge: 0 1px 3px rgba(0, 0, 0, .12), 0 6px 24px rgba(0, 0, 0, .06);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --radius-s: 8px; --radius-m: 12px;
  /* Type scale: hints, secondary/labels, body/inputs, card titles. */
  --t-hint: 13px; --t-label: 15px; --t-body: 16px; --t-title: 18px;

  --bar-h: 56px;      /* header */
  --nav-h: 0px;       /* bottom nav, phones only */
  --save-h: 64px;     /* the save bar */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161714;
    --surface: #20221e;
    --sunken: #1b1c19;
    --ink: #ecebe5;
    --muted: #a3a69c;
    --line: #34372f;
    --accent: #7fb08f;
    --accent-ink: #10130f;
    --danger: #e0806f;
    --warn-bg: #3a3017;
    --warn-ink: #f0d79a;
    --warn: #e0b45c;
    /* The page stays white (it's what prints); an edge, not a glow (2.9). */
    --page-edge: 0 0 0 1px var(--line);
    color-scheme: dark;
  }
}
@media (max-width: 719px) { :root { --nav-h: 56px; } }

* { box-sizing: border-box; }
/* `hidden` wins over any display rule below. */
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  /* Scrolled-to things stop clear of the header and the save bar (1.6). */
  scroll-padding-top: calc(var(--bar-h) + var(--space-3));
  scroll-padding-bottom: calc(var(--save-h) + var(--nav-h) + var(--space-5));
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--t-body)/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
h2 { font-size: var(--t-title); margin: 0 0 var(--space-2); }

.ic {
  flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- header and navigation (2.1, 2.2) ----------------------------------- */

.bar {
  position: sticky; top: 0; z-index: 4;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.bar-in {
  max-width: 1280px; margin: 0 auto; height: var(--bar-h);
  display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4);
}
.brand { font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.screen-title { display: none; }
.savestate {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-hint); color: var(--muted); white-space: nowrap;
}
.savestate .ic { width: 16px; height: 16px; }
.savestate .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
#account { margin-left: var(--space-1); }
.savestate[hidden] + #account { margin-left: auto; }

.nav { display: flex; gap: var(--space-1); }
.nav a {
  position: relative; display: flex; align-items: center; gap: var(--space-2);
  color: var(--muted); text-decoration: none; border-radius: var(--radius-s);
  padding: var(--space-2) 14px; font-size: var(--t-label); min-height: 44px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--warn); color: #1d1f1b; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

@media (max-width: 719px) {
  /* Phones: the screen's name in the header, navigation under the thumb. */
  .brand-name { display: none; }
  .screen-title { display: inline; font-size: 17px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; gap: 0;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 0 var(--space-1) env(safe-area-inset-bottom);
  }
  .nav a {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px;
    height: var(--nav-h); padding: 4px 2px; font-size: 11px; border-radius: 0; min-height: 0;
  }
  .nav a[aria-current="page"] { background: none; }
  .nav a .ic { width: 22px; height: 22px; }
  .nav .badge { position: absolute; top: 4px; left: calc(50% + 6px); }
}

main { max-width: 1280px; margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-5); }
/* Screens without a preview beside them read better narrow (2.9). */
.panel.narrow { max-width: 720px; margin: 0 auto; }
.narrow-card { max-width: 720px; }
.center { max-width: 420px; margin: 20vh auto 0; padding: 0 var(--space-4); text-align: center; }

/* ---- controls --------------------------------------------------------------- */

.toolbar { display: flex; align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-3); }
.toolbar .grow { flex: 1; margin: 0; padding-top: 10px; }
.controls {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) 10px;
  margin-bottom: var(--space-3);
}
label { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--t-hint); color: var(--muted); flex: 1 1 180px; }
select, input, textarea, button { font: inherit; color: inherit; }
select, input {
  font-size: var(--t-body); /* below 16px, iOS zooms the page on focus */
  min-height: 44px; padding: var(--space-2) 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink); width: 100%;
}
button {
  min-height: 44px; padding: var(--space-2) 14px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-size: var(--t-label);
}
button .ic { width: 18px; height: 18px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger, .danger { color: var(--danger); }
button.link {
  border: 0; background: none; color: var(--accent); padding: 4px 0; min-height: 0; gap: 6px;
}
button.icon { min-width: 44px; padding: var(--space-2); }
button.ghost { border-color: transparent; background: none; }
button:disabled { opacity: .5; cursor: default; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.controls > button.icon { flex: none; }

textarea {
  width: 100%; resize: vertical;
  font: var(--t-body)/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: var(--space-2) 10px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink);
}
.json-box textarea, #imp-draft {
  height: 50vh; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.status { flex: 1 1 100%; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.status.error { color: var(--danger); }
@media (min-width: 640px) { .status { flex: 1 1 auto; } }
@media (max-width: 560px) {
  /* Phones: text buttons in a control row share the width. */
  .controls > button:not(.icon) { flex: 1 1 auto; }
}
.hint { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--t-hint); }
button.info {
  min-height: 0; min-width: 0; padding: 2px; border: 0; background: none; color: var(--muted);
  vertical-align: -4px;
}
button.info .ic { width: 16px; height: 16px; }
.back { margin-bottom: var(--space-3); }
.screen-h { margin-bottom: var(--space-1); }
.with-icon { display: flex; gap: var(--space-2); align-items: flex-start; }

/* ---- menus (Popover API) (3.3) ------------------------------------------- */

.menu {
  /* Placed beside its button by placeMenu() in editors.js. */
  inset: auto; margin: 0; position: fixed;
  min-width: 200px; padding: var(--space-1);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}
.menu-item {
  width: 100%; justify-content: flex-start; border: 0; background: none;
  border-radius: var(--radius-s); padding: 10px 12px; font-size: var(--t-label);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--sunken); }
.menu-item.armed { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.menu-note { margin: 0; padding: 8px 12px; font-size: var(--t-hint); color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: var(--space-1); overflow-wrap: anywhere; }

/* ---- preview pages ------------------------------------------------------------ */

.issues { list-style: none; padding: 0; margin: 0 0 var(--space-3); }
.issues li {
  background: var(--warn-bg); color: var(--warn-ink);
  border-radius: var(--radius-s); padding: var(--space-2) var(--space-3); margin-bottom: 6px; font-size: 14px;
}
.pages { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.pages img {
  width: 100%; max-width: 816px; height: auto;
  background: #fff; box-shadow: var(--page-edge); border-radius: 2px;
}
.zoomable img { cursor: zoom-in; }
.pages .loading { color: var(--muted); padding: 40px 0; }
.count { color: var(--muted); font-size: 14px; padding-bottom: 12px; }
.zoom-hint { display: none; }
@media (max-width: 719px) { .zoom-hint { display: block; } }

/* Full-screen page (1.5). */
.zoom {
  padding: 0; border: 0; margin: 0; width: 100vw; height: 100dvh;
  max-width: none; max-height: none; background: var(--bg); color: var(--ink);
}
.zoom::backdrop { background: rgba(0, 0, 0, .6); }
.zoom-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: var(--space-2);
  padding: calc(var(--space-2) + env(safe-area-inset-top)) var(--space-3) var(--space-2);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.zoom-bar span { flex: 1; font-weight: 600; }
.zoom-pages { overflow: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.zoom-pages img { width: 100%; max-width: 900px; margin: 0 auto; background: #fff; display: block; }
.zoom.big .zoom-pages img { width: 200%; max-width: none; margin: 0; }

/* ---- the toast (1.2) ------------------------------------------------------------ */

.toast {
  position: fixed; left: 50%; z-index: 20;
  bottom: calc(var(--save-h) + var(--nav-h) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  animation: fade-in .15s ease-out;
}
@keyframes fade-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---- waiting on the server ------------------------------------------------- */

.spinner {
  display: inline-block; flex: none; width: 1em; height: 1em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -.15em;
  animation: spin .8s linear infinite;
}
.spinner.big { width: 28px; height: 28px; border-width: 3px; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.waiting { display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); font-size: var(--t-label); margin: 0 0 var(--space-3); }

/* A button waiting on its request: spinner in place of its icon. */
button.busy .ic { display: none; }
button.busy::before {
  content: ""; display: inline-block; width: .9em; height: .9em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
button.busy:disabled { opacity: .8; }

.busybar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 10;
  overflow: hidden; background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.busybar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  background: var(--accent); animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide { from { left: -40%; } to { left: 100%; } }

/* Old pages stay visible, dimmed, while the new ones render. */
.pages.stale img { opacity: .35; transition: opacity .2s; }

@media (prefers-reduced-motion: reduce) {
  .spinner, button.busy::before { animation-duration: 2.4s; }
  .busybar::after { animation-duration: 3s; }
  .toast, .savebar.dirty { animation: none; }
}

/* ---- cards --------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: var(--space-4); margin-bottom: var(--space-4);
}
.card p { margin: 0 0 var(--space-2); }
.working { display: flex; gap: 14px; align-items: flex-start; }
.working p { color: var(--muted); font-size: 14px; }
.elapsed { font-variant-numeric: tabular-nums; }
.failed { border-color: var(--danger); }
.failed p { color: var(--danger); }
#imp-summary { color: var(--muted); font-size: 14px; }
details > summary { cursor: pointer; color: var(--accent); font-size: 14px; padding: 4px 0; }
details pre {
  max-height: 50vh; overflow: auto; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border-radius: var(--radius-s); padding: 10px; white-space: pre-wrap; word-break: break-word;
}
.question { display: block; margin: 0 0 14px; color: var(--ink); font-size: var(--t-label); }
.question small { display: block; color: var(--muted); font-size: var(--t-hint); margin: 2px 0 6px; }
.question textarea { min-height: 76px; }

.empty { text-align: center; color: var(--muted); padding: 48px var(--space-4); }
.empty .ic { width: 40px; height: 40px; stroke-width: 1.5; }

/* Import's file picker (1.11). */
.drop {
  position: relative; align-items: center; gap: 6px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: var(--radius-m); padding: var(--space-5) var(--space-4);
  background: var(--surface); color: var(--ink);
}
.drop .ic { width: 28px; height: 28px; color: var(--accent); }
.drop small { color: var(--muted); font-size: var(--t-hint); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#imp-file { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

/* Forms in cards: hints under the input (1.7). */
.form label { margin-bottom: 14px; font-size: var(--t-label); color: var(--ink); }
.form label small { color: var(--muted); font-size: var(--t-hint); }
.field-label { font-size: var(--t-label); margin-bottom: var(--space-1); }
#gen-summary { font-size: var(--t-label); }
#gen-dropped li { font-size: var(--t-hint); }
#gen-pages { margin: var(--space-3) 0; }

/* ---- editors (editors.js) -------------------------------------------------- */

/* Editor on the left, its live preview on the right. On phones the preview
   opens full screen from a floating button (2.7). */
.split { display: grid; gap: var(--space-4); }
.split > * { min-width: 0; }
.fab { display: none; }
@media (min-width: 980px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .split > .pv { position: sticky; top: calc(var(--bar-h) + var(--space-4)); max-height: calc(100vh - var(--bar-h) - 32px); overflow: auto; }
  .pv-close { display: none; }
}
@media (max-width: 979px) {
  .split > .pv { display: none; }
  .split > .pv.open {
    display: block; position: fixed; inset: 0; z-index: 8; overflow: auto;
    background: var(--bg); padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-5);
  }
  .fab {
    display: inline-flex; position: fixed; z-index: 5; right: var(--space-4);
    bottom: calc(var(--nav-h) + var(--space-4) + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%; padding: 0;
    background: var(--accent); color: var(--accent-ink); border: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  }
  .fab .ic { width: 24px; height: 24px; }
  /* Sits above the save bar while it shows. */
  .split:has(.savebar.dirty) .fab { bottom: calc(var(--nav-h) + var(--save-h) + var(--space-3) + env(safe-area-inset-bottom)); }
  .pv-head { flex-wrap: nowrap; align-items: flex-end; }
  .pv-head .count { white-space: nowrap; }
}
.pv .pages img { max-width: 100%; }

/* The editors leave room at the bottom for the save bar (1.2). */
.editor { padding-bottom: var(--space-2); }
.ed h2 { margin: 0; }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); flex-wrap: wrap; }
/* Text boxes grow with their text (fit() in editors.js), so no handle (1.10). */
.editor textarea { resize: none; overflow: hidden; min-height: 0; }

.field { margin-bottom: var(--space-3); color: var(--muted); align-self: start; }
.field > span { font-size: var(--t-hint); }
.field small { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--space-3); }
.grid .wide { grid-column: 1 / -1; }
.sub { margin: var(--space-2) 0 6px; font-size: var(--t-hint); color: var(--muted); font-weight: 600; }

/* Rows that collapse to a summary (2.3). */
.row { border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.row-head { display: flex; align-items: center; gap: var(--space-1); min-height: 52px; }
.row-toggle {
  flex: 1; min-width: 0; justify-content: flex-start; border: 0; background: none;
  padding: var(--space-2) var(--space-1); text-align: left; gap: var(--space-2);
}
.row-toggle .ic { color: var(--muted); }
.row-title { display: flex; flex-direction: column; min-width: 0; }
.row-title strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title small { color: var(--muted); font-size: var(--t-hint); }
.row-body { padding: var(--space-1) 0 var(--space-3); }
.row-body.inset { padding-left: 34px; }
@media (max-width: 560px) { .row-body.inset { padding-left: 0; } }

/* Reorder handle and row menu (3.3). */
.grip { cursor: grab; touch-action: none; color: var(--muted); border-color: transparent; background: none; }
.grip:active { cursor: grabbing; }
.dragging { position: relative; z-index: 3; background: var(--surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); border-radius: var(--radius-s); }
.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.drop-after { box-shadow: 0 3px 0 var(--accent); }
.more-btn { border-color: transparent; background: none; color: var(--muted); }

/* One accomplishment or picked line: text, then its tools. Tools sit
   under the text on phones so the text gets the width (1.3). */
.line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-1) var(--space-2); align-items: start; padding: var(--space-2) 0; }
.line + .line { border-top: 1px dashed var(--line); }
.line .lead { padding-top: 2px; }
.line .tools { display: flex; gap: 2px; }
@media (max-width: 560px) {
  .line { grid-template-columns: auto minmax(0, 1fr); }
  .line .tools { grid-column: 1 / -1; justify-content: flex-end; }
}
.line textarea { width: 100%; }
.badge-btn { position: relative; }
.badge-btn .count-dot {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.details-panel { grid-column: 1 / -1; background: var(--sunken); border-radius: var(--radius-s); padding: var(--space-3) var(--space-3) 0; }

/* Picking (Versions). */
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 2px; gap: 2px;
  background: var(--sunken);
}
.seg button { min-height: 36px; border: 0; background: none; padding: 4px 12px; font-size: 14px; color: var(--muted); border-radius: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg button.armed { color: var(--danger); }
.seg.small button { min-height: 32px; font-size: 13px; padding: 2px 10px; }
@media (pointer: coarse) { .seg button { min-height: 40px; } .seg.small button { min-height: 36px; } }
.all-note { color: var(--muted); font-size: 14px; margin: 0; }

.tick { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.tick input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.line .tick { height: 40px; }

/* Left out: quieter, no text box, one tap to bring back (2.5). */
.left { margin-top: var(--space-2); }
.left > summary { font-size: var(--t-hint); font-weight: 600; color: var(--muted); padding: var(--space-2) 0; }
.off {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left; justify-content: flex-start;
  background: var(--sunken); border: 1px solid transparent; color: var(--muted); margin-bottom: var(--space-1);
  font-size: var(--t-label);
}
.off .off-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.off .show { color: var(--accent); font-size: var(--t-hint); display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.off .show .ic { width: 16px; height: 16px; }
.gone { display: flex; align-items: center; gap: var(--space-2); color: var(--danger); font-size: 14px; padding: var(--space-2) 0; }
.gone span { flex: 1; }

.own { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: var(--t-hint); margin-top: 4px; }
.own .ic { width: 15px; height: 15px; }
.own .link { font-size: var(--t-hint); }

/* Outdated wording (2.6). */
.warn {
  background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--radius-s);
  padding: var(--space-2) var(--space-3); font-size: 14px; margin-top: 6px;
}
.warn-title { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.warn-title .ic { width: 16px; height: 16px; color: var(--warn); }
.warn-text { margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.warn-text.all { display: block; }
.warn .link { font-size: var(--t-hint); color: var(--warn-ink); text-decoration: underline; }
.warn-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }
.warn-actions button { min-height: 40px; font-size: 14px; background: var(--surface); }
.stale-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--warn); font-size: 12px; font-weight: 700; }
.stale-badge .ic { width: 14px; height: 14px; }

/* Skill chips wrap their text instead of running off the card (1.1). */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 var(--space-3) 44px; }
@media (max-width: 560px) { .chips { padding-left: 0; } }
.chip {
  flex: 0 1 auto; max-width: 100%; min-width: 0; flex-direction: row; align-items: flex-start; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 18px; font-size: 14px; color: var(--muted);
  cursor: pointer; min-height: 36px; overflow-wrap: anywhere;
}
.chip.on { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.chip input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }

.json-box { margin: var(--space-2) 0; }
.json-box[open] summary { margin-bottom: var(--space-2); }

/* Save bar: only while there's something to save (1.2). One row. */
.savebar {
  display: none; position: sticky; z-index: 3;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  align-items: center; gap: 10px; flex-wrap: nowrap;
  min-height: var(--save-h); margin: 0 calc(-1 * var(--space-4));
  padding: 10px var(--space-4); background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .06);
}
.savebar.dirty { display: flex; animation: rise .15s ease-out; }
.savebar .status { flex: 1 1 auto; min-width: 0; font-size: 14px; }
.savebar button { flex: none; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (min-width: 980px) { .split .savebar { margin: 0; border-radius: var(--radius-m); border: 1px solid var(--line); } }

/* Styles: layouts as thumbnails (2.8). */
.themes {
  display: flex; gap: var(--space-3); overflow-x: auto; padding: var(--space-1) 2px var(--space-3);
  scroll-snap-type: x mandatory; margin-bottom: var(--space-2);
}
.theme {
  flex: none; width: 112px; flex-direction: column; gap: 6px; padding: 6px; scroll-snap-align: start;
  border-radius: var(--radius-s); position: relative; font-size: 14px;
}
.theme .thumb { width: 100%; aspect-ratio: 8.5 / 11; background: #fff; border-radius: 2px; box-shadow: var(--page-edge); display: block; object-fit: cover; }
.theme .thumb.loading { background: var(--sunken); box-shadow: none; }
.theme[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme .picked { position: absolute; top: 10px; right: 10px; background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.theme .picked .ic { width: 14px; height: 14px; stroke-width: 2.5; }
.theme:disabled { opacity: 1; cursor: default; }
.fonts-text { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 var(--space-3); font-size: var(--t-label); }
.fonts-text dt { color: var(--muted); }
.fonts-text dd { margin: 0; }
#st-builtin h2 { margin-bottom: 2px; }

.ed > .add, .ed > .rows + .add { margin-top: var(--space-2); }
.badge-btn { border-color: transparent; background: none; color: var(--muted); }
.badge-btn.on { color: var(--accent); background: var(--accent-soft); }
/* Checkboxes aren't text inputs: no 44px box around them. */
.chip input, .tick input { min-height: 0; padding: 0; }
/* The zoomed page scrolls under a fixed bar, starting at its top. */
.zoom[open] { display: flex; flex-direction: column; }
.zoom-bar { flex: none; }
.zoom-pages { flex: 1; min-height: 0; }
@media (max-width: 560px) {
  /* Phones: a picker takes its own row; buttons share the next. */
  .controls > label { flex-basis: 100%; }
}

/* ---- the three steps -------------------------------------------------------- */

/* Navigation reads as a sequence: numbered, with an arrow between steps. */
.step-n {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; border: 1.5px solid currentColor;
}
.nav a[aria-current="step"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav a[aria-current="step"] .step-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (min-width: 720px) {
  .nav { align-items: center; }
  .nav a .ic { display: none; }
  .nav a + a { margin-left: 18px; }
  .nav a + a::before {
    content: ""; position: absolute; left: -16px; top: 50%; width: 7px; height: 7px;
    border-top: 1.5px solid var(--line); border-right: 1.5px solid var(--line);
    transform: translateY(-50%) rotate(45deg);
  }
}
@media (max-width: 719px) {
  .nav a[aria-current="step"] { background: none; }
  .nav a .step-n { position: absolute; top: 5px; left: calc(50% - 30px); width: 16px; height: 16px; font-size: 10px; border-width: 1px; }
}
.next-row { display: flex; justify-content: flex-end; margin: var(--space-2) 0 var(--space-4); }
button.next { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* Studio. */
.sub-h { margin: var(--space-2) 0 var(--space-3); }
.pv-title { font-weight: 600; padding-bottom: 12px; flex: 1; }
.pv-title small { color: var(--muted); font-weight: 400; font-size: var(--t-hint); margin-left: 6px; }
.slider { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px var(--space-3); }
.slider output { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.slider input {
  grid-column: 1 / -1; padding: 0; min-height: 36px; border: 0; background: none;
  accent-color: var(--accent);
}
.presets > summary { font-size: var(--t-label); font-weight: 600; color: var(--ink); }
.presets[open] > summary { margin-bottom: var(--space-2); }
.preset { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-1) 0; }
.preset .grow, .grow { flex: 1; min-width: 0; }
.preset button { min-height: 36px; }

/* ---- copies ----------------------------------------------------------------- */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* Copies comes after the three steps, set apart from them. */
@media (min-width: 720px) {
  .nav a.after-steps { margin-left: 28px; }
  .nav a.after-steps .ic { display: block; }
  .nav a.after-steps::before { left: -15px; width: 0; height: 22px; border: 0; border-left: 1px solid var(--line); transform: translateY(-50%); }
}
.nav a[aria-current="step"].after-steps { color: var(--accent); }

.copies { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.copies th { text-align: left; font-size: var(--t-hint); font-weight: 600; color: var(--muted); padding: 10px var(--space-3); border-bottom: 1px solid var(--line); }
.copies td { padding: var(--space-3); vertical-align: top; border-bottom: 1px solid var(--line); }
.copies tr:last-child td { border-bottom: 0; }
.copies td strong { display: block; font-weight: 600; }
.copies td small { display: block; color: var(--muted); font-size: var(--t-hint); }
.copy-thumb { width: 96px; min-height: 124px; align-items: stretch; }
.copy-thumb img { width: 96px; max-width: none; }
.copy-thumb img:not(:first-child) { display: none; }
.c-actions { white-space: nowrap; text-align: right; }
@media (max-width: 719px) {
  /* Phones: each copy is a card, its preview on the left. */
  .copies, .copies tbody { display: block; border: 0; background: none; }
  .copies thead { display: none; }
  .copies tr {
    display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px var(--space-3);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
    padding: var(--space-3); margin-bottom: var(--space-3);
  }
  .copies td { display: block; padding: 0 0 var(--space-2); border: 0; grid-column: 2; }
  .copies td.c-thumb { grid-column: 1; grid-row: 1 / span 4; }
  .copies td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .copies td[data-label="Made"]::before { display: none; }
  .c-actions { text-align: left; }
}

/* ---- one home page, and a flow -------------------------------------------------- */

/* Home has no navigation. The three steps show only inside the flow that
   "New resume" opens, as its progress, with a close button back to home. */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); flex-wrap: wrap; }
.home-head h1 { font-size: 24px; margin: 0 0 var(--space-1); }
.home-head .hint { margin: 0; }
#flow-close { margin-left: -8px; }
body.home .brand-name { display: inline; }
body.home .screen-title { display: none; }
@media (max-width: 719px) {
  /* Phones: no bottom bar. In the flow, the steps sit under the header. */
  :root { --nav-h: 0px; }
  body.flow { --bar-h: 100px; }
  .bar-in { flex-wrap: wrap; height: auto; min-height: 56px; }
  .nav {
    position: static; order: 9; flex: 1 0 100%; padding: 0 0 6px; border: 0; background: none; gap: 6px;
  }
  .nav a {
    flex: 1; flex-direction: row; gap: 6px; height: 38px; padding: 0 4px; font-size: 13px;
    border-radius: var(--radius-s); background: var(--sunken);
  }
  .nav a[aria-current="step"] { background: var(--accent-soft); }
  .nav a .ic { display: none; }
  .nav a .step-n { position: static; width: 18px; height: 18px; font-size: 11px; }
  .nav .badge { position: static; }
  .home-head .primary { width: 100%; }
}
/* Profile sits in the header, beside the account button. */
#open-profile { margin-left: auto; padding: var(--space-2) 12px; }
.savestate:not([hidden]) + #open-profile { margin-left: var(--space-1); }
#open-profile:not([hidden]) + #account, #open-profile + #account { margin-left: 0; }
#open-profile[hidden] + #account { margin-left: auto; }
.savestate:not([hidden]) + #open-profile[hidden] + #account { margin-left: var(--space-1); }
@media (max-width: 719px) {
  .home-head .primary { width: 100%; }
  /* In the flow a phone's header is full; Profile is one tap away on home. */
  body.flow #open-profile { display: none; }
  body.flow .savestate:not([hidden]) ~ #account { margin-left: var(--space-1); }
  body.flow .savestate[hidden] ~ #account { margin-left: auto; }
}
/* A page off home that isn't a flow step (Profile, its import) names itself
   in the header; on phones the name already replaces the brand. */
@media (min-width: 720px) {
  body.page .screen-title { display: inline; margin-left: var(--space-3); padding-left: var(--space-3); border-left: 1px solid var(--line); font-weight: 500; }
}
@media (max-width: 560px) {
  /* Phones: a toolbar's hint gets its own line above its buttons. */
  .toolbar { flex-wrap: wrap; }
  .toolbar .grow { flex-basis: 100%; padding-top: 0; }
  .toolbar > button:not(.icon) { flex: 1; }
}

/* ---- drafts on home ------------------------------------------------------------- */

.list-h { font-size: var(--t-label); color: var(--muted); font-weight: 600; margin: var(--space-4) 0 var(--space-2); }
.drafts { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.draft {
  display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-m);
}
.draft strong { display: block; }
.draft small { display: block; color: var(--muted); font-size: var(--t-hint); }
.draft .clamp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#st-title { margin: 0; align-self: center; }
