/* ============================================================
   Tokens
   ============================================================ */
:root {
  --canvas:       #F4F2EC;
  --surface:      #FFFFFF;
  --surface-2:    #FAF9F5;
  --ink:          #1A2321;
  --ink-soft:     #55615E;
  --ink-faint:    #8A9490;
  --line:         #E6E3DA;
  --line-strong:  #D0CCC0;

  --accent:       #2F7D6D;
  --accent-hover: #256558;
  --accent-soft:  #E3F1EC;
  --accent-ink:   #1D4F45;
  --on-accent:    #FFFFFF;

  --ai:           #6B4FD8;
  --ai-hover:     #5A3FC4;
  --ai-soft:      #F0ECFF;
  --ai-border:    #D5CBFA;

  --nav-bg:       #16211F;
  --nav-ink:      #C5D0CC;
  --nav-ink-dim:  #7F8D88;
  --nav-active:   rgba(255,255,255,0.09);
  --nav-line:     rgba(255,255,255,0.08);

  --warn-bg:      #FFF6E5;
  --warn-border:  #E8C27A;
  --warn-ink:     #6B4E12;
  --danger:       #B3402C;
  --danger-soft:  #FBEAE5;

  /* The CV sheet is paper: it keeps its own colours in every theme. */
  --sheet-bg:     #FFFFFF;
  --sheet-ink:    #1A2321;
  --sheet-soft:   #55615E;
  --sheet-faint:  #8A9490;
  --sheet-line:   #E6E3DA;
  --sheet-head:   #1F3B36;
  --sheet-tint:   #E3F1EC;
  --sheet-tint-ink: #1D4F45;

  --font-ui:  "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-doc: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(22,33,31,0.05);
  --shadow-md: 0 2px 4px rgba(22,33,31,0.04), 0 10px 28px rgba(22,33,31,0.08);
  --shadow-sheet: 0 2px 6px rgba(22,33,31,0.08), 0 18px 44px rgba(22,33,31,0.14);
  --topbar-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas:      #0F1715;
    --surface:     #172220;
    --surface-2:   #1C2927;
    --ink:         #E8EEEC;
    --ink-soft:    #A9B6B2;
    --ink-faint:   #7D8A86;
    --line:        #26332F;
    --line-strong: #364540;
    --accent:      #4FB59F;
    --accent-hover:#6FCBB6;
    --accent-soft: #1B332E;
    --accent-ink:  #A8E3D5;
    --on-accent:   #0B1211;
    --on-accent:   #0B1211;
    --ai:          #A99BFF;
    --ai-hover:    #C2B8FF;
    --ai-soft:     #25203F;
    --ai-border:   #413872;
    --nav-bg:      #0B1211;
    --warn-bg:     #2D2412;
    --warn-border: #6B5326;
    --warn-ink:    #E8CC8C;
    --danger:      #E5806C;
    --danger-soft: #3A1F19;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 28px rgba(0,0,0,0.4);
    --shadow-sheet: 0 18px 44px rgba(0,0,0,0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --canvas:      #0F1715;
    --surface:     #172220;
    --surface-2:   #1C2927;
    --ink:         #E8EEEC;
    --ink-soft:    #A9B6B2;
    --ink-faint:   #7D8A86;
    --line:        #26332F;
    --line-strong: #364540;
    --accent:      #4FB59F;
    --accent-hover:#6FCBB6;
    --accent-soft: #1B332E;
    --accent-ink:  #A8E3D5;
    --ai:          #A99BFF;
    --ai-hover:    #C2B8FF;
    --ai-soft:     #25203F;
    --ai-border:   #413872;
    --nav-bg:      #0B1211;
    --warn-bg:     #2D2412;
    --warn-border: #6B5326;
    --warn-ink:    #E8CC8C;
    --danger:      #E5806C;
    --danger-soft: #3A1F19;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 28px rgba(0,0,0,0.4);
    --shadow-sheet: 0 18px 44px rgba(0,0,0,0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font-ui);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1, h2, h3 { font-family: var(--font-ui); margin: 0; }
button { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ============================================================
   Brand
   ============================================================ */
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(47,125,109,0.35);
}
.brand-accent { color: var(--accent); }
.sidebar-brand .brand-accent { color: #8FD3C2; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }

/* ============================================================
   Dashboard ("My CVs")
   ============================================================ */
.dashboard { min-height: 100%; }

.dashboard-topbar {
  padding: 1rem 2rem;
  max-width: 1120px;
  margin: 0 auto;
}

.dashboard-body { max-width: 1120px; margin: 0 auto; padding: 1.5rem 2rem 4rem; }
.dashboard-body h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.025em; margin: 0 0 0.35rem; }
.dashboard-sub { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 2rem; max-width: 52ch; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.5rem 1.25rem;
}

.dashboard-card { position: relative; }

.new-cv-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  aspect-ratio: 0.77;
  background: transparent;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.new-cv-card:hover { border-color: var(--accent); color: var(--accent-hover); background: var(--accent-soft); }
.new-cv-plus {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(47,125,109,0.35);
}

.cv-card-open {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Miniature paper */
.cv-card-thumb {
  position: relative;
  aspect-ratio: 0.77;
  background: var(--sheet-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.cv-card:hover .cv-card-thumb,
.cv-card-open:focus-visible .cv-card-thumb {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}
.cv-thumb-band {
  background: var(--sheet-head);
  padding: 0.9rem 0.9rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.cv-card-avatar {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.cv-thumb-lines { flex: 1; min-width: 0; }
.cv-thumb-lines i { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.7); width: 70%; margin-bottom: 5px; }
.cv-thumb-lines i + i { width: 45%; background: rgba(255,255,255,0.35); margin-bottom: 0; }
.cv-thumb-body { padding: 0.8rem 0.9rem; display: flex; flex-direction: column; gap: 6px; }
.cv-thumb-body i { display: block; height: 4px; border-radius: 2px; background: var(--sheet-line); }
.cv-thumb-body i.h { width: 38%; height: 5px; background: var(--sheet-tint); margin-top: 6px; }
.cv-thumb-body i.s { width: 78%; }
.cv-thumb-body i.m { width: 92%; }

.cv-card-meta { padding: 0.7rem 0.15rem 0; }
.cv-card-title { font-weight: 650; font-size: 0.95rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-card-headline { font-size: 0.82rem; color: var(--ink-soft); margin: 0.05rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-card-headline:empty { display: none; }
.cv-card-updated { font-size: 0.76rem; color: var(--ink-faint); margin: 0.15rem 0 0; }

.cv-card-delete {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 2;
}
.cv-card:hover .cv-card-delete, .cv-card-delete:focus-visible { opacity: 1; }
.cv-card-delete:hover { color: var(--danger); border-color: var(--danger); }
.cv-card-delete.is-armed { width: auto; padding: 0 0.7rem; border-radius: 999px; opacity: 1; color: #fff; background: var(--danger); border-color: var(--danger); font-size: 0.75rem; font-weight: 600; }

.dashboard-empty-hint { color: var(--ink-faint); font-size: 0.9rem; grid-column: 1 / -1; padding-top: 0.25rem; }

/* ============================================================
   Shell layout
   ============================================================ */
.app { display: flex; min-height: 100%; }

/* ---- Sidebar ---- */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.9rem;
  background: var(--nav-bg);
  color: var(--nav-ink);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  margin-bottom: 1.5rem;
  color: #fff;
}
.sidebar-brand-link {
  background: none;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.sidebar-brand-link:hover { background: var(--nav-active); }
.sidebar-back {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--nav-ink-dim);
  white-space: nowrap;
}
.sidebar-brand-link:hover .sidebar-back { color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.side-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--nav-ink);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.side-tab svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--nav-ink-dim); }
.side-tab:hover { background: var(--nav-active); color: #fff; }
.side-tab[aria-selected="true"] { background: #fff; color: var(--nav-bg); font-weight: 650; }
.side-tab[aria-selected="true"] svg { color: var(--accent); }

.sidebar-spacer { flex: 1; }

.sidebar-footer { border-top: 1px solid var(--nav-line); padding: 0.9rem 0.5rem 0; }
.save-status { font-size: 0.8rem; color: #8FD0BF; display: flex; align-items: center; gap: 0.45rem; }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sidebar-note { font-size: 0.74rem; color: var(--nav-ink-dim); margin: 0.5rem 0 0; line-height: 1.45; }

/* ---- Main column ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.workspace { flex: 1; display: flex; flex-wrap: wrap; align-items: flex-start; }
.workspace .editor { flex: 3 1 400px; min-width: 300px; }
.workspace .preview-pane { flex: 2 1 340px; min-width: 260px; max-width: 520px; }

/* ============================================================
   Editor (left pane)
   ============================================================ */
.editor { padding: 2rem 2rem 3rem; max-width: 760px; width: 100%; margin: 0 auto; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.6rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.panel-intro { color: var(--ink-soft); font-size: 0.92rem; margin: 0 0 1.4rem; }

.onboarding-hint {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.86rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  margin: -0.5rem 0 1.25rem;
}

.block { margin-bottom: 1.75rem; }
.block:last-child { margin-bottom: 0; }
.panel .block + .block { padding-top: 1.5rem; border-top: 1px solid var(--line); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.block h2 { font-size: 1.02rem; font-weight: 650; margin-bottom: 0.5rem; letter-spacing: -0.005em; }
.block-head h2 { margin-bottom: 0; }

.hint { color: var(--ink-faint); font-size: 0.84rem; margin: 0.15rem 0 0.7rem; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-grid.two-col { grid-template-columns: 1fr 1fr; }

.field { display: block; font-size: 0.8rem; font-weight: 550; color: var(--ink-soft); margin-bottom: 0.95rem; }
.field span { display: block; margin-bottom: 0.35rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; line-height: 1.5; }

.char-count { font-size: 0.78rem; color: var(--ink-faint); margin: -0.6rem 0 1rem; text-align: right; }

/* ---- Buttons ---- */
.btn-primary, .btn-ai, .btn-add, .btn-ghost, .icon-btn { font: inherit; cursor: pointer; border-radius: var(--radius-sm); }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }

/* AI actions: violet pill with a sparkle, clearly distinct from normal controls */
.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--ai-soft);
  color: var(--ai);
  border: 1px solid var(--ai-border);
  border-radius: 999px;
  padding: 0.42rem 0.95rem 0.42rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .12s, transform .12s;
}
.btn-ai:hover { background: var(--ai); color: #fff; border-color: var(--ai); }
.btn-ai:disabled { opacity: 0.6; cursor: progress; }
.btn-ai-dot { display: inline-block; width: auto; height: auto; flex-shrink: 0; line-height: 1; }
.btn-ai-dot::before { content: "\2726"; font-size: 0.85rem; }
.btn-ai.is-loading .btn-ai-dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.btn-add {
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  color: var(--ink-soft);
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 550;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
#btnAddRole { width: 100%; padding: 0.85rem; margin-top: 0.75rem; }

.btn-ghost { background: none; border: 1px solid var(--line-strong); color: var(--ink); padding: 0.4rem 0.85rem; font-size: 0.85rem; }

.icon-btn {
  background: none;
  border: none;
  color: var(--ink-faint);
  width: 1.8rem;
  height: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.icon-btn:hover { color: var(--ink); background: var(--accent-soft); }
.icon-btn.remove-role:hover,
.icon-btn.remove-bullet:hover,
.icon-btn.remove-edu:hover { color: var(--danger); background: var(--danger-soft); }

.button-row { display: flex; gap: 0.6rem; margin: 0.75rem 0 1rem; flex-wrap: wrap; }

/* ---- AI suggestion / question output ---- */
.ai-suggestion {
  margin-top: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--ai-border);
  background: var(--ai-soft);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  white-space: pre-wrap;
}
.ai-suggestion .suggestion-apply { margin-top: 0; }
.ai-suggestion .suggestion-text {
  width: 100%;
  font: inherit;
  white-space: pre-wrap;
  resize: vertical;
}
.suggestion-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }
.flag-block {
  margin-top: 0.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  white-space: normal;
}
.flag-block.flag-soft { background: transparent; }
.flag-term {
  display: inline-block;
  margin: 0.1rem 0.25rem 0.1rem 0;
  padding: 0 0.4rem;
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  font-weight: 600;
}
.compare-group { margin-bottom: 0.6rem; white-space: normal; }
.compare-group ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }
.compare-empty, .compare-notes { margin: 0.25rem 0 0; }
.job-tailor { display: flex; flex-direction: column; gap: 0.3rem; margin: -0.2rem 0 0.8rem; align-items: flex-start; }
.trust-card {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 0.9rem 1rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  font-size: 0.9rem;
}
.trust-card p { margin: 0 0 0.6rem; }
.field small.muted { color: var(--ink-faint); font-weight: 400; }
.trust-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
@media print { .trust-card { display: none !important; } }

.warning-block {
  margin-top: 0.5rem;
  padding: 0.55rem 0.8rem;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-ink);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.question-list { margin: 0.75rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; color: var(--ink); }
.question-list li { margin-bottom: 0.45rem; }

/* ---- Review step: checks with an "Add" button each ---- */
.check-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.check-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 0.55rem 0.6rem 0.55rem 0.85rem; font-size: 0.9rem; color: var(--ink);
}
.check-item .check-text { flex: 1; min-width: 0; }
.check-item .check-add { flex: none; padding: 0.3rem 0.8rem; }
.check-item .check-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.check-item.check-ok { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }

.check-item.check-note { background: var(--surface); border-style: dashed; color: var(--ink-soft); }
.check-item.check-intro { background: transparent; border: 0; padding: 0; color: var(--ink-soft); }
.check-group { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-top: 0.6rem; }
.check-group:first-child { margin-top: 0; }
/* Long-CV review: one check per part, and progress text that may wrap */
.review-parts { margin-top: 1rem; }
.review-part-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.4rem; }
.btn-ai.btn-ai-small { font-size: 0.8rem; padding: 0.32rem 0.8rem 0.32rem 0.65rem; }
#panel-review .btn-ai.is-loading { white-space: normal; text-align: left; }

/* ---- Callout shown where a check or question sends you ---- */
.field-ask {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.75rem;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink);
  border-radius: var(--radius-sm); padding: 0.5rem 0.4rem 0.5rem 0.8rem; margin: 0.25rem 0 0.6rem;
  font-size: 0.86rem; scroll-margin-top: calc(var(--topbar-h, 0px) + 1rem);
}
.field-ask .field-ask-text { flex: 1 1 14rem; }
.field-ask .field-ask-back { font-size: 0.84rem; color: var(--warn-ink); }
.field-ask .field-ask-close { color: var(--warn-ink); }
.jump-target { box-shadow: 0 0 0 3px var(--warn-border) !important; }

/* ---- Back / Next at the end of every editor step ---- */
.step-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.step-nav .step-count { color: var(--ink-faint); font-size: 0.8rem; }
.step-nav .step-next-group { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
.step-nav .btn-primary { padding: 0.55rem 1.1rem; }
.step-nav .btn-ghost { padding: 0.5rem 0.95rem; }

.side-nav-divider {
  display: block; margin: 0.9rem 0.7rem 0.3rem; font-size: 0.68rem; font-weight: 650;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--nav-ink-dim);
}

/* ============================================================
   Drag-and-drop lists (experience, bullets, skills)
   ============================================================ */
.dnd-list { display: flex; flex-direction: column; gap: 0.7rem; }
.dnd-item { display: flex; align-items: flex-start; gap: 0.5rem; }

.dnd-handle {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  cursor: grab;
  border-radius: 6px;
  font-size: 0.95rem;
  user-select: none;
  touch-action: none;
}
.dnd-handle:hover { background: var(--accent-soft); color: var(--accent); }
.dnd-handle:active { cursor: grabbing; }

.dnd-item.dragging { opacity: 0.4; }
.dnd-item.drag-over-top { box-shadow: inset 0 3px 0 var(--accent); }
.dnd-item.drag-over-bottom { box-shadow: inset 0 -3px 0 var(--accent); }

/* ---- Experience ---- */
.role-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  transition: border-color .12s, box-shadow .12s;
}
.role-card:hover, .role-card:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.role-card .dnd-handle { margin-top: 0.15rem; }
.role-card-body { flex: 1; min-width: 0; }

.role-card-header { display: flex; align-items: center; gap: 0.5rem; }

.role-card-summary {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: none;
  border: none;
  padding: 0.25rem 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.role-card-summary:hover .role-card-summary-title { color: var(--accent); }
.role-chevron { flex-shrink: 0; display: inline-flex; color: var(--ink-faint); font-size: 0.8rem; transition: transform .15s ease; }
.role-card-summary[aria-expanded="false"] .role-chevron { transform: rotate(-90deg); }

.role-card-summary-text { min-width: 0; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.role-card-summary-title { font-weight: 650; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-card-summary-dates { font-size: 0.78rem; color: var(--ink-faint); white-space: nowrap; }

.role-card-actions { display: flex; gap: 0.1rem; flex-shrink: 0; opacity: 0; transition: opacity .12s ease; }
.role-card:hover .role-card-actions,
.role-card:focus-within .role-card-actions { opacity: 1; }

.role-card-details {
  margin-top: 0.8rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.role-card.collapsed .role-card-details { display: none; }
.role-card-details .role-bullets-btn { align-self: flex-start; }

.role-bullets-list { margin-top: 0.75rem; gap: 0.4rem; }
.role-bullets-warnings:empty { display: none; }

/* ---- Bullets ---- */
.bullet-item { align-items: center; }
.bullet-item .bullet-text { flex: 1; background: var(--surface); padding: 0.45rem 0.65rem; font-size: 0.9rem; }
.bullet-actions { display: flex; gap: 0.1rem; flex-shrink: 0; opacity: 0; transition: opacity .12s ease; }
.bullet-item:hover .bullet-actions,
.bullet-item:focus-within .bullet-actions { opacity: 1; }

/* ---- Education ---- */
.stack { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 0.75rem; }
.edu-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1rem 0.1rem;
}
.edu-card .field-grid { flex: 1; }

/* ---- Skill chips ---- */
.chip-list { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  align-items: center;
  gap: 0.3rem;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.28rem 0.45rem 0.28rem 0.25rem;
  font-size: 0.86rem;
  font-weight: 500;
}
.chip-handle { width: 1.1rem; height: 1.1rem; color: var(--accent); }
.chip-text { white-space: nowrap; }
.chip-remove { background: none; border: none; color: var(--accent); opacity: 0.6; cursor: pointer; font-size: 0.75rem; width: 1.2rem; height: 1.2rem; }
.chip-remove:hover { opacity: 1; }
.chip-input-row { display: flex; gap: 0.5rem; margin-top: 0.85rem; max-width: 360px; }
.chip-input-row input { flex: 1; }

/* ============================================================
   Live preview (right pane)
   ============================================================ */
.preview-pane {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 2rem 1.75rem;
  background: color-mix(in srgb, var(--canvas) 70%, var(--line-strong) 30%);
  border-left: 1px solid var(--line);
}
/* ---- Preview toolbar ---- */
.preview-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem;
  margin: -0.5rem 0 1rem;
}
.preview-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-faint); margin-right: auto;
}
.theme-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.theme-switch button {
  font: inherit; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft);
  background: none; border: none; border-radius: 999px; padding: 0.3rem 0.7rem; cursor: pointer;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.accent-pick {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.accent-pick input {
  width: 1.6rem; height: 1.6rem; padding: 0; border: 1px solid var(--line-strong);
  border-radius: 50%; background: none; cursor: pointer; overflow: hidden;
}
.accent-pick input::-webkit-color-swatch-wrapper { padding: 0; }
.accent-pick input::-webkit-color-swatch { border: none; border-radius: 50%; }
.accent-pick input::-moz-color-swatch { border: none; border-radius: 50%; }
.accent-pick input:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-pdf {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: none; border-radius: 999px; padding: 0.42rem 0.95rem;
}
.btn-pdf:hover { background: var(--accent-hover); }
.preview-note { flex-basis: 100%; font-size: 0.76rem; color: var(--ink-faint); margin: 0; }
.preview-note:empty { display: none; }

/* ---- Text & layout panel ---- */
.style-toggle { font-size: 0.78rem; font-weight: 600; border-radius: 999px; background: var(--surface); display: inline-flex; gap: 0.35rem; align-items: center; }
.style-toggle[aria-expanded="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.style-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.8rem 1rem; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 0.85rem 1rem; margin: -0.4rem 0 0.9rem;
}
.style-panel[hidden] { display: none; }
.style-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.style-field > span { display: flex; justify-content: space-between; }
.style-field output { color: var(--ink); font-variant-numeric: tabular-nums; }
.style-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.style-field select { font: inherit; font-weight: 500; padding: 0.3rem 0.4rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { flex: 1; font: inherit; font-weight: 500; font-size: 0.76rem; padding: 0.3rem 0.4rem; background: var(--surface); color: var(--ink-soft); border: 0; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.style-panel .link-btn { font-size: 0.8rem; justify-self: start; }

/* ---- Zoom and page count ---- */
.preview-viewbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 0.6rem; }
.page-count { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.page-count.is-over { color: var(--warn-ink); }
.zoom-ctl { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.zoom-ctl button { font: inherit; font-size: 0.8rem; font-weight: 700; min-width: 1.8rem; height: 1.7rem; border: 0; border-radius: 999px; background: none; color: var(--ink-soft); cursor: pointer; }
.zoom-ctl button:hover { background: var(--surface-2); color: var(--ink); }
.zoom-ctl .zoom-fit { font-weight: 600; font-size: 0.74rem; padding: 0 0.6rem; }
.zoom-ctl .zoom-fit[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.zoom-ctl output { min-width: 3.1rem; text-align: center; font-size: 0.78rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Sheet: an A4 page at real size, zoomed to fit the pane ---- */
.preview-sheet { width: 100%; }
#previewSheet.is-zoomed { overflow-x: auto; padding-bottom: 0.5rem; }
@media print { .style-panel, .preview-viewbar { display: none !important; } }
.cv-page {
  --primary: #1F3A5F; --accent: #2F7D6D; --text: #1C1F23; --muted: #5B6470;
  --font-heading: "Inter", sans-serif; --font-body: "Inter", sans-serif;
  --base-size: 9.5pt; --line-height: 1.42; --section-gap: 6.5mm; --margin: 15mm;
  --page-h: 297mm;
  width: var(--page-w, 210mm); min-height: var(--page-h, 297mm);
  padding: var(--margin) var(--margin) calc(var(--margin) + 4mm);
  background-color: #fff;
  /* faint guide where page 2, 3… would begin in the PDF */
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(var(--page-h) - 1px),
    rgba(31,58,95,0.18) calc(var(--page-h) - 1px), rgba(31,58,95,0.18) var(--page-h));
  box-shadow: var(--shadow-sheet);
  border-radius: 2px;
  font-family: var(--font-body); font-size: var(--base-size); line-height: var(--line-height);
  color: var(--text);
  font-kerning: normal; text-rendering: optimizeLegibility;
  hyphens: manual; overflow-wrap: break-word;
  transform-origin: top left;
  color-scheme: light;
}
.cv-page *, .cv-page *::before, .cv-page *::after { box-sizing: border-box; }
.cv-page h1, .cv-page h2, .cv-page h3, .cv-page p, .cv-page ul, .cv-page dl, .cv-page dd { margin: 0; padding: 0; }
.cv-page ul { list-style: none; }
.cv-page a { color: inherit; text-decoration: none; }
.cv-page p { orphans: 3; widows: 3; }
.cv-page .placeholder { color: #A3A9B0; font-style: italic; }

.cv-page .section-title, .cv-page .entry-head { break-after: avoid; }
.cv-page .entry-compact, .cv-page .skill-group, .cv-page .plain-list li, .cv-page .bullets li, .cv-page .cv-header { break-inside: avoid; }

.cv-page .section { margin-top: var(--section-gap); }
.cv-page .entry + .entry { margin-top: calc(var(--section-gap) * 0.55); }
.cv-page .entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4mm; }
.cv-page .entry-main { min-width: 0; }
.cv-page .entry-title { font-family: var(--font-heading); font-size: 1.05em; font-weight: 600; line-height: 1.3; }
.cv-page .entry-org { color: var(--muted); }
.cv-page .entry-org .loc::before { content: " · "; }
.cv-page .entry-date { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; color: var(--muted); font-size: 0.92em; }
.cv-page .entry-notes { margin-top: 0.6mm; }
.cv-page .bullets { margin-top: 1.2mm; }
.cv-page .bullets li { position: relative; padding-left: 3.6mm; }
.cv-page .bullets li + li { margin-top: 0.7mm; }
.cv-page .bullets li::before {
  content: ""; position: absolute; left: 0.4mm; top: calc(var(--line-height) * 0.5em - 0.6mm);
  width: 1.3mm; height: 1.3mm; background: var(--accent); border-radius: 50%;
}
.cv-page .skill-line { }
.cv-page .contact {
  --contact-gap: 4mm;
  display: flex; flex-wrap: wrap; column-gap: var(--contact-gap); overflow: hidden; color: var(--muted);
}
.cv-page .contact li { position: relative; white-space: nowrap; }
.cv-page .contact li::before {
  content: var(--contact-sep, "·"); position: absolute;
  left: calc(-1 * var(--contact-gap)); width: var(--contact-gap); text-align: center; color: var(--accent);
}

.cv-page .plain-list li + li { margin-top: 0.6mm; }
.cv-page .muted { color: var(--muted); }
.cv-page .cv-header.has-photo { display: flex; align-items: center; gap: 6mm; }
.cv-page .cv-header-text { min-width: 0; flex: 1; }
.cv-page .cv-photo { width: 26mm; height: 26mm; border-radius: 50%; object-fit: cover; flex: none; order: 2; }
.cv-page.t-classic .cv-header.has-photo { flex-direction: column; justify-content: center; }
.cv-page.t-classic .cv-photo { order: 0; }
.cv-page.t-minimal .cv-header.has-photo { display: block; position: relative; min-height: 28mm; }
.cv-page.t-minimal .cv-photo { position: absolute; left: 0; top: 1mm; width: 28mm; height: 28mm; border-radius: 2mm; }

/* Modern */
.cv-page.t-modern .cv-header { padding-bottom: 4.5mm; border-bottom: 0.6pt solid color-mix(in srgb, var(--primary) 22%, white); }
.cv-page.t-modern .name { font-family: var(--font-heading); font-weight: 700; font-size: calc(2.55em * var(--heading-scale, 1)); line-height: 1.05; letter-spacing: -0.02em; color: var(--primary); }
.cv-page.t-modern .headline { margin-top: 1.4mm; font-size: 1.18em; font-weight: 500; color: var(--accent); }
.cv-page.t-modern .contact { margin-top: 2.6mm; font-size: 0.92em; }
.cv-page.t-modern .section-title {
  display: flex; align-items: center; gap: 2.5mm; margin-bottom: 2.4mm;
  font-family: var(--font-heading); font-size: calc(0.8em * var(--heading-scale, 1)); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--primary);
}
.cv-page.t-modern .section-title::after { content: ""; flex: 1; border-top: 0.5pt solid color-mix(in srgb, var(--primary) 18%, white); }
.cv-page.t-modern .summary { font-size: 1.04em; }
.cv-page.t-modern .entry-title { color: var(--primary); }
.cv-page.t-modern .entry-org .org { color: var(--text); font-weight: 500; }
.cv-page.t-modern .cols { display: grid; grid-template-columns: minmax(0, 1fr) 56mm; column-gap: 9mm; }
.cv-page.t-modern .col-side { font-size: 0.95em; }
.cv-page.t-modern .col-side .entry-head { display: block; }
.cv-page.t-modern .col-side .entry-title { font-size: 1em; }
.cv-page.t-modern .col-side .skill-line { line-height: 1.55; }

/* Classic */
.cv-page.t-classic .cv-header { text-align: center; padding-bottom: 3.5mm; border-bottom: 2.4pt double var(--primary); }
.cv-page.t-classic .name { font-family: var(--font-heading); font-weight: 600; font-size: calc(2.35em * var(--heading-scale, 1)); line-height: 1.1; letter-spacing: 0.06em; font-variant: small-caps; color: var(--primary); }
.cv-page.t-classic .headline { margin-top: 1mm; font-style: italic; font-size: 1.12em; color: var(--accent); }
.cv-page.t-classic .contact { justify-content: center; --contact-gap: 5mm; margin-top: 2mm; font-size: 0.93em; }
.cv-page.t-classic .contact li::before { content: none; }
.cv-page.t-classic .section-title {
  margin-bottom: 2.2mm; padding-bottom: 0.8mm; border-bottom: 0.5pt solid color-mix(in srgb, var(--primary) 40%, white);
  font-family: var(--font-heading); font-weight: 600; font-size: calc(1.12em * var(--heading-scale, 1)); font-variant: small-caps; letter-spacing: 0.08em; color: var(--primary);
}
.cv-page.t-classic .entry-org { font-style: italic; }
.cv-page.t-classic .entry-org .org { color: var(--accent); }
.cv-page.t-classic .entry-date { font-style: italic; }
.cv-page.t-classic .bullets li::before { content: "–"; background: none; width: auto; height: auto; border-radius: 0; top: 0; left: 0; color: var(--accent); }

/* Minimal */
.cv-page.t-minimal .cv-header { padding: 0 0 5mm 36mm; }
.cv-page.t-minimal .name { font-family: var(--font-heading); font-weight: 500; font-size: calc(2.6em * var(--heading-scale, 1)); line-height: 1.02; letter-spacing: -0.025em; color: var(--primary); }
.cv-page.t-minimal .headline { margin-top: 1.6mm; font-size: 1.12em; color: var(--accent); }
.cv-page.t-minimal .contact { --contact-sep: "/"; margin-top: 2.4mm; font-size: 0.92em; }
.cv-page.t-minimal .contact li::before { color: color-mix(in srgb, var(--muted) 55%, white); }
.cv-page.t-minimal .section {
  position: relative; padding-left: 36mm; padding-top: calc(var(--section-gap) * 0.6);
  border-top: 0.5pt solid color-mix(in srgb, var(--primary) 14%, white);
}
.cv-page.t-minimal .section-title {
  position: absolute; left: 0; width: 30mm; padding-top: 0.5mm;
  font-family: var(--font-heading); font-size: calc(0.82em * var(--heading-scale, 1)); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.cv-page.t-minimal .entry-org .org { color: var(--text); }
.cv-page.t-minimal .bullets li::before { width: 1.8mm; height: 0; border-radius: 0; background: none; border-top: 0.7pt solid var(--accent); top: calc(var(--line-height) * 0.5em); }

/* ATS */
.cv-page.t-ats .cv-header { padding-bottom: 2.5mm; border-bottom: 0.75pt solid var(--text); }
.cv-page.t-ats .name { font-family: var(--font-heading); font-weight: 700; font-size: calc(1.9em * var(--heading-scale, 1)); line-height: 1.15; }
.cv-page.t-ats .headline { margin-top: 0.6mm; font-size: 1.08em; font-weight: 500; }
.cv-page.t-ats .contact { --contact-sep: "|"; --contact-gap: 5mm; margin-top: 1.4mm; color: var(--text); }
.cv-page.t-ats .contact li::before { color: var(--muted); }
.cv-page.t-ats .section-title {
  margin-bottom: 1.8mm; padding-bottom: 0.6mm; border-bottom: 0.5pt solid var(--muted);
  font-family: var(--font-heading); font-size: calc(1.02em * var(--heading-scale, 1)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.cv-page.t-ats .entry-title { font-weight: 700; }
.cv-page.t-ats .entry-org, .cv-page.t-ats .entry-date { color: var(--text); }
.cv-page.t-ats .bullets li::before { content: "•"; background: none; width: auto; height: auto; border-radius: 0; top: 0; left: 0.2mm; color: var(--text); }

.preview-empty { color: var(--sheet-faint); font-family: var(--font-ui); font-size: 0.9rem; text-align: center; padding: 3rem 1.75rem; background: var(--sheet-bg); border-radius: 4px; box-shadow: var(--shadow-sheet); }

/* ---- Print = PDF export: only the page, at real size ---- */
@media print {
  html, body { height: auto; background: #fff !important; }
  .demo-banner, #screenDashboard, .sidebar, .editor, .preview-toolbar, .toast { display: none !important; }
  .app, .main, .workspace, .preview-pane, .preview-sheet {
    display: block !important; position: static !important; height: auto !important; width: auto !important;
    max-width: none !important; min-width: 0 !important; overflow: visible !important;
    padding: 0 !important; margin: 0 !important; background: none !important; border: 0 !important;
  }
  .cv-page { zoom: 1 !important; padding: 0; min-height: 0; box-shadow: none; background-image: none; width: auto; border-radius: 0; }
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #16211F;
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  max-width: calc(100vw - 2rem);
  border: 1px solid rgba(255,255,255,0.12);
}
.toast.toast-error { background: var(--danger); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 920px) {
  :root { --topbar-h: 58px; }
  .dashboard-topbar { padding: 0.9rem 1.1rem 0; }
  .dashboard-body { padding: 1rem 1.1rem 3rem; }
  .dashboard-body h1 { font-size: 1.6rem; }
  .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.1rem 0.9rem; }

  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 25;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
  }
  .sidebar-brand { margin-bottom: 0; padding: 0.3rem; }
  .sidebar-back { display: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; gap: 0.2rem; margin-left: auto; }
  .side-tab { white-space: nowrap; padding: 0.55rem 0.65rem; width: auto; }
  .side-tab span.side-tab-label { display: none; }
  .side-nav-divider { display: none; }
  .step-nav .step-count { order: -1; flex-basis: 100%; text-align: center; }
  .step-nav .step-next-group { margin-left: auto; }
  .sidebar-spacer, .sidebar-footer { display: none; }

  .editor { padding: 1.1rem 0.9rem 2rem; }
  .panel { padding: 1.2rem 1.1rem; }
  .field-grid, .field-grid.two-col { grid-template-columns: 1fr; }
  /* Touch devices have no hover, so row actions must stay visible. */
  .role-card-actions, .bullet-actions { opacity: 1; }
  .cv-card-delete { opacity: 1; }
}

/* Below this the preview moves under the editor — still always reachable. */
@media (max-width: 700px) {
  .workspace { flex-direction: column; }
  .workspace .editor, .workspace .preview-pane { flex: none; width: 100%; }
  .preview-pane {
    position: static;
    height: auto;
    max-width: none;
    padding: 1.5rem 0.9rem calc(3rem + env(safe-area-inset-bottom));
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

/* ---- More sections tab ---- */
.size-pick { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.size-pick select { font: inherit; font-size: 0.78rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.6rem; }
.photo-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.photo-thumb { width: 4rem; height: 4rem; border-radius: 50%; background: var(--accent-soft) center / cover no-repeat; border: 1px solid var(--line); flex: none; display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 700; }
.photo-actions { display: flex; gap: 0.5rem; }

.section-row { display: flex; align-items: center; gap: 0.5rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.45rem 0.6rem; }
.section-row .section-row-label { flex: 1; font-weight: 600; font-size: 0.92rem; }
.section-row.is-hidden .section-row-label { color: var(--ink-faint); text-decoration: line-through; }
.section-row .eye { background: none; border: 1px solid var(--line); border-radius: 999px; font-size: 0.78rem; color: var(--ink-soft); padding: 0.2rem 0.65rem; cursor: pointer; }
.section-row .eye:hover { border-color: var(--accent); color: var(--accent); }

.list-section { margin-bottom: 1.6rem; }
.list-section h2 { margin-bottom: 0.5rem; }
.row-card { display: flex; gap: 0.6rem; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.8rem 0.9rem 0.1rem; margin-bottom: 0.6rem; }
.row-card .field-grid { flex: 1; }
.row-card .field-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.custom-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.9rem 1rem 0.2rem; }
.custom-card .custom-head { display: flex; gap: 0.5rem; align-items: flex-start; }
.custom-card .custom-head .field { flex: 1; }
@media (max-width: 920px) { .row-card .field-grid.cols-3 { grid-template-columns: 1fr; } }

/* ============================================================
   Accounts, dialogs, history, cover letter, mobile toggle
   ============================================================ */
.sidebar-export {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: left;
  color: var(--nav-ink); background: var(--nav-active); border: 1px solid var(--nav-line);
  border-radius: var(--radius-sm); padding: 0.45rem 0.7rem; width: 100%;
}
.sidebar-export:hover:not(:disabled) { background: rgba(255,255,255,0.15); color: #fff; }
.sidebar-export:disabled { opacity: 0.4; cursor: default; }
.sidebar-export:focus-visible, .account-btn:focus-visible { outline: 2px solid #8FD3C2; outline-offset: 2px; }
.history-row { display: flex; gap: 0.35rem; margin-bottom: 0.4rem; }
.history-row .sidebar-export { text-align: center; padding: 0.45rem 0.3rem; }
.sidebar-footer .sidebar-export + .sidebar-export { margin-top: 0; }

.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn-danger { font: inherit; cursor: pointer; border: 0; border-radius: var(--radius-sm); background: var(--danger); color: #fff; padding: 0.55rem 1rem; font-weight: 600; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-danger:disabled, .btn-primary:disabled { opacity: 0.55; cursor: default; }

/* sign in */
.auth-screen { min-height: 100vh; background: var(--canvas); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem 1.75rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.9rem; }
.auth-card h2 { margin: 0; font-size: 1.4rem; line-height: 1.25; }
.auth-sub { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.auth-hint { margin: -0.3rem 0 0; color: var(--ink-soft); font-size: 0.8rem; }
.auth-error { margin: 0; color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; font-size: 0.85rem; }
.auth-switch { margin: 0.2rem 0 0; text-align: center; font-size: 0.88rem; color: var(--ink-soft); }
.auth-card .btn-primary { padding: 0.7rem 1rem; }

/* account menu */
.dashboard-topbar { display: flex; align-items: center; justify-content: space-between; }
.account-menu { position: relative; }
.account-btn { font: inherit; font-size: 0.85rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.4rem 0.9rem; cursor: pointer; color: var(--ink); max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pop { position: absolute; right: 0; top: calc(100% + 0.35rem); min-width: 14rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 12px 30px rgba(22,33,31,0.15); padding: 0.35rem; z-index: 30; display: flex; flex-direction: column; }
.account-pop button { font: inherit; font-size: 0.88rem; text-align: left; background: none; border: 0; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink); }
.account-pop button:hover { background: var(--surface-2); }
.account-pop button.danger { color: var(--danger); }

/* duplicate button on cards */
.cv-card-dup {
  position: absolute; top: 0.55rem; right: 2.6rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity .12s ease; z-index: 2;
}
.cv-card:hover .cv-card-dup, .cv-card-dup:focus-visible { opacity: 1; }
.cv-card-dup:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 920px) { .cv-card-dup { opacity: 1; } }

/* dialogs */
.modal { border: 0; border-radius: var(--radius-lg); padding: 1.6rem 1.6rem 1.2rem; width: min(520px, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
.modal::backdrop { background: rgba(22,33,31,0.5); }
.modal h2 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.modal-sub { margin: 0 0 1rem; color: var(--ink-soft); font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.1rem; }
.version-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.version-list li { display: flex; align-items: center; gap: 0.75rem; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.55rem 0.75rem; background: var(--surface-2); }
.version-list .v-when { font-weight: 600; font-size: 0.9rem; }
.version-list .v-what { color: var(--ink-soft); font-size: 0.8rem; }
.version-list .v-text { flex: 1; }
.version-empty { color: var(--ink-soft); font-size: 0.9rem; padding: 0.5rem 0; }
.import-summary { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.8rem 1rem; font-size: 0.9rem; display: grid; gap: 0.25rem; }
.import-summary strong { font-size: 1rem; }

/* waiting for the local model */
.ai-wait { display: flex; align-items: center; gap: 0.6rem; margin: 0.4rem 0 0.8rem; padding: 0.55rem 0.8rem; background: var(--ai-soft); border: 1px solid var(--ai-border); border-radius: var(--radius-sm); color: #3F2F94; font-size: 0.85rem; }
.spinner { width: 1rem; height: 1rem; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }
.busy-overlay { position: fixed; inset: 0; background: rgba(244,242,236,0.82); display: grid; place-items: center; z-index: 90; padding: 1.5rem; }
.busy-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 12px 40px rgba(22,33,31,0.15); padding: 1.4rem 1.6rem; display: flex; align-items: center; gap: 0.9rem; max-width: 26rem; color: var(--ink); }
.busy-card p { margin: 0; font-size: 0.92rem; }
.btn-ai:disabled:not(.is-loading) { opacity: 0.55; cursor: not-allowed; }

/* cover letter */
.letter-editor { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.letter-editor h2 { margin: 0 0 0.3rem; }
.cv-page.letter .letter-meta { margin-top: 9mm; }
.cv-page.letter .letter-date { color: var(--muted); }
.cv-page.letter .letter-to { margin-top: 1mm; font-weight: 600; }
.cv-page.letter .letter-body { margin-top: 7mm; font-size: 1.04em; line-height: 1.55; }
.cv-page.letter .letter-body p { margin: 0 0 3.6mm; white-space: pre-wrap; orphans: 3; widows: 3; }
.cv-page.letter .letter-sign { margin-top: 6mm; }
.cv-page.letter .letter-empty { color: var(--muted); font-style: italic; margin-top: 9mm; }

/* plain-text (ATS) view */
.text-view { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1rem; }
.text-view-bar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.6rem; flex-wrap: wrap; }
.text-view-bar p { margin: 0; flex: 1 1 12rem; font-size: 0.8rem; color: var(--ink-soft); }
.text-view pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 0.8rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); max-height: 70vh; overflow: auto; }

/* mobile: edit / preview toggle */
.mobile-toggle { display: none; }
@media (max-width: 700px) {
  .mobile-toggle {
    display: flex; position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 40;
    background: var(--ink); border-radius: 999px; padding: 0.25rem; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .mobile-toggle[hidden] { display: none; }
  .mobile-toggle button { font: inherit; font-size: 0.9rem; font-weight: 600; color: #cfd8d5; background: none; border: 0; border-radius: 999px; padding: 0.55rem 1.4rem; cursor: pointer; }
  .mobile-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
  .workspace.show-preview .editor { display: none; }
  .workspace:not(.show-preview) .preview-pane { display: none; }
  .editor { padding-bottom: 6rem; }
  .preview-pane { border-top: 0; padding-bottom: 6rem; }
}
@media print { .mobile-toggle, .busy-overlay, .modal, .auth-screen, #screenAuth { display: none !important; } .preview-pane { display: block !important; } }

.dashboard-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.dashboard-head .dashboard-sub { margin: 0; }
.dashboard-head .btn-ghost { white-space: nowrap; background: var(--surface); }
.dashboard-head .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.dashboard-head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
#btnImportLinkedIn { display: inline-flex; align-items: center; gap: 0.45rem; }
.linkedin-steps { margin: 0.25rem 0 0.9rem; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.92rem; }
#linkedinTitle { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.history-row .sidebar-export { flex: 1 1 0; white-space: nowrap; padding: 0.45rem 0.2rem; }
@media (max-width: 700px) { .preview-pane { min-height: calc(100vh - 7rem); } }

/* ---- Light / dark / auto switch ---- */
.theme-toggle {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 0.4rem 0.8rem;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
.sidebar-footer .theme-toggle { width: 100%; text-align: left; border-radius: var(--radius-sm); margin-bottom: 0.4rem;
  color: var(--nav-ink); background: var(--nav-active); border-color: var(--nav-line); padding: 0.45rem 0.7rem; }
.sidebar-footer .theme-toggle:hover { color: #fff; background: rgba(255,255,255,0.15); }
.mobile-theme { display: none; }
@media (max-width: 920px) { .sidebar-footer { display: none; } }


/* ============================================================
   Job tracker
   ============================================================ */
select { appearance: auto; }
.dash-tabs { max-width: 1120px; margin: 0 auto; padding: 0 2rem; display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); }
.dash-tab { font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--ink-soft); background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.7rem 0.9rem; margin-bottom: -1px; cursor: pointer; }
.dash-tab:hover { color: var(--ink); }
.dash-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.jobs-tools { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.jobs-tools input[type="search"] { width: 14rem; padding: 0.5rem 0.75rem; border-radius: 999px; background: var(--surface); }
.view-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.view-switch button { font: inherit; font-size: 1rem; line-height: 1; color: var(--ink-soft); background: none; border: 0; border-radius: 6px; padding: 0.4rem 0.6rem; cursor: pointer; }
.view-switch button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.job-board { display: grid; grid-template-columns: repeat(5, minmax(185px, 1fr)); gap: 0.8rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; }
.job-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.7rem; min-height: 9rem; display: flex; flex-direction: column; gap: 0.6rem; transition: border-color .12s, background .12s; }
.job-col.drop-target { border-color: var(--accent); background: var(--accent-soft); }
.job-col-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.1rem 0.2rem; }
.job-col-head h2 { font-size: 0.95rem; font-weight: 700; }
.job-col-count { font-size: 0.8rem; color: var(--ink-faint); font-weight: 600; }
.job-col-add { font: inherit; font-size: 0.85rem; font-weight: 550; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem; cursor: pointer; }
.job-col-add:hover { border-color: var(--accent); color: var(--accent); }

.job-card { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; cursor: grab; box-shadow: var(--shadow-sm); }
.job-card:hover, .job-card:focus-visible { border-color: var(--accent); }
.job-card.dragging { opacity: 0.4; }
.job-card-company { display: block; font-weight: 650; font-size: 0.92rem; overflow-wrap: anywhere; }
.job-card-title { display: block; font-size: 0.85rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.job-card-meta { display: block; margin-top: 0.35rem; font-size: 0.76rem; color: var(--ink-faint); overflow-wrap: anywhere; }
.job-empty { grid-column: 1 / -1; color: var(--ink-faint); font-size: 0.9rem; }

.job-list { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.job-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.job-table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
.job-table td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.job-table tr:last-child td { border-bottom: 0; }
.job-table tbody tr:hover { background: var(--surface-2); }
.job-table .job-open { font: inherit; font-weight: 650; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.job-table .job-open:hover { color: var(--accent); }
.job-table select { width: auto; padding: 0.3rem 0.5rem; font-size: 0.85rem; }

.job-actions { align-items: center; }
.job-actions-spacer { flex: 1; }
.btn-danger-ghost { font: inherit; font-size: 0.85rem; cursor: pointer; background: none; border: 1px solid var(--line-strong); color: var(--danger); border-radius: var(--radius-sm); padding: 0.4rem 0.85rem; }
.btn-danger-ghost:hover, .btn-danger-ghost.is-armed { background: var(--danger); border-color: var(--danger); color: #fff; }
#jobDialog { width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; }
#jobDialog .field-grid { gap: 0 1rem; }

@media (max-width: 920px) {
  .dash-tabs { padding: 0 1.1rem; }
}
@media (max-width: 700px) {
  .job-board { grid-template-columns: 1fr; overflow-x: visible; }
  .jobs-tools input[type="search"] { width: 100%; flex: 1 1 100%; }
  #jobDialog .field-grid { grid-template-columns: 1fr; }
}
.size-pick select { width: auto; }
@media (max-width: 700px) {
  .brand-name { white-space: nowrap; }
  .dashboard-topbar { gap: 0.5rem; }
  .topbar-actions { gap: 0.4rem; min-width: 0; }
  .account-btn { max-width: 8.5rem; }
}


/* ============================================================
   Sign-in methods
   ============================================================ */
.auth-view { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-view[hidden] { display: none; }
.auth-providers { display: flex; flex-direction: column; gap: 0.6rem; }
.auth-providers:not(:has(.btn-provider:not([hidden]))) { display: none; }
.btn-provider {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  width: 100%; font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 0.7rem 1rem;
}
.btn-provider[hidden] { display: none; }
.btn-provider:hover { border-color: var(--accent); background: var(--surface-2); }
.btn-provider:disabled { opacity: 0.6; cursor: progress; }
.btn-provider.is-soon { cursor: not-allowed; opacity: 0.7; }
.btn-provider.is-soon:hover { border-color: var(--line-strong); background: var(--surface); }
.soon-tag { font-size: 0.7rem; font-weight: 600; color: var(--ink-soft, var(--ink-faint)); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.5rem; }
.auth-divider { display: flex; align-items: center; gap: 0.8rem; margin: 0.2rem 0; color: var(--ink-faint); font-size: 0.8rem; }
.auth-divider[hidden] { display: none; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
#authForm { display: flex; flex-direction: column; gap: 0.2rem; }
#authForm[hidden] { display: none; }
.auth-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ============================================================
   Landing page (signed-out screen)
   ============================================================ */
.landing { --lp-max: 1120px; color: var(--ink); padding: 0 1rem; }
.landing[hidden] { display: none; }
.landing h1, .landing h2, .landing h3 { letter-spacing: -0.01em; }
.landing-top {
  max-width: var(--lp-max); margin: 0 auto; padding: 1rem 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.landing-top .btn-ghost { background: var(--surface); }

/* Shown when a signed-in user opens the home page to look at it */
.home-preview-bar {
  max-width: var(--lp-max); margin: 0.75rem auto 0; padding: 0.6rem 0.75rem 0.6rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--radius-md); font-size: 0.9rem;
}
.home-preview-bar[hidden] { display: none; }
.topbar-link, .topbar-signout { background: var(--surface); border-radius: 999px; white-space: nowrap; }
@media (max-width: 700px) {
  /* On a phone, sign out stays in the account menu to save room. */
  .topbar-signout { display: none; }
}

.landing-hero {
  max-width: var(--lp-max); margin: 0 auto; padding: 2.5rem 0 3.5rem;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 400px);
  gap: 3.5rem; align-items: center;
}
.hero-copy { display: flex; flex-direction: column; gap: 1.1rem; align-items: flex-start; }
.eyebrow {
  margin: 0; font-size: 0.8rem; font-weight: 600; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 999px; padding: 0.3rem 0.75rem;
}
.hero-copy h1 { margin: 0; font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.08; text-wrap: balance; }
.hero-lead { margin: 0; font-size: 1.08rem; line-height: 1.6; color: var(--ink-soft); max-width: 36rem; }
.hero-points { list-style: none; margin: 0.2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.hero-points li { position: relative; padding-left: 1.7rem; font-size: 0.95rem; }
.hero-points li::before {
  content: ""; position: absolute; left: 0; top: 0.15em; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%232F7D6D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 0.8rem no-repeat;
}
.hero-cta { margin-top: 0.4rem; padding: 0.75rem 1.5rem; font-size: 1rem; }
.landing-hero .auth-card { justify-self: end; box-shadow: var(--shadow-md); scroll-margin: 1.5rem; }

.landing-extra { display: contents; }
.landing-section { max-width: var(--lp-max); margin: 0 auto; padding: 3.5rem 0; border-top: 1px solid var(--line); }
.landing-section h2 { margin: 0; font-size: clamp(1.45rem, 2.6vw, 1.9rem); line-height: 1.2; }
.section-lead { margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.6; max-width: 40rem; }

.feature-grid { margin-top: 2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.3rem 1.25rem; }
.feature h3 { margin: 0 0 0.45rem; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.55; }
.feature-ai { background: var(--ai-soft); border-color: var(--ai-border); }
.feature-ai h3 { color: var(--ai); }

.landing-demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.demo-card { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 0.4rem 1.3rem; }
.demo-row { padding: 1rem 0; }
.demo-row + .demo-row { border-top: 1px dashed var(--line-strong); }
.demo-row p { margin: 0.4rem 0 0; font-size: 0.95rem; line-height: 1.5; }
.demo-notes { color: var(--ink-soft); font-style: italic; }
.demo-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }
.demo-label-ai { color: var(--ai); }

.steps { list-style: none; counter-reset: step; margin: 2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.steps li { counter-increment: step; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 2rem; height: 2rem; margin-bottom: 0.8rem;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700;
}
.steps strong { display: block; color: var(--ink); margin-bottom: 0.25rem; }

.privacy-list { list-style: none; margin: 1.5rem 0 1.8rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.privacy-list li { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.55; }
.privacy-list strong { display: block; color: var(--ink); margin-bottom: 0.25rem; }

.landing-foot { max-width: var(--lp-max); margin: 0 auto; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 0.85rem; }

/* While a sign-in link is being confirmed, show only the card. */
.landing[data-view="authConfirm"] .landing-extra,
.landing[data-view="authConfirm"] .hero-copy,
.landing[data-view="authConfirm"] .landing-top .btn-ghost { display: none; }
.landing[data-view="authConfirm"] .landing-hero { grid-template-columns: minmax(0, 400px); justify-content: center; padding-top: 4rem; }
.landing[data-view="authConfirm"] .landing-hero .auth-card { justify-self: center; }

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 1.5rem; }
  .landing-hero .auth-card { justify-self: stretch; max-width: none; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-demo { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}
@media (max-width: 600px) {
  .landing-top { padding: 0.75rem 0; }
  .feature-grid, .steps, .privacy-list { grid-template-columns: minmax(0, 1fr); }
  .landing-section { padding: 2.5rem 0; }
  .auth-card { padding: 1.5rem 1.25rem; }
}

/* ============================================================
   Theme picker: one button per theme with a small layout sketch
   ============================================================ */
.theme-picker {
  flex-basis: 100%; display: flex; gap: 0.45rem; overflow-x: auto; padding: 2px 2px 6px;
  scrollbar-width: thin;
}
.theme-option {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  font: inherit; font-size: 0.72rem; font-weight: 600; color: var(--ink-soft);
  background: none; border: none; padding: 0; cursor: pointer;
}
.theme-option:hover { color: var(--ink); }
.tp-thumb {
  position: relative; display: block; width: 44px; height: 58px; background: #fff;
  border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
}
.theme-option[aria-pressed="true"] { color: var(--ink); }
.theme-option[aria-pressed="true"] .tp-thumb { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px var(--accent); }
.tp-thumb span { position: absolute; display: block; border-radius: 1px; }
/* default sketch: title bar, then text lines */
.tp-thumb .tp-a { left: 6px; top: 6px; width: 24px; height: 4px; background: #1F3A5F; }
.tp-thumb .tp-b { left: 6px; top: 13px; width: 16px; height: 2px; background: #2F7D6D; }
.tp-thumb .tp-c { left: 6px; right: 6px; top: 21px; height: 30px;
  background: repeating-linear-gradient(to bottom, #D8DCE0 0 2px, transparent 2px 5px); }
.tp-thumb .tp-d { display: none; }
.tp-modern .tp-c { right: 18px; }
.tp-modern .tp-d { display: block; right: 6px; top: 21px; width: 9px; height: 30px;
  background: repeating-linear-gradient(to bottom, #C5D4CF 0 2px, transparent 2px 5px); }
.tp-classic .tp-a { left: 10px; width: 24px; background: #2B2B2B; }
.tp-classic .tp-b { left: 14px; background: #8A5A2B; }
.tp-minimal .tp-a { left: 16px; width: 20px; background: #111; }
.tp-minimal .tp-b { left: 16px; background: #C2410C; }
.tp-minimal .tp-c { left: 16px; }
.tp-sidebar .tp-d { display: block; left: 0; top: 0; bottom: 0; width: 14px; border-radius: 0;
  background: radial-gradient(circle at 7px 8px, #9FB7B0 4px, transparent 4.5px), color-mix(in srgb, #2F7D6D 18%, white); }
.tp-sidebar .tp-a, .tp-sidebar .tp-b, .tp-sidebar .tp-c { left: 18px; }
.tp-sidebar .tp-a { width: 18px; background: #1E3A4C; }
.tp-executive .tp-d { display: block; left: 3px; right: 3px; top: 3px; height: 15px; background: #1F2A44; border-radius: 2px; }
.tp-executive .tp-a { z-index: 1; top: 7px; background: #fff; width: 20px; }
.tp-executive .tp-b { z-index: 1; top: 12px; background: #A07A2C; }
.tp-compact .tp-c { top: 17px; height: 36px; left: 15px;
  background: repeating-linear-gradient(to bottom, #D8DCE0 0 2px, transparent 2px 4px); }
.tp-compact .tp-d { display: block; left: 6px; top: 17px; width: 6px; height: 36px;
  background: repeating-linear-gradient(to bottom, #9DB4CF 0 2px, transparent 2px 8px); }
.tp-bold .tp-a { height: 6px; width: 30px; background: #111; }
.tp-bold .tp-b { top: 15px; width: 32px; height: 2px; background: #D9480F; }
.tp-ats .tp-a { background: #000; } .tp-ats .tp-b { background: #444; }
.tp-ats .tp-c { background: repeating-linear-gradient(to bottom, #BBB 0 2px, transparent 2px 5px); }

/* ============================================================
   New CV themes (print-safe: no full-bleed colour, so they print
   the same with the browser's default margins)
   ============================================================ */
.cv-page.t-sidebar, .cv-page.t-executive, .cv-page.t-bold {
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* ---- Sidebar ---- */
.cv-page.t-sidebar .sb-grid {
  display: grid; grid-template-columns: 58mm minmax(0, 1fr); column-gap: 8mm;
  min-height: calc(var(--page-h) - 2 * var(--margin) - 4mm);
}
.cv-page.t-sidebar .sb-side {
  background: color-mix(in srgb, var(--accent) 11%, white);
  border-radius: 2mm; padding: 7mm 5.5mm; font-size: 0.94em;
}
.cv-page.t-sidebar .sb-side .cv-photo {
  display: block; width: 34mm; height: 34mm; margin: 0 auto 2mm; border-radius: 50%;
  object-fit: cover; border: 1.2mm solid #fff; order: 0;
}
.cv-page.t-sidebar .sb-side > .section:first-child { margin-top: 0; }
.cv-page.t-sidebar .sb-main > .cv-header + .section { margin-top: var(--section-gap); }
.cv-page.t-sidebar .sb-contact dl { margin: 0; display: grid; gap: 2.2mm; }
.cv-page.t-sidebar .sb-ct dt { font-size: 0.78em; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cv-page.t-sidebar .sb-ct dd { margin: 0.3mm 0 0; overflow-wrap: anywhere; }
.cv-page.t-sidebar .sb-ct.ct-work_permit dd { font-weight: 600; color: var(--primary); }
.cv-page.t-sidebar .sb-side .section-title {
  font-family: var(--font-heading); font-size: calc(0.82em * var(--heading-scale, 1)); font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 2mm;
}
.cv-page.t-sidebar .sb-side .entry-head { display: block; }
.cv-page.t-sidebar .sb-side .entry-title { font-size: 1em; }
.cv-page.t-sidebar .sb-side .skill-line { line-height: 1.6; }
.cv-page.t-sidebar .sb-main { padding-top: 6mm; }
.cv-page.t-sidebar .sb-main .cv-header { padding-bottom: 4mm; border-bottom: 0.6pt solid color-mix(in srgb, var(--primary) 20%, white); }
.cv-page.t-sidebar .name { font-family: var(--font-heading); font-weight: 700; font-size: calc(2.5em * var(--heading-scale, 1)); line-height: 1.05; letter-spacing: -0.02em; color: var(--primary); }
.cv-page.t-sidebar .headline { margin-top: 1.5mm; font-size: 1.15em; font-weight: 500; color: var(--accent); }
.cv-page.t-sidebar .sb-main .section-title {
  font-family: var(--font-heading); font-size: calc(0.86em * var(--heading-scale, 1)); font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 2.4mm;
  padding-bottom: 1mm; border-bottom: 1.4pt solid var(--accent); display: inline-block;
}
.cv-page.t-sidebar .entry-title { color: var(--primary); }
.cv-page.t-sidebar .entry-org .org { color: var(--text); font-weight: 500; }
/* letters in the Sidebar theme use a plain header with the photo on the left */
.cv-page.letter.t-sidebar .cv-header { padding: 5mm 6mm; border-radius: 2mm; background: color-mix(in srgb, var(--accent) 11%, white); }
.cv-page.letter.t-sidebar .cv-header.has-photo { display: flex; align-items: center; gap: 6mm; }
.cv-page.letter.t-sidebar .cv-photo { order: 0; width: 24mm; height: 24mm; }
.cv-page.letter.t-sidebar .contact { margin-top: 2mm; font-size: 0.92em; }

/* ---- Executive ---- */
.cv-page.t-executive .cv-header {
  background: var(--primary); color: #fff; border-radius: 1.5mm; padding: 8mm 9mm 7mm;
}
.cv-page.t-executive .cv-header.has-photo { display: flex; align-items: center; gap: 7mm; }
.cv-page.t-executive .cv-photo { width: 27mm; height: 27mm; border: 0.9mm solid rgba(255,255,255,0.85); }
.cv-page.t-executive .name { font-family: var(--font-heading); font-weight: 600; font-size: calc(2.6em * var(--heading-scale, 1)); line-height: 1.05; letter-spacing: 0.01em; color: #fff; }
.cv-page.t-executive .headline { margin-top: 1.6mm; font-size: 1.12em; color: color-mix(in srgb, var(--accent) 55%, white); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.cv-page.t-executive .contact { margin-top: 3mm; font-size: 0.92em; color: rgba(255,255,255,0.88); }
.cv-page.t-executive .contact li::before { color: color-mix(in srgb, var(--accent) 60%, white); }
.cv-page.t-executive .section-title {
  font-family: var(--font-heading); font-size: calc(1.2em * var(--heading-scale, 1)); font-weight: 600; color: var(--primary);
  margin-bottom: 2.4mm; padding-bottom: 1.2mm; border-bottom: 0.5pt solid color-mix(in srgb, var(--accent) 70%, white);
}
.cv-page.t-executive .entry-title { font-family: var(--font-heading); font-size: 1.12em; color: var(--primary); }
.cv-page.t-executive .entry-org .org { color: var(--accent); font-weight: 600; }
.cv-page.t-executive .bullets li::before { background: var(--accent); border-radius: 0; width: 1.3mm; height: 1.3mm; transform: rotate(45deg); }

/* ---- Compact: dates in a left gutter, tighter type ---- */
.cv-page.t-compact .cv-header { padding-bottom: 3mm; border-bottom: 1pt solid var(--primary); }
.cv-page.t-compact .cv-header.has-photo { display: flex; align-items: center; gap: 5mm; }
.cv-page.t-compact .cv-photo { order: 0; width: 20mm; height: 20mm; border-radius: 1.5mm; }
.cv-page.t-compact .name { font-family: var(--font-heading); font-weight: 700; font-size: calc(2.05em * var(--heading-scale, 1)); line-height: 1.08; color: var(--primary); }
.cv-page.t-compact .headline { margin-top: 0.8mm; font-weight: 500; color: var(--accent); }
.cv-page.t-compact .contact { margin-top: 1.6mm; font-size: 0.95em; }
.cv-page.t-compact .section-title {
  font-family: var(--font-heading); font-size: calc(0.86em * var(--heading-scale, 1)); font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 1.6mm;
  padding-bottom: 0.8mm; border-bottom: 0.5pt solid color-mix(in srgb, var(--primary) 18%, white);
}
/* Entries put their dates in a 27 mm gutter; other content lines up with the entry text. */
.cv-page.t-compact .section-body > :not(.entry) { margin-left: 32mm; }
.cv-page.t-compact .entry { display: grid; grid-template-columns: 27mm minmax(0, 1fr); column-gap: 5mm; }
.cv-page.t-compact .entry-head { display: contents; }
.cv-page.t-compact .entry-date { grid-column: 1; grid-row: 1 / span 3; text-align: left; font-size: 0.9em; padding-top: 0.15em; white-space: normal; }
.cv-page.t-compact .entry-main, .cv-page.t-compact .bullets, .cv-page.t-compact .entry-notes { grid-column: 2; }
.cv-page.t-compact .entry-title { font-size: 1em; color: var(--primary); }
.cv-page.t-compact .entry-org { display: inline; }
.cv-page.t-compact .bullets { margin-top: 0.6mm; }
.cv-page.t-compact .bullets li + li { margin-top: 0.3mm; }

/* ---- Bold ---- */
.cv-page.t-bold .cv-header { padding-bottom: 5mm; border-bottom: 2.6pt solid var(--accent); }
.cv-page.t-bold .cv-header.has-photo { display: flex; align-items: center; gap: 6mm; }
.cv-page.t-bold .cv-photo { order: 2; width: 28mm; height: 28mm; border-radius: 3mm; }
.cv-page.t-bold .name { font-family: var(--font-heading); font-weight: 800; font-size: calc(3.1em * var(--heading-scale, 1)); line-height: 0.98; letter-spacing: -0.035em; color: var(--primary); }
.cv-page.t-bold .headline { margin-top: 2mm; font-size: 1.25em; font-weight: 600; color: var(--accent); }
.cv-page.t-bold .contact { margin-top: 2.6mm; font-size: 0.93em; font-weight: 500; }
.cv-page.t-bold .section-title {
  font-family: var(--font-heading); font-size: calc(1.05em * var(--heading-scale, 1)); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--primary); margin-bottom: 2.4mm; display: flex; align-items: center; gap: 2.5mm;
}
.cv-page.t-bold .section-title::before { content: ""; width: 5mm; height: 2.4mm; background: var(--accent); }
.cv-page.t-bold .entry-title { font-weight: 700; }
.cv-page.t-bold .entry-org .org { font-weight: 600; color: var(--accent); }
.cv-page.t-bold .bullets li::before { background: var(--accent); border-radius: 0; width: 1.6mm; height: 0.7mm; top: calc(var(--line-height) * 0.5em - 0.35mm); }

/* ============================================================
   Cover letters: dashboard cards, editor screen
   ============================================================ */
.letter-thumb .letter-thumb-head { display: flex; align-items: center; gap: 0.55rem; padding: 0.85rem 0.9rem 0.3rem; }
.letter-thumb .letter-thumb-head .cv-card-avatar { background: var(--sheet-head); border-color: transparent; width: 1.8rem; height: 1.8rem; font-size: 0.66rem; }
.letter-thumb .letter-thumb-head i { display: block; height: 5px; width: 45%; border-radius: 3px; background: var(--sheet-tint); }

.letter-screen { min-height: 100vh; display: flex; flex-direction: column; }
.letter-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--surface);
}
.letter-save { font-size: 0.8rem; color: var(--ink-faint); }
.letter-h1 { font-size: 1.3rem; margin: 0 0 1.1rem; }
.letter-ai { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.letter-ai summary { cursor: pointer; font-weight: 650; font-size: 0.95rem; margin-bottom: 0.6rem; }
.letter-screen .preview-pane { top: 0; height: 100vh; }

.letter-links { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.letter-links h2 { margin: 0 0 0.3rem; }
.letter-link-list { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }

@media (max-width: 920px) {
  .letter-topbar { padding: 0.65rem 0.9rem; position: sticky; top: 0; z-index: 25; }
  .letter-screen .preview-pane { height: auto; }
}

/* Printing from the letter editor must show only the letter: hidden
   screens stay hidden even where the rules above force a display. */
@media print {
  [hidden] { display: none !important; }
  .letter-topbar, .mobile-toggle { display: none !important; }
  .letter-screen { display: block !important; min-height: 0; }
}

/* ---- Fit on fewer pages ---- */
.page-count-wrap { display: inline-flex; align-items: baseline; gap: 0.6rem; }
.fit-toggle { font-size: 0.78rem; }
.fit-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.9rem 1rem; margin: 0 0 0.9rem; font-size: 0.85rem; color: var(--ink); display: flex; flex-direction: column; gap: 0.9rem; }
.fit-panel[hidden] { display: none; }
.fit-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.fit-head select { font: inherit; padding: 0.2rem 0.35rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.fit-step p { margin: 0 0 0.45rem; color: var(--ink-soft); line-height: 1.45; }
.fit-step p strong { color: var(--ink); }
.fit-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.fit-result { font-weight: 600; color: var(--ink) !important; margin-top: 0.45rem !important; }
.fit-result:empty { display: none; }
.fit-suggestions { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.4rem; }
.fit-suggestions .fit-role-title { font-weight: 700; font-size: 0.82rem; margin: 0.2rem 0 -0.3rem; }
@media print { .fit-panel { display: none !important; } }
/* ---- Other personal details (Profile) ---- */
.extra-list { display: flex; flex-direction: column; gap: 0.5rem; }
.extra-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto; gap: 0.5rem; align-items: center; }
.extra-row input { width: 100%; }
.extra-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin-top: 0.6rem; }
.extra-quick { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.extra-chip { font: inherit; font-size: 0.78rem; padding: 0.2rem 0.6rem; border: 1px dashed var(--line-strong); border-radius: 999px; background: none; color: var(--ink-soft); cursor: pointer; }
.extra-chip:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 700px) { .extra-row { grid-template-columns: 1fr auto; } .extra-row .extra-value { grid-column: 1 / 2; } }
