/*
 * CV Atlas – builder interface. The CV sheets have their own stylesheet (cv.css).
 * Calm, layered surfaces in the spirit of Apple's interfaces: one accent colour, hairline
 * separators, soft depth, clear type hierarchy and quiet motion. Brand colours match the logo
 * and docs/brand.md: Atlas Navy #1F4E79 (light) / Sky #8DB8E4 (dark), Cloud and Night backgrounds.
 */


/* ── Tokens ── */
@font-face { font-family: 'Atlas Display'; src: url('../fonts/alegreya/AlegreyaSans-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  /* Surfaces, back to front */
  --bg: #f7f9fe; --surface: #ffffff; --surface-2: #f9fafc; --sunken: #edf2fc; --raised: #ffffff; --glass: rgba(251, 252, 254, .8);
  --line: rgba(20, 44, 122, .12); --line-2: rgba(20, 44, 122, .2); --hairline: rgba(20, 44, 122, .09);
  /* Text: --ink-3 keeps 4.5:1 on every surface */
  --ink: #0e1630; --ink-2: #3a4566; --ink-3: #56607d;
  /* Accent */
  --brand: #1e4fd8; --brand-hover: #173fb0; --brand-ink: #ffffff; --brand-soft: #e8effd; --brand-tint: rgba(30, 79, 216, .12);
  --focus: #1e4fd8; --focus-ring: 0 0 0 3px rgba(30, 79, 216, .3);
  /* Status */
  --good: #166534; --good-bg: #e7f6ec; --warn: #92400e; --warn-bg: #fdf1df; --bad: #b42318; --bad-bg: #fdecea;
  /* Shape and depth */
  --r-l: 16px; --r: 12px; --r-s: 9px; --r-xs: 7px;
  --shadow-1: 0 1px 2px rgba(20, 44, 122, .05);
  --shadow-2: 0 1px 2px rgba(20, 44, 122, .04), 0 8px 24px -12px rgba(20, 44, 122, .14);
  --shadow-3: 0 2px 6px rgba(20, 44, 122, .06), 0 24px 60px -20px rgba(20, 44, 122, .35);
  --control-h: 38px; --touch: 44px;
  --ease: cubic-bezier(.2, .8, .2, 1); --fast: 140ms; --med: 220ms;
  --topbar-h: 58px;
  color-scheme: light;
}
/* ── Base ── */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Noto Sans', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 20px 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
::selection { background: var(--brand-tint); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.small { font-size: 13px; }
.muted { color: var(--ink-3); }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap-s { gap: 8px; }
.mt-s { margin-top: 12px; }
.noscript { padding: 24px; }

.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }

/* ── Buttons ── */
.btn {
  font: inherit; font-size: 14px; font-weight: 500; letter-spacing: -.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-h); padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  box-shadow: var(--shadow-1);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--focus); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn-small { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.btn-primary { background: var(--brand); border-color: transparent; color: var(--brand-ink); box-shadow: 0 1px 2px rgba(20, 44, 122, .12), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--brand-hover); border-color: transparent; color: var(--brand-ink); }
.btn-secondary { background: var(--brand-soft); border-color: transparent; color: var(--brand); box-shadow: none; }
.btn-secondary:hover { background: var(--brand-tint); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-danger { background: var(--bad); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(.94); color: #fff; }
.danger { color: var(--bad); }
.btn-add { margin-top: 10px; width: 100%; border-radius: var(--r-s); border: 1.5px dashed var(--line-2); color: var(--brand); background: transparent; box-shadow: none; }
.btn-add:hover { background: var(--brand-soft); border-color: var(--brand); }
.icon-btn {
  font: inherit; font-size: 13px; width: 32px; height: 32px; border-radius: 8px; border: 0;
  background: transparent; color: var(--ink-3); cursor: pointer; display: inline-grid; place-items: center;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.icon-btn:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-bg); }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--bad); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ── Top bar: translucent glass over the workspace ── */
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: var(--topbar-h);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--glass); border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -.015em; }
.status { font-size: 12px; color: var(--ink-3); }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Workspace ── */
.workspace { display: grid; grid-template-columns: minmax(380px, 560px) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.editor-pane { border-right: 1px solid var(--hairline); background: var(--bg); min-width: 0; display: flex; flex-direction: column; }

/* Tabs as a segmented control */
.tabs {
  position: sticky; top: calc(var(--topbar-h) + 10px); z-index: 10;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 12px 12px 0; padding: 3px; border-radius: 11px;
  /* Scroll shadows: a soft edge appears only on the side that has more tabs to scroll to. */
  background:
    linear-gradient(90deg, var(--sunken) 40%, transparent) left / 28px 100% no-repeat local,
    linear-gradient(270deg, var(--sunken) 40%, transparent) right / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--line-2), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--line-2), transparent) right / 12px 100% no-repeat scroll,
    var(--sunken);
  box-shadow: inset 0 0 0 1px var(--hairline);
  /* The outline paints the page colour around the pill, so scrolled content never shows through the gaps. */
  outline: 10px solid var(--bg);
  scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2);
  background: transparent; border: 0; border-radius: 8px; padding: 6px 9px; min-height: 32px;
  cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; justify-content: center; flex: 1 0 auto;
  scroll-snap-align: start;
  transition: background-color var(--med) var(--ease), color var(--fast) var(--ease), box-shadow var(--med) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.on { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 44, 122, .1), 0 1px 1px rgba(20, 44, 122, .04); }
.tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.count { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 6px; font-variant-numeric: tabular-nums; }
.editor { padding: 16px 16px 8px; flex: 1; }
.foot { padding: 0 20px 18px; line-height: 1.55; }
nav.foot { padding-top: 0; }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--brand); text-decoration: underline; }

/* Preview */
.preview-pane { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; min-width: 0; background: var(--sunken); }
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--hairline); background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.preview-info { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.preview-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pages-wrap { flex: 1; overflow: auto; padding: 24px; scrollbar-gutter: stable; }
.preview-toggle { display: none; }

/* ── Cards (grouped sections) ── */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-l); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.card-head h2 .muted { font-weight: 400; font-size: 13px; margin-left: 6px; letter-spacing: 0; }

/* ── Form controls ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.grid-2 .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field > span:empty { display: none; }
.field small { color: var(--ink-3); font-size: 12px; line-height: 1.4; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=month], input[type=date], select, textarea {
  font: inherit; font-size: 15px; width: 100%; min-height: var(--control-h); padding: 8px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r-s); background: var(--surface); color: var(--ink);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: var(--focus-ring); }
textarea { resize: vertical; line-height: 1.55; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23878b95' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
select option, select optgroup { background: var(--surface); color: var(--ink); }
input[type=color] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line-2); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type=range] { width: 100%; accent-color: var(--brand); }

/* Checkboxes */
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; min-height: 32px; }
.check.wide { grid-column: 1 / -1; }
.check input, .sec-row input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 19px; height: 19px; margin: 0;
  border: 1.5px solid var(--line-2); border-radius: 6px; background: var(--surface); cursor: pointer;
  display: inline-grid; place-items: center;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.check input::after, .sec-row input[type=checkbox]::after {
  content: ''; width: 5px; height: 9px; margin-top: -2px; border: solid var(--brand-ink); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform var(--fast) var(--ease);
}
.check input:checked, .sec-row input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after, .sec-row input[type=checkbox]:checked::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible, .sec-row input[type=checkbox]:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Switches (iOS-style; still real checkboxes) */
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; min-height: 32px; }
.switch input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; position: relative; margin: 0; cursor: pointer;
  width: 40px; height: 24px; border-radius: 999px; background: var(--line-2);
  transition: background-color var(--med) var(--ease);
}
.switch input::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform var(--med) var(--ease);
}
.switch input:checked { background: var(--brand); }
.switch input:checked::before { transform: translateX(16px); }
.switch input:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.switch-row { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.field-with-switch { display: flex; flex-direction: column; gap: 6px; }

/* Badges */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; letter-spacing: .005em; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-neutral { background: var(--sunken); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--hairline); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }

/* ── Target tab ── */
.hero { padding: 8px 2px 20px; }
.hero h1 { font-size: 28px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 10px; }
.hero p { color: var(--ink-2); max-width: 60ch; font-size: 15.5px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 8px; border-radius: var(--r); overflow: hidden; background: var(--hairline); border: 1px solid var(--hairline); }
.fact { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface-2); }
.fact dt { font-size: 12px; color: var(--ink-3); }
.fact dd { margin: 0; font-size: 13.5px; font-weight: 500; }
.tips { margin: 0 0 12px; padding-left: 18px; }
.tips li { margin-bottom: 6px; font-size: 14px; color: var(--ink-2); }
.tips li::marker { color: var(--brand); }
.callout { background: var(--brand-soft); border-radius: var(--r-s); padding: 11px 13px; font-size: 14px; border: 1px solid var(--brand-tint); }

/* ── Repeatable entries ── */
.entity-list .empty { color: var(--ink-3); font-size: 14px; margin: 2px 0 4px; }
.entity { border: 1px solid var(--hairline); border-radius: var(--r); margin-bottom: 8px; background: var(--surface-2); transition: background-color var(--fast) var(--ease), box-shadow var(--med) var(--ease); }
.entity[open] { background: var(--surface); box-shadow: var(--shadow-2); border-color: var(--line); }
.entity > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 8px 9px 14px; cursor: pointer; border-radius: var(--r); min-height: 52px; }
.entity > summary::-webkit-details-marker { display: none; }
.entity > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.entity-text { display: flex; flex-direction: column; min-width: 0; }
.entity-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-tools { display: flex; gap: 0; flex-shrink: 0; opacity: .75; transition: opacity var(--fast) var(--ease); }
.entity:hover .entity-tools, .entity[open] .entity-tools, .entity-tools:focus-within { opacity: 1; }
.entity > .grid-2 { padding: 6px 14px 16px; border-top: 1px solid var(--hairline); margin-top: 0; padding-top: 14px; }

/* Personal details */
.personal-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; padding: 10px 0; border-top: 1px solid var(--hairline); }
.personal-row:first-of-type { border-top: 0; padding-top: 2px; }
.personal-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-bottom: 4px; }
.personal-row.discouraged input[type=text], .personal-row.discouraged input[type=date] { background: var(--surface-2); }

/* Photo */
.photo-empty { display: grid; justify-items: start; gap: 10px; }
.photo-editor { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; }
.photo-stage { width: 140px; height: 168px; overflow: hidden; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--sunken); cursor: grab; touch-action: none; box-shadow: var(--shadow-1); }
.photo-stage:active { cursor: grabbing; }
.photo-stage:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.photo-stage.square, .photo-stage.circle { height: 140px; }
.photo-stage.circle { border-radius: 50%; }
.photo-stage img { width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; pointer-events: none; }
.photo-controls { display: grid; gap: 12px; }

/* Segmented control */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--hairline); }
.seg-btn { font: inherit; font-size: 13px; font-weight: 500; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); padding: 5px 12px; min-height: 30px; cursor: pointer; transition: background-color var(--med) var(--ease), color var(--fast) var(--ease), box-shadow var(--med) var(--ease); }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 44, 122, .12); }
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ── Design tab ── */
.layout-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.layout-card {
  font: inherit; text-align: left; display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 10px 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: border-color var(--fast) var(--ease), box-shadow var(--med) var(--ease), transform var(--fast) var(--ease);
}
.layout-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.layout-card:active { transform: scale(.99); }
.layout-card.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-2); background: var(--surface); }
.layout-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.layout-thumb { width: 100%; height: 72px; border-radius: 6px; background: #fff; border: 1px solid rgba(17, 18, 22, .1); margin-bottom: 6px; position: relative; overflow: hidden; }
.layout-thumb::before, .layout-thumb::after { content: ''; position: absolute; background: #c9cdd4; border-radius: 2px; }
.thumb-classic::before { left: 30%; right: 30%; top: 8px; height: 7px; background: #4b5160; } .thumb-classic::after { left: 12%; right: 12%; top: 22px; height: 42px; background: repeating-linear-gradient(#c9cdd4 0 3px, transparent 3px 8px); }
.thumb-modern::before { left: 0; top: 0; bottom: 0; width: 32%; background: #1f4e79; } .thumb-modern::after { left: 38%; right: 8%; top: 10px; height: 54px; background: repeating-linear-gradient(#c9cdd4 0 3px, transparent 3px 8px); }
.thumb-compact::before { left: 8%; width: 40%; top: 7px; height: 7px; background: #4b5160; } .thumb-compact::after { left: 8%; right: 8%; top: 20px; height: 46px; background: repeating-linear-gradient(#8a909b 0 2px, transparent 2px 4px, #c9cdd4 4px 6px, transparent 6px 9px); }
.thumb-detailed::before { left: 8%; width: 18%; top: 10px; height: 54px; background: repeating-linear-gradient(#8a909b 0 3px, transparent 3px 13px); } .thumb-detailed::after { left: 32%; right: 8%; top: 10px; height: 54px; background: repeating-linear-gradient(#c9cdd4 0 3px, transparent 3px 8px); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); cursor: pointer; transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }
.sec-list { display: grid; gap: 2px; }
.sec-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; padding: 3px 4px 3px 8px; border-radius: var(--r-s); transition: background-color var(--fast) var(--ease); }
.sec-row:hover { background: var(--surface-2); }
.sec-row.off .sec-title { color: var(--ink-3); text-decoration: line-through; }
.sec-title { min-height: 34px !important; padding: 5px 8px !important; border-color: transparent !important; background: transparent !important; box-shadow: none !important; }
.sec-title:hover { background: var(--sunken) !important; }
.sec-title:focus { border-color: var(--focus) !important; background: var(--surface) !important; box-shadow: var(--focus-ring) !important; }
.sec-move { display: flex; }

/* ── Check tab ── */
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.issue { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: start; padding: 12px 14px 12px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--hairline); overflow: hidden; }
.issue.fix { background: var(--bad-bg); border-color: rgba(180, 35, 24, .16); }
.issue.improve { background: var(--warn-bg); border-color: rgba(146, 64, 14, .16); }
.issue.tip { background: var(--brand-soft); border-color: var(--brand-tint); }
.issue-text { font-size: 14px; line-height: 1.5; }
.issue-tools { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.all-clear { padding: 14px; border-radius: var(--r); background: var(--good-bg); color: var(--good); font-weight: 500; }

/* ── Dialog and toast ── */
.dialog { border: 0; border-radius: 18px; padding: 24px; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); }
.dialog[open] { animation: dialog-in var(--med) var(--ease); }
.dialog::backdrop { background: rgba(10, 11, 14, .42); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog h2 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; margin-bottom: 10px; }
.dialog p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 100;
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-3); max-width: calc(100vw - 32px);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: opacity var(--med) var(--ease), transform var(--med) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Narrow screens: one pane at a time ── */
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .editor-pane { border-right: 0; }
  .preview-pane { display: none; position: static; height: auto; min-height: calc(100vh - var(--topbar-h)); }
  body.show-preview .preview-pane { display: flex; }
  body.show-preview .editor-pane { display: none; }
  .pages-wrap { padding: 16px; }
  .preview-toggle {
    display: inline-flex; align-items: center; justify-content: center; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30;
    font: inherit; font-weight: 600; min-height: 48px; padding: 0 22px; border-radius: 99px; border: 0;
    background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-3); cursor: pointer;
    transition: transform var(--fast) var(--ease);
  }
  .preview-toggle:active { transform: scale(.97); }
  .preview-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-3); }
  .when-previewing { display: none; }
  body.show-preview .when-previewing { display: inline; }
  body.show-preview .when-editing { display: none; }
  .editor-pane { padding-bottom: 76px; } /* room for the floating Preview button */
}

/* Touch screens and phones: 44 px targets, 16 px inputs (no iOS zoom on focus) */
@media (pointer: coarse), (max-width: 560px) {
  .btn, .btn-small { min-height: var(--touch); }
  .icon-btn { width: var(--touch); height: var(--touch); }
  .tab { min-height: 38px; }
  .seg-btn { min-height: 38px; }
  .check, .switch { min-height: var(--touch); }
  input[type=text], input[type=email], input[type=tel], input[type=url], input[type=month], input[type=date], select, textarea { font-size: 16px; min-height: var(--touch); }
  .swatch { width: 36px; height: 36px; }
}
@media (max-width: 560px) {
  /* The header wraps to two rows here, so it scrolls away and only the tabs stay pinned. */
  :root { --topbar-h: 0px; }
  .topbar { position: static; padding: 10px 16px; }
  /* Collapsed entries give their title the full width; the tools appear once an entry is open. */
  .entity:not([open]) .entity-tools { display: none; }
  .tabs { margin: 10px 12px 0; }
  .editor { padding: 12px 16px 8px; }
  .card { padding: 16px; border-radius: var(--r); }
  .grid-2, .facts, .layout-grid { grid-template-columns: 1fr; }
  .photo-editor { grid-template-columns: 1fr; }
  .personal-row { grid-template-columns: 1fr; }
  .personal-meta { flex-direction: row; justify-content: space-between; align-items: center; padding-bottom: 0; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; padding-left: 8px; padding-right: 8px; }
  .preview-bar { padding: 10px 16px; }
  .hero h1 { font-size: 24px; }
}

/*
 * ── Builder flow ──
 * First-run setup, step navigation, CV menu, banners, comboboxes, month picker, export sheet and
 * the phone bottom bar. Folded in from flow.css (web developer) and polished; it comes after the
 * rules above on purpose, so the one-row header and the bottom bar win on narrow screens.
 */

/* Header: one row on every screen */
.topbar { flex-wrap: nowrap; gap: 10px; }
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; border-radius: var(--r-xs); }
.topbar .brand:focus-visible { outline: none; box-shadow: var(--focus-ring); }
img.logo, .loading img.logo { width: 32px; height: 32px; background: none; box-shadow: none; border-radius: 0; display: block; }
.cv-menu-wrap { position: relative; min-width: 0; flex: 0 1 auto; display: flex; margin-right: auto; }
.cv-menu-btn {
  font: inherit; font-size: 14px; font-weight: 500; letter-spacing: -.005em;
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 36px; padding: 0 12px 0 14px;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-1);
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.cv-menu-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.cv-menu-btn[aria-expanded="true"] { border-color: var(--brand); }
.cv-menu-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
#cv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.caret { color: var(--ink-3); font-size: 11px; transition: transform var(--fast) var(--ease); }
.cv-menu-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.topbar .status { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.topbar .status.bad { color: var(--bad); font-weight: 600; }
.top-download { flex-shrink: 0; }

/* CV menu */
.cv-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - var(--topbar-h) - 24px); max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-3);
  animation: menu-in var(--fast) var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.cv-menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 6px 4px; }
.menu-label { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 6px 10px 4px; text-transform: uppercase; letter-spacing: .04em; }
.menu-cvs.scroll { max-height: calc(8 * 40px); overflow-y: auto; }
.menu-item {
  font: inherit; font-size: 14px; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 6px 10px;
  border: 0; border-radius: var(--r-xs); background: none; color: var(--ink); text-align: left; cursor: pointer;
  transition: background-color var(--fast) var(--ease);
}
.menu-item:hover, .menu-item:focus-visible, .menu-item:focus-within { background: var(--brand-soft); outline: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--bad-bg); }
.cv-row .tick { width: 14px; color: var(--brand); flex-shrink: 0; }
.cv-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-row.on .cv-row-name { font-weight: 600; }
.cv-row-meta { font-size: 12px; color: var(--ink-3); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.menu-foot { margin: 6px 10px 4px; }

/* Steps: a row of pills on wide screens, a compact name with arrows on narrow ones */
.steps {
  position: sticky; top: var(--topbar-h); z-index: 10; padding: 10px 16px 0; border-bottom: 1px solid var(--hairline);
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
body.in-setup .steps, body.in-setup .step-foot { display: none; }
.step-list { display: flex; flex-wrap: wrap; gap: 4px; }
.step {
  font: inherit; font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 12px 4px 8px;
  border: 0; border-radius: 99px; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background-color var(--med) var(--ease), color var(--fast) var(--ease), box-shadow var(--med) var(--ease);
}
.step:hover { color: var(--ink); background: var(--sunken); }
.step.on { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.step:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sunken); font-size: 11.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px var(--hairline); }
.step.on .step-n { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-3); flex-shrink: 0; }
.step-dot.is-started { background: linear-gradient(90deg, var(--ink-3) 50%, transparent 50%); }
.step-dot.is-done { background: var(--good); border-color: var(--good); }
.step-dot.fix { box-shadow: 0 0 0 2px var(--warn-bg), 0 0 0 3.5px var(--warn); }
.step-compact { display: none; align-items: center; gap: 4px; }
.step-compact-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-compact .icon-btn { font-size: 22px; line-height: 1; color: var(--ink-2); }
.step-dots { display: inline-flex; gap: 8px; margin-left: 8px; flex-shrink: 0; padding: 0 4px; }
.progress { height: 3px; margin: 10px -16px 0; background: var(--hairline); overflow: hidden; }
.progress span { display: block; width: 100%; height: 100%; background: var(--brand); border-radius: 0 2px 2px 0; transform-origin: left center; transition: transform var(--med) var(--ease); }

/* Back / Next */
.step-foot {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--hairline);
}
.step-foot .btn { white-space: normal; text-align: center; line-height: 1.25; }
.step-foot .btn-primary { min-height: var(--touch); padding-left: 20px; padding-right: 20px; font-weight: 600; }
.app-foot { padding: 16px 16px 24px; display: grid; gap: 8px; }
.app-foot p { margin: 0; }
.app-foot a { color: var(--ink-2); }
.app-foot a:hover { color: var(--brand); }
.app-foot .link.danger { display: inline-flex; align-items: center; min-height: var(--touch); }
.link.danger { color: var(--bad); }

/* Banners: storage, conflict and backup reminder */
.banners { padding: 0 16px; }
.banner {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding: 12px 14px 12px 17px;
  border-radius: var(--r); border: 1px solid var(--hairline); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden;
}
.banner { background: var(--brand-soft); border-color: var(--brand-tint); }
.banner p { margin: 0; flex: 1 1 260px; font-size: 14px; line-height: 1.5; }
.banner-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.banner-btns .btn { white-space: normal; text-align: center; }
.banner-info { background: var(--brand-soft); border-color: var(--brand-tint); }
.banner-warn { background: var(--warn-bg); border-color: transparent; color: var(--ink); }
.banner-bad { background: var(--bad-bg); border-color: transparent; color: var(--ink); }

/* First-run setup */
.setup { max-width: 560px; margin: 16px auto 0; padding: 26px 24px 24px; position: relative; }
.setup-dots { display: flex; gap: 6px; }
.setup-dots span { width: 24px; height: 4px; border-radius: 2px; background: var(--line-2); transition: background-color var(--med) var(--ease); }
.setup-dots span.on { background: var(--brand); }
.setup-count { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.setup-back { position: absolute; top: 14px; right: 14px; }
.setup-title { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin: 12px 0 18px; }
.setup-label { margin: 16px 0 8px; }
.setup-summary { margin: -6px 0 16px; color: var(--ink-2); }
.setup-summary .link { color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 500; min-height: 38px; padding: 0 15px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow-1);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.setup-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 24px; }
.setup-actions .btn-primary { min-height: var(--touch); padding-left: 24px; padding-right: 24px; font-weight: 600; }
.setup-confirm { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-s); background: var(--good-bg); color: var(--ink); font-size: 14px; }
.options { display: grid; gap: 8px; margin-bottom: 14px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--line-2); border-radius: var(--r);
  cursor: pointer; background: var(--surface); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.option:hover { border-color: var(--brand); }
.option.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
.option:focus-within { box-shadow: var(--focus-ring); border-color: var(--focus); }
.option input { margin: 2px 0 0; accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.option > span { display: grid; gap: 2px; }
#pages.sample { opacity: .55; filter: saturate(.7); }

/* Combobox */
.combo { position: relative; }
.combo-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 4px; list-style: none; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-s); box-shadow: var(--shadow-3);
}
.combo-option { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; border-radius: var(--r-xs); cursor: pointer; font-size: 14px; }
.combo-option small { color: var(--ink-3); font-size: 12px; text-align: right; }
.combo-option.active, .combo-option:hover { background: var(--brand-soft); }
.combo-option.as-typed { border-top: 1px solid var(--hairline); margin-top: 4px; color: var(--brand); border-radius: 0 0 var(--r-xs) var(--r-xs); }
.combo-group { padding: 8px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.combo-empty { padding: 8px 10px; color: var(--ink-3); font-size: 14px; }

/* Editor pieces */
.month-pick { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 6px; }
.month-pick select:disabled { opacity: .5; cursor: default; }
.empty { padding: 20px 16px; border: 1.5px dashed var(--line-2); border-radius: var(--r); text-align: center; display: grid; justify-items: center; gap: 4px; color: var(--ink-2); }
.empty p { margin: 0; }
.empty-title { font-weight: 600; color: var(--ink); }
.empty .btn { margin-top: 8px; white-space: normal; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 8px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); font-weight: 500; }
.examples { grid-column: 1 / -1; margin: 0 12px 14px; padding: 8px 12px; border-radius: var(--r-s); background: var(--surface-2); border: 1px solid var(--hairline); }
.examples summary { cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--brand); min-height: 32px; display: flex; align-items: center; }
.examples summary:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-xs); }
.examples ul { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.examples li { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); }
.never-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; margin-top: 8px; border-radius: var(--r-s); background: var(--surface-2); border: 1px solid var(--hairline); }
.never-line p { margin: 0; flex: 1 1 240px; }
.disclaimer { margin: 10px 0 0; }
.sec-empty { white-space: nowrap; }
.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 32px; border-radius: var(--r-xs); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.disclosure > summary h2 { font-size: 15.5px; font-weight: 600; margin: 0; }
.disclosure > summary::after { content: '+'; font-size: 20px; line-height: 1; color: var(--ink-3); }
.disclosure[open] > summary::after { content: '–'; }
.disclosure[open] > summary { margin-bottom: 12px; }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--brand); border-radius: var(--r-s); } 100% { box-shadow: 0 0 0 3px transparent; } }
.toast { display: flex; align-items: center; gap: 4px; }
.toast-btn { font: inherit; font-weight: 600; margin-left: 8px; min-height: 32px; padding: 4px 12px; border-radius: 8px; border: 0; background: var(--bg); color: var(--ink); cursor: pointer; flex-shrink: 0; }
.toast-btn:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }
.toast:has(.toast-btn) { pointer-events: auto; }
.boot-error { max-width: 420px; text-align: center; color: var(--ink-2); margin: 12px 16px; }
.loading { flex-direction: column; }

/* Export sheet */
.export-sheet { width: min(560px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 48px); overflow-y: auto; overscroll-behavior: contain; }
.export-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.export-head h2 { margin: 0; }
.export-head .icon-btn { margin-right: -8px; }
.export-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px 10px 15px; margin: 12px 0; border-radius: var(--r-s); background: var(--warn-bg); position: relative; overflow: hidden; }
.export-warn p { margin: 0; flex: 1 1 100%; font-size: 14px; color: var(--ink); }
.export-rows { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 12px; background: var(--surface); }
.export-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; background: var(--surface); }
.export-row + .export-row { border-top: 1px solid var(--hairline); }
.export-row strong { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.export-row p { margin: 2px 0 0; }
.export-row.off strong { color: var(--ink-3); }
.export-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.export-error { color: var(--bad); }
.export-file { margin: 12px 0 0; overflow-wrap: anywhere; }

/* Phone bottom bar */
.bottom-bar { display: none; }
.preview-toggle { display: none !important; }

@media (max-width: 980px) {
  .bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--hairline);
  }
  .bottom-bar .seg { flex: 0 0 auto; background: var(--sunken); }
  .bottom-bar .seg-btn[aria-pressed="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 44, 122, .12), 0 0 0 1px var(--hairline); }
  .bottom-bar .seg-btn { min-width: 76px; }
  .bottom-bar .btn-primary { font-weight: 600; padding-left: 22px; padding-right: 22px; }
  .editor-pane, .preview-pane { padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
  .step-foot { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .top-download { display: none; }
  .step-list { display: none; }
  .step-compact { display: flex; }
  .steps { padding-top: 4px; }
}

/* Touch screens and phones: 44 px targets for the flow controls too */
@media (pointer: coarse), (max-width: 560px) {
  .cv-menu-btn, .step, .chip, .menu-item, .combo-option, .seg-btn, .examples summary, .disclosure > summary { min-height: var(--touch); }
  .toast-btn { min-height: 40px; }
}

@media (max-width: 560px) {
  .topbar { position: sticky; padding: 8px 12px; gap: 8px; }
  .topbar .brand-name { display: none; }
  .cv-menu-wrap { flex: 1 1 auto; position: static; }
  .topbar { position: sticky; }
  /* Full width under the header, so it never runs off the right edge */
  .cv-menu { left: 12px; right: 12px; width: auto; top: calc(100% + 6px); }
  .topbar .status { max-width: 40%; }
  .steps { padding: 4px 12px 0; margin: 0; }
  .progress { margin: 4px -12px 0; }
  .banners { padding: 0 12px; }
  .setup { padding: 20px 16px; margin: 12px 12px 0; }
  .setup-title { font-size: 21px; }
  .setup-actions { flex-wrap: wrap; }
  .setup-actions .btn-primary { flex: 1 1 auto; }
  .setup-actions > span:empty { display: none; }
  .export-row { flex-direction: column; align-items: stretch; }
  .export-btns { justify-content: stretch; }
  .export-btns .btn { flex: 1; white-space: normal; text-align: center; }
  .examples li { flex-direction: column; }
  .step-foot { padding: 10px 12px; }
  .step-foot .btn { flex: 1; padding-left: 8px; padding-right: 8px; font-size: 14px; }
  dialog.export-sheet { margin: auto 0 0; width: 100vw; max-height: 92vh; max-height: 92dvh; border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  dialog.export-sheet[open] { animation: sheet-in var(--med) var(--ease); }
}
/* Small phones: the CV name gets the room. "Saved" is still read out and repeated in the footer;
   a save problem (.bad) always shows. */
@media (max-width: 420px) {
  .topbar .status:not(.bad) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (forced-colors: active) {
  .step-dot.is-done { background: CanvasText; }
  .step.on, .chip.on, .option.on { outline: 2px solid CanvasText; }
  .banner, .export-warn { border: 1px solid CanvasText; }
}
body.in-setup .top-download, body.in-setup .bottom-bar .btn-primary { display: none; }

/* Motion: respect the system setting */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* High-contrast / forced colours: keep controls visible */
@media (forced-colors: active) {
  .switch input, .check input, .sec-row input[type=checkbox] { border: 1px solid CanvasText; }
  .tab.on, .seg-btn.on { outline: 1px solid CanvasText; }
}

/* ── Printing: only the CV sheets ── */
@media print {
  /* The browser's own Print (Ctrl+P) shows no CV: printing goes through Download, which checks the plan. */
  body:not(.printing) .cv-sheet { display: none !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing { background: #fff; }
  #print-root .cv-sheet { margin: 0 !important; box-shadow: none !important; break-after: page; }
  #print-root .cv-sheet:last-child { break-after: auto; }
}

/* Two-tab conflict: the editor is paused until the user chooses (shell.js adds the class). */
body.editing-paused #editor { opacity: .55; pointer-events: none; user-select: none; transition: opacity .18s; }
@media (prefers-reduced-motion: reduce) { body.editing-paused #editor { transition: none; } }

/* QA 28 Oct: touch targets and phone bars (scripts/screen-check.mjs) */
.sec-check { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; cursor: pointer; }
.foot a { display: inline-block; padding: 3px 0; min-height: 24px; }
@media (pointer: coarse), (max-width: 560px) {
  .sec-check { min-width: var(--touch); min-height: var(--touch); }
  .swatch { width: var(--touch); height: var(--touch); }
  .topbar .brand { min-height: var(--touch); min-width: var(--touch); justify-content: center; }
  .foot a { padding: 12px 0; }
}
@media (max-width: 980px) {
  /* The bottom bar already has Download: don't repeat it in Back / Next. */
  .step-download { display: none; }
}
/* Phones held sideways: only the bottom bar stays fixed, so the form keeps most of the screen. */
@media (max-width: 980px) and (max-height: 520px) {
  .topbar, .step-foot { position: static; }
  .steps { position: static; }
}
.app-foot nav a { display: inline-block; padding: 3px 0; min-height: 24px; }
@media (pointer: coarse), (max-width: 560px) {
  .app-foot nav a { padding: 12px 0; }
  input[type=color] { min-width: var(--touch); min-height: var(--touch); }
}
@media (pointer: coarse), (max-width: 560px) {
  .app-foot nav a { min-width: 44px; text-align: center; }
  .sec-title { min-height: var(--touch) !important; }
}
@media (max-width: 560px) {
  /* Section rows: the badge drops under the name so the name box keeps its width. */
  .sec-row { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 0; }
  .sec-row .badge { grid-column: 2; grid-row: 2; justify-self: start; margin-bottom: 6px; }
  .sec-row .sec-move { grid-column: 3; grid-row: 1; }
}
.setup-summary .link { display: inline-flex; align-items: center; min-height: 24px; padding: 0 2px; }
@media (pointer: coarse), (max-width: 560px) { .setup-summary .link { min-height: var(--touch); min-width: var(--touch); justify-content: center; } }

/* White and blue identity (P17): display face for the brand and headings, blue browser surfaces. */
::selection { background: #dce6fb; color: #142c7a; }
html { scrollbar-color: #dce6fb transparent; }
body { caret-color: #1e4fd8; }
.brand-name { font-family: 'Atlas Display', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Noto Sans', sans-serif; font-size: 19px; font-weight: 700; color: #142c7a; letter-spacing: -.01em; }

/* The name is written in capitals: CV ATLAS. The markup keeps "CV Atlas" so screen readers say it as words. */
.brand-name, #loading-text { text-transform: uppercase; letter-spacing: .06em; }
