/* cvforge — App shell
   Aesthetic: clean industrial / product tool
*/

:root {
  --ink: #121417;
  --ink-soft: #2a3038;
  --muted: #6a7280;
  --paper: #f3f4f6;
  --paper-2: #ffffff;
  --line: rgba(18, 20, 23, 0.1);
  --accent: #1a5f4a;
  --accent-2: #1a5f4a;
  --ok: #1a5f4a;
  --danger: #a33;
  --shadow: 0 1px 2px rgba(18, 20, 23, 0.04), 0 8px 24px rgba(18, 20, 23, 0.06);
  --radius: 10px;
  --font-display: "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --header-h: 56px;
  --cv-accent: #1f4b7a;
  --cv-density: 1;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: var(--accent-2); }
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(15, 28, 46, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 1000;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-word {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-transform: lowercase;
}
.brand-word::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 2px;
  margin-bottom: 1px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.header-nav {
  display: flex;
  gap: 1rem;
  margin-left: 1rem;
  flex: 1;
}
.header-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
}
.header-nav a:hover { color: var(--accent); }

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

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn.primary:hover { background: #000; }
.btn.ghost {
  background: transparent;
}
.btn.small {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}
.btn.lg {
  padding: 0.8rem 1.25rem;
  font-size: 1rem;
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(170, 51, 51, 0.25);
}

/* Hero */
.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.4vw, 2.65rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 48ch;
  margin: 0 0 1.4rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.hero-badges {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.hero-badges li {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 28, 46, 0.06);
  border: 1px solid var(--line);
}

/* Hero interactive template showcase */
.hero-panel { display: grid; place-items: center; }
.hero-showcase {
  width: min(100%, 340px);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.hero-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(18, 20, 23, 0.05), 0 22px 48px rgba(18, 20, 23, 0.13);
  padding: 0.55rem;
  transform: rotate(1.6deg);
  transition: transform 0.35s ease;
}
.hero-showcase:hover .hero-card,
.hero-showcase:focus-within .hero-card { transform: rotate(0deg); }
.hc-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px 9px;
}
.hc-bar .dot { width: 9px; height: 9px; border-radius: 50%; background: #e2e4e8; }
.hc-bar .dot:first-child { background: #e07a5f; }
.hc-bar .dot:nth-child(2) { background: #e8b93f; }
.hc-bar .dot:nth-child(3) { background: #5fb87a; }
.hc-url {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 9px;
  border-radius: 999px;
}

.hero-stage {
  --acc: #1a5f4a;
  position: relative;
  min-height: 216px;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f6f8fa);
  overflow: hidden;
}
.hero-stage.in { animation: heroIn 0.45s ease both; }
@keyframes heroIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* mini-CV skeleton primitives */
.hero-stage .hm-head { display: flex; align-items: center; gap: 9px; }
.hero-stage .hm-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: color-mix(in srgb, var(--acc) 18%, #e9edf2);
  color: var(--acc);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.7rem; flex-shrink: 0;
}
.hero-stage .hm-avatar.lg { width: 44px; height: 44px; font-size: 0.85rem; margin: 0 auto 6px; }
.hero-stage .hm-name { font-weight: 700; font-size: 0.92rem; letter-spacing: -0.01em; color: #1b1f24; }
.hero-stage .hm-role { font-size: 0.66rem; color: var(--acc); font-weight: 600; }
.hero-stage .hm-rule { height: 2px; background: var(--acc); opacity: 0.85; margin: 0.7rem 0; border-radius: 2px; }
.hero-stage .hm-sec {
  height: 6px; width: 32%; border-radius: 2px;
  background: var(--acc); opacity: 0.8; margin: 0.7rem 0 0.4rem;
}
.hero-stage .hm-line { height: 6px; border-radius: 3px; background: #e0e4ea; margin-bottom: 0.35rem; }
.hero-stage .hm-line.sh { width: 58%; }

/* single layout: centered header */
.hero-stage.layout-single .hm-head { flex-direction: column; text-align: center; gap: 6px; }
.hero-stage.layout-single .hm-avatar { width: 44px; height: 44px; font-size: 0.85rem; }

/* sidebar layout */
.hero-stage .hm-sb { display: grid; grid-template-columns: 38% 1fr; gap: 10px; height: 100%; }
.hero-stage .hm-side {
  background: linear-gradient(160deg, var(--acc), color-mix(in srgb, var(--acc) 68%, #000));
  border-radius: 7px; padding: 0.7rem 0.55rem; text-align: center; color: #fff;
}
.hero-stage .hm-side .hm-avatar { background: rgba(255,255,255,0.25); color: #fff; }
.hero-stage .hm-sname { font-weight: 700; font-size: 0.72rem; }
.hero-stage .hm-srole { font-size: 0.58rem; opacity: 0.9; margin-bottom: 8px; }
.hero-stage .hm-sline { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.5); margin: 5px auto; }
.hero-stage .hm-sline.sh { width: 62%; }
.hero-stage .hm-main { padding-top: 2px; }

/* grid (swiss) layout */
.hero-stage .hm-topbar { height: 7px; background: var(--acc); border-radius: 2px; margin-bottom: 0.7rem; }
.hero-stage .hm-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 0.8rem; }
.hero-stage .hm-cells i {
  height: 34px; border-radius: 5px; background: #e9edf2;
  border-left: 3px solid var(--acc);
}

/* dark (tech) layout */
.hero-stage.layout-dark { background: linear-gradient(180deg, #0d1117, #161b22); border-color: #30363d; }
.hero-stage.layout-dark .hm-name { color: #e6edf3; }
.hero-stage.layout-dark .hm-avatar { background: rgba(88,166,255,0.15); }
.hero-stage.layout-dark .hm-line { background: #21262d; }
.hero-stage.layout-dark .hm-role { color: var(--acc); }

/* switch dots */
.hero-switch { display: flex; gap: 8px; justify-content: center; }
.hero-dot {
  --acc: #9aa1ab;
  width: 26px; height: 8px; padding: 0; border: none; border-radius: 999px;
  background: rgba(18, 20, 23, 0.14); cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.hero-dot:hover { background: color-mix(in srgb, var(--acc) 60%, #cfd3da); }
.hero-dot.active { background: var(--acc); transform: scaleX(1.18); }
.hero-dot:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.hero-showcase-cap {
  margin: 0; text-align: center; font-size: 0.78rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.hero-showcase-cap strong { color: var(--ink); font-weight: 600; }
.hero-live {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: heroPulse 1.8s ease-out infinite;
}
@keyframes heroPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-stage.in { animation: none; }
  .hero-live { animation: none; }
}

/* Sections */
.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
}

.section-head {
  margin-bottom: 1.25rem;
  max-width: 60ch;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}
.section-head p {
  margin: 0;
  color: var(--muted);
}

/* Template gallery — cards */
.tpl-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.tpl-card {
  --sw1: #1f4b7a;
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.tpl-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--sw1) 45%, var(--line));
  box-shadow: 0 2px 4px rgba(18, 20, 23, 0.05), 0 16px 34px rgba(18, 20, 23, 0.11);
}
.tpl-card:focus-visible {
  outline: 2px solid var(--sw1);
  outline-offset: 2px;
}
.tpl-card.active {
  border-color: var(--sw1);
  box-shadow: 0 0 0 2px var(--sw1), var(--shadow);
}

/* Mini CV preview thumbnail */
.tpl-thumb {
  --pad: 12px;
  position: relative;
  display: block;
  height: 138px;
  padding: var(--pad);
  background:
    linear-gradient(180deg, #fff, #fbfbfc);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.tpl-thumb::after {
  /* accent header strip */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--sw1);
  opacity: 0.9;
}
.tpl-card:hover .tpl-thumb { background: linear-gradient(180deg, #fff, #f7f8fa); }

/* skeleton primitives */
.tpl-thumb .th-name {
  display: block;
  height: 9px;
  width: 62%;
  border-radius: 2px;
  background: var(--sw1);
  margin-bottom: 6px;
}
.tpl-thumb .th-role {
  display: block;
  height: 5px;
  width: 42%;
  border-radius: 2px;
  background: color-mix(in srgb, var(--sw1) 45%, #cfd3da);
  margin-bottom: 9px;
}
.tpl-thumb .th-rule {
  display: block;
  height: 1px;
  width: 100%;
  background: var(--line);
  margin-bottom: 8px;
}
.tpl-thumb .th-line {
  display: block;
  height: 4px;
  width: 100%;
  border-radius: 2px;
  background: #dfe2e8;
  margin-bottom: 6px;
}
.tpl-thumb .th-line.short { width: 55%; }

/* single */
.tpl-thumb.l-single { padding-top: 16px; }

/* sidebar */
.tpl-thumb.l-sidebar {
  display: grid;
  grid-template-columns: 34% 1fr;
  gap: 10px;
  padding-top: 16px;
}
.tpl-thumb.l-sidebar .th-side {
  align-self: stretch;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--sw1), color-mix(in srgb, var(--sw1) 70%, #000));
  opacity: 0.92;
}
.tpl-thumb.l-sidebar .th-main { min-width: 0; }

/* grid */
.tpl-thumb.l-grid { padding-top: 16px; }
.tpl-thumb.l-grid .th-bar {
  display: block;
  height: 10px;
  width: 70%;
  border-radius: 2px;
  background: var(--sw1);
  margin-bottom: 10px;
}
.tpl-thumb.l-grid .th-cells {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tpl-thumb.l-grid .th-cells i {
  display: block;
  height: 30px;
  border-radius: 4px;
  background: #e6e8ee;
  border-left: 3px solid color-mix(in srgb, var(--sw1) 60%, #cfd3da);
}

/* timeline */
.tpl-thumb.l-timeline { padding-top: 16px; }
.tpl-thumb.l-timeline .th-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 16px;
}
.tpl-thumb.l-timeline .th-rail::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 3px;
  bottom: 3px;
  width: 2px;
  background: color-mix(in srgb, var(--sw1) 40%, #d7dae1);
}
.tpl-thumb.l-timeline .th-ev {
  position: relative;
  height: 16px;
  border-radius: 4px;
  background: #e6e8ee;
}
.tpl-thumb.l-timeline .th-ev::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sw1);
  box-shadow: 0 0 0 2px #fff;
}

/* Card body */
.tpl-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 0.9rem 1rem;
  flex: 1;
}
.tpl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.1rem;
}
.tpl-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--sw1);
  background: color-mix(in srgb, var(--sw1) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--sw1) 22%, transparent);
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  line-height: 1.4;
}
.tpl-format {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tpl-body strong {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tpl-body .desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

/* "Aplicada" badge on active card */
.tpl-check {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--sw1);
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-4px) scale(0.95);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}
.tpl-card.active .tpl-check {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Photo upload */
.photo-field {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.photo-preview-wrap {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.photo-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #e8eaee;
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}
.photo-preview span {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--muted);
}
.photo-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-preview.has-photo span { display: none; }
.photo-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.photo-actions .hint { margin: 0 0 0.55rem; max-width: 36ch; }
.photo-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.photo-upload-btn { cursor: pointer; }

/* Photo cropper modal */
.cropper-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(18, 20, 23, 0.55);
  backdrop-filter: blur(3px);
}
.cropper-overlay[hidden] { display: none; }
.cropper-modal {
  width: min(360px, 92vw);
  background: var(--paper-2);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  padding: 1.25rem;
  animation: cropper-pop 0.16s ease;
}
@keyframes cropper-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.cropper-modal h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.cropper-hint {
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.cropper-stage {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: #11151b;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.cropper-stage:active { cursor: grabbing; }
.cropper-stage img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.cropper-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(17, 21, 27, 0.55);
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: -1px;
}
.cropper-zoom {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.95rem 0 1rem;
}
.cropper-zoom span { font-size: 0.8rem; color: var(--muted); }
.cropper-zoom input { flex: 1; accent-color: var(--accent); }
.cropper-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Editor */
.editor-section {
  max-width: 1400px;
  margin: 1rem auto 2rem;
  padding: 0 1rem;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 24px rgba(15, 28, 46, 0.04);
}
.editor-toolbar h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.35rem;
}
.muted { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0 0; }

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: flex-end;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field-inline select,
.field-inline input[type="color"] {
  font: inherit;
  font-size: 0.88rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.4rem 0.5rem;
  min-width: 140px;
}
.field-inline input[type="color"] {
  padding: 0.15rem;
  width: 52px;
  min-width: 52px;
  height: 34px;
  cursor: pointer;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 1.05fr);
  gap: 0.9rem;
  align-items: start;
}

.form-panel,
.preview-panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-panel {
  min-height: 70vh;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 28, 46, 0.03);
}

.tab {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
}
.tab:hover { background: rgba(15, 28, 46, 0.05); color: var(--ink); }
.tab.active {
  background: var(--ink);
  color: var(--paper);
}

.tab-panel {
  display: none;
  padding: 1rem 1.1rem 1.4rem;
  max-height: calc(100vh - 220px);
  overflow: auto;
}
.tab-panel.active { display: block; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.field.span-2 { grid-column: span 2; }
.field input,
.field textarea,
.field select,
.repeat-card input,
.repeat-card textarea {
  font: inherit;
  font-weight: 450;
  font-size: 0.92rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.55rem 0.7rem;
  background: #fff;
  width: 100%;
}
.field textarea,
.repeat-card textarea { resize: vertical; min-height: 70px; }
.field input:focus,
.field textarea:focus,
.repeat-card input:focus,
.repeat-card textarea:focus,
.field-inline select:focus {
  outline: 2px solid rgba(31, 75, 122, 0.35);
  border-color: var(--accent-2);
}
.hint {
  font-weight: 450;
  color: var(--muted);
  font-size: 0.78rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}
.panel-head h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-display);
}
.panel-head.mt,
.field.mt { margin-top: 1.25rem; }

.repeat-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.repeat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(15, 28, 46, 0.02);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.repeat-card .full { grid-column: span 2; }
.repeat-card .card-actions {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}
.repeat-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

/* Tips / ATS */
.tips-card h3,
.tips-card h4 {
  font-family: var(--font-display);
  margin: 0 0 0.6rem;
}
.checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.checklist li {
  padding: 0.45rem 0.55rem 0.45rem 1.9rem;
  border-radius: 8px;
  margin-bottom: 0.3rem;
  background: rgba(15, 28, 46, 0.04);
  position: relative;
  font-size: 0.9rem;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.6rem;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid var(--line);
  background: #fff;
}
.checklist li.ok {
  background: rgba(31, 122, 76, 0.1);
}
.checklist li.ok::before {
  border-color: var(--ok);
  background: var(--ok);
  box-shadow: inset 0 0 0 2px #fff;
}
.score-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  margin-bottom: 1rem;
}
.score-box strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
}
.tips-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.tips-list li { margin-bottom: 0.4rem; }

/* Preview */
.preview-panel {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  max-height: calc(100vh - var(--header-h) - 24px);
  display: flex;
  flex-direction: column;
}

.preview-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(15, 28, 46, 0.03);
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
#zoomLabel {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-width: 3ch;
  text-align: center;
}

.preview-scroll {
  overflow: auto;
  padding: 1rem;
  background:
    linear-gradient(45deg, #d9d2c5 25%, transparent 25%),
    linear-gradient(-45deg, #d9d2c5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9d2c5 75%),
    linear-gradient(-45deg, transparent 75%, #d9d2c5 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #cfc6b6;
  flex: 1;
}

.preview-scale {
  margin: 0 auto;
  /* width/height are set by JS to the scaled footprint of the A4 page */
}
.cv-scale {
  width: 210mm;
  transform-origin: top left;
  will-change: transform;
}

/* Formats + FAQ */
.fmt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}
.fmt-grid article {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}
.fmt-grid h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.fmt-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-list {
  display: grid;
  gap: 0.55rem;
  max-width: 760px;
}
.faq-list details {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.faq-list summary {
  font-weight: 700;
  cursor: pointer;
}
.faq-list p {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 2rem 1.25rem;
  background: rgba(15, 28, 46, 0.04);
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.4fr;
  gap: 2rem;
  align-items: start;
}
.site-footer strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.site-footer p { margin: 0.4rem 0 0; max-width: 42ch; font-size: 0.9rem; }
.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  width: fit-content;
}
.footer-nav a:hover { color: var(--accent); }
.footer-meta { text-align: right; }
.footer-meta p { max-width: none; margin-top: 0; }
.footer-meta p + p { margin-top: 0.6rem; }
.footer-meta a { text-decoration: none; }
.footer-meta a:hover { text-decoration: underline; }
.footer-contact { font-size: 0.9rem; font-weight: 500; color: var(--ink-soft); }
.footer-contact a { color: var(--accent); font-weight: 600; }

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-meta { text-align: left; }
  .site-footer p { max-width: 52ch; }
}

/* Empty state in lists */
.empty-hint {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
}

/* Responsive */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-panel { display: none; }
  .header-nav { display: none; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview-panel {
    position: relative;
    top: 0;
    max-height: none;
  }
  /* Auto-fit preview to width on mobile → manual zoom not needed */
  .zoom-controls { display: none; }
  .preview-scroll { padding: 0.75rem; }
  .form-panel { min-height: 0; }
  .tab-panel { max-height: none; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
  .repeat-card { grid-template-columns: 1fr; }
  .repeat-card .full,
  .repeat-card .card-actions { grid-column: span 1; }
  .header-actions .ghost { display: none; }
  .hero h1 { max-width: none; }
  .tpl-list { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
  .tpl-thumb { height: 118px; }
}

@media (prefers-reduced-motion: reduce) {
  .tpl-card,
  .tpl-check { transition: none; }
  .tpl-card:hover { transform: none; }
}

/* Print / PDF */
@media print {
  body * { visibility: hidden !important; }
  #cvPage,
  #cvPage * { visibility: visible !important; }
  #cvPage {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    width: 210mm !important;
    min-height: 297mm !important;
  }
  .site-header,
  .hero,
  .section,
  .editor-toolbar,
  .form-panel,
  .preview-chrome,
  .site-footer,
  .skip-link { display: none !important; }
  .preview-panel,
  .preview-scroll,
  .preview-scale,
  .cv-scale,
  .editor-section,
  .editor-layout,
  main {
    all: unset !important;
    display: block !important;
  }
  body {
    background: #fff !important;
    margin: 0 !important;
  }
  @page {
    size: A4;
    margin: 0;
  }
}
