/* Estilos del ERP. Pensado para PC y tablet (botones grandes). */
/* El ERP va siempre en modo claro (también si Windows está en oscuro) */
:root {
  color-scheme: light;
  --fondo: #f4f6f9;
  --tarjeta: #ffffff;
  --texto: #1c2430;
  --suave: #5b6675;
  --borde: #d9dee6;
  --primario: #1f3a5f;
  --primario-hover: #2b4f80;
  --error-fondo: #fdecec;
  --error-texto: #a61b1b;
  --radio: 12px;
  --foco-fondo: #fff7d1;   /* casilla donde está el cursor */
  --foco-borde: #e0a400;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* lo oculto, siempre oculto */
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { margin: 0 0 .25rem; font-size: 1.6rem; }
.subtitulo { color: var(--suave); margin: 0 0 1.5rem; }

/* Barra superior */
.barra {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; background: var(--primario); color: #fff;
}
.barra form { margin: 0; }
.marca { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.barra-derecha { display: flex; gap: 1rem; align-items: center; }
.barra .enlace { color: #fff; }
.usuario { opacity: .9; }

.contenido { max-width: 1320px; margin: 0 auto; padding: 1.5rem 1rem; }

/* Login */
.pantalla-login .contenido { min-height: 100vh; display: grid; place-items: center; }
.tarjeta-login {
  width: 100%; max-width: 380px; background: var(--tarjeta);
  border: 1px solid var(--borde); border-radius: var(--radio); padding: 2rem;
}
.tarjeta-login label { display: block; margin: 1rem 0 .35rem; font-weight: 600; }
.tarjeta-login input {
  width: 100%; padding: .8rem; font-size: 1rem; border-radius: 8px;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto);
}
.aviso-error {
  background: var(--error-fondo); color: var(--error-texto);
  padding: .75rem; border-radius: 8px; margin-bottom: .5rem;
}

/* Botones */
.boton-principal {
  display: block; width: 100%; margin-top: 1.5rem; padding: .9rem;
  border: 0; border-radius: 8px; background: var(--primario); color: #fff;
  font-size: 1rem; font-weight: 600; cursor: pointer; text-align: center;
  text-decoration: none;
}
.boton-principal:hover { background: var(--primario-hover); }
.boton-secundario {
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid rgba(255,255,255,.6);
  background: transparent; color: #fff; cursor: pointer; font-size: .95rem;
}

/* Módulos del inicio */
.rejilla-modulos {
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.modulo {
  display: flex; flex-direction: column; gap: .25rem; padding: 1.25rem;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  min-height: 150px;
}
.modulo span { color: var(--suave); }
.modulo-icono { font-size: 2rem; }
.modulo-pronto { opacity: .65; }
.modulo em { margin-top: auto; font-size: .85rem; color: var(--suave); }

/* --- Barra: empresa y botón Registros ------------------------------------ */
.barra-izquierda { display: flex; align-items: center; gap: 1rem; }
.barra .boton-barra { color: #fff; text-decoration: none; padding: .3rem .75rem; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; }
.barra .boton-barra:hover { background: rgba(255,255,255,.12); }
.boton-cuenta { display: inline-flex; align-items: center; gap: .4rem; }
.icono-cuenta { font-size: 1.05rem; line-height: 1; }
.empresa-actual { opacity: .8; font-size: .9rem; }
.barra .enlace { text-decoration: none; }
.boton-registros { position: relative; }
.globo {
  display: inline-block; min-width: 1.3rem; padding: 0 .35rem; margin-left: .25rem;
  border-radius: 999px; background: #e0483e; color: #fff; font-size: .75rem;
  font-weight: 700; text-align: center; line-height: 1.3rem;
}
@media (max-width: 640px) {
  .barra { flex-wrap: wrap; gap: .5rem; }
  .barra-derecha { gap: .6rem; flex-wrap: wrap; }
  span.usuario { display: none; }
  .boton-cuenta { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* --- Avisos ---------------------------------------------------------------- */
.aviso { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.aviso-error { background: var(--error-fondo); color: var(--error-texto); }
.aviso-success { background: #e6f5ea; color: #1e6b34; }

/* --- Formularios ----------------------------------------------------------- */
.formulario fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.formulario legend { font-weight: 700; margin-bottom: .25rem; color: var(--suave); }
.campo { margin-top: .9rem; }
.campo label { display: block; font-weight: 600; margin-bottom: .3rem; }
.campo input:not([type=checkbox]), .campo select {
  width: 100%; padding: .75rem; font-size: 1rem; border-radius: 8px;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto);
}
.campo-check { display: flex; align-items: center; gap: .6rem; flex-direction: row-reverse; justify-content: flex-end; }
.campo-check label { margin: 0; }
.campo-check input { width: 1.3rem; height: 1.3rem; }
.campo .ayuda { display: block; color: var(--suave); margin-top: .25rem; }
.campo .error { display: block; color: var(--error-texto); margin-top: .25rem; }
.campo-error input, .campo-error select { border-color: var(--error-texto); }
.trampa { position: absolute; left: -9999px; }
.tarjeta-login .campo label { margin: 0 0 .35rem; }
.tarjeta-ancha { max-width: 480px; }
.enlaces-login { display: flex; flex-direction: column; gap: .75rem; margin-top: 1.25rem; text-align: center; }
.enlaces-login a { color: var(--primario); }
.boton-contorno {
  display: block; padding: .8rem; border-radius: 8px; border: 1px solid var(--primario);
  text-decoration: none; font-weight: 600;
}
.nota { color: var(--suave); font-size: .92rem; }
.tabla td.fecha { white-space: nowrap; color: var(--suave); font-size: .9rem; }
.fechas-ficha { margin: -.4rem 0 1rem; }

/* --- Tarjetas, tablas y botones -------------------------------------------- */
.tarjeta {
  background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 1.25rem; margin-bottom: 1rem;
}
.tarjeta-formulario { max-width: 520px; }
.cabecera-pagina { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cabecera-pagina .subtitulo { margin: 0; }
.boton-auto { width: auto; margin: 0; padding: .75rem 1.25rem; }
.tabla-contenedor { overflow-x: auto; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--borde); }
.tabla th { font-size: .85rem; color: var(--suave); font-weight: 600; }
.tabla th.ordenable a { color: inherit; text-decoration: none; white-space: nowrap; }
.tabla th.ordenable a:hover { color: var(--texto, inherit); text-decoration: underline; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla-compacta { margin-top: .75rem; font-size: .92rem; }
.acciones { text-align: right; white-space: nowrap; }
.acciones form { display: flex; gap: .5rem; }
.boton-pequeno, .boton-ok, .boton-peligro {
  display: inline-block; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); text-decoration: none; cursor: pointer; font-size: .95rem;
}
.boton-ok { background: #1e7a3c; border-color: #1e7a3c; color: #fff; }
.boton-peligro { background: transparent; border-color: #c0392b; color: #c0392b; }
.etiqueta { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: var(--fondo); border: 1px solid var(--borde); color: var(--suave); }
.estado { font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; font-weight: 600; vertical-align: middle; }
.estado-activa { background: #e6f5ea; color: #1e6b34; }
.estado-pendiente { background: #fff4d6; color: #7a5a00; }
.estado-suspendida { background: var(--error-fondo); color: var(--error-texto); }
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros a {
  padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--borde);
  text-decoration: none; color: var(--texto); background: var(--tarjeta);
}
.filtros a.activo { background: var(--primario); border-color: var(--primario); color: #fff; }
.empresa-cabecera { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.empresa-cabecera h2 { margin: 0; font-size: 1.2rem; }
.empresa-cabecera .subtitulo { margin: .25rem 0 0; font-size: .9rem; }
details { margin-top: .75rem; }
summary { cursor: pointer; color: var(--primario); }
a.modulo { text-decoration: none; color: var(--texto); }
a.modulo:hover { border-color: var(--primario); }
.modulo .destacado { color: #b35c00; font-style: normal; font-weight: 600; }

/* Tablas en móvil/tablet vertical: cada fila como tarjeta */
@media (max-width: 700px) {
  .tabla thead { display: none; }
  .tabla tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--borde); }
  .tabla td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem .8rem; }
  .tabla td[data-titulo]::before { content: attr(data-titulo); color: var(--suave); font-size: .85rem; }
  .acciones { text-align: left; }
}
.contenido a:not([class]) { color: var(--primario); }
.rejilla-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
.rejilla-campos .ancho-total { grid-column: 1 / -1; }
@media (max-width: 640px) { .rejilla-campos { grid-template-columns: 1fr; } }
.tarjeta-formulario.ancha { max-width: 760px; }
.pasos { padding-left: 1.2rem; margin: 0 0 1rem; }
.pasos li { margin-bottom: .6rem; }
.pasos ul { margin: .4rem 0 0; padding-left: 1.1rem; }
code { background: var(--fondo); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
.fila-error td { background: color-mix(in srgb, var(--error-fondo) 60%, transparent); }
.error-fila { color: var(--error-texto); font-size: .9rem; }
.botonera { display: flex; gap: .75rem; justify-content: flex-end; align-items: center; margin-top: 1rem; }
.botonera form { margin: 0; }
.boton-ok { padding: .7rem 1.2rem; font-weight: 600; }
.campo input[type=file] { padding: .6rem; }

/* --- Selector de empresa (arriba a la izquierda) --------------------------- */
.selector-empresa { position: relative; }
.selector-empresa summary {
  list-style: none; cursor: pointer; color: #fff; padding: .3rem .75rem;
  border: 1px solid rgba(255,255,255,.45); border-radius: 8px; white-space: nowrap;
}
.selector-empresa summary::-webkit-details-marker { display: none; }
.selector-empresa summary:hover { background: rgba(255,255,255,.12); }
.menu-empresas {
  position: absolute; top: calc(100% + .4rem); left: 0; z-index: 20; min-width: 240px;
  background: var(--tarjeta); color: var(--texto); border: 1px solid var(--borde);
  border-radius: var(--radio); box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: .4rem;
}
.menu-empresas form { margin: 0; }
.menu-empresas .fila-empresa { display: flex; gap: .2rem; }
.menu-empresas .fila-empresa button.datos-empresa { width: auto; flex: none; padding: .6rem .7rem; text-align: center; opacity: .75; }
.menu-empresas .fila-empresa button.datos-empresa:hover { opacity: 1; }
.menu-empresas button, .menu-empresas a {
  display: block; width: 100%; text-align: left; padding: .6rem .75rem; border: 0;
  border-radius: 8px; background: none; color: var(--texto); font-size: .95rem;
  cursor: pointer; text-decoration: none;
}
.menu-empresas button:hover, .menu-empresas a:hover { background: var(--fondo); }
.menu-empresas button.actual { font-weight: 700; }
.menu-empresas a.nueva { color: var(--primario); border-top: 1px solid var(--borde); margin-top: .3rem; border-radius: 0 0 8px 8px; }
.empresas-usuario { margin-top: 1.2rem !important; }
.fila-empresa { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--borde); }
.fila-empresa label { font-weight: 600; }
.fila-empresa select { padding: .5rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); min-width: 9rem; }

/* --- Catálogo -------------------------------------------------------------- */
.buscador { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.buscador input[type=search] { flex: 1 1 280px; padding: .7rem .8rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); font-size: 1rem; }
.buscador select { padding: .6rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); }
.tabla .num { text-align: right; white-space: nowrap; }
.tabla tr.inactivo td { opacity: .5; }
.miniatura { width: 48px; }
.miniatura img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 6px; display: block; }
.paginacion { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }
.resumen-precios { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: 1rem; }
.resumen-precios div { background: var(--fondo); border: 1px solid var(--borde); border-radius: 8px; padding: .55rem .75rem; display: flex; flex-direction: column; }
.resumen-precios span { font-size: .8rem; color: var(--suave); }
.resumen-precios strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.resumen-precios .destacado { border-color: var(--primario); }
.foto-ficha { max-width: 160px; border-radius: 8px; margin-top: .75rem; border: 1px solid var(--borde); }
.campo textarea { width: 100%; padding: .75rem; font-size: 1rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font-family: inherit; }
.dos-columnas { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.dos-columnas h2 { margin-top: 0; font-size: 1.1rem; }
@media (max-width: 800px) {
  .dos-columnas { grid-template-columns: 1fr; }
  .resumen-precios { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .miniatura { display: none; }
}

/* Sin flechitas en los números ni triángulo de sugerencias (se escribe directamente) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[list]::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; }

.bloque-foto { display: flex; gap: 1rem; align-items: flex-start; margin-top: 1rem; flex-wrap: wrap; }
.vista-foto { width: 160px; height: 160px; border-radius: 10px; border: 1px dashed var(--borde); background: var(--fondo);
  display: grid; place-items: center; overflow: hidden; flex: none; font-size: 2.5rem; color: var(--suave); }
.vista-foto img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.bloque-foto .campo { margin-top: 0; }
.campo input[type=file] { padding: .6rem; background: var(--fondo); }

/* --- Compras ---------------------------------------------------------------- */
.pestanas { margin-bottom: 1rem; }
.relaciones { display: flex; gap: 1.25rem; flex-wrap: wrap; margin: -.4rem 0 1rem; }
.rejilla-cabecera { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .rejilla-cabecera { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .rejilla-cabecera { grid-template-columns: 1fr; } }
.titulo-lineas { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
.tabla-lineas { min-width: 860px; }
.tabla-lineas td { padding: .35rem .4rem; vertical-align: top; }
.tabla-lineas input { width: 100%; padding: .5rem; font-size: .95rem; border-radius: 6px;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.tabla-lineas input.num { text-align: right; max-width: 7rem; }
.tabla-lineas input:disabled { border-color: transparent; background: transparent; color: var(--texto); }
.tabla-lineas .col-articulo { width: 13rem; }
.tabla-lineas .importe, .tabla-lineas .recibido { padding-top: .8rem; }
.tabla-lineas .importe { font-weight: 600; }
.tabla-lineas input.con-articulo { border-color: var(--primario); font-weight: 600; }
.buscador-articulo { position: relative; }
.buscador-articulo .resultados { position: fixed; z-index: 30; width: 30rem; max-width: 80vw;
  margin: 0; padding: .3rem; list-style: none; background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-height: 20rem; overflow-y: auto; }
.buscador-articulo .resultados li { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; }
.buscador-articulo .resultados li:hover, .buscador-articulo .resultados li:first-child { background: var(--fondo); }
.buscador-articulo .resultados small { color: var(--suave); }
.ayuda-lineas { margin: .5rem 0; }
.totales { margin: 1rem 0 0 auto; max-width: 320px; display: grid; gap: .25rem; }
.totales div { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.totales span { color: var(--suave); }
.totales .total-final { border-top: 1px solid var(--borde); padding-top: .4rem; font-size: 1.2rem; }
.zona-borrar { display: flex; justify-content: flex-end; margin-top: .5rem; }
.casilla { width: 1.2rem; height: 1.2rem; }
@media (max-width: 700px) {
  .tabla-lineas { min-width: 0; }
  .tabla-lineas input.num { max-width: none; }
  .tabla-lineas .col-articulo { width: auto; }
}
.negativo { color: var(--error-texto); }
.regularizar { max-width: 760px; }
.dato-stock { display: flex; gap: 1rem; align-items: baseline; margin: .55rem 0 0; font-size: 1.1rem; }
.dato-stock a { font-size: .9rem; }
.campo-check { flex-wrap: wrap; }
.campo-check .ayuda { order: 1; flex-basis: 100%; margin-top: 0; }

/* --- Mover las cartas del inicio ------------------------------------------ */
.rejilla-modulos .modulo { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.modulo-fantasma { opacity: .35; border-style: dashed; }
.modulo-elegido { border-color: var(--primario); box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.pie-modulos { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; font-size: .88rem; }
.pie-modulos form { margin: 0; }
.boton-enlace { background: none; border: 0; padding: 0; color: var(--primario); cursor: pointer; font: inherit; text-decoration: underline; }

/* --- Seleccionar filas y borrar ------------------------------------------- */
.col-casilla { width: 2.4rem; text-align: center !important; }
.col-casilla input { width: 1.2rem; height: 1.2rem; cursor: pointer; vertical-align: middle; }
.barra-seleccion { display: none; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem;
  padding: .55rem .8rem; border-radius: 10px; background: var(--tarjeta); border: 1px solid var(--primario); }
.barra-seleccion.activa { display: flex; position: sticky; top: .5rem; z-index: 15; }
.barra-seleccion button:disabled { opacity: .5; cursor: default; }
.tabla tr.seleccionada td { background: color-mix(in srgb, var(--primario) 14%, transparent); }
@media (max-width: 700px) { .tabla td.col-casilla { justify-content: flex-start; } }

/* --- Base de datos (superusuario) ----------------------------------------- */
.tabla-bd { font-size: .85rem; }
.tabla-bd td, .tabla-bd th { white-space: nowrap; padding: .45rem .6rem; }
.tabla-bd td { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.nulo { color: var(--suave); font-style: italic; opacity: .7; }
.consola-sql textarea { width: 100%; margin-top: .5rem; padding: .75rem; border-radius: 8px; border: 1px solid var(--borde);
  background: var(--fondo); color: var(--texto); font: .95rem/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.consola-sql .botonera { justify-content: space-between; }
@media (max-width: 700px) { .tabla-bd td { display: table-cell; } .tabla-bd thead { display: table-header-group; } .tabla-bd tr { display: table-row; } }

/* --- Inventario ------------------------------------------------------------ */
.nuevo-inventario { display: flex; gap: .5rem; flex-wrap: wrap; }
.nuevo-inventario input { padding: .7rem .8rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); min-width: 16rem; }
.descripcion-inventario input { margin-top: .4rem; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); min-width: 20rem; max-width: 100%; }
.resumen-inventario { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.resumen-inventario div { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; padding: .6rem .8rem; display: flex; flex-direction: column; }
.resumen-inventario span { font-size: .8rem; color: var(--suave); }
.resumen-inventario strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .resumen-inventario { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.escaner .fila-escaner { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.escaner #codigo { flex: 1 1 280px; padding: .8rem; font-size: 1.15rem; border-radius: 8px; border: 2px solid var(--primario); background: var(--fondo); color: var(--texto); }
.campo-check-linea { display: flex; gap: .4rem; align-items: center; cursor: pointer; }
.campo-check-linea input { width: 1.2rem; height: 1.2rem; }
.ultimo-escaneado { margin-top: .75rem; padding: .6rem .8rem; border-radius: 8px; background: var(--fondo); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ultimo-escaneado input { width: 7rem; padding: .5rem; text-align: right; font-size: 1.1rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); }
.tabla-inventario .conteo, .tabla-inventario .paquetes { width: 6.5rem; padding: .5rem; text-align: right; font-size: 1rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.tabla-inventario .conteo.error { border-color: var(--error-texto); }
.tabla-inventario tr.contado td:first-child { box-shadow: inset 3px 0 0 var(--primario); }
.tabla-inventario tr.guardado td { background: color-mix(in srgb, #1e7a3c 18%, transparent); transition: background .3s; }
.positivo { color: #1e7a3c; }
.caja-buscar { flex: 1 1 320px; }
.caja-buscar #buscar { width: 100%; padding: .8rem; font-size: 1.15rem; border-radius: 8px; border: 2px solid var(--primario); background: var(--fondo); color: var(--texto); }
.buscador-articulo .resultados li.marcado { background: var(--primario); color: #fff; }
.buscador-articulo .resultados li.marcado small { color: #e6eaf0; }
.ayuda-inventario { margin: .6rem 0 0; }
.vacio-inventario { padding: 1rem; margin: 0; }

/* --- Ventas ----------------------------------------------------------------- */
.titulo-ventas { font-size: 1rem; font-weight: 400; }
.rejilla-cabecera .doble { grid-column: span 2; }
@media (max-width: 640px) { .rejilla-cabecera .doble { grid-column: auto; } }
.aviso-recargo { text-align: right; margin: .5rem 0 0; }

/* --- TPV ----------------------------------------------------------------------- */
.pagina-tpv .contenido { max-width: none; }
.tpv { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.tpv-arriba { display: flex; gap: .6rem; margin-bottom: .75rem; }
.tpv-buscar { flex: 1; }
.tpv-buscar input { width: 100%; padding: .9rem 1rem; font-size: 1.2rem; border-radius: 10px; border: 2px solid var(--primario); background: var(--tarjeta); color: var(--texto); }
#cliente { max-width: 280px; padding: .6rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); font-size: 1rem; }
.tpv-lineas { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); min-height: 55vh; overflow: auto; }
.tabla-tpv td { vertical-align: middle; padding: .45rem .6rem; }
.tabla-tpv input { width: 5.5rem; padding: .45rem; text-align: right; border-radius: 6px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font-size: 1rem; }
.tabla-tpv input.dto, .tabla-tpv input.dto2 { width: 3.8rem; }
.tpv-cant { display: inline-flex; align-items: center; gap: .25rem; }
.tpv-cant input { width: 4rem; }
.tabla-tpv input.total { width: 4.5rem; }
.tpv-cant button { width: 2rem; height: 2rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); cursor: pointer; font-size: 1.1rem; }
.tabla-tpv .importe { font-weight: 700; font-size: 1.05rem; }
.tpv-vacio { padding: 2rem; text-align: center; }
.tpv-derecha { display: flex; flex-direction: column; gap: .75rem; position: sticky; top: 1rem; }
.tpv-total { background: var(--primario); color: #fff; border-radius: var(--radio); padding: 1rem 1.2rem; display: flex; flex-direction: column; }
.tpv-total span { opacity: .85; }
.tpv-total strong { font-size: 2.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tpv-total .nota { color: #e6eaf0; }
.tpv-desglose div { display: flex; justify-content: space-between; color: var(--suave); font-size: .9rem; font-variant-numeric: tabular-nums; }
.boton-cobrar { padding: 1.1rem; font-size: 1.4rem; font-weight: 700; border: 0; border-radius: var(--radio); background: #1e7a3c; color: #fff; cursor: pointer; }
.boton-cobrar:disabled { opacity: .45; cursor: default; }
kbd { font-size: .75rem; padding: .05rem .35rem; border-radius: 4px; border: 1px solid currentColor; opacity: .7; margin-left: .3rem; font-family: inherit; }
.tpv-opcion { font-size: .9rem; }
.tpv-ultimo { background: var(--tarjeta); border: 1px solid #1e7a3c; border-radius: var(--radio); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
.tpv-cambio-grande { font-size: 1.6rem; font-weight: 700; color: #1e7a3c; }
.tpv-ultimo-botones { display: flex; gap: .5rem; }
.tpv-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; }
.tpv-modal[hidden] { display: none; }
.tpv-modal-caja { background: var(--tarjeta); border-radius: 14px; padding: 1.4rem 1.6rem; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.tpv-modal-caja h2 { margin: 0 0 .6rem; }
.tpv-a-pagar { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; }
.tpv-a-pagar strong { font-size: 2.2rem; }
.tpv-rapidos { display: flex; gap: .5rem; flex-wrap: wrap; margin: .8rem 0; }
.tpv-medios { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
#modal-cobro .tpv-modal-caja { width: min(560px, 94vw); box-sizing: border-box; }
.tpv-medios label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; min-width: 0; }
.tpv-medios input, .tpv-medios output { width: 100%; box-sizing: border-box; min-width: 0; padding: .6rem; font-size: 1.25rem; text-align: right; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.tpv-cambio { margin-top: .8rem; font-size: 1.6rem; font-weight: 700; text-align: right; color: #1e7a3c; min-height: 2rem; }
.tpv-cambio.falta { color: var(--error-texto); }
.tpv-medios select { width: 100%; box-sizing: border-box; padding: .6rem; font-size: 1.15rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.mc-deuda { margin-top: .8rem; padding: .8rem 1rem; border-radius: 10px; border: 2px solid #b7791f; background: color-mix(in srgb, #b7791f 12%, var(--fondo)); }
.mc-deuda-texto { margin: 0 0 .6rem; font-size: 1.25rem; font-weight: 700; }
.mc-deuda input { width: 100%; box-sizing: border-box; padding: .6rem; font-size: 1.05rem; border-radius: 8px; border: 2px solid var(--primario); background: var(--fondo); color: var(--texto); margin: .3rem 0; }
.mc-deuda .lista-clientes { max-height: 40vh; overflow-y: auto; }
.total-deudas { font-size: 1.1rem; } .total-deudas strong { font-size: 1.6rem; color: var(--error-texto); margin-left: .4rem; }
@media (max-width: 900px) { .tpv { grid-template-columns: 1fr; } }
.tpv-ultimo[hidden] { display: none; }
#tipo-doc { padding: .6rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); font-size: 1rem; }
.mc-parcial { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; margin-top: .6rem; }
.mc-parcial input { width: 100%; box-sizing: border-box; padding: .6rem; font-size: 1.25rem; text-align: right; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.pendiente-cobro { color: #b35c00; font-weight: 600; }
details.cobros { margin: -.4rem 0 1rem; }
details.cobros table { max-width: 520px; }
.boton-cobrar.boton-doc { background: var(--primario); }
.boton-espera { padding: 1.1rem; font-size: 1.4rem; font-weight: 700; border: 0; border-radius: var(--radio); background: #b7791f; color: #fff; cursor: pointer; }
.boton-espera .globo, #btn-pedidos .globo { position: static; display: inline-block; vertical-align: middle; }
#btn-pedidos .globo[hidden] { display: none; }
.caja-espera { width: min(720px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.lista-espera { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; }
.lista-espera li { display: grid; grid-template-columns: 6.5rem 1fr auto auto auto; align-items: center; gap: .7rem; padding: .5rem .7rem; border: 1px solid var(--borde); border-radius: 8px; background: var(--fondo); }
.lista-espera li.nota { display: block; }
.lista-pedidos li { grid-template-columns: auto 6.5rem 1fr auto auto auto; }
.caja-pedidos { width: min(980px, 96vw); }
#buscar-pedido { width: 100%; margin: .2rem 0 .4rem; padding: .8rem; font-size: 1.1rem; border-radius: 8px; border: 2px solid var(--primario); background: var(--fondo); color: var(--texto); }
.tpv-pedido { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .45rem .8rem; margin: 0 0 .6rem;
  border-radius: 8px; background: #e8f0fe; color: #1a3d7c; font-weight: 600; border: 1px solid #b6cdf5; }
.tpv-pedido[hidden] { display: none; }
.lista-espera .quien { display: flex; flex-direction: column; }
.lista-espera .esp-total { font-weight: 700; }
.tpv-cliente-caja { display: flex; gap: .4rem; }
.tpv-cliente { display: flex; align-items: center; gap: .4rem; max-width: 340px; padding: .6rem .9rem; border-radius: 10px;
  border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); font-size: 1rem; cursor: pointer; white-space: nowrap; }
.tpv-cliente span { overflow: hidden; text-overflow: ellipsis; }
.tpv-cliente.con-cliente { border-color: var(--primario); font-weight: 600; }
.caja-clientes { width: min(620px, 94vw); }
.caja-clientes input { width: 100%; padding: .8rem; font-size: 1.1rem; border-radius: 8px; border: 2px solid var(--primario); background: var(--fondo); color: var(--texto); }
.lista-clientes { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.lista-clientes li { padding: .6rem .7rem; border-radius: 8px; cursor: pointer; }
.lista-clientes li:hover { background: var(--fondo); }
.lista-clientes li.marcado { background: var(--primario); color: #fff; }
.lista-clientes li.marcado .nota { color: #e6eaf0; }
.nuevo-campos .ancho-total { grid-column: 1 / -1; }
.nuevo-campos input { text-align: left !important; font-size: 1.05rem !important; }
.tabla-tpv .tpv-ref, .tabla-tpv .tpv-barras { white-space: nowrap; }
.tabla-tpv input.desc { width: 100%; min-width: 12rem; text-align: left; }
.tabla-tpv input:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primario) 35%, transparent); }
.tpv-modal:has(.caja-productos) { place-items: start center; padding-top: 4vh; }
.caja-productos { width: min(1000px, 96vw); height: 88vh; display: flex; flex-direction: column; }
.cabecera-productos { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.filtros-productos { display: flex; gap: .5rem; margin: .4rem 0 .8rem; }
.filtros-productos input { flex: 1; padding: .7rem; font-size: 1.05rem; border-radius: 8px; border: 2px solid var(--primario); background: var(--fondo); color: var(--texto); }
.filtros-productos #pr-nuevo { white-space: nowrap; flex: none; }
.rejilla-productos { flex: 1; display: flex; flex-direction: column; gap: .3rem; overflow-y: auto; min-height: 0; }
.producto { display: grid; grid-template-columns: 44px 4.5rem 9rem 1fr 6rem 6rem auto; align-items: center; gap: .8rem; padding: .35rem .6rem; text-align: left; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font: inherit; width: 100%; }
.producto:hover, .producto:focus { border-color: var(--primario); outline: none; }
.producto.anadido { background: color-mix(in srgb, #1e7a3c 30%, var(--fondo)); }
.pr-foto { width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.4rem; background: #fff1; border-radius: 6px; overflow: hidden; }
.pr-foto img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.pr-desc { line-height: 1.2; }
.producto small { text-align: right; }
.pr-precio { font-weight: 700; font-size: 1.05rem; text-align: right; }
@media (max-width: 640px) { .producto { grid-template-columns: 44px 1fr 5rem; } .producto strong, .producto small, .producto .pr-id { display: none; } }
.producto .pr-id { font-variant-numeric: tabular-nums; }

#marco-imprimir { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; }
.menu-usuario .menu-empresas { left: auto; right: 0; }
.menu-empresas button.salir-menu { border-top: 1px solid var(--borde); margin-top: .3rem; border-radius: 0 0 8px 8px; }
.cuenta-rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 560px)); gap: 1rem; align-items: start; }
.cuenta-rejilla .tarjeta h2 { margin-top: 0; font-size: 1.15rem; }
.lista-cuenta { list-style: none; padding: 0; margin: 0 0 .8rem; display: flex; flex-direction: column; gap: .4rem; }
.fila-accion { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--borde); }
.fila-accion:first-of-type { border-top: 0; }
.fila-accion p { margin: .2rem 0 0; }
.fila-accion button { white-space: nowrap; flex: none; }
.zona-peligro { margin-top: 2rem; padding: 1.2rem 1.4rem; border: 2px solid #c0392b; border-radius: var(--radio); background: color-mix(in srgb, #c0392b 8%, var(--tarjeta)); max-width: 900px; }
.zona-peligro h2 { margin: 0 0 .8rem; color: #c0392b; font-size: 1.15rem; }
.boton-borrar-empresa { display: inline-block; list-style: none; cursor: pointer; padding: .7rem 1.1rem; border-radius: 8px; background: #c0392b; color: #fff; font-weight: 700; }
.boton-borrar-empresa::-webkit-details-marker { display: none; }
.zona-peligro details[open] .boton-borrar-empresa { margin-bottom: 1rem; }
.zona-peligro ul { margin: .4rem 0 .8rem; }
.confirmar-borrado { display: flex; flex-direction: column; gap: .5rem; max-width: 520px; }
.confirmar-borrado input { padding: .7rem; font-size: 1.05rem; border-radius: 8px; border: 2px solid #c0392b; background: var(--fondo); color: var(--texto); }
.boton-borrar-definitivo { padding: .8rem 1.2rem; border: 0; border-radius: 8px; background: #c0392b; color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }
.boton-borrar-definitivo:disabled { opacity: .4; cursor: not-allowed; }
.tpv-estado { padding: .6rem .9rem; border-radius: 8px; font-weight: 600; margin: 0 0 .6rem; }
.tpv-estado.sin-conexion { background: #c0392b; color: #fff; }
.tpv-estado.subiendo { background: #b7791f; color: #fff; }
.tpv-estado.subido { background: #1e7a3c; color: #fff; }
.tpv-estado.con-error { background: #7b241c; color: #fff; }
.tpv-sin-conexion .boton-espera { opacity: .5; }
.fila-nuevo-sector { display: flex; gap: .5rem; margin: .8rem 0 1rem; }
.fila-nuevo-sector input { flex: 1; padding: .6rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.fila-sector { display: flex; gap: .5rem; align-items: center; margin: 0; }
.fila-sector input[type=text] { flex: 1; min-width: 12rem; padding: .45rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.fila-sector input.orden { width: 5rem; padding: .45rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
/* Publicidad en el TPV (abajo) */
.tpv-publicidad { margin-top: .8rem; }
.publi-anuncio { position: relative; display: flex; align-items: center; justify-content: center; gap: .8rem; min-height: 64px; max-height: 110px;
  overflow: hidden; border-radius: var(--radio); border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto);
  text-decoration: none; padding: .6rem 1rem; animation: publi-entra .5s ease; }
.publi-anuncio img { max-width: 100%; max-height: 100px; object-fit: contain; display: block; }
.publi-anuncio small { color: var(--texto-suave, #888); text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; }
.publi-anuncio strong { font-size: 1.15rem; }
.publi-marca { position: absolute; top: 3px; right: 8px; font-style: normal; font-size: .65rem; opacity: .55; }
@keyframes publi-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Panel de anuncios */
.lista-anuncios { display: flex; flex-direction: column; gap: .8rem; }
.anuncio-fila { display: grid; grid-template-columns: minmax(220px, 1.2fr) 2fr auto; gap: 1rem; align-items: center; }
.anuncio-fila.mini { grid-template-columns: minmax(200px, 1fr) 2fr auto; padding: .5rem 0; border-top: 1px solid var(--borde); }
.publi-muestra { border: 1px dashed var(--borde); border-radius: 8px; padding: .5rem .7rem; min-height: 48px; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.publi-muestra img { max-width: 100%; max-height: 60px; object-fit: contain; }
.publi-proveedor { font-size: .75rem; text-transform: uppercase; opacity: .7; }
.publi-actual { max-width: 100%; max-height: 90px; border-radius: 6px; margin-bottom: .5rem; }
.lista-sectores ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .3rem .8rem; }
.tipo-anuncio ul { list-style: none; padding: 0; display: flex; gap: 1.2rem; }
.proveedor-publi { margin-bottom: 1rem; }
@media (max-width: 760px) { .anuncio-fila, .anuncio-fila.mini { grid-template-columns: 1fr; } }
.tipo-anuncio #id_tipo { display: flex; gap: 1.5rem; }
.lista-sectores #id_sectores { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem .9rem; }
.tipo-anuncio #id_tipo label, .lista-sectores #id_sectores label { display: flex; align-items: center; gap: .45rem; font-weight: 500; margin: 0; cursor: pointer; }
.tipo-anuncio #id_tipo input, .lista-sectores #id_sectores input { width: auto; margin: 0; }
.idiomas-login { display: flex; justify-content: center; gap: 1.2rem; margin: 1.2rem 0; font-size: .9rem; }
.idiomas-login a { color: var(--texto); opacity: .65; text-decoration: none; }
.idiomas-login a.actual { opacity: 1; font-weight: 700; text-decoration: underline; }
/* Publicidad del TPV en tarjetas */
.publi-cabecera { display: flex; justify-content: space-between; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; opacity: .55; margin: 0 .2rem .3rem; }
.publi-rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: 200px; gap: 10px; }
.publi-tarjeta { display: flex; flex-direction: column; justify-content: flex-start; gap: .35rem; padding: .8rem .85rem; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); text-decoration: none;
  animation: publi-entra .45s ease; }
a.publi-tarjeta:hover { border-color: var(--primario); }
.publi-tarjeta small { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; opacity: .6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.publi-tarjeta strong { font-size: 1.1rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.publi-tarjeta span { font-size: .85rem; opacity: .8; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.publi-tarjeta.con-imagen { padding: 0; gap: 0; justify-content: flex-start; }
.publi-tarjeta.con-imagen img { width: 100%; height: auto; max-height: 140px; flex: none; object-fit: contain; display: block; background: var(--fondo); }
.publi-pie { padding: .3rem .75rem .4rem; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.publi-pie strong { font-size: .92rem !important; -webkit-line-clamp: 1 !important; }
.publi-cabecera { align-items: center; gap: .8rem; }
.publi-cabecera input { flex: 0 1 320px; margin-left: auto; padding: .35rem .6rem; font-size: .85rem; text-transform: none; letter-spacing: 0;
  border-radius: 6px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); opacity: 1; }
.publi-cabecera { opacity: 1; } .publi-cabecera > span:first-child { opacity: .55; }
.publi-boton { border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); border-radius: 6px; padding: 0 .55rem; cursor: pointer; font-size: 1rem; line-height: 1.4; }
button.publi-tarjeta { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.publi-tarjeta:hover { border-color: var(--primario); }
.caja-publi { width: min(560px, 94vw); }
.caja-publi h2 { margin: .2rem 0 .6rem; }
.pf-proveedor { text-transform: uppercase; letter-spacing: .05em; opacity: .65; }
.caja-publi img { width: 100%; border-radius: 8px; margin-bottom: .6rem; }
.pf-datos { list-style: none; padding: 0; margin: .6rem 0 1rem; display: flex; flex-direction: column; gap: .35rem; font-size: 1.05rem; }
/* Entrada: casilla «Recordarme» */
.tarjeta-login .casilla-recordar { display: flex; align-items: center; gap: .5rem; margin: 1rem 0 0; font-weight: 500; cursor: pointer; }
.tarjeta-login .casilla-recordar input { width: 1.15rem; height: 1.15rem; margin: 0; padding: 0; flex: none; accent-color: var(--primario); }
.tarjeta-login .ayuda { display: block; color: var(--suave); font-size: .85rem; margin: .2rem 0 .4rem 1.65rem; }
.olvidar-equipo { text-align: center; margin-top: .8rem; font-size: .9rem; }
/* Panel: botón «Editar» para mover las cartas */
.cabecera-inicio { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
#editar-cartas { margin-top: .4rem; white-space: nowrap; }
#editar-cartas.boton-principal { width: auto; padding: .45rem .9rem; font-size: .95rem; }
.rejilla-modulos.editando .modulo { border-style: dashed; border-color: var(--primario); cursor: grab; animation: carta-tiembla .35s ease-in-out infinite alternate; }
.rejilla-modulos.editando .modulo:nth-child(2n) { animation-delay: .17s; }
@keyframes carta-tiembla { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
@media (prefers-reduced-motion: reduce) { .rejilla-modulos.editando .modulo { animation: none; } }
/* TPV: opción «Crear artículo» al final de los resultados */
li.crear-articulo { color: var(--primario); font-weight: 600; border-bottom: 1px dashed var(--borde); }
/* «Ver como» (administrador): menú de usuario y aviso arriba */
.menu-empresas .ver-como { border-top: 1px solid var(--borde); margin-top: .3rem; padding-top: .3rem; }
.ver-como-titulo { display: block; padding: .35rem .9rem .15rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); }
.menu-empresas .ver-como button { padding-left: 1.6rem; }
.menu-empresas .ver-como button.activo { font-weight: 700; color: var(--primario); }
.aviso-ver-como { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap;
  padding: .55rem 1rem; background: #b26b00; color: #fff; font-size: .95rem; }
.aviso-ver-como .boton-pequeno { background: #fff; color: #5a3600; border-color: #fff; }
.nuevo-campos .casilla-linea { flex-direction: row; align-items: center; gap: .5rem; }
.nuevo-campos .casilla-linea input { width: 1.15rem; height: 1.15rem; flex: none; }
/* Botones de la barra de arriba: misma altura y alineados */
.barra .boton-barra, .barra .selector-empresa summary { display: inline-flex; align-items: center; gap: .35rem; line-height: 1.4; min-height: 2.2rem; box-sizing: border-box; }
.barra .selector-empresa { display: flex; align-items: center; margin: 0; }
/* --- Informes ------------------------------------------------------------------------------ */
.informe-periodo { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1rem; }
.informe-periodo label { display: flex; align-items: center; gap: .4rem; color: var(--suave); font-size: .9rem; }
.informe-periodo input[type=date], .informe-periodo select { padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font: inherit; }
.informe-periodo .rangos { display: flex; flex-wrap: wrap; gap: .3rem; margin-right: .5rem; }
.informe-periodo .rangos a { padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--borde); color: var(--texto);
  text-decoration: none; font-size: .9rem; }
.informe-periodo .rangos a.activo { background: var(--primario); border-color: var(--primario); color: #fff; }
.cifras-informe { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.cifras-informe .cifra { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .2rem; }
.cifras-informe .cifra span { color: var(--suave); font-size: .85rem; }
.cifras-informe .cifra strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.cifras-informe .cifra small { color: var(--suave); }
.grafico-ventas { position: relative; margin-bottom: 1rem; padding: 1rem 1.2rem; }
.grafico-ventas h2 { font-size: 1rem; margin: 0 0 .8rem; color: var(--suave); font-weight: 600; }
.barras { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; align-items: end; height: 180px;
  border-bottom: 1px solid var(--borde); }
.barra-dia { height: 100%; display: flex; align-items: flex-end; cursor: default; outline: none; }
.barra-dia .relleno { width: 100%; max-width: 46px; margin: 0 auto; background: var(--primario); border-radius: 4px 4px 0 0; min-height: 0; }
.barra-dia:hover .relleno, .barra-dia:focus .relleno { filter: brightness(1.18); }
.eje-barras { display: flex; justify-content: space-between; color: var(--suave); font-size: .8rem; margin-top: .3rem; }
.globo-grafico { position: absolute; top: 2.4rem; transform: translateX(-50%); background: var(--fondo); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 8px; padding: .3rem .6rem; font-size: .85rem; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.tabla .fila-total td { font-weight: 700; border-top: 2px solid var(--borde); }
.dos-columnas { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; margin-bottom: .5rem; }
@media (max-width: 800px) { .dos-columnas { grid-template-columns: 1fr; } }
.filtros-informe select { max-width: 280px; }
/* Panel y ventas sin conexión */
.aviso-sin-conexion { background: #fdecec; color: #8a1c1c; padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.ventas-locales { margin-top: 1.5rem; }
.caja-documento { width: min(900px, 96vw); max-height: 90vh; overflow: auto; }
.vl-total { text-align: right; font-size: 1.3rem; font-weight: 700; margin: .8rem 0; }

/* Sin conexión: secciones del panel, ficha de cliente y avisos de lo subido */
.aviso-warning { background: #fff4e0; color: #7a4a00; }
.aviso-offline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.aviso-offline form { margin: 0; }
.modulo.modulo-activo { outline: 3px solid var(--primario, #2563eb); outline-offset: -3px; }
.tabla td.negativo { color: #b42318; font-weight: 700; }
.sc-ficha { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1rem; }
.sc-ficha dt { color: var(--texto-suave, #666); }
.sc-ficha dd { margin: 0; font-weight: 600; word-break: break-word; }

/* Series y numeración */
.tarjeta-serie { background: var(--tarjeta, #fff); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tarjeta-serie-cabecera { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.tarjeta-serie-cabecera h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.campos-serie { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem 1.2rem; margin-bottom: .8rem; }
.campos-serie label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; }
.codigo-serie { text-transform: uppercase; max-width: 12rem; }
.numero-serie { width: 7rem; text-align: right; }
.tabla-numeros-serie code { font-size: 1rem; }
.tarjeta-serie input[type=text] { padding: .45rem .6rem; border: 1px solid #c8ced6; border-radius: 8px; font-size: 1rem; }
.campos-serie small { font-weight: 400; }
.codigo-serie::placeholder { text-transform: none; }
.campo[hidden] { display: none; }

/* Modo pruebas */
.etiqueta-pruebas { background: #ffb020; color: #3a2600; font-weight: 700; padding: .35rem .7rem; border-radius: 8px; text-decoration: none; }
.tarjeta-pruebas.activo { border: 2px solid #ffb020; }
.borrar-todas { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; margin-top: .8rem; }
.borrar-todas label { display: flex; flex-direction: column; gap: .3rem; flex: 1 1 320px; font-weight: 600; }
.borrar-todas input { max-width: 10rem; padding: .45rem .6rem; border: 1px solid #c8ced6; border-radius: 8px; }

/* Sistema → Actividad */
.filtros-actividad { flex-wrap: wrap; gap: .5rem; }
.filtros-actividad label { display: flex; align-items: center; gap: .3rem; }
.tabla-actividad td { vertical-align: top; }
.actividad-detalle span { display: inline-block; margin-right: .7rem; font-size: .9rem; }
.actividad-detalle small { display: block; }
.actividad-fallo td, .actividad-error td { background: #fdf1f1; }
.actividad-bd_editar td, .actividad-bd_sql td { background: #fff8e6; }
.actividad-detalle .antes { text-decoration: line-through; color: #a33; }
.actividad-detalle .despues { color: #1e6b34; font-weight: 600; }
.cabecera-lista-log { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cabecera-lista-log form { margin: 0; }

/* Cabecera fija en las listas: el título, los botones y el buscador se quedan arriba al bajar */
.cabecera-fija { position: sticky; top: 0; z-index: 20; background: var(--fondo);
                 margin: 0 -1rem; padding: .6rem 1rem .1rem; box-shadow: 0 6px 8px -8px rgba(0,0,0,.25); }
.cabecera-fija .buscador { margin-bottom: .6rem; }
.cabecera-fija ~ form .barra-seleccion.activa, .cabecera-fija ~ .barra-seleccion.activa { top: calc(var(--alto-fijo, 0px) + .3rem); }

/* Artículos: cada artículo en una sola línea (lo que no cabe se corta con «…»; al pasar el ratón se ve entero) */
@media (min-width: 701px) {
  .tabla-articulos th, .tabla-articulos td { white-space: nowrap; }
  .tabla-articulos td.celda-corta { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
  .tabla-articulos td.celda-larga { max-width: 20rem; }
  .tabla-articulos td, .tabla-articulos th { padding-left: .5rem; padding-right: .5rem; }
  .tabla-articulos td, .tabla-articulos th { padding-top: .45rem; padding-bottom: .45rem; }
}
/* Listas a todo lo ancho del navegador (Artículos) */
.pagina-ancha .contenido { max-width: none; padding-left: 1.5rem; padding-right: 1.5rem; }
.pagina-ancha .cabecera-fija { margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
@media (min-width: 701px) { .pagina-ancha .tabla-articulos td.celda-larga { max-width: 32rem; } .pagina-ancha .tabla-articulos td.celda-corta { max-width: 13rem; } }

/* Artículos: al bajar por la lista, la fila de títulos (ID, Referencia… Stock) se queda fija debajo del buscador.
   El contenedor no puede tener scroll propio (si no, «sticky» se pega a él y no a la ventana). */
@media (min-width: 701px) {
  .tabla-contenedor.contenedor-cabecera-fija { overflow: visible; }
  .contenedor-cabecera-fija thead th { position: sticky; top: var(--alto-fijo, 0px); z-index: 10;
                                       background: var(--tarjeta); box-shadow: inset 0 -1px 0 var(--borde); }
}

/* Ventana de cobro: «Descuento %» a todo el documento (debajo de «Entregado») */
.mc-descuento { margin-top: .6rem; }
.mc-descuento[hidden] { display: none; }
.mc-descuento .mc-dto-antes { align-self: end; padding-bottom: .7rem; text-align: right; }

/* TPV: recargo dentro del total; buscador de clientes con ID y comercial */
.tpv-total .total-recargo { display: block; font-size: .9rem; opacity: .85; }
.lista-clientes .cli-id { font-variant-numeric: tabular-nums; }
.lista-clientes .cli-comercial { float: right; font-size: .85rem; color: var(--suave); }

/* TPV: alta de cliente con todos los datos (como la ficha); se desplaza si no cabe */
.modal-cliente-completo { width: min(760px, 96vw); max-height: 94vh; display: flex; flex-direction: column; box-sizing: border-box; }
.modal-cliente-completo .nuevo-campos-cliente { overflow-y: auto; flex: 1; padding-right: .3rem; }
.nuevo-campos-cliente fieldset { border: 0; padding: 0; margin: 0 0 .6rem; }
.nuevo-campos-cliente legend { font-weight: 700; color: var(--suave); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .3rem; }
.nuevo-campos select, .nuevo-campos textarea { width: 100%; box-sizing: border-box; padding: .55rem; font-size: 1.05rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font-family: inherit; }


/* La casilla donde está el cursor se ve claramente: fondo amarillo suave y borde ámbar (en todo el ERP) */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([readonly]):focus, select:focus, textarea:focus,
.tabla-tpv input:focus, .tpv-medios input:focus, .filtros-productos input:focus {
  background-color: var(--foco-fondo) !important; border-color: var(--foco-borde) !important; outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--foco-borde) 35%, transparent) !important;
}
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--foco-borde); outline-offset: 2px;
}

/* Promociones: buscador para añadir artículos; en el TPV, las líneas de promoción en azul claro */
.buscador-promo { position: relative; margin: .5rem 0 .8rem; }
.buscador-promo input { width: 100%; }
.buscador-promo .resultados { position: absolute; left: 0; right: 0; top: 100%; width: auto; max-width: none; z-index: 30; }
.tabla-tpv tr.linea-promo td { background: #dceefe; }
.tabla-tpv tr.linea-promo .tpv-ref::after { content: " 🏷"; }

/* Ficha de promoción: más ancha, y las casillas del buscador y de la tabla con el estilo del ERP */
.ficha-promo { max-width: 1100px; }
.buscador-promo input, .tabla-promo input {
  box-sizing: border-box; padding: .55rem .7rem; font-size: 1rem; border-radius: 8px;
  border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font-family: inherit;
}
.buscador-promo input { padding: .7rem .9rem; font-size: 1.05rem; }
.tabla-promo input { width: 7rem; text-align: right; }
.tabla-promo th, .tabla-promo td { padding-left: .5rem; padding-right: .5rem; }
.tabla-promo td.desc { min-width: 12rem; }

/* TPV: «No existe» */
#modal-no-existe .tpv-modal-caja { width: min(440px, 94vw); }
.no-existe-texto { font-size: 1.15rem; margin: .4rem 0 1.2rem; word-break: break-all; }
#modal-no-existe button:focus { outline: 3px solid var(--foco-borde); outline-offset: 3px; }
.producto .pr-editar { white-space: nowrap; text-decoration: none; }
@media (max-width: 640px) { .producto { grid-template-columns: 44px 1fr 5rem auto; } }

/* Artículos: cargar fotos de una carpeta */
.caja-fotos { width: min(620px, 94vw); }
.caja-fotos .boton-carpeta { display: inline-block; margin: .8rem 0; cursor: pointer; }
.caja-fotos progress { width: 100%; height: 1.1rem; }
.caja-fotos .fotos-sin-lista { max-height: 12rem; overflow: auto; font-size: .85rem; }

/* Ficha de artículo: a la derecha, a qué clientes se ha vendido */
.ficha-con-lateral { display: grid; gap: 1.2rem; align-items: start; }
@media (min-width: 1200px) {
  /* el recuadro mide lo mismo que la ficha (no la alarga); si la lista es más larga, se baja con el ratón */
  .ficha-con-lateral { align-items: stretch; }
  .lateral-vendido { position: relative; min-height: 14rem; padding: 0 !important; }
  .lateral-vendido .lateral-dentro { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 1.25rem; }
  .lateral-vendido .tabla-contenedor { flex: 0 1 auto; min-height: 0; overflow-y: auto; }   /* termina donde acaba la lista (si es más larga, se baja con el ratón) */
  .tabla-vendido thead th { position: sticky; top: 0; background: var(--tarjeta); z-index: 1; }
  .tabla-vendido tfoot th { position: sticky; bottom: 0; background: var(--tarjeta); }
}
@media (min-width: 1200px) { .ficha-con-lateral { grid-template-columns: minmax(0, 760px) minmax(0, 1fr); } }
.ficha-con-lateral > .tarjeta-formulario { max-width: none; margin: 0; }
.lateral-vendido h2 { margin-top: 0; font-size: 1.15rem; }
.tabla-vendido th, .tabla-vendido td { padding: .45rem .5rem; }
.tabla-vendido tfoot th { border-top: 2px solid var(--borde); }

/* TPV: buscador arriba a todo lo ancho; debajo, en una línea, cliente, productos y los botones de la venta */
.pagina-tpv .tpv-arriba { flex-wrap: wrap; align-items: stretch; }
.pagina-tpv .tpv-arriba .tpv-buscar { flex: 1 1 100%; }
.tpv-acciones { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
.tpv-acciones .boton-cobrar, .tpv-acciones .boton-espera { padding: .55rem 1rem; font-size: 1.05rem; border-radius: 10px; }
.tpv-acciones .boton-pequeno { padding: .55rem .9rem; }
.tpv-acciones kbd { font-size: .7rem; }
/* (a la derecha solo queda el total: más estrecho, más sitio para la venta) */
@media (min-width: 901px) { .tpv { grid-template-columns: minmax(0, 1fr) 260px; } }
.pagina-tpv .tpv-total strong { font-size: 2.3rem; }

/* TPV (todo en una columna): arriba buscador + total; debajo cliente, productos y botones; luego las líneas */
.pagina-tpv .tpv { grid-template-columns: minmax(0, 1fr) !important; }
.pagina-tpv .tpv-arriba .tpv-buscar { flex: 0 1 720px; align-self: center; }
.pagina-tpv .tpv-salto { flex-basis: 100%; height: 0; }
.pagina-tpv .tpv-arriba .tpv-total { flex: 1 1 auto; flex-direction: row; align-items: center; justify-content: flex-end;
  gap: 1rem; padding: .5rem 1.2rem; margin-left: auto; }
.pagina-tpv .tpv-arriba .tpv-total > span:first-child { font-size: 1.1rem; }
.pagina-tpv .tpv-arriba .tpv-total strong { font-size: 2.4rem; }
.pagina-tpv .tpv-total-notas { display: flex; flex-direction: column; text-align: right; }
/* TPV: arriba los botones (cliente, productos, cobrar…); debajo el escaneo y el total */
.pagina-tpv .tpv-arriba > * { order: 1; }
.pagina-tpv .tpv-arriba > .tpv-salto { order: 2; }
.pagina-tpv .tpv-arriba > .tpv-buscar, .pagina-tpv .tpv-arriba > .tpv-total { order: 3; }
/* TPV · Comparación con un Excel: panel a la izquierda */
.pagina-tpv .tpv.con-comparar { grid-template-columns: 340px minmax(0, 1fr) !important; }
.tpv-comparar { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); display: flex; flex-direction: column;
                position: sticky; top: .5rem; max-height: calc(100vh - 1rem); overflow: hidden; }
.tpv-comparar[hidden] { display: none; }
.cmp-cabecera { display: flex; align-items: center; gap: .5rem; padding: .6rem .7rem; border-bottom: 1px solid var(--borde); }
.cmp-cabecera small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-resumen { display: flex; flex-wrap: wrap; gap: .35rem; padding: .5rem .7rem; font-size: .85rem; }
.cmp-resumen span { padding: .15rem .5rem; border-radius: 999px; font-weight: 600; }
.cmp-lista { overflow: auto; flex: 1; }
.tabla-cmp { font-size: .85rem; }
.tabla-cmp td, .tabla-cmp th { padding: .35rem .5rem; }
.tabla-cmp thead th { position: sticky; top: 0; background: var(--tarjeta); z-index: 1; }
.tabla-cmp tbody tr { cursor: pointer; }
.tabla-cmp .cmp-cod { white-space: nowrap; font-weight: 600; }
.tabla-cmp .cmp-desc { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabla-cmp tr.cmp-ok td, .cmp-resumen .cmp-ok { background: #d9f2df; color: #145c2a; }
.tabla-cmp tr.cmp-falta td, .cmp-resumen .cmp-falta { background: #ffe3c2; color: #8a4500; }
.tabla-cmp tr.cmp-sobra td, .cmp-resumen .cmp-sobra { background: #f1f1f4; color: #6b6b78; font-style: italic; }
.tabla-cmp tbody tr:hover td { filter: brightness(.96); }
@media (max-width: 900px) { .pagina-tpv .tpv.con-comparar { grid-template-columns: 1fr !important; } .tpv-comparar { position: static; max-height: 45vh; } }
/* TPV · Imprimir etiquetas */
.caja-etiquetas { width: min(760px, 96vw); }
.et-opciones { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; margin-bottom: .7rem; }
.et-opciones input { width: 4.5rem; text-align: right; }
.et-lista { max-height: 55vh; overflow: auto; border: 1px solid var(--borde); border-radius: var(--radio); }
.et-lista .et-copias { width: 4.5rem; text-align: right; }
/* Comparación: el panel acaba donde acaba la tabla del TPV (si hay más líneas, se baja con el ratón dentro) */
@media (min-width: 901px) {
  .pagina-tpv .tpv.con-comparar { align-items: stretch; }
  .tpv-comparar { position: static; max-height: none; align-self: stretch; contain: size; min-height: 0; }
}
/* TPV: la fila de botones siempre en una línea y siempre con todo (textos y teclas F). Si no cabe, el TPV
   la va haciendo más pequeña (ver «ajustarFila» en tpv.html): .compacta → .mas-compacta → .mini */
.pagina-tpv .tpv-fila-botones { order: 1; flex: 1 1 100%; min-width: 0; display: flex; flex-wrap: nowrap; align-items: stretch; gap: .5rem; }
.pagina-tpv .tpv-fila-botones > * { flex-shrink: 0; }
.pagina-tpv .tpv-fila-botones .tpv-acciones { flex-wrap: nowrap; margin-left: auto; }
.pagina-tpv .tpv-fila-botones button { white-space: nowrap; }
.tpv-fila-botones.compacta { gap: .4rem; }
.tpv-fila-botones.compacta .tpv-acciones { gap: .4rem; }
.tpv-fila-botones.compacta button { padding: .5rem .65rem !important; font-size: .95rem !important; gap: .3rem; }
.tpv-fila-botones.mas-compacta { gap: .3rem; }
.tpv-fila-botones.mas-compacta .tpv-acciones { gap: .3rem; }
.tpv-fila-botones.mas-compacta button { padding: .45rem .5rem !important; font-size: .85rem !important; }
.tpv-fila-botones.mas-compacta kbd { font-size: .7rem; padding: 0 .2rem; }
.tpv-fila-botones.mini button { padding: .4rem .4rem !important; font-size: .78rem !important; gap: .2rem; }
.tpv-fila-botones.mini kbd { font-size: .65rem; }
/* El buscador y el total, siempre juntos en su línea */
.pagina-tpv .tpv-arriba .tpv-buscar { flex: 1 1 360px; max-width: 720px; }
.pagina-tpv .tpv-arriba .tpv-total { flex: 1 1 260px; min-width: 0; }
@media (max-width: 1100px) { .pagina-tpv .tpv-arriba .tpv-total strong { font-size: 1.8rem; } }
/* Último paso: textos cortos (Etiqueta, Notas, Vaciar, Comparar) y el nombre del cliente recortado; las teclas F se quedan */
.tpv-fila-botones .txt-c { display: none; }
.tpv-fila-botones.corta .txt-l { display: none; }
.tpv-fila-botones.corta .txt-c { display: inline; }
.tpv-fila-botones.corta .tpv-cliente-caja { flex-shrink: 1; min-width: 90px; }
.tpv-fila-botones.corta #btn-cliente { min-width: 0; max-width: 100%; overflow: hidden; }
.tpv-fila-botones.corta #cliente-nombre { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Comparación: el resumen en una sola línea */
.cmp-resumen { flex-wrap: nowrap; gap: .3rem; white-space: nowrap; font-size: .8rem; }
.cmp-resumen span { padding: .15rem .45rem; }
/* Comparación: las 4 columnas siempre a la vista; las líneas no se pueden pulsar */
.tabla-cmp { width: 100%; table-layout: fixed; font-size: .8rem; }
.tabla-cmp col.c-cod { width: 118px; }
.tabla-cmp col.c-num { width: 46px; }
.tabla-cmp td, .tabla-cmp th { padding: .35rem .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabla-cmp .cmp-desc { max-width: none; }
.tabla-cmp tbody tr { cursor: default; }
.tabla-cmp tbody tr:hover td { filter: none; }
.cmp-lista { overflow-x: hidden; }
.tabla-cmp col.c-cod { width: 128px; }
.tabla-cmp col.c-num { width: 50px; }
.tabla-cmp td, .tabla-cmp th { padding: .35rem .3rem; }
.tabla-cmp td:first-child, .tabla-cmp th:first-child { padding-left: .5rem; }
.tabla-cmp .cmp-cod { font-weight: 600; letter-spacing: -.01em; text-overflow: clip; }
/* TPV: la tabla de líneas con alto fijo (si hay más líneas, se baja dentro) y la cabecera siempre a la vista */
.pagina-tpv .tpv-lineas { height: 58vh; min-height: 320px; overflow: auto; }
.pagina-tpv .tabla-tpv thead th { position: sticky; top: 0; z-index: 2; background: var(--tarjeta); box-shadow: inset 0 -1px 0 var(--borde); }
/* Productos (TPV): columna de peso, entre el stock y el precio */
.producto { grid-template-columns: 44px 4.5rem 9rem 1fr 6rem 5.5rem 6rem auto; }
.pr-peso { text-align: right; white-space: nowrap; }
@media (max-width: 640px) { .producto { grid-template-columns: 44px 1fr 5rem auto; } .producto .pr-peso { display: none; } }
/* TPV: columna «Peso» de la línea */
.tabla-tpv td.peso { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* TPV: cantidad, total uds. y precio del mismo ancho que los descuentos */
.pagina-tpv .tpv-cant input.cantidad, .pagina-tpv .tabla-tpv input.total, .pagina-tpv .tabla-tpv input.precio { width: 3.8rem; padding: .45rem .35rem; }
.tabla-tpv th .peso-total { display: block; font-size: .95rem; font-weight: 700; color: var(--texto); white-space: nowrap; }
.tabla-tpv th .peso-total:empty { display: none; }
/* TPV: Stock y Peso al final (detrás de la ✕); el peso total, pequeño */
.tabla-tpv th .peso-total { font-size: .78rem; font-weight: 600; }
.tabla-tpv td.stock { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla-tpv td.stock.stock-corto { color: #c0392b; font-weight: 700; }
/* TPV: las columnas de números, solo lo justo (Cantidad, Paquete…); el sitio que sobra es para la descripción */
.pagina-tpv .tabla-tpv th, .pagina-tpv .tabla-tpv td { width: 1%; white-space: nowrap; }
.pagina-tpv .tabla-tpv th:nth-child(3), .pagina-tpv .tabla-tpv td:nth-child(3) { width: auto; }
.pagina-tpv .tabla-tpv td:nth-child(3) input.desc { min-width: 10rem; }
.pagina-tpv .tabla-tpv th { padding-left: .6rem; padding-right: .6rem; }
.pagina-tpv .tabla-tpv td { padding-left: .6rem; padding-right: .6rem; }
/* TPV: Cantidad y Total uds., más estrechas (caben 4 cifras) */
.pagina-tpv .tpv-cant input.cantidad, .pagina-tpv .tabla-tpv input.total { width: 3rem; padding: .45rem .3rem; }
.pagina-tpv .tpv-cant { gap: .2rem; }
.pagina-tpv .tpv-cant button { padding-left: .45rem; padding-right: .45rem; min-width: 0; }
/* Ventas: Editar · Imprimir · Devolución, en una línea */
.acciones-venta { display: inline-flex; gap: .35rem; white-space: nowrap; }
/* Cierre de caja */
.cierre-form { display: flex; flex-direction: column; gap: .8rem; padding: 1rem 1.2rem; margin: 1rem 0 1.5rem; }
.cierre-cuadre { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; align-items: flex-end; }
.cierre-cuadre > div { display: flex; flex-direction: column; }
.cierre-cuadre strong { font-size: 1.5rem; }
.cierre-cuadre label { display: flex; flex-direction: column; font-weight: 600; }
.cierre-cuadre input { font-size: 1.4rem; width: 11rem; text-align: right; }
.cierre-nota { display: flex; flex-direction: column; }
.cierre-falta { color: #c0392b; font-weight: 700; }
.cierre-sobra { color: #b8650a; font-weight: 700; }
.cierre-cuadra { color: #1e7a3c; font-weight: 700; }
.cifra.cifra-total strong { color: var(--primario); }
.tabla-cierre tr.fila-devolucion td { color: #c0392b; }
.hoja-cierre { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.5rem; }
.cierre-cabecera { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cierre-cabecera h1 { margin: 0; }
.cierre-fechas { text-align: right; line-height: 1.6; }
.cierre-totales { max-width: 480px; margin-bottom: 1rem; }
.cierre-totales .fila-total td { font-weight: 700; font-size: 1.05rem; }
@media print {
  @page { size: A4; margin: 12mm; }
  .pagina-cierre .barra, .pagina-cierre .no-imprimir, .pagina-cierre .aviso { display: none !important; }
  .pagina-cierre, .pagina-cierre .contenido { background: #fff !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .hoja-cierre { border: 0; padding: 0; color: #000; }
  .hoja-cierre .tabla { font-size: 9.5pt; }
  .hoja-cierre .tabla td, .hoja-cierre .tabla th { padding: 1.2mm 2mm; }
  .hoja-cierre .tabla-contenedor { overflow: visible; border: 0; }
}
.cierre-form input { padding: .55rem .7rem; border: 1px solid var(--borde); border-radius: 8px; background: var(--fondo); color: var(--texto); font: inherit; }
.cierre-cuadre input { font-size: 1.4rem; }
.cierre-dia { display: flex; gap: .5rem; align-items: center; }
.cierre-dia input { padding: .45rem .6rem; border: 1px solid var(--borde); border-radius: 8px; font: inherit; background: var(--fondo); color: var(--texto); }
.cierre-ya { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.cierre-previo { font-weight: 600; }
/* Desplegables con buscador (selector_buscable.js): se escribe encima y sale la lista filtrada */
select.sb-oculto { display: none !important; }
.sb-input { box-sizing: border-box; min-width: 9rem; padding: .55rem 2rem .55rem .7rem; border: 1px solid var(--borde); border-radius: 8px;
  background: var(--fondo) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23778' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right .7rem center;
  color: var(--texto); font: inherit; text-overflow: ellipsis; }
.sb-input:disabled { opacity: .6; }
.campo .sb-input, .tpv-medios .sb-input, .nuevo-campos .sb-input, .rejilla-campos .sb-input { width: 100%; }
.sb-lista { position: fixed; z-index: 10000; margin: 0; padding: .25rem; list-style: none; overflow-y: auto; background: var(--tarjeta); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.18); box-sizing: border-box; }
.sb-lista[hidden] { display: none; }
.sb-lista li { padding: .45rem .65rem; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-lista li.sb-marcada { background: var(--primario); color: #fff; }
.sb-lista li.sb-elegida:not(.sb-marcada) { font-weight: 700; }
.sb-lista li.sb-nada { color: var(--texto-suave, #888); cursor: default; }
/* TPV: ficha del cliente arriba a la derecha (al lado de los botones y del total) */
.pagina-tpv .tpv-cabecera { display: flex; gap: .75rem; align-items: stretch; margin-bottom: .75rem; }
.pagina-tpv .tpv-cabecera > .tpv-arriba { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
.tpv-ficha-cliente { flex: 0 0 340px; display: flex; flex-direction: column; gap: .2rem; padding: .45rem .7rem; border: 1px solid var(--borde);
  border-radius: 10px; background: var(--tarjeta); font-size: .82rem; line-height: 1.3; overflow: hidden; min-width: 0; }
.tpv-ficha-cliente .fc-cabecera { display: flex; gap: .4rem; align-items: center; }
.tpv-ficha-cliente .fc-nombre { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem; border: 1px solid var(--borde);
  border-radius: 8px; background: var(--fondo); color: var(--texto); font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; text-align: left; }
.tpv-ficha-cliente .fc-nombre span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpv-ficha-cliente .fc-nombre.con-cliente { border-color: var(--primario); }
.tpv-ficha-cliente .fc-nombre:hover { border-color: var(--primario); }
.tpv-ficha-cliente .fc-datos { display: flex; flex-direction: column; gap: .05rem; padding: 0 .2rem; overflow: hidden; }
.tpv-ficha-cliente .fc-datos div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpv-ficha-cliente .fc-fiscal { font-weight: 600; }
.tpv-ficha-cliente .fc-aviso { color: #b8650a; font-weight: 600; }
.tpv-ficha-cliente .fc-marcas { color: var(--primario); font-weight: 600; }
.tpv-ficha-cliente.fc-contado .fc-datos { justify-content: center; flex: 1; }
@media (max-width: 1100px) { .pagina-tpv .tpv-cabecera { flex-direction: column; } .tpv-ficha-cliente { flex-basis: auto; } }
.tpv-ficha-cliente { flex-basis: 360px; }
.tpv-ficha-cliente .fc-nombre span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.tpv-ficha-cliente .fc-nombre kbd { font-size: .7rem; }
.tpv-ficha-cliente #quitar-cliente { padding: .25rem .5rem; align-self: stretch; }
.tpv-ficha-cliente .fc-datos .fc-marcas { white-space: normal; }
.pagina-tpv .tpv-total strong { white-space: nowrap; }
.pagina-tpv .tpv-total-notas small { white-space: nowrap; }
@media (max-width: 1500px) { .pagina-tpv .tpv-arriba .tpv-total strong { font-size: 2rem; } .pagina-tpv .tpv-total-notas { font-size: .85em; } }
.pagina-tpv .tpv-cabecera > .tpv-arriba { align-content: space-between; }
.pagina-tpv .tpv-arriba .tpv-buscar { flex: 1 1 220px; }
.pagina-tpv .tpv-arriba .tpv-total { flex: 1 0 auto; min-width: max-content; }
/* TPV: el total, solo lo que ocupa; el escáner, todo lo demás */
.pagina-tpv .tpv-arriba .tpv-buscar { flex: 1 1 300px; max-width: none; }
.pagina-tpv .tpv-arriba .tpv-total { flex: 0 0 auto; min-width: max-content; margin-left: 0; }
/* TPV · Buscar cliente: cada cliente en una sola línea (ventana más ancha) y con «Editar» */
.caja-clientes { width: min(1150px, 96vw); }
.caja-clientes .lista-clientes { max-height: 60vh; }
.caja-clientes .lista-clientes li { display: flex; align-items: center; gap: .7rem; white-space: nowrap; }
.caja-clientes .lista-clientes li .cli-id { flex: 0 0 4.5rem; }
.caja-clientes .lista-clientes li .cli-nombre { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.caja-clientes .lista-clientes li .cli-datos { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.caja-clientes .lista-clientes li .cli-comercial { float: none; flex: 0 0 auto; }
.caja-clientes .lista-clientes li .cli-editar { flex: 0 0 auto; padding: .2rem .55rem; font-size: .85rem; text-decoration: none; }
.caja-clientes .lista-clientes li.marcado .cli-editar { background: #fff; color: var(--primario); }
.tpv-ficha-cliente #editar-cliente { padding: .25rem .45rem; text-decoration: none; align-self: stretch; display: inline-flex; align-items: center; }
.caja-clientes .lista-clientes li.marcado .cli-comercial { color: #e6eaf0; }
/* Ventana de cobro: segunda forma de pago */
.mc-otra { background: none; border: 0; color: var(--primario); font: inherit; font-size: .9rem; cursor: pointer; padding: .2rem 0; text-decoration: underline; align-self: flex-start; }
.mc-segundo { border-top: 1px dashed var(--borde); padding-top: .5rem; }
.mc-quitar2 { background: none; border: 0; color: var(--suave, #888); cursor: pointer; font-size: .9rem; padding: 0 .2rem; }
#mc-deuda-botones { flex-wrap: wrap; }
/* Ventas (lista): cada documento en una sola línea; la página usa más ancho si hace falta */
.pagina-ventas-lista .contenido { max-width: 1900px; }
.pagina-ventas-lista .tabla th, .pagina-ventas-lista .tabla td { white-space: nowrap; }
.pagina-ventas-lista .tabla td, .pagina-ventas-lista .tabla th { padding-left: .55rem; padding-right: .55rem; }
.pagina-ventas-lista .tabla .estado { white-space: nowrap; }
.pagina-ventas-lista .acciones-venta .boton-pequeno { padding: .35rem .6rem; }
.imagen-doc { display: block; max-width: 140px; max-height: 140px; margin-bottom: .4rem; border: 1px solid var(--borde); border-radius: 6px; background: #fff; }
/* TPV: filas más juntas (menos hueco entre línea y línea) */
.pagina-tpv .tabla-tpv td { padding-top: .18rem; padding-bottom: .18rem; }
.pagina-tpv .tabla-tpv input { padding-top: .28rem; padding-bottom: .28rem; }
.pagina-tpv .tpv-cant button { height: 1.75rem; }
.pagina-tpv .tabla-tpv td > button, .pagina-tpv .tabla-tpv .quitar { padding-top: .2rem; padding-bottom: .2rem; }
/* TPV: total con recargo, pequeño, a la izquierda de «N artículos» */
.pagina-tpv .tpv-notas-fila { display: flex; justify-content: flex-end; align-items: baseline; gap: 1rem; }
.pagina-tpv .total-con-recargo { font-weight: 700; color: #fff; background: rgba(255,255,255,.14); padding: .05rem .5rem; border-radius: 6px; }
/* Ventana de cobro: «Enviar por correo» (debajo del descuento, en la columna de la derecha) */
.mc-correo { margin-top: .7rem; }
.mc-correo-col { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.mc-correo-check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; cursor: pointer; white-space: nowrap; padding: .35rem .4rem; border-radius: 8px; }
.mc-correo-check:focus-within { outline: 2px solid var(--primario); }
.mc-correo-check input { width: 1.2rem; height: 1.2rem; }
.mc-correo-col input[type=email] { width: 100%; box-sizing: border-box; padding: .55rem .6rem; font-size: 1rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.tpv-medios .mc-correo-check { flex-direction: row; font-size: 1rem; }
.tpv-medios .mc-correo-check input[type=checkbox] { width: 1.25rem; height: 1.25rem; padding: 0; flex: none; margin: 0; }
.tpv-medios .mc-correo-col input[type=email] { font-size: 1rem; text-align: left; }
/* TPV: que se note bien en qué casilla estás (y en qué línea) */
.pagina-tpv .tabla-tpv input:hover { border-color: color-mix(in srgb, var(--primario) 55%, var(--borde)); }
.pagina-tpv .tabla-tpv input:focus { background: #fff6cc; color: #111; border-color: var(--primario); font-weight: 700;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primario) 45%, transparent); }
.pagina-tpv .tabla-tpv tr:focus-within td { background: color-mix(in srgb, var(--primario) 9%, transparent); }
.pagina-tpv .tabla-tpv tr:focus-within td:first-child { box-shadow: inset 4px 0 0 var(--primario); }
/* TPV: botones de arriba y ficha del cliente — al pasar el ratón o al llegar con el teclado se nota */
.pagina-tpv .tpv-cabecera button, .pagina-tpv .tpv-cabecera a.boton-pequeno {
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background-color .12s ease; }
.pagina-tpv .tpv-cabecera button:not(:disabled):hover, .pagina-tpv .tpv-cabecera a.boton-pequeno:hover {
  transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.pagina-tpv .tpv-cabecera .tpv-cliente:hover, .pagina-tpv .tpv-cabecera .boton-pequeno:hover, .pagina-tpv .tpv-cabecera .fc-nombre:hover {
  background-color: #fff6cc; border-color: var(--primario); }
.pagina-tpv .tpv-cabecera button:focus-visible, .pagina-tpv .tpv-cabecera a.boton-pequeno:focus-visible {
  outline: 3px solid #f5b800; outline-offset: 2px; }
.pagina-tpv .tpv-cabecera button:not(:disabled):active { transform: translateY(0); box-shadow: none; }
.pagina-tpv .tpv-buscar input:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primario) 25%, transparent); }
.pagina-tpv .tpv-buscar input:focus { background: #fffbe6; box-shadow: 0 0 0 4px color-mix(in srgb, var(--primario) 35%, transparent); outline: none; }
/* Ventas (lista): botones de cada documento, todos iguales y alineados en columnas */
.pagina-ventas-lista .acciones-venta { display: inline-grid; grid-template-columns: 4.6rem 6.4rem 8.6rem 7.4rem 5.6rem; gap: .3rem; }
.pagina-ventas-lista .acciones-venta .boton-pequeno { display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  padding: .3rem .4rem; font-size: .88rem; height: 2.05rem; box-sizing: border-box; white-space: nowrap; }
.pagina-ventas-lista .acciones-venta .enviado { color: #1e7a3c; border-color: #1e7a3c; }
#modal-correo .mco-campo { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; margin: .6rem 0 .2rem; }
#modal-correo input { padding: .6rem; font-size: 1.05rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
/* Listas: las filas que se abren con doble clic */
table tbody tr.fila-abrible { cursor: pointer; }
table tbody tr.fila-abrible:hover td { background: color-mix(in srgb, var(--primario) 6%, transparent); }
/* Fichas con Intro: el botón «Guardar» cuando se llega a él con el teclado */
form[data-intro-baja] button[type=submit]:focus { outline: 3px solid #f5b800; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(245,184,0,.25); }
/* Compras: casilla «IVA incluido» arriba a la derecha de la cabecera */
#form-compra .iva-incluido-caja { margin-top: .5rem; }
#form-compra .iva-incluido-caja .campo { margin: 0; }
#form-compra .tabla-lineas .total-uds { font-weight: 600; white-space: nowrap; }
#form-compra .tabla-lineas input.total-uds { font-weight: 700; }
#form-compra .tabla-lineas td:nth-child(2) { min-width: 13rem; }
/* compras: la referencia más ancha y todas las casillas de números del mismo tamaño (el de «Cajas») */
#form-compra .tabla-lineas td.col-articulo { min-width: 12rem; }
#form-compra .tabla-lineas input.num { width: 4.6rem; max-width: 4.6rem; }
#form-compra .tabla-lineas td.num { width: 1%; }
/* Compras (lista): junto al estado, a qué albarán / factura se ha pasado */
.estado-y-pase { display: inline-flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.estado-y-pase .pase { font-size: .85rem; font-weight: 600; white-space: nowrap; color: var(--primario); text-decoration: none; }
.estado-y-pase .pase:hover { text-decoration: underline; }
/* TPV: código de barras en la lista del buscador, detrás de la referencia */
.resultados .res-barras { font-style: normal; font-size: .85em; color: var(--suave); font-variant-numeric: tabular-nums; margin-right: .2rem; }
.resultados .res-barras:empty { display: none; }
.resultados li.marcado .res-barras { color: inherit; opacity: .8; }
/* TPV: lupa para abrir la ficha del artículo (en otra pestaña) */
.pagina-tpv .tabla-tpv .col-lupa { width: 1%; padding-left: .2rem; }
.pagina-tpv .tabla-tpv .lupa { padding: .2rem .45rem; text-decoration: none; }

/* compras: 🔍 delante de la referencia para abrir la ficha del artículo */
.linea-articulo { display: flex; align-items: center; gap: .3rem; }
.linea-articulo .buscador-articulo { flex: 1; min-width: 0; }
.linea-articulo .lupa { padding: .2rem .4rem; flex: none; }

/* ficha de artículo dentro de la ventana flotante (compras): sin la barra de arriba */
.en-modal .barra, .en-modal .aviso-ver-como { display: none; }
.en-modal .contenido { padding-top: .6rem; }
dialog.modal-articulo { width: min(1250px, 96vw); height: 92vh; padding: 0; border: none; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
dialog.modal-articulo::backdrop { background: rgba(15, 23, 42, .45); }
dialog.modal-articulo iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--fondo); }
dialog.modal-articulo .cerrar-modal { position: absolute; top: .5rem; right: .7rem; z-index: 2; }

/* artículo nuevo: buscador «Copiar datos de otro artículo» al lado del título */
.titulo-con-copiar { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.titulo-con-copiar h1 { margin-right: .5rem; }
.copiar-articulo { flex: 1; max-width: 30rem; min-width: 16rem; }
.copiar-articulo input { width: 100%; padding: .55rem .7rem; border: 1px solid var(--borde); border-radius: 8px; font-size: .95rem; }
.copiar-articulo #copiado-de { display: block; margin-top: .3rem; color: var(--primario); }

/* «Vendido a»: filtros por cliente y fechas, y nº de cliente delante */
.filtros-vendido { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin-bottom: .6rem; align-items: center; }
.filtros-vendido input[type=search] { flex: 1 1 100%; padding: .45rem .6rem; border: 1px solid var(--borde); border-radius: 8px; }
.filtros-vendido label { font-size: .85rem; color: var(--suave); display: flex; align-items: center; gap: .3rem; }
.filtros-vendido input[type=date] { padding: .3rem .4rem; border: 1px solid var(--borde); border-radius: 6px; }
.lateral-vendido .vendido-resultado { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabla-vendido .num-cliente { font-variant-numeric: tabular-nums; }

/* Inventario: el mismo artículo contado otra vez sale en otra línea, marcada «Duplicado» */
.tabla-inventario .duplicado { display: block; margin-top: .15rem; font-size: .78rem; font-weight: 600; color: #b45309; }
.tabla-inventario .duplicado[hidden] { display: none; }
/* inventario: la fecha (se puede cambiar) al lado de la descripción */
.descripcion-inventario { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.descripcion-inventario input[type=date], .descripcion-inventario input[type=time] { width: auto; min-width: 0; }

/* inventario: la ubicación se puede cambiar (se guarda en el artículo) */
.tabla-inventario .ubicacion { width: 9rem; padding: .45rem .5rem; border-radius: 6px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); }
.tabla-inventario .ubicacion.error { border-color: var(--error-texto); }

/* ===== Todo lo que se puede pulsar: al pasar el ratón por encima, una pequeña animación ===== */
button, input[type=submit], input[type=button], summary, select, a.modulo, a[class*="boton"], .pestanas a,
a.publi-tarjeta, .producto, .resultados li, .sb-lista li, .lista-clientes li, label:has(> input[type=checkbox]),
input[type=checkbox], input[type=radio], tr.fila-abrible, .lupa {
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease, background-color .15s ease,
              border-color .15s ease, color .15s ease;
}
:is(button, input[type=submit], input[type=button], a[class*="boton"], .pestanas a, summary):not(:disabled):hover {
  filter: brightness(1.06);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .14);
}
:is(a.modulo, a.publi-tarjeta, button.publi-tarjeta, .producto):hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .12); }
select:not(:disabled):hover, input:is([type=text], [type=search], [type=date], [type=number], [type=email], [type=password], :not([type])):not(:disabled):hover,
textarea:not(:disabled):hover, .sb-input:not(:disabled):hover {
  border-color: color-mix(in srgb, var(--primario) 55%, var(--borde));
}
/* enlaces de texto: el subrayado se marca un poco */
.contenido a:not([class]):hover { text-decoration-thickness: 2px; text-underline-offset: 3px; }
/* listas desplegables (buscadores): la fila se mueve un poquito */
.resultados li:hover, .sb-lista li:hover, .lista-clientes li:hover { background: var(--fondo); }
label:has(> input[type=checkbox]):hover { color: var(--primario); }
@media (prefers-reduced-motion: no-preference) {
  :is(button, input[type=submit], input[type=button], a[class*="boton"], .pestanas a):not(:disabled):hover { transform: translateY(-1px); }
  :is(button, input[type=submit], input[type=button], a[class*="boton"], .pestanas a):not(:disabled):active { transform: translateY(0) scale(.97); box-shadow: none; }
  :is(a.modulo, a.publi-tarjeta, button.publi-tarjeta, .producto):hover { transform: translateY(-2px); }
  input:is([type=checkbox], [type=radio]):not(:disabled):hover { transform: scale(1.12); }
  .resultados li:hover, .sb-lista li:hover, .lista-clientes li:hover { transform: translateX(3px); }
}

/* inventario: nº del día (si hay varios el mismo día, cuál va antes) */
.orden-dia { font-size: .6em; color: var(--suave); font-weight: 600; }
.orden-dia-campo { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--suave); }
.descripcion-inventario .orden-dia-campo input { width: 4.2rem; min-width: 0; text-align: right; margin-top: .4rem; }

/* inventario: 🔍 delante de la referencia */
.tabla-inventario .lupa { padding: .15rem .4rem; margin-right: .3rem; vertical-align: middle; }
/* inventario: en su buscador, la primera de la lista no sale marcada hasta pulsar Intro o ↓ */
.escaner .buscador-articulo .resultados li:first-child:not(.marcado):not(:hover) { background: transparent; }

/* ventana: borrar inventarios y hacer uno con el stock de ahora */
dialog.dialogo-cuadrar { max-width: 34rem; border: none; border-radius: 12px; padding: 1.4rem 1.6rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.dialogo-cuadrar::backdrop { background: rgba(15, 23, 42, .45); }
dialog.dialogo-cuadrar h3 { margin-top: 0; }
dialog.dialogo-cuadrar .botonera { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; margin-top: 1rem; }

/* ===== 💬 Chat tiendas ↔ proveedores de publicidad ===== */
.barra button.boton-chat { cursor: pointer; font: inherit; background: transparent; color: #fff; }
.barra button.boton-chat:hover { background: rgba(255,255,255,.12); }
.chat-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 900; background: var(--tarjeta);
  border-left: 1px solid var(--borde); box-shadow: -10px 0 30px rgba(15, 23, 42, .18); display: flex; flex-direction: column; }
.chat-panel[hidden] { display: none !important; }
.chat-cabecera { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; background: var(--primario); color: #fff; }
.chat-cabecera .boton-pequeno { padding: .25rem .55rem; }
.chat-vista { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-vista[hidden] { display: none !important; }
.chat-chats { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-fila { padding: .75rem 1rem; border-bottom: 1px solid var(--borde); cursor: pointer; }
.chat-fila:hover, .chat-fila:focus { background: var(--fondo); outline: none; }
.chat-fila-arriba, .chat-fila-abajo { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.chat-fila-abajo span:first-child { color: var(--suave); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-fila small { color: var(--suave); }
.chat-fila.sin-leer strong, .chat-fila.sin-leer .chat-fila-abajo span:first-child { color: var(--texto); font-weight: 700; }
.chat-fila.bloqueada { opacity: .6; }
.chat-vacio { padding: 1.2rem 1rem; color: var(--suave); text-align: center; }
.chat-hilo-cabecera { display: flex; align-items: center; gap: .4rem; padding: .55rem .7rem; border-bottom: 1px solid var(--borde); }
.chat-hilo-nombre { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-hilo-nombre strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-hilo-nombre small a { margin-right: .5rem; font-size: .8rem; }
.chat-hilo-cabecera .boton-pequeno { padding: .3rem .55rem; font-size: .85rem; white-space: nowrap; }
.chat-aviso { background: #fff4e0; color: #7a4a00; padding: .45rem .8rem; font-size: .85rem; }
.chat-mensajes { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .45rem; background: var(--fondo); }
.chat-msg { max-width: 85%; align-self: flex-start; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px 12px 12px 4px;
  padding: .45rem .7rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow-wrap: anywhere; }
.chat-msg.mio { align-self: flex-end; background: color-mix(in srgb, var(--primario) 12%, var(--tarjeta)); border-radius: 12px 12px 4px 12px; }
.chat-msg.con-oferta { max-width: 100%; width: 100%; }
.chat-autor { display: block; color: var(--primario); font-weight: 600; font-size: .78rem; }
.chat-cita { font-size: .8rem; color: var(--suave); border-left: 3px solid var(--primario); padding-left: .4rem; margin-bottom: .25rem; }
.chat-hora { display: block; text-align: right; color: var(--suave); font-size: .72rem; margin-top: .15rem; }
.chat-check { color: var(--suave); }
.chat-msg.mio.leido .chat-check { color: #1d9bf0; }
.chat-foto { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin-top: .25rem; }
.chat-pdf { display: inline-block; margin-top: .2rem; }
.chat-sobre, .chat-adjunto { display: flex; align-items: center; gap: .4rem; padding: .35rem .8rem; font-size: .85rem;
  background: color-mix(in srgb, var(--primario) 8%, var(--tarjeta)); border-top: 1px solid var(--borde); }
.chat-sobre[hidden], .chat-adjunto[hidden] { display: none !important; }
.chat-sobre span, .chat-adjunto span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sobre button, .chat-adjunto button { border: none; background: none; cursor: pointer; }
.chat-escribir { display: flex; align-items: flex-end; gap: .4rem; padding: .6rem .7rem; border-top: 1px solid var(--borde); }
.chat-escribir textarea { flex: 1; resize: none; padding: .55rem .7rem; border: 1px solid var(--borde); border-radius: 10px;
  font: inherit; max-height: 140px; background: var(--fondo); color: var(--texto); }
.chat-escribir .boton-ok { padding: .5rem .85rem; }
.chat-vista.bloqueada .chat-escribir { opacity: .5; }
.chat-oferta { font-size: .85rem; }
.chat-oferta-titulo { font-weight: 700; margin-bottom: .3rem; }
.chat-oferta table { width: 100%; border-collapse: collapse; }
.chat-oferta th, .chat-oferta td { padding: .2rem .3rem; border-bottom: 1px solid var(--borde); text-align: left; }
.chat-oferta .num { text-align: right; white-space: nowrap; }
.chat-oferta tfoot td { font-weight: 700; border-bottom: none; }
.chat-oferta-notas { margin: .35rem 0 0; color: var(--suave); }
.chat-oferta-botones { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.chat-oferta-estado { margin-top: .45rem; font-weight: 600; }
.chat-oferta-estado.ok { color: #1e6b34; }
.chat-oferta-estado.no { color: #b42318; }
.chat-oferta-form { padding: .9rem; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.chat-oferta-form h3 { margin: 0; }
.chat-oferta-form input, .chat-oferta-form textarea { width: 100%; padding: .45rem .55rem; border: 1px solid var(--borde); border-radius: 8px;
  font: inherit; background: var(--fondo); color: var(--texto); box-sizing: border-box; }
.chat-oferta-tabla { width: 100%; border-collapse: collapse; }
.chat-oferta-tabla th { font-size: .75rem; color: var(--suave); text-align: left; padding: 0 .2rem; }
.chat-oferta-tabla td { padding: .15rem; }
.chat-oferta-tabla .num { text-align: right; }
.chat-oferta-tabla td:nth-child(1) { width: 22%; } .chat-oferta-tabla td:nth-child(3) { width: 14%; } .chat-oferta-tabla td:nth-child(4) { width: 20%; }
@media (min-width: 1100px) { body.con-chat .contenido { margin-right: 420px; } }

/* «Ver como proveedor de anuncios» (superusuario) */
.menu-empresas .ver-proveedor select { margin: .2rem .9rem .5rem 1.6rem; width: calc(100% - 2.5rem); padding: .35rem .4rem;
  border: 1px solid var(--borde); border-radius: 6px; font: inherit; font-size: .9rem; background: var(--tarjeta); color: var(--texto); }
.ver-proveedor-vacio { display: block; padding: .2rem .9rem .5rem 1.6rem; }

/* Ficha del cliente: sus ventas a la derecha (filtrar y mandar por correo) */
.vc-correo { display: flex; gap: .4rem; margin-bottom: .5rem; }
.vc-correo input { flex: 1; min-width: 0; padding: .45rem .6rem; border: 1px solid var(--borde); border-radius: 8px; }
.vc-correo .boton-ok { padding: .45rem .8rem; white-space: nowrap; }
.vc-estado { margin: 0 0 .5rem; }
.filtros-vendido select { padding: .3rem .4rem; border: 1px solid var(--borde); border-radius: 6px; }
.tabla-ventas-cliente td.acciones .boton-pequeno { padding: .15rem .45rem; }

/* TPV: la página cabe justa en la pantalla (la tabla se ajusta y la publicidad queda abajo del todo) */
.pagina-tpv .contenido { padding-bottom: .4rem; }
.pagina-tpv .tpv-lineas { min-height: 160px; }
/* La publicidad del TPV, siempre en una sola fila (lo que no cabe no se ve) */
.tpv-publicidad .publi-rejilla { max-height: 200px; overflow: clip; overflow-clip-margin: 8px; }
.buscador .fecha-buscar { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; font-size: .9rem; }
.buscador .fecha-buscar input { padding: .45rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); }
.buscador a.boton-pequeno.activo { background: var(--primario); color: #fff; border-color: var(--primario); }
/* Ficha de artículo: marcas Baja tablet/web, Descatalogado, Liquidación junto a «Identificación» */
.legend-con-marcas { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; width: 100%; box-sizing: border-box; padding-right: .5rem; }
.marcas-articulo { display: flex; flex-wrap: wrap; gap: .5rem 1.8rem; margin-left: auto; font-weight: 600; color: var(--texto); }
.marcas-articulo label { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; margin: 0; }
.marcas-articulo input { width: 1.15rem; height: 1.15rem; margin: 0; }
@media (max-width: 760px) { .marcas-articulo { margin-left: 0; } }
/* Familias en árbol */
.familias-pantalla { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
.arbol-familias { padding: .8rem; }
.arbol-barra { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.arbol-barra input { flex: 1 1 220px; padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--borde); background: var(--fondo); color: var(--texto); font-size: 1rem; }
.arbol { list-style: none; margin: 0; padding: 0; }
.arbol .nodo { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem .45rem calc(.4rem + var(--nivel) * 1.6rem);
  border-radius: 8px; position: relative; border-left: 4px solid hsl(var(--tono) 60% 55%); margin-bottom: 2px;
  background: hsl(var(--tono) 75% 50% / .11); }
.arbol .nodo[hidden] { display: none; }
.arbol .nodo.nivel-0 { font-weight: 700; font-size: 1.05rem; padding-top: .6rem; padding-bottom: .6rem; margin-top: .35rem; }
.arbol .nodo:not(.nivel-0)::before { content: ""; position: absolute; left: calc(var(--nivel) * 1.6rem - .6rem); top: 0; bottom: 50%;
  width: .7rem; border-left: 1px dashed hsl(var(--tono) 40% 60%); border-bottom: 1px dashed hsl(var(--tono) 40% 60%); }
.arbol .nodo:hover { background: hsl(var(--tono) 70% 50% / .16); }
.arbol .nodo.editando { outline: 2px solid var(--primario); }
.arbol .nodo.coincide .nodo-nombre { background: #fff3a8; color: #111; border-radius: 4px; padding: 0 .2rem; }
.arbol .nodo.inactivo { opacity: .55; }
.nodo-flecha { width: 1.7rem; height: 1.7rem; border: 1px solid var(--borde); border-radius: 6px; background: var(--tarjeta); color: var(--texto); cursor: pointer; flex: none; font-size: .9rem; padding: 0; }
.nodo-flecha.vacia { border: 0; background: none; cursor: default; }
.nodo-icono { flex: none; }
.nodo-nombre { color: var(--texto); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nodo-nombre:hover { text-decoration: underline; }
.nodo-sub { font-size: .78rem; font-weight: 400; color: var(--suave); white-space: nowrap; }
.nodo-cuenta { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; background: var(--tarjeta);
  border: 1px solid var(--borde); border-radius: 999px; padding: .05rem .6rem; font-size: .85rem; }
.nodo-cuenta small { font-weight: 400; color: var(--suave); }
.nodo-acciones { display: flex; gap: .3rem; flex: none; opacity: .35; transition: opacity .15s; }
.arbol .nodo:hover .nodo-acciones, .arbol .nodo:focus-within .nodo-acciones { opacity: 1; }
.nodo-acciones .boton-pequeno { padding: .2rem .55rem; }
.form-familia { position: sticky; top: 1rem; }
@media (max-width: 900px) { .familias-pantalla { grid-template-columns: 1fr; } .form-familia { position: static; } .nodo-acciones { opacity: 1; } }
.arbol-ayuda { margin: 0 0 .5rem; font-size: .85rem; }
.nodo-asa { cursor: grab; color: var(--suave); flex: none; font-size: 1.1rem; line-height: 1; padding: 0 .1rem; user-select: none; }
.arbol .nodo[draggable=true] { cursor: grab; }
.arbol .nodo.arrastrando { opacity: .35; }
.arbol .nodo.drop-dentro { outline: 2px dashed var(--primario); outline-offset: -2px; background: color-mix(in srgb, var(--primario) 14%, transparent); }
.arbol .nodo.drop-antes { box-shadow: inset 0 3px 0 var(--primario); }
.arbol .nodo.drop-despues { box-shadow: inset 0 -3px 0 var(--primario); }
.form-borrar-familia { display: inline; margin: 0; }
.boton-borrar-familia:hover { background: #fde8e8; border-color: #e0a0a0; }
.arbol-leyenda { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .4rem; }
.arbol-leyenda span { border-left: 4px solid hsl(var(--tono) 60% 55%); background: hsl(var(--tono) 75% 50% / .13); border-radius: 6px; padding: .1rem .6rem; font-size: .8rem; font-weight: 600; }
/* TPV: la ficha del artículo (lupa) en ventana flotante más pequeña */
dialog.modal-articulo-tpv { width: min(980px, 92vw); height: 82vh; }
/* ===== Ficha de artículo (diseño nuevo) ===== */
.ficha-art-cabecera { display: flex; gap: 1rem; align-items: center; background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: 14px; padding: .9rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.fac-foto { width: 84px; height: 84px; flex: none; border-radius: 12px; background: var(--fondo); border: 1px solid var(--borde);
  display: grid; place-items: center; overflow: hidden; font-size: 2.2rem; }
.fac-foto img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.fac-texto { min-width: 0; }
.fac-texto h1 { margin: 0; font-size: 1.45rem; line-height: 1.25; }
.fac-id { font-size: .85rem; color: var(--suave); font-weight: 600; vertical-align: middle; }
.fac-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .2rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .65rem; border-radius: 999px; font-size: .85rem;
  background: var(--fondo); border: 1px solid var(--borde); color: var(--texto); text-decoration: none; white-space: nowrap; }
.chip-familia { background: hsl(215 80% 50% / .1); border-color: hsl(215 60% 70%); }
.chip-stock { background: hsl(140 60% 45% / .12); border-color: hsl(140 45% 65%); }
.chip-stock.sin { background: hsl(0 80% 55% / .1); border-color: hsl(0 60% 75%); }
.chip-alerta { background: hsl(35 95% 55% / .15); border-color: hsl(35 80% 65%); font-weight: 600; }
.ficha-art-cabecera .fechas-ficha { margin: .2rem 0 0; font-size: .8rem; }
.ficha-art { padding: .4rem; background: transparent; border: 0; box-shadow: none; }
.ficha-art .formulario { display: flex; flex-direction: column; gap: .9rem; }
.fa-seccion { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px; padding: .9rem 1.1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.fa-titulo { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--borde); padding-bottom: .55rem; margin-bottom: .2rem; }
.fa-titulo h2 { margin: 0; font-size: 1.02rem; letter-spacing: .01em; }
.fa-rejilla { display: grid; gap: 0 1rem; }
.fa-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fa-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fa-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fa-todo { grid-column: 1 / -1; }
.fa-2col { grid-column: span 2; }
.ficha-art .campo { margin-top: .7rem; }
.ficha-art .campo label { font-size: .82rem; font-weight: 600; color: var(--suave); margin-bottom: .25rem; }
.ficha-art .campo input:not([type=checkbox]):not([type=file]), .ficha-art .campo select, .ficha-art .campo textarea {
  padding: .5rem .7rem; font-size: 1rem; border-radius: 9px; background: var(--fondo); border: 1px solid var(--borde); }
.ficha-art .campo input:focus, .ficha-art .campo select:focus, .ficha-art .campo textarea:focus {
  outline: none; border-color: var(--primario); background: var(--tarjeta); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primario) 18%, transparent); }
.fa-precios .campo input { font-size: 1.15rem !important; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.fa-precios .campo:first-child input { background: hsl(140 60% 45% / .1) !important; border-color: hsl(140 45% 60%) !important; }
.fa-margen { margin-top: .7rem; align-self: end; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 .8rem;
  padding: .45rem .8rem; border-radius: 10px; border: 1px dashed var(--borde); background: var(--fondo); min-height: 2.6rem; }
.fa-margen span { font-size: .8rem; color: var(--suave); font-weight: 600; grid-row: span 2; }
.fa-margen strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.fa-margen small { color: var(--suave); }
.fa-margen.bien { border-color: hsl(140 45% 60%); background: hsl(140 60% 45% / .08); }
.fa-margen.bien strong { color: #1e7a3c; }
.fa-margen.bajo { border-color: hsl(35 80% 60%); background: hsl(35 95% 55% / .1); }
.fa-margen.bajo strong { color: #b7791f; }
.fa-margen.malo { border-color: hsl(0 60% 70%); background: hsl(0 80% 55% / .08); }
.fa-margen.malo strong { color: #c0392b; }
.fa-marcas { display: flex; flex-wrap: wrap; gap: .4rem; }
.fa-marca { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--borde);
  font-size: .85rem; font-weight: 600; cursor: pointer; background: var(--fondo); user-select: none; margin: 0; }
.fa-marca:has(input:checked) { background: hsl(35 95% 55% / .18); border-color: hsl(35 80% 55%); }
.fa-marca input { margin: 0; width: 1rem; height: 1rem; }
.fa-stock { display: flex; align-items: baseline; gap: .6rem; padding: .45rem .8rem; border-radius: 10px; text-decoration: none;
  background: hsl(140 60% 45% / .1); border: 1px solid hsl(140 45% 65%); color: var(--texto); }
.fa-stock strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.fa-stock small { color: var(--suave); }
.fa-stock.cero { background: var(--fondo); border-color: var(--borde); }
.fa-stock.negativo { background: hsl(0 80% 55% / .08); border-color: hsl(0 60% 75%); }
.fa-stock.negativo strong { color: #c0392b; }
.fa-otros { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.fa-otros .bloque-foto { flex-direction: column; margin-top: .7rem; }
.fa-otros .vista-foto { width: 150px; height: 150px; }
.fa-otros .campo-check { margin-top: 2rem; }
.fa-guardar { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--fondo) 85%, transparent);
  backdrop-filter: blur(6px); padding: .7rem .2rem; margin: 0; border-top: 1px solid var(--borde); }
.fa-guardar .boton-ok { padding: .65rem 2.2rem; font-size: 1.05rem; }
@media (max-width: 760px) {
  .fa-3, .fa-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fa-otros { grid-template-columns: 1fr; }
  .ficha-art-cabecera { align-items: flex-start; }
  .fac-foto { width: 60px; height: 60px; }
}
.fa-otros { grid-template-columns: 190px minmax(0, 1fr); }
.fa-otros .bloque-foto { gap: .5rem; }
.fa-otros .bloque-foto .campo { margin-top: 0; }
.fa-otros input[type=file] { max-width: 100%; font-size: .8rem; }
.fa-otros .bloque-foto .ayuda { font-size: .75rem; }
/* ===== Lista de artículos (diseño nuevo) ===== */
.pagina-articulos .tabla-articulos { border-collapse: separate; border-spacing: 0; }
.pagina-articulos .tabla-articulos thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); }
.pagina-articulos .tabla-articulos tbody tr { transition: background .12s; }
.pagina-articulos .tabla-articulos tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--fondo) 55%, transparent); }
.pagina-articulos .tabla-articulos tbody tr:hover td { background: color-mix(in srgb, var(--primario) 7%, transparent); }
.pagina-articulos .tabla-articulos tr.inactivo td { opacity: .55; }
.pagina-articulos .miniatura { width: 60px; position: relative; }
.pagina-articulos .miniatura img { width: 52px; height: 52px; border-radius: 10px; border: 1px solid var(--borde);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08); transition: transform .15s; position: relative; z-index: 1; }
.pagina-articulos .miniatura img:hover { transform: scale(3); z-index: 20; box-shadow: 0 8px 30px rgba(15, 23, 42, .3); transform-origin: left center; }
.pagina-articulos .sin-foto { width: 52px; height: 52px; border-radius: 10px; background: var(--fondo); border: 1px dashed var(--borde);
  display: grid; place-items: center; font-size: 1.3rem; opacity: .55; }
.pagina-articulos .col-ref strong { display: block; font-size: 1rem; }
.pagina-articulos .col-ref small { display: block; color: var(--suave); font-size: .78rem; font-variant-numeric: tabular-nums; }
.pagina-articulos .col-desc { font-weight: 500; }
.marcas-fila { margin-left: .4rem; display: inline-flex; gap: .15rem; font-size: .9rem; }
.pastilla { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; padding: .12rem .55rem;
  border-radius: 999px; background: var(--fondo); border: 1px solid var(--borde); font-size: .82rem; }
.pastilla-familia { background: hsl(215 80% 50% / .09); border-color: hsl(215 50% 78%); }
.pastilla-ubic { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; background: hsl(275 60% 55% / .08); border-color: hsl(275 40% 80%); }
.pagina-articulos .vacio { color: var(--suave); opacity: .45; }
.pagina-articulos td.precio-1 { font-weight: 700; font-size: 1.02rem; }
.pagina-articulos td.precio-otro { color: var(--suave); }
.pastilla-stock { display: inline-block; min-width: 2.6rem; text-align: center; padding: .15rem .55rem; border-radius: 999px; font-weight: 700;
  text-decoration: none; font-variant-numeric: tabular-nums; background: hsl(140 60% 45% / .13); color: #1e7a3c; border: 1px solid hsl(140 45% 70%); }
.pastilla-stock.cero { background: var(--fondo); color: var(--suave); border-color: var(--borde); }
.pastilla-stock.negativo { background: hsl(0 80% 55% / .1); color: #c0392b; border-color: hsl(0 60% 78%); }
.pastilla-stock:hover { filter: brightness(.95); }
.pagina-articulos .boton-editar-fila { opacity: .6; }
.pagina-articulos tr:hover .boton-editar-fila { opacity: 1; border-color: var(--primario); }
/* Comerciales: la tabla entera a la vista */
.comerciales-pantalla { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
.pagina-comerciales .tabla td, .pagina-comerciales .tabla th { white-space: nowrap; }
.pagina-comerciales .tabla td:nth-child(2) { white-space: normal; min-width: 12rem; }
.acciones-fila { display: inline-flex; gap: .35rem; align-items: center; }
.form-borrar-comercial { display: inline; margin: 0; }
@media (max-width: 1000px) { .comerciales-pantalla { grid-template-columns: 1fr; } }
.fa-margen { display: flex; flex-direction: column; align-self: start; margin-top: 2.05rem; padding: .35rem .7rem; gap: 0; min-height: 0; }
.fa-margen span { font-size: .72rem; grid-row: auto; }
.fa-margen strong { font-size: 1.1rem; white-space: nowrap; line-height: 1.2; }
.fa-margen small { font-size: .75rem; white-space: nowrap; }
.pagina-comerciales .tabla td:nth-child(2) { min-width: 15rem; }

/* =====================================================================
   ACABADO VISUAL DE TODO EL PROGRAMA (capa final: solo aspecto)
   ===================================================================== */
:root {
  --fondo: #f3f5f9;
  --borde: #dde3eb;
  --sombra: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .04);
  --sombra-alta: 0 6px 22px rgba(15, 23, 42, .10);
  --radio: 14px;
}
body { background: radial-gradient(1200px 500px at 0 0, #eef3fb 0, transparent 60%), var(--fondo); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; }
h1 { font-weight: 800; letter-spacing: -.015em; }
h2 { letter-spacing: -.01em; }
.subtitulo { font-size: .95rem; }
::selection { background: color-mix(in srgb, var(--primario) 22%, transparent); }

/* Barra de arriba */
.barra { background: linear-gradient(180deg, #22416b 0%, var(--primario) 100%); box-shadow: 0 2px 10px rgba(15, 23, 42, .18); }

/* Tarjetas y contenedores de tablas */
.tarjeta, .tabla-contenedor { border-color: var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.tarjeta h2 { font-size: 1.12rem; }

/* Tablas (todas menos la del TPV, que tiene la suya) */
body:not(.pagina-tpv) .tabla thead th { background: #f7f9fc; font-size: .74rem; text-transform: uppercase; letter-spacing: .045em;
  color: #6a7686; font-weight: 700; border-bottom: 1px solid var(--borde); padding-top: .65rem; padding-bottom: .65rem; }
body:not(.pagina-tpv) .tabla thead tr:first-child th:first-child { border-top-left-radius: var(--radio); }
body:not(.pagina-tpv) .tabla thead tr:first-child th:last-child { border-top-right-radius: var(--radio); }
body:not(.pagina-tpv) .tabla tbody td { border-bottom-color: #edf0f5; }
body:not(.pagina-tpv) .tabla tbody tr:nth-child(even) td { background: #fbfcfe; }
body:not(.pagina-tpv) .tabla tbody tr { transition: background .12s; }
body:not(.pagina-tpv) .tabla tbody tr:hover td { background: color-mix(in srgb, var(--primario) 6%, #fff); }
body:not(.pagina-tpv) .tabla td strong { font-weight: 700; }
.tabla .num { font-variant-numeric: tabular-nums; }
.tabla th.ordenable a:hover { text-decoration: none; color: var(--primario); }
.tabla tbody tr td[colspan] { color: var(--suave); padding: 1.6rem 1rem; text-align: center; }

/* Botones */
.boton-pequeno, .boton-ok, .boton-peligro { border-radius: 9px; font-weight: 500; box-shadow: 0 1px 1px rgba(15, 23, 42, .04);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .12s; }
.boton-pequeno:hover { border-color: color-mix(in srgb, var(--primario) 45%, var(--borde)); box-shadow: 0 2px 6px rgba(15, 23, 42, .08); }
.boton-ok { background: linear-gradient(180deg, #23894a, #1e7a3c); font-weight: 700; }
.boton-ok:hover { background: #1a6b34; box-shadow: 0 3px 10px rgba(30, 122, 60, .3); }
.boton-principal { border-radius: 10px; background: linear-gradient(180deg, #284a78, var(--primario)); box-shadow: 0 2px 8px rgba(31, 58, 95, .25); }
.boton-principal:hover { background: var(--primario-hover); }
.boton-peligro:hover { background: #fdecec; }
.boton-pequeno.activo, a.boton-pequeno.activo { background: var(--primario); border-color: var(--primario); color: #fff; }

/* Casillas de escribir: mismas en todas partes, con foco claro */
.campo input:not([type=checkbox]):not([type=radio]):not([type=file]), .campo select, .campo textarea,
.buscador input[type=search], .buscador select, .buscador input[type=date] {
  border-radius: 10px; border: 1px solid var(--borde); background: #f8fafc; transition: border-color .12s, box-shadow .12s, background .12s; }
.campo textarea { width: 100%; padding: .65rem .75rem; font: inherit; color: var(--texto); }
.campo input:not([type=checkbox]):not([type=radio]):hover, .campo select:hover, .buscador input[type=search]:hover {
  border-color: color-mix(in srgb, var(--primario) 35%, var(--borde)); }
.campo input:not([type=checkbox]):not([type=radio]):focus, .campo select:focus, .campo textarea:focus,
.buscador input[type=search]:focus, .buscador select:focus, .buscador input[type=date]:focus {
  outline: none; border-color: var(--primario); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primario) 16%, transparent); }
.campo label { font-size: .88rem; color: #3d4757; }
.buscador { align-items: center; }
.buscador input[type=search] { padding-left: 2.3rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a7686' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: .8rem center; }

/* Secciones de los formularios (clientes, proveedores, empresa…): título con línea */
.formulario fieldset { margin-bottom: 1.2rem; }
.formulario legend { display: block; width: 100%; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--primario);
  font-weight: 800; padding-bottom: .4rem; border-bottom: 2px solid color-mix(in srgb, var(--primario) 12%, transparent); margin-bottom: .2rem; }
.ficha-art .formulario legend, .legend-con-marcas { text-transform: none; letter-spacing: 0; }

/* Pestañas y filtros en pastilla */
.filtros a { box-shadow: 0 1px 1px rgba(15, 23, 42, .04); transition: background .12s, border-color .12s; }
.filtros a:hover { border-color: color-mix(in srgb, var(--primario) 45%, var(--borde)); }
.filtros a.activo { box-shadow: 0 2px 8px rgba(31, 58, 95, .25); }

/* Estados en pastilla con punto */
.estado { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; }
.estado::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .75; }

/* Avisos */
.aviso { border: 1px solid transparent; box-shadow: var(--sombra); }
.aviso-error { border-color: #f3c4c4; }
.aviso-success { border-color: #bfe3c9; }

/* Panel de control: cartas con el icono en una burbuja */
.modulo { border-radius: 16px; box-shadow: var(--sombra); transition: box-shadow .15s, transform .15s, border-color .15s; }
a.modulo:hover { box-shadow: var(--sombra-alta); }
.modulo-icono { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 14px; font-size: 1.8rem;
  background: linear-gradient(135deg, #eef3fb, #e3ebf7); box-shadow: inset 0 0 0 1px rgba(31, 58, 95, .06); margin-bottom: .35rem; }
.modulo strong { font-size: 1.05rem; }

/* Barras de desplazamiento finas */
* { scrollbar-width: thin; scrollbar-color: #c3ccd8 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3ccd8; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #a9b4c3; }

/* Paginación / «cargando más» */
.cargando-mas { text-align: center; padding: .8rem; }
.buscador input[type=search], .buscador input[type=search]:focus, .buscador input[type=search]:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236a7686' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: .8rem center !important; padding-left: 2.3rem !important; }

/* ===== Dentro de cada carta: cabecera, «volver», fichas por secciones ===== */
/* Enlace «← Volver / ← Clientes…» como botón pequeño */
.contenido > p:first-child > a:only-child, .contenido > span[hidden] + p > a:only-child {
  display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .8rem; border-radius: 999px; text-decoration: none;
  background: var(--tarjeta); border: 1px solid var(--borde); color: var(--suave); font-size: .9rem; box-shadow: var(--sombra); }
.contenido > p:first-child > a:only-child:hover { color: var(--primario); border-color: color-mix(in srgb, var(--primario) 45%, var(--borde)); }

/* Cabecera de cada pantalla: una franja con el título y los botones */
body:not(.pagina-tpv) .cabecera-pagina { background: linear-gradient(135deg, #ffffff 0%, #f5f8fd 100%); border: 1px solid var(--borde);
  border-radius: 16px; padding: 1rem 1.3rem; box-shadow: var(--sombra); position: relative; overflow: hidden; }
body:not(.pagina-tpv) .cabecera-pagina::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, #3b6db3, var(--primario)); }
body:not(.pagina-tpv) .cabecera-pagina h1 { font-size: 1.55rem; }
.cabecera-fija .cabecera-pagina { margin-bottom: .7rem; }

/* Fichas con secciones (clientes, proveedores, empresa, usuarios…): cada sección en su tarjeta */
.tarjeta-formulario:has(> form.formulario > fieldset) { background: transparent; border: 0; box-shadow: none; padding: 0; }
.tarjeta-formulario > form.formulario > fieldset { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: .9rem 1.2rem 1.15rem; box-shadow: var(--sombra); margin: 0 0 .9rem; }
.tarjeta-formulario > form.formulario > fieldset > legend { float: left; width: 100%; margin-bottom: .3rem; }
.tarjeta-formulario > form.formulario > fieldset > legend + * { clear: both; }
.tarjeta-formulario > form.formulario > .botonera { position: sticky; bottom: 0; z-index: 5; padding: .7rem .2rem; margin: 0;
  background: color-mix(in srgb, var(--fondo) 85%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--borde); }
.tarjeta-formulario > form.formulario > .botonera .boton-ok { padding: .65rem 2.2rem; font-size: 1.05rem; }

/* Fichas de documentos (ventas y compras): datos de arriba y totales */
.relaciones { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px;
  padding: .55rem 1rem; box-shadow: var(--sombra); margin-bottom: .9rem; }
details.cobros { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; padding: .5rem 1rem; margin-bottom: .9rem; box-shadow: var(--sombra); }
details.cobros summary { cursor: pointer; font-weight: 600; }

/* Paneles laterales («Vendido a», ventas del cliente…) */
.lateral-vendido h2 { display: flex; align-items: center; gap: .4rem; padding-bottom: .5rem; border-bottom: 1px solid var(--borde); }
/* Totales de los documentos en un recuadro */
.totales { background: linear-gradient(135deg, #f8fafd, #eef3fb); border: 1px solid var(--borde); border-radius: 12px; padding: .8rem 1rem;
  box-shadow: var(--sombra); max-width: 340px; }
.totales .total-final { font-weight: 800; color: var(--primario); font-size: 1.35rem; }
/* Importar y exportar */
.rejilla-impexp { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-top: .4rem; }
.impexp-carta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .9rem; }
.impexp-cabeza { display: flex; gap: .8rem; align-items: center; }
.impexp-cabeza .modulo-icono { margin: 0; flex: none; }
.impexp-cabeza strong { display: block; font-size: 1.1rem; }
.impexp-cabeza .nota { font-size: .85rem; }
.impexp-botones { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: auto; }
.impexp-botones a { text-align: center; text-decoration: none; padding: .6rem .7rem; }
.impexp-nota { margin-top: 1.2rem; }
.impexp-limite { margin-top: .3rem; }
.impexp-orden { margin: .2rem 0 .6rem; }
.impexp-numero { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  font-size: .95rem; color: #fff; background: linear-gradient(180deg, #3b6db3, var(--primario)); box-shadow: 0 2px 6px rgba(31, 58, 95, .3); }
.impexp-un-boton { grid-template-columns: 1fr; } .impexp-un-boton button { padding: .6rem .7rem; font-size: 1rem; }
/* Revisión antes de importar: todas las columnas */
.revision-barra { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .8rem 0 .6rem; }
.revision-barra input[type=search] { flex: 1 1 300px; padding: .55rem .8rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--tarjeta); }
.rev-filtros { margin: 0; }
.rev-filtros span { font-weight: 700; opacity: .75; margin-left: .2rem; }
.revision-tabla { max-height: 70vh; overflow: auto; }
.tabla-revision th { position: sticky; top: 0; z-index: 2; white-space: nowrap; }
.tabla-revision td { white-space: nowrap; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.tabla-revision td.rev-vacio { color: var(--suave); opacity: .5; font-style: italic; }
/* Importar: pantalla entera, botones arriba */
.revision-barra .revision-acciones { margin: 0 0 0 auto; display: flex; gap: .5rem; align-items: center; }
.revision-barra .revision-acciones form { margin: 0; }
.revision-barra .revision-acciones .boton-ok { padding: .6rem 1.4rem; font-size: 1rem; }
.pagina-importar .revision-tabla { max-height: calc(100vh - 16rem); }
.titulo-seccion { margin: 1.6rem 0 .6rem; font-size: 1.15rem; }

/* Copia de seguridad automática */
.copia-auto-linea { margin: .2rem 0; }
.copia-recuperar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.copia-recuperar input[type=text] { flex: 1 1 12rem; }
.copia-auto-permiso { position: fixed; right: 1rem; bottom: 1rem; z-index: 900; padding: .7rem 1rem; border-radius: 10px;
  border: 0; background: #1F3A5F; color: #fff; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.copia-auto-ajustes { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: end; margin: .4rem 0; }
.copia-auto-ajustes label { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; color: #475569; }
.copia-auto-ajustes input[type=time] { width: 8rem; }
.copia-auto-ajustes input[type=number] { width: 6rem; }

/* Configuración */
.config-qr { display: flex; justify-content: center; margin: .5rem 0; }
.config-qr svg { width: 190px; height: 190px; background: #fff; border-radius: 12px; }
.config-pasos { margin: .4rem 0 .8rem; padding-left: 1.2rem; line-height: 1.6; }
.config-opciones { display: flex; flex-direction: column; gap: .5rem; }
.config-opciones .check { display: flex; gap: .5rem; align-items: center; }
.config-pdas { margin-bottom: 1.2rem; }
.config-lista-pdas { display: flex; flex-wrap: wrap; gap: 1rem; margin: .6rem 0; }
.config-pda { border: 1px solid var(--borde, #d9dee8); border-radius: 14px; padding: .8rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 220px; }
.config-pda .impexp-botones { display: flex; gap: .4rem; }
.config-nueva-pda { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.config-nueva-pda input { flex: 1 1 14rem; }
.config-probar { margin-bottom: 1rem; }
.config-probar-cuerpo { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.config-probar .config-qr svg { width: 150px; height: 150px; }
.acepto-condiciones { display: flex; gap: .6rem; align-items: flex-start; margin: .8rem 0 1rem; font-size: .92rem; line-height: 1.45; color: var(--texto); }
.acepto-condiciones input { margin-top: .2rem; width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.acepto-condiciones span { font-weight: 400; } .acepto-condiciones b { font-weight: 700; }
