/*
 * MakeMyCVAI — site styles (no build step; edit this file directly).
 *
 * Idea: the desk and the paper. Pages are a cool blue-grey desk; anything the user
 * fills in or reads closely sits on a white paper sheet. Ballpoint-ink blue carries
 * the brand; highlighter yellow is used sparingly to mark what matters (keywords,
 * the one key action), echoing how recruiters skim a CV.
 */

:root {
  --ink: #14306b;          /* ballpoint blue: brand, headings, primary buttons */
  --ink-strong: #0d2252;
  --text: #1e2533;         /* body text */
  --muted: #5a6475;
  --desk: #eef2f6;         /* page background */
  --paper: #ffffff;
  --rule: #d6dce5;
  --rule-strong: #b9c3d1;
  --highlight: #ffe45c;    /* highlighter */
  --stamp: #1f7a4d;        /* success / verified */
  --stamp-bg: #e5f3eb;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --focus: rgba(20, 48, 107, .28);

  --font-ui: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Zilla Slab", Georgia, "Times New Roman", serif;

  --r-paper: 3px;
  --r-control: 7px;
  --shadow-paper: 0 1px 0 rgba(20, 48, 107, .06), 0 10px 24px -14px rgba(20, 48, 107, .30);

  --gutter: 16px;
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #a9c1ff;
    --ink-strong: #c9d8ff;
    --text: #e6e9ef;
    --muted: #a3acbb;
    --desk: #141a24;
    --paper: #1c2431;
    --rule: #2e3a4c;
    --rule-strong: #43526a;
    --highlight: #e0c53a;
    --stamp: #6fd39f;
    --stamp-bg: #173326;
    --danger: #ff9b8f;
    --danger-bg: #3b1915;
    --focus: rgba(169, 193, 255, .35);
    --shadow-paper: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 28px -16px rgba(0, 0, 0, .7);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--desk);
  color: var(--text);
  font: 400 1rem/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--ink); text-underline-offset: .18em; }
a:hover { color: var(--ink-strong); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; max-width: 68ch; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---- Header -------------------------------------------------------------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }

.brand { display: inline-flex; align-items: baseline; gap: 2px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--ink); }
.brand-ai { font-family: var(--font-ui); font-size: .78rem; font-weight: 700; color: var(--ink-strong); background: var(--highlight); padding: 1px 5px 2px; border-radius: 2px; transform: translateY(-2px); }

.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.nav-link { text-decoration: none; color: var(--text); font-weight: 500; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); text-decoration: underline; }
.nav form { margin: 0; }
#main { flex: 1 0 auto; }
@media (max-width: 600px) {
  .site-header .wrap { flex-wrap: nowrap; gap: 12px; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 18px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav > * { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 480px) {
  .site-header .wrap { min-height: 56px; }
  .nav { gap: 4px 14px; }
  .nav .btn { min-height: 38px; padding: 7px 12px; font-size: .92rem; }
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--r-control);
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--text);
  font: 600 .98rem/1.2 var(--font-ui); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-link { border: 0; background: none; padding: 0; min-height: 0; color: var(--ink); font: 600 1rem/1.4 var(--font-ui); text-decoration: underline; cursor: pointer; }
.nav .btn-link { font-weight: 500; color: var(--text); text-decoration: none; }
.nav .btn-link:hover { color: var(--ink); text-decoration: underline; }
.btn-block { width: 100%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #0d1730; }
}

/* ---- Paper sheet ---------------------------------------------------------- */
.sheet { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); padding: 28px; }
.sheet + .sheet { margin-top: 24px; }
@media (max-width: 560px) { .sheet { padding: 20px 16px; } }

/* ---- Forms -------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-control);
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--text);
  font: 400 1rem/1.4 var(--font-ui);
}
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .9rem; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--ink); }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ---- Messages ----------------------------------------------------------- */
.flash { border-radius: var(--r-control); padding: 12px 14px; margin: 16px 0; border: 1px solid; }
.flash-ok { background: var(--stamp-bg); border-color: var(--stamp); color: var(--text); }
.flash-error { background: var(--danger-bg); border-color: var(--danger); color: var(--text); }
.error-summary { background: var(--danger-bg); border-left: 4px solid var(--danger); padding: 12px 14px; margin-bottom: 18px; border-radius: 0 var(--r-control) var(--r-control) 0; }
.error-summary ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- Auth pages ----------------------------------------------------------- */
.auth { padding: 48px 0 72px; }
.auth .sheet { max-width: 460px; margin: 0 auto; }
.auth h1 { font-size: 1.9rem; }
.auth .lede { color: var(--muted); }
.auth .alt { text-align: center; margin-top: 18px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 20px 0; font-size: .92rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ---- Dashboard / account ------------------------------------------------ */
.page { padding: 32px 0 72px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin: 0; }
.notice { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--paper); border: 1px dashed var(--rule-strong); border-radius: var(--r-control); padding: 12px 16px; margin-bottom: 20px; }
.notice form { margin: 0; }

.empty { text-align: left; padding: 28px; }
.empty p { color: var(--muted); }

.plan-line { display: flex; gap: 8px 24px; flex-wrap: wrap; color: var(--muted); font-size: .95rem; }
.plan-line strong { color: var(--text); }

.danger-zone { border-color: var(--danger); }
.danger-zone h2 { color: var(--danger); }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---- Utilities ------------------------------------------------------------ */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.page.narrow, .narrow { max-width: 720px; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .92rem; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { border-color: var(--rule-strong); }
.btn-locked { color: var(--muted); cursor: not-allowed; }
.btn-locked small { font-size: .72rem; font-weight: 700; background: var(--highlight); color: #1e2533; padding: 1px 5px; border-radius: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .92rem; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.crumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--rule-strong); }
.lede { font-size: 1.08rem; color: var(--muted); }
.label-like { display: block; font-weight: 600; margin-bottom: 6px; }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.pro-tag { display: inline-block; font-size: .72rem; font-weight: 700; background: var(--highlight); color: #1e2533; padding: 0 5px; border-radius: 2px; margin-left: 4px; }

/* ---- Dashboard ------------------------------------------------------------ */
.cv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cv-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-paper); padding: 14px; box-shadow: var(--shadow-paper); }
.cv-card-thumb { display: block; border: 1px solid var(--rule); background: #fff; aspect-ratio: 210 / 297; overflow: hidden; }
.cv-card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cv-card-title { font-size: 1.15rem; margin: 0 0 4px; }
.cv-card-title a { text-decoration: none; }
.cv-card-title a:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: .9rem; margin: 0; }
.cv-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: flex-start; }
.cv-card-actions form { margin: 0; }
details.confirm { position: relative; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
.confirm-box { position: absolute; z-index: 5; top: calc(100% + 6px); right: 0; width: 240px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r-control); padding: 12px; box-shadow: var(--shadow-paper); }
.confirm-box p { font-size: .92rem; margin-bottom: 10px; }
.dash-letters { margin-top: 44px; }
.dash-letters h2 { margin: 0; }
.letter-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.letter-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; }

/* ---- New CV ---------------------------------------------------------------- */
.choice { border: 0; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.choice legend { font-weight: 600; margin-bottom: 8px; }
.choice-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--rule-strong); border-radius: var(--r-control); padding: 14px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice-card input { margin-top: 4px; accent-color: var(--ink); width: 18px; height: 18px; }
.chosen-template { display: flex; gap: 14px; align-items: center; margin: 4px 0 18px; }
.chosen-template img { border: 1px solid var(--rule); background: #fff; }

/* ---- Template gallery ------------------------------------------------------ */
.gallery-head { max-width: 760px; margin-bottom: 26px; }
.gallery-layout { display: grid; grid-template-columns: 230px 1fr; gap: 32px; align-items: start; }
.side-h { font-family: var(--font-ui); font-size: .95rem; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.cat-list { list-style: none; padding: 0; margin: 0 0 22px; font-size: .95rem; }
.cat-list li { padding: 3px 0; }
.cat-list a { color: var(--text); text-decoration: none; }
.cat-list a:hover, .cat-list a[aria-current="page"] { color: var(--ink); text-decoration: underline; }
.cat-list a[aria-current="page"] { font-weight: 700; }
.filter-form { display: grid; gap: 8px; }
.result-count { color: var(--muted); margin: 0 0 12px; }
.tpl-gallery { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tpl-gallery-small { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.tpl-tile { display: block; text-decoration: none; color: var(--text); }
.tpl-tile img { display: block; width: 100%; height: auto; aspect-ratio: 210 / 297; background: #fff; border: 1px solid var(--rule); box-shadow: var(--shadow-paper); }
.tpl-tile:hover img { outline: 2px solid var(--ink); outline-offset: 2px; }
.tpl-tile-name { display: block; font-weight: 600; margin-top: 8px; }
.tpl-tile-tags { display: block; color: var(--muted); font-size: .85rem; }
.tpl-detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.tpl-detail-preview { background: #e7ebf0; border: 1px solid var(--rule); height: 78vh; min-height: 520px; overflow: hidden; }
.tpl-detail-preview iframe { width: 100%; height: 100%; border: 0; }
.tpl-detail-info { position: sticky; top: 20px; }
.similar { margin-top: 48px; }
@media (max-width: 860px) {
  .gallery-layout, .tpl-detail { grid-template-columns: 1fr; }
  .gallery-side { display: grid; gap: 4px; }
  .cat-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
  .tpl-detail-info { position: static; }
  .tpl-detail-preview { height: 70vh; }
}
@media (max-width: 420px) { .tpl-gallery { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; } }

/* ---- Editor ---------------------------------------------------------------- */
body.is-editor .site-footer { display: none; }
.editor { --bar-h: 60px; }
.ed-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px var(--gutter); background: var(--paper); border-bottom: 1px solid var(--rule); }
.ed-back { font-weight: 600; text-decoration: none; white-space: nowrap; }
.ed-back::before { content: "‹ "; }
.ed-title { flex: 1 1 180px; min-width: 0; max-width: 360px; font: 700 1.1rem/1.3 var(--font-display); color: var(--ink); border: 1px solid transparent; border-radius: var(--r-control); padding: 6px 8px; background: transparent; }
.ed-title:hover { border-color: var(--rule); }
.ed-title:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus); }
.ed-status { font-size: .88rem; color: var(--muted); min-width: 0; }
.ed-status[data-kind="error"] { color: var(--danger); font-weight: 600; }
.ed-status[data-kind="saved"]::before { content: "✓ "; color: var(--stamp); }
.ed-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.ed-actions .btn { min-height: 38px; padding: 7px 14px; }
.ed-tabs { display: none; }
.ed-body { display: grid; grid-template-columns: minmax(360px, 520px) 1fr; align-items: start; }
.ed-form { padding: 18px var(--gutter) 80px; }
.ed-preview { position: sticky; top: var(--bar-h); height: calc(100vh - var(--bar-h)); display: flex; flex-direction: column; background: #e7ebf0; border-left: 1px solid var(--rule); }
.ed-preview-stage { position: relative; flex: 1; overflow: hidden; }
.ed-preview-stage iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #e7ebf0; }
.ed-preview-stage iframe.is-loading { visibility: hidden; }
.ed-preview-note { margin: 0; padding: 8px 14px; font-size: .85rem; color: var(--muted); background: var(--paper); border-top: 1px solid var(--rule); max-width: none; }
.ed-conflict { background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--r-control); padding: 12px 14px; margin-bottom: 14px; }

.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-paper); box-shadow: var(--shadow-paper); margin-bottom: 12px; }
.panel > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 14px 16px; list-style: none; font: 700 1.08rem/1.3 var(--font-display); color: var(--ink); }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.panel[open] > summary::after { transform: rotate(-135deg); }
.panel-count { font: 600 .8rem/1 var(--font-ui); color: var(--muted); background: var(--desk); border-radius: 10px; padding: 3px 8px; }
.panel-count:empty { display: none; }
.panel-body { padding: 0 16px 16px; }
.panel-help { color: var(--muted); font-size: .93rem; margin-bottom: 12px; }
.subpanel { margin-top: 14px; border-top: 1px dashed var(--rule-strong); padding-top: 10px; }
.subpanel > summary { cursor: pointer; font-weight: 600; color: var(--ink); }

.fgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 12px; }
.f { grid-column: span 4; min-width: 0; }
.f-half { grid-column: span 2; }
.f-quarter { grid-column: span 1; }
.f-tq { grid-column: span 3; }
.f > label:not(.check) { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.f .input { min-height: 40px; padding: 8px 10px; font-size: .97rem; }
.f-check { align-self: end; padding-bottom: 8px; }
textarea.input { resize: vertical; line-height: 1.45; }
.hint { color: var(--muted); font-size: .86rem; margin-top: 4px; }
@media (max-width: 520px) { .f-half, .f-tq { grid-column: span 4; } .f-quarter { grid-column: span 2; } }

.items { display: grid; gap: 12px; }
.item { position: relative; border: 1px solid var(--rule); border-radius: var(--r-control); padding: 12px; margin: 0; min-width: 0; }
.item-legend { font-weight: 700; padding: 0 6px; max-width: calc(100% - 150px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-tools { position: absolute; top: -12px; right: 10px; display: flex; gap: 2px; background: var(--paper); padding: 0 4px; }
.tool { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 28px; padding: 0 6px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); color: var(--text); cursor: pointer; font: 600 .82rem/1 var(--font-ui); }
.tool:hover { border-color: var(--ink); color: var(--ink); }
.tool svg { width: 12px; height: 12px; fill: currentColor; }
.tool-text { padding: 0 9px; }
.btn-add { margin-top: 12px; border-style: dashed; width: 100%; }
.subitems { display: grid; gap: 10px; margin-top: 12px; }
.subitem { border-left: 3px solid var(--rule); padding-left: 10px; }
.subitem .tool { margin-top: 8px; }
.radios { border: 0; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }

.photo-field { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: start; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--rule-strong); }
.photo-field[data-photo-hidden] .photo-thumb { opacity: .45; }
.photo-thumb { width: 76px; height: 76px; border: 1px solid var(--rule); background: var(--desk); border-radius: 4px; overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-label { font-weight: 600; display: block; }
.photo-field .hint { margin: 2px 0 8px; }

.design-template { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.design-template-name { font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--rule-strong); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }
.swatch-custom input { width: 34px; height: 34px; padding: 0; border: 1px solid var(--rule-strong); border-radius: 50%; background: none; cursor: pointer; }
.order { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.order li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--rule); border-radius: var(--r-control); padding: 6px 8px 6px 12px; }
.order-tools { display: flex; gap: 4px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form .input { flex: 1 1 200px; min-height: 40px; }
.versions { list-style: none; padding: 0; margin: 0; }
.versions li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.versions .muted { display: block; font-size: .86rem; }
.versions form { margin: 0; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%); background: #1e2533; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast .btn-link { color: var(--highlight); margin-left: 8px; }

.tpl-dialog { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 8px; padding: 0; background: var(--paper); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.tpl-dialog::backdrop { background: rgba(14, 22, 38, .55); }
.tpl-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.tpl-head h2 { margin: 0; font-size: 1.3rem; }
.tpl-filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px 18px; }
.tpl-filters .input { width: auto; min-height: 38px; padding: 6px 10px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; padding: 4px 18px 18px; }
.tpl-card { display: block; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font: inherit; }
.tpl-card img { display: block; width: 100%; height: auto; aspect-ratio: 210 / 297; background: #fff; border: 1px solid var(--rule); }
.tpl-card:hover img, .tpl-card:focus-visible img { outline: 2px solid var(--ink); outline-offset: 2px; }
.tpl-card.is-current img { outline: 3px solid var(--stamp); outline-offset: 2px; }
.tpl-card.is-locked img { opacity: .6; }
.tpl-name { display: block; font-weight: 600; font-size: .92rem; margin-top: 6px; }
.tpl-tags { display: block; font-size: .8rem; color: var(--muted); }
.tpl-pro-note { margin: 0; padding: 0 18px 18px; color: var(--muted); }

@media (min-width: 981px) {
  body.is-editor .site-header { display: none; }
  .ed-form { height: calc(100vh - var(--bar-h)); overflow-y: auto; }
}
@media (max-width: 980px) {
  .ed-tabs { display: flex; position: sticky; top: var(--bar-sticky, 0); z-index: 15; background: var(--paper); border-bottom: 1px solid var(--rule); }
  .ed-tabs button { flex: 1; min-height: 44px; border: 0; background: none; font: 600 1rem var(--font-ui); color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
  .ed-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
  .ed-bar { position: static; }
  .ed-body { display: block; }
  .ed-preview { display: none; position: static; height: calc(100vh - 110px); border-left: 0; }
  .editor.show-preview .ed-form { display: none; }
  .editor.show-preview .ed-preview { display: flex; }
  .ed-actions { margin-left: 0; width: 100%; }
  .ed-actions .btn { flex: 1; }
}

/* ---- AI and ATS (editor) ---------------------------------------------------- */
.ai-credits { font-size: .88rem; color: var(--muted); margin: 0 0 10px; }
.ai-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.ai-row .hint { margin: 0; }
.btn-ai { border-color: var(--ink); color: var(--ink); background: linear-gradient(transparent 62%, rgba(255, 228, 92, .75) 62%); }
.btn-ai:hover { background: var(--highlight); color: #1e2533; }
.btn-ai[aria-busy="true"] { opacity: .7; cursor: progress; }
.ai-suggest { margin-top: 12px; border: 1px solid var(--rule-strong); border-left: 4px solid var(--highlight); border-radius: var(--r-control); padding: 12px 14px; background: var(--paper); }
.ai-suggest.is-error { border-left-color: var(--danger); }
.ai-suggest-title { font-weight: 700; margin-bottom: 6px; }
.ai-suggest .ai-text { margin: 0 0 8px; }
.ai-suggest ul.ai-text { padding-left: 18px; }
.ai-suggest ul.ai-text li { margin-bottom: 4px; }
.ai-tips-title { font-size: .88rem; font-weight: 600; color: var(--muted); margin: 8px 0 4px; }
.ai-tips { margin: 0 0 6px; padding-left: 18px; font-size: .93rem; }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ats-result { margin-top: 14px; }
.ats-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.ats-score { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 1.5rem var(--font-display); color: var(--ink); border: 3px solid var(--ink); }
.ats-score-note { margin: 0; }
.ats-checks { list-style: none; padding: 0; margin: 0; }
.ats-checks li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); }
.ats-checks p { margin: 2px 0 0; font-size: .92rem; color: var(--muted); }
.ats-status { align-self: start; font-size: .78rem; font-weight: 700; text-align: center; border-radius: 4px; padding: 3px 0; }
.is-pass .ats-status { background: var(--stamp-bg); color: var(--stamp); }
.is-warn .ats-status { background: #fff3c4; color: #7a5600; }
.is-fail .ats-status { background: var(--danger-bg); color: var(--danger); }
.is-info .ats-status { background: var(--desk); color: var(--muted); }
.chips { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: .85rem; border: 1px solid var(--rule-strong); border-radius: 14px; padding: 2px 10px; }
.chips-missing li { border-style: dashed; }
.ats-kw { margin-top: 10px; }
.letter-ai { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 4px 0 16px; padding: 12px; border: 1px dashed var(--rule-strong); border-radius: var(--r-control); }
.letter-ai .hint { margin: 0; }

/* ---- Landing and site pages ------------------------------------------------- */
.landing-hero { max-width: 760px; margin-bottom: 36px; }
.landing-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.1rem); line-height: 1.06; }
.landing-section { margin: 0 0 44px; }
.landing-section > h2 { margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.two-col h2 { margin-bottom: 10px; }
.tick-list { list-style: none; padding: 0; margin: 0; }
.tick-list li { padding: 6px 0 6px 28px; position: relative; border-bottom: 1px solid var(--rule); }
.tick-list li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 10px; height: 6px; border-left: 2px solid var(--stamp); border-bottom: 2px solid var(--stamp); transform: rotate(-45deg); }
.note-card { border-left: 4px solid var(--highlight); }
.note-card h2, .note-card h3 { font-size: 1.2rem; }
.note-card p:last-child, .note-card ul:last-child { margin-bottom: 0; }
.steps-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.order-guide { padding-left: 22px; max-width: 820px; }
.order-guide li { margin-bottom: 10px; }
.before-after { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 10px; }
.before-after .sheet { margin: 0; }
.mono-ish { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92rem; color: var(--muted); margin: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 22px; }
.feature-grid h3 { font-size: 1.1rem; margin-bottom: 4px; }
.feature-grid p { color: var(--muted); margin: 0; }
.guide-table td:first-child { font-weight: 600; white-space: nowrap; }
.example { font-size: .95rem; }
.letter-example p { margin-bottom: 10px; }
.guide-tips { margin-top: 18px; border-left: 4px solid var(--highlight); }
.guide-tips h2 { font-size: 1.2rem; }
.guide-tips ul { margin: 0; padding-left: 18px; }
.ats-tool { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; align-items: start; margin-bottom: 44px; }
.ats-tool .sheet + .sheet { margin-top: 18px; }
.legal { max-width: 820px; }
.legal h2 { margin-top: 30px; font-size: 1.35rem; }
.legal-missing { color: var(--danger); font-style: italic; }
.contact-details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 18px 0; }
.contact-details dt { font-weight: 700; }
.contact-details dd { margin: 0; }
.error-page { padding: 72px 16px; max-width: 640px; }
.error-code { font: 700 1rem var(--font-ui); color: var(--muted); margin: 0 0 6px; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 24px; }
.footer-grid nav { display: flex; flex-direction: column; gap: 6px; }
.footer-h { font: 700 .95rem var(--font-ui); color: var(--text); margin: 0 0 4px; }
.footer-note { margin: 8px 0 0; }
.footer-base { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--rule); }
.consent { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 10px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.consent p { margin: 0 0 10px; font-size: .93rem; }
.consent-actions { display: flex; gap: 8px; }
@media (max-width: 860px) {
  .two-col, .before-after, .ats-tool { grid-template-columns: 1fr; }
  .steps-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 480px) { .steps-4 { grid-template-columns: 1fr; } }

/* ---- Admin ------------------------------------------------------------------ */
.admin h1 { margin-bottom: 10px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 10px 0 14px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); }
.admin-nav a { text-decoration: none; font-weight: 600; color: var(--text); }
.admin-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: .35em; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-paper); padding: 14px; }
.kpi-alert { border-color: var(--danger); background: var(--danger-bg); }
.kpi-n { display: block; font: 700 1.6rem/1.1 var(--font-display); color: var(--ink); }
.kpi-l { color: var(--muted); font-size: .88rem; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-bottom: 18px; }
.admin-grid .sheet + .sheet { margin-top: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.status { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 4px; padding: 1px 7px; }
.status-paid { background: var(--stamp-bg); color: var(--stamp); }
.status-created { background: #fff3c4; color: #7a5600; }
.status-failed { background: var(--danger-bg); color: var(--danger); }
.admin-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-filter .input { width: auto; min-width: 200px; min-height: 40px; }
.stack { display: grid; gap: 8px; align-content: start; }
.stack label:not(.check) { font-weight: 600; font-size: .92rem; }
.row-form { display: flex; align-items: center; gap: 14px; }
.input-small { width: 90px; min-height: 34px; padding: 4px 8px; }
.mini-thumb { border: 1px solid var(--rule); background: #fff; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-control); }
.bulk-bar .check { margin-right: auto; }
.bulk-label { font-weight: 600; font-size: .92rem; }
.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin: 18px 0; }
.danger-zone form + form { margin-top: 18px; }

/* ---- Pricing --------------------------------------------------------------- */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin: 24px 0 40px; }
.plan-card { display: flex; flex-direction: column; }
.plan-card ul { padding-left: 18px; margin: 0 0 16px; }
.plan-card form, .plan-card > .btn { margin-top: auto; }
.plan-card-paid { border-top: 4px solid var(--highlight); }
.current-plan { font-weight: 600; color: var(--stamp); }

/* ---- Cover letters --------------------------------------------------------- */
.letter-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.letter-grid .sheet h1 { font-size: 1.7rem; }
.letter-text { font-size: 1rem; line-height: 1.55; }
.letter-preview { position: sticky; top: 16px; height: 86vh; background: #e7ebf0; border: 1px solid var(--rule); overflow: hidden; }
.letter-preview iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 980px) { .letter-grid { grid-template-columns: 1fr; } .letter-preview { position: static; height: 70vh; } }

/* ---- Home ------------------------------------------------------------------- */
.hero { padding: 56px 0 64px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.6rem); line-height: 1.04; letter-spacing: -.015em; max-width: 14ch; }
.hero .lede { font-size: 1.15rem; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 12px; }
.hero-note { color: var(--muted); font-size: .95rem; }
.hero-paper { margin: 0; }
.paper-sheet { background: #fff; color: #1f2328; border: 1px solid var(--rule); box-shadow: 0 2px 0 rgba(20,48,107,.05), 0 30px 60px -30px rgba(20,48,107,.45); padding: 30px 32px 34px; transform: rotate(1.2deg); font-size: .93rem; line-height: 1.5; max-width: 470px; margin-left: auto; }
.ps-name { font: 700 1.75rem/1.1 var(--font-display); color: var(--ink); }
.ps-role { color: var(--ink); font-weight: 600; margin-top: 2px; }
.ps-contact { color: #5a6475; font-size: .82rem; margin-top: 4px; }
.ps-h { font-weight: 700; color: var(--ink); border-bottom: 1px solid #c9d1dc; margin: 16px 0 6px; padding-bottom: 2px; font-size: .9rem; }
.paper-sheet p { margin: 0; }
.paper-sheet ul { margin: 4px 0 0; padding-left: 18px; }
.ps-row { display: flex; justify-content: space-between; gap: 10px; }
.ps-row span { color: #5a6475; font-size: .85rem; white-space: nowrap; }
.ps-org { color: #5a6475; }
.ps-faint { color: #8a929c; }
.paper-sheet mark { color: inherit; background-color: transparent; background-image: linear-gradient(104deg, rgba(255,228,92,0) 0.6%, rgba(255,228,92,.95) 2.4%, rgba(255,228,92,.85) 96%, rgba(255,228,92,0) 99%); background-repeat: no-repeat; background-size: 100% 78%; background-position: 0 70%; padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (prefers-reduced-motion: no-preference) {
  .paper-sheet mark { background-size: 0% 78%; animation: highlight .7s cubic-bezier(.3,.7,.3,1) forwards; }
  .paper-sheet mark:nth-of-type(1) { animation-delay: .5s; }
  .paper-sheet p mark:nth-of-type(2) { animation-delay: 1.0s; }
  .paper-sheet li mark { animation-delay: 1.5s; }
}
@keyframes highlight { to { background-size: 100% 78%; } }
.hero-paper figcaption { color: var(--muted); font-size: .86rem; margin: 18px 0 0 auto; max-width: 470px; }

.band { background: var(--paper); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 48px 0; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); color: var(--ink); font: 700 1rem var(--font-display); margin-bottom: 10px; }
.steps h3 { margin-bottom: 4px; }
.steps p { color: var(--muted); margin: 0; }

.showcase { padding: 56px 0 24px; }
.showcase-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.showcase-strip { list-style: none; padding: 6px 2px 16px; margin: 12px 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 190px); gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; }
.showcase-strip li { scroll-snap-align: start; }
.showcase-strip a { display: block; text-decoration: none; color: var(--text); }
.showcase-strip img { display: block; width: 100%; height: auto; aspect-ratio: 210/297; background: #fff; border: 1px solid var(--rule); box-shadow: var(--shadow-paper); }
.showcase-strip span { display: block; font-weight: 600; font-size: .92rem; margin-top: 8px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; padding-top: 48px; padding-bottom: 48px; align-items: start; }
.band .split { padding-top: 0; padding-bottom: 0; }
.job-links { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; }
.job-links li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.job-links a { text-decoration: none; font-weight: 500; }
.job-links a:hover { text-decoration: underline; }
.ats-note h3 { font-size: 1.15rem; }
.ats-note p { margin: 0; color: var(--muted); }

.pricing-lite { padding-top: 24px; padding-bottom: 48px; }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 20px; margin-top: 12px; }
.price h3 { margin-bottom: 2px; }
.price-amount { font: 700 2rem/1.1 var(--font-display); color: var(--ink); margin-bottom: 12px; }
.price-amount span { font: 400 1rem var(--font-ui); color: var(--muted); }
.price ul { margin: 0; padding-left: 18px; }
.price li { margin-bottom: 4px; }
.price-pro { border-top: 4px solid var(--highlight); }

.faq { padding-bottom: 56px; }
.faq details { max-width: 780px; }
.faq details { border-bottom: 1px solid var(--rule); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

.cta-final { background: var(--ink); color: #fff; padding: 52px 0; text-align: center; }
.cta-final h2 { color: #fff; margin-bottom: 18px; }
.cta-final .btn-primary { background: var(--highlight); border-color: var(--highlight); color: #1e2533; }
.cta-final .btn-primary:hover { filter: brightness(.95); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cta-final { background: #0f1830; }
}

@media (max-width: 860px) {
  .hero { padding: 32px 0 40px; }
  .hero-grid, .split { grid-template-columns: 1fr; gap: 28px; }
  .paper-sheet { margin: 0 auto; transform: rotate(.6deg); padding: 22px 20px; }
  .hero-paper figcaption { margin: 14px auto 0; }
  .steps { grid-template-columns: 1fr; gap: 18px; }
  .price-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) { .job-links { columns: 1; } }

/* ---- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--rule); background: var(--paper); padding: 28px 0; color: var(--muted); font-size: .92rem; }
.site-footer a { color: var(--muted); }

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