/* ProformasEC · «la hoja que se llena sola»
   Base común de la familia Utiliec (gris oficina, papel blanco) con color propio: uva.
   Tipografías alojadas en el sitio (licencia OFL, ver fonts/). */
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --office: #eef1f4;
  --paper: #ffffff;
  --ink: #1d2125;
  --muted: #5b626c;
  --rule: #d6dbe2;
  --rule-soft: #e7eaee;
  --brand: #5b3a8e;        /* uva de marca */
  --brand-ink: #ffffff;
  --brand-soft: #efe9f8;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --office: #14171b; --paper: #1d2126; --ink: #e8eaed; --muted: #a3aab4; --rule: #343b45; --rule-soft: #2a3038;
    --brand: #c4a8f0; --brand-ink: #1c1030; --brand-soft: #2b2340; --bad: #ff9b92; --bad-soft: #3a1a17; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--sans); font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--office); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--paper); z-index: 99; border-radius: 6px; font-weight: 700; }
.skip-link:focus-visible { top: 1rem; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); }

/* ---------- Cabecera ---------- */
.top { background: var(--paper); border-bottom: 1px solid var(--rule); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.top nav a { padding: 6px 12px; font-size: .95rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }
@media (max-width: 640px) { .top nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -6px; } .top nav a { white-space: nowrap; } }

.hero { padding: 26px 0 16px; }
.hero h1 { font-size: clamp(1.6rem, 3vw + .7rem, 2.4rem); font-weight: 700; letter-spacing: -.015em; max-width: 26ch; }
.sub { color: var(--muted); margin-top: 8px; max-width: 66ch; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; min-height: 44px; border-radius: 6px; font-weight: 600; font-size: .95rem; border: 1px solid var(--rule); background: var(--paper); text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* ---------- Herramienta: formulario + hoja ---------- */
.estudio { display: grid; gap: 18px; align-items: start; }
@media (min-width: 1000px) { .estudio { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 26px; } .vista { position: sticky; top: 14px; } }
.form { display: grid; gap: 14px; min-width: 0; }
.cargar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 12px 14px; border-radius: 10px; background: var(--brand-soft); font-size: .93rem; }
.cargar p { flex: 1 1 260px; }
.cargar-acc { display: flex; gap: 8px; flex-wrap: wrap; }
.bloque { border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); padding: 16px 16px 18px; min-width: 0; }
.bloque legend { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; padding: 0 6px; margin-left: -6px; }
.bloque legend .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--brand); color: var(--brand); font-size: .85rem; }
.fila { margin-bottom: 12px; }
.grid { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.g4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.fld { display: grid; gap: 4px; align-content: start; min-width: 0; }
.fld.ancho { grid-column: 1 / -1; }
.fld > span { font-weight: 600; font-size: .9rem; }
.fld small { color: var(--muted); font-size: .8rem; }
.fld input, .fld textarea, .ln select, .ln input { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: .95rem; }
.fld textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.fld input:focus, .fld textarea:focus, .ln input:focus, .ln select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.bloque .chk { margin: 2px 0 12px; }
.bloque .chk + .colores, .fld + .chk { margin-top: 12px; }

/* Logo */
.logo-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 14px; }
.logo-caja { width: 132px; height: 72px; border: 1.5px dashed var(--rule); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; overflow: hidden; background: #fff; }
.logo-caja.con { border-style: solid; }
.logo-caja img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.logo-acc small { flex-basis: 100%; color: var(--muted); font-size: .8rem; }

/* Líneas de detalle */
.lineas { display: grid; gap: 10px; }
.ln { border: 1px solid var(--rule-soft); border-left: 3px solid var(--brand); border-radius: 8px; padding: 10px; display: grid; gap: 8px; background: color-mix(in srgb, var(--brand) 3%, var(--paper)); }
.ln-a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.ln-b { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; }
.ln label { display: grid; gap: 3px; min-width: 0; }
.ln label > span { font-size: .75rem; font-weight: 600; color: var(--muted); }
.ln input, .ln select { min-height: 38px; padding: 6px 8px; font-size: .92rem; }
.ln input.num { font-family: var(--mono); text-align: right; font-size: .88rem; }
.ln .tot { font-family: var(--mono); font-size: .9rem; font-weight: 600; text-align: right; padding: 8px 2px; white-space: nowrap; }
.ln .quitar { width: 38px; height: 38px; border-radius: 6px; border: 1px solid var(--rule); display: grid; place-items: center; color: var(--muted); }
.ln .quitar:hover { color: var(--bad); border-color: var(--bad); }
@media (max-width: 560px) { .ln-b { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.agregar { margin-top: 10px; border-style: dashed; color: var(--brand); }

/* Color del documento */
.colores { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.colores > span { font-weight: 600; font-size: .9rem; }
.sws { display: flex; gap: 8px; }
.sw { cursor: pointer; }
.sw input { position: absolute; opacity: 0; pointer-events: none; }
.sw span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--sw); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--rule); }
.sw input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.sw input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* La hoja (elemento propio): vista previa con proporción A4 */
.vista-in { display: grid; gap: 12px; }
.hoja-marco { container-type: inline-size; padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 9%, var(--office)); }
.hoja { --c: #5b3a8e; --cs: #efe9f8; position: relative; aspect-ratio: 210 / 297; background: #fff; color: #1d2125; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 12px 32px rgba(29, 33, 37, .16);
  padding: 6cqw 6.5cqw 5cqw; font-size: 1.75cqw; line-height: 1.35; overflow: hidden; display: flex; flex-direction: column; gap: 2.4cqw; }
.hoja-vacia { margin: auto; color: #8a919b; font-size: 2.6cqw; text-align: center; max-width: 30ch; }
.h-top { display: flex; justify-content: space-between; gap: 3cqw; align-items: flex-start; }
.h-emisor { display: flex; gap: 2.4cqw; align-items: flex-start; min-width: 0; }
.h-logo { max-width: 18cqw; max-height: 10cqw; object-fit: contain; }
.h-emisor b { display: block; font-size: 2.3cqw; }
.h-emisor span { display: block; color: #5b626c; overflow-wrap: anywhere; }
.h-doc { text-align: right; flex: none; }
.h-doc .h-tipo { font-size: 3.6cqw; font-weight: 700; color: var(--c); letter-spacing: .02em; text-transform: uppercase; line-height: 1.1; }
.h-doc span { display: block; color: #5b626c; }
.h-doc strong { color: #1d2125; }
.h-cli { border: 1px solid #dfe3e8; border-left: .8cqw solid var(--c); border-radius: .6cqw; padding: 1.6cqw 2cqw; display: grid; grid-template-columns: 1fr 1fr; gap: .4cqw 3cqw; }
.h-cli .t { grid-column: 1 / -1; font-size: 1.45cqw; text-transform: uppercase; letter-spacing: .06em; color: #5b626c; }
.h-cli b { grid-column: 1 / -1; font-size: 2.05cqw; }
.h-tabla { width: 100%; border-collapse: collapse; }
.h-tabla th { background: var(--cs); color: var(--c); font-weight: 700; padding: .9cqw 1cqw; text-align: left; border-bottom: .3cqw solid var(--c); }
.h-tabla td { padding: .9cqw 1cqw; border-bottom: 1px solid #e7eaee; vertical-align: top; }
.h-tabla .r { text-align: right; white-space: nowrap; }
.h-tabla small { display: block; color: #8a919b; }
.h-fin { display: flex; justify-content: space-between; gap: 3cqw; align-items: flex-start; }
.h-cond { flex: 1; min-width: 0; color: #3b424b; }
.h-cond p { margin-bottom: .6cqw; overflow-wrap: anywhere; white-space: pre-line; }
.h-cond b { color: #1d2125; }
.h-tot { width: 40%; flex: none; border-collapse: collapse; }
.h-tot td { padding: .55cqw 1cqw; }
.h-tot td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-tot tr.total td { background: var(--c); color: #fff; font-weight: 700; font-size: 2.1cqw; padding: 1cqw; }
.h-firma { display: grid; grid-template-columns: 1fr 1fr; gap: 8cqw; margin-top: auto; padding-top: 6cqw; text-align: center; color: #5b626c; }
.h-firma span { border-top: 1px solid #8a919b; padding-top: .8cqw; }
.h-pie { margin-top: auto; border-top: 1px solid #e7eaee; padding-top: 1.2cqw; font-size: 1.35cqw; color: #8a919b; display: flex; justify-content: space-between; gap: 2cqw; }
.h-firma + .h-pie { margin-top: 3cqw; }
.h-mas { color: #8a919b; font-style: italic; }

.acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.acciones .btn.primary { flex: 1 1 200px; min-height: 48px; font-size: 1rem; }
.guardar { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
.guardar .btn { justify-self: start; }
.guardar p { font-size: .84rem; color: var(--muted); }

.barra-movil { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--paper); border-top: 1px solid var(--rule); box-shadow: 0 -4px 18px rgba(29,33,37,.12); }
.barra-movil strong { font-family: var(--mono); font-size: 1.05rem; }
@media (max-width: 999px) { .barra-movil.on { display: flex; } }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg label + label { border-left: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; font-size: .93rem; color: var(--muted); }
.seg input:checked + span { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -3px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Tablas */
.tbl { overflow-x: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 72%, var(--ink)); font-weight: 700; text-align: center; white-space: nowrap; border-bottom: 2px solid var(--brand); }
.tbl td.n { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: .84rem; font-variant-numeric: tabular-nums; }
.tbl td.nw { white-space: nowrap; }
.tbl td.fuerte { font-weight: 600; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--ink); background: color-mix(in srgb, var(--brand) 6%, var(--paper)); }
.tbl small { display: block; font-size: .78rem; }
.badge { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; font-size: .92rem; }
.badge svg { flex: none; margin-top: 4px; color: var(--brand); }
.limits { margin-top: 6px; font-size: .88rem; color: var(--muted); max-width: 88ch; }

.ad-slot { min-height: 90px; margin: 30px 0; border: 1px dashed var(--rule); border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }


/* ---------- Contenido ---------- */
.prose { padding: 8px 0; width: min(70ch, 100% - 32px); margin-inline: auto; }
.prose h2 { font-size: 1.45rem; margin: 30px 0 10px; }
.prose h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.prose p, .prose li { margin-bottom: 10px; }
.prose ol, .prose ul { padding-left: 22px; margin-bottom: 12px; }
.prose a { color: var(--brand); text-underline-offset: 3px; }
.prose .tbl { margin: 12px 0 18px; }
.prose .tbl table { font-size: .9rem; }
.prose .tbl.ancha table { min-width: 620px; }
.faq details { border-bottom: 1px solid var(--rule); padding: 13px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin-top: 8px; color: var(--muted); }
.legal { padding: 32px 0; }
.legal h1 { font-size: 2rem; margin-bottom: 16px; }
.descargas { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }

.more-sec { width: min(70ch, 100% - 32px); margin: 10px auto 40px; }
.more-h { font-size: 1.3rem; margin: 26px 0 8px; }
.more { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.more li { border-bottom: 1px solid var(--rule); }
.more a { display: grid; gap: 2px; padding: 12px 0; text-decoration: none; }
.more a strong { color: var(--brand); font-weight: 600; }
.more a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.more a span { color: var(--muted); font-size: .92rem; }

.foot { border-top: 1px solid var(--rule); background: var(--paper); padding: 26px 0 110px; color: var(--muted); font-size: .92rem; }
.foot .wrap { display: grid; gap: 10px; }
.foot-contact { color: var(--ink); font-weight: 600; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; padding: 0; }
.foot a { text-underline-offset: 3px; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 6px; font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--paper); border-top: 1px solid var(--rule); box-shadow: 0 -4px 24px rgba(31, 35, 40, .14); }
.cookie-bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 0; }
.cookie-bar p { flex: 1 1 320px; font-size: .9rem; color: var(--muted); }
.cookie-bar a { color: var(--ink); }
.cookie-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 560px) { .cookie-bar-inner { flex-direction: column; align-items: stretch; } .cookie-bar p { flex: 0 1 auto; } .cookie-actions { justify-content: flex-end; } }

@media (max-width: 640px) {
  .hero { padding-top: 18px; }
  .bloque { padding: 14px 12px 16px; }
  .hoja-marco { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print {
  .top, .hero, .badge, .limits, .ad-slot, .prose, .more-sec, .foot, .toast, .skip-link, .cookie-bar, .form, .acciones, .guardar, .barra-movil { display: none !important; }
  body { background: #fff; }
  .estudio { display: block; }
  .hoja-marco { padding: 0; background: none; }
  .hoja { box-shadow: none; }
}
