:root {
  color-scheme: light;
  --bg: #e7f7fb;
  --ink: #16343c;
  --muted: #5d7d88;
  --line: #d5eef3;
  --green: #12b5a8;
  --green-ink: #0c7f76;
  --green-soft: #dffaf4;
  --coral: #ff6f61;
  --clay: #e2564a;
  --clay-soft: #ffe8e3;
  --amber: #c98400;
  --amber-soft: #fff4cc;
  --white: #ffffff;
  --shadow: 0 10px 28px rgba(20, 120, 140, 0.1);
}

* { box-sizing: border-box; }
html, body { min-height: 100dvh; }
body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, #ffe7c4 0%, transparent 58%),
    radial-gradient(800px 380px at 100% 0%, #b7f3ee 0%, transparent 52%),
    var(--bg);
  line-height: 1.4;
}
.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.app { max-width: 1180px; margin: 0 auto; padding: 22px 28px 48px; }
.logo { height: 78px; width: auto; max-width: 460px; display: block; background: #fff; object-fit: contain; }
h1 { font-size: 1.7rem; line-height: 1.15; margin: 0 0 8px; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
a { color: var(--green-ink); }

.mes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 14px;
}
.mes a, .mes strong {
  background: #fff;
  border-radius: 14px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.mes strong { flex: 1; text-transform: capitalize; }

.numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.numeros.pasos { grid-template-columns: repeat(5, 1fr); }
.numeros.pasos .numero strong { font-size: 1.45rem; }
.numero {
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.numero span { display: block; color: var(--muted); font-weight: 700; }
.numero strong { display: block; font-size: 2rem; letter-spacing: -0.03em; line-height: 1.1; }
.numero.bien strong { color: var(--green-ink); }
.numero.debe strong { color: var(--clay); }
.numero.gasto strong { color: var(--amber); }

.casas { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.casa {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  border-radius: 16px;
  background: #fff;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 8px 4px;
}
.casa b { font-size: 1.45rem; line-height: 1; }
.casa small { color: var(--muted); font-size: 0.72rem; text-align: center; font-weight: 700; }
.casa.debe { background: var(--clay-soft); }
.casa.debe small { color: var(--clay); }
.casa.ok { background: var(--green-soft); }
.casa.ok small { color: var(--green-ink); }
.casa.favor { background: var(--amber-soft); }
.casa.favor small { color: var(--amber); }

.card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 0 0 14px;
}
.concepto { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.concepto:first-of-type { border-top: 0; }
.fila { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.fila a { text-decoration: none; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field span { font-weight: 750; }
input[type="text"], input[type="password"], input[type="file"], select {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7fcff;
  color: var(--ink);
}
.tipos { display: grid; gap: 8px; margin-bottom: 14px; }
.tipo {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #f7fcff;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  font-weight: 750;
}
.tipo:has(input:checked) { border-color: var(--coral); background: #fff; }
.tipo input { width: 22px; height: 22px; accent-color: var(--coral); }
.tipo small { display: block; font-weight: 650; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--coral);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.peligro { background: var(--clay); }
.acciones { display: grid; gap: 8px; margin-top: 12px; }
.flash { background: var(--green-soft); color: var(--green-ink); border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.flash.error { background: var(--clay-soft); color: var(--clay); }
.aviso {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 8px 0 12px;
}
.comprobante img, .logo-mini { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; background: #fff; }
.visor { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr); gap: 16px; align-items: start; }
.visor-doc { background: #fff; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.visor-doc img, .visor-doc iframe { display: block; width: 100%; height: 72vh; min-height: 420px; border: 0; background: #10262c; object-fit: contain; }
.visor-lado { position: sticky; top: 88px; }
.visor-lado form + form { margin-top: 8px; }
.instalar { margin-top: 0; }
@media (display-mode: standalone) {
  .instalar { display: none; }
}
.tabla-caja { overflow-x: auto; background: #fff; border-radius: 18px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
th { color: var(--muted); font-size: 0.85rem; }
td.debe, .debe-txt { color: var(--clay); font-weight: 800; }
td.favor { color: var(--green-ink); font-weight: 800; }
.bien-txt { color: var(--green-ink); }
.concepto small { display: block; }
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
  border-radius: 12px;
}
.nav a.activa { background: var(--green-soft); color: var(--green-ink); }
.nav form { margin: 0; display: flex; }
.salir {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--clay);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.entrar { max-width: 420px; margin: 40px auto; }
input[inputmode="numeric"] { letter-spacing: 0.3em; }

@media (max-width: 860px) {
  .barra { flex-direction: column; align-items: stretch; padding: 12px; }
  .nav { justify-content: flex-start; }
  .numeros, .numeros.pasos, .casas { grid-template-columns: 1fr 1fr; }
  .visor { grid-template-columns: 1fr; }
  .visor-lado { position: static; }
  .visor-doc img, .visor-doc iframe { height: 55vh; min-height: 240px; }
  .app { padding: 16px; }
}
