/* =========================================================
 * styles.css — Mobile-first. Paleta neutra estilo Apple con acento azul.
 * ========================================================= */

:root {
  --radio: 14px;
  --alto-nav: 64px;
  /* Escala de letra (Plan 4): ningún font-size suelto en pantalla */
  --texto-xs: .75rem;
  --texto-sm: .875rem;
  --texto-base: 1rem;
  --texto-md: 1.125rem;
  --texto-lg: 1.375rem;
  --texto-xl: 1.75rem;
  --texto-2xl: 2.25rem;
}

/* Tema claro. Los formatos imprimibles y el panel de marca del login son claros en cualquier tema. */
:root, .hoja, .login-marca {
  color-scheme: light;
  --acento: #0066cc;
  --acento-fuerte: #004f9e;
  --acento-tenue: #e8f1fc;
  --tinte-1: #eaf2fd;
  --tinte-2: #f2f2f7;
  --marino: #3a3a3c;
  --marino-oscuro: #1d1d1f;
  --azul-claro: #efeff4;
  --ambar: #a14800;
  --ambar-fondo: #fff4e5;
  --rojo: #d70015;
  --rojo-fondo: #ffebed;
  --verde: #1f7a36;
  --verde-fondo: #e8f7ec;
  --texto: #1d1d1f;
  --texto-suave: #6e6e73;
  --fondo: #f5f5f7;
  --blanco: #fff;
  --borde: #e5e5ea;
  --acento-brillante: #2997ff;
  --fondo-tabla: #fafafc;
  --badge-gris-fondo: #f2f2f7;
  --resaltado: #fff3b0;
  --texto-sobre-color: #fff; /* texto e iconos sobre acento, rojo, verde, marino */
  --nav-fondo: rgba(255, 255, 255, .8); /* translúcido: la nav lleva backdrop-filter */
  --velo: rgba(0, 0, 0, .3);
  --sombra: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --sombra-flotante: 0 8px 28px rgba(0, 0, 0, .1);
  --sombra-modal: 0 16px 48px rgba(0, 0, 0, .18);
  --sombra-login: 0 1px 3px rgba(0, 0, 0, .04), 0 20px 50px rgba(0, 0, 0, .08);
  --icono-buscar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3 3'/%3E%3C/svg%3E");
}

/* Tema oscuro: el de siempre en pantalla salvo data-theme="light" (js/tema.js). Solo screen: los impresos salen en claro. */
@media screen {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --acento: #0a84ff;
    --acento-fuerte: #409cff; /* en oscuro "fuerte" = acento con más énfasis: más claro */
    --acento-tenue: #0a1f38;
    --tinte-1: #0e1a2b;
    --tinte-2: #1c1c1e;
    --marino: #aeaeb2;
    --marino-oscuro: #e5e5ea;
    --azul-claro: #2c2c2e;
    --ambar: #ff9f0a;
    --ambar-fondo: #3a2a0d;
    --rojo: #ff453a;
    --rojo-fondo: #3b1614;
    --verde: #30d158;
    --verde-fondo: #0f3319;
    --texto: #f5f5f7;
    --texto-suave: #98989d;
    --fondo: #000;
    --blanco: #1c1c1e; /* superficie de tarjetas */
    --borde: #38383a;
    --acento-brillante: #64b5ff;
    --fondo-tabla: #242426;
    --badge-gris-fondo: #2c2c2e;
    --resaltado: #5c4f12;
    --texto-sobre-color: #000; /* sobre acento, rojo, verde y marino claros: negro pasa AA, blanco no */
    --nav-fondo: rgba(28, 28, 30, .78);
    --velo: rgba(0, 0, 0, .6);
    --sombra: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3);
    --sombra-flotante: 0 8px 28px rgba(0, 0, 0, .5);
    --sombra-modal: 0 16px 48px rgba(0, 0, 0, .6);
    --sombra-login: 0 1px 3px rgba(0, 0, 0, .3), 0 20px 50px rgba(0, 0, 0, .4);
    --icono-buscar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2398989d' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3 3'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--texto-base);
  line-height: 1.45;
  color: var(--texto);
  background: var(--fondo);
}

h1 { font-size: var(--texto-lg); margin: 0; }
h2 { font-size: var(--texto-md); margin: 0 0 .75rem; }
h3 { font-size: var(--texto-md); }
small { font-size: var(--texto-sm); }
code { font-family: inherit; font-size: var(--texto-sm); font-variant-numeric: tabular-nums; }
a { color: var(--acento); }
[hidden] { display: none !important; }

/* ---------- Layout y navegación ---------- */

.contenido {
  padding: 16px 16px calc(var(--alto-nav) + 24px);
  max-width: 1100px;
  margin: 0 auto;
}

.nav {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--alto-nav);
  display: flex;
  background: var(--nav-fondo);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--borde);
  z-index: 10;
}
.nav-marca { display: none; }
.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 2px;
  font-size: var(--texto-xs);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--texto-suave);
  text-decoration: none;
}
.nav svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav a.activo { color: var(--acento); }

/* Admin en celular: 4 destinos + "Más" (hoja sobre la barra con el resto, Mi usuario y Cerrar sesión) */
.nav-mas { flex: 1; }
.nav-mas > summary {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--texto-xs);
  font-weight: 600;
  color: var(--texto-suave);
  cursor: pointer;
}
.nav-mas[open] > summary, .nav-mas:has(a.activo) > summary { color: var(--acento); }
@media (max-width: 899px) {
  .nav-mas-hoja {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--alto-nav);
    max-height: calc(100dvh - var(--alto-nav) - 16px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    background: var(--blanco);
    border-top: 1px solid var(--borde);
    border-radius: var(--radio) var(--radio) 0 0;
    box-shadow: var(--sombra-flotante);
  }
  .nav .nav-mas-hoja a, .nav-salir {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    min-height: 48px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--texto);
    font: inherit;
    font-size: var(--texto-base);
    font-weight: 600;
    cursor: pointer;
  }
  .nav-salir { display: flex; align-items: center; border-top: 1px solid var(--borde); border-radius: 0; }
  .nav .nav-mas-hoja a.activo { color: var(--acento); background: var(--acento-tenue); }
}

@media (min-width: 900px) {
  .nav {
    inset: 0 auto 0 0;
    width: 230px;
    height: auto;
    flex-direction: column;
    gap: 4px;
    padding: 20px 12px;
    border-top: 0;
    border-right: 1px solid var(--borde);
  }
  .nav-marca {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    font-weight: 700;
    color: var(--acento-fuerte);
    line-height: 1.2;
  }
  .nav-marca small { font-weight: 500; color: var(--texto-suave); }
  .nav-logo {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
  }
  .nav a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    font-size: var(--texto-base);
  }
  .nav a:hover { background: var(--acento-tenue); }
  .nav a.activo { background: var(--acento-tenue); color: var(--acento-fuerte); }
  .nav-mas > summary { display: none; }
  .nav-mas-hoja { display: flex; flex-direction: column; gap: 4px; }
  .app { padding-left: 230px; }
  .contenido { padding: 28px 32px 40px; }
}

.vista-encabezado {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.subtitulo { margin: 2px 0 0; color: var(--texto-suave); }
.botones { display: flex; flex-wrap: wrap; gap: 8px; }

/* encabezadoVista(): en celular la primaria ocupa el ancho y Más + secundarias van en una fila debajo */
.vista-encabezado .volver { flex-basis: 100%; display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: none; }
.vista-titulo { min-width: 0; }
.vista-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 699px) {
  .vista-acciones { width: 100%; }
  .vista-acciones > * { flex: 1; }
  .vista-acciones > .btn-primario { order: -1; flex-basis: 100%; }
  .vista-acciones .menu-mas > summary { width: 100%; }
}

/* ⋯ Más: <details> nativo; app.js lo cierra al tocar fuera o con Esc */
.menu-mas { position: relative; }
.menu-mas > summary { list-style: none; }
.menu-mas > summary::-webkit-details-marker { display: none; }
.menu-mas-lista {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  width: max-content;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra-flotante);
}
@media (max-width: 699px) { .menu-mas-lista { right: auto; left: 0; } }
.menu-mas-opcion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--texto);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
}
.menu-mas-opcion:hover, .menu-mas-opcion:focus-visible { background: var(--acento-tenue); }
.menu-mas-opcion small { font-weight: 400; color: var(--texto-suave); }
.menu-mas-peligro { color: var(--rojo); }
.menu-mas-peligro:hover, .menu-mas-peligro:focus-visible { background: var(--rojo-fondo); }

/* ---------- Botones ---------- */

.btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: var(--blanco);
  color: var(--texto);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--acento); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--acento); border-color: var(--acento); color: var(--texto-sobre-color); }
.btn-primario:hover { background: var(--acento-fuerte); }
.btn-peligro { background: var(--rojo); border-color: var(--rojo); color: var(--texto-sobre-color); }
.btn-peligro-texto { color: var(--rojo); }
.btn-chico { min-height: 36px; padding: 6px 12px; font-size: var(--texto-sm); }
@media (max-width: 699px) { .btn-chico { min-height: 44px; } } /* R23 */
.btn-grande { min-height: 52px; padding: 12px 22px; font-size: var(--texto-md); }
.btn-bloque { width: 100%; }
.btn-icono {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--texto-suave);
  font: inherit;
  font-size: var(--texto-md);
  cursor: pointer;
}
.btn-icono:hover { background: var(--rojo-fondo); color: var(--rojo); }

/* ---------- Formularios ---------- */

input, select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: var(--blanco);
  color: var(--texto);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--acento); outline-offset: 1px; border-color: var(--acento); }
input:disabled { background: var(--fondo); }
.campo { display: flex; flex-direction: column; gap: 4px; font-size: var(--texto-sm); font-weight: 600; color: var(--texto-suave); margin-bottom: 12px; }
.campo input, .campo select { color: var(--texto); font-weight: 400; }
.campo small { font-weight: 400; }
.fila-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--acento); }
.buscador { margin-bottom: 14px; }
.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; margin-bottom: 8px; }
.filtros .buscador { grid-column: 1 / -1; margin-bottom: 8px; }
.filtros .check { margin-bottom: 14px; }
@media (min-width: 700px) {
  .filtros { display: flex; flex-wrap: wrap; gap: 12px; }
  .filtros .campo { min-width: 160px; }
  .filtros .buscador { flex: 1; min-width: 240px; margin-bottom: 14px; }
}

.aviso-error {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--rojo-fondo);
  color: var(--rojo);
  font-weight: 600;
}

/* ---------- Tarjetas y paneles ---------- */

.tarjetas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (min-width: 900px) { .tarjetas { grid-template-columns: repeat(4, 1fr); } }
.tarjeta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radio);
  border-top: 4px solid var(--acento);
  background: var(--blanco);
  box-shadow: var(--sombra);
  color: var(--texto);
  text-decoration: none;
}
.tarjeta-ambar { border-top-color: var(--ambar); }
.tarjeta-roja { border-top-color: var(--rojo); }
.tarjeta-etiqueta { font-size: var(--texto-sm); color: var(--texto-suave); font-weight: 600; }
.tarjeta-valor { font-size: var(--texto-lg); }
.tarjeta-nota { font-size: var(--texto-xs); color: var(--texto-suave); }

/* Fila compacta de indicadores bajo las tarjetas de Inicio: etiqueta, cifra y nota en una sola caja baja */
.indicadores { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 18px; padding: 0;
  border-radius: var(--radio); overflow: hidden; background: var(--borde); box-shadow: var(--sombra); }
@media (min-width: 900px) { .indicadores { grid-template-columns: repeat(4, 1fr); } }
.indicadores a { display: flex; flex-direction: column; padding: 10px 14px; background: var(--blanco); color: var(--texto); text-decoration: none; }
.indicadores a:hover { background: var(--acento-tenue); }
.indicadores small { font-size: var(--texto-xs); color: var(--texto-suave); }
.indicadores a.texto-rojo strong { color: var(--rojo); }

.panel { padding: 18px; margin-bottom: 18px; border-radius: var(--radio); background: var(--blanco); box-shadow: var(--sombra); }
.panel-discreto { background: transparent; box-shadow: none; border: 1px dashed var(--borde); }
.panel-discreto p { color: var(--texto-suave); margin-top: 0; }
.dos-columnas { display: grid; gap: 0 18px; }
@media (min-width: 900px) { .dos-columnas { grid-template-columns: 1fr 1fr; } }

.lista { list-style: none; margin: 0; padding: 0; }
.lista li + li { border-top: 1px solid var(--borde); }
.lista a, .lista .lista-fila { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; color: var(--texto); text-decoration: none; }
.lista a:hover { background: var(--acento-tenue); }
.lista small { color: var(--texto-suave); }
.lista-der { text-align: right; white-space: nowrap; }
.lista-simple { margin: 0 0 12px; padding-left: 18px; }
.lista-simple li { margin-bottom: 4px; }
.mini-titulo { font-size: var(--texto-base); margin: 8px 0 6px; }
.vacio { color: var(--texto-suave); text-align: center; padding: 16px; list-style: none; }

/* ---------- Badges y textos de estado ---------- */

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: var(--texto-xs); font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.badge-verde { background: var(--verde-fondo); color: var(--verde); }
.badge-ambar { background: var(--ambar-fondo); color: var(--ambar); }
.badge-rojo { background: var(--rojo-fondo); color: var(--rojo); }
.texto-rojo { color: var(--rojo); }
.texto-ambar { color: var(--ambar); }

/* ---------- Tablas ---------- */

.tabla-contenedor { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden; }
.tabla th { padding: 12px; text-align: left; font-size: var(--texto-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); background: var(--fondo-tabla); border-bottom: 1px solid var(--borde); }
.tabla td { padding: 12px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla tfoot td { font-weight: 700; background: var(--fondo-tabla); border-bottom: 0; }
.num { text-align: right !important; white-space: nowrap; }
.acciones { text-align: right; white-space: nowrap; }
#inv-filas .acciones { white-space: normal; width: 16rem; } /* 4 botones en dos renglones: la tabla tiene más columnas */
.tabla-clic tbody tr[tabindex] { cursor: pointer; }
.tabla-clic tbody tr[tabindex]:hover { background: var(--acento-tenue); }
.fila-alerta td { background: var(--rojo-fondo); }
.fila-alerta td:first-child { box-shadow: inset 4px 0 0 var(--rojo); }

/* En celular las tablas se vuelven tarjetas */
@media (max-width: 699px) {
  .tabla-responsiva, .tabla-partidas { box-shadow: none; background: transparent; }
  .tabla-responsiva thead, .tabla-partidas thead { display: none; }
  .tabla-responsiva tr, .tabla-partidas tr {
    display: block;
    margin-bottom: 10px;
    padding: 6px 12px;
    border-radius: var(--radio);
    background: var(--blanco);
    box-shadow: var(--sombra);
  }
  .tabla-responsiva td, .tabla-partidas td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    text-align: right;
    background: transparent !important;
    box-shadow: none !important;
  }
  .tabla-responsiva td[data-label]::before, .tabla-partidas td[data-label]::before {
    content: attr(data-label);
    font-size: var(--texto-xs);
    font-weight: 600;
    color: var(--texto-suave);
    text-align: left;
  }
  .tabla-responsiva td[colspan] { justify-content: center; }
  .tabla-responsiva .acciones { justify-content: flex-end; flex-wrap: wrap; }
  .tabla-responsiva tr.fila-alerta, .tabla-partidas tr.fila-alerta { box-shadow: inset 4px 0 0 var(--rojo), var(--sombra); background: var(--rojo-fondo); }
  .tabla-partidas td { flex-direction: column; align-items: stretch; text-align: left; }
  .tabla-partidas td.importe { flex-direction: row; align-items: center; font-weight: 700; }
  .tabla-partidas td.acciones { align-items: flex-end; }
}

/* Lista como tarjeta de 2 líneas en celular (R13): .tt-titulo y .tt-monto arriba, .tt-sub (· entre ellas) y
   .tt-estado abajo; las demás celdas solo se ven en escritorio */
@media (max-width: 699px) {
  .tabla-tarjetas { box-shadow: none; background: transparent; }
  .tabla-tarjetas thead { display: none; }
  .tabla-tarjetas tr {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 4px 0;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: var(--radio);
    background: var(--blanco);
    box-shadow: var(--sombra);
  }
  .tabla-tarjetas td { display: none; padding: 0; border: 0; background: transparent !important; }
  .tabla-tarjetas .tt-titulo { display: block; grid-column: 1 / 4; grid-row: 1; font-weight: 600; }
  .tabla-tarjetas .tt-monto { display: block; grid-column: 4; grid-row: 1; padding-left: 12px; font-weight: 700; }
  .tabla-tarjetas .tt-sub { display: block; grid-row: 2; color: var(--texto-suave); font-size: var(--texto-sm); text-align: left; }
  .tabla-tarjetas .tt-sub ~ .tt-sub { grid-column: 2 / 4; }
  .tabla-tarjetas .tt-sub ~ .tt-sub::before { content: '·'; margin: 0 6px; }
  .tabla-tarjetas .tt-estado { display: block; grid-column: 4; grid-row: 2; padding-left: 12px; text-align: right; }
  .tabla-tarjetas td.vacio { display: block; grid-column: 1 / -1; }
  .tabla-tarjetas tr.fila-alerta { box-shadow: inset 4px 0 0 var(--rojo), var(--sombra); }
  .tabla-tarjetas .fila-alerta td:first-child { box-shadow: none; }
}
.mostrar-mas { display: flex; margin: 12px auto 0; }
.filtros-plegables > summary, .mapa-plegable > summary { list-style: none; margin-bottom: 12px; }
.filtros-plegables > summary::-webkit-details-marker, .mapa-plegable > summary::-webkit-details-marker { display: none; }
@media (min-width: 700px) { .filtros-plegables > summary, .mapa-plegable > summary { display: none; } }

/* Hoja de papel solo desde 700 px (R26); en celular su versión simple. Al imprimir, siempre la hoja */
@media screen and (max-width: 699px) { .solo-papel { display: none !important; } }
@media (min-width: 700px), print { .solo-celular { display: none !important; } }

/* ---------- Nueva nota (formulario) ---------- */

/* La captura usa la misma hoja que la remisión impresa (.hoja, js/app.js encabezadoHoja) */
.nota-form { max-width: 820px; margin: 0 auto; }
.nota-form .hoja { margin-bottom: 0; }
.nota-form .hoja-datos { align-items: start; grid-template-columns: auto 1fr auto 11em; }
.nota-form .hoja-datos > label { padding-top: .8em; }
.nota-form .hoja-datos > * { min-width: 0; }
.nota-form .nota-bodega { display: block; padding-top: .8em; }
.nota-form .hoja-datos input, #nv-folio { background-color: var(--caja); border-color: var(--linea-fuerte); }
#nv-folio { width: 9em; padding: 4px 8px; text-align: right; font-weight: 700; text-transform: uppercase; font-size: inherit; }
.nota-form .hoja-tabla td { vertical-align: middle; }
.nota-form .hoja-tabla td.col-clave { font-weight: 600; }
.nota-form .hoja-tabla td.acciones { padding: 4px 0; text-align: center; }
.nota-form .hoja-tabla input { width: 100%; padding: 6px 8px; background-color: transparent; border-color: var(--linea); }
.nota-form .hoja-tabla .combo input { padding-right: 32px; }
.nota-form .btn-icono { width: 32px; height: 32px; }
.nota-form .hoja-totales { align-items: center; }
.nota-form .hoja-totales label { display: flex; align-items: center; }
.nota-form .hoja-totales input { width: 1.1em; height: 1.1em; min-height: 0; margin: 0 .5em 0 0; accent-color: var(--acento); }
.nota-form .pago { margin-top: 18px; }
.nota-barra { margin-top: 12px; }
#nv-agregar { margin-top: 10px; }
.ayuda-campo { display: block; margin-top: 4px; color: var(--texto-suave); font-size: var(--texto-sm); }

/* Cliente elegido */
.cliente-elegido {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--acento);
  border-radius: 12px;
  background: var(--blanco);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--texto-sobre-color);
  font-weight: 700;
  background: var(--acento);
}
.cliente-elegido-datos { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.cliente-elegido-datos strong { font-size: var(--texto-md); }
.cliente-elegido-datos small { color: var(--texto-suave); }

/* Alta rápida de cliente */
.cliente-nuevo { padding: 14px; border: 2px dashed var(--acento); border-radius: 12px; background: var(--blanco); }
.cliente-nuevo-titulo { display: block; margin-bottom: 10px; color: var(--acento-fuerte); }
.cliente-nuevo .botones { justify-content: flex-end; }
@media (min-width: 700px) {
  .cliente-nuevo { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0 12px; }
  .cliente-nuevo-titulo, .cliente-nuevo .aviso-error, .cliente-nuevo .botones { grid-column: 1 / -1; }
}

/* Combobox con autocompletado */
.combo { position: relative; }
.combo input {
  padding-right: 36px;
  background: var(--blanco) var(--icono-buscar) no-repeat right 12px center;
}
.combo-lista {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  min-width: 260px;
  max-height: 300px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: var(--blanco);
  box-shadow: var(--sombra-flotante);
}
.combo-lista li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.combo-lista li.activo { background: var(--acento-tenue); }
.combo-lista li.deshabilitada { opacity: .45; cursor: not-allowed; }
.combo-principal { display: flex; flex-direction: column; min-width: 0; }
.combo-principal small { color: var(--texto-suave); font-size: var(--texto-sm); }
.combo-stock { font-size: var(--texto-sm); font-weight: 600; white-space: nowrap; color: var(--texto-suave); }
.combo-lista mark { background: var(--resaltado); color: inherit; border-radius: 2px; }
.combo-extra { margin-top: 4px; border-top: 1px solid var(--borde); color: var(--acento-fuerte); font-weight: 600; justify-content: flex-start !important; }
.combo-vacio { padding: 10px 12px; color: var(--texto-suave); font-size: var(--texto-sm); }
.tabla-partidas input:disabled { background: var(--fondo); cursor: not-allowed; }

.input-unidad { display: flex; align-items: center; gap: 6px; }
.input-unidad input { min-width: 0; }
.input-unidad span { font-weight: 700; min-width: 32px; }
.aviso-stock { display: block; color: var(--rojo); font-weight: 600; }
.aviso-stock:empty { display: none; }
@media (max-width: 699px) {
  .tabla-partidas .combo, .tabla-partidas input[type="number"], .input-unidad input { min-width: 0; max-width: none; }
}

/* Captura en celular (R26): formulario simple con el tema de la app, sin la hoja; partidas como tarjetas,
   total y guardar fijos sobre la barra (R17). El mismo DOM que la hoja, solo cambia el CSS. */
@media screen and (max-width: 699px) {
  .nota-form .hoja {
    /* la hoja fuerza el tema claro (ver :root, .hoja); en celular toma el de la app y la escala de pantalla */
    color-scheme: inherit;
    --acento: inherit; --acento-fuerte: inherit; --acento-tenue: inherit; --tinte-1: inherit; --tinte-2: inherit;
    --marino: inherit; --marino-oscuro: inherit; --azul-claro: inherit; --ambar: inherit; --ambar-fondo: inherit; --rojo: inherit;
    --rojo-fondo: inherit; --verde: inherit; --verde-fondo: inherit; --texto: inherit; --texto-suave: inherit; --fondo: inherit;
    --blanco: inherit; --borde: inherit; --acento-brillante: inherit;
    --fondo-tabla: inherit; --badge-gris-fondo: inherit; --resaltado: inherit; --texto-sobre-color: inherit; --velo: inherit;
    --sombra: inherit; --sombra-flotante: inherit; --sombra-modal: inherit; --icono-buscar: inherit;
    --caja: var(--blanco); --linea: var(--borde); --linea-fuerte: var(--borde);
    --hoja-tinta: var(--texto); --hoja-gris: var(--texto-suave); --hoja-acento: var(--acento);
    --hoja-xs: var(--texto-sm); --hoja-sm: var(--texto-sm); --hoja-base: var(--texto-base); --hoja-md: var(--texto-md);
    --hoja-lg: var(--texto-md); --hoja-xl: var(--texto-lg);
    padding: 0; background: transparent; box-shadow: none; color: var(--texto); line-height: 1.5;
  }
  .nota-form .hoja-marca, .nota-form .hoja-tipo, .nota-form .hoja-firmas, .nota-form .hoja-pie,
  .nota-form .col-clave, .nota-form .hoja-tabla thead { display: none !important; }
  .nota-form .hoja-encabezado { justify-content: flex-start; margin: 0 0 8px; padding: 0; border: 0; }
  .nota-form .hoja-doc { align-items: flex-start; }
  .nota-form .hoja-datos { grid-template-columns: 1fr; gap: 4px; margin-bottom: 16px; }
  .nota-form .hoja-datos > label { margin: 8px 0 0; padding: 0; font-size: var(--texto-sm); text-transform: none; letter-spacing: 0; }
  .nota-form .nota-bodega { padding-top: 0; }
  .nota-form .hoja-tabla { font-size: var(--texto-base); }
  .nota-form .hoja-tabla tr[data-i] { display: grid; grid-template-columns: 1fr 1fr 44px; column-gap: 12px; position: relative; }
  .nota-form .hoja-tabla td { padding: 4px 0; border: 0; }
  .nota-form .hoja-tabla td[data-label="Producto"] { grid-column: 1 / 3; }
  .nota-form .hoja-tabla td.acciones { grid-column: 3; grid-row: 1; justify-content: flex-end; }
  .nota-form .hoja-tabla td[data-label="Piezas"], .nota-form .hoja-tabla td.importe,
  .nota-form .hoja-tabla td[data-label="P/pieza"] { grid-column: 2 / 4; }
  .nota-form .hoja-tabla td.importe { align-self: end; justify-content: space-between; padding-bottom: 14px; }
  .nota-form .hoja-tabla input { padding: 10px 12px; font-size: var(--texto-base); background-color: var(--fondo); }
  .nota-form .hoja-cierre { grid-template-columns: 1fr; margin: 12px 0 0; }
  .nota-form .hoja-totales { grid-template-columns: 1fr auto; }
  .nota-form .btn-icono, .nota-form .btn-chico, .nota-form .chip { min-height: 44px; }
  .nota-form .btn-icono { width: 44px; height: 44px; }
  .nota-form #nv-agregar { width: 100%; }
  .nota-barra {
    position: sticky; bottom: calc(var(--alto-nav) + 8px); z-index: 5;
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: var(--radio); background: var(--blanco); box-shadow: var(--sombra-flotante);
  }
  .nota-barra p { display: flex; flex-direction: column; margin: 0; white-space: nowrap; color: var(--texto-suave); font-size: var(--texto-sm); }
  .nota-barra strong { color: var(--texto); font-size: var(--texto-md); }
}

.pago { margin-top: 18px; padding: 14px; border-radius: 10px; background: var(--acento-tenue); }
.pago .campo { margin-bottom: 8px; max-width: 260px; }
.pago-botones { display: flex; gap: 8px; }
.pago-resumen { margin: 12px 0 0; }

/* ---------- Hojas impresas ---------- */
/* impreso: color fijo — los hex de .hoja son del papel: blanco + acento, se leen igual en blanco y negro.
   Escala propia en pt (--hoja-*), no la de pantalla. La arma encabezadoHoja() en js/app.js. */

.hoja {
  --hoja-xs: 7.5pt; --hoja-sm: 8.5pt; --hoja-base: 10pt; --hoja-md: 12pt; --hoja-lg: 14pt; --hoja-xl: 18pt;
  --hoja-tinta: #1d1d1f;
  --hoja-gris: #6e6e73;
  --hoja-acento: #0066cc;
  --caja: #fff;              /* campos de la captura sobre la hoja */
  --linea: #d2d2d7;
  --linea-fuerte: #8e8e93;
  max-width: 820px;
  margin: 0 auto 18px;
  padding: 40px 44px 28px;
  background: #fff;
  box-shadow: var(--sombra);
  border-radius: 4px;
  color: var(--hoja-tinta);
  font-size: var(--hoja-base);
  line-height: 1.4;
}
.hoja-encabezado {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1.5pt solid var(--hoja-acento);
}
.hoja-marca { display: flex; align-items: center; gap: 10px; }
.hoja-logo { width: 40px; height: 40px; object-fit: contain; }
.hoja-marca div { display: flex; flex-direction: column; }
.hoja-nombre { font-size: var(--hoja-xl); font-weight: 700; line-height: 1.1; color: var(--hoja-acento); }
.hoja-giro { font-size: var(--hoja-xs); color: var(--hoja-gris); letter-spacing: .04em; }
.hoja-doc { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.hoja-tipo { font-size: var(--hoja-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--hoja-gris); }
.hoja-folio { font-size: var(--hoja-lg); font-weight: 700; }
.hoja-fecha { font-size: var(--hoja-sm); color: var(--hoja-gris); }
/* Nota cancelada: discreto, junto al folio, también sale impreso */
.hoja-sello { margin-top: 4px; padding: 1px 6px; border: 1pt solid #c0392b; border-radius: 3px; color: #c0392b; font-size: var(--hoja-sm); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

/* Datos: etiqueta · valor en 2 columnas */
.hoja-datos { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: baseline; gap: 6px 12px; margin: 0 0 18px; }
.hoja-datos > :nth-child(4n+1), .hoja-datos > :nth-child(4n+3) {
  font-size: var(--hoja-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--hoja-gris);
}
.hoja-datos dd { margin: 0; overflow-wrap: anywhere; }

/* Tabla: filas separadas por líneas finas, sin cuadrícula ni fondos */
.hoja-tabla { width: 100%; border-collapse: collapse; table-layout: fixed; }
.hoja-tabla th {
  padding: 6px 6px; border-bottom: 1pt solid var(--hoja-tinta); text-align: left;
  font-size: var(--hoja-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--hoja-gris);
}
.hoja-tabla td { padding: 6px; border-bottom: .5pt solid var(--linea); vertical-align: top; overflow-wrap: anywhere; }
.hoja-tabla tr { break-inside: avoid; }
.hoja-tabla thead { display: table-header-group; }
.hoja-tabla .cen { text-align: center; }
.hoja-tabla .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hoja-tabla small { font-size: var(--hoja-xs); color: var(--hoja-gris); }
.hoja-tabla .w-clave { width: 13%; }
.hoja-tabla .w-cant { width: 9%; }
.hoja-tabla .w-dinero { width: 15%; }
.hoja-tabla .w-quitar { width: 40px; }

/* Cierre: firmas a la izquierda, totales a la derecha */
.hoja-cierre { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 32px; margin-top: 16px; break-inside: avoid; }
.hoja-firmas { display: flex; gap: 32px; }
.hoja-firma { flex: 1; max-width: 260px; padding-top: 6px; margin-top: 48px; border-top: .75pt solid var(--hoja-tinta); text-align: center; font-size: var(--hoja-sm); color: var(--hoja-gris); }
.hoja-totales { display: grid; grid-template-columns: auto minmax(8em, auto); gap: 4px 0; font-variant-numeric: tabular-nums; }
.hoja-totales > :nth-child(odd) { color: var(--hoja-gris); }
.hoja-totales > :nth-child(even) { padding-left: 24px; text-align: right; }
.hoja-totales .hoja-total { padding-top: 6px; border-top: 1pt solid var(--hoja-tinta); color: var(--hoja-tinta); font-size: var(--hoja-md); font-weight: 700; }

.hoja-pie { margin-top: 24px; padding-top: 8px; border-top: .5pt solid var(--linea); text-align: center; font-size: var(--hoja-xs); color: var(--hoja-gris); }

.remision-estado { margin: 0 auto 10px; max-width: 820px; color: var(--texto-suave); }

/* Notas al pie de la tabla (cotización) */
.hoja-notas { margin: 16px 0 0; padding-left: 1.2em; font-size: var(--hoja-sm); color: var(--hoja-gris); }

/* Reportes en carta horizontal (cobranza, estado de cuenta): columnas al ancho del contenido */
.hoja-horizontal { max-width: 1100px; overflow-x: auto; }
.hoja-tabla-auto { table-layout: auto; }
.hoja-tabla-auto td { white-space: nowrap; vertical-align: baseline; }
.hoja-tabla-auto td.hoja-ancha { width: 100%; white-space: normal; }
.hoja-tabla tbody tr[tabindex] { cursor: pointer; }
.hoja-tabla tbody tr[tabindex]:hover { background: #eef4fc; } /* impreso: color fijo */
.hoja-tabla .vacio { padding: 18px 6px; text-align: center; color: var(--hoja-gris); white-space: normal; }
.hoja-tabla tfoot { display: table-row-group; } /* los totales solo al final, no en cada hoja */
.hoja-tabla tfoot td { padding: 6px; border-top: 1pt solid var(--hoja-tinta); font-weight: 700; font-variant-numeric: tabular-nums; }
.hoja-tabla .hoja-anterior td { font-style: italic; color: var(--hoja-gris); }
.hoja-tabla .hoja-saldo-total td { border-top: 0; font-size: var(--hoja-md); }
/* Estatus como texto de color, no celdas rellenas */
.hoja-estatus { font-size: var(--hoja-sm); font-weight: 600; letter-spacing: .04em; }
.hoja-estatus.st-VENCIDA, .st-VENCIDA + .hoja-dias { color: #c0392b; font-weight: 700; }
.hoja-estatus.st-PAGADA { color: #1e7d4f; }

/* Hojas de ruta, carga y liquidación: columnas para escribir a mano (línea inferior, sin casillas) */
.hoja-tabla .hoja-escribir { width: 11em; min-width: 11em; }
.hoja-tabla-auto td.hoja-media { width: 30%; white-space: normal; } /* segunda columna de texto largo junto a .hoja-ancha */
.hoja-horizontal .hoja-tabla td { padding-block: 4px; }
.hoja-horizontal .hoja-pie { margin-top: 14px; }
.hoja-tabla td.hoja-escribir { height: 2.4em; border-bottom: .75pt solid var(--hoja-tinta); }
.hoja-seccion { margin: 14px 0 2px; font-size: var(--hoja-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--hoja-gris); }
.hoja-rojo { color: #c0392b; font-weight: 700; } /* impreso: color fijo */
.hoja-cifras { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: -6px 0 12px; break-inside: avoid; }
.hoja-cifras > div { display: flex; flex-direction: column; gap: 2px; min-width: 10em; }
.hoja-cifras span { font-size: var(--hoja-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--hoja-gris); }
.hoja-cifras strong { font-size: var(--hoja-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.hoja-cifras strong.hoja-escribir { height: 1.4em; border-bottom: .75pt solid var(--hoja-tinta); }
.hoja-horizontal > .hoja-firmas { break-inside: avoid; }
.hoja-horizontal > .hoja-firmas .hoja-firma { margin-top: 36px; }

/* Corte del mes: utilidad y flujo en dos bloques, el resultado en negrita (color solo en la cifra) */
.hoja-bloques { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 8px; }
.hoja-bloques .hoja-seccion { margin-top: 0; }
.corte-tabla { table-layout: auto; }
.corte-tabla td:first-child { width: 100%; }
.corte-tabla .corte-detalle td { color: var(--hoja-gris); }
.corte-tabla .corte-detalle td:first-child { padding-left: 16px; }
.corte-tabla .corte-subtotal td { font-weight: 600; border-top: 1pt solid var(--hoja-tinta); }
.corte-tabla .corte-resultado td { font-size: var(--hoja-md); font-weight: 700; border-top: 1pt solid var(--hoja-tinta); border-bottom: 0; }
.hoja-nota { margin: 6px 0 0; font-size: var(--hoja-xs); color: var(--hoja-gris); }
.hoja-verde { color: #1e7d4f; font-weight: 700; } /* impreso: color fijo */

.filtros > .btn { margin-bottom: 12px; } /* alineado con los .campo, que llevan margen abajo */

/* ---------- Modal ---------- */

dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: var(--texto);
  background: var(--blanco);
  box-shadow: var(--sombra-modal);
}
dialog::backdrop { background: var(--velo); }
.modal-form { padding: 18px; }
.modal-encabezado { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-encabezado h2 { margin: 0; }
.modal-pie { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Toasts ---------- */

#toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--alto-nav) + 12px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast { padding: 12px 18px; border-radius: 10px; color: var(--texto-sobre-color); font-weight: 600; background: var(--verde); box-shadow: var(--sombra); animation: aparecer .2s ease-out; }
.toast-info { background: var(--marino); }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }
@media (min-width: 900px) { #toasts { left: auto; right: 24px; bottom: 24px; transform: none; } }

/* ---------- Impresión ---------- */

@media print {
  @page { margin: 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; } /* impreso: color fijo */
  .nav, #toasts, dialog, .filtros { display: none !important; }
  .app { padding: 0 !important; }
  .contenido { margin: 0 !important; padding: 0 !important; max-width: none; }
  /* Solo se imprime el área marcada de la vista activa */
  .vista :not(.print-area):not(:has(.print-area)):not(.print-area *) { display: none !important; }
  /* Hojas: el margen lo pone @page; remisión carta vertical, pedido media carta con la escala reducida */
  .hoja { max-width: none; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
  @page hoja-carta { size: letter; margin: .5in .6in; }
  @page hoja-media { size: 5.5in 8.5in; margin: .35in .4in; }
  @page hoja-horizontal { size: letter landscape; margin: .4in .5in; }
  .hoja-remision, .hoja-cotizacion, .hoja-corte { page: hoja-carta; }
  .hoja-horizontal { page: hoja-horizontal; overflow: visible; }
  .hoja-media-carta { page: hoja-media; --hoja-xs: 6.5pt; --hoja-sm: 7pt; --hoja-base: 8pt; --hoja-md: 9.5pt; --hoja-lg: 11pt; --hoja-xl: 14pt; }
  .tabla-contenedor { overflow: visible; }
}

/* Pantallas angostas: los botones largos parten el texto */
@media screen and (max-width: 599px) {
  .btn { max-width: 100%; white-space: normal; text-align: center; }
}

/* ---------- Inventario: entradas, salidas y movimientos ---------- */

.ficha-acciones { display: grid; grid-template-columns: 1fr 1fr; margin-top: 16px; }
.presentacion { white-space: nowrap; }
.badge-azul { background: var(--azul-claro); color: var(--marino); }
.texto-verde { color: var(--verde); }

.pestanas { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--borde); overflow-x: auto; overflow-y: hidden; }
.pestanas a {
  padding: 10px 14px;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  color: var(--texto-suave);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.pestanas a.activa { color: var(--acento-fuerte); border-bottom-color: var(--acento); }
@media (max-width: 699px) { .pestanas a { padding: 10px 11px; } } /* 4 pestañas cortas caben a 360 px (Finanzas) */
/* Si no caben, se desplazan a propósito: sin barra y con desvanecido mientras haya más a la derecha (app.js) */
.pestanas { scrollbar-width: none; }
.pestanas.hay-mas { mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.pestanas.hay-antes { mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.pestanas.hay-antes.hay-mas { mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }

.resumen-producto {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--acento-tenue);
}
.ayuda { margin-top: 0; color: var(--texto-suave); font-size: var(--texto-sm); }
.vista-previa { padding: 10px 12px; border-radius: 10px; background: var(--fondo); }
.vista-previa:empty { display: none; }
.tabla-responsiva .acciones .btn { margin: 2px 0; }

/* ---------- Login ---------- */

.login { min-height: 100vh; display: grid; background: var(--fondo); }
.login-marca { display: none; }
.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 0 0, var(--tinte-1), transparent 55%),
    radial-gradient(circle at 100% 100%, var(--tinte-2), transparent 50%),
    var(--fondo);
}
.login-form {
  width: 100%;
  max-width: 400px;
  padding: 32px 24px;
  border-radius: 20px;
  background: var(--blanco);
  box-shadow: var(--sombra-login);
}
.login-form h1 { font-size: var(--texto-xl); }
.login-form .subtitulo { margin: 4px 0 24px; }
.login-form .check { margin: 4px 0 8px; font-size: var(--texto-base); }
.login-form .btn-bloque { margin-top: 12px; }
.login-logo-movil {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
}
.login-pie { margin: 0; color: var(--texto-suave); font-size: var(--texto-sm); }

.input-password { position: relative; display: block; }
.input-password input { padding-right: 88px; }
.btn-ver {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--acento);
  font: inherit;
  font-size: var(--texto-sm);
  font-weight: 700;
  cursor: pointer;
}
.btn-ver:hover { background: var(--acento-tenue); }

.sacudir { animation: sacudir .4s; }
@keyframes sacudir {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
@media (prefers-reduced-motion: reduce) { .sacudir { animation: none; } }

@media (min-width: 900px) {
  .login { grid-template-columns: 1.1fr 1fr; }
  .login-panel { background: var(--fondo); }
  .login-logo-movil { display: none; }
  .login-marca {
    position: relative;
    display: flex;
    align-items: center;
    padding: 64px;
    overflow: hidden;
    color: var(--texto-sobre-color);
    background: linear-gradient(140deg, var(--acento-fuerte) 0%, var(--acento) 45%, var(--acento-brillante) 100%);
  }
  /* Franja diagonal de reflejo. Los rgba de este panel son reflejos
     sobre el degradado de marca: iguales en cualquier tema. */
  .login-marca::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 38%;
    background: linear-gradient(110deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .22));
    clip-path: polygon(0 45%, 100% 0, 100% 100%, 0 100%);
  }
  .login-marca-contenido { position: relative; z-index: 1; max-width: 420px; }
  .login-logo { width: 72px; height: 72px; }
  .login-marca h2 { margin: 24px 0 8px; font-size: var(--texto-2xl); letter-spacing: -.01em; }
  .login-marca p { margin: 0 0 28px; font-size: var(--texto-md); opacity: .9; }
  .login-marca ul { margin: 0; padding: 0; list-style: none; }
  .login-marca li { position: relative; padding-left: 30px; margin-bottom: 12px; opacity: .95; }
  .login-marca li::before {
    content: "✓";
    position: absolute;
    left: 0;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: var(--texto-xs);
    background: rgba(255, 255, 255, .22);
  }
  .burbuja { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); }
  .b1 { width: 320px; height: 320px; top: -90px; right: -110px; }
  .b2 { width: 160px; height: 160px; top: 38%; right: 12%; }
  .b3 { width: 90px; height: 90px; top: 14%; left: 54%; background: rgba(255, 255, 255, .12); }
}

/* Usuario y salir en el menú lateral; en celular van en la hoja Más (admin) o en Mi usuario */
.nav-usuario { display: none; }
.avatar-chico { width: 32px; height: 32px; font-size: var(--texto-sm); }
@media (min-width: 900px) {
  .nav-usuario {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 12px 8px 0;
    border-top: 1px solid var(--borde);
    font-weight: 600;
  }
  .nav-usuario .btn { margin-left: auto; }
  .nav-usuario .nav-cuenta { gap: 10px; min-width: 0; padding: 6px 8px; color: var(--texto); }
  .solo-movil, .nav a.solo-movil { display: none; }
}

/* Logo y nombre del negocio */
.nav-logo img { width: 100%; height: 100%; }
.marca-nombre { font-weight: 700; letter-spacing: 0; }

/* ---------- Vencidas, cotizaciones y precios por cliente ---------- */

.badge-gris { background: var(--badge-gris-fondo); color: var(--texto-suave); }
.texto-suave { color: var(--texto-suave); font-weight: 500; }
.texto-acento { color: var(--acento); }
.tarjeta-verde { border-top-color: var(--verde); }
.aviso-info { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--azul-claro); color: var(--marino-oscuro); font-weight: 500; }
.panel-encabezado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.panel-encabezado h2 { margin: 0; }
.opcion-gasto { margin-top: 12px; padding: 12px; border-radius: 10px; border: 1px dashed var(--borde); }
.opcion-gasto .campo { margin: 10px 0 0; }

/* Atajos de periodo (estado de cuenta) */
.filtros-periodo { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--borde);
  border-radius: 99px;
  background: var(--blanco);
  color: var(--texto);
  font: inherit;
  font-size: var(--texto-sm);
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { border-color: var(--acento); }
.chip[aria-pressed="true"] { background: var(--acento); border-color: var(--acento); color: var(--texto-sobre-color); }
@media (max-width: 699px) { .chip { min-height: 44px; } } /* R23 */

/* Mapa de clientes: filtros y "Ubicar cliente" en una fila; leyenda de colores bajo el mapa */
.mapa-controles { display: grid; gap: 0 12px; }
@media (min-width: 700px) { .mapa-controles { grid-template-columns: 3fr 1fr; align-items: end; } .mapa-controles .filtros { grid-template-columns: repeat(3, 1fr); margin-bottom: 0; } }
.leyenda { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; color: var(--texto-suave); font-size: var(--texto-sm); }
.punto-vencido { background: transparent; box-shadow: inset 0 0 0 3px var(--rojo); }

/* ---------- Finanzas ---------- */

.campo-mes { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.campo-mes select { width: auto; min-width: 170px; text-transform: capitalize; }

/* Barras por día: una serie, barras delgadas con tope redondeado anclado a la base */
.grafica { position: relative; padding-top: 18px; }
.grafica-max { position: absolute; top: 0; left: 0; font-size: var(--texto-xs); color: var(--texto-suave); }
.barras {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 160px;
  border-top: 1px dashed var(--borde);
  border-bottom: 1px solid var(--borde);
}
.barra-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.barra { width: min(100%, 14px); border-radius: 4px 4px 0 0; background: var(--acento); }
.barra-col:hover .barra, .barra-col:focus-visible .barra { background: var(--acento-fuerte); }
.barra-col:hover::after, .barra-col:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--texto);
  color: var(--texto-sobre-color);
  font-size: var(--texto-xs);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.barra-col:hover { background: var(--acento-tenue); border-radius: 4px; }
.barras-eje { display: flex; gap: 2px; margin-top: 4px; font-size: var(--texto-xs); color: var(--texto-suave); }
.barras-eje span { flex: 1; text-align: center; }

.dos-columnas-gastos { align-items: start; }
@media (min-width: 900px) { .dos-columnas-gastos { grid-template-columns: 1.7fr 1fr; } }
.lista-categorias { list-style: none; margin: 0; padding: 0; }
.lista-categorias li { margin-bottom: 12px; }
.cat-fila { display: flex; justify-content: space-between; gap: 8px; font-size: var(--texto-sm); }
.cat-barra { display: block; height: 6px; margin-top: 4px; border-radius: 99px; background: var(--fondo); overflow: hidden; }
.cat-barra span { display: block; height: 100%; border-radius: 99px; background: var(--marino); }
.cat-total { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--borde); text-align: right; }

/* Crédito por nota y precio del cliente en la partida */
.credito { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--borde); }
.credito .campo { max-width: 260px; margin-bottom: 8px; }
.credito .chips { margin-bottom: 0; }
.aviso-precio { display: block; }
.aviso-precio:empty { display: none; }
.link-precio {
  margin-top: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--acento);
  font: inherit;
  font-size: var(--texto-xs);
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Usuario ---------- */

.dos-columnas-usuario { align-items: start; }
.opciones-tema { display: flex; gap: 24px; }

/* ---------- Mapa (Leaflet) ---------- */
.mapa-grande { height: calc(100dvh - 300px); min-height: 360px; border-radius: var(--radio); box-shadow: var(--sombra); z-index: 0; }
.mapa-chico { height: 220px; border-radius: var(--radio); z-index: 0; }
.mapa-chico.sin-mapa { height: auto; }
/* Tiles invertidos en tema oscuro para que el mapa no deslumbre */
@media screen {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
}
.leaflet-container { font: inherit; background: var(--fondo); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--blanco); color: var(--texto); }
.leaflet-container a.leaflet-popup-close-button { color: var(--texto-suave); }
.popup-cliente { display: grid; gap: 4px; min-width: 180px; }
.popup-cliente small { color: var(--texto-suave); }
.popup-cliente .btn { justify-self: start; margin-top: 4px; }
.leaflet-container .popup-cliente a.btn { color: var(--texto); }
.leaflet-container .popup-cliente .btn-primario { color: var(--texto-sobre-color); }
/* Marcador: gota con el color de la ruta (inline) y borde rojo si tiene saldo vencido */
.pin { background: none; border: none; }
.pin span { display: block; width: 22px; height: 22px; margin: 1px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.pin-vencido span { border-color: var(--rojo); }
.leaflet-marker-draggable.pin span { cursor: grab; outline: 2px dashed var(--marino); outline-offset: 2px; }
.mi-ubicacion { fill: #2b7de9; fill-opacity: .9; stroke: #fff; stroke-width: 3; }
.pin span b { display: block; transform: rotate(45deg); color: #fff; font-size: var(--texto-xs); line-height: 16px; text-align: center; }
.pin-bodega span, .punto-bodega { background: var(--marino); }
.otro-cliente { fill: #8e8e93; fill-opacity: .7; stroke: #fff; stroke-width: 2; }
.popup-cliente .campo { margin: 4px 0 0; }
/* Alta de cliente o bodega: en celular datos → mapa → guardar; desde 900 px datos y guardar a la izquierda, mapa a la derecha */
.alta-lugar { display: grid; gap: 16px; }
.alta-lugar .panel { margin: 0; }
.alta-lugar h2 { margin-top: 0; }
.alta-lugar-mapa .mapa-grande { min-height: 320px; height: 50dvh; }
[data-quitar] { margin-top: 8px; }
.alta-lugar-pie { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.alta-lugar-pie .aviso-error { flex-basis: 100%; margin: 0; }
@media (min-width: 900px) {
  .alta-lugar { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: auto 1fr; align-items: start; }
  .alta-lugar-mapa { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; position: sticky; top: 16px; }
  .alta-lugar-mapa .mapa-grande { height: calc(100dvh - 240px); min-height: 420px; }
}

/* ---------- Rutas ---------- */
.punto-ruta { display: inline-block; width: .8em; height: .8em; margin-right: .45em; border-radius: 50%; vertical-align: baseline; }
.ruta-layout { display: grid; gap: 16px; margin-bottom: 18px; }
.ruta-layout .panel { margin: 0; }
@media (min-width: 1100px) { .ruta-layout { grid-template-columns: 3fr 2fr; } .ruta-layout .mapa-grande { height: auto; min-height: 520px; } }
.secuencia { margin: 8px 0; padding: 0; list-style: none; max-height: 420px; overflow-y: auto; }
.secuencia li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--borde); }
.secuencia-num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 700; font-size: var(--texto-sm); }
.secuencia-datos { flex: 1; display: grid; min-width: 0; }
.secuencia-datos a { color: inherit; text-decoration: none; }
.secuencia-botones { display: flex; }
.secuencia-botones .btn-icono:disabled { opacity: .3; cursor: default; background: transparent; }
.orden-visita:not(.editando) :is(.solo-edicion, .secuencia-botones) { display: none; }
.orden-visita .solo-edicion > .btn { margin-top: 8px; }
@media (max-width: 699px) {
  .ruta-layout .panel { order: -1; } /* R4: la lista antes que el mapa */
  .secuencia { max-height: none; overflow: visible; }
  .secuencia-botones .btn-icono { width: 44px; height: 44px; }
}
.dias-visita { display: flex; flex-wrap: wrap; gap: 6px 14px; border: 0; padding: 0; }
.dias-visita legend { padding: 0; margin-bottom: 6px; }

/* ---------- Preventa ---------- */
.campo-ruta { margin: 0 0 12px; min-width: 12em; max-width: 20em; }
.avance-dia { margin: 0 0 12px; }
.mapa-plegable { margin-top: 14px; }
.mapa-preventa { height: 260px; margin-bottom: 14px; border-radius: var(--radio); box-shadow: var(--sombra); z-index: 0; }
@media (min-width: 900px) { .mapa-preventa { height: 340px; } }
.preventa-lista { margin: 0; padding: 0; list-style: none; }
.preventa-lista li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; margin-bottom: 8px; background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); }
.preventa-lista li.visitado { opacity: .75; }
.pv-datos { flex: 1 1 14em; display: grid; gap: 3px; min-width: 0; }
.pv-datos > a { color: inherit; text-decoration: none; }
.pv-botones { display: flex; gap: 6px; margin-left: auto; }
.opciones-sin-venta { display: flex; flex-wrap: wrap; gap: 6px 18px; border: 0; padding: 0; }
.opciones-sin-venta legend { padding: 0; margin-bottom: 6px; }
.minimos-bodega { border: 0; padding: 0; margin: 0; }
.minimos-bodega legend { padding: 0; margin-bottom: 6px; }

/* ---------- Reparto ---------- */
.tabla-entrega input { width: 5.5em; }
.tt-acciones .btn + .btn { margin-left: 6px; }
@media (max-width: 699px) {
  .tabla-tarjetas .tt-acciones:not(:empty) { display: flex; grid-column: 1 / -1; grid-row: 3; gap: 8px; margin-top: 6px; }
  .tabla-tarjetas .tt-acciones .btn { flex: 1; margin: 0; }
}
.consolidado > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.consolidado[open] > summary { margin-bottom: 8px; }
/* Liquidación: esperado, recibido y diferencia arriba y grandes */
.liquidacion-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(11em, 1fr)); align-items: end; gap: 12px 20px; margin-bottom: 12px; }
.liquidacion-form .campo { margin: 0; }
.lq-cifra { display: grid; gap: 4px; color: var(--texto-suave); font-size: var(--texto-sm); }
.lq-cifra strong { font-size: var(--texto-xl); color: var(--texto); }
.lq-cifra strong.texto-rojo { color: var(--rojo); }
.lq-cifra strong.texto-verde { color: var(--verde); }
.lq-cifra input { font-size: var(--texto-xl); font-weight: 700; padding: 6px 10px; }
.liquidacion-form .btn-primario { min-height: 48px; }
