/* ==========================================================================
   CreaCV — editor (formularios, barra de herramientas y vista previa)
   ========================================================================== */
.editor-page { background: var(--bg); }
.editor-page .site-header { position: sticky; }
.ed-toolbar { position: sticky; top: var(--header-h); z-index: 50; background: #fff; border-bottom: 1px solid var(--line); }
.ed-toolbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 20px; max-width: 1500px; margin: 0 auto; }
.ed-tool { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; color: var(--text-soft); }
.ed-tool select, .ed-tool input[type="range"] { font: inherit; }
.ed-tool select { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 32px 0 10px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%235f6880' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; color: var(--navy); font-weight: 600; }
.ed-tool input[type="range"] { width: 110px; accent-color: var(--blue); }
.ed-swatches { display: flex; gap: 6px; align-items: center; }
.ed-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.ed-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--navy); }
.ed-color { width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.ed-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.ed-more { position: relative; }
.ed-more > summary { list-style: none; cursor: pointer; }
.ed-more > summary::-webkit-details-marker { display: none; }
.ed-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; }
.ed-menu button, .ed-menu a { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 9px; font: inherit; font-size: .92rem; color: var(--text); cursor: pointer; text-decoration: none; }
.ed-menu button:hover, .ed-menu a:hover { background: var(--surface-2); }
.ed-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.ed-menu .is-danger { color: var(--danger); }
.ed-menu button[disabled] { opacity: .45; cursor: not-allowed; }
.ed-tpl-desc { flex-basis: 100%; margin: -2px 0 0; font-size: .82rem; color: var(--muted); }

.ed-layout { display: grid; grid-template-columns: minmax(380px, 560px) minmax(0, 1fr); gap: 0; max-width: 1500px; margin: 0 auto; width: 100%; align-items: start; }
.ed-form { padding: 20px; display: grid; gap: 14px; }
.ed-preview { min-width: 0; position: sticky; top: calc(var(--header-h) + 64px); height: calc(100vh - var(--header-h) - 64px); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #e9edf4; }
.ed-preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #f3f5f9; font-size: .88rem; color: var(--text-soft); }
.ed-preview-bar strong { color: var(--navy); }
.ed-zoom { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ed-zoom button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-weight: 700; color: var(--navy); }
.ed-zoom .ed-fit { width: auto; padding: 0 10px; font-weight: 600; font-size: .82rem; }
#zoom-label { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.ed-preview-scroll { flex: 1; overflow: auto; padding: 20px 16px 40px; }
.ed-pages { margin: 0 auto; position: relative; }
.ed-pages > .cv { transform: scale(var(--zoom, 1)); transform-origin: top left; width: 210mm; }
.ed-pages .cv-page { box-shadow: 0 1px 3px rgba(13, 27, 62, .12), 0 10px 30px -12px rgba(13, 27, 62, .25); margin-bottom: 8mm; }
.ed-preview-note { font-size: .8rem; color: var(--muted); text-align: center; margin: 4px 0 0; }
#cv-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }

/* Tarjetas del formulario */
.ed-card, .ed-sec { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.ed-card { padding: 16px 18px; }
.ed-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 18px; font-family: var(--font-display); font-weight: 500; color: var(--navy); font-size: 1.05rem; }
.ed-sec > summary::-webkit-details-marker { display: none; }
.ed-sec > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-left: 6px; transition: transform .2s; }
.ed-sec[open] > summary::after { transform: rotate(-135deg); }
.ed-sec-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--blue-soft); color: var(--blue-strong); display: grid; place-items: center; flex-shrink: 0; }
.ed-sec-icon svg { width: 18px; height: 18px; }
.ed-sec-title { flex: 1; }
.ed-switch { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font); font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.ed-switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.ed-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.ed-switch input:checked { background: var(--blue); }
.ed-switch input:checked::after { transform: translateX(16px); }
.ed-sec.is-off > summary .ed-sec-title { opacity: .6; }
.ed-sec-body { padding: 0 18px 18px; display: grid; gap: 14px; }
.ed-sec-off { margin: 0 18px 16px; font-size: .86rem; color: var(--muted); }
.ed-grid { display: grid; gap: 12px 14px; grid-template-columns: 1fr 1fr; }
.ed-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ed-field--full, .ed-grid > .ed-field--full { grid-column: 1 / -1; }
.ed-label { font-size: .86rem; font-weight: 600; color: var(--text-soft); }
.ed-label small { font-weight: 400; color: var(--muted); }
.ed-input { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: .97rem; color: var(--text); background: #fff; transition: border-color .2s, box-shadow .2s; }
textarea.ed-input { resize: vertical; line-height: 1.5; min-height: 88px; }
select.ed-input { appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%235f6880' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.ed-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.ed-input[aria-invalid="true"] { border-color: var(--danger); }
.ed-input::placeholder { color: #98a1b5; }
.ed-hint { font-size: .8rem; color: var(--muted); }
.ed-hint.is-warn { color: var(--warning); }
.ed-error { font-size: .8rem; color: var(--danger); font-weight: 600; min-height: 0; }
.ed-error:empty { display: none; }
.ed-month { display: grid; grid-template-columns: 1.3fr 1fr; gap: 6px; }
[data-month].is-disabled { opacity: .5; }
.ed-check { flex-direction: row; align-items: center; gap: 8px; font-size: .92rem; color: var(--text-soft); cursor: pointer; }
.ed-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.ed-helpers { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -2px; }
.ed-helpers .btn { color: var(--blue-strong); padding: 0 8px; }

.ed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ed-item { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; animation: rise .25s var(--ease) both; }
.ed-item-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.ed-item-title { flex: 1; font-weight: 600; font-size: .92rem; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-item-tools { display: flex; gap: 4px; }
.ed-mini { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--text-soft); font-size: .95rem; }
.ed-mini:hover { border-color: var(--navy); color: var(--navy); }
.ed-mini[disabled] { opacity: .35; cursor: default; }
.ed-mini--del:hover { border-color: var(--danger); color: var(--danger); }
.ed-item-grid { padding: 12px; display: grid; gap: 12px 14px; grid-template-columns: 1fr 1fr; }
.ed-item--compact .ed-item-grid { grid-template-columns: 1fr 1fr; }
.ed-empty { font-size: .9rem; color: var(--muted); margin: 0; }
.ed-add { justify-self: start; }

.ed-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ed-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--blue-soft); color: var(--navy); font-size: .9rem; font-weight: 600; }
.ed-chip button { width: 22px; height: 22px; border-radius: 50%; border: 0; background: #fff; color: var(--text-soft); cursor: pointer; font-size: .72rem; }
.ed-chip button:hover { background: var(--danger); color: #fff; }
.ed-inline { display: flex; gap: 8px; }
.ed-inline .ed-input { flex: 1; }

.ed-photo { display: flex; align-items: center; gap: 16px; }
.ed-photo-frame { width: 76px; height: 76px; border-radius: 50%; background: var(--surface-2); border: 2px dashed var(--line-strong); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; color: var(--muted); }
.ed-photo-frame img { width: 100%; height: 100%; object-fit: cover; display: none; }
.ed-photo-frame svg { width: 28px; height: 28px; }
.has-photo .ed-photo-frame { border-style: solid; }
.has-photo .ed-photo-frame img { display: block; }
.has-photo .ed-photo-frame svg { display: none; }
.ed-photo input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* Asistente */
.ed-assistant > summary .ed-badge { margin-left: auto; }
.ed-badge { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-strong); display: inline-grid; place-items: center; font-family: var(--font); font-size: .8rem; font-weight: 700; }
.ed-badge.is-warning { background: var(--warning-bg); color: var(--warning); }
.ed-badge.is-error { background: var(--danger-bg); color: var(--danger); }
.ed-badge.is-ok { background: var(--success-bg); color: var(--success); }
.ed-assistant-note { font-size: .82rem; color: var(--muted); margin: 0; }
.ed-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.ed-tip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: 10px; font-size: .88rem; line-height: 1.45; background: var(--bg); border: 1px solid var(--line); }
.ed-tip > span:nth-child(2) { flex: 1 1 220px; }
.ed-tip-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 6px; background: var(--blue-soft); color: var(--blue-strong); }
.ed-tip.is-warning .ed-tip-label { background: var(--warning-bg); color: var(--warning); }
.ed-tip.is-error { border-color: #f4c7c1; }
.ed-tip.is-error .ed-tip-label { background: var(--danger-bg); color: var(--danger); }
.ed-tip.is-ok { background: var(--success-bg); border-color: #bfe5d2; color: var(--success); }
.ed-link { border: 0; background: none; color: var(--blue-strong); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }
.ed-general-tips { margin: 0; padding-left: 1.1em; font-size: .86rem; color: var(--text-soft); }
.ed-general-tips li { margin-bottom: 4px; }

.ed-restore { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border-radius: 14px; background: var(--blue-soft); border: 1px solid #c9d8ff; color: var(--navy); }
.ed-restore p { margin: 0; flex: 1 1 240px; font-size: .92rem; }
.ed-save-status { font-size: .84rem; color: var(--muted); margin: 0; }
.ed-privacy { font-size: .84rem; color: var(--text-soft); margin: 0; }

/* Diálogos de ayuda */
.ed-dlg-h { font-size: .95rem; margin: 16px 0 8px; font-family: var(--font); font-weight: 700; }
.ed-verbs { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-verb { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--navy); }
.ed-verb:hover { border-color: var(--blue); background: var(--blue-soft); }
.ed-examples { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ed-examples li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: .9rem; }
.ed-example { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.ed-example p { margin: 6px 0 10px; font-size: .92rem; }

/* Pestañas móviles */
.ed-tabs { display: none; }
@media (max-width: 1000px) {
  .ed-layout { grid-template-columns: minmax(0, 1fr); }
  .ed-preview { position: static; height: auto; border-left: 0; min-height: calc(100vh - var(--header-h) - 120px); }
  .ed-preview-scroll { overflow: visible; }
  body[data-view="form"] .ed-preview { display: none; }
  body[data-view="preview"] .ed-form { display: none; }
  .ed-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(13, 27, 62, .4); }
  .ed-tabs button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff; font: inherit; font-weight: 700; color: var(--navy); }
  .ed-tabs button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
  .editor-page main { padding-bottom: 76px; }
  .ed-toolbar { position: static; }
  .ed-actions { margin-left: 0; width: 100%; }
  .ed-actions .btn { flex: 1; }
  .ed-preview-bar .ed-back { display: inline-flex; }
}
.ed-back { display: none; }
@media (max-width: 560px) {
  .ed-form { padding: 12px; }
  .ed-grid, .ed-item-grid { grid-template-columns: 1fr; }
  .ed-toolbar-inner { padding: 10px 12px; }
  .ed-tool input[type="range"] { width: 90px; }
  .ed-preview-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .ed-preview-bar > span:not(.ed-zoom) { order: -1; flex-basis: 100%; }
  .ed-preview-bar .ed-back { flex: 1; justify-content: center; }
  .ed-zoom { margin-left: 0; }
}

/* Impresión: solo se imprimen las páginas del currículum */
@media print {
  .editor-page .site-header, .ed-toolbar, .ed-form, .ed-preview-bar, .ed-tabs, .ed-preview-note, .toast-region, dialog, .skip-link, #cv-measure { display: none !important; }
  .editor-page, .editor-page main, .ed-layout, .ed-preview, .ed-preview-scroll { display: block !important; position: static !important; height: auto !important; min-height: 0 !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; border: 0 !important; background: #fff !important; max-width: none !important; }
  body[data-view] .ed-preview { display: block !important; }
  .ed-pages { width: auto !important; height: auto !important; margin: 0 !important; }
  .ed-pages > .cv { transform: none !important; }
  .ed-pages .cv-page { margin: 0 !important; box-shadow: none !important; }
}

/* Íconos dentro de textos del editor */
.ed-tool > svg, .ed-card h2 svg, .ed-preview-bar svg, .ed-tabs svg, .ed-sec-body .btn svg { width: 18px; height: 18px; vertical-align: -3px; flex-shrink: 0; }
.ed-tool > svg { color: var(--muted); }
