:root {
  --verde: #1f6f43; --verde-osc: #17553a; --verde-claro: #e3f1e8;
  --rojo: #b42318; --rojo-claro: #fde8e7; --ambar: #fff4c2;
  --texto: #1d2420; --suave: #5f6b64; --borde: #d9e0dc;
  --fondo: #f4f6f5; --tarjeta: #ffffff;
  --radio: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --verde: #3fa56c; --verde-osc: #2f8a57; --verde-claro: #1d3327;
    --rojo: #f0857a; --rojo-claro: #3a1f1d; --ambar: #3a3420;
    --texto: #e7ece9; --suave: #9aa8a0; --borde: #2c3530;
    --fondo: #121614; --tarjeta: #1a201d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--verde); }
h1 { font-size: 1.35rem; margin: .4rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
small { color: var(--suave); display: block; font-size: .8rem; }

/* Barra superior */
.barra { background: var(--verde); color: #fff; position: sticky; top: 0; z-index: 10; }
.barra-arriba { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; }
.marca { color: #fff; font-weight: 700; text-decoration: none; }
.menu { display: flex; gap: .25rem; overflow-x: auto; padding: 0 .75rem .5rem; scrollbar-width: none; }
.menu a { color: #fff; text-decoration: none; padding: .4rem .8rem; border-radius: 999px; white-space: nowrap; opacity: .85; }
.menu a.activo { background: rgba(255,255,255,.2); opacity: 1; font-weight: 600; }
.menu-usuario { position: relative; }
.menu-usuario summary { cursor: pointer; list-style: none; padding: .3rem .6rem; border-radius: 8px; background: rgba(255,255,255,.15); }
.menu-usuario summary::-webkit-details-marker { display: none; }
.menu-desplegable {
  position: absolute; right: 0; top: 2.4rem; background: var(--tarjeta); color: var(--texto);
  border: 1px solid var(--borde); border-radius: var(--radio); min-width: 200px; padding: .4rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.menu-desplegable a, .menu-desplegable .link {
  display: block; width: 100%; text-align: left; padding: .6rem .7rem; color: var(--texto);
  text-decoration: none; border-radius: 8px; background: none; border: 0; font: inherit; cursor: pointer;
}
.menu-desplegable a:hover, .menu-desplegable .link:hover { background: var(--fondo); }

.contenido { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 5rem; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; margin-bottom: 1rem; }
.angosta { max-width: 520px; }
.centrado { text-align: center; max-width: 420px; margin: 3rem auto; }
.login { max-width: 380px; margin: 3rem auto; }
.pie, .nota { color: var(--suave); font-size: .85rem; margin-top: .8rem; }
.grilla-2 { display: grid; gap: 0 1rem; }
@media (min-width: 860px) { .grilla-2 { grid-template-columns: 1fr 1fr; } }
.titulo-con-acciones { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.titulo-con-acciones h1 { margin: .4rem 0; }

/* Formularios */
label { display: block; margin-bottom: .9rem; font-weight: 600; font-size: .92rem; }
input, select {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem; font: inherit; font-weight: 400;
  color: var(--texto); background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px;
}
input:focus, select:focus { outline: 2px solid var(--verde); outline-offset: 1px; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.en-linea { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.en-linea input { width: auto; flex: 1 1 140px; margin: 0; }
.en-linea label { margin: 0; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filtros input, .filtros select { width: auto; margin: 0; }

.boton {
  display: inline-block; background: var(--verde); color: #fff; border: 0; border-radius: 10px;
  padding: .7rem 1.1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
}
.boton:hover { background: var(--verde-osc); }
.boton-grande { width: 100%; padding: 1rem; font-size: 1.1rem; }
.boton-chico { padding: .4rem .7rem; font-size: .85rem; }
.boton-gris { background: var(--fondo); color: var(--texto); border: 1px solid var(--borde); }
.boton-gris:hover { background: var(--borde); }
.boton-flotante { margin-bottom: 1rem; }

/* Carga rápida */
.opciones { border: 0; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
@media (min-width: 640px) { .opciones { grid-template-columns: repeat(3, 1fr); } }
.opciones legend { font-weight: 600; font-size: .92rem; margin-bottom: .5rem; }
.opcion { margin: 0; position: relative; }
.opcion input { position: absolute; opacity: 0; pointer-events: none; }
.opcion span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 3.2rem;
  padding: .5rem; border: 2px solid var(--borde); border-radius: 10px; font-weight: 600; cursor: pointer;
  background: var(--tarjeta);
}
.opcion input:checked + span { border-color: var(--verde); background: var(--verde-claro); }
.opcion.sale input:checked + span { border-color: var(--rojo); background: var(--rojo-claro); }
.opcion input:focus-visible + span { outline: 2px solid var(--verde); outline-offset: 2px; }
.campo-monto input { font-size: 1.8rem; font-weight: 700; text-align: right; padding: .6rem .8rem; }
.oculto { display: none !important; }

/* Avisos */
.aviso { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.aviso-ok { background: var(--verde-claro); color: var(--verde-osc); border: 1px solid var(--verde); }
.aviso-error { background: var(--rojo-claro); color: var(--rojo); border: 1px solid var(--rojo); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--fondo); border-radius: 10px; padding: .7rem .8rem; }
.kpi span { display: block; color: var(--suave); font-size: .8rem; }
.kpi strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.kpi-destacado { background: var(--verde-claro); }
.kpi-alerta strong { color: var(--rojo); }

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th { text-align: left; color: var(--suave); font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--borde); padding: .5rem .4rem; }
.tabla td { border-bottom: 1px solid var(--borde); padding: .55rem .4rem; vertical-align: middle; }
.num, .tabla th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .total td { font-weight: 700; background: var(--fondo); }
.tabla .grande td { font-size: 1.05rem; }
.tabla .acciones { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabla-dias tr.vacio td { color: var(--suave); }
.scroll-h { overflow-x: auto; }
.entra { color: var(--verde); }
.sale { color: var(--rojo); }
.apagado { opacity: .55; }
.anulado, .anulado td { text-decoration: line-through; opacity: .5; }

/* Movimientos en celular: cada fila es una tarjetita */
@media (max-width: 640px) {
  .tabla-movs thead { display: none; }
  .tabla-movs tr { display: block; border-bottom: 1px solid var(--borde); padding: .5rem 0; }
  .tabla-movs td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .15rem 0; }
  .tabla-movs td::before { content: attr(data-et); color: var(--suave); font-size: .8rem; }
  .tabla-movs td.num { justify-content: space-between; }
}

.lista-movs { list-style: none; padding: 0; margin: 0 0 .8rem; }
.lista-movs li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--borde); }
.lista-movs small { display: inline; }
.lista-movs strong { white-space: nowrap; }
.tabla + h2 { margin-top: 1.4rem; }
details > summary { cursor: pointer; }
details.tarjeta > summary { font-weight: 600; }
details.tarjeta[open] > summary { margin-bottom: .8rem; }
