/* Facturas SRI — papel cuadriculado de tkaed (base copiada de conciliar-pagos) */

:root {
  --paper: #f2f6f3;
  --card: #ffffff;
  --ink: #112a3a;
  --pencil: #4d626e;
  --line: rgba(17, 42, 58, 0.14);
  --amber: #f2b632;
  --amber-soft: rgba(242, 182, 50, 0.32);
  --ok: #2e7d5b;
  --no: #a8324a;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); font-size: 1rem; line-height: 1.6; color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

main, .top, .foot { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; }
.brand { font-family: var(--serif); font-size: 1.1rem; text-decoration: none; }
.top nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.top nav a { text-decoration: none; border-bottom: 2px solid transparent; }
.top nav a:hover { border-bottom-color: var(--amber); }

.intro { padding: 0.6rem 0 1.2rem; max-width: 46rem; }
.intro h1 { font-size: clamp(1.85rem, 6vw, 3.2rem); margin-bottom: 0.5rem; }
.lede { font-size: 1.05rem; color: var(--pencil); max-width: 40rem; margin: 0; }

.tool { background: var(--card); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 7px 7px 0 var(--amber); overflow: hidden; margin-bottom: 2rem; }
.next { background: var(--ink); color: var(--paper); padding: 1rem 1.1rem 1.1rem; }
.next p { margin: 0; }
.next-label { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.next-date { font-family: var(--serif); font-size: clamp(1.4rem, 4.5vw, 1.9rem); line-height: 1.2; }
.next-what { font-size: 0.98rem; font-weight: 500; opacity: 0.92; }
.tool-body { padding: 1.1rem; }

/* Subir */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 128px; padding: 0.9rem; cursor: pointer;
  border: 2px dashed var(--ink); border-radius: 6px; background: #fff;
}
.drop:hover, .drop.over { background: var(--amber-soft); }
.drop:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }
.drop-main { font-weight: 700; font-size: 1.1rem; }
.drop-sub { font-size: 0.88rem; color: var(--pencil); }
.loaded .drop { min-height: 0; flex-direction: row; gap: 0.6rem; padding: 0.55rem 0.8rem; border-style: solid; justify-content: flex-start; text-align: left; }
.loaded .drop-main { white-space: nowrap; }
.loaded .drop-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.go { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin-top: 0.6rem; }
.count { font-size: 0.9rem; color: var(--pencil); font-variant-numeric: tabular-nums; }
.btn-link { font: inherit; color: var(--ink); background: none; border: 0; padding: 0.4rem 0.1rem; cursor: pointer; text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.form-msg { display: block; margin: 0.5rem 0 0; font-size: 0.92rem; color: var(--no); font-weight: 500; }
.form-msg:empty { display: none; }
.demo-note { margin: 0.6rem 0 0; font-size: 0.9rem; background: var(--amber-soft); border-radius: 4px; padding: 0.4rem 0.7rem; }
.errores { margin-top: 0.8rem; border-left: 4px solid var(--no); background: rgba(168, 50, 74, 0.07); padding: 0.6rem 0.8rem; font-size: 0.9rem; }
.errores p { margin: 0; }
.errores ul { margin: 0.3rem 0 0; padding-left: 1.2rem; overflow-wrap: anywhere; }
.help { margin-top: 0.9rem; font-size: 0.93rem; }
.help summary { cursor: pointer; font-weight: 700; }
.help ol { margin: 0.5rem 0 0; padding-left: 1.3rem; color: var(--pencil); }
.help li { margin-bottom: 0.35rem; }
.help b { color: var(--ink); }

/* Datos */
.result { margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.datos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem 1rem; }
@media (min-width: 760px) { .datos { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.datos label, .datos .lbl { display: block; font-size: 0.85rem; font-weight: 700; }
.datos .check, .datos .wide { grid-column: 1 / -1; }
.datos .check { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 500; font-size: 0.92rem; }
.datos .check input { width: 20px; height: 20px; margin: 0.15rem 0 0; accent-color: var(--ink); flex: none; }
select, .datos input[type="text"], .buscar input {
  display: block; width: 100%; font: inherit; font-size: 0.95rem; color: var(--ink); background: #fff;
  border: 2px solid var(--ink); border-radius: 4px; padding: 0.4rem 0.5rem; min-height: 42px; margin-top: 0.15rem;
}
select { cursor: pointer; }
.hint { display: block; font-size: 0.82rem; color: var(--pencil); font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 0.2rem; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 999px; padding: 0.1rem 0.2rem 0.1rem 0.7rem; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.chip-x { font: inherit; font-size: 1.1rem; line-height: 1; background: none; border: 0; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; color: var(--ink); }
.chip-x:hover { background: var(--amber-soft); }

/* Rebaja */
.rebaja { margin: 1.2rem 0; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 0.9rem 1rem; }
.rebaja p { margin: 0; }
.rebaja-lbl { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--pencil); }
.rebaja-num { font-family: var(--serif); font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.calc { list-style: none; margin: 0.6rem 0 0; padding: 0; font-size: 0.93rem; }
.calc li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-top: 1px solid var(--line); }
.calc b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.avisos { margin: 0.6rem 0 0; padding-left: 1.1rem; font-size: 0.88rem; color: var(--pencil); }
.avisos li { margin-bottom: 0.2rem; }
.avisos .warn { color: var(--ink); font-weight: 500; }
.avisos .btn-link { padding: 0; font-size: inherit; }

/* Rubros */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile {
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: #fff; border: 2px solid var(--ink); border-radius: 6px; padding: 0.5rem 0.65rem;
  border-top-width: 6px; min-width: 0;
}
.tile[aria-selected="true"] { box-shadow: 4px 4px 0 var(--amber); background: var(--paper); }
.tile span { display: block; font-weight: 700; font-size: 0.86rem; line-height: 1.25; }
.tile b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile small { display: block; color: var(--pencil); font-size: 0.8rem; }
.t-all { border-top-color: var(--ink); }
.t-viv { border-top-color: #5b6fb0; }
.t-edu { border-top-color: #7a5ba8; }
.t-sal { border-top-color: var(--ok); }
.t-ves { border-top-color: #b0645b; }
.t-ali { border-top-color: #c28a12; }
.t-tur { border-top-color: #2b8a9a; }
.t-falta { border-top-color: var(--no); border-style: dashed; border-top-style: solid; }
.t-no { border-top-color: #9aa6ad; }

/* Proveedores */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.6rem 1rem; margin-top: 1.3rem; }
.buscar { flex: 1 1 14rem; max-width: 22rem; }
.res-help { font-size: 0.88rem; color: var(--pencil); margin: 0.5rem 0; }
.res-done { font-size: 0.9rem; font-weight: 700; color: var(--ok); margin: 0 0 0.4rem; }
.res-done:empty { display: none; }
.rows { border-top: 2px solid var(--ink); }
.prov { border-bottom: 1px solid var(--line); }
.prov.sin-rubro { background: linear-gradient(90deg, rgba(168, 50, 74, 0.07), transparent 40%); }
.prov-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1rem; padding: 0.65rem 0.3rem; align-items: start; }
@media (min-width: 760px) { .prov-main { grid-template-columns: minmax(0, 1fr) 9.5rem 17rem; } }
.prov-who b { display: block; overflow-wrap: anywhere; }
.prov-who small, .prov-amt small { display: block; font-size: 0.8rem; color: var(--pencil); overflow-wrap: anywhere; }
.prov-amt { text-align: right; }
.prov-amt b { font-variant-numeric: tabular-nums; }
.prov-pick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
@media (min-width: 760px) { .prov-pick { grid-column: auto; } }
.prov-pick label { flex: 1 1 11rem; }
.prov-pick select { margin: 0; min-height: 40px; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 0.05rem 0.55rem; border: 1px solid var(--line); }
.b-sug { background: var(--amber-soft); }
.mini {
  font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--ink); cursor: pointer;
  background: #fff; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0.2rem 0.55rem; min-height: 34px;
}
.mini:hover, .mini:focus-visible { background: var(--amber-soft); }
.docs { overflow-x: auto; padding: 0 0.3rem 0.7rem; }
.docs table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 34rem; }
.docs th { text-align: left; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--pencil); border-bottom: 1px solid var(--ink); padding: 0.3rem 0.4rem; }
.docs td { padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.docs td small { display: block; color: var(--pencil); font-size: 0.78rem; }
.docs .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.docs tr.nc td { color: var(--no); }
.rows .empty { padding: 1rem 0.3rem; color: var(--pencil); margin: 0; }
.more-rows { padding: 0.7rem 0.3rem; font-size: 0.88rem; color: var(--pencil); margin: 0; }

/* No cuentan */
.fuera { margin-top: 1.2rem; border: 2px dashed var(--line); border-radius: 6px; padding: 0.6rem 0.8rem; }
.fuera summary { cursor: pointer; font-weight: 700; }
.out { padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.out:last-child { border-bottom: 0; }
.out p { margin: 0 0 0.3rem; }
.out-list { margin: 0.2rem 0 0; padding-left: 1.2rem; font-size: 0.85rem; color: var(--pencil); max-height: 12rem; overflow-y: auto; }

/* Modo */
.modo { display: inline-flex; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; max-width: 100%; }
.modo button { font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--ink); background: #fff; border: 0; padding: 0.5rem 0.9rem; min-height: 44px; cursor: pointer; }
.modo button + button { border-left: 2px solid var(--ink); }
.modo button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.modo button:not([aria-pressed="true"]):hover { background: var(--amber-soft); }
.modo-help { font-size: 0.9rem; color: var(--pencil); margin: 0.5rem 0 0.8rem; }
.solo-negocio { display: none !important; }
.modo-negocio .solo-negocio { display: revert !important; }
.modo-negocio .meses.solo-negocio { display: block !important; }
.modo-negocio .solo-personal { display: none !important; }
.prov.fuera-neg { opacity: 0.6; }

/* Meses */
.meses { margin: 1.2rem 0; }
.meses h3 { margin-bottom: 0.5rem; }
.meses-tabla { overflow-x: auto; border: 2px solid var(--ink); border-radius: 6px; }
.meses-tabla table, .cp-meses table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 32rem; }
.meses-tabla th, .cp-meses th { text-align: left; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--pencil); background: var(--paper); padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--ink); }
.meses-tabla td, .cp-meses td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
.meses-tabla .n, .cp-meses .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meses-tabla tr.vacio td { color: var(--pencil); }
.meses-tabla tfoot td, .cp-meses tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }

/* Descargas */
.export { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; font-weight: 700; font-size: 0.95rem; }
.btn-out {
  font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; min-height: 40px;
  background: #fff; border: 2px solid var(--ink); border-radius: 6px; padding: 0.35rem 0.9rem; box-shadow: 3px 3px 0 var(--amber);
}
.btn-out:hover, .btn-out:focus-visible { background: var(--amber-soft); }

/* Ver comprobante */
.ver { width: min(46rem, calc(100% - 1.5rem)); max-height: calc(100% - 2rem); padding: 0; border: 2px solid var(--ink); border-radius: 6px; box-shadow: 7px 7px 0 var(--amber); color: var(--ink); }
.ver::backdrop { background: rgba(17, 42, 58, 0.55); }
.ver-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.9rem; background: var(--paper); border-bottom: 2px solid var(--ink); }
.ver-bar h2 { flex: 1; font-size: 1.2rem; }
#fs-ver-body { padding: 1rem; }
.cp { font-size: 0.9rem; }
.cp p { margin: 0 0 0.2rem; }
.cp-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem; padding-bottom: 0.7rem; border-bottom: 2px solid var(--ink); }
.cp-emisor { font-weight: 700; font-size: 1.05rem; }
.cp-tipo { font-family: var(--serif); font-size: 1.3rem; }
.cp-num { text-align: right; }
.cp-clave { margin: 0.7rem 0 !important; font-size: 0.8rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cp-cli { margin-bottom: 0.7rem !important; }
.cp table { width: 100%; border-collapse: collapse; margin-bottom: 0.7rem; }
.cp-scroll { overflow-x: auto; }
.cp th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pencil); border-bottom: 1px solid var(--ink); padding: 0.3rem; }
.cp td { padding: 0.3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.cp .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cp-tot { max-width: 22rem; margin-left: auto; }
.cp-total td { font-weight: 700; border-top: 2px solid var(--ink); }
.cp-pie { font-size: 0.75rem; color: var(--pencil); margin-top: 0.6rem !important; }
#fs-print { display: none; }
@media print {
  body.imprimiendo { background: #fff; }
  body.imprimiendo > :not(#fs-print) { display: none !important; }
  body.imprimiendo #fs-print { display: block; }
  #fs-print .cp { font-size: 10.5pt; }
}

.ad-slot { min-height: 90px; margin: 2rem 0; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 4px; color: rgba(77, 98, 110, 0.55); font-size: 0.8rem; }

.how, .seo, .faq { max-width: 46rem; margin: 3rem 0; }
.how h2, .faq h2 { margin-bottom: 1rem; }
.seo h2 { margin: 1.8rem 0 0.8rem; }
.seo h2:first-child { margin-top: 0; }
.topes { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: 0.93rem; background: #fff; border: 2px solid var(--ink); }
.topes th { text-align: left; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--pencil); background: var(--paper); padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--ink); }
.topes td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); }
.topes .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.steps { padding-left: 1.4rem; margin: 0; }
.steps li { margin-bottom: 0.8rem; padding-left: 0.3rem; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq details { border-top: 1px solid var(--line); padding: 0.8rem 0; }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq details p { margin: 0.6rem 0 0; color: var(--pencil); }

.foot { padding: 2rem 0 3rem; border-top: 2px solid var(--ink); color: var(--pencil); font-size: 0.9rem; }
.foot p { margin: 0; }
.noscript { background: var(--amber); padding: 1rem; text-align: center; margin: 0; }

@media (max-width: 420px) {
  .top nav a[href="#como-funciona"] { display: none; }
  .tool-body { padding: 0.9rem; }
  .topes { font-size: 0.8rem; }
  .topes th, .topes td { padding: 0.35rem 0.35rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Escondido hasta que AdSense apruebe; entonces borrar esta regla y poner los bloques. */
.ad-slot { display: none !important; }
