/* ==========================================================================
   CVlisto — estilos
   ========================================================================== */

:root {
  --brand: #2350e0;
  --brand-dark: #1a3db3;
  --brand-soft: #eaf0ff;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ok: #0f7a55;
  --ok-soft: #e6f5ee;
  --warn: #9a5b00;
  --err: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; font-size: 16px; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; letter-spacing: -.015em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------- Cabecera ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo svg { width: 30px; height: 30px; }
.logo b { color: var(--brand); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.nav .lang { border: 1px solid var(--line); font-weight: 600; }
@media (max-width: 860px) { .nav > a { display: none; } }
.langs { position: relative; }
.langs > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; font-weight: 600; color: var(--ink); white-space: nowrap; user-select: none; }
.langs > summary::-webkit-details-marker { display: none; }
.langs > summary svg { width: 18px; height: 18px; fill: var(--muted); }
.langs > summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); margin-left: 2px; }
.langs[open] > summary { background: var(--bg); }
.langs-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 190px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.langs-menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .92rem; font-weight: 500; }
.langs-menu a:hover { background: var(--bg); color: var(--ink); }
.langs-menu a[aria-current="true"] { color: var(--brand); background: var(--brand-soft); font-weight: 700; }

/* ---------- Encabezado de la herramienta ---------- */
.hero { padding: 22px 0 14px; }
.hero h1 { font-size: clamp(1.55rem, 1.1rem + 2vw, 2.35rem); margin: 0 0 6px; font-weight: 800; }
.hero .sub { margin: 0; color: var(--muted); font-size: clamp(.95rem, .9rem + .2vw, 1.05rem); max-width: 760px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; padding: 0; list-style: none; font-size: .85rem; font-weight: 600; color: var(--ink); }
.badges li { display: flex; align-items: center; gap: 6px; }
.badges li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--ok-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%230f7a55' d='M9.5 16.2L5.3 12l-1.4 1.4 5.6 5.6L20.1 8.4 18.7 7z'/%3E%3C/svg%3E") center/12px no-repeat; }
@media (max-width: 560px) { .badges { font-size: .78rem; } .hero { padding-top: 16px; } }

/* ---------- Herramienta ---------- */
.tool { margin-bottom: 22px; }
.tool noscript p { background: var(--card); padding: 24px; border-radius: var(--radius); }
.tabs { display: none; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 20px; align-items: start; }

.editor { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 700; color: var(--ink); user-select: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: ""; margin-left: auto; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.sec[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.sec-count:not(:empty) { font-size: .75rem; background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 1px 8px; }
.sec-body { padding: 0 18px 18px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { grid-column: span 2; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld--half { grid-column: span 1; }
.fld label, .fld-label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.fld input[type="text"], .fld input[type="email"], .fld input[type="tel"], .fld textarea, .fld select, .tb-group select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #cfd8e3; border-radius: 10px; padding: 9px 11px; transition: border-color .15s, box-shadow .15s;
}
.fld textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.fld input:focus, .fld textarea:focus, .fld select:focus, .tb-group select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(35, 80, 224, .15); }
.fld input:disabled { background: var(--bg); color: var(--muted); }
.fld-hint { margin: 0; font-size: .78rem; color: var(--muted); }
.fld--check { flex-direction: row; align-items: center; gap: 8px; }
.fld--check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.fld--check label { font-weight: 500; }
.sec-body > .fld--check { margin-top: 4px; margin-bottom: 12px; }

.fld--photo { margin-top: 14px; }
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-thumb { flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--bg) center/cover no-repeat; border: 2px dashed #cfd8e3; }
.photo-thumb.has { border: 2px solid var(--line); }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.photo-actions .fld-hint { flex-basis: 100%; }

.more { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.more > summary { cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--brand); margin-bottom: 10px; }
.us-note { display: none; margin: 0 0 12px; font-size: .84rem; background: var(--brand-soft); color: var(--brand-dark); padding: 8px 12px; border-radius: 10px; }
[data-nophoto="1"] .us-note { display: block; }
[data-nophoto="1"] .fld--photo, [data-nophoto="1"] .more { display: none; }
.consent-opt { display: none; margin-top: 14px; }
[data-consent="1"] .consent-opt { display: flex; }

.items { display: flex; flex-direction: column; gap: 12px; }
.items:empty { display: none; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; background: #fbfcfe; }
.item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.item-title { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item-tools { display: flex; gap: 2px; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover:not(:disabled) { background: var(--line); color: var(--ink); }
.icon-btn--del:hover:not(:disabled) { background: #fdecea; color: var(--err); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.add-btn { margin-top: 12px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--brand); background: transparent; border: 1.5px dashed #b8c6f5; border-radius: 10px; cursor: pointer; }
.add-btn svg { width: 18px; height: 18px; fill: currentColor; }
.add-btn:hover { background: var(--brand-soft); }

.data-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.data-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .88rem; font-weight: 700; color: var(--ok); }
.lock svg { width: 16px; height: 16px; fill: currentColor; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; padding: 10px 16px; font-size: .95rem; transition: background .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: .84rem; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(35, 80, 224, .3); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-soft { background: #fff; color: var(--ink); border-color: #cfd8e3; }
.btn-soft:hover { background: var(--bg); }
.btn-link { background: transparent; color: var(--muted); text-decoration: underline; padding-left: 4px; padding-right: 4px; }
.btn-danger { color: var(--err); }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; fill: currentColor; }

/* Vista previa */
.viewer { position: sticky; top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 24px); min-width: 0; }
.toolbar { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.tb-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tb-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tb-row { display: flex; gap: 10px; }
.tb-grow { flex: 1; }
.tb-group select { padding: 7px 10px; font-size: 15px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg-btn { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font: inherit; font-size: .86rem; font-weight: 600; color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.seg-btn[aria-checked="true"] { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.tpl-ico { flex: none; width: 18px; height: 23px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; overflow: hidden; }
.tpl-clasica .tpl-ico::before { content: ""; position: absolute; left: 3px; right: 3px; top: 4px; height: 2px; background: currentColor; box-shadow: 0 5px 0 currentColor, 0 9px 0 currentColor, 0 13px 0 currentColor; opacity: .8; }
.tpl-moderna .tpl-ico::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: currentColor; }
.tpl-elegante .tpl-ico::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: currentColor; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--c); }

.pv-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; font-size: .8rem; color: var(--muted); }
.pv-saved { color: var(--ok); font-weight: 600; opacity: 0; transition: opacity .3s; }
.pv-saved.on { opacity: 1; }
.pv-stage { position: relative; flex: 1; min-height: 0; overflow: auto; background: #e8ecf2; padding: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pages { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.page { width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(15, 23, 42, .14); border-radius: 2px; }
.ghost-badge { display: none; position: sticky; top: 0; z-index: 2; margin: -4px auto 10px; width: fit-content; max-width: 100%; text-align: center; font-size: .8rem; font-weight: 600; background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 99px; }
.is-ghost .ghost-badge { display: block; }
.is-ghost .pages { opacity: .55; }
.dl-box { padding: 12px 16px 14px; }
.btn-dl { width: 100%; padding: 13px 18px; font-size: 1.02rem; }
.is-busy .btn-dl { opacity: .7; pointer-events: none; }
.dl-status { margin: 8px 0 0; font-size: .85rem; text-align: center; min-height: 1.3em; color: var(--muted); }
.dl-status:empty { display: none; }
.dl-status.is-ok { color: var(--ok); font-weight: 600; }
.dl-status.is-warn { color: var(--warn); font-weight: 600; }
.dl-status.is-err { color: var(--err); font-weight: 600; }
.mbar { display: none; }

.privacy { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; font-size: .86rem; color: var(--ok); font-weight: 600; text-align: center; }

@media (max-width: 899px) {
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #e3e8f0; padding: 4px; border-radius: 12px; margin-bottom: 12px; }
  .tab { font: inherit; font-weight: 700; font-size: .95rem; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
  .tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
  .builder { grid-template-columns: 1fr; }
  [data-view="edit"] .viewer { display: none; }
  [data-view="preview"] .editor { display: none; }
  .viewer { position: static; max-height: none; }
  .pv-stage { padding: 10px; }
  .dl-box { display: none; }
  .mbar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .mbar .dl-status { margin: 0 0 8px; }
  body { padding-bottom: 84px; }
  .sec > summary { padding: 13px 14px; }
  .sec-body { padding: 0 14px 14px; }
}
@media (max-width: 400px) {
  .fld--half { grid-column: span 2; }
  .seg-btn { font-size: .78rem; padding: 7px 6px; gap: 5px; }
}

/* ---------- Huecos de publicidad ---------- */
.ad-slot { position: relative; display: flex; align-items: center; justify-content: center; border: 1.5px dashed #c3ccd9; border-radius: 10px; background: repeating-linear-gradient(-45deg, #f8fafc, #f8fafc 10px, #f1f4f8 10px, #f1f4f8 20px); color: #94a3b8; font-size: .78rem; font-weight: 700; letter-spacing: .14em; }
.ad-slot--leader { min-height: 100px; margin: 0 auto 28px; max-width: 970px; }
.ad-slot--content { min-height: 260px; margin: 32px 0; }
.ad-slot--modal { min-height: 250px; margin: 14px 0; }
.ad-slot--toast { min-height: 100px; }

.ad-modal { border: 0; border-radius: 16px; padding: 22px; width: min(92vw, 400px); box-shadow: 0 24px 60px rgba(15, 23, 42, .3); }
.ad-modal::backdrop { background: rgba(15, 23, 42, .5); }
.ad-modal-title { margin: 0 24px 2px 0; font-weight: 800; color: var(--ink); font-size: 1.1rem; }
.ad-modal-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.ad-close { width: 100%; }
.ad-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--bg); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.ad-x:hover { background: var(--line); }
.ad-toast { position: fixed; left: 16px; bottom: 16px; z-index: 50; width: 320px; background: #fff; border-radius: 14px; padding: 28px 12px 12px; box-shadow: 0 12px 36px rgba(15, 23, 42, .22); }
.ad-toast[hidden] { display: none; }
.ad-toast .ad-x { top: 4px; right: 4px; width: 26px; height: 26px; font-size: 1.1rem; }
@media (max-width: 899px) { .ad-toast { left: 12px; right: 12px; width: auto; bottom: 96px; } }

/* ---------- Contenido ---------- */
.content { max-width: 860px; margin: 0 auto; }
.block { margin: 0 0 40px; }
.block h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); margin: 0 0 14px; }
.block h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.block p, .block li { font-size: 1rem; }
.block ul { padding-left: 20px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0; margin: 0; list-style: none; counter-reset: s; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: 10px; }
.steps strong { display: block; color: var(--ink); margin-bottom: 4px; }
.steps p { margin: 0; font-size: .93rem; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }
.guide { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 32px); }
.guide h3:first-of-type { margin-top: 6px; }
.tip { background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 16px; color: var(--ink); font-size: .95rem; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--brand); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 18px 16px; }
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.formats a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); font-weight: 700; transition: border-color .15s, transform .15s; }
.formats a:hover { border-color: var(--brand); transform: translateY(-2px); }
.formats a span { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.formats a[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); padding: 26px 0; margin-top: 20px; font-size: .88rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-footer a { color: var(--muted); }

/* ---------- Páginas legales ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 32px 16px 20px; }
.legal h1 { font-size: 1.9rem; }
.legal .todo { background: #fff6e0; border: 1px dashed #e0a800; padding: 2px 6px; border-radius: 4px; }
