:root {
  --navy: #17233d;
  --ink: #0e1e38;
  --teal: #58c9b9;
  --teal-dark: #0e7c72;
  --paper: #f4f7f9;
  --card: #ffffff;
  --muted: #4a5568;
  --faint: #718096;
  --line: #d7e0e6;
  --section: #d4e3ec;
  --subtotal: #b5c9d6;
  --total: #8eacbc;
  --neg: #b00000;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(23, 35, 61, 0.08);
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--card);
  color: var(--ink);
  font: 15px/1.5 var(--font);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-dark); }
h1, h2, h3 { letter-spacing: -0.03em; line-height: 1.15; font-weight: 700; }
h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.15rem); color: var(--navy); }
p { margin: 0; }
table { border-collapse: collapse; width: 100%; }
caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.neg { color: var(--neg); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.sub { color: var(--muted); margin-top: 12px; max-width: 40rem; font-size: 1.05rem; }
section { padding: 72px 0; }
.paper { background: var(--paper); }

header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; line-height: 0; text-decoration: none; }
.brand img { display: block; height: 34px; width: auto; }
.nav-links { display: flex; gap: 22px; align-items: center; }
.nav-links a { color: var(--muted); font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.nav-links a:hover { color: var(--navy); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 8px;
  font: 700 0.95rem/1 var(--font);
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { padding: 8px 14px; font-size: 0.88rem; }

.hero { padding: 48px 0 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: 36px;
  align-items: start;
}
.hero-grid > *,
.stage,
.pane,
.table-wrap { min-width: 0; }
.kicker {
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.15rem); color: var(--navy); }
.lead { margin-top: 16px; color: var(--muted); font-size: 1.08rem; max-width: 34rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.cta-note { margin-top: 12px; color: var(--faint); font-size: 0.85rem; }

.switch { display: flex; gap: 8px; margin-bottom: 10px; }
.vista-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.switch label {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.stage:has(#vista-gerencia:checked) label[for="vista-gerencia"],
.stage:has(#vista-contabilidad:checked) label[for="vista-contabilidad"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.vista-input:focus-visible + label { outline: 2px solid var(--navy); outline-offset: 2px; }
.stage:has(#vista-contabilidad:checked) .pane-g,
.stage:has(#vista-gerencia:checked) .pane-c,
.stage:has(#vista-contabilidad:checked) .role-g,
.stage:has(#vista-gerencia:checked) .role-c { display: none; }

.app {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: min(720px, 78vh);
  overflow-x: hidden;
  overflow-y: auto;
}
.appbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-height: 46px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
#lectura,
#comprobante-1098 { scroll-margin-top: 12px; }
.company-chip,
.role-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}
.role-chip { margin-left: auto; background: var(--navy); color: #fff; border-color: var(--navy); }
.quotes { color: var(--faint); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; }
.pane { padding: 14px 14px 16px; }
.sheet-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-h h2 { font-size: 1.25rem; }
.sheet-h p, .sheet-note, .muted { color: var(--muted); font-size: 0.85rem; }
.sheet-note { margin: 8px 0 10px; }
.pill {
  background: var(--teal);
  color: var(--navy);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.stage-note { margin-top: 10px; color: var(--faint); font-size: 0.82rem; }

.table-wrap { overflow-x: auto; margin-top: 10px; }
.eerr th, .eerr td, .mayor th, .mayor td, .lectura-t th, .lectura-t td {
  padding: 7px 10px;
  text-align: left;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--line);
}
.eerr thead th, .mayor thead th, .lectura-t thead th {
  background: var(--section);
  color: #4a6578;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eerr tr.account td { background: #fff; }
.eerr tr.account td:first-child { padding-left: 1.3rem; }
.eerr tr.subtotal td { background: var(--subtotal); font-weight: 700; }
.eerr tr.total td {
  background: var(--total);
  font-weight: 700;
  border-top: 2px solid var(--navy);
}
.eerr tr.on td, .mayor tr.on td, .lectura-t tr.on td { background: #e4eef2; }
.stmt-fig { color: inherit; font-weight: 700; }
.stmt-fig:hover { text-decoration: underline; }
.fecha { white-space: nowrap; }
.mayor tfoot td, .lectura-t tfoot td { font-weight: 700; background: var(--paper); }

.lectura { margin-top: 14px; }
.crumb { color: var(--faint); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.lectura h3, .voucher h3 { margin: 4px 0; font-size: 1.15rem; color: var(--navy); }
.code, .acct {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lectura-panel {
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.lectura-h {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lectura-h b {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.3rem;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0;
}
.lectura-kpis {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.lectura-kpi { padding: 10px 12px 12px; border-left: 1px solid var(--line); min-width: 0; }
.lectura-kpi:first-child { border-left: 0; }
.lectura-kpi .k { color: var(--muted); font-size: 0.78rem; }
.lectura-kpi .v {
  margin-top: 2px;
  color: var(--navy);
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lectura-kpi .v.neg { color: var(--neg); }
.lectura-kpi .n { color: var(--muted); font-size: 0.78rem; }
.lectura-lead, .lectura-note { padding: 0 12px 12px; color: var(--muted); font-size: 0.88rem; }
.lectura-lead { margin-top: 0; }
.meses {
  list-style: none;
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  padding: 12px 12px 0;
  height: 148px;
}
.meses li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.meses .track {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  min-height: 0;
}
.meses i {
  display: block;
  width: 62%;
  height: calc(var(--h) * 100%);
  background: var(--navy);
}
.meses li.on i { background: var(--teal); }
.meses li:not(.on) { opacity: 0.45; }
.meses span { margin-top: 4px; color: var(--muted); font-size: 0.68rem; font-weight: 600; }
.meses li.on span { color: var(--navy); font-weight: 700; opacity: 1; }
.lectura-panel .table-wrap { margin: 8px 0 0; }
.voucher {
  margin-top: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.band { background: var(--navy); color: #c5d0de; padding: 36px 0; }
.band p { max-width: 46rem; font-size: 1.15rem; }
.band strong { color: #fff; font-weight: 700; }

.orders, .base-grid, .pulse {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}
.pulse { grid-template-columns: repeat(3, 1fr); }
.orders article, .base-grid article, .pulse article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 18px;
}
.paper .orders article, .paper .pulse article, .paper .base-grid article { background: #fff; }
.orders h3, .base-grid h3, .pulse h3 { margin: 0 0 8px; font-size: 1.15rem; color: var(--navy); }
.orders p, .base-grid p, .pulse p { color: var(--muted); }
.orders ul { margin: 12px 0 0; padding: 0; list-style: none; }
.orders li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.92rem;
}
.limit {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--navy);
  font-weight: 600;
}
.paths { margin-top: 22px; display: grid; gap: 10px; }
.paths p {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: baseline;
  padding: 14px 16px;
  background: var(--paper);
  border-radius: 8px;
  color: var(--ink);
}
.paths span {
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.faq { max-width: 760px; }
.faq h2 { margin-bottom: 18px; }
details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: #fff;
}
details summary { font-weight: 600; cursor: pointer; }
details p { margin-top: 8px; color: var(--muted); }

.final {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 48px 28px;
  text-align: center;
}
.final h2 { color: #fff; }
.final p { color: #c5d0de; margin: 12px auto 22px; max-width: 34rem; }
.final .cta-row { justify-content: center; }
.final .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.final .btn-ghost:hover { border-color: var(--teal); color: #fff; }

footer { padding: 28px 0 40px; color: var(--faint); font-size: 0.9rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: var(--muted); text-decoration: none; }

.legal { max-width: 40rem; margin: 0 auto; padding: 4.5rem 1.5rem 5rem; }
.legal h1 { margin: 1.2rem 0 0.6rem; font-size: 2rem; color: var(--navy); }
.legal p { margin-top: 0.85rem; color: var(--muted); }
.legal .btn { margin-top: 1.2rem; }

@media (max-width: 980px) {
  .hero-grid, .orders, .base-grid, .pulse { grid-template-columns: 1fr; }
  .lectura-kpis { grid-template-columns: 1fr; }
  .lectura-kpi { border-left: 0; border-top: 1px solid var(--line); }
  .lectura-kpi:first-child { border-top: 0; }
}
@media (max-width: 720px) {
  .brand img { height: 28px; }
  .nav-links a:not(.btn) { display: none; }
  .quotes { display: none; }
  section { padding: 52px 0; }
  .role-chip { margin-left: 0; }
  .mayor thead { display: none; }
  .mayor,
  .mayor tbody,
  .mayor tfoot,
  .mayor tr,
  .mayor td { display: block; width: auto; }
  .mayor tr { padding: 8px 10px; border-bottom: 1px solid var(--line); }
  .mayor td { border: 0; padding: 1px 0; text-align: left; white-space: normal; }
  .mayor td.num { text-align: left; }
  .mayor td::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 4.6rem;
    margin-right: 8px;
    color: var(--faint);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
