/* =========================================================
   Presupuestá — estilos
   ========================================================= */

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f6f8;
  --bg2: #eceef2;
  --panel: #ffffff;
  --ink: #141823;
  --ink2: #444b5a;
  --muted: #6b7280;
  --line: #e2e5eb;
  --line2: #d3d7df;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --accent-soft: #eaf0ff;
  --accent-text: #2448c4;
  --good: #0f9d76;
  --bad: #d92d20;
  --bad-soft: #fff1f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .16);
  --page-shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 12px 32px rgba(16, 24, 40, .12);
  --preview-bg: #e4e7ec;
  --r: 14px;
  --r-sm: 9px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017; --bg2: #151923; --panel: #141923; --ink: #eef0f5; --ink2: #c3c8d4; --muted: #8a92a3;
    --line: #232a37; --line2: #2f3746; --accent: #6b8cff; --accent-ink: #0b1020; --accent-soft: #1a2342; --accent-text: #9db2ff;
    --bad: #ff6b5e; --bad-soft: #2a1513; --preview-bg: #0a0d13;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
    --page-shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1017; --bg2: #151923; --panel: #141923; --ink: #eef0f5; --ink2: #c3c8d4; --muted: #8a92a3;
  --line: #232a37; --line2: #2f3746; --accent: #6b8cff; --accent-ink: #0b1020; --accent-soft: #1a2342; --accent-text: #9db2ff;
  --bad: #ff6b5e; --bad-soft: #2a1513; --preview-bg: #0a0d13;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --page-shadow: 0 2px 6px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

*, *::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; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 24px; } }

/* ---------- barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar__in { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 17px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand__mark { width: 28px; height: 28px; color: var(--accent); }
.topnav { margin-left: auto; display: flex; gap: 4px; }
.topnav a { color: var(--ink2); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.topnav a:hover { background: var(--bg2); color: var(--ink); }
.topnav a { white-space: nowrap; }
@media (max-width: 880px) { .topnav { display: none; } .coffee-btn { margin-left: auto; } }

/* ---------- cafecito ---------- */
:root { --coffee: #b85a1f; --coffee-ink: #fff; --coffee-soft: #fff3e6; --coffee-text: #8a3f12; --coffee-line: #f3d6bb; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --coffee: #f0a05f; --coffee-ink: #1d1006; --coffee-soft: #2a1a0f; --coffee-text: #f6bb85; --coffee-line: #4a2e19; } }
:root[data-theme="dark"] { --coffee: #f0a05f; --coffee-ink: #1d1006; --coffee-soft: #2a1a0f; --coffee-text: #f6bb85; --coffee-line: #4a2e19; }
.coffee-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: 99px; background: var(--coffee-soft); border: 1px solid var(--coffee-line); color: var(--coffee-text); font-weight: 650; font-size: 14px; text-decoration: none; white-space: nowrap; transition: background .15s, transform .15s; }
.coffee-btn:hover { background: color-mix(in srgb, var(--coffee-soft) 75%, var(--coffee)); }
.coffee-btn svg, .btn--coffee svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) { .coffee-btn { width: 38px; padding: 0; justify-content: center; } .coffee-btn span { display: none; } }
.btn--coffee { background: var(--coffee); color: var(--coffee-ink); text-decoration: none; }
.btn--coffee:hover { background: color-mix(in srgb, var(--coffee) 88%, #000); }
.support { display: flex; align-items: center; gap: 20px 24px; padding: 26px; border-radius: 20px; background: var(--coffee-soft); border: 1px solid var(--coffee-line); }
.support__icon { flex: none; width: 64px; height: 64px; display: grid; place-items: center; font-size: 34px; border-radius: 18px; background: var(--panel); border: 1px solid var(--coffee-line); }
.support__text { flex: 1; min-width: 0; }
.support h2 { font-size: clamp(21px, 2.3vw, 26px); }
.support p { margin: 8px 0 0; color: var(--ink2); max-width: 720px; }
.support .btn { height: 48px; padding: 0 22px; font-size: 15.5px; flex: none; }
@media (max-width: 760px) { .support { flex-direction: column; align-items: flex-start; padding: 20px; } .support .btn { width: 100%; } }
.coffee-card { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--coffee-soft); border: 1px solid var(--coffee-line); }
.coffee-card p { margin: 0 0 10px !important; font-size: 14.5px; }
.coffee-card b { color: var(--ink); }
.coffee-card .btn { width: 100%; }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--ink2); }
.icon-btn:hover { color: var(--ink); border-color: var(--line2); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn--sm svg { width: 16px; height: 16px; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.15); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn--ghost { background: var(--panel); border-color: var(--line2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--muted); }
.btn--soft { background: var(--accent-soft); color: var(--accent-text); }
.btn--soft:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent)); }
.btn--icon { width: 42px; padding: 0; }
.btn--add { width: 100%; margin-top: 10px; background: transparent; border: 1.5px dashed var(--line2); color: var(--accent-text); }
.btn--add:hover { border-color: var(--accent); background: var(--accent-soft); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 16px; }
.hero h1 { font-size: clamp(25px, 3.4vw, 36px); font-weight: 780; }
.hero__sub { margin: 6px 0 0; color: var(--ink2); max-width: 640px; font-size: 15.5px; }
.hero__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .hero { padding-top: 14px; padding-bottom: 12px; }
  .hero__sub { font-size: 14.5px; }
  .hero__actions { width: 100%; }
  .hero__actions .btn { flex: 1; height: 40px; padding: 0 10px; font-size: 13.5px; }
}
.noscript { padding: 16px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad); }

/* ---------- app ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 24px; }
@media (min-width: 1200px) { .app { grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); } }

.mobile-tabs { display: none; }
.mobile-bar { display: none; }

@media (max-width: 999px) {
  .app { grid-template-columns: 1fr; padding-bottom: 96px; }
  .mobile-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: var(--bg2); border-radius: 12px; position: sticky; top: 64px; z-index: 15; width: calc(100% - 32px); }
  .mobile-tabs button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--ink2); cursor: pointer; }
  .mobile-tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
  .app[data-view="edit"] .side { display: none; }
  .app[data-view="preview"] .editor { display: none; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .mobile-bar small { display: block; color: var(--muted); font-size: 12px; line-height: 1.2; }
  .mobile-bar strong { font-size: 18px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
  .side .actions { display: none; }
}
@media (min-width: 640px) and (max-width: 999px) { .mobile-tabs { width: calc(100% - 48px); } }

/* ---------- tarjetas del formulario ---------- */
.editor { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; user-select: none; }
.card > summary::-webkit-details-marker { display: none; }
.card__n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13px; }
.card__t { font-weight: 650; font-size: 15.5px; display: flex; flex-direction: column; line-height: 1.25; }
.card__t small { font-weight: 450; color: var(--muted); font-size: 12.5px; }
.chev { margin-left: auto; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s; }
.card[open] .chev { transform: rotate(180deg); }
.card__body { padding: 2px 16px 16px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .grid--3 { grid-template-columns: 1fr 1fr; }
  .span2, .span3 { grid-column: 1 / -1; }
}

.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f > span { font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.f em, .taxes em { font-style: normal; font-weight: 450; color: var(--muted); }
input:not([type=checkbox]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: var(--panel); color: var(--ink);
  font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type="date"] { padding-right: 6px; }
.is-bad, .is-bad:hover, .is-bad:focus { border-color: var(--bad) !important; background: var(--bad-soft) !important; }

.pair { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 6px; }

/* logo */
.logo-field { display: flex; align-items: center; gap: 14px; }
.logo-drop { display: grid; place-items: center; min-width: 168px; height: 72px; padding: 6px 12px; border: 1.5px dashed var(--line2); border-radius: 12px; cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; }
.logo-drop:hover, .logo-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.logo-drop img { max-height: 58px; max-width: 180px; object-fit: contain; }
.logo-drop__ph { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.logo-drop__ph b { color: var(--ink); font-weight: 600; font-size: 13.5px; }
.logo-drop__ph svg { width: 26px; height: 26px; fill: none; stroke: var(--muted); stroke-width: 1.6; }

/* ---------- líneas ---------- */
.items-head { display: none; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: it; }
.item {
  display: grid; gap: 8px 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.25fr) minmax(0, .75fr) minmax(0, 1.2fr) auto;
  grid-template-areas: "desc desc desc desc acts" "qty price disc total acts";
  position: relative;
}
.item__desc { grid-area: desc; }
.item__desc textarea { min-height: 40px; resize: none; overflow: hidden; background: var(--panel); }
.item__f:nth-of-type(2) { grid-area: qty; }
.item__f:nth-of-type(3) { grid-area: price; }
.item__f:nth-of-type(4) { grid-area: disc; }
.item__f, .item__total { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item__f span, .item__total span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item__f input { text-align: right; font-variant-numeric: tabular-nums; background: var(--panel); }
.item__total { grid-area: total; align-items: flex-end; }
.item__total output { height: 40px; display: flex; align-items: center; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px; white-space: nowrap; }
.item__acts { grid-area: acts; display: flex; flex-direction: column; gap: 2px; }
.item__acts button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; color: var(--muted); cursor: pointer; }
.item__acts button:hover:not(:disabled) { background: var(--panel); color: var(--ink); }
.item__acts button[data-a="del"]:hover { color: var(--bad); }
.item__acts button:disabled { opacity: .3; cursor: default; }
.item__acts svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) {
  .item { grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr) minmax(0, .8fr); grid-template-areas: "desc desc desc" "qty price disc" "total total total" "acts acts acts"; }
  .item__total { flex-direction: row; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line2); padding-top: 4px; }
  .item__total output { height: 30px; }
  .item__acts { flex-direction: row; justify-content: flex-end; margin-top: -6px; }
}

/* impuestos */
.taxes { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.taxes__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.taxes__head strong { font-size: 14px; font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel); font-size: 13px; font-weight: 550; color: var(--ink2); cursor: pointer; }
.chips button:hover { border-color: var(--accent); color: var(--accent-text); }
.tax-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tax-list li { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(90px, auto) 32px; gap: 8px; align-items: center; }
.tax__rate { position: relative; }
.tax__rate input { text-align: right; padding-right: 26px; }
.tax__rate i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 14px; }
.tax-list output { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* resumen */
.sum { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.sum div { display: flex; justify-content: space-between; gap: 12px; }
.sum dt { color: var(--ink2); font-size: 14px; }
.sum dd { margin: 0; font-weight: 550; }
.sum .sum__total { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line2); }
.sum .sum__total dt { color: var(--ink); font-weight: 700; font-size: 15px; }
.sum .sum__total dd { font-weight: 780; font-size: 19px; letter-spacing: -.01em; }

/* extras */
.extras { display: flex; flex-direction: column; gap: 4px; }
.extra { padding: 6px 0; }
.extra > textarea, .extra__body { display: none; margin-top: 8px; }
.extra.is-on > textarea { display: block; }
.extra.is-on .extra__body { display: flex; flex-direction: column; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 550; font-size: 14.5px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 36px; height: 21px; border-radius: 99px; background: var(--line2); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.privacy { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 0; padding: 12px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--good) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--good) 25%, var(--line)); font-size: 13.5px; color: var(--ink2); }
.privacy svg { width: 20px; height: 20px; fill: none; stroke: var(--good); stroke-width: 1.9; margin-top: 1px; }
.privacy b { color: var(--ink); }
.saved { color: var(--good); font-weight: 550; }

/* ---------- lado derecho: diseño + vista previa ---------- */
.side { min-width: 0; }
.side__sticky { position: sticky; top: 68px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 999px) { .side__sticky { position: static; } }
.design { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.design__row { display: flex; align-items: center; gap: 12px; }
.design__label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 48px; flex: none; }
.tpls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; flex: 1; }
.tpls button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 5px 4px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; }
.tpls button:hover { border-color: var(--line2); }
.tpls button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tpl__img { width: 100%; aspect-ratio: 210 / 140; overflow: hidden; border-radius: 5px; background: #fff; border: 1px solid var(--line); display: block; }
.tpl__img svg { width: 100%; height: auto; display: block; }
.tpl__name { font-size: 12px; font-weight: 600; color: var(--ink2); }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatches button, .swatch-custom { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; position: relative; }
.swatches button[aria-checked="true"], .swatch-custom.is-on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.swatch-custom { display: grid; place-items: center; border: 1.5px dashed var(--line2); background: var(--c, transparent); color: var(--muted); font-weight: 600; }
.swatch-custom.is-on span { color: #fff; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.preview { background: var(--preview-bg); border-radius: var(--r); padding: 16px; max-height: calc(100vh - 290px); min-height: 360px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); }
@media (max-width: 999px) { .preview { max-height: none; padding: 12px; } }
.pages { display: flex; flex-direction: column; gap: 16px; max-width: 640px; margin: 0 auto; }
.page { position: relative; background: #fff; box-shadow: var(--page-shadow); border-radius: 2px; }
.page svg { display: block; width: 100%; height: auto; }
.page::after { content: attr(data-label); position: absolute; right: 0; bottom: -15px; font-size: 10.5px; color: var(--muted); }
.pages .page:only-child::after { content: none; }

.actions { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 10px 10px 16px; box-shadow: var(--shadow); }
.actions__total { margin-right: auto; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.actions__total span { font-size: 12px; color: var(--muted); }
.actions__total strong { font-size: 20px; letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions .btn--primary { height: 46px; padding: 0 20px; font-size: 15.5px; }

/* ---------- espacios publicitarios ---------- */
.ad-slot { display: grid; place-items: center; border: 1.5px dashed var(--line2); border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .14em; background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--line) 40%, transparent) 10px 20px); }
.ad-slot--banner { min-height: 100px; margin: 8px 0 8px; }
.ad-slot--inline { min-height: 250px; max-width: 970px; margin: 8px auto; }
.ad-slot--modal { min-height: 200px; margin: 14px 0; }
.ad-slot--toast { min-height: 100px; width: 100%; }
@media (min-width: 768px) { .ad-slot--banner { min-height: 90px; } }

.ad-toast { position: fixed; right: 16px; bottom: 16px; z-index: 30; width: 300px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 26px 10px 10px; transform: translateY(16px); opacity: 0; transition: transform .25s, opacity .25s; }
.ad-toast.is-in { transform: none; opacity: 1; }
.ad-toast__x { position: absolute; top: 3px; right: 4px; width: 28px; height: 24px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 6px; }
.ad-toast__x:hover { color: var(--ink); background: var(--bg2); }
@media (max-width: 999px) { .ad-toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }

/* ---------- diálogos ---------- */
.modal { border: 0; padding: 0; background: transparent; max-width: min(460px, calc(100vw - 32px)); width: 100%; color: var(--ink); }
.modal::backdrop { background: rgba(10, 13, 20, .55); backdrop-filter: blur(2px); }
.modal__box { max-height: calc(100dvh - 32px); overflow-y: auto; position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-lg); margin: 0; }
.modal__box h2 { font-size: 19px; margin-right: 28px; }
.modal__box p { color: var(--ink2); margin: 8px 0 0; }
.modal__x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--bg2); font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink2); }
.modal__x:hover { color: var(--ink); }
.modal__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; justify-content: flex-end; }
@media (max-width: 480px) { .modal__actions .btn { flex: 1 1 100%; } }
.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 12px); opacity: 0; transition: transform .2s, opacity .2s; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); text-align: center; }
.toast.is-in { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 999px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }

/* ---------- contenido ---------- */
.section { padding-top: 48px; padding-bottom: 16px; }
.section h2 { font-size: clamp(23px, 2.6vw, 30px); font-weight: 760; }
.section__lead { color: var(--ink2); margin: 8px 0 22px; font-size: 16px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.steps li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.steps__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 14px; }
.steps__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.steps h3 { font-size: 17px; margin-bottom: 6px; }
.steps p { margin: 0; color: var(--ink2); font-size: 14.5px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ex { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.ex__tag { align-self: flex-start; font-size: 11.5px; font-weight: 650; color: var(--accent-text); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px; }
.ex h3 { font-size: 16px; }
.ex p { margin: 0 0 6px; color: var(--ink2); font-size: 14px; flex: 1; }
.ex .link-btn { align-self: flex-start; }

.prose { max-width: 820px; }
.prose h3 { font-size: 19px; margin: 26px 0 6px; }
.prose p, .prose li { color: var(--ink2); font-size: 15.5px; line-height: 1.7; }
.prose strong, .prose b { color: var(--ink); font-weight: 650; }
.prose ul { padding-left: 20px; }

.faq { display: flex; flex-direction: column; gap: 8px; max-width: 820px; margin-top: 18px; }
.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.faq summary { padding: 14px 44px 14px 16px; font-weight: 600; cursor: pointer; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 16px 16px; color: var(--ink2); }

.footer { margin-top: 56px; border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--muted); font-size: 14px; }
@media (max-width: 999px) { .footer { padding-bottom: 110px; } }
.footer__in { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.footer p { margin: 0; }
.footer nav { display: flex; gap: 16px; }
.footer a { color: var(--ink2); }

#print-root { display: none; }

/* ---------- impresión: solo las hojas A4 ---------- */
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .print-page { width: 210mm; height: 297mm; overflow: hidden; break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-page svg { width: 210mm; height: 297mm; display: block; }
}
