:root {
  --navy: #17233d;
  --teal: #58c9b9;
  --teal-fill: #58c9b9;
  --teal-dark: #0e7c72;
  --paper: #f4f7f9;
  --card: #ffffff;
  --ink: #0e1e38;
  --muted: #4a5568;
  --line: #d7e0e6;
  --accent: #58c9b9;
  --ok: #0e7c72;
  --grafito: #4a5568;
  --error: #c23b4a;
  --neg: #B00000;
  --heading: #4a6578;
  --band-soft: #eef5f8;
  --band-soft-2: #eef4f7;
  --band-section: #d4e3ec;
  --band-head: #b5c9d6;
  --band-total: #8eacbc;
  --band-line: #17233d;
  --band-hover: #f7fbfb;
  --band-hover-2: #f8fbfb;
  --row-on: #e4eef2;
  --wash: #e7eef2;
  --placeholder: #1c7c86;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(23, 35, 61, 0.08);
  --font: "Plus Jakarta Sans", Inter, "Segoe UI", sans-serif;
  --side-w: 200px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--font);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 9.2rem fits 00.000.000-0 in Plus Jakarta Sans at 0.92rem, the widest Chilean RUT. */
td.rut, th.rut, span.rut { white-space: nowrap; }
th.fecha, td.fecha { white-space: nowrap; min-width: 7.6rem; }
td.cuenta, th.cuenta {
  white-space: nowrap;
  min-width: 8.75rem;
  font-variant-numeric: tabular-nums;
}
table.eerr.balance thead tr:first-child th.grp { text-align: center; }
button.stmt-fig {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: right;
  width: 100%;
}
button.stmt-fig:hover { text-decoration: underline; }
button.date-sort {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
}
button.date-sort:hover { text-decoration: underline; }
th.fecha[aria-sort="ascending"] button.date-sort::after { content: " \2191"; }
th.fecha[aria-sort="descending"] button.date-sort::after { content: " \2193"; }
a.stmt-fig {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  width: 100%;
  text-align: right;
}
a.stmt-fig:hover { text-decoration: underline; }
.lectura-code {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  vertical-align: 0.25rem;
}
.lectura-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0.9rem 0;
}
.lectura-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.lectura-h b {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
}
.lectura-h > div {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lectura-kpis {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr;
  border-top: 1px solid var(--line);
  margin-top: 0.7rem;
}
.lectura-kpi {
  padding: 0.85rem 1rem 0.95rem;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.lectura-kpi:first-child { border-left: 0; }
.lectura-kpi .k { font-size: 0.78rem; color: var(--muted); }
.lectura-kpi .v {
  margin-top: 0.1rem;
  color: var(--navy);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.lectura-kpi:first-child .v { font-size: 2rem; }
.lectura-kpi .n { margin-top: 0.15rem; font-size: 0.78rem; color: var(--muted); }
.lectura-lead {
  margin: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
}
.lectura-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0.7rem 0.8rem 0.2rem;
  overflow-x: auto;
}
.lectura-chart a.bar {
  flex: 1 0 2.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.lectura-chart a.bar.dim { opacity: 0.35; }
.lectura-chart .val {
  min-height: 1rem;
  margin-bottom: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lectura-chart .stack {
  display: flex;
  flex-direction: column-reverse;
  width: 58%;
  height: 8.5rem;
  border-bottom: 1px solid var(--line);
}
.lectura-chart .stack i { display: block; width: 100%; }
.lectura-chart .stack i.top { background: var(--teal-fill); }
.lectura-chart .stack i.rest { background: var(--navy); }
.lectura-chart .lbl { margin-top: 0.25rem; font-size: 0.72rem; color: var(--muted); }
.lectura-chart a.on .lbl { color: var(--navy); font-weight: 700; }
.lectura-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.35rem 1rem 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.lectura-legend .swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.35rem;
  border-radius: 2px;
  vertical-align: -1px;
}
.lectura-legend .swatch.top { background: var(--teal-fill); }
.lectura-legend .swatch.rest { background: var(--navy); }
.lectura-note { margin: 0; padding: 0 1rem 0.9rem; color: var(--muted); font-size: 0.85rem; }
.lectura-panel .table-wrap { margin: 0.35rem 0 0; }
.lectura-panel th { position: static; background: transparent; }
table.lectura td.who { font-weight: 600; }
table.lectura tr.on td { background: var(--row-on); }
table.lectura tfoot td { font-weight: 700; border-bottom: 0; background: var(--paper); }
.share-row { display: flex; align-items: center; gap: 0.45rem; min-width: 8.5rem; }
.share-row > span:last-child { width: 2.4rem; color: var(--muted); font-size: 0.82rem; text-align: right; font-variant-numeric: tabular-nums; }
.share-track {
  flex: 1;
  display: block;
  height: 0.45rem;
  background: var(--paper);
  border-radius: 2px;
  overflow: hidden;
}
.share { display: block; height: 100%; background: var(--navy); border-radius: 2px; }
.share.lead { background: var(--teal-fill); }
.spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 5.6rem;
  height: 1.35rem;
}
.spark i { flex: 1; display: block; min-height: 1px; background: var(--navy); }
.spark i.lead { background: var(--teal-fill); }
.spark i.dim { opacity: 0.3; }
.lectura-docs { padding: 0.2rem 1rem 1rem; }
.lectura-docs > p { margin: 0.6rem 0 0.35rem; font-weight: 600; }
.lectura-docs table { background: #fff; }
.lectura-mayor { margin: 0.4rem 0 0; font-size: 0.92rem; }
@media (max-width: 760px) {
  .lectura-kpis { grid-template-columns: 1fr; }
  .lectura-kpi { border-left: 0; border-top: 1px solid var(--line); }
  .lectura-kpi:first-child { border-top: 0; }
}
.fig-dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  max-width: 36rem;
  width: calc(100% - 2rem);
}
.fig-dialog::backdrop { background: rgba(14, 30, 56, 0.45); }
span.acct, span.cuenta { white-space: nowrap; font-variant-numeric: tabular-nums; }
span.acct { color: var(--muted); }
input[inputmode="numeric"], input[inputmode="decimal"] { text-align: right; }
a { color: var(--teal-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.staff-shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  align-items: start;
}
html.nav-ready body.staff-shell { transition: grid-template-columns 0.22s ease; }
html.nav-collapsed body.staff-shell { grid-template-columns: 0 minmax(0, 1fr); }
body.bare.staff-shell,
html.nav-collapsed body.bare.staff-shell { grid-template-columns: minmax(0, 1fr); }
body.bare .side,
body.bare .topbar { display: none; }
html.nav-collapsed body.staff-shell > .side {
  width: 0;
  max-width: 0;
  min-width: 0;
  overflow: hidden;
  visibility: hidden;
}
.side {
  background: var(--navy);
  color: #fff;
  min-height: 100vh;
  max-width: var(--side-w);
  width: var(--side-w);
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 2;
}
html.nav-ready .side { transition: width 0.22s ease, max-width 0.22s ease; }
.side .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
  padding: 1rem 0.85rem 0.8rem;
}
.wordmark { display: block; line-height: 0; }
.wordmark img { display: block; height: 26px; width: auto; }
.wordmark .wm-dark { display: none; }
.side .wordmark .wm-light { display: none; }
.side .wordmark .wm-dark { display: block; }
.side-group { padding: 0.2rem 0.75rem 0.55rem; }
.side-group h2 {
  margin: 0.55rem 0.5rem 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 600;
}
.side nav { padding: 0 0.35rem 1rem; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.side-user {
  flex: 0 0 auto;
  border-top: 2px solid var(--teal);
  padding: 0.4rem 0.35rem 0.65rem;
  background: var(--navy);
}
.side-user .side-fold > summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  position: relative;
  padding: 0.4rem 1.15rem 0.4rem 0.45rem;
  color: #fff;
  font-weight: 700;
}
.side-user .side-user-name {
  display: block;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.side-user .side-fold > summary::after {
  float: none;
  position: absolute;
  right: 0.4rem;
  top: 0.72rem;
  margin-top: 0;
  border-color: #fff transparent transparent transparent;
}
.side-user .side-fold[open] > summary::after {
  top: 0.85rem;
  margin-top: 0;
  border-width: 0 4px 5px 4px;
  border-color: transparent transparent #fff transparent;
}
.side-user .side-fold summary:hover { background: rgba(255, 255, 255, 0.08); }
.side-user .side-link { color: rgba(255, 255, 255, 0.9); }
.side-user .side-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.side-user .side-link.on { background: rgba(88, 201, 185, 0.22); color: #fff; }
.side-logout {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border: 0;
  padding: 0.32rem 0.5rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
}
.side-logout:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.role-chip {
  display: inline-block;
  margin: 0;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(88, 201, 185, 0.28);
  color: #fff;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.3;
}
.side-link {
  display: block;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
}
.side-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.side-link.on { background: rgba(88, 201, 185, 0.18); color: var(--teal); }
.side-fold {
  margin: 0.15rem 0 0.35rem;
}
.side-fold summary {
  list-style: none;
  cursor: pointer;
  padding: 0.34rem 0.4rem;
  border-radius: 6px;
  color: rgba(255,255,255,0.92);
  font-size: 0.78rem;
  font-weight: 600;
}
.side nav .side-fold > summary {
  color: var(--teal);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.side-fold summary::-webkit-details-marker,
.top-menu > summary::-webkit-details-marker { display: none; }
.side-fold summary::marker,
.top-menu > summary::marker { content: ""; }
.side-fold summary::after {
  content: "";
  float: right;
  margin-top: 0.45rem;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 4px 0 4px;
  border-color: rgba(255,255,255,0.55) transparent transparent transparent;
}
.side nav .side-fold > summary::after {
  border-color: var(--teal) transparent transparent transparent;
}
.side nav .side-fold[open] > summary::after,
.side-fold[open] summary::after {
  margin-top: 0.2rem;
  border-width: 0 4px 5px 4px;
  border-color: transparent transparent var(--teal) transparent;
}
.side-fold summary:hover { background: rgba(255,255,255,0.06); }
.side nav .side-fold > summary:hover { background: rgba(22, 184, 166, 0.14); color: #7ee8db; }
.side-fold .side-link { margin-left: 0.2rem; font-size: 0.76rem; }
.side nav > a.side-direct {
  display: block;
  margin: 0.15rem 0 0.35rem;
  padding: 0.34rem 0.4rem;
  border-radius: 6px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1.3;
}
.side nav > a.side-direct:hover { background: rgba(22, 184, 166, 0.14); color: #7ee8db; }
.side nav > a.side-direct.on { background: rgba(88, 201, 185, 0.18); color: var(--teal); }
.lote-lista { margin: 0.4rem 0 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.lote-lista .lote-proyecto { border-top: 1px solid var(--line); }
.lote-lista .lote-proyecto:first-child { border-top: 0; }
.lote-lista summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  list-style: none;
}
.lote-lista summary::-webkit-details-marker { display: none; }
.lote-lista summary::marker { content: ""; }
.lote-lista summary b { color: var(--navy); font-weight: 600; }
.lote-lista summary .muted { font-size: 0.82rem; white-space: nowrap; }
.lote-lista .lote-cuerpo { padding: 0 0.85rem 0.75rem; }
.lote-lista .lote-cuerpo p { margin: 0.2rem 0; }
.lote-dash {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  align-items: start;
  margin: 0.4rem 0 0.2rem;
}
.lote-dash h2 { margin-top: 0; }
.lote-total { margin: 0 0 0.55rem; font-size: 1.35rem; font-weight: 700; color: var(--navy); }
.lote-dash .chart-box { min-height: 280px; }
.lote-kpis { grid-template-columns: 1fr 1fr; align-items: stretch; }
.lote-dash .kpi.with-ico {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.18rem;
}
.lote-dash .kpi.with-ico b { font-size: 1.12rem; white-space: nowrap; }
.lote-dash .kpi.with-ico em {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}
.lote-nota { margin: 1rem 0; }
.lote-nota > summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.side-label {
  margin: 0.7rem 0.45rem 0.1rem 0.85rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  font-weight: 600;
}
.side-mobile { display: none; padding: 0.4rem 0.75rem 1rem; }
.side-mobile h2 {
  margin: 0.7rem 0.5rem 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 600;
}
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.1rem;
  background: var(--navy);
  color: #fff;
  position: relative;
  z-index: 5;
}
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: #fff;
  margin: 0;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 6px;
  padding: 0;
}
.menu-btn svg { display: block; }
.company-chip {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}
.quotes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.35rem;
  align-items: center;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.78);
  margin-right: auto;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
.switcher { display: flex; gap: 0.5rem; align-items: center; }
.switcher select {
  width: auto;
  min-width: 14rem;
  max-width: 22rem;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}
.switcher select option { color: var(--ink); background: #fff; }
.topbar button {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: var(--radius-sm);
}
.topbar button:hover { border-color: var(--teal); color: var(--teal); }
.top-menu { position: relative; }
.top-menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  color: var(--teal);
}
.top-menu > summary::after {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 4px 0 4px;
  border-color: var(--teal) transparent transparent transparent;
}
.top-menu[open] > summary::after {
  border-width: 0 4px 5px 4px;
  border-color: transparent transparent var(--teal) transparent;
  margin-top: 0;
}
.top-menu > summary:hover,
.top-menu[open] > summary {
  background: rgba(22, 184, 166, 0.14);
  color: #7ee8db;
}
.top-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.55rem 0.8rem 0.6rem;
  width: max-content;
  max-width: calc(100vw - 1rem);
  z-index: 30;
}
.top-panel-sm { width: max-content; min-width: 0; }
.top-col h3 {
  margin: 0.45rem 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal-dark);
}
.top-col h3:first-child { margin-top: 0; }
.top-col a {
  display: block;
  padding: 0.22rem 0;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.86rem;
  white-space: nowrap;
}
.top-col a:hover { color: var(--teal-dark); }

main { padding: 1.5rem 1.6rem 3.2rem; max-width: none; min-width: 0; }
@media (max-width: 1100px) {
  .top-panel { right: auto; left: 0; width: max-content; max-width: calc(100vw - 1rem); max-height: 70vh; overflow: auto; }
}
@media (max-width: 960px) {
  body.staff-shell,
  html.nav-collapsed body.staff-shell { grid-template-columns: 1fr; }
  html.nav-ready body.staff-shell > .side,
  body.staff-shell > .side,
  html.nav-collapsed body.staff-shell > .side {
    display: flex;
    position: fixed;
    z-index: 20;
    width: var(--side-w);
    max-width: var(--side-w);
    min-width: 0;
    visibility: visible;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  html.nav-open body.staff-shell > .side { transform: none; }
  .topbar { position: sticky; top: 0; z-index: 30; }
  body.staff-shell > .side,
  html.nav-collapsed body.staff-shell > .side {
    top: 3.25rem;
    height: calc(100vh - 3.25rem);
    min-height: 0;
    max-height: none;
  }
  html.nav-collapsed .side nav { display: block; }
  html.nav-collapsed .side .side-user { display: block; }
  html.nav-collapsed .side .brand-name { display: inline; }
  html.nav-collapsed .side .brand {
    justify-content: flex-start;
    padding: 1.1rem 1.15rem 0.85rem;
  }
  .top-menu { position: relative; }
  .top-panel {
    position: absolute;
    left: 0;
    right: auto;
    top: calc(100% + 0.35rem);
    width: max-content;
    max-width: calc(100vw - 1rem);
    max-height: 70vh;
    overflow: auto;
  }
  .top-col a { white-space: normal; }
  .quotes { margin-right: 0; }
}
h1 { font-size: 1.55rem; letter-spacing: -0.03em; margin: 0.2rem 0 0.6rem; color: var(--heading); font-weight: 400; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 0.4rem; color: var(--heading); font-weight: 400; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem 1rem;
  margin: 0 0 0.35rem;
}
.page-head h1 { margin: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2rem; }
.table-wrap table { margin: 0; }
.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-dark);
  font-weight: 600;
}

label { display: block; margin: 0.8rem 0 0.25rem; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  max-width: 22rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  font-style: italic;
  opacity: 1;
}
textarea.pem {
  max-width: 44rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}
input[type="checkbox"], input[type="radio"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  max-width: none;
  padding: 0;
  accent-color: var(--teal-dark);
}
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  max-width: 100%;
  margin: 0.35rem 0;
  color: var(--ink);
  font-size: 0.95rem;
}
button, .btn {
  background: var(--navy);
  color: #fff;
  border: 0;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--teal-dark); }
.error { color: var(--error); }
.ok { color: var(--ok); }
.muted { color: var(--muted); }
p.ok, p.error {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
}
p.ok { background: #e9f8f5; border-color: #b8e8e1; }
p.error { background: #fdecee; border-color: #f3c4c9; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
th, td { text-align: left; padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.stmt-head { text-align: center; margin: 0.8rem 0 1rem; }
.stmt-head h2 { margin: 0.35rem 0 0.2rem; font-size: 1.35rem; letter-spacing: -0.01em; }
.stmt-head p { margin: 0.12rem 0; }
.stmt-company { font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--heading); }
.stmt-head .unit { font-style: italic; color: var(--muted); }
.sheet-note { color: var(--muted); font-size: 0.82rem; margin-top: 0.6rem; }
.esf-cuenta { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: stretch; }
.esf-cuenta > div { min-width: 0; }
table.esf-side { height: 100%; min-width: 0; }
table.esf-side td.head { font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--line); }
table.esf-side td.subtotal { font-weight: 700; border-top: 1px solid var(--ink); }
table.esf-side td.total,
table.esf-side th.total { font-weight: 700; border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); }
table.esf-side td.category { padding-left: 0.9rem; }
table.esf-side td.account { padding-left: 1.5rem; }
@media (max-width: 960px) {
  .esf-cuenta { grid-template-columns: 1fr; }
}
.eerr-sheet { margin: 0.4rem 0 0.8rem; }
.eerr-sheet p { margin: 0.1rem 0; }
.eerr-title { text-align: center; font-weight: 400; letter-spacing: 0.03em; color: var(--heading); }
.eerr-scroll { overflow-x: auto; max-width: 100%; }
table.eerr { min-width: 36rem; }
table.balance {
  table-layout: fixed;
  width: 100%;
  min-width: 119rem;
  border-collapse: separate;
  border-spacing: 0;
}
table.balance col.b-code { width: 9rem; }
table.balance col.b-name { width: 33rem; }
table.balance col.b-num { width: 9.6rem; }
table.balance col.b-aux { width: 7rem; }
/* .pin is Código and Cuenta only. The second header row starts at Debe. */
table.balance thead th.pin,
table.balance tbody td.pin {
  position: sticky;
  left: 0;
  width: 9rem;
  min-width: 9rem;
  white-space: nowrap;
  z-index: 2;
  background: var(--card);
}
table.balance thead th.pin.name,
table.balance tbody td.pin.name {
  left: 9rem;
  width: 33rem;
  min-width: 33rem;
  max-width: 33rem;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 8px 0 8px -8px rgba(23, 35, 61, 0.28);
}
table.balance thead th.pin {
  top: 0;
  z-index: 4;
  background: var(--band-head);
  color: var(--ink);
}
table.balance tbody tr:hover td.pin { background: var(--band-hover-2); }
table.balance td.num,
table.balance th.num { min-width: 0; }
@media (max-width: 960px) {
  table.balance thead th.pin,
  table.balance tbody td.pin {
    position: static;
    left: auto;
    box-shadow: none;
  }
  table.balance thead th.pin:not(.name),
  table.balance tbody td.pin:not(.name) {
    width: auto;
    min-width: 9rem;
    max-width: none;
  }
}
table.eerr td.num, table.eerr th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.eerr tr.section td { font-weight: 400; background: var(--band-section); color: var(--heading); }
table.eerr tr.section td a { color: inherit; }
table.eerr thead th,
table.esf-side thead th { background: var(--band-head); color: var(--ink); font-weight: 700; }
table.eerr tr.account td { background: #fff; }
table.eerr tr.subtotal td { font-weight: 700; background: var(--band-head); color: var(--ink); }
table.eerr tr.total td { font-weight: 700; background: var(--band-total); color: var(--ink); border-top: 2px solid var(--band-line); }
table.eerr tr.account td:first-child { padding-left: 1.6rem; }
table.eerr tr.eerr-folder { cursor: pointer; }
table.eerr tr.eerr-folder td:first-child::before { content: "▸ "; }
table.eerr tr.eerr-folder.is-open td:first-child::before { content: "▾ "; }
table.eerr.esf-side thead th {
  background: var(--band-total);
  color: var(--ink);
  font-weight: 700;
  border-top: 2px solid var(--band-line);
  border-bottom: 3px double var(--ink);
}
table.eerr.esf-side thead th:first-child { text-align: center; }
table.eerr.esf-side td.head,
table.eerr.esf-side th.head { background: var(--band-section); color: var(--ink); font-weight: 700; }
table.eerr.esf-side td.category,
table.eerr.esf-side td.section { background: var(--band-soft); color: var(--heading); font-weight: 400; }
table.eerr.esf-side td.account { background: #fff; color: var(--ink); font-weight: 400; }
table.eerr.esf-side td.subtotal { background: var(--band-section); color: var(--ink); font-weight: 700; }
table.eerr.esf-side td.total,
table.eerr.esf-side th.total { background: var(--band-total); color: var(--ink); font-weight: 700; border-top: 2px solid var(--band-line); }
table.eerr.esf-side td a { color: inherit; }
table.eerr .col-hint { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
table.eerr.split {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
}
table.eerr.split thead th { z-index: 3; }
table.eerr.split thead th:first-child,
table.eerr.split tbody td:first-child {
  position: sticky;
  left: 0;
  min-width: 12rem;
  max-width: none;
  z-index: 2;
  background: var(--card);
  box-shadow: 8px 0 8px -8px rgba(23, 35, 61, 0.28);
}
table.eerr.split thead th:first-child {
  top: 0;
  z-index: 4;
  background: var(--band-head);
  color: var(--ink);
}
table.eerr.split th.num,
table.eerr.split td.num { min-width: 0; }
table.eerr.split tbody tr:hover td:first-child { background: var(--band-hover-2); }
table.eerr.split tr.section td:first-child,
table.eerr.split tr.section:hover td:first-child { background: var(--band-section); color: var(--navy); }
table.eerr.split tr.subtotal td:first-child,
table.eerr.split tr.subtotal:hover td:first-child { background: var(--band-head); }
table.eerr.split tr.total td:first-child,
table.eerr.split tr.total:hover td:first-child { background: var(--band-total); }
table.eerr.split tr.account td:first-child,
table.eerr.split tr.account:hover td:first-child { background: #fff; }
@media (max-width: 960px) {
  table.eerr.split thead th:first-child,
  table.eerr.split tbody td:first-child {
    position: static;
    left: auto;
    max-width: none;
    box-shadow: none;
  }
}
button[aria-pressed="true"] { outline: 2px solid var(--navy); outline-offset: 1px; }
th { font-weight: 600; color: var(--muted); background: var(--band-hover); position: sticky; top: 0; z-index: 1; }
td.muted { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
main table:not(.eerr):not(.balance) > tbody > tr:last-child > td {
  border-bottom: 1px solid var(--line);
}
/* Data rows stay white, separated by a hairline. Color marks a section, a subtotal or a total. */
main table:not(.eerr):not(.balance) > tbody > tr:not(.section):not(.subtotal):not(.total):not(.account-head):not(.group-head):not(.mayor-account):not(.mayor-total):not([data-pin]) > td {
  background: #fff;
}
tbody tr:hover:not(.section):not(.subtotal):not(.total):not(.account-head):not(.group-head):not(.mayor-account):not(.mayor-total):not([data-pin]) td {
  background: var(--band-hover);
}
main table:not(.eerr):not(.balance) tr.section > td {
  background: var(--band-section);
  color: var(--heading);
  font-weight: 400;
  border-bottom: 0;
}
main table:not(.eerr):not(.balance) tr.section .account-code {
  color: var(--heading);
  margin-right: 0.4rem;
}
main table:not(.eerr):not(.balance) tr.account-head > td,
main table:not(.eerr):not(.balance) tr.group-head > td {
  background: var(--band-soft-2);
  color: var(--heading);
  font-weight: 400;
}
main table:not(.eerr):not(.balance) tr.subtotal > :is(td, th),
main table tr.mayor-total > :is(td, th) {
  background: var(--band-head);
  color: var(--ink);
  font-weight: 700;
}
/* Two analysis subtotals in a row share one color. The second takes the subtitle tone. */
table.analisis tr.subtotal + tr.subtotal > :is(td, th),
table.analisis tbody:has(> tr.subtotal) + tbody:has(> tr.subtotal) > tr.subtotal > :is(td, th) {
  background: var(--band-section);
  color: var(--navy);
}
main table.libro-mov:not(.eerr):not(.balance) tr.section > td {
  background: var(--band-section);
  color: var(--heading);
}
main table.libro-mov thead th { background: var(--band-head); color: var(--ink); }
main table:not(.eerr):not(.balance) tr.total > td,
main table:not(.eerr):not(.balance) tr.total > th {
  background: var(--band-total);
  color: var(--ink);
  font-weight: 700;
  border-top: 2px solid var(--band-line);
}
td.accion .stack { display: flex; flex-direction: column; gap: 0.25rem; align-items: stretch; }
td.accion form { margin: 0; }
details.rev-group { margin: 0.7rem 0; }
details.rev-group > summary {
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}
details.rev-group table { margin-top: 0; }
.sev-alta { color: #B00000; font-weight: 700; }
.sev-media { color: #7a4e12; font-weight: 700; }
.sev-baja { color: var(--muted); }
.descuadre { color: #7a4e12; font-weight: 700; }
.empty-hint {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.flag { font-size: 0.75rem; letter-spacing: 0.04em; color: var(--ok); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; margin: 1rem 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card b { display: block; font-size: 1.45rem; color: var(--navy); letter-spacing: -0.03em; }
a.card { text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--teal); }
a.card b { font-size: 1.05rem; margin-bottom: 0.25rem; }
.home-map section { margin: 1.15rem 0 1.4rem; }
.home-map .btn { margin: 0 0.4rem 0.4rem 0; }
.neg,
b.neg,
td.neg,
th.neg,
.kpi b.neg,
.kpi em.neg,
.card b.neg { color: var(--neg); }
.dash-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.85rem 0 0.4rem;
}
.dash-tabs a {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--card);
}
.dash-tabs a.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.9rem 0 1rem;
}
.kpi-grid.lote-kpis { grid-template-columns: 1fr 1fr; }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 0.95rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.kpi > span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.kpi b {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.22rem;
  letter-spacing: -0.03em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.kpi em {
  display: block;
  margin-top: 0.15rem;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--teal-dark);
  font-weight: 600;
}
.kpi.accent { border-color: var(--teal); }
.kpi.with-ico {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.15rem 0.8rem;
}
.kpi.with-ico > span {
  flex: 1 0 100%;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--navy);
}
.kpi.with-ico b { margin: 0; font-size: 1.35rem; }
.kpi.with-ico em { margin: 0 0 0.2rem auto; font-size: 1.05rem; color: var(--muted); }
.tm-title { margin: 0 0 0.45rem; font-weight: 700; color: var(--navy); }
.treemap { display: flex; gap: 6px; height: 320px; }
.tm-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tm-block {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  font-weight: 700;
  padding: 0.45rem;
  border-radius: 4px;
  min-height: 1.8rem;
  line-height: 1.2;
}
.tm-block.blue { background: #3b6fd8; }
.tm-block.blue-2 { background: #2a549f; }
.tm-block.green { background: #2f9e6b; }
.tm-block.green-2 { background: #1f7a52; }
.tm-block.red { background: #c23b4a; }
.dash-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem 1rem;
  box-shadow: var(--shadow);
  margin: 0 0 1.2rem;
}
.dash-panel h2 { margin-top: 0; }
.dash-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 170px;
  overflow-x: auto;
}
.dash-bar-col {
  flex: 1 0 2.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 2.1rem;
}
.dash-bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  width: 100%;
  justify-content: center;
}
.dash-bar {
  width: 42%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
}
.dash-bar.in { background: var(--teal-fill); }
.dash-bar.out { background: var(--navy); }
.dash-bar-col span {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.legend { display: flex; align-items: center; gap: 0.55rem; }
.swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.2rem;
}
.swatch.in { background: var(--teal-fill); }
.swatch.out { background: var(--navy); }
.dash-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  align-items: start;
}
.dash-actions { margin-top: 1.6rem; }
.dash-actions .btn { margin-right: 0.4rem; }
.chart-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1rem;
  margin: 0 0 1.1rem;
}
.chart-grid.flip { grid-template-columns: 1fr 1.45fr; }
.chart-grid.even { grid-template-columns: 1fr 1fr; }
.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem 0.85rem;
  box-shadow: var(--shadow);
  min-height: 300px;
}
.chart-box.wide { grid-column: 1 / -1; min-height: 340px; }
.chart-box canvas { width: 100% !important; max-height: 320px; }
#chart-gastos-cuenta-box canvas { max-height: none; height: 100% !important; }
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.25rem 0.85rem;
  margin: 0.5rem 0 1rem;
  max-height: 14rem;
  overflow: auto;
  padding: 0.5rem 0.65rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.pick-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
}
.pick-grid input { width: auto; min-width: 0; }
.pick-fold { margin: 0.15rem 0 0.9rem; }
.pick-fold summary {
  cursor: pointer;
  width: fit-content;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--navy);
}
.pick-fold[open] summary { margin-bottom: 0.45rem; }
.pick-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.35rem; }
.pick-actions button {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
}
.pick-actions button:hover { background: var(--paper); color: var(--navy); }
.area-pick {
  border: 0;
  margin: 0.1rem 0 0.7rem;
  padding: 0;
}
.area-pick legend {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 0;
  margin-bottom: 0.35rem;
}
.pick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}
.pick-chips label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
}
.pick-chips input { width: auto; min-width: 0; }
.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: center;
}
.flag-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
}
.flag-row input { width: auto; min-width: 0; }
table.cuentas { table-layout: fixed; width: 100%; min-width: 76rem; }
table.cuentas col.col-code { width: 8.5rem; }
table.cuentas col.col-name { width: 18%; }
table.cuentas col.col-class { width: 12.25rem; }
table.cuentas col.col-cat { width: 42%; }
table.cuentas col.col-flags { width: 8.6rem; }
table.cuentas col.col-save { width: 13.5rem; }
table.cuentas td.cuenta-actions { white-space: nowrap; }
table.cuentas td.cuenta-actions form.inline { display: inline-flex; margin: 0 0 0 0.35rem; }
table.cuentas td, table.cuentas th { vertical-align: middle; }
table.cuentas input[type="text"],
table.cuentas select { width: 100%; max-width: none; }
table.cuentas select[name="clasificacion"] { font-size: 0.86rem; }
table.cuentas .flags {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.2rem 0.45rem;
  justify-content: start;
  white-space: normal;
}
table.cuentas .flags label {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
table.cuentas .flags input { width: auto; min-width: 0; }
table.aging { table-layout: fixed; width: 100%; min-width: 50rem; }
table.aging th, table.aging td { vertical-align: middle; }
table.aging td:first-child, table.aging th:first-child { overflow-wrap: anywhere; }
table.aging .doc { width: 7.5rem; white-space: nowrap; }
table.aging .cuenta { width: 8.75rem; white-space: nowrap; }
table.aging .dias { width: 3.25rem; white-space: nowrap; text-align: right; }
table.aging .tramo { width: 4.25rem; white-space: nowrap; }
table.aging td.num, table.aging th.num { white-space: nowrap; text-align: right; width: 8rem; }
table.aging tr.settle td { background: var(--band-hover); }
table.aging tr.settle form { margin: 0; }
#chart-gastos-cuenta-box { min-height: 280px; max-height: 420px; }
#chart-gastos-cuenta-box canvas { max-height: 400px; height: 100% !important; }
@media (max-width: 960px) {
  .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-split { grid-template-columns: 1fr; }
  .chart-grid, .chart-grid.flip, .chart-grid.even, .lote-dash { grid-template-columns: 1fr; }
  .treemap { height: auto; min-height: 240px; flex-direction: column; }
  .chart-box.wide { grid-column: auto; }
}
@media (max-width: 560px) {
  .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-4, .kpi-grid.lote-kpis { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html.nav-ready body.staff-shell,
  html.nav-ready .side,
  html.nav-ready body.staff-shell > .side { transition: none; }
}
.row-search { display: block; max-width: 18rem; margin: 0.2rem 0 0.8rem; }
.doc-btn {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--navy);
  background: #fff;
}
.doc-btn:hover { border-color: var(--teal); color: var(--teal-dark); }
tr.no-match td:first-child { box-shadow: inset 3px 0 0 var(--error); }
.dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.3rem;
  border-radius: 50%;
  background: var(--error);
  vertical-align: middle;
}
.pill {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(194, 59, 74, 0.12);
  color: var(--error);
  font-size: 0.75rem;
  font-weight: 700;
}
.filters { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: flex-end; margin: 0.6rem 0 1rem; }
.filters.same-line { flex-wrap: nowrap; }
.filters.same-line input[name="glosa"] { width: 18rem; max-width: 24rem; }
.filters.same-line .cuenta-q { width: 14rem; max-width: 18rem; }
.filters label { margin: 0; min-width: 0; }
.filters input:not([type="checkbox"]):not([type="radio"]),
.filters select { width: auto; min-width: 8rem; max-width: 18rem; }
.filters label.check,
.filters label:has(> input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-weight: 500;
}
.filters label.check input,
.filters label:has(> input[type="checkbox"]) input {
  width: auto;
  min-width: 0;
  max-width: none;
}
.filter-actions { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0 0 0.15rem; }
.param-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.6rem;
  margin: 0.5rem 0 1rem;
}
form.param-join { display: contents; }
.param-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin: 0;
  padding: 0.45rem 0.7rem 0.65rem;
  min-width: 15rem;
}
.param-box legend {
  padding: 0 0.35rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
}
.param-fields {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}
.param-fields > label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  margin: 0;
}
.param-fields > label.check,
.param-fields > label:has(> input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
}
.param-fields input:not([type="checkbox"]):not([type="radio"]),
.param-fields select {
  width: 100%;
  min-width: 12rem;
  max-width: none;
}
.param-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 0.2rem 0;
}
.cartola-avance {
  margin-left: auto;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  min-width: 11rem;
}
.cartola-avance .ring {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: conic-gradient(
    var(--ok) 0 calc(var(--done) * 1%),
    var(--teal) calc(var(--done) * 1%) calc(var(--mid) * 1%),
    var(--band-head) calc(var(--mid) * 1%) 100%
  );
  -webkit-mask: radial-gradient(circle at center, transparent 58%, #000 60%);
  mask: radial-gradient(circle at center, transparent 58%, #000 60%);
}
.cartola-avance strong { display: block; color: var(--navy); font-size: 0.95rem; line-height: 1.25; }
.cartola-avance span { color: var(--muted); font-size: 0.8rem; }
.pack-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin: 0.2rem 0 0.6rem;
}
.pack-bar p { margin: 0; margin-right: auto; }
table.asiento-lines { width: 100%; min-width: 62rem; }
table.asiento-lines,
table.asiento-lines tbody,
table.asiento-lines tr,
table.asiento-lines td { overflow: visible; }
table.asiento-lines td { vertical-align: top; }
table.asiento-lines td.cuenta { min-width: 14rem; }
table.asiento-lines td.monto { width: 8.5rem; }
table.asiento-lines td.act { width: 1%; white-space: nowrap; }
table.asiento-lines .combo-list { z-index: 30; }
.asiento-cuadre { margin: 0.35rem 0 0.8rem; font-variant-numeric: tabular-nums; }
.asiento-cuadre .bad { color: var(--neg); font-weight: 700; }
.asiento-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
label.sp-folio { display: block; max-width: 16rem; margin: 0 0 0.6rem; }
label.asiento-glosa { display: block; max-width: 42rem; margin: 0 0 0.8rem; }
label.asiento-glosa input { width: 100%; max-width: none; }
.seek-row { max-width: 28rem; margin: 0.2rem 0 0.15rem; }
.voucher-preview { margin: 0.4rem 0 1rem; }
.voucher-preview[hidden] { display: none; }
form.inline input, form.inline select { width: auto; max-width: 16rem; }
form.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 22rem));
  gap: 0.75rem 1.25rem;
  align-items: end;
  margin: 0.4rem 0 1rem;
}
form.field-grid label { margin: 0; }
form.field-grid select,
form.field-grid input:not([type="checkbox"]):not([type="radio"]) { width: 100%; max-width: none; }
table.lines td input, table.lines td select { width: 100%; max-width: none; }
table input, table select { max-width: 22rem; }
table.cols { table-layout: fixed; width: 100%; min-width: 64rem; }
table.cols col.col-code { width: 11.25rem; }
table.cols col.col-name { width: 13rem; }
table.cols col.col-area { width: 10.75rem; }
table.cols col.col-act { width: 11.5rem; }
table.cols th:nth-child(-n+3),
table.cols td:nth-child(-n+3) { font-size: 0.84rem; }
table.cols td.cc-code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.cols td:last-child { white-space: nowrap; }
table.cols td input:not([type="hidden"]) { width: 100%; max-width: none; min-width: 0; }
table.cols td .inline { display: inline-flex; }
.user-actions { white-space: nowrap; }
.user-actions > button,
.user-actions form.inline { vertical-align: middle; }
.user-actions > button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.user-actions form.inline { display: inline-flex; margin: 0 0 0 0.35rem; }
tr.user-edit td { background: #fbfcfd; }
.user-edit-panel { display: flex; flex-direction: column; gap: 0.85rem; }
.user-edit-panel form.inline label { margin: 0; }
details.disclose { margin: 0.2rem 0 1rem; }
details.disclose > summary {
  display: inline-block;
  width: auto;
  list-style: none;
  background: var(--navy);
  color: #fff;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::marker { content: ""; }
details.disclose > summary:hover { background: var(--teal-dark); }
details.disclose[open] > summary { margin-bottom: 0.85rem; }
details.disclose:not([open]) > .disclose-body { display: none; }
form.field-grid.bank-new {
  grid-template-columns: 8.5rem minmax(12rem, 15rem) minmax(12rem, 14rem) 5.25rem minmax(22rem, 1fr) auto;
}
form.field-grid.bank-new label.bank-short,
form.field-grid.bank-new label.bank-cur { min-width: 0; }
form.field-grid.bank-new label.bank-wide { min-width: 18rem; }
@media (max-width: 1100px) {
  form.field-grid.bank-new {
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  }
  form.field-grid.bank-new label.bank-short { max-width: 8.5rem; }
  form.field-grid.bank-new label.bank-cur { max-width: 5.5rem; }
  form.field-grid.bank-new label.bank-wide { grid-column: 1 / -1; min-width: 0; }
}
table.bank-edit { table-layout: fixed; width: 100%; min-width: 64rem; }
table.bank-edit col.col-bank { width: 8rem; }
table.bank-edit col.col-cur { width: 5rem; }
table.bank-edit col.col-label { width: 13.5rem; }
table.bank-edit col.col-num { width: 11.5rem; }
table.bank-edit col.col-act { width: 6.75rem; }
table.bank-edit th,
table.bank-edit td { min-width: 0; }
table.bank-edit td:nth-child(-n+2) { white-space: nowrap; }
table.bank-edit td input,
table.bank-edit td select { width: 100%; max-width: none; min-width: 0; }
table.bank-edit td:last-child { white-space: nowrap; }
input.search-field { display: block; width: 100%; max-width: none; margin: 0.35rem 0 1rem; }
dialog.doc-dialog {
  width: min(960px, 96vw);
  height: min(88vh, 900px);
  max-width: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
dialog.doc-dialog::backdrop { background: rgba(23, 35, 61, 0.55); }
.doc-dialog-bar { display: flex; justify-content: flex-end; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); }
.doc-dialog-bar button { width: auto; }
dialog.doc-dialog iframe { width: 100%; height: calc(100% - 3rem); border: 0; background: #fff; }
.banner-warn {
  background: #fff6df;
  border: 1px solid #e2c56a;
  color: var(--ink);
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
}
tr.cruce-diff td { background: #fff6df; }
table.cruce { min-width: 46rem; }
button.cruce-val {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
#cruce-dialog {
  width: min(48rem, calc(100vw - 2rem));
  max-width: none;
  padding: 1.5rem 1.8rem 1.25rem;
}
#cruce-dialog h2 { margin: 0 0 0.35rem; line-height: 1.3; }
#cruce-dialog-cuerpo p { margin: 0.7rem 0; line-height: 1.5; }
#cruce-dialog-cuerpo table { margin-top: 1rem; width: 100%; }
.token-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: center;
  margin: 0.75rem 0 1rem;
}
.token-actions form { margin: 0; }
.token-actions button { width: auto; }
tr.is-hidden { opacity: 0.55; }
table.lines td input, table.lines td select { max-width: none; }
form.compact {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.25rem;
  margin: 0.4rem 0 1.4rem;
}
form.compact label { margin: 0; color: var(--muted); }
form.compact select { width: 7.5rem; }
form.compact input[type="text"],
form.compact input:not([type]),
form.compact input[type="password"] { width: 14rem; }
form.compact label.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.45rem;
  color: var(--ink);
  font-size: 0.95rem;
}
form.compact label.check input { width: auto; min-width: 0; }
.sign-row { display: flex; gap: 4rem; margin: 2.5rem 0 1rem; }
.sign-row p { margin: 0; text-align: center; color: var(--navy); }

table.rcv { table-layout: fixed; width: 100%; min-width: 84rem; }
table.rcv col.check { width: 2.2rem; }
table.rcv col.tipo { width: 9.5rem; }
table.rcv col.rut { width: 9.2rem; }
table.rcv col.folio { width: 4.2rem; }
table.rcv col.money { width: 5.4rem; }
table.rcv.rcv-honorarios col.money { width: 6.6rem; }
table.rcv td.num .amt-name {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--muted);
}
table.rcv col.fecha { width: 6.2rem; }
table.rcv col.sgp { width: 9rem; }
table.rcv col.accion { width: 10.5rem; }
table.rcv td.accion .btn,
table.rcv td.accion button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  padding: 0.4rem 0.5rem;
}
table.rcv th, table.rcv td { vertical-align: top; }
table.rcv td.num, table.rcv th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.rcv td.tipo, table.rcv td.who {
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
}
table.rcv td.who .muted, table.rcv td.sgp { overflow-wrap: anywhere; }
table.rcv tr.rcv-fact td { padding-bottom: 0.45rem; }
table.rcv tbody.no-match tr.rcv-fact td:first-child { box-shadow: inset 3px 0 0 var(--error); }
table.rcv tbody:hover tr:not(.total):not(.subtotal):not(.section) td { background: var(--band-hover); }
.rcv-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
}
table.rcv .rcv-tools form.inline {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
}
table.rcv form.rcv-link input,
table.rcv form.rcv-book select,
table.rcv form.rcv-book input:not([type="hidden"]) {
  width: auto;
  min-width: 0;
  max-width: none;
}
table.rcv form.rcv-link input { width: 11rem; }
table.rcv form.rcv-book select { width: 12rem; }
table.rcv form.rcv-book input:not([type="hidden"]) { width: 16rem; }
table.rcv .rcv-tools button { white-space: nowrap; }
.informe-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 0 0 0.9rem;
}
.informe-id p { margin: 0; line-height: 1.35; color: var(--ink); }
.informe-name { font-weight: 600; }
.informe-logo { width: 148px; height: auto; margin-left: auto; }
table.libro tr.section > td,
table.libro tr.subtotal > :is(th, td):first-child,
table.libro tr.total > :is(th, td):first-child { white-space: nowrap; }
table.libro { table-layout: fixed; width: 100%; min-width: 64rem; }
table.libro col.fecha { width: 5.8rem; }
table.libro.libro-honorarios col.fecha { width: 6.2rem; }
table.libro.libro-honorarios col.folio { width: 4.6rem; }
table.libro.libro-honorarios col.rut { width: 9.2rem; }
table.libro.libro-honorarios col.money { width: 5.4rem; }
table.libro.libro-honorarios th.fecha,
table.libro.libro-honorarios td.fecha { min-width: 0; }
table.libro.libro-honorarios td.who {
  overflow-wrap: normal;
  word-break: normal;
}
table.libro col.folio { width: 8.2rem; }
table.libro col.rut { width: 11rem; }
table.libro col.tipo { width: 9rem; }
table.libro col.cuenta { width: 14rem; }
table.libro col.money { width: 5.6rem; }
table.libro.libro-compras col.money { width: 7.2rem; }
table.libro col.estado { width: 8.5rem; }
table.libro td.folio, table.libro th.folio {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
tr.apertura-gap td { background: #fff4d6; color: #6a4b00; }
table.libro td.rut, table.libro th.rut {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
table.libro th, table.libro td { vertical-align: top; }
table.libro td.num, table.libro th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.libro td.tipo, table.libro td.who {
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
}
table.libro td.who .muted { overflow-wrap: anywhere; }
table.libro tr.libro-fact td { border-bottom: 0; padding-bottom: 0.2rem; }
table.libro tr.libro-fact:last-child td { border-bottom: 1px solid var(--line); }
table.libro tr.libro-do td { padding-top: 0.15rem; background: #fff; }
table.libro tbody:hover tr:not(.total):not(.subtotal):not(.section):not(.account-head):not(.group-head) td { background: var(--band-hover); }
.param-fields.bank-pick {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(4, auto);
  gap: 0.2rem 1.2rem;
  justify-content: start;
}
.param-fields.bank-pick label.check { margin: 0; }
table.aging { table-layout: fixed; width: 100%; }
table.aging col.pick { width: 1.8rem; }
table.aging col.fecha { width: 6.2rem; }
table.aging col.rut { width: 9.2rem; }
table.aging col.tipo { width: 8rem; }
table.aging col.doc { width: 5rem; }
table.aging col.dias { width: 3.2rem; }
table.aging col.money { width: 6.4rem; }
table.aging col.accion { width: 7rem; }
table.aging td.pick, table.aging th.pick { padding-left: 0.3rem; padding-right: 0.2rem; }
table.aging td.who { white-space: normal; overflow-wrap: anywhere; }
table.analisis { table-layout: fixed; width: 100%; min-width: 72rem; }
table.analisis col.fecha { width: 7.4rem; }
table.analisis col.comprobante { width: 5rem; }
table.analisis th.comprobante,
table.analisis td.comprobante { white-space: nowrap; }
table.analisis col.cuenta { width: 16rem; }
table.analisis col.doc { width: 6.5rem; }
table.analisis col.money { width: 8.4rem; }
table.analisis td.glosa,
table.analisis tr.section > td,
table.analisis tr.account-head > td,
table.analisis tr.group-head > td,
table.analisis tr.subtotal > td:not(.num) {
  white-space: normal;
  overflow-wrap: anywhere;
}
table.analisis:not(.analisis-cc) col.fecha { width: 6.4rem; }
table.analisis:not(.analisis-cc) col.cuenta { width: 15rem; }
table.analisis:not(.analisis-cc) col.doc { width: 6.5rem; }
table.analisis:not(.analisis-cc) th.fecha,
table.analisis:not(.analisis-cc) td.fecha,
table.analisis:not(.analisis-cc) th.cuenta,
table.analisis:not(.analisis-cc) td.cuenta {
  font-size: 0.78rem;
  min-width: 0;
}
table.analisis:not(.analisis-cc) td.cuenta,
table.analisis:not(.analisis-cc) th.cuenta { white-space: normal; }
table.analisis:not(.analisis-cc) td.cuenta span.cuenta { white-space: nowrap; }
table.analisis:not(.analisis-cc) td.doc { overflow-wrap: anywhere; }
table.analisis:not(.analisis-cc) td.glosa,
table.analisis:not(.analisis-cc) th.glosa { overflow-wrap: break-word; }
table.analisis-cc { min-width: 64rem; }
table.analisis-cc col.cc { width: 8rem; }
table.analisis-cc col.glosa { width: auto; }
.libro-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  align-items: center;
}
table.libro .libro-tools form.inline { margin: 0; }
table.libro .libro-tools select { width: 11rem; }
table.libro .libro-tools input:not([type="hidden"]) { width: 8.5rem; }
table.fichas { min-width: 76rem; }
table.fichas th.fit, table.fichas td.fit { white-space: nowrap; }
table.fichas th:nth-child(2), table.fichas td:nth-child(2) { min-width: 16rem; }
table.fichas th:last-child, table.fichas td:last-child { white-space: nowrap; }
.combo { position: relative; display: block; }
label .combo input, td .combo input { width: 100%; }
.combo-list {
  position: absolute;
  z-index: 6;
  left: 0;
  top: calc(100% + 2px);
  min-width: 22rem;
  max-height: 16rem;
  overflow: auto;
  margin: 0;
  padding: 0.2rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.combo-list li.muted { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
.combo-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font-weight: 500;
  padding: 0.35rem 0.6rem;
}
.combo-list button:hover,
.combo-list button.on { background: var(--wash); }
table.lines th.detalle,
table.lines td.detalle { width: 34%; min-width: 14rem; }
table.asiento-lines th.detalle,
table.asiento-lines td.detalle { width: auto; min-width: 8rem; }
table.lines tfoot th { text-align: right; font-variant-numeric: tabular-nums; }
.pesos-preview {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pesos-preview[hidden] { display: none; }
form.inline { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
form.inline select, form.inline input:not([type="checkbox"]):not([type="radio"]) { width: auto; min-width: 7rem; max-width: 16rem; }
form.inline button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
form.payer { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.45rem; }
form.payer input[type="text"] { width: 11rem; max-width: 100%; }
form.payer select { width: auto; min-width: 14rem; max-width: 28rem; }
form.payer button { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
form.payer label.check { display: flex; align-items: center; gap: 0.35rem; margin: 0; font-size: 0.85rem; color: var(--ink); }
form.payer label.check input { width: auto; min-width: 0; }
@media (max-width: 560px) {
  form.payer { align-items: stretch; }
  form.payer input[type="text"], form.payer select { width: 100%; min-width: 0; max-width: 100%; }
}
.sp-hint { font-size: 0.8rem; color: var(--muted); }
.sp-warn { font-size: 0.8rem; color: var(--error); }
tfoot th, tfoot td { font-weight: 600; }

/* Login — split from the branding board */
body.login-page { background: var(--card); }
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 4rem;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.login-form .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 2.2rem;
}
.login-form .wordmark img { height: 42px; }
.login-form h1 { font-size: 1.8rem; margin: 0 0 0.35rem; }
.login-form .lead { margin: 0 0 1.6rem; color: var(--muted); }
.login-form button { width: 100%; padding: 0.7rem 1rem; margin-top: 0.8rem; }
.login-panel {
  position: relative;
  background: var(--navy);
  overflow: hidden;
}
.login-panel::before,
.login-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.login-panel::before {
  width: 140%;
  height: 90%;
  right: -35%;
  top: -10%;
  background: linear-gradient(160deg, rgba(88, 201, 185, 0.62) 0%, rgba(88, 201, 185, 0.22) 48%, transparent 62%);
  clip-path: polygon(28% 0, 100% 0, 100% 100%, 0 72%);
}
.login-panel::after {
  width: 48%;
  aspect-ratio: 1;
  right: 8%;
  bottom: 16%;
  background: rgba(255, 255, 255, 0.08);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.login-copy {
  position: absolute;
  z-index: 1;
  left: 2.6rem;
  right: 2.6rem;
  bottom: 2.8rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.7rem;
  max-width: 24rem;
}
.login-panel .motto {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.5;
}
.login-panel .motto span + span::before {
  content: "·";
  margin: 0 0.95rem;
  letter-spacing: 0;
  color: #fff;
}
.login-panel .caption {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.5;
  max-width: 17rem;
}
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-panel { min-height: 300px; }
  .login-form { padding: 2rem 1.4rem; }
  .login-copy { left: 1.4rem; right: 1.4rem; bottom: 1.6rem; gap: 1.05rem; }
  .login-panel .caption { font-size: 1.05rem; }
  header.app .switcher { margin-left: 0; }
}

.reparto { display: flex; flex-direction: column; gap: 0.55rem; margin: 0.4rem 0 0.8rem; }
.split-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem 0.55rem;
  align-items: flex-end;
}
.split-row label { margin: 0; min-width: 0; }
.split-row label.grow { flex: 1 1 14rem; }
.split-row label.amt { flex: 0 0 8.5rem; }
.split-row label.split-cc-label { flex: 0 1 11rem; }
.split-row select,
.split-row input {
  width: 100%;
  max-width: none;
  min-width: 0;
}
form.sp-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.55rem;
  margin: 0.2rem 0 0.9rem;
}
form.sp-line label { flex: 1 1 auto; margin: 0; min-width: 0; }
form.sp-line input { width: 100%; max-width: none; }
form.sp-line button { flex: 0 0 auto; white-space: nowrap; }
button.detalle, button.quiet {
  width: auto;
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
button.detalle {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}
button.quiet { font-size: 0.85rem; padding: 0.35rem 0.7rem; }
button.detalle:hover, button.quiet:hover { background: #f4f7f9; color: var(--navy); }
label.glosa-line input { width: 100%; max-width: none; }
ul.asiento-fijo { list-style: none; margin: 0.6rem 0; padding: 0; }
ul.asiento-fijo li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line);
}
ul.asiento-fijo li span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
dialog.detalle-dialog {
  width: min(28rem, 92vw);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: var(--card);
}
dialog.detalle-dialog::backdrop { background: rgba(23, 35, 61, 0.55); }
dialog.detalle-dialog textarea { width: 100%; max-width: none; }

.clase-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.2rem 0 1rem; }
.chip {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.badge {
  display: inline-block;
  margin-top: 0.15rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge.memoria { background: #e7f8f5; color: var(--teal-dark); }
.badge.ia { background: #e7eef8; color: #1d4e89; }
.badge.sin { background: #fff4e5; color: #9a5b00; }

.workspace:has(main.bandeja) { min-height: 100vh; }
main.bandeja {
  max-width: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem 1rem;
}
.review {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 0.78fr);
  gap: 0.8rem;
  min-height: 0;
  flex: 1;
}
.review-doc, .review-side {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 70vh;
}
.review-doc iframe {
  width: 100%;
  height: 68vh;
  border: 0;
  border-radius: var(--radius);
  background: var(--wash);
}
.review-side { padding: 1rem 1.1rem 1.2rem; overflow: auto; }
.review-side select { max-width: none; }
.review-side .memorize {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--ink);
}
.review-side .memorize input { width: auto; max-width: none; margin-top: 0.2rem; }
.review-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
}
table.asiento { width: 100%; }
table.asiento th, table.asiento td { text-align: left; }
table.asiento td:nth-child(n+2), table.asiento th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
table.mayor { table-layout: fixed; width: 100%; min-width: 70rem; }
table.mayor col.m-fecha { width: 8.4rem; }
table.mayor col.m-tipo { width: 5.8rem; }
table.mayor col.m-num { width: 4.2rem; }
table.mayor col.m-rut { width: 8.4rem; }
table.mayor col.m-razon { width: 12rem; }
table.mayor col.m-det { width: 14%; }
table.mayor col.m-money { width: 7.8rem; }
table.mayor th.num, table.mayor td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.mayor td.m-fecha, table.mayor td.fecha, table.mayor th.fecha, table.mayor td.m-num { white-space: nowrap; }
table.mayor td.m-text { overflow-wrap: anywhere; }
table.mayor tr.mayor-account td { font-weight: 700; background: #f4f7f9; }
table.mayor tr.mayor-total td { font-weight: 700; border-top: 1px solid var(--ink); }
@page voucher { size: A4 landscape; margin: 10mm; }
main.voucher-page { page: voucher; }
.voucher-sheet { margin-top: 0.4rem; }
.voucher-head { margin-bottom: 1rem; }
.voucher-company { font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; margin: 0; }
.voucher-head h1 { text-align: center; font-size: 1.15rem; letter-spacing: 0.04em; margin: 1.1rem 0 0.4rem; }
.voucher-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(8rem, 0.7fr) minmax(8rem, 0.8fr);
  gap: 0.8rem 1.2rem;
  margin: 0 0 1rem;
}
.voucher-meta b { display: block; font-size: 0.78rem; color: var(--muted); }
.voucher-meta span { display: block; }
table.voucher-lines { font-size: 0.78rem; }
table.voucher-lines td, table.voucher-lines th { padding: 0.28rem 0.4rem; }
table.voucher-lines td.num, table.voucher-lines th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.voucher-signs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-top: 3.2rem;
  text-align: center;
  break-inside: avoid;
}
.sign-line { display: block; border-bottom: 1px solid var(--ink); height: 2.2rem; margin: 0 1rem 0.35rem; }
.voucher-signs p, .voucher-retire p { margin: 0.15rem 0; }
.voucher-retire {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 2rem;
  margin-top: 1.8rem;
  break-inside: avoid;
}
.fill { display: inline-block; min-width: 12rem; border-bottom: 1px solid var(--ink); }
.no-print a { margin-left: 0.8rem; }
@media print {
  .no-print, .side, .topbar, .menu-btn, .ayuda { display: none !important; }
  body.staff-shell { display: block !important; background: #fff; }
  main { max-width: none !important; padding: 0 !important; }
  table, .voucher-sheet { box-shadow: none; }
}
details.row-menu { position: relative; display: inline-block; }
details.row-menu > summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  border: 1px solid var(--line, #d5dde8);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  background: #fff;
}
details.row-menu > summary::-webkit-details-marker { display: none; }
details.row-menu[open] > summary { background: #f4f7fb; }
details.row-menu .row-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 8;
  width: 20rem;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100vh - 1rem);
  overflow: auto;
  margin: 0;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid #d5dde8;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: stretch;
}
details.row-menu .row-menu-panel form.inline {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
}
details.row-menu .row-menu-panel form.rcv-book select,
details.row-menu .row-menu-panel form.rcv-book input:not([type="hidden"]),
details.row-menu .row-menu-panel form.rcv-link input {
  width: 100%;
  min-width: 0;
  max-width: none;
}
details.row-menu .row-menu-panel.is-fixed {
  position: fixed;
  right: auto;
  top: auto;
  bottom: auto;
  z-index: 40;
}
table.rcv td.accion { position: relative; overflow: visible; }
@media (max-width: 960px) {
  .review { grid-template-columns: 1fr; }
  .review-doc, .review-side { min-height: 0; }
  .review-doc iframe { height: 50vh; }
  form.sp-line, .split-row { flex-wrap: wrap; }
}

.wait-veil {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 35, 61, 0.45);
}
.wait-veil[hidden] { display: none; }
.wait-card {
  width: min(28rem, 92vw);
  padding: 1.2rem 1.4rem;
  background: #fff;
  border-radius: 12px;
  color: var(--ink);
}
.wait-title { margin: 0 0 0.35rem; font-weight: 600; color: var(--navy); }
.wait-stage { margin: 0 0 0.8rem; color: var(--muted); }
.wait-bar { height: 8px; background: var(--wash); border-radius: 999px; overflow: hidden; }
.wait-bar span { display: block; height: 100%; width: 0; background: #1aa89a; }
.wait-bar span.indeterminate { width: 40%; animation: wait-slide 1.1s ease-in-out infinite; }
@keyframes wait-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.ayuda { position: fixed; right: 0.85rem; bottom: 0.85rem; z-index: 40; }
.ayuda.placed { right: auto; bottom: auto; }
.ayuda-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  background: transparent;
  color: var(--navy);
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.ayuda.dragging .ayuda-open { cursor: grabbing; }
.ayuda-open:hover,
.ayuda-open:focus {
  background: transparent;
  color: var(--teal-dark);
}
.ayuda-open:focus-visible {
  outline: 2px solid var(--teal-dark);
  outline-offset: 3px;
  border-radius: 12px;
}
.ayuda-open img {
  display: block;
  width: 5.6rem;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 8px 12px rgba(23, 35, 61, 0.22));
}
.ayuda-open span {
  transform: translateX(-0.31rem);
}
.ayuda-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  width: min(28rem, 92vw);
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.ayuda.panel-below .ayuda-panel { top: calc(100% + 0.45rem); bottom: auto; }
.ayuda.panel-left .ayuda-panel { left: 0; right: auto; }
.ayuda-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ayuda-head img {
  width: 4.4rem;
  height: auto;
  flex: none;
}
.ayuda-panel[hidden] { display: none; }
.ayuda-panel button { margin-top: 0.6rem; }
.ayuda-title { margin: 0 0 0.35rem; color: var(--navy); font-weight: 600; }
.ayuda-head .ayuda-title { margin: 0 0 0.2rem; }
.ayuda-head .muted { margin: 0; }
.ayuda-log { max-height: 22rem; overflow: auto; margin: 0.6rem 0; }
.ayuda-log p { margin: 0.35rem 0; }
.ayuda-log .ayuda-go { display: block; width: fit-content; margin: 0.45rem 0 0.15rem; }
.ayuda-panel textarea { width: 100%; max-width: none; }
fieldset.theme-choice {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 1rem 0 0.4rem;
  padding: 0.35rem 0.9rem 0.7rem;
  max-width: 28rem;
}
fieldset.theme-choice legend {
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
fieldset.theme-choice .muted { margin: 0.2rem 0 0.15rem; }
form.perfil { flex-direction: column; align-items: stretch; max-width: 52rem; }
.perfil-cuenta,
.perfil-opciones { display: flex; flex-wrap: wrap; gap: 0.85rem 1.25rem; }
.perfil-cuenta { align-items: flex-end; }
.perfil-opciones { align-items: flex-start; }
form.perfil fieldset.theme-choice { margin: 0; max-width: none; }
form.perfil .perfil-opciones fieldset.theme-choice:first-child { flex: 0 1 16rem; }
form.perfil .perfil-opciones fieldset.theme-choice:last-child { flex: 1 1 26rem; }
.sumi-choice { display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: flex-end; }
.sumi-choice label { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; width: 6.6rem; text-align: center; }
.sumi-choice img { width: 4.8rem; height: 5.4rem; object-fit: contain; object-position: center bottom; background: transparent; }

/* Light: same layout, warmer colors, no strong blue. Original stays on :root. */
html[data-theme="light"] {
  --navy: #4e5c56;
  --teal: #2b564c;
  --teal-fill: #8aa399;
  --teal-dark: #23483f;
  --paper: #f7f4ef;
  --card: #fffdfb;
  --ink: #2e3330;
  --muted: #5f675f;
  --line: #e4ddd4;
  --accent: #7f978d;
  --ok: #2b564c;
  --grafito: #5f675f;
  --shadow: 0 10px 30px rgba(62, 52, 40, 0.08);
  --heading: #5e584f;
  --band-soft: #f4f1eb;
  --band-soft-2: #f3efe8;
  --band-section: #efe8de;
  --band-head: #e3dbd0;
  --band-total: #d2c6b8;
  --band-line: #6d675f;
  --band-hover: #faf8f5;
  --band-hover-2: #faf8f5;
  --row-on: #f3efe8;
  --wash: #f3efe8;
  --placeholder: #6a655c;
  --chrome: #f3f0ea;
  --chrome-ink: #2e3330;
  --chrome-muted: rgba(46, 51, 48, 0.72);
  --chrome-faint: rgba(46, 51, 48, 0.48);
  --chrome-line: rgba(46, 51, 48, 0.16);
  --chrome-hover: rgba(46, 51, 48, 0.06);
  --chrome-on: rgba(43, 86, 76, 0.14);
}
html[data-theme="light"] .side,
html[data-theme="light"] .side-user,
html[data-theme="light"] .topbar {
  background: var(--chrome);
  color: var(--chrome-ink);
}
html[data-theme="light"] .side-user { border-top-color: var(--line); }
html[data-theme="light"] .side .wordmark .wm-dark { display: none; }
html[data-theme="light"] .side .wordmark .wm-light { display: block; }
html[data-theme="light"] .side .brand,
html[data-theme="light"] .side-user .side-fold > summary,
html[data-theme="light"] .side-link,
html[data-theme="light"] .side-user .side-link,
html[data-theme="light"] .side-fold summary,
html[data-theme="light"] .side-logout,
html[data-theme="light"] .side-label,
html[data-theme="light"] .menu-btn,
html[data-theme="light"] .company-chip,
html[data-theme="light"] .quotes,
html[data-theme="light"] .switcher select,
html[data-theme="light"] .topbar button {
  color: var(--chrome-ink);
}
html[data-theme="light"] .quotes,
html[data-theme="light"] .side-link,
html[data-theme="light"] .side-logout,
html[data-theme="light"] .side-user .side-link { color: var(--chrome-muted); }
html[data-theme="light"] .side-label { color: var(--chrome-faint); }
html[data-theme="light"] .side nav .side-fold > summary,
html[data-theme="light"] .side nav > a.side-direct,
html[data-theme="light"] .side-group h2,
html[data-theme="light"] .side-mobile h2,
html[data-theme="light"] .top-menu > summary,
html[data-theme="light"] .side-link.on,
html[data-theme="light"] .side nav > a.side-direct.on,
html[data-theme="light"] .side-user .side-link.on { color: var(--teal); }
html[data-theme="light"] .side-link.on,
html[data-theme="light"] .side nav > a.side-direct.on,
html[data-theme="light"] .side-user .side-link.on,
html[data-theme="light"] .role-chip {
  background: var(--chrome-on);
  color: var(--teal);
}
html[data-theme="light"] .side-link:hover,
html[data-theme="light"] .side-logout:hover,
html[data-theme="light"] .side-user .side-link:hover,
html[data-theme="light"] .side-user .side-fold summary:hover,
html[data-theme="light"] .side-fold summary:hover,
html[data-theme="light"] .menu-btn:hover {
  color: var(--chrome-ink);
  background: var(--chrome-hover);
}
html[data-theme="light"] .side nav .side-fold > summary:hover,
html[data-theme="light"] .side nav > a.side-direct:hover,
html[data-theme="light"] .top-menu > summary:hover,
html[data-theme="light"] .top-menu[open] > summary {
  background: var(--chrome-hover);
  color: var(--teal);
}
html[data-theme="light"] .side-user .side-fold > summary::after {
  border-color: var(--chrome-ink) transparent transparent transparent;
}
html[data-theme="light"] .side-user .side-fold[open] > summary::after {
  border-color: transparent transparent var(--chrome-ink) transparent;
}
html[data-theme="light"] .side-fold summary::after {
  border-color: var(--chrome-faint) transparent transparent transparent;
}
html[data-theme="light"] .side nav .side-fold > summary::after {
  border-color: var(--teal) transparent transparent transparent;
}
html[data-theme="light"] .side nav .side-fold[open] > summary::after {
  border-color: transparent transparent var(--teal) transparent;
}
html[data-theme="light"] .company-chip,
html[data-theme="light"] .switcher select {
  background: var(--card);
  border-color: var(--line);
  color: var(--chrome-ink);
}
html[data-theme="light"] .menu-btn,
html[data-theme="light"] .topbar button {
  background: transparent;
  border-color: var(--chrome-line);
  color: var(--chrome-ink);
}
html[data-theme="light"] .topbar button:hover {
  background: transparent;
  border-color: var(--teal);
  color: var(--teal);
}
html[data-theme="light"] .tm-block.blue { background: #3f524c; }
html[data-theme="light"] .tm-block.blue-2 { background: #31423d; }
html[data-theme="light"] .badge.ia { background: var(--wash); color: var(--teal); }
html[data-theme="light"] p.ok { background: #f3f6f2; border-color: #d5e0d6; }
html[data-theme="light"] details.row-menu[open] > summary { background: var(--wash); }
html[data-theme="light"] .wait-bar span { background: var(--teal-fill); }
html[data-theme="light"] table.balance thead th.pin.name,
html[data-theme="light"] table.balance tbody td.pin.name,
html[data-theme="light"] table.eerr.split thead th:first-child,
html[data-theme="light"] table.eerr.split tbody td:first-child {
  box-shadow: 8px 0 8px -8px rgba(62, 52, 40, 0.22);
}
table.relacionadas { width: max-content; min-width: 100%; border-collapse: collapse; }
table.relacionadas th,
table.relacionadas td { vertical-align: top; }
table.relacionadas thead th { background: var(--band-head); color: var(--ink); font-weight: 700; white-space: nowrap; }
table.relacionadas col.empresa { width: 16rem; }
table.relacionadas col.rut { width: 8.6rem; }
table.relacionadas col.cuentas { width: 24rem; }
table.relacionadas col.money { width: 8.4rem; }
table.relacionadas col.ingreso { width: 7.2rem; }
table.relacionadas th.num,
table.relacionadas td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.relacionadas td.rut,
table.relacionadas th.rut { white-space: nowrap; }
table.relacionadas .rel-code { font-weight: 700; margin-right: 0.4rem; }
table.relacionadas .rel-out { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
table.relacionadas td.rel-cuentas > span { display: block; line-height: 1.35; }
table.relacionadas td.rel-cuentas .cuenta {
  display: inline;
  margin-right: 0.35rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.relacionadas tbody tr:hover td { background: var(--band-hover); }
table.relacionadas tr.total td { font-weight: 700; background: var(--band-total); border-top: 2px solid var(--band-line); }
table.relacionadas tr.total:hover td { background: var(--band-total); }
table.relacionadas td.ingreso { white-space: nowrap; }
