/* ── Base ─────────────────────────────────────────────────────────────────── */
:root {
  --brand: #4338ca;
  --brand-d: color-mix(in srgb, var(--brand) 80%, #000);
  --brand-50: color-mix(in srgb, var(--brand) 8%, #fff);
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f6f7fb; --card: #fff;
  --wa: #15803d; --wa-d: #166534;
  --r: 14px; --r-sm: 10px;
  --sh: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px rgba(15, 23, 42, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.modal-open { overflow: hidden; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: #fff; padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Encabezado y pie ─────────────────────────────────────────────────────── */
.top { background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 18px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo svg { width: 32px; height: 32px; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 14.5px; font-weight: 600; padding: 7px 10px; border-radius: 9px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand); }
.nav .nav-pro { color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 30%, #fff); }
.is-pro .nav .nav-pro::after { content: " ✓"; }
.menu-btn { display: none; margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 12px; font-size: 18px; cursor: pointer; }
.install { border: 0; background: var(--brand-50); color: var(--brand); font-weight: 700; border-radius: 9px; padding: 7px 10px; cursor: pointer; font-size: 14px; }

.foot { background: #0f172a; color: #cbd5e1; margin-top: 64px; padding: 40px 18px 28px; font-size: 14.5px; }
.foot-in { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
.foot a { color: #e2e8f0; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot h4 { color: #fff; margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot .logo { color: #fff; }
.foot-legal { max-width: 1240px; margin: 26px auto 0; padding-top: 18px; border-top: 1px solid #1e293b; font-size: 13px; color: #94a3b8; }

main { max-width: 1240px; margin: 0 auto; padding: 0 18px; }

/* ── Héroe ────────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 34px 0 22px; max-width: 860px; margin: 0 auto; }
.hero h1 { font-size: clamp(28px, 4.4vw, 44px); margin: 0 0 12px; font-weight: 850; }
.hero h1 span { color: var(--brand); }
.hero p { font-size: clamp(16px, 2vw, 19px); color: var(--ink-2); margin: 0 auto; max-width: 720px; }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; padding: 0; margin: 16px 0 0; }
.pills li { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.crumbs { font-size: 13.5px; color: var(--muted); padding-top: 16px; }
.crumbs a { color: var(--muted); }

/* ── Generador ────────────────────────────────────────────────────────────── */
.app { min-height: 420px; }
.app-loading { padding: 60px 0; text-align: center; color: var(--muted); }
.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: 24px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
.card h3 { margin: 0 0 12px; font-size: 15.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; }
.full { grid-column: 1 / -1; }
.mt { margin-top: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span:first-child { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.fld.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: var(--r-sm); padding: 9px 11px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type="color"] { padding: 2px; width: 44px; height: 36px; cursor: pointer; }
input[type="checkbox"] { width: auto; }
.join { display: flex; align-items: center; gap: 6px; }
.join select { width: auto; flex: 0 0 auto; }
.join input { flex: 1; }
.join .rate { flex: 0 0 72px; }
.join i { font-style: normal; color: var(--muted); }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; }

details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
details.card[open] > summary { margin-bottom: 12px; }
details.card[open] > summary::after { content: "▴"; }
.sum-title { font-weight: 700; font-size: 15.5px; }
.sum-hint { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.btn-ghost { border: 1px dashed #94a3b8; background: #fff; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-link { border: 0; background: none; color: var(--brand); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }
.color-pick { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.badge { display: inline-block; font-style: normal; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; background: var(--brand); color: #fff; border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }

.items { display: grid; gap: 8px; }
.it { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fcfcfe; }
.it-d { width: 100%; min-height: 40px; resize: none; overflow: hidden; }
.it-row { display: grid; grid-template-columns: 74px 96px minmax(90px, 1fr) auto 36px; gap: 8px; margin-top: 8px; align-items: end; }
.it-row label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.it-row label span, .it-tot span { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.it-row input { padding: 8px 9px; }
.it-tot { display: flex; flex-direction: column; gap: 3px; text-align: right; min-width: 86px; }
.it-tot b { font-size: 15px; padding: 8px 0; white-space: nowrap; }
.it-del { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 9px; height: 38px; cursor: pointer; font-size: 14px; }
.it-del:hover { color: #b91c1c; border-color: #fca5a5; }
.btn-add { margin-top: 10px; width: 100%; border: 1px dashed #94a3b8; background: #fff; border-radius: 12px; padding: 10px; font: inherit; font-weight: 700; color: var(--brand); cursor: pointer; }
.btn-add:hover { border-color: var(--brand); background: var(--brand-50); }
.sums { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 4px; }
.sums div { display: flex; justify-content: space-between; color: var(--ink-2); }
.sums .sum-total { font-size: 19px; color: var(--ink); padding-top: 6px; }
.sums .sum-total b { color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 750; font-size: 15.5px; cursor: pointer; text-decoration: none; border: 1px solid transparent; line-height: 1.2; text-align: center; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-pri { background: var(--brand); color: #fff; }
.btn-pri:hover { background: var(--brand-d); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-d); }
.btn-sec { background: #fff; color: var(--ink); border-color: #cbd5e1; }
.btn-sec:hover { border-color: var(--brand); color: var(--brand); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.actions2 { display: flex; flex-wrap: wrap; gap: 8px; }
.actions2 button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.actions2 button:hover { border-color: var(--brand); color: var(--brand); }
.actions2 .get-pro { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, #fff); }
.privacy-note { font-size: 13px; color: var(--muted); margin: 12px 2px 0; }

.gen-prev { position: sticky; top: 14px; }
.prev-bar { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.prev-close { display: none; }
.prev-wrap { position: relative; overflow: hidden; border-radius: 6px; box-shadow: var(--sh); background: #fff; }
.prev-wrap .paper { transform-origin: top left; }
.mbar { display: none; }

/* ── Documento (vista previa; mismas proporciones que el PDF: 1 pt = 1.333 px) ── */
.paper { --accent: #1d4ed8; width: 816px; min-height: 1056px; background: #fff; color: #111827; font: 12.3px/1.32 Helvetica, Arial, sans-serif; padding: 53px; display: flex; flex-direction: column; text-align: left; letter-spacing: 0; }
.paper--a4 { width: 794px; min-height: 1123px; }
.paper .ph { color: #a3acb9; }
.pp-head { display: flex; justify-content: space-between; gap: 24px; }
.pp-biz { max-width: 55%; }
.pp-logo { max-width: 200px; max-height: 72px; object-fit: contain; display: block; margin-bottom: 10px; }
.pp-biz-name { font-weight: 700; font-size: 17.3px; margin-bottom: 2px; overflow-wrap: anywhere; }
.pp-muted { color: #64748b; font-size: 11.7px; overflow-wrap: anywhere; }
.pp-meta { text-align: right; }
.pp-title { color: var(--accent); font-weight: 700; font-size: 28px; line-height: 1.15; margin-bottom: 6px; }
.pp-num { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pp-date { color: #64748b; font-size: 12px; }
.pp-bueno { margin-top: 6px; font-size: 15.3px; }
.pp-rule { height: 1.6px; background: var(--accent); margin: 11px 0 21px; }
.pp-band { background: var(--accent); color: #fff; margin: -53px -53px 21px; padding: 0 53px; height: 128px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pp-band-l { display: flex; align-items: center; gap: 18px; min-width: 0; }
.pp-band .pp-biz-name { color: #fff; font-size: 20px; }
.pp-band-sub { font-size: 12px; opacity: .92; }
.pp-band-r { text-align: right; }
.pp-band .pp-title { color: #fff; margin: 0; }
.pp-band .pp-num { font-weight: 400; }
.pp-logo-box { background: #fff; border-radius: 8px; padding: 9px; display: inline-flex; }
.pp-logo-box img { max-width: 146px; max-height: 62px; object-fit: contain; display: block; }
.pp-sub { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.pp-client { background: #f4f6fa; border-radius: 8px; padding: 14px 18px; margin-bottom: 21px; }
.pp-label { font-size: 10px; font-weight: 700; color: #64748b; letter-spacing: .08em; margin-bottom: 4px; }
.pp-client-name { font-weight: 700; font-size: 14.7px; overflow-wrap: anywhere; }
.pp-recibo { font-size: 14.7px; line-height: 1.6; margin: 0 0 18px; }
.pp-items { width: 100%; border-collapse: collapse; }
.pp-items th { background: var(--accent); color: #fff; font-size: 11.3px; font-weight: 700; text-align: left; padding: 8px 10.5px; }
.pp-items td { padding: 8px 10.5px; vertical-align: top; overflow-wrap: anywhere; }
.pp-items tbody tr:nth-child(even) td { background: #f4f6fa; }
.pp-items .r { text-align: right; white-space: nowrap; }
.pp-items th:nth-child(2), .pp-items td:nth-child(2) { width: 64px; }
.pp-items th:nth-child(3), .pp-items td:nth-child(3) { width: 75px; }
.pp-items th:nth-child(4), .pp-items td:nth-child(4) { width: 112px; }
.pp-items th:nth-child(5), .pp-items td:nth-child(5) { width: 117px; }
.pp-items tbody { border-bottom: 1px solid #e2e8f0; }
.pp-totals { width: 307px; margin: 14px 0 0 auto; }
.pp-tr { display: flex; justify-content: space-between; padding: 2px 0; font-size: 12.7px; }
.pp-tr span:first-child { color: #64748b; }
.pp-total { border-top: 1.3px solid var(--accent); margin-top: 4px; padding-top: 7px; font-size: 16.7px; font-weight: 700; color: var(--accent); }
.pp-total span:first-child { color: var(--accent); }
.pp-inc { text-align: right; font-size: 11px; color: #64748b; margin-top: 2px; }
.pp-words { font-style: italic; font-size: 11.7px; margin-top: 12px; }
.pp-pay { font-size: 12.7px; color: #64748b; margin-top: 14px; }
.pp-pay b { color: #111827; }
.pp-notes { margin-top: 20px; font-size: 12px; }
.pp-sign { display: flex; justify-content: space-between; margin-top: 56px; text-align: center; font-size: 11.7px; color: #64748b; }
.pp-sign.one { justify-content: center; }
.pp-sign > div { width: 253px; }
.pp-line { border-top: 1px solid #94a3b8; margin-bottom: 6px; }
.pp-sign small { display: block; font-size: 11.7px; font-weight: 700; color: #111827; margin-top: 3px; }
.pp-foot { margin-top: auto; padding-top: 28px; text-align: center; font-size: 10.4px; color: #94a3b8; }

/* ── Contenido (SEO) ──────────────────────────────────────────────────────── */
.content { max-width: 860px; margin: 48px auto 0; }
.content h2 { font-size: clamp(22px, 3vw, 28px); margin: 44px 0 12px; }
.content h3 { font-size: 18px; margin: 24px 0 8px; }
.content p, .content li { color: var(--ink-2); line-height: 1.7; }
.content li { margin: 4px 0; }
.lead { font-size: 18px; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 14px 58px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.feature b { display: block; margin-bottom: 4px; }
.feature p { margin: 0; font-size: 15px; }
.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; list-style: none; padding: 0; }
.links a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.links a:hover { border-color: var(--brand); color: var(--brand); }
.links small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; margin: 8px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 10px 0 2px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); font-size: 15px; }
.tbl th, .tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--brand-50); font-size: 13.5px; color: var(--ink-2); }
.tbl tr:last-child td { border-bottom: 0; }
.note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 12px 14px; color: #78350f; font-size: 15px; }
.quote { border-left: 4px solid var(--brand); background: #fff; padding: 12px 16px; border-radius: 0 12px 12px 0; color: var(--ink-2); }
.cta-box { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #7c3aed)); color: #fff; border-radius: 18px; padding: 24px; margin: 40px 0; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.cta-box p { color: #e0e7ff; margin: 4px 0 0; }
.cta-box h2 { margin: 0; color: #fff; font-size: 22px; }
.cta-box .btn { background: #fff; color: var(--brand); }

/* ── Anuncios (AdSense) ───────────────────────────────────────────────────── */
/* Espacio reservado para que la página no «salte» al cargar el anuncio; si Google no tiene
   anuncio que mostrar, el espacio se oculta completo. */
.ad { max-width: 860px; margin: 36px auto; min-height: 120px; text-align: center; }
.ad-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.ad--demo::after { content: "Espacio para anuncio · se llena con Google AdSense cuando publiques el sitio"; display: flex; align-items: center; justify-content: center; min-height: 160px; padding: 12px; border: 2px dashed #cbd5e1; border-radius: 14px; color: var(--muted); font-size: 14px; background: repeating-linear-gradient(45deg, #f8fafc 0 10px, #f1f5f9 10px 20px); }
.is-pro .ad { display: none; }

/* ── Herramientas ─────────────────────────────────────────────────────────── */
.tool { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--sh); max-width: 860px; margin: 0 auto; }
.tool .grid3 { margin-bottom: 14px; }
.tool-out { background: var(--brand-50); border-radius: 14px; padding: 18px; font-size: 20px; font-weight: 700; line-height: 1.45; color: var(--ink); min-height: 64px; overflow-wrap: anywhere; }
.tool-out.muted { color: var(--muted); font-weight: 500; }
.tool-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label { display: flex; align-items: center; gap: 6px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 15px; }
.radios input { width: auto; }
.radios label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.iva-res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.iva-res div { background: var(--brand-50); border-radius: 12px; padding: 12px 14px; }
.iva-res span { display: block; font-size: 13px; color: var(--muted); font-weight: 650; }
.iva-res b { font-size: 21px; }
.iva-res .tot { background: var(--brand); color: #fff; }
.iva-res .tot span { color: #e0e7ff; }
.iva-res small { display: block; margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--muted); }
.iva-res .tot small { color: #e0e7ff; }
#mg-warn { margin-top: 12px; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink-2); font-size: 14.5px; margin-top: 10px; }

/* ── Pro ──────────────────────────────────────────────────────────────────── */
.checks { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; gap: 7px; }
.checks li { padding-left: 28px; position: relative; color: var(--ink-2); }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-weight: 800; font-size: 12px; display: grid; place-items: center; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 6px 0 16px; }
.plan { position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.plan--feat { border: 2px solid var(--brand); box-shadow: var(--sh); }
.plan-tag { position: absolute; top: -11px; left: 16px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 10px; }
.plan-name { font-weight: 700; color: var(--ink-2); }
.plan-price { font-size: 28px; font-weight: 850; }
.plan-price small { font-size: 14px; color: var(--muted); font-weight: 600; }
.lic { display: grid; gap: 10px; }
.lic-msg { margin: 0; min-height: 1.4em; font-weight: 600; color: var(--ink-2); }
.pro-active { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.pro-active .big { font-size: 19px; font-weight: 700; margin-top: 0; }
.pro-active .btn { margin: 6px 6px 0 0; }

/* ── Modal y toast ────────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 100; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { position: relative; background: #fff; border-radius: 18px; padding: 24px 22px 20px; width: min(100%, 560px); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal h2 { margin: 0 0 6px; font-size: 22px; padding-right: 30px; }
.modal-x { position: absolute; top: 12px; right: 12px; border: 0; background: #f1f5f9; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; font-size: 15px; }
.modal-reason { background: var(--brand-50); color: var(--brand-d); border-radius: 10px; padding: 9px 12px; font-weight: 600; margin: 10px 0 0; }
.modal--docs { width: min(100%, 660px); }
.doc-search { margin: 10px 0; }
.doclist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.doclist li { display: flex; gap: 6px; align-items: stretch; }
.doclist li.cur .doc-open { border-color: var(--brand); }
.doc-open { flex: 1; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 9px 12px; cursor: pointer; font: inherit; display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: baseline; }
.doc-open:hover { border-color: var(--brand); }
.doc-open span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-open .doc-total { font-weight: 700; color: var(--ink); }
.doc-open small { grid-column: 1 / -1; color: var(--muted); }
.doc-acts { display: flex; gap: 6px; }
.doc-acts button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 0 10px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.doc-acts button:hover { border-color: var(--brand); color: var(--brand); }
.doc-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.doc-foot .btn { padding: 9px 12px; font-size: 14px; }
.upsell { background: var(--brand-50); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }
.link-box { width: 100%; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; z-index: 200; transition: transform .25s ease; max-width: calc(100vw - 32px); box-shadow: 0 12px 30px rgba(0, 0, 0, .25); }
.toast.show { transform: translate(-50%, 0); }

/* ── Visor de documentos compartidos ──────────────────────────────────────── */
.viewer { max-width: 900px; margin: 20px auto 0; }
.vw-top { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; box-shadow: var(--sh); }
.vw-from { display: flex; align-items: center; gap: 12px; }
.vw-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-weight: 800; font-size: 19px; display: grid; place-items: center; flex: 0 0 auto; }
.vw-from h1 { color: var(--muted); font-size: 14px; font-weight: 500; margin: 0; line-height: 1.35; letter-spacing: 0; }
.vw-total { font-size: 24px; font-weight: 850; }
.vw-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.vw-acts .btn { padding: 10px 14px; font-size: 15px; }
.vw-cta { margin: 18px 0 0; background: #fff; border: 2px solid var(--brand); border-radius: 16px; padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.vw-error { text-align: center; padding: 60px 0; }

/* ── Impresión ────────────────────────────────────────────────────────────── */
#print-root { display: none; }
@media print {
  @page { size: auto; margin: 0; }
  body { background: #fff; }
  body > :not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .paper { width: 100%; min-height: auto; box-shadow: none; transform: none !important; }
  .paper { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Responsivo ───────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  /* minmax(0, …): sin él, un texto largo que no se parte (como la pista de «Tu negocio») ensancha la columna
     y en el celular el editor se sale de la pantalla. */
  .gen { grid-template-columns: minmax(0, 1fr); }
  .gen-prev { display: none; }
  body.show-prev .gen-prev { display: block; position: fixed; inset: 0; z-index: 60; background: #e2e8f0; overflow-y: auto; padding: 0 10px 90px; }
  body.show-prev .prev-bar { position: sticky; top: 0; background: #e2e8f0; padding: 10px 2px; margin: 0; z-index: 2; color: var(--ink); }
  body.show-prev .prev-close { display: inline-block; border: 1px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 7px 12px; font: inherit; font-weight: 700; cursor: pointer; }
  .mbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); transition: transform .2s ease, visibility .2s; }
  /* Con los botones del editor a la vista (o ya pasados) la barra se esconde: no tapa el contenido ni queda junto a un anuncio. */
  body.mbar-off:not(.show-prev) .mbar { transform: translateY(110%); visibility: hidden; }
  .mbar > * { border: 1px solid #cbd5e1; background: #fff; border-radius: 12px; padding: 11px 6px; font: inherit; font-weight: 750; font-size: 15px; cursor: pointer; color: var(--ink); text-align: center; text-decoration: none; }
  .mbar .mbar-pdf { background: var(--brand); border-color: var(--brand); color: #fff; }
  .mbar .mbar-wa { background: var(--wa); border-color: var(--wa); color: #fff; }
  body:has(.mbar) { padding-bottom: 76px; }
  .foot-in { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 12px 12px; flex-direction: column; align-items: stretch; box-shadow: var(--sh); }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; font-size: 16px; }
}
@media (max-width: 560px) {
  main { padding: 0 12px; }
  .hero { padding: 22px 0 14px; }
  .card { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  .it-row { grid-template-columns: 62px 1fr 1fr 36px; }
  .it-tot { grid-column: 1 / -2; grid-row: 2; flex-direction: row; justify-content: space-between; align-items: baseline; text-align: left; }
  .it-tot b { padding: 0; }
  .it-del { grid-column: 4; grid-row: 1; }
  .actions { grid-template-columns: 1fr 1fr; }
  .iva-res { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr; }
  .vw-acts .btn { flex: 1 1 auto; }
}
