/* =====================================================
   CV BUILDER — Hoja de estilos externa
   =====================================================
   Secciones:
   1. Variables CSS
   2. Reset
   3. Header
   4. Botones
   5. Barra de plantillas
   6. Layout principal
   7. Panel de formulario
   8. Secciones colapsables
   9. Elementos de formulario
   10. Tarjetas repetibles
   11. Tags / Habilidades
   12. Estrellas y rango
   13. Panel de vista previa
   14. Documento CV (base)
   15. Plantilla: Classic
   16. Plantilla: Modern
   17. Plantilla: Minimal
   18. Plantilla: Contemporary
   19. Plantilla: Studio
   20. Variantes Studio
   21. Foto de perfil
   22. Notificación
   23. Modal
   24. Estados vacíos
   25. Badge ATS
   26. Panel ATS
   27. Sugerencias de palabras clave
   28. Clases utilitarias (reemplazan estilos en línea)
   29. Media queries (responsive + impresión)
   ===================================================== */


/* ===== 1. VARIABLES CSS ===== */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: #e0ddd6;
  --text: #1a1916;
  --text-muted: #7a7770;
  --accent: #1a1916;
  --accent-light: #f0ede6;
  --danger: #c0392b;
  --success: #27ae60;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
  --font-display: 'DM Serif Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --photo-radius: 50%;
  --photo-size: 60px;
  --dm-bg: #111110;
  --dm-surface: #1c1b19;
  --dm-border: #2e2d2a;
  --dm-text: #f0ede6;
  --dm-text-muted: #9a9690;
  --dm-accent: #e8e4db;
  --dm-accent-light: #2a2925;
}

[data-dark] {
  --bg: var(--dm-bg);
  --surface: var(--dm-surface);
  --border: var(--dm-border);
  --text: var(--dm-text);
  --text-muted: var(--dm-text-muted);
  --accent: var(--dm-accent);
  --accent-light: var(--dm-accent-light);
}


/* ===== 2. RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: background .25s, color .25s;
}


/* ===== 3. HEADER ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  transition: background .25s, border-color .25s;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo span { color: var(--text-muted); font-style: italic; }

.header-actions { display: flex; gap: 8px; align-items: center; }


/* ===== 4. BOTONES ===== */
.btn {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover { background: var(--accent-light); border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover { opacity: .85; background: var(--accent); }

.btn.is-disabled,
.btn.is-disabled:hover {
  opacity: .55;
  cursor: not-allowed;
}

.btn-danger { color: var(--danger); border-color: #f5c6c2; }
.btn-danger:hover { background: #fdf0ef; border-color: var(--danger); }
[data-dark] .btn-danger:hover { background: #2a1a1a; }

.btn-icon {
  padding: 7px 10px;
  font-size: 1rem;
}

.btn-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .85rem;
  padding: 2px 5px;
  border-radius: 4px;
  transition: all .15s;
}

.btn-remove:hover { color: var(--danger); background: #fdf0ef; }

.btn-add {
  width: 100%;
  padding: 8px;
  border: 1.5px dashed var(--border);
  border-radius: 7px;
  background: transparent;
  font-family: var(--font-body);
  font-size: .8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  margin-top: 6px;
}

.btn-add:hover { border-color: var(--accent); color: var(--text); background: var(--accent-light); }

.btn-example {
  margin-top: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.btn-example:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-light);
}


/* ===== 5. BARRA DE PLANTILLAS ===== */
.templates-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  transition: background .25s;
}

.templates-bar::-webkit-scrollbar { display: none; }

.tpl-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }

.tpl-btn {
  font-family: var(--font-body);
  font-size: .77rem;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.tpl-btn:hover,
.tpl-btn.active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-light);
  font-weight: 500;
}


/* ===== 6. LAYOUT PRINCIPAL ===== */
.app-body {
  display: grid;
  grid-template-columns: 420px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}


/* ===== 7. PANEL DE FORMULARIO ===== */
.form-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
  padding: 24px;
  transition: background .25s, border-color .25s;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.form-panel::-webkit-scrollbar { width: 5px; }
.form-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.progress-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  background: var(--bg);
  transition: background .25s, border-color .25s;
}

.progress-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.progress-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.progress-card strong {
  display: block;
  color: var(--text);
  font-size: .95rem;
  line-height: 1.2;
}

.progress-count {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  background: var(--surface);
}

.progress-track {
  height: 7px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width .25s ease;
}

.progress-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.progress-item {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: .76rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}

.progress-item:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-light);
}

.progress-dot {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--surface);
  font-size: .68rem;
  font-weight: 700;
}

.progress-item.done {
  border-color: rgba(39, 174, 96, .45);
  color: var(--text);
  background: rgba(39, 174, 96, .09);
}

.progress-item.done .progress-dot {
  border-color: var(--success);
  background: var(--success);
}


/* ===== 8. SECCIONES COLAPSABLES ===== */
.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color .15s;
}

.section-card:focus-within { border-color: var(--accent); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--accent-light);
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}

.section-header:hover { background: var(--border); }

.section-title-row { display: flex; align-items: center; gap: 8px; }

.section-icon { font-size: 1rem; }

.section-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .2px;
}

.section-toggle { font-size: .75rem; color: var(--text-muted); transition: transform .2s; }
.section-toggle.open { transform: rotate(180deg); }

.section-body { padding: 14px; display: none; }
.section-body.open { display: block; }

.field-hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.45;
}


/* ===== 9. ELEMENTOS DE FORMULARIO ===== */
.field-group { margin-bottom: 10px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }

label {
  display: block;
  font-size: .73rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

input[type=text],
input[type=email],
input[type=tel],
input[type=url],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: .85rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, background .25s, color .25s;
  outline: none;
  resize: vertical;
}

input[type=file] {
  width: 100%;
  max-width: 100%;
  color: transparent;
}

input[type=file]::file-selector-button {
  color: #000;
}

input[type=range] {
  width: 100%;
  max-width: 100%;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 70px; }


/* ===== 10. TARJETAS REPETIBLES ===== */
.item-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
  background: var(--bg);
  transition: background .25s;
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.item-card-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}


/* ===== 11. TAGS / HABILIDADES ===== */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  min-height: 42px;
  cursor: text;
  transition: border-color .15s;
}

.tags-container:focus-within { border-color: var(--accent); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 500;
}

.tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  font-size: .75rem;
  line-height: 1;
  transition: color .15s;
}

.tag-remove:hover { color: var(--danger); }

.tag-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: .83rem;
  color: var(--text);
  flex: 1;
  min-width: 80px;
  padding: 2px;
}


/* ===== 12. ESTRELLAS Y RANGO ===== */
.stars { display: flex; gap: 3px; cursor: pointer; }
.star { font-size: 1rem; color: var(--border); transition: color .1s; }
.star.filled { color: #f39c12; }

input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}


/* ===== 13. PANEL DE VISTA PREVIA ===== */
.preview-panel {
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  transition: background .25s;
}

.preview-panel::-webkit-scrollbar { width: 5px; }
.preview-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Durante exportación PDF: evita recorte del escalado */
body.pdf-export-active .preview-panel { overflow: visible; }

/* Zoom para ajustar al contenedor */
.preview-scaler {
  transform-origin: top center;
  width: 794px;
  max-width: 100%;
  flex-shrink: 0;
}


/* ===== 14. DOCUMENTO CV (BASE) ===== */
/* A4 @ 96dpi ≈ 794×1123px — ancho fijo para paridad pantalla/PDF */
.cv-doc {
  width: 794px;
  min-height: 1122px;
  max-width: 794px;
  background: #fff;
  box-shadow: 0 4px 40px rgba(0,0,0,0.12);
  position: relative;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: #1a1916;
  transition: box-shadow .3s;
  transform-origin: top center;
  box-sizing: border-box;
  overflow: visible;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.cv-doc.pdf-exporting { box-shadow: none; }

.cv-doc-empty {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 260px 48px 48px;
}

.cv-empty-state {
  width: min(420px, 100%);
  text-align: center;
  color: #1a1916;
}

.cv-empty-state-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f0ede6;
  border: 1px solid #e0ddd6;
  color: #7a7770;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-style: italic;
}

.cv-empty-state h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
}

.cv-empty-state p {
  margin: 0 auto 20px;
  max-width: 34ch;
  color: #7a7770;
  font-size: .95rem;
  line-height: 1.55;
}

.cv-empty-state-action {
  justify-content: center;
}

.cv-doc .cv-item {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Idiomas: nombre + nivel en una sola fila (flex más estable que table-cell en PDF) */
.cv-doc .cv-lang { min-width: 0; }

.cv-doc .cv-lang-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 3px;
}

.cv-doc .cv-lang-row .cv-lang-name-text {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cv-doc .cv-lang-row .cv-lang-level {
  flex: 0 0 auto;
  white-space: nowrap;
}

.cv-empty { color: #c0bdb8; font-style: italic; font-size: 12px; }


/* ===== 15. PLANTILLA: CLASSIC ===== */
.tpl-classic .cv-header {
  background: #1a1916;
  color: #fff;
  padding: 36px 48px 28px;
}

.tpl-classic .cv-name {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.tpl-classic .cv-title {
  font-size: 13px;
  opacity: .7;
  font-weight: 300;
  margin-bottom: 14px;
  font-style: italic;
}

.tpl-classic .cv-contacts {
  display: block;
  font-size: 11.5px;
  opacity: .85;
  margin-top: 8px;
}

.tpl-classic .cv-contacts span {
  display: inline-block;
  margin-right: 18px;
  margin-bottom: 4px;
}

/* Layout tabla: estable en html2canvas/PDF (evita bugs con float) */
.tpl-classic .cv-body {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.tpl-classic .cv-sidebar {
  display: table-cell;
  vertical-align: top;
  background: #f5f4f0;
  padding: 28px 20px 28px 28px;
  width: 200px;
  box-sizing: border-box;
}

.tpl-classic .cv-main {
  display: table-cell;
  vertical-align: top;
  padding: 28px 38px 28px 24px;
  box-sizing: border-box;
}

.tpl-classic .cv-section { margin-bottom: 24px; }

.tpl-classic .cv-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #7a7770;
  border-bottom: 1.5px solid #e0ddd6;
  padding-bottom: 5px;
  margin-bottom: 12px;
}

.tpl-classic .cv-item { margin-bottom: 14px; }
.tpl-classic .cv-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }

.tpl-classic .cv-item-sub {
  font-size: 11.5px;
  color: #7a7770;
  margin-bottom: 5px;
  display: table;
  width: 100%;
  table-layout: fixed;
}

.tpl-classic .cv-item-sub span { display: table-cell; }

.tpl-classic .cv-item-sub span:last-child {
  text-align: right;
  white-space: nowrap;
  width: 34%;
}

.tpl-classic .cv-item-desc { font-size: 12px; color: #3a3835; line-height: 1.55; }

.tpl-classic .cv-tag {
  display: inline-block;
  background: #e8e4db;
  color: #1a1916;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  margin: 3px 3px 0 0;
  font-weight: 500;
}

.tpl-classic .cv-lang { margin-bottom: 10px; }
.tpl-classic .cv-lang-row { font-weight: 500; font-size: 12px; }
.tpl-classic .cv-lang-row .cv-lang-level { font-size: 10px; color: #7a7770; font-weight: 400; }
.tpl-classic .cv-lang-bar { height: 4px; background: #e0ddd6; border-radius: 2px; margin-top: 2px; }
.tpl-classic .cv-lang-fill { height: 100%; background: #1a1916; border-radius: 2px; }
.tpl-classic .cv-profile { font-size: 12.5px; line-height: 1.6; color: #3a3835; }


/* ===== 16. PLANTILLA: MODERN ===== */
.tpl-modern .cv-header {
  display: table;
  width: 100%;
  table-layout: fixed;
  padding: 40px 48px 32px;
  border-bottom: 2px solid #1a1916;
}

.tpl-modern .cv-header > div:first-child {
  display: table-cell;
  vertical-align: bottom;
  width: 100%;
}

.tpl-modern .cv-header > div:last-child {
  display: table-cell;
  vertical-align: bottom;
  width: 220px;
  text-align: right;
  padding-left: 20px;
}

.tpl-modern .cv-name {
  font-family: 'DM Serif Display', serif;
  font-size: 36px;
  letter-spacing: -1px;
  margin-bottom: 4px;
  color: #1a1916;
}

.tpl-modern .cv-title { font-size: 13px; color: #7a7770; font-weight: 400; }

.tpl-modern .cv-contacts {
  text-align: right;
  font-size: 11.5px;
  color: #7a7770;
  line-height: 1.8;
}

.tpl-modern .cv-body { padding: 32px 48px; box-sizing: border-box; }

.tpl-modern .cv-main-grid {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.tpl-modern .cv-main-grid > div { display: table-cell; vertical-align: top; }
.tpl-modern .cv-main-grid > div:first-child { width: auto; padding-right: 20px; }

.tpl-modern .cv-main-grid > div:last-child {
  width: 200px;
  padding-left: 20px;
  box-sizing: border-box;
}

.tpl-modern .cv-section { margin-bottom: 28px; }

.tpl-modern .cv-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #1a1916;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid #1a1916;
}

.tpl-modern .cv-item { margin-bottom: 16px; padding-left: 12px; border-left: 2px solid #e0ddd6; }
.tpl-modern .cv-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.tpl-modern .cv-item-sub { font-size: 11.5px; color: #7a7770; margin-bottom: 5px; }
.tpl-modern .cv-item-date { font-size: 10.5px; color: #9a9690; font-family: 'DM Mono', monospace; }
.tpl-modern .cv-item-desc { font-size: 12px; color: #3a3835; line-height: 1.55; }

.tpl-modern .cv-tag {
  display: inline-block;
  border: 1px solid #e0ddd6;
  color: #3a3835;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  margin: 3px 3px 0 0;
}

.tpl-modern .cv-lang { margin-bottom: 10px; }
.tpl-modern .cv-lang-row { font-weight: 500; font-size: 12px; }
.tpl-modern .cv-lang-row .cv-lang-level { font-size: 10px; color: #7a7770; }
.tpl-modern .cv-lang-bar { height: 3px; background: #e0ddd6; border-radius: 2px; margin-top: 1px; }
.tpl-modern .cv-lang-fill { height: 100%; background: #1a1916; border-radius: 2px; }
.tpl-modern .cv-profile { font-size: 12.5px; line-height: 1.65; color: #3a3835; }


/* ===== 17. PLANTILLA: MINIMAL ===== */
.tpl-minimal .cv-header {
  padding: 52px 56px 28px;
  text-align: center;
  border-bottom: 1px solid #e0ddd6;
}

.tpl-minimal .cv-name {
  font-family: 'DM Serif Display', serif;
  font-size: 34px;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.tpl-minimal .cv-title { font-size: 13px; color: #7a7770; margin-bottom: 12px; }

.tpl-minimal .cv-contacts {
  text-align: center;
  font-size: 11px;
  color: #9a9690;
  line-height: 1.65;
}

.tpl-minimal .cv-contacts span {
  display: inline-block;
  margin: 2px 8px;
  vertical-align: middle;
}

.tpl-minimal .cv-contacts span::before { content: '· '; }
.tpl-minimal .cv-contacts span:first-child::before { content: ''; }

.tpl-minimal .cv-body { padding: 32px 48px 40px; }
.tpl-minimal .cv-section { margin-bottom: 26px; }

.tpl-minimal .cv-section-title {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #9a9690;
  margin-bottom: 14px;
}

.tpl-minimal .cv-item {
  margin-bottom: 14px;
  display: table;
  width: 100%;
  table-layout: fixed;
  min-width: 0;
}

.tpl-minimal .cv-item-meta {
  display: table-cell;
  width: 110px;
  vertical-align: top;
  padding-right: 16px;
  box-sizing: border-box;
  font-size: 11px;
  color: #9a9690;
  padding-top: 1px;
}

.tpl-minimal .cv-item > div:not(.cv-item-meta) {
  display: table-cell;
  vertical-align: top;
  min-width: 0;
}

.tpl-minimal .cv-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.tpl-minimal .cv-item-sub { font-size: 11.5px; color: #7a7770; margin-bottom: 4px; }
.tpl-minimal .cv-item-desc { font-size: 12px; color: #3a3835; line-height: 1.55; }
.tpl-minimal .cv-tags-inline { margin-top: 12px; }

.tpl-minimal .cv-tag {
  display: inline-block;
  font-size: 11px;
  color: #7a7770;
  margin-right: 12px;
}

.tpl-minimal .cv-tag::before { content: '— '; }
.tpl-minimal .cv-lang { margin-bottom: 8px; font-size: 12px; }
.tpl-minimal .cv-lang-row { font-weight: 500; justify-content: flex-start; gap: 6px; }
.tpl-minimal .cv-lang-row .cv-lang-name-text { flex: 0 0 auto; }
.tpl-minimal .cv-lang-row .cv-lang-level { font-size: 11px; color: #9a9690; }
.tpl-minimal .cv-profile { font-size: 12.5px; line-height: 1.65; color: #3a3835; }


/* ===== 18. PLANTILLA: CONTEMPORARY ===== */
.tpl-contemporary .cv-header {
  background: #2c3e50 linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #fff;
  padding: 40px 48px 32px;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

/* Columna fija para foto — evita que table-layout:fixed + 1% sub-asigne y la imagen tape el texto */
.tpl-contemporary .cv-header-photo {
  flex: 0 0 var(--photo-size);
  width: var(--photo-size);
  min-width: var(--photo-size);
  max-width: var(--photo-size);
  line-height: 0;
  overflow: hidden;
  border-radius: var(--photo-radius);
}

.tpl-contemporary .cv-header-text {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tpl-contemporary .cv-photo { display: block; margin: 0; }

.tpl-contemporary .cv-name {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  letter-spacing: -0.5px;
  margin: 8px 0 4px;
  font-weight: 600;
}

.tpl-contemporary .cv-title {
  font-size: 14px;
  opacity: .9;
  font-weight: 400;
  margin: 0 0 16px;
  letter-spacing: 0.5px;
}

.tpl-contemporary .cv-contacts {
  display: block;
  font-size: 11px;
  opacity: .85;
  line-height: 1.6;
}

.tpl-contemporary .cv-contacts div {
  display: inline-block;
  margin-right: 16px;
  margin-bottom: 2px;
  vertical-align: top;
}

.tpl-contemporary .cv-contacts-bar {
  padding: 16px 48px 18px;
  border-bottom: 1px solid #ecf0f1;
  box-sizing: border-box;
  background: #fff;
  color: #34495e;
}

.tpl-contemporary .cv-body { display: block; padding: 32px 48px 40px; }
.tpl-contemporary .cv-section { margin-bottom: 28px; display: block; }

.tpl-contemporary .cv-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #2c3e50;
  margin: 0 0 16px 0;
  padding-left: 12px;
  border-left: 3px solid #3498db;
}

.tpl-contemporary .cv-item {
  margin-bottom: 16px;
  display: block;
  padding-bottom: 12px;
}

.tpl-contemporary .cv-item-title {
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 2px;
  color: #2c3e50;
}

.tpl-contemporary .cv-item-sub {
  font-size: 11px;
  color: #7f8c8d;
  margin: 2px 0 6px;
  display: block;
}

.tpl-contemporary .cv-item-date {
  font-size: 10px;
  color: #95a5a6;
  font-family: 'DM Mono', monospace;
  display: block;
  margin-bottom: 3px;
}

.tpl-contemporary .cv-item-desc { font-size: 12px; color: #34495e; line-height: 1.6; }

.tpl-contemporary .cv-tag {
  display: inline-block;
  background: #ecf0f1;
  color: #2c3e50;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11px;
  margin: 4px 6px 0 0;
  font-weight: 500;
}

.tpl-contemporary .cv-lang { margin-bottom: 10px; font-size: 12px; }
.tpl-contemporary .cv-lang-row { font-weight: 500; }
.tpl-contemporary .cv-lang-row .cv-lang-level { font-size: 10px; color: #95a5a6; }
.tpl-contemporary .cv-lang-bar { height: 3px; background: #ecf0f1; border-radius: 2px; margin-top: 5px; }
.tpl-contemporary .cv-lang-fill { height: 100%; background: #3498db; border-radius: 2px; }
.tpl-contemporary .cv-profile { font-size: 12px; line-height: 1.7; color: #34495e; }


/* ===== 19. PLANTILLA: STUDIO ===== */
/* Variables CSS únicamente; cabecera flex = estable en PDF, sin superposición table/img */
.tpl-studio {
  font-family: var(--studio-font-family, 'DM Sans'), sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--studio-fg, #1a2332);
  background: var(--studio-bg, #f4f6f9);
  --studio-primary: #1e3a5f;
  --studio-secondary: #4a7ab0;
  --studio-pad-x: 40px;
  --studio-pad-y: 28px;
  --studio-section-gap: 20px;
  --studio-item-gap: 14px;
  --studio-fg: #1a2332;
  --studio-bg: #f4f6f9;
  --studio-header-bg: #ffffff;
  --studio-strip-bg: #ffffff;
  --studio-muted: #5c6b7a;
  --studio-track-bg: #e2e8f0;
  --studio-line-style: solid;
  --studio-line-color: #4a7ab0;
  --studio-section-line-w: 1px;
  --studio-header-border-w: 2px;
  --studio-font-family: 'DM Sans';
  --studio-text-align: left;
}

.tpl-studio .cv-header {
  background: var(--studio-header-bg);
  padding: var(--studio-pad-y) var(--studio-pad-x);
  border-bottom: var(--studio-header-border-w, 2px) var(--studio-line-style) var(--studio-line-color);
  box-sizing: border-box;
}

/* Fila flex: columna de foto fija (igual que contemporary) — estable en html2canvas vs table+img */
.tpl-studio .cv-studio-head-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-width: 0;
}

.tpl-studio .cv-studio-photo-wrap {
  flex: 0 0 var(--photo-size);
  width: var(--photo-size);
  min-width: var(--photo-size);
  max-width: var(--photo-size);
  line-height: 0;
  overflow: hidden;
  border-radius: var(--photo-radius);
}

.tpl-studio .cv-studio-text-cell {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.tpl-studio .cv-name {
  font-family: 'DM Serif Display', serif;
  font-size: 30px;
  letter-spacing: -0.5px;
  color: var(--studio-primary);
  margin: 0 0 6px;
}

.tpl-studio .cv-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--studio-secondary);
  margin: 0;
}

.tpl-studio .cv-contacts-strip {
  display: block;
  background: var(--studio-strip-bg);
  padding: 12px var(--studio-pad-x) 14px;
  border-bottom: var(--studio-section-line-w, 1px) var(--studio-line-style) var(--studio-line-color);
  box-sizing: border-box;
}

.tpl-studio .cv-contacts {
  font-size: 11px;
  line-height: 1.65;
  color: var(--studio-muted);
}

.tpl-studio .cv-contacts span {
  display: inline-block;
  margin: 2px 14px 2px 0;
  white-space: nowrap;
}

.tpl-studio .cv-body {
  display: block;
  padding: var(--studio-pad-y) var(--studio-pad-x) calc(var(--studio-pad-y) + 8px);
  box-sizing: border-box;
}

.tpl-studio .cv-section { display: block; margin-bottom: var(--studio-section-gap); }

.tpl-studio .cv-section-title {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--studio-primary);
  border-bottom: var(--studio-section-line-w, 1px) var(--studio-line-style) var(--studio-line-color);
  padding-bottom: 6px;
  margin-bottom: 10px;
  text-align: var(--studio-text-align, left);
}

.tpl-studio .cv-item { display: block; margin-bottom: var(--studio-item-gap); padding-bottom: 2px; }

.tpl-studio .cv-item-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--studio-fg);
  margin: 0 0 3px;
}

.tpl-studio .cv-item-sub { font-size: 11.5px; color: var(--studio-secondary); margin: 0 0 4px; }

.tpl-studio .cv-item-date {
  font-size: 10px;
  color: var(--studio-muted);
  font-family: 'DM Mono', monospace;
  margin: 0 0 4px;
}

.tpl-studio .cv-item-desc {
  font-size: 12px;
  line-height: 1.55;
  color: var(--studio-fg);
  margin: 0;
  opacity: 0.92;
  text-align: var(--studio-text-align, left);
}

.tpl-studio .cv-profile {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--studio-fg);
  opacity: 0.95;
  text-align: var(--studio-text-align, left);
}

.tpl-studio .cv-tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  margin: 3px 6px 0 0;
  border: 1px solid var(--studio-secondary);
  color: var(--studio-primary);
  border-radius: 4px;
  font-weight: 500;
}

.tpl-studio .cv-lang-bar { height: 3px; background: var(--studio-track-bg); border-radius: 2px; margin-top: 4px; }
.tpl-studio .cv-lang-fill { height: 100%; background: var(--studio-primary); border-radius: 2px; }
.tpl-studio .cv-lang-row .cv-lang-level { color: var(--studio-secondary); }

.tpl-studio .cv-contacts,
.tpl-studio .cv-item-title,
.tpl-studio .cv-item-sub,
.tpl-studio .cv-item-date {
  text-align: var(--studio-text-align, left);
}


/* ===== 20. VARIANTES STUDIO ===== */

/* Layout con barra lateral */
.tpl-studio.studio-layout-sidebar .cv-body {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  padding: 0;
}

.tpl-studio.studio-layout-sidebar .cv-studio-col-main {
  display: table-cell;
  vertical-align: top;
  padding: var(--studio-pad-y) 22px calc(var(--studio-pad-y) + 8px) var(--studio-pad-x);
  box-sizing: border-box;
}

.tpl-studio.studio-layout-sidebar .cv-studio-col-aside {
  display: table-cell;
  vertical-align: top;
  width: 200px;
  background: var(--studio-track-bg);
  padding: var(--studio-pad-y) 20px calc(var(--studio-pad-y) + 8px) 18px;
  box-sizing: border-box;
  border-left: var(--studio-section-line-w, 1px) var(--studio-line-style, solid) var(--studio-line-color);
}

/* Cabecera centrada */
.tpl-studio.studio-header-center .cv-studio-head-row {
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.tpl-studio.studio-header-center .cv-studio-photo-wrap { margin-bottom: 10px; }

.tpl-studio.studio-header-center .cv-studio-text-cell {
  text-align: center;
  flex: 0 0 auto;
  width: 100%;
}

.tpl-studio.studio-header-center .cv-contacts { text-align: center; }
.tpl-studio.studio-header-center .cv-contacts span { margin: 2px 8px; }

/* Etiquetas rellenas */
.tpl-studio.studio-tags-filled .cv-tag {
  background: var(--studio-secondary);
  color: #fff;
  border-color: var(--studio-secondary);
}

/* Etiquetas de texto simple */
.tpl-studio.studio-tags-text .cv-tag {
  border: none;
  background: transparent;
  padding-left: 0;
  padding-right: 10px;
  color: var(--studio-fg);
  opacity: 0.88;
}

.tpl-studio.studio-tags-text .cv-tag::before {
  content: '· ';
  color: var(--studio-secondary);
  font-weight: 700;
}

/* Aviso de contraste insuficiente */
.studio-contrast-warn {
  font-size: .72rem;
  color: #c0392b;
  background: #fdf0ef;
  border: 1px solid #f5c6c2;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 12px;
  display: none;
}

.studio-contrast-warn.visible { display: block; }


/* ===== 21. FOTO DE PERFIL ===== */
/* div.cv-photo usa background-size:cover — más fiable en html2canvas que img+object-fit */
.cv-photo {
  width: var(--photo-size);
  height: var(--photo-size);
  border-radius: var(--photo-radius);
  box-sizing: border-box;
  flex-shrink: 0;
}

.cv-photo--fill {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: inline-block;
  vertical-align: middle;
}


/* ===== 22. NOTIFICACIÓN ===== */
.notif {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 500;
  z-index: 1000;
  animation: slideUp .2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}


/* ===== 23. MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.modal h3 { font-size: 1.05rem; margin-bottom: 8px; }
.modal p { font-size: .85rem; color: var(--text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }


/* ===== 24. ESTADOS VACÍOS ===== */
.cv-empty { color: #c0bdb8; font-style: italic; font-size: 12px; }


/* ===== 25. BADGE ATS ===== */
.ats-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: all .15s;
  user-select: none;
  white-space: nowrap;
}

.ats-badge:hover { background: var(--accent-light); border-color: var(--accent); }

.ats-score-ring {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.ats-score-ring.good { background: #27ae60; }
.ats-score-ring.fair { background: #f39c12; }
.ats-score-ring.poor { background: #e74c3c; }
.ats-score-ring.idle { background: #9a9690; }


/* ===== 26. PANEL ATS ===== */
.ats-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 370px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -6px 0 28px rgba(0,0,0,.13);
  z-index: 400;
  flex-direction: column;
  transition: background .25s, border-color .25s;
}

.ats-panel.show { display: flex; }

.ats-panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ats-panel-header h3 { font-size: .95rem; font-weight: 700; }

.ats-panel-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ats-score-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 12px;
}

.ats-score-circle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  border: 3px solid transparent;
}

.ats-score-circle .ats-num { font-size: 1.45rem; line-height: 1; }
.ats-score-circle .ats-pct { font-size: .6rem; opacity: .8; }
.ats-score-circle.good { background: #e9f7ef; color: #1e8449; border-color: #27ae60; }
.ats-score-circle.fair { background: #fef9e7; color: #9a7d0a; border-color: #f39c12; }
.ats-score-circle.poor { background: #fdedec; color: #922b21; border-color: #e74c3c; }

.ats-score-label strong { display: block; font-size: .9rem; margin-bottom: 3px; }
.ats-score-label p { font-size: .76rem; color: var(--text-muted); margin: 0; line-height: 1.4; }

.ats-progress {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  margin-bottom: 16px;
  overflow: hidden;
}

.ats-progress-bar { height: 100%; border-radius: 4px; transition: width .4s; }

.ats-group-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

.ats-issue {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 7px;
  margin-bottom: 4px;
  font-size: .78rem;
  line-height: 1.38;
}

.ats-issue.error { background: #fdedec; color: #922b21; }
.ats-issue.warn  { background: #fef9e7; color: #7d6608; }
.ats-issue.info  { background: #eaf4fb; color: #1a5276; }
.ats-issue.ok    { background: #e9f7ef; color: #1e8449; }
.ats-issue-icon  { flex-shrink: 0; font-size: .85rem; margin-top: 1px; }

.ats-panel-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}


/* ===== 27. SUGERENCIAS DE PALABRAS CLAVE ===== */
.kw-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

.kw-chip {
  font-size: .74rem;
  padding: 3px 10px;
  border-radius: 14px;
  border: 1.5px dashed var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}

.kw-chip:hover { border-color: var(--accent); color: var(--text); background: var(--accent-light); border-style: solid; }
.kw-chip.added { border-style: solid; border-color: #27ae60; color: #1e8449; cursor: default; opacity: .7; }

.ats-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 399;
}


/* ===== 28. CLASES UTILITARIAS (reemplazan estilos en línea del HTML) ===== */

/* Imagen de previsualización de foto */
#photo-preview {
  max-width: 100px;
  margin-top: 5px;
  display: none;
  border-radius: 5px;
}

/* Botón para eliminar foto */
.btn-remove-photo {
  margin-top: 5px;
  padding: 5px 10px;
}

/* Grupos de opciones de foto (forma y tamaño) */
.photo-option-group { margin-top: 10px; }

/* Campo de sugerencias con margen superior */
.field-group-mt { margin-top: 12px; }

/* Input de palabras clave */
#kw-position { margin-bottom: 6px; }

/* Sección Studio oculta por defecto (JS la muestra dinámicamente) */
#sec-studio { display: none; }

/* Fila de radios de alineación Studio */
.studio-align-options {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* Párrafo de ayuda del orden de secciones */
.section-order-hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Grupo con margen superior grande */
.field-group-lg-mt { margin-top: 16px; }

/* Botón ancho completo */
.btn-full { width: 100%; }

/* Botón ancho completo con margen inferior */
.btn-full-mb { width: 100%; margin-bottom: 8px; }

/* Botón centrado (para panel ATS) */
.btn-center { justify-content: center; }

/* Input de nombre de preset */
#presetNameInput {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-body);
  margin-bottom: 16px;
}

/* Ocultar input de importación de archivo */
#importFile { display: none; }

/* Mensaje de carga del panel ATS */
.ats-loading-msg {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 40px;
}

/* Texto aclaratorio del pie del panel ATS */
.ats-disclaimer {
  font-size: .69rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}


/* ===== 29. CLASES PARA CONTENIDO GENERADO POR JS ===== */

/* Studio — UI de orden de secciones */
.studio-order-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}

.studio-order-num {
  width: 16px;
  text-align: center;
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.studio-order-label {
  flex: 1;
  font-size: .8rem;
}

.studio-order-badge {
  font-size: .63rem;
  color: var(--text-muted);
  background: var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 3px;
}

.studio-order-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 7px;
  font-size: .7rem;
  color: var(--text-muted);
  line-height: 1.4;
  transition: all .15s;
}

.studio-order-btn:disabled {
  opacity: .3;
  cursor: default;
}

.studio-order-btn:not(:disabled):hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--text);
}

/* Panel ATS — caja de buenas prácticas */
.ats-good-section {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ats-empty-state {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 18px;
  color: var(--text);
}

.ats-empty-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.ats-empty-state strong {
  font-size: .95rem;
  margin-bottom: 6px;
}

.ats-empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: .78rem;
  line-height: 1.45;
  max-width: 28ch;
}

.ats-group-title--first { margin-top: 0; }

/* Sugerencias de palabras clave — sin resultados */
.kw-no-results {
  font-size: .74rem;
  color: var(--text-muted);
}

/* ===== 30. PESTAÑAS MÓVIL (ocultas por defecto) ===== */
.mobile-tabs { display: none; }
.mobile-tab  { display: none; }


/* ===== 31. MEDIA QUERIES ===== */

/* ─── Tablet / ventana estrecha (≤ 900px) ─── */
@media (max-width: 900px) {
  body {
    height: auto;
    overflow: auto;
    display: block;
  }

  .app-body {
    grid-template-columns: 1fr;
    flex: none;
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .form-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 0;
    overflow-y: visible;
    padding: 20px;
  }

  /* overflow-x: hidden evita scroll horizontal del CV escalado */
  .preview-panel {
    padding: 20px;
    min-height: 200px;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: flex-start;
  }

  /* transform-origin y scale son inyectados por scalePreview() en JS */
  .preview-scaler { transform-origin: top left; }

  .app-header { padding: 0 16px; }
  .header-actions { gap: 6px; }
  .header-actions .btn-label { display: none; }

  .templates-bar { padding: 10px 16px; gap: 8px; }

  /* Panel ATS: no mayor que la ventana */
  .ats-panel { width: min(370px, 100vw); }

  .tpl-contemporary .cv-body  { padding: 24px 32px 32px; }
  .tpl-contemporary .cv-header { padding: 24px 32px; }
}


/* ─── Móvil (≤ 640px) ─── */
@media (max-width: 640px) {

  /* — Header — */
  .app-header {
    height: auto;
    min-height: 52px;
    padding: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }
  .logo { font-size: 1.1rem; }
  .app-header,
  .templates-bar,
  .mobile-tabs,
  .app-body,
  .form-panel {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .header-actions {
    width: 100%;
    gap: 4px;
    min-width: 0;
    flex-shrink: 1;
    justify-content: flex-start;
  }
  #btn-import,
  #btn-export,
  #btn-clear,
  #darkBtn { display: none; }
  .btn { padding: 6px 10px; font-size: .78rem; }
  .btn-icon { padding: 6px 8px; }
  .ats-badge { padding: 5px 9px; }

  /* — Barra de plantillas — */
  .templates-bar { padding: 8px 10px; gap: 6px; }
  .tpl-label { display: none; }
  .tpl-btn   { font-size: .74rem; padding: 5px 10px; }

  /* — Pestañas móvil — */
  .mobile-tabs {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: sticky;
    top: 92px;
    z-index: 99;
    transition: background .25s, border-color .25s;
  }

  .mobile-tab {
    display: flex;
    flex: 0 0 195px;
    max-width: 195px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    padding: 10px 4px;
    font-family: var(--font-body);
    font-size: .72rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: color .15s, border-color .15s, background .15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
    background: var(--accent-light);
  }

  /* Por defecto: formulario visible, previsualización oculta */
  .form-panel    { display: block !important; }
  .preview-panel { display: none  !important; }

  /* Al activar pestaña "Vista previa" */
  .app-body.mobile-show-preview .form-panel    { display: none  !important; }
  .app-body.mobile-show-preview .preview-panel { display: flex  !important; }

  /* — Panel de formulario — */
  .form-panel {
    width: 100vw;
    max-width: 100vw;
    padding: 14px;
    overflow-x: hidden;
  }
  .progress-card,
  .section-card {
    width: min(360px, calc(100vw - 28px));
    max-width: min(360px, calc(100vw - 28px));
    margin-left: 0;
    margin-right: 0;
  }

  /* Campos 2 columnas → 1 columna */
  .field-row { grid-template-columns: 1fr; }

  /* — Panel de previsualización — */
  .preview-panel { padding: 16px 20px 20px; }

  /* — Panel ATS → bottom-sheet — */
  .ats-panel {
    width: 100%;
    left: 0;
    top: auto;
    bottom: 0;
    height: 75vh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 28px rgba(0,0,0,.13);
  }

  /* — Modal — */
  .modal { padding: 20px; }
}


/* ─── Teléfono pequeño (≤ 420px) ─── */
@media (max-width: 420px) {
  /* Ocultar botones menos críticos para evitar desbordamiento */
  #btn-import, #btn-export { display: none; }
  .header-actions { gap: 3px; }
  .btn { padding: 5px 8px; font-size: .75rem; }
  .ats-badge { font-size: .72rem; padding: 4px 8px; }
}


/* ─── Impresión / Exportación PDF ─── */
@page { size: A4 portrait; margin: 0; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: white !important; height: auto !important; overflow: visible !important; display: block !important; }

  .app-header,
  .templates-bar,
  .mobile-tabs,
  .form-panel,
  .ats-panel,
  .ats-overlay,
  .notif { display: none !important; }

  .app-body { display: block !important; overflow: visible !important; height: auto !important; min-height: 0 !important; }

  .preview-panel {
    overflow: visible !important;
    padding: 0 !important;
    background: white !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  #previewScaler { transform: none !important; width: 210mm !important; margin: 0 !important; }

  #cvDoc {
    width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-height: 297mm !important;
  }

  .cv-item    { page-break-inside: avoid; break-inside: avoid; }
  .cv-section { page-break-inside: avoid; break-inside: avoid; }

  /* Ritmo vertical compacto */
  #cvDoc .cv-header { padding-top: 22px !important; padding-bottom: 20px !important; }
  #cvDoc .cv-sidebar,
  #cvDoc .cv-main,
  #cvDoc .cv-body { padding-top: 20px !important; padding-bottom: 20px !important; }
  #cvDoc .cv-section { margin-bottom: 16px !important; }
  #cvDoc .cv-item    { margin-bottom: 10px !important; }
  #cvDoc.tpl-studio  { --studio-pad-y: 20px; --studio-section-gap: 14px; --studio-item-gap: 10px; }
}
