/* ComprobantesEC · «la clave de acceso, leída»
   Base común de la familia Utiliec (fondo gris oficina, papel blanco, tablas con encabezado negro)
   con color propio: ocre. 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: #7a5200;        /* ocre de marca */
  --brand-ink: #ffffff;
  --brand-soft: #f7efdf;   /* fila seleccionada */
  --ok: #1d6b3c;
  --ok-soft: #e4f3ea;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --seg-a: #f1e3c4;        /* tramos de la clave */
  --seg-b: #e3e8ee;
  --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: #e9b65a; --brand-ink: #1c1405; --brand-soft: #2f2714; --ok: #7fd1a0; --ok-soft: #173325; --bad: #ff9b92; --bad-soft: #3a1a17;
    --seg-a: #3d3218; --seg-b: #2b323b; }
}

*, *::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 { top: 1rem; }
.wrap { width: min(1160px, 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; letter-spacing: -.005em; }
.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; } }

/* ---------- Encabezado ---------- */
.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: 64ch; }

/* ---------- 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; }
.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 svg { flex: none; }
.btn[disabled] { opacity: .55; cursor: progress; }
.linklike { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }

/* ---------- Herramienta ---------- */
.tool { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; }
.drop { position: relative; display: grid; justify-items: center; text-align: center; gap: 10px; padding: 34px 20px 28px; border-radius: 10px; }
.drop::before { content: ""; position: absolute; inset: 10px; border: 1.5px dashed var(--rule); border-radius: 8px; pointer-events: none; transition: border-color .15s, background-color .15s; }
.drop.over::before { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.drop-ico { color: var(--brand); }
.drop-t { font-size: 1.2rem; font-weight: 600; }
.drop-s { color: var(--muted); font-size: .93rem; max-width: 46ch; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pegar { width: 100%; max-width: 640px; text-align: left; }
.pegar summary { cursor: pointer; color: var(--brand); font-weight: 500; font-size: .95rem; text-align: center; list-style: none; }
.pegar summary::-webkit-details-marker { display: none; }
.pegar textarea { width: 100%; min-height: 130px; margin-top: 10px; padding: 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: .82rem; resize: vertical; }
.pegar .btn { margin-top: 8px; }

/* Progreso */
.prog { padding: 0 20px 20px; }
.prog-t { font-size: .92rem; color: var(--muted); margin-bottom: 6px; }
.prog-bar { height: 6px; background: var(--rule-soft); border-radius: 3px; overflow: hidden; }
.prog-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }

/* Resultado: barra de acciones + lista + vista */
.res-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.res-sum { font-weight: 600; }
.res-sum small { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fallos { margin: 12px 16px 0; padding: 10px 14px; border-radius: 6px; background: var(--bad-soft); font-size: .9rem; }
.fallos summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.fallos ul { margin: 8px 0 2px; padding-left: 18px; }
.fallos li { margin-bottom: 4px; overflow-wrap: anywhere; }

.res-body { display: grid; grid-template-columns: 1fr; }
@media (min-width: 980px) { .res-body { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); } .lista-col { border-right: 1px solid var(--rule); } }
.lista-col { min-width: 0; }
.buscar { padding: 12px 16px 0; }
.buscar input { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: .95rem; }
.lista { list-style: none; padding: 8px 8px 12px; margin: 0; max-height: 640px; overflow-y: auto; }
@media (max-width: 979px) { .lista { max-height: 360px; } }
.lista li + li { border-top: 1px solid var(--rule-soft); }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; padding: 10px 10px; border-radius: 6px; }
.item:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.item[aria-current="true"] { background: var(--brand-soft); }
.item .i-tipo { font-size: .8rem; color: var(--muted); }
.item .i-tipo b { color: var(--ink); font-weight: 600; }
.item .i-num { font-family: var(--mono); font-size: .86rem; }
.item .i-emi { min-width: 0; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .i-tot { font-family: var(--mono); font-weight: 600; font-size: .95rem; text-align: right; font-variant-numeric: tabular-nums; }
.item .i-fecha { font-size: .82rem; color: var(--muted); text-align: right; }
.flag { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-left: 6px; vertical-align: middle; }
.lista-vacia { padding: 14px 16px; color: var(--muted); font-size: .92rem; }

/* Vista del comprobante */
.vista { min-width: 0; padding: 16px; display: grid; gap: 14px; align-content: start; }
.v-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.avisos { display: grid; gap: 6px; }
.avisos p { padding: 8px 12px; border-left: 3px solid var(--bad); background: var(--bad-soft); font-size: .9rem; border-radius: 0 6px 6px 0; }

/* La clave de acceso, leída (el elemento propio de esta web) */
.clave { border: 1px solid var(--rule); border-radius: 8px; padding: 14px 14px 12px; background: var(--paper); }
.clave-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.clave-h h2, .clave-h h3 { font-size: 1rem; font-weight: 600; }
.estado { font-size: .86rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; }
.estado.ok { background: var(--ok-soft); color: var(--ok); }
.estado.bad { background: var(--bad-soft); color: var(--bad); }
.regla { display: flex; flex-wrap: wrap; gap: 6px 3px; font-family: var(--mono); }
.tramo { display: grid; gap: 4px; align-content: start; border: 0; padding: 0; text-align: left; cursor: default; }
.tramo .dig { display: block; padding: 3px 4px 2px; border-radius: 3px; font-size: .95rem; letter-spacing: .02em; line-height: 1.3; background: var(--seg-b); font-variant-numeric: tabular-nums; }
.tramo:nth-child(odd) .dig { background: var(--seg-a); }
.tramo.mal .dig { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 -2px 0 var(--bad); }
.tramo.dv.bien .dig { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 -2px 0 var(--ok); }
.tramo .lab { font-family: var(--sans); font-size: .7rem; color: var(--muted); line-height: 1.25; max-width: 15ch; }
.tramo .lab b { display: block; color: var(--ink); font-weight: 600; font-size: .78rem; }
.clave-nota { margin-top: 10px; font-size: .86rem; color: var(--muted); }

/* El comprobante en pantalla */
.doc { border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding: 16px; display: grid; gap: 14px; font-size: .92rem; }
.d-top { display: grid; gap: 12px; }
@media (min-width: 640px) { .d-top { grid-template-columns: 1fr 1fr; } }
.d-emisor h3 { font-size: 1.08rem; font-weight: 700; margin-bottom: 4px; }
.d-box { border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; }
.d-tipo { font-size: 1.05rem; font-weight: 700; }
.d-num { font-family: var(--mono); font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-size: .82rem; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dt { font-size: .8rem; margin-top: 6px; } .kv dt:first-child { margin-top: 0; } }
.doc .tbl table { min-width: 520px; }
.doc .tbl td.nw { white-space: nowrap; }
.doc .totales table { min-width: 0; }
@media (max-width: 640px) { .v-actions .btn { flex: 1 1 auto; } .doc { padding: 12px; } }
.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 tr:last-child td { border-bottom: 0; }
.tbl th { background: #1f2328; color: #fff; font-weight: 600; text-align: center; white-space: nowrap; }
.tbl td.n { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: .84rem; font-variant-numeric: tabular-nums; }
.tbl td small { display: block; color: var(--muted); }
.d-pie { display: grid; gap: 12px; }
@media (min-width: 640px) { .d-pie { grid-template-columns: 1fr minmax(240px, 300px); align-items: start; } }
.totales td.n { font-weight: 500; }
.totales tr.fin td { font-weight: 700; border-top: 2px solid var(--ink); }
.totales td:first-child { font-weight: 500; }

.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: 84ch; }

/* Página de la clave */
.clave-in { display: grid; gap: 8px; padding: 20px; }
.clave-in label { font-weight: 600; }
.clave-in input { width: 100%; min-height: 54px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 1.05rem; letter-spacing: .03em; }
.clave-in input:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 22%, transparent); }
.clave-in .ayuda { font-size: .86rem; color: var(--muted); }
.clave-in .cuenta { font-family: var(--mono); font-size: .86rem; color: var(--muted); }
.clave-out { padding: 0 20px 20px; display: grid; gap: 12px; }
.clave-out .tbl table { min-width: 0; }
.clave-out .tramo .dig { font-size: 1.2rem; padding: 4px 6px 3px; }
.clave-out .tramo .lab { font-size: .78rem; }

/* Publicidad */
.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 code { font-family: var(--mono); font-size: .9em; }
.prose .tbl { margin: 12px 0 18px; }
.prose .tbl table { min-width: 460px; font-size: .93rem; }
.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; }

.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 96px; 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); }

/* Cookies */
.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; }
  .drop { padding: 26px 14px 22px; }
  .res-actions { width: 100%; }
  .res-actions .btn { flex: 1 1 auto; }
}
@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, .res-head, .lista-col, .v-actions, .drop { display: none !important; }
  body { background: #fff; color: #000; }
  .tool { border: 0; }
  .res-body { display: block; }
}

/* Las tablas anchas se desplazan dentro de su caja, nunca empujan la página */
.doc > *, .d-pie > *, .d-top > *, .vista > * { min-width: 0; }
