@font-face {
  font-family: Atkinson; font-weight: 200 800; font-display: swap;
  src: url(/fuentes/atkinson-hyperlegible-next-latin-wght-normal.woff2) format('woff2');
}
:root {
  /* light-dark(claro, oscuro): lo decide color-scheme. */
  color-scheme: light dark;
  --tinta: light-dark(#17323b, #e3edef); --tenue: light-dark(#52686f, #a3b8be);
  --fondo: light-dark(#dfe8ea, #132025); --papel: light-dark(#fff, #20323a); --linea: light-dark(#b3c4c9, #4a626b);
  --accion: light-dark(#1c4b5a, #93cfde); --boton: light-dark(#1c4b5a, #2a6b7e); --cabecera: light-dark(#1c4b5a, #0b1519);
  --peligro: light-dark(#a3202c, #b32a37);
  --mal: light-dark(#a3202c, #ffb1b5); --mal-fondo: light-dark(#f9e1e2, #54232a);
  --bien: light-dark(#17633f, #a5e3c1); --bien-fondo: light-dark(#d9efe2, #1b4532);
  --ojo: light-dark(#6b4a00, #f5d98b); --ojo-fondo: light-dark(#fbeec2, #4b3b12);
}
[data-tema=claro] { color-scheme: light; }
[data-tema=oscuro] { color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font: 1.0625rem/1.5 Atkinson, system-ui, sans-serif; }
main { max-width: 68rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 1.25rem; font-weight: 700; }
h2 { font-size: 1.375rem; margin: 0 0 .75rem; }
h3 { font-size: 1.0625rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; max-width: 70ch; }
a { color: var(--accion); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #e08a00; outline-offset: 2px; }
small { color: var(--tenue); font-size: .9375rem; font-weight: 400; }

/* Menú: lateral fijo en pantallas anchas, desplegable desde la barra superior en las estrechas. */
.barra { background: var(--cabecera); color: #fff; }
.menu { background: var(--cabecera); color: #fff; border: 0; margin: 0; padding: 1rem 0; width: 15rem; overflow-y: auto; }
.menu nav, .sesion { display: grid; }
.menu a, .menu .enlace { color: #fff; text-decoration: none; padding: .7rem 1.25rem; min-height: 2.75rem; display: block; width: 100%; text-align: left; overflow-wrap: anywhere; }
.menu a:hover, .menu .enlace:hover { text-decoration: underline; }
.menu nav [aria-current] { background: var(--fondo); color: var(--tinta); font-weight: 700; }
.sesion { margin-top: auto; padding-top: 1rem; }
.abrir { background: none; display: flex; align-items: center; gap: .6rem; padding: .6rem 1.25rem; min-height: 3.25rem; }
@media (min-width: 60rem) {
  body:has(> .barra) { display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
  main { width: 100%; }
  .menu { display: flex; flex-direction: column; position: sticky; inset: 0 auto auto 0; height: 100vh; max-height: none; }
  .abrir, .menu .cerrar { display: none; }
}
@media (max-width: 59.99rem) {
  .barra { position: sticky; top: 0; z-index: 1; }
  .menu { position: fixed; inset: 0 auto 0 0; width: min(18rem, 85vw); height: 100vh; height: 100dvh; max-height: none; }
  .menu:popover-open { display: flex; flex-direction: column; }
  .menu::backdrop { background: #0009; }
}

.pestanas { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.pestanas a { padding: .45rem 1rem; border: 1px solid var(--accion); border-radius: 99px; text-decoration: none; }
.pestanas [aria-current] { background: var(--boton); color: #fff; }

button, .boton { font: inherit; font-weight: 700; color: #fff; background: var(--boton); border: 0; border-radius: 6px; padding: .6rem 1.25rem; min-height: 2.75rem; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .boton:hover { filter: brightness(1.2); }
button:disabled { opacity: .55; cursor: wait; }
button.peligro { background: var(--peligro); width: 100%; }
button.suave { background: none; color: var(--accion); border: 1px solid var(--accion); }
button.enlace { background: none; font-weight: 400; border-radius: 0; }
button.rojo { color: var(--mal); text-decoration: underline; padding-left: 0; }

.campo { display: grid; gap: .3rem; font-weight: 700; align-content: start; }
input, select, textarea { font: inherit; font-weight: 400; color: inherit; background: var(--papel); border: 1px solid #6d858c; border-radius: 6px; padding: .5rem .7rem; width: 100%; min-height: 2.75rem; min-width: 0; }
[type=checkbox], [type=radio] { width: 1.25rem; height: 1.25rem; min-height: 0; margin: .15rem 0 0; accent-color: var(--accion); flex: none; }
.opcion { display: flex; gap: .7rem; padding: .45rem 0; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: .25rem; }

.busqueda { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; margin-bottom: 1.75rem; }
.busqueda .campo { flex: 0 1 13rem; }
.busqueda .campo:has([name=anio]) { flex-basis: 6.5rem; }

.nota { max-width: 46rem; padding: .7rem 1rem; border-radius: 6px; margin-bottom: .75rem; }
.mal { background: var(--mal-fondo); color: var(--mal); }
.bien { background: var(--bien-fondo); color: var(--bien); }
.ojo { background: var(--ojo-fondo); color: var(--ojo); }
.vacio { font-size: 1.1875rem; padding: 1.5rem 0; }

/* El ticket, como sale de la impresora: papel con el borde cortado. */
.caso { display: grid; grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); gap: 2.5rem; align-items: start; margin-bottom: 3rem; }
.recibo {
  background: var(--papel); padding: 1.75rem 1.5rem 2.5rem; font-variant-numeric: tabular-nums;
  --d: 12px; mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% 100% / var(--d) 51% repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--d)) no-repeat;
}
.recibo h2 { font-size: 1.75rem; }
.recibo dl, .recibo table { margin: 0 0 1rem; width: 100%; }
.recibo dl div, .cobro { display: flex; justify-content: space-between; gap: 1rem; }
.recibo dt { color: var(--tenue); }
.recibo dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.recibo table { border-collapse: collapse; border-block: 2px dashed var(--linea); }
.recibo th, .recibo td { text-align: left; padding: .35rem 0; vertical-align: top; }
.recibo thead th { font-weight: 400; color: var(--tenue); }
.recibo tfoot { font-size: 1.25rem; font-weight: 700; }
.recibo .num { text-align: right; padding-left: .75rem; white-space: nowrap; }
.recibo .cobro { margin: 0; }
.tacha h2, .tacha tbody td, .tacha tfoot td, .tacha .cobro { text-decoration: line-through; text-decoration-color: var(--mal); text-decoration-thickness: 2px; }
.cambia { background: var(--mal-fondo); color: var(--mal); font-weight: 700; padding: .05rem .5rem; border-radius: 4px; white-space: nowrap; }
.panel .campo { margin-bottom: 1rem; }
.impagadas .ancho { margin-bottom: 1rem; }
.impagadas .num { text-align: right; white-space: nowrap; }
.impagadas td small { display: block; }
.impagadas td .nota { margin: .35rem 0 0; padding: .3rem .6rem; }
.impagadas tr:has(:checked) td { background: var(--mal-fondo); }
.impagadas .panel { max-width: 30rem; }
.destino { margin-top: .75rem; }

.ficha { background: var(--papel); padding: 1.75rem; border-radius: 10px; display: grid; gap: 1.25rem; max-width: 46rem; }
.ficha > * { margin: 0; }
.ficha > button { justify-self: start; }
.estrecha { max-width: 25rem; margin: 8vh auto 0; }
.estrecha h1 { font-size: 1.625rem; }
.fila { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.crece { flex: 1 1 14rem; }
.corto { flex: 0 1 7rem; }
.acciones { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; margin-top: 1.5rem; }
.ficha .acciones { margin: 0; }
.eliminar { margin-top: 1.5rem; }
.titular { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 0 1rem; margin-bottom: 1rem; }

.ancho { overflow-x: auto; }
.lista { border-collapse: collapse; width: 100%; background: var(--papel); font-variant-numeric: tabular-nums; }
.lista th, .lista td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--fondo); vertical-align: top; }
.lista th { color: var(--tenue); font-weight: 400; white-space: nowrap; }
.estado { white-space: nowrap; font-weight: 700; }
.estado.ok { color: var(--bien); } .estado.error { color: var(--tenue); } .estado.revisar { color: var(--mal); } .estado.pendiente { color: var(--ojo); }
.datos div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); padding: .25rem 0; }
.datos dt { color: var(--tenue); } .datos dd { margin: 0; overflow-wrap: anywhere; }
.persona { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: end; padding: 1rem 0; border-bottom: 1px solid var(--linea); margin: 0; max-width: none; }
.persona > strong { flex: 1 1 9rem; align-self: center; overflow-wrap: anywhere; }
.persona + .ficha { margin-top: 2rem; }

@media (max-width: 46rem) {
  .caso { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .busqueda .campo, .busqueda button { flex: 1 1 100%; }
  .datos div { grid-template-columns: 1fr; }
  main { padding: 1.25rem 1rem 3rem; }
  h1 { font-size: 1.625rem; }
  .ficha { padding: 1.25rem; }
  .persona .campo, .persona button { flex: 1 1 100%; }

  /* Cada fila pasa a ser una tarjeta, para no tener que desplazarse de lado. */
  .apilada, .apilada tbody, .apilada td { display: block; }
  .apilada thead { display: none; }
  .apilada tr { display: block; padding: .75rem 1rem; border-bottom: 2px solid var(--fondo); }
  .apilada td { border: 0; padding: .15rem 0; overflow-wrap: anywhere; }
  .apilada td:empty { display: none; }
  .apilada [data-t]::before { content: attr(data-t) ': '; color: var(--tenue); }
  .impagadas .apilada tr { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0 .5rem; }
  .impagadas .apilada td:empty { display: block; }
  .impagadas .apilada td:nth-child(3) { grid-area: 2 / 2 / 3 / 4; }
  .impagadas .apilada tr:has(:checked) { background: var(--mal-fondo); }
  .impagadas .apilada td label { display: block; padding-bottom: .35rem; }
}
