/*
 * Diseño de FACTU («Libro mayor»). Se carga después de tailwind.min.css.
 *
 * 1. Fuentes y variables de la marca.
 * 2. Capa de tema: Tailwind v2 solo trae gray, red, yellow, green, blue, indigo, purple y pink y su CSS va
 *    precompilado. Aquí se reasignan esas clases a la paleta de la marca, así que una pantalla nueva escrita con
 *    `bg-blue-600` o `text-gray-600` sale ya con los colores y el contraste correctos.
 * 3. Clases con corchetes (`max-h-[90vh]`, `z-[100]`…), que Tailwind v2 precompilado no genera.
 * 4. Componentes propios: más abajo, por bloques.
 *
 * Contraste AA: con texto blanco, #2f7fa7 da 4,45:1 y #1C8CB0 da 3,87:1, así que esos dos azules quedan para
 * gráficos y detalles. Botones en --marca y texto de acento en --acento-texto.
 */

/* ---------- 1. Fuentes (ver lib/fonts/LEEME.md) y variables ---------- */
@font-face {
  font-family: 'Source Sans 3';
  src: url('fonts/source-sans-3-factu.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/source-serif-4-factu.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --tinta: #10242f;
  --tinta-2: #3d5461;
  --tinta-3: #566c79;
  --linea: #dbe5ea;
  --linea-2: #bccbd3;
  --fondo: #fbfcfd;
  --superficie: #ffffff;
  --marca: #0d3f5a;
  --marca-2: #0a3249;
  --marca-3: #164d6b;
  --acento: #2f7fa7;
  --acento-texto: #22668a;
  --suave: #dcecf3;
  --suave-2: #eef5f9;
  --ok: #1b6a54;
  --ok-2: #155645;
  --ok-fondo: #e2f1eb;
  --espera: #85570a;
  --espera-2: #6f4807;
  --espera-fondo: #f8eeda;
  --mal: #a03529;
  --mal-2: #862b20;
  --mal-fondo: #f9e8e4;
  --neutro: #48606d;
  --neutro-fondo: #e9eff3;
  --nav-texto: #d7e6ee;
  --nav-tenue: #a9c4d2;
  --f-ui: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --f-cifra: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

*, ::before, ::after { border-color: var(--linea); }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--tinta);
  background: var(--fondo);
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::placeholder { color: var(--tinta-3) !important; opacity: 1 !important; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--marca); }

/* Escala de texto: Source Sans es más pequeña de ojo que la fuente del sistema */
.text-xs { font-size: .8125rem; line-height: 1.25rem; }
.text-sm { font-size: .9375rem; line-height: 1.35rem; }
.font-bold { font-weight: 600; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--f-ui); font-variant-numeric: lining-nums tabular-nums; }
code.font-mono, ul.font-mono, input.font-mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; }
.rounded { border-radius: 4px; }
.rounded-lg { border-radius: 6px; }
.rounded-xl { border-radius: 8px; }
.rounded-2xl { border-radius: 12px; }

/* ---------- 2. Capa de tema ---------- */
/* Neutros con un punto de azul */
.bg-gray-50, .hover\:bg-gray-50:hover { background-color: #f6f9fb; }
.bg-gray-100, .hover\:bg-gray-100:hover { background-color: #eef3f6; }
.bg-gray-200, .hover\:bg-gray-200:hover { background-color: #e3eaef; }
.bg-gray-300, .hover\:bg-gray-300:hover { background-color: #d3dee5; }
.bg-gray-700, .hover\:bg-gray-700:hover { background-color: #2a5069; }
.bg-gray-800, .hover\:bg-gray-800:hover { background-color: var(--marca-3); }
.bg-gray-900, .hover\:bg-gray-900:hover { background-color: var(--marca-2); }
.text-gray-200, .text-gray-300 { color: var(--nav-texto); }
.text-gray-400 { color: var(--tinta-3); }
.text-gray-500, .hover\:text-gray-500:hover { color: var(--tinta-3); }
.text-gray-600, .hover\:text-gray-600:hover { color: var(--neutro); }
.text-gray-700, .hover\:text-gray-700:hover { color: var(--tinta-2); }
.text-gray-800, .hover\:text-gray-800:hover { color: #1c3542; }
.text-gray-900 { color: var(--tinta); }
.border-gray-100, .border-gray-200 { border-color: var(--linea); }
.border-gray-300 { border-color: var(--linea-2); }
.border-gray-700 { border-color: #2a5069; }

/* Azul, índigo y púrpura: todo es la marca */
.bg-blue-50, .hover\:bg-blue-50:hover, .bg-indigo-50, .hover\:bg-indigo-50:hover, .bg-purple-50, .hover\:bg-purple-50:hover { background-color: var(--suave-2); }
.bg-blue-100, .hover\:bg-blue-100:hover, .bg-indigo-100, .hover\:bg-indigo-100:hover, .bg-purple-100, .hover\:bg-purple-100:hover { background-color: var(--suave); }
.bg-blue-500, .hover\:bg-blue-500:hover { background-color: var(--acento-texto); }
.bg-blue-600, .bg-blue-700, .bg-indigo-600, .bg-indigo-700, .bg-purple-600, .bg-purple-700, .hover\:bg-blue-600:hover { background-color: var(--marca); }
.hover\:bg-blue-700:hover, .hover\:bg-indigo-700:hover, .hover\:bg-indigo-800:hover, .hover\:bg-purple-700:hover, .hover\:bg-purple-800:hover, .bg-indigo-800, .bg-purple-800 { background-color: var(--marca-2); }
.text-blue-600, .hover\:text-blue-600:hover, .text-indigo-600, .text-indigo-700, .text-purple-600, .text-purple-700 { color: var(--acento-texto); }
.text-blue-700, .hover\:text-blue-700:hover { color: #1c5a7b; }
.text-blue-800, .hover\:text-blue-800:hover, .text-blue-900, .text-indigo-800, .text-indigo-900, .text-purple-800, .text-purple-900 { color: var(--marca); }
.border-blue-200, .border-indigo-200, .border-purple-200 { border-color: #bcd8e6; }
.border-blue-300, .border-indigo-300, .border-purple-300, .border-purple-400, .border-blue-400 { border-color: #8fbcd2; }
.focus\:border-blue-500:focus { border-color: var(--acento); }
.focus\:ring-blue-500:focus, .focus\:ring-blue-600:focus, .focus\:ring-red-500:focus { --tw-ring-color: rgba(47, 127, 167, .55); }

/* Rojo: un solo ladrillo */
.bg-red-50, .hover\:bg-red-50:hover { background-color: var(--mal-fondo); }
.bg-red-100, .hover\:bg-red-100:hover { background-color: #f5dcd6; }
.bg-red-200, .hover\:bg-red-200:hover { background-color: #edc7bf; }
.bg-red-500, .bg-red-600, .bg-red-700, .hover\:bg-red-600:hover { background-color: var(--mal); }
.hover\:bg-red-700:hover, .bg-red-800 { background-color: var(--mal-2); }
.text-red-400 { color: #f0a89c; }
.text-red-500, .text-red-600, .text-red-700 { color: var(--mal); }
.text-red-800, .hover\:text-red-800:hover, .text-red-900 { color: var(--mal-2); }
.border-red-200 { border-color: #edc7bf; }
.border-red-300 { border-color: #e0a79c; }
.border-red-400 { border-color: #cc7f72; }

/* Amarillo: ocre */
.bg-yellow-50, .hover\:bg-yellow-50:hover { background-color: #fbf5e6; }
.bg-yellow-100, .hover\:bg-yellow-100:hover { background-color: var(--espera-fondo); }
.bg-yellow-200, .hover\:bg-yellow-200:hover { background-color: #f0dfb8; }
.bg-yellow-500, .bg-yellow-600, .bg-yellow-700, .hover\:bg-yellow-700:hover { background-color: var(--espera); }
.hover\:bg-yellow-800:hover, .bg-yellow-800 { background-color: var(--espera-2); }
.text-yellow-50 { color: #fbf5e6; }
.text-yellow-300, .text-yellow-400 { color: #f0dfb8; }
.text-yellow-500, .text-yellow-600, .text-yellow-700 { color: var(--espera); }
.text-yellow-800 { color: var(--espera-2); }
.text-yellow-900 { color: #5d3d06; }
.border-yellow-200 { border-color: #f0dfb8; }
.border-yellow-300 { border-color: #e5cc97; }
.border-yellow-400 { border-color: #dcc48f; }
.border-yellow-700 { border-color: var(--espera); }

/* Verde: pino */
.bg-green-50, .hover\:bg-green-50:hover { background-color: #eef7f3; }
.bg-green-100, .hover\:bg-green-100:hover { background-color: var(--ok-fondo); }
.bg-green-200, .hover\:bg-green-200:hover { background-color: #c5e3d7; }
.bg-green-500, .bg-green-600, .bg-green-700 { background-color: var(--ok); }
.hover\:bg-green-700:hover, .hover\:bg-green-800:hover, .bg-green-800 { background-color: var(--ok-2); }
.text-green-200 { color: #c5e3d7; }
.text-green-400 { color: #8fd5bb; }
.text-green-500, .text-green-600, .text-green-700 { color: var(--ok); }
.text-green-800, .text-green-900 { color: var(--ok-2); }
.border-green-200 { border-color: #c5e3d7; }
.border-green-300, .border-green-400 { border-color: #6fb59c; }

/* Sin degradados ni sombras de catálogo: el relieve lo dan las líneas */
.bg-gradient-to-r[class*="from-"], .bg-gradient-to-b[class*="from-"], .bg-gradient-to-br[class*="from-"] { background-image: none; background-color: var(--marca); }
.shadow-sm, .shadow, .shadow-md, .shadow-lg, .shadow-xl { --tw-shadow: 0 0 #0000; }
.bg-white.rounded-xl { box-shadow: 0 0 0 1px var(--linea); }

/* ---------- 3. Clases con corchetes y utilidades que Tailwind v2 no resuelve solas ---------- */
.z-\[60\] { z-index: 60; }
.z-\[100\] { z-index: 100; }
.max-h-\[90vh\] { max-height: 90vh; }
.min-w-\[200px\] { min-width: 200px; }
.max-w-\[140px\] { max-width: 140px; }
.max-w-\[160px\] { max-width: 160px; }
.max-w-\[180px\] { max-width: 180px; }
.max-w-\[200px\] { max-width: 200px; }
.-translate-y-1\/2 { transform: translateY(-50%); }

/* Controles de formulario */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  background-color: var(--superficie);
  color: var(--tinta);
  min-height: 40px;
}
input:disabled, select:disabled, textarea:disabled { background-color: #eef3f6; color: var(--tinta-3); }

/* En el móvil: objetivos táctiles cómodos y sin que Android amplíe la página al enfocar un campo */
@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px; min-height: 44px; }
  button { min-height: 40px; touch-action: manipulation; }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.logo-blanco { filter: brightness(0) invert(1); }

/* ---------- 4. Componentes propios ---------- */
.icono { flex: none; }
.icono-disco { width: 44px; height: 44px; margin-inline: auto; margin-bottom: 8px; display: grid; place-items: center; border-radius: 50%; background: var(--suave); color: var(--marca); }
.icono-disco-ok { background: var(--ok-fondo); color: var(--ok); }
.icono-disco-mal { background: var(--mal-fondo); color: var(--mal); }

/* Botones. Las acciones principales van en azul de marca; el resto, con borde */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--linea-2); background: var(--superficie); color: var(--tinta);
  font-weight: 500; white-space: nowrap; transition: background-color .15s, border-color .15s;
}
.boton:hover { background: #f6f9fb; border-color: #9fb3be; }
.boton:disabled { opacity: .55; cursor: not-allowed; }
.boton-principal { background: var(--marca); border-color: var(--marca); color: #fff; }
.boton-principal:hover { background: var(--marca-2); border-color: var(--marca-2); }
.boton-ok { color: var(--ok); border-color: #a3cdbd; }
.boton-ok:hover { background: var(--ok-fondo); border-color: var(--ok); }
.boton-espera { color: var(--espera-2); border-color: #dcc48f; }
.boton-espera:hover { background: var(--espera-fondo); border-color: var(--espera); }
.boton-mini { min-height: 30px; padding: 0 10px; font-size: .875rem; }
.boton-ancho { width: 100%; min-height: 46px; font-size: 1rem; font-weight: 600; }
.boton-icono {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  width: 30px; height: 30px; border-radius: 6px; color: var(--tinta-2); transition: background-color .15s;
}
.boton-icono:hover { background: #eef3f6; }
.boton-icono-peligro { color: var(--mal); }
.boton-icono-peligro:hover { background: var(--mal-fondo); }
.boton-icono-ok { color: var(--ok); }
.boton-icono-ok:hover { background: var(--ok-fondo); }
.boton-icono-espera { color: var(--espera); }
.boton-icono-espera:hover { background: var(--espera-fondo); }
.boton-icono-texto { display: none; }
.enlace-boton { display: block; width: 100%; padding: 8px 6px; text-align: center; font-size: .9375rem; color: var(--acento-texto); }
.enlace-boton:hover { text-decoration: underline; }
.enlace-boton-tenue { color: var(--tinta-2); }

/* Estado de una factura: punto y texto */
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 500; white-space: nowrap; }
.estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.estado-ok { color: var(--ok); }
.estado-espera { color: var(--espera); }
.estado-mal { color: var(--mal); }
.estado-neutro { color: var(--neutro); }

/* Avisos dentro de la página */
.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 6px; }
.aviso-mal { background: var(--mal-fondo); color: var(--mal); }
.aviso-espera { background: var(--espera-fondo); color: var(--espera-2); }
.aviso-con-accion { flex-wrap: wrap; align-items: center; justify-content: space-between; }
.aviso-con-accion p { flex: 1 1 320px; }
.aviso b { display: block; font-weight: 600; }

/* Avisos flotantes */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--linea); border-radius: 8px; background: var(--superficie); color: var(--tinta); box-shadow: 0 8px 24px rgba(8, 41, 60, .14); }
.toast .icono:first-child { margin-top: 2px; }
.toast-exito .icono:first-child { color: var(--ok); }
.toast-error .icono:first-child { color: var(--mal); }
.toast-warning .icono:first-child { color: var(--espera); }
.toast-info .icono:first-child { color: var(--acento-texto); }
.toast-cerrar { margin-left: auto; flex: none; color: var(--tinta-3); display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; margin-block: -6px; margin-right: -6px; }

/* Modales */
.modal-fondo { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 41, 60, .5); }
.modal-caja { width: 100%; max-width: 32rem; max-height: 90vh; overflow-y: auto; border-radius: 10px; background: var(--superficie); box-shadow: 0 24px 60px rgba(8, 41, 60, .3); }
.modal-cab { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--superficie); border-bottom: 1px solid var(--linea); }
.modal-titulo { font: 500 1.3125rem/1.25 var(--f-cifra); color: var(--marca); }
.modal-cuerpo { padding: 18px 20px 20px; }
.modal-cuerpo .grid { align-items: end; }

/* Armazón: barra lateral, barra del móvil y contenido */
.pantalla-carga { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--marca); color: #fff; }
.barra-lateral { width: 232px; display: flex; flex-direction: column; gap: 18px; padding: 22px 14px 12px; background: var(--marca); color: var(--nav-texto); }
.barra-lateral-con-aviso { padding-top: 56px; }
.barra-lateral-logo { width: 128px; margin-inline: 8px; }
.barra-lateral-contexto { display: flex; flex-direction: column; gap: 8px; }
.barra-lateral-empresa { padding-inline: 8px; font-size: .8125rem; line-height: 1.25; color: var(--nav-tenue); }
.seg { display: flex; padding: 3px; border-radius: 9px; background: rgba(255, 255, 255, .1); }
.seg button { flex: 1; min-width: 0; min-height: 30px; padding: 4px 4px; border-radius: 7px; font-size: .8125rem; font-weight: 600; color: var(--nav-texto); transition: background-color .15s; }
.seg button:hover { background: rgba(255, 255, 255, .1); }
.seg button.on { background: #fff; color: var(--marca); }
.seg-select { width: 100%; min-height: 36px; padding: 0 8px; border-radius: 8px; font-weight: 600; }
.menu { display: grid; gap: 2px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; color: var(--nav-texto); text-align: left; transition: background-color .15s; }
.menu button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.menu button.on { background: rgba(255, 255, 255, .15); color: #fff; font-weight: 600; }
.menu-cuentas { margin-left: auto; display: flex; gap: 4px; }
.menu-cuenta { min-width: 20px; padding: 0 6px; border-radius: 9px; background: rgba(255, 255, 255, .18); color: #fff; font-size: .75rem; line-height: 1.25rem; font-weight: 600; text-align: center; }
.menu-cuenta-espera { background: #f0dfb8; color: #5d3d06; }
.barra-lateral-pie { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .16); font-size: .875rem; }
.barra-lateral-quien { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 8px 8px; color: var(--nav-tenue); font-size: .8125rem; }
.barra-lateral-sync { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex: none; }
.pie-boton { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 7px; color: var(--nav-texto); text-align: left; transition: background-color .15s; }
.pie-boton .icono { margin-top: 2px; }
.pie-boton:hover:not(:disabled) { background: rgba(255, 255, 255, .08); color: #fff; }
.pie-boton:disabled { opacity: .55; cursor: not-allowed; }
.pie-boton small { display: block; font-size: .75rem; color: var(--nav-tenue); }
.barra-lateral-version { display: flex; justify-content: space-between; padding: 8px 8px 0; font-size: .75rem; color: var(--nav-tenue); }
.barra-movil { position: fixed; left: 0; right: 0; z-index: 40; display: flex; align-items: center; gap: 8px; height: 56px; padding-inline: 4px 14px; background: var(--marca); color: #fff; }
.barra-movil-menu { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; }
.barra-movil-logo { width: 104px; }
.barra-movil-contexto { margin-left: auto; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.contenido-principal { flex: 1; min-width: 0; padding: 74px 16px 32px; }
@media (min-width: 1024px) {
  .barra-movil { display: none; }
  .contenido-principal { margin-left: 232px; padding: 32px 40px 56px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .contenido-principal { padding-inline: 28px; }
}

/* Partes comunes de cada vista */
.vista { display: flex; flex-direction: column; gap: 18px; max-width: 1400px; }
.cabecera-vista { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px 20px; }
.titulo-vista { font: 500 2rem/1.15 var(--f-cifra); color: var(--marca); letter-spacing: -.005em; }
.subtitulo-vista { margin-top: 2px; color: var(--tinta-2); }
.acciones-vista { display: flex; flex-wrap: wrap; gap: 8px; }
.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.filtros label, .filtros .filtro-etiqueta { display: block; margin-bottom: 3px; font-size: .8125rem; font-weight: 500; color: var(--tinta-2); }
.filtro-buscar { flex: 1 1 240px; min-width: 0; }
.filtros .boton { min-height: 40px; }
.chips { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.chips button { min-height: 40px; padding: 4px 2px; color: var(--tinta-2); font-weight: 500; white-space: nowrap; }
.chips button b { margin-left: 3px; font-weight: 400; color: var(--tinta-3); }
.chips button:hover { color: var(--marca); }
.chips button.on { color: var(--marca); font-weight: 600; box-shadow: inset 0 -2px 0 var(--marca); }
.chips button.on b { color: var(--marca); font-weight: 500; }
.seleccion { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 14px; border-radius: 6px; background: var(--suave); color: var(--marca); }
.seleccion-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.paginacion { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding-top: 12px; color: var(--tinta-2); }
.paginacion-botones { display: flex; gap: 6px; }
.bloque { min-width: 0; }
.bloque-cab { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; margin-bottom: 8px; }
.bloque-titulo { font: 500 1.25rem/1.3 var(--f-cifra); color: var(--marca); }
.bloque-nota { font-size: .8125rem; color: var(--tinta-3); }
.solo-ancho { display: inline; }
.cifra-suelta { padding-top: 12px; border-top: 1px solid var(--linea-2); }
.cifra-suelta-titulo { font-size: .875rem; font-weight: 500; color: var(--tinta-2); }
.cifra-suelta-importe { margin-top: 2px; font: 500 1.625rem/1.2 var(--f-cifra); color: var(--marca); white-space: nowrap; }
.cifra-suelta-nota { margin-top: 2px; font-size: .8125rem; color: var(--tinta-3); }

/* Tablas: sobre la página, con líneas finas. Los totales llevan la doble línea de los libros contables */
.tabla-marco { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { padding: 7px 10px; border-bottom: 1px solid var(--linea-2); font-size: .875rem; font-weight: 500; color: var(--tinta-3); text-align: left; white-space: nowrap; }
.tabla td { padding: 9px 10px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla th:first-child, .tabla td:first-child { padding-left: 0; }
.tabla th:last-child, .tabla td:last-child { padding-right: 0; }
.tabla .th-orden { cursor: pointer; user-select: none; }
.tabla .th-orden:hover { color: var(--marca); }
.tabla .der { text-align: right; }
.tabla .cen { text-align: center; }
.tabla tbody tr:hover td { background: #f6f9fb; }
.tabla .fila-seleccionada td { background: var(--suave-2); }
.tabla .importe { font-family: var(--f-cifra); text-align: right; white-space: nowrap; }
.tabla .importe-fuerte { font-weight: 500; }
.tabla .numero { font-weight: 500; white-space: nowrap; }
.tabla .tenue { color: var(--tinta-2); white-space: nowrap; }
.tabla .celda-acciones { white-space: nowrap; }
.tabla .acciones-fila { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.tabla .doble { display: block; font-weight: 600; }
.tabla .doble + small { display: block; font-size: .875rem; color: var(--tinta-3); }
.tabla tfoot td { border-top: 1px solid var(--marca); border-bottom: 3px double var(--marca); font-weight: 600; }
.tabla tfoot .importe { font-weight: 600; }
.tabla .fila-vacia td { padding: 36px 12px; text-align: center; color: var(--tinta-2); }
.tabla .fila-vacia:hover td { background: none; }

/* En anchuras estrechas la tabla pasa a lista: cada fila es un bloque y cada celda va a su sitio por grid */
@media (max-width: 1023px) {
  .boton { min-height: 44px; }
  .boton-mini { min-height: 40px; padding: 0 12px; }
  .boton-icono { width: 40px; height: 40px; }
  .acciones-vista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .acciones-vista .boton { padding: 0 4px; }
  .acciones-vista .boton-principal { grid-column: 1 / -1; }
  .solo-ancho { display: none; }
  .tabla-lista, .tabla-lista tbody, .tabla-lista tfoot { display: block; }
  .tabla-lista thead { display: none; }
  .tabla-lista tr { display: grid; align-items: center; column-gap: 8px; row-gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--linea); }
  .tabla-lista td, .tabla-lista td:first-child, .tabla-lista td:last-child { display: block; padding: 0; border: 0; }
  .tabla-lista tbody tr:hover td, .tabla-lista .fila-seleccionada td { background: none; }
  .tabla-lista .fila-seleccionada { background: var(--suave-2); box-shadow: -8px 0 0 var(--suave-2), 8px 0 0 var(--suave-2); }
  .tabla-lista .fila-vacia { display: block; }
  .tabla-lista .fila-vacia td, .tabla-lista .fila-vacia td:first-child, .tabla-lista .fila-vacia td:last-child { padding: 28px 12px; text-align: center; }
  .tabla-lista tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding-block: 12px; border-top: 1px solid var(--marca); border-bottom: 3px double var(--marca); }
  .tabla-lista tfoot td, .tabla-lista tfoot td:first-child { border: 0; }
  .tabla-lista tfoot td:empty { display: none; }
  .tabla-lista tfoot .pie-etiqueta { flex-basis: 100%; }
  .tabla-lista .acciones-fila { justify-content: flex-end; }
  .tabla-lista .importe-sec::after { content: " sin IVA"; font: 400 .75rem var(--f-ui); }
}
@media (max-width: 767px) {
  .modal-fondo { align-items: flex-end; padding: 0; }
  .modal-caja { max-width: none; max-height: 94vh; border-radius: 14px 14px 0 0; }
  .modal-cuerpo { padding: 16px 16px 24px; }
  .modal-cab { padding: 10px 8px 10px 16px; }
  .toasts { top: 8px; right: 16px; }
  .titulo-vista { font-size: 1.75rem; }
  .filtros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filtros select, .filtros > div:not(.chips) > button { width: 100%; }
  .filtro-buscar, .filtros > .chips, .filtros > .filtro-ancho { grid-column: 1 / -1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .chips button { flex: none; min-height: 44px; }
}

/* Acceso y 2FA: a la izquierda, azul de marca con el rayado de un libro de cuentas */
.acceso { min-height: 100vh; display: grid; grid-template-columns: 5fr 7fr; background: var(--fondo); }
.acceso-marca {
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: 48px;
  background-color: var(--marca);
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(255, 255, 255, .06) 31px 32px),
    linear-gradient(to right, transparent 0 74%, rgba(255, 255, 255, .12) 74% calc(74% + 1px), transparent calc(74% + 1px) calc(74% + 4px), rgba(255, 255, 255, .12) calc(74% + 4px) calc(74% + 5px), transparent calc(74% + 5px));
}
.acceso-marca img { width: 190px; max-width: 100%; }
.acceso-marca p { font: 500 1.375rem/1.3 var(--f-cifra); color: #fff; }
.acceso-zona { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.acceso-caja { width: 100%; max-width: 360px; }
.acceso input:not([type="checkbox"]) { min-height: 44px; }
.acceso button[type="submit"], .acceso-caja > .space-y-4 > button:not(.text-sm) { min-height: 46px; font-weight: 600; }
.icono-disco-fila { flex: none; margin: 0; }
@media (max-width: 767px) {
  .acceso { display: flex; flex-direction: column; }
  .acceso-marca { padding: 28px 24px 22px; gap: 26px; }
  .acceso-marca img { width: 160px; }
  .acceso-marca p { font-size: 1.1875rem; }
  .acceso-zona { flex: 1; align-items: flex-start; padding: 24px; }
  .acceso-caja { max-width: none; }
}

/* Panel */
.vista-panel { gap: 28px; }
.cifras { display: grid; grid-template-columns: 1.35fr 1fr 1fr; grid-template-areas: "pend fact cobr" "pend gast bene"; border-top: 2px solid var(--marca); }
.cifras-con-antiguedad { grid-template-areas: "pend fact cobr" "anti gast bene"; }
.cifra { padding: 16px 22px; border-left: 1px solid var(--linea); border-bottom: 1px solid var(--linea); min-width: 0; }
.cifra-titulo { font-size: .875rem; font-weight: 500; color: var(--tinta-2); }
.cifra-importe { margin-top: 4px; font-family: var(--f-cifra); font-size: 1.6875rem; font-weight: 500; line-height: 1.2; color: var(--marca); white-space: nowrap; }
.cifra-importe small { font: 500 .8125rem var(--f-ui); color: var(--tinta-3); }
.cifra-sec { margin-top: 3px; color: var(--tinta-2); }
.cifra-nota { margin-top: 2px; font-size: .8125rem; color: var(--tinta-3); }
.cifra-pendiente { grid-area: pend; padding-left: 0; border-left: 0; }
.cifra-pendiente .cifra-importe { font-size: clamp(2.125rem, 3.3vw, 2.875rem); line-height: 1.05; letter-spacing: -.01em; }
.cifra-facturado { grid-area: fact; }
.cifra-cobrado { grid-area: cobr; }
.cifra-gastos { grid-area: gast; }
.cifra-beneficio { grid-area: bene; }
.cifra-negativa .cifra-importe { color: var(--mal); }
.antiguedad { grid-area: anti; min-width: 0; padding: 14px 22px 16px 0; border-bottom: 1px solid var(--linea); }
.antiguedad-barra { display: flex; gap: 2px; height: 8px; margin: 10px 0 12px; }
.antiguedad-barra i { display: block; min-width: 2px; border-radius: 2px; }
.tramo-0 { background: var(--acento); }
.tramo-1 { background: #c08a2b; }
.tramo-2 { background: var(--mal); }
.antiguedad-lista { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.antiguedad-lista dt { display: flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--tinta-2); }
.antiguedad-lista dt i { flex: none; width: 8px; height: 8px; border-radius: 2px; }
.antiguedad-lista dd { margin: 0; }
.antiguedad-importe { font-family: var(--f-cifra); font-size: 1.0625rem; font-weight: 500; white-space: nowrap; }
.panel-graficos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; }
.bloque-vacio { display: flex; align-items: center; justify-content: center; min-height: 160px; color: var(--tinta-2); border: 1px dashed var(--linea-2); border-radius: 6px; }
.tabla-panel .c-cli { width: 100%; font-weight: 600; }
.dias-mal { color: var(--mal); font-weight: 600; }
.dias-espera { color: var(--espera); font-weight: 600; }
.tabla-iva .a-pagar { color: var(--espera); font-weight: 500; }
.tabla-iva .a-compensar { color: var(--ok); font-weight: 500; }
.tabla-iva .c-sop { color: var(--tinta-2); }
.tabla-iva th:first-child, .tabla-trimestres th:first-child { width: 22%; }

@media (max-width: 1023px) {
  .panel-graficos { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .cifra-importe { font-size: 1.3125rem; }
  .cifra-sec { font-size: .875rem; }
  .cifras, .cifras-con-antiguedad { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "pend pend" "fact cobr" "gast bene" "anti anti"; }
  .cifra { padding: 12px 0 12px 12px; }
  .cifra-pendiente { padding: 14px 0; }
  .cifra-pendiente .cifra-importe { font-size: 2.5rem; }
  .cifra-facturado, .cifra-gastos { border-left: 0; padding-left: 0; }
  .antiguedad { padding: 14px 0 16px; }
  .antiguedad-importe { font-size: .9375rem; }
  .tabla-panel .c-cli { width: auto; }
  .tabla-panel tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "cli cli con" "num fec sin" "dia acc acc"; }
  .tabla-panel .c-cli { grid-area: cli; }
  .tabla-panel .c-con { grid-area: con; font-size: 1rem; }
  .tabla-panel .c-num { grid-area: num; font-size: .8125rem; font-weight: 400; color: var(--tinta-2); }
  .tabla-panel .c-fec { grid-area: fec; font-size: .8125rem; }
  .tabla-panel .c-sin { grid-area: sin; font-size: .8125rem; color: var(--tinta-2); }
  .tabla-panel .c-dias { grid-area: dia; font-size: .875rem; text-align: left; }
  .tabla-panel .c-dias::after { content: " días"; }
  .tabla-panel .c-acc { grid-area: acc; margin-top: 4px; }
  .tabla-trimestres tr, .tabla-trimestres tfoot tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "tri tri sin sin" "con con con con" "n1 n2 n3 n4"; row-gap: 6px; column-gap: 8px; }
  .tabla-trimestres .c-tri { grid-area: tri; font-weight: 600; }
  .tabla-trimestres .c-sin { grid-area: sin; font-weight: 500; }
  .tabla-trimestres .c-sin::before { content: none; }
  .tabla-trimestres .c-sin::after { content: " sin IVA"; font: 400 .75rem var(--f-ui); color: var(--tinta-3); }
  .tabla-trimestres .c-con { grid-area: con; font-size: .875rem; color: var(--tinta-2); }
  .tabla-trimestres .c-con::before { content: none; }
  .tabla-trimestres .c-con::after { content: " con IVA"; font: 400 .75rem var(--f-ui); color: var(--tinta-3); }
  .tabla-trimestres .c-n { text-align: left; font-weight: 500; }
  .tabla-trimestres .c-n::before { content: attr(data-l); display: block; font: 400 .75rem var(--f-ui); color: var(--tinta-3); }
  .tabla-iva tr, .tabla-iva tfoot tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "tri tri liq" "bas rep sop"; row-gap: 4px; column-gap: 8px; }
  .tabla-iva .c-tri { grid-area: tri; font-weight: 600; }
  .tabla-iva .c-liq { grid-area: liq; font-size: 1rem; }
  .tabla-iva .c-bas { grid-area: bas; }
  .tabla-iva .c-rep { grid-area: rep; }
  .tabla-iva .c-sop { grid-area: sop; }
  .tabla-iva .c-bas, .tabla-iva .c-rep, .tabla-iva .c-sop { text-align: left; font-size: .8125rem; font-weight: 400; color: var(--tinta-2); }
  .tabla-iva .c-bas::before, .tabla-iva .c-rep::before, .tabla-iva .c-sop::before { content: attr(data-l); display: block; font: 400 .75rem var(--f-ui); color: var(--tinta-3); }
}

/* Facturas */
.boton-fijo:disabled { opacity: 1; cursor: default; background: none; color: var(--tinta-2); border-color: var(--linea); }
.filtros > .chips { flex: 1 1 100%; }
.tabla-facturas .c-ch { width: 26px; padding-right: 0; }
.tabla-facturas .c-cli { width: 100%; max-width: 0; }
.tabla-facturas .doble, .tabla-facturas .c-cli small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-anulada .numero, .fila-anulada .importe, .fila-anulada .doble { text-decoration: line-through; color: var(--tinta-3); font-weight: 400; }
@media (max-width: 1023px) {
  .acciones-vista .boton { white-space: normal; line-height: 1.1; }
  .tabla-facturas tr { grid-template-columns: 30px auto minmax(0, 1fr) auto; grid-template-areas: "ch cli cli tot" "ch cli cli bas" ". num fec est" "acc acc acc acc"; }
  .tabla-facturas tfoot tr { display: flex; }
  .tabla-facturas .c-ch { grid-area: ch; align-self: start; width: auto; }
  .tabla-facturas .c-cli { grid-area: cli; width: auto; max-width: none; align-self: start; }
  .tabla-facturas .doble, .tabla-facturas .c-cli small { white-space: normal; }
  .tabla-facturas .c-tot { grid-area: tot; font-size: 1rem; }
  .tabla-facturas .c-bas { grid-area: bas; font-size: .8125rem; color: var(--tinta-2); }
  .tabla-facturas .c-num { grid-area: num; font-size: .8125rem; font-weight: 400; color: var(--tinta-2); }
  .tabla-facturas .c-fec { grid-area: fec; font-size: .8125rem; }
  .tabla-facturas .c-est { grid-area: est; justify-self: end; }
  .tabla-facturas .c-acc { grid-area: acc; margin-top: 4px; }
  .boton-avanzar { width: auto; height: 40px; margin-right: auto; padding: 0 12px; border: 1px solid currentColor; }
  .boton-avanzar .boton-icono-texto { display: inline; font-size: .875rem; font-weight: 500; }
}

/* Gastos, clientes y recurrentes */
.cifras-sueltas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 240px)); gap: 12px 28px; }
.cifra-suelta-importe small { font: 500 .8125rem var(--f-ui); color: var(--tinta-3); }
.filtro-casilla { display: inline-flex !important; align-items: center; gap: 8px; min-height: 40px; margin: 0 !important; font-size: .9375rem !important; font-weight: 400 !important; color: var(--tinta-2) !important; cursor: pointer; }
.tabla-gastos th, .tabla-gastos td { padding-inline: 8px; }
.tabla-gastos .c-ch { width: 26px; padding-right: 0; }
.tabla-gastos .c-pro { width: 100%; max-width: 0; }
.tabla-gastos .doble, .tabla-gastos .c-pro small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabla-gastos .c-iva { color: var(--tinta-2); }
.tabla-clientes .c-nom { width: 34%; }
.tabla-recurrentes .c-pla { min-width: 180px; }
.fila-cancelada td { color: var(--tinta-3); }
.fila-cancelada .doble, .fila-cancelada .importe { color: var(--tinta-3); }
.estado-boton { padding: 4px 6px; border-radius: 6px; }
.estado-boton:hover { background: #eef3f6; }
.aviso-proximo { display: block; font-size: .8125rem; color: var(--tinta-3); white-space: nowrap; }
.aviso-proximo-cerca { color: var(--espera); font-weight: 600; }
@media (max-width: 1023px) {
  .cifras-sueltas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cifra-suelta-importe { font-size: 1.3125rem; }
  .tabla-gastos tr { grid-template-columns: 30px auto minmax(0, 1fr) auto; grid-template-areas: "ch pro pro tot" "ch pro pro bas" ". fec cat iva" ". num num num" "acc acc acc acc"; }
  .tabla-gastos tfoot tr { display: flex; }
  .tabla-gastos .c-ch { grid-area: ch; align-self: start; width: auto; }
  .tabla-gastos .c-pro { grid-area: pro; width: auto; max-width: none; align-self: start; }
  .tabla-gastos .doble, .tabla-gastos .c-pro small { white-space: normal; }
  .tabla-gastos .c-tot { grid-area: tot; font-size: 1rem; }
  .tabla-gastos .c-bas { grid-area: bas; font-size: .8125rem; color: var(--tinta-2); }
  .tabla-gastos .c-fec { grid-area: fec; font-size: .8125rem; }
  .tabla-gastos .c-cat { grid-area: cat; font-size: .8125rem; white-space: normal; }
  .tabla-gastos .c-iva { grid-area: iva; font-size: .8125rem; }
  .tabla-gastos .c-iva::before { content: "IVA "; font: 400 .75rem var(--f-ui); }
  .tabla-gastos .c-num { grid-area: num; font-size: .8125rem; }
  .tabla-gastos .sin-numero { display: none; }
  .tabla-gastos .c-acc { grid-area: acc; margin-top: 4px; }
  .tabla-clientes tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nom fac" "nif acc" "ema acc"; }
  .tabla-clientes .c-nom { grid-area: nom; width: auto; }
  .tabla-clientes .c-fac { grid-area: fac; font-size: .875rem; }
  .tabla-clientes .c-nif { grid-area: nif; font-size: .875rem; }
  .tabla-clientes .c-ema { grid-area: ema; font-size: .875rem; overflow-wrap: anywhere; white-space: normal; }
  .tabla-clientes .c-acc { grid-area: acc; }
  .tabla-recurrentes tr { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 12px; grid-template-areas: "pla pla imp" "cat mes ano" "per mes ano" "pro est acc"; }
  .tabla-recurrentes .c-pla { grid-area: pla; min-width: 0; }
  .tabla-recurrentes .c-imp { grid-area: imp; font-size: 1rem; }
  .tabla-recurrentes .c-cat { grid-area: cat; font-size: .875rem; white-space: normal; }
  .tabla-recurrentes .c-per { grid-area: per; font-size: .875rem; }
  .tabla-recurrentes .c-mes { grid-area: mes; font-size: .875rem; }
  .tabla-recurrentes .c-ano { grid-area: ano; font-size: .875rem; }
  .tabla-recurrentes .c-mes::before, .tabla-recurrentes .c-ano::before { content: attr(data-l); display: block; font: 400 .75rem var(--f-ui); color: var(--tinta-3); }
  .tabla-recurrentes .c-pro { grid-area: pro; font-size: .875rem; margin-top: 4px; }
  .tabla-recurrentes .c-est { grid-area: est; margin-top: 4px; }
  .tabla-recurrentes .c-acc { grid-area: acc; margin-top: 4px; }
}

/* Móvil: el menú lateral, la casilla de selección y el botón «Ver», con sitio para el dedo */
@media (max-width: 767px) {
  .seg button { min-height: 40px; }
  input[type="checkbox"] { width: 24px; height: 24px; flex: none; }
  .acceso .relative > button { right: 2px; min-width: 44px; min-height: 44px; padding: 0 8px; }
}
label.flex > input[type="checkbox"] { flex: none; }

/* Consulta de la gestoría y administración de usuarios */
.cabecera-consulta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 56px; padding: 8px 16px; background: var(--marca); color: #fff; }
.cabecera-consulta-logo { width: 116px; }
.cabecera-consulta-acciones { display: flex; gap: 4px; }
.cabecera-boton { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: 7px; color: var(--nav-texto); transition: background-color .15s; }
.cabecera-boton:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: #fff; }
.cabecera-boton:disabled { opacity: .55; cursor: not-allowed; }
.consulta { margin-inline: auto; padding: 28px 16px 40px; max-width: 1180px; }
.consulta-zip { margin-left: auto; }
.consulta-pestanas { margin-bottom: 6px; }
.consulta-anulada { display: inline-block; margin-left: 8px; font-size: .8125rem; font-weight: 500; color: var(--mal); }
.estado-lista { padding: 36px 12px; text-align: center; color: var(--tinta-2); }
.ficha-formulario select { width: 100%; max-width: 100%; }
.ficha-formulario { padding: 16px 18px; border: 1px solid var(--linea-2); border-radius: 8px; background: var(--superficie); }
.modal-estrecho { max-width: 24rem; height: auto; }
.accion-texto { min-height: 30px; padding: 0 6px; color: var(--acento-texto); font-weight: 500; }
.accion-texto:hover:not(:disabled) { text-decoration: underline; }
.accion-texto:disabled { opacity: .55; cursor: not-allowed; }
.accion-texto-peligro { color: var(--mal); }
.tabla-usuarios .c-acc { text-align: right; }
.tabla-consulta-facturas .c-cli, .tabla-consulta-gastos .c-pro { min-width: 150px; }
@media (max-width: 1023px) {
  .tabla-consulta-facturas tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "cli cli tot" "num fec bas" "nif emp iva" "doc doc ret"; }
  .tabla-consulta-gastos tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pro pro tot" "num fec bas" "cat emp iva" "doc doc doc"; }
  .tabla-consulta-facturas .c-cli { grid-area: cli; min-width: 0; }
  .tabla-consulta-gastos .c-pro { grid-area: pro; min-width: 0; }
  .tabla-consulta-facturas .c-num, .tabla-consulta-gastos .c-num { grid-area: num; font-size: .8125rem; font-weight: 400; color: var(--tinta-2); }
  .tabla-consulta-facturas .c-fec, .tabla-consulta-gastos .c-fec { grid-area: fec; font-size: .8125rem; }
  .tabla-consulta-facturas .c-tot, .tabla-consulta-gastos .c-tot { grid-area: tot; font-size: 1rem; }
  .tabla-consulta-facturas .c-bas, .tabla-consulta-gastos .c-bas { grid-area: bas; font-size: .8125rem; color: var(--tinta-2); }
  .tabla-consulta-facturas .c-nif { grid-area: nif; font-size: .8125rem; }
  .tabla-consulta-gastos .c-cat { grid-area: cat; font-size: .8125rem; white-space: normal; }
  .tabla-consulta-facturas .c-emp, .tabla-consulta-gastos .c-emp { grid-area: emp; font-size: .8125rem; }
  .tabla-consulta-facturas .c-iva, .tabla-consulta-gastos .c-iva { grid-area: iva; font-size: .8125rem; color: var(--tinta-2); }
  .tabla-consulta-facturas .c-ret { grid-area: ret; font-size: .8125rem; color: var(--tinta-2); }
  .tabla-consulta-facturas .c-iva::before, .tabla-consulta-gastos .c-iva::before, .tabla-consulta-facturas .c-ret::before { content: attr(data-l) " "; font: 400 .75rem var(--f-ui); }
  .tabla-consulta-facturas .c-doc, .tabla-consulta-gastos .c-doc { grid-area: doc; text-align: left; }
  .tabla-usuarios tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nom 2fa" "cor cor" "rol rol" "emp emp" "acc acc"; }
  .tabla-usuarios .c-nom { grid-area: nom; }
  .tabla-usuarios .c-2fa { grid-area: 2fa; }
  .tabla-usuarios .c-cor { grid-area: cor; overflow-wrap: anywhere; white-space: normal; font-size: .875rem; }
  .tabla-usuarios .c-rol { grid-area: rol; font-size: .875rem; }
  .tabla-usuarios .c-emp { grid-area: emp; font-size: .875rem; white-space: normal; }
  .tabla-usuarios .c-acc { grid-area: acc; margin-top: 4px; white-space: normal; }
  .accion-texto { min-height: 40px; }
  .consulta-zip { margin-left: 0; width: 100%; white-space: normal; }
}

/* Altas en lote: botones, capa al soltar archivos, tabla de revisión y estados de fila */
.modal-ancha { max-width: 80rem; }
.pastilla { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8125rem; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.pastilla-ok { background: var(--ok-fondo); color: var(--ok); }
.pastilla-espera { background: var(--espera-fondo); color: var(--espera-2); }
.pastilla-mal { background: var(--mal-fondo); color: var(--mal); }
.pastilla-duplicado { background: var(--superficie); color: var(--mal); box-shadow: inset 0 0 0 1px currentColor; }
.pastilla-neutro { background: var(--neutro-fondo); color: var(--neutro); }
.pastilla-marca { background: var(--suave); color: var(--marca); }
.capa-soltar { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(13, 63, 90, .93); pointer-events: none; }
.capa-soltar-marco { max-width: 36rem; padding: 40px 32px; border: 2px dashed rgba(255, 255, 255, .75); border-radius: 12px; text-align: center; color: #fff; }
.capa-soltar-marco p { margin-top: 8px; color: var(--nav-texto); }
.capa-soltar-marco .capa-soltar-titulo { margin: 0; font: 500 1.75rem/1.2 var(--f-cifra); color: #fff; }
.lote-marco { overflow: auto; border: 1px solid var(--linea-2); border-radius: 8px; }
.tabla-lote { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.tabla-lote thead { position: sticky; top: 0; z-index: 1; background: #f6f9fb; }
.tabla-lote th { padding: 7px 8px; border-bottom: 1px solid var(--linea-2); font-weight: 500; color: var(--tinta-3); text-align: left; white-space: nowrap; }
.tabla-lote tbody tr { border-top: 1px solid var(--linea); }
.tabla-lote input:not([type="checkbox"]), .tabla-lote select { min-height: 34px; font-size: .8125rem; }
@media (max-width: 767px) {
  .tabla-lote input:not([type="checkbox"]), .tabla-lote select { min-height: 44px; font-size: 16px; }
  .capa-soltar-marco { padding: 28px 20px; }
}

/* ---------- 5. Tonos pastel: estados, clientes, categorías, cifras y gráficos ----------
   Cada tono-* define fondo (--tono-f), texto (--tono-t, AA sobre su fondo y sobre blanco), relleno de gráfico
   (--tono-r) y trazo (--tono-b, al menos 3:1 sobre blanco). El relleno y el trazo se repiten en TONOS del JSX. */
.tono-cielo { --tono-f: #e2f0f9; --tono-t: #1d5d84; --tono-r: #a9d3ec; --tono-b: #3f86b5; }
.tono-menta { --tono-f: #dff3e9; --tono-t: #1a6650; --tono-r: #a6dcc4; --tono-b: #3d9475; }
.tono-melocoton { --tono-f: #fdeed9; --tono-t: #7a4c08; --tono-r: #f6cf98; --tono-b: #b07a26; }
.tono-rosa { --tono-f: #fbe5e3; --tono-t: #983226; --tono-r: #f2b8b0; --tono-b: #cf6d60; }
.tono-lavanda { --tono-f: #ecebfa; --tono-t: #4a4392; --tono-r: #c9c5f0; --tono-b: #7d76c9; }
.tono-aqua { --tono-f: #dcf2f2; --tono-t: #1c6262; --tono-r: #a2dada; --tono-b: #3f9898; }
.tono-lila { --tono-f: #f5e7f5; --tono-t: #7a3a80; --tono-r: #e3bfe6; --tono-b: #b56dbb; }
.tono-arena { --tono-f: #f3efe3; --tono-t: #5f5229; --tono-r: #ddd0a6; --tono-b: #a08a4a; }
.tono-pizarra { --tono-f: #e9eef4; --tono-t: #44576a; --tono-r: #c3d0dc; --tono-b: #7d93a8; }

/* Estado de una factura o de un gasto recurrente: pastilla pastel con su punto */
.estado { gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; background: var(--tono-f); color: var(--tono-t); font-size: .8125rem; font-weight: 600; line-height: 1.5; }
.estado::before { width: 7px; height: 7px; background: var(--tono-b); }
.estado-ok { --tono-f: #dff3e9; --tono-t: #1a6650; --tono-b: #3d9475; }
.estado-espera { --tono-f: #fdeed9; --tono-t: #7a4c08; --tono-b: #b07a26; }
.estado-mal { --tono-f: #fbe5e3; --tono-t: #983226; --tono-b: #cf6d60; }
.estado-borrador { --tono-f: #ecebfa; --tono-t: #4a4392; --tono-b: #7d76c9; }
.estado-neutro { --tono-f: #e9eef4; --tono-t: #44576a; --tono-b: #7d93a8; }
.estado-ok, .estado-espera, .estado-mal, .estado-borrador, .estado-neutro { color: var(--tono-t); }
.estado-boton { padding: 2px 10px 2px 8px; border-radius: 999px; }
.estado-boton:hover { background: var(--tono-f); box-shadow: inset 0 0 0 1px var(--tono-b); }
.fila-anulada .estado { text-decoration: none; }

/* Etiquetas: categorías de gasto y empresa */
.etiqueta { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--tono-f); color: var(--tono-t); font-size: .8125rem; font-weight: 500; line-height: 1.55; white-space: nowrap; }
.etiqueta-empresa { margin-right: 6px; padding-inline: 7px; font-size: .75rem; font-weight: 600; vertical-align: middle; }

/* Clientes: círculo con iniciales y su tono, el mismo que su barra en el gráfico */
.avatar { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--tono-f); color: var(--tono-t); box-shadow: inset 0 0 0 1px var(--tono-r); font-size: .75rem; font-weight: 600; letter-spacing: .02em; line-height: 1; }
.con-avatar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.con-avatar-texto { min-width: 0; }
.tabla-panel .c-cli .con-avatar-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Panel: cifras en tarjetas pastel */
.cifras, .cifras-con-antiguedad { gap: 12px; border-top: 0; }
.cifra, .cifra-pendiente, .cifra-facturado, .cifra-gastos { padding: 16px 18px; border: 0; border-radius: 14px; background: var(--tono-f); }
.cifra-pendiente { --tono-f: #fdeed9; --tono-t: #7a4c08; }
.cifra-facturado { --tono-f: #e2f0f9; --tono-t: #1d5d84; }
.cifra-cobrado { --tono-f: #dff3e9; --tono-t: #1a6650; }
.cifra-gastos { --tono-f: #fbe5e3; --tono-t: #983226; }
.cifra-beneficio { --tono-f: #ecebfa; --tono-t: #4a4392; }
.cifra-negativa { --tono-f: #fbe5e3; --tono-t: #983226; }
.cifra .cifra-titulo, .cifra .cifra-importe, .cifra .cifra-sec, .cifra .cifra-nota, .cifra .cifra-importe small { color: var(--tono-t); }
.cifra .cifra-titulo { font-weight: 600; }
.cifra .cifra-nota { opacity: .9; }
.cifra-negativa .cifra-importe { color: var(--tono-t); }
.antiguedad { padding: 16px 18px; border: 1px solid var(--linea); border-radius: 14px; background: var(--superficie); }
.antiguedad-barra { height: 10px; gap: 3px; }
.antiguedad-barra i { border-radius: 4px; }
.tramo-0 { background: #a6dcc4; box-shadow: inset 0 0 0 1px #3d9475; }
.tramo-1 { background: #f6cf98; box-shadow: inset 0 0 0 1px #b07a26; }
.tramo-2 { background: #f2b8b0; box-shadow: inset 0 0 0 1px #cf6d60; }
.antiguedad-lista dt i { width: 10px; height: 10px; border-radius: 3px; }

/* Gastos y recurrentes: cifras sueltas en pastel */
.cifra-suelta { padding: 14px 16px; border: 0; border-radius: 14px; background: var(--tono-f, #f6f9fb); }
.cifra-suelta .cifra-suelta-titulo, .cifra-suelta .cifra-suelta-importe, .cifra-suelta .cifra-suelta-nota, .cifra-suelta .cifra-suelta-importe small { color: var(--tono-t, var(--tinta)); }
.cifra-suelta .cifra-suelta-titulo { font-weight: 600; }

/* Pestañas de estado: pastilla con el tono de su estado */
.chips { gap: 8px; }
.chips button { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--linea-2); background: var(--superficie); color: var(--tinta-2); box-shadow: none; }
.chips button:hover { border-color: var(--tono-b, var(--linea-2)); color: var(--tono-t, var(--marca)); }
.chips button.on { border-color: transparent; background: var(--tono-f, var(--suave)); color: var(--tono-t, var(--marca)); box-shadow: inset 0 0 0 1px var(--tono-r, transparent); }
.chips button.on b, .chips button:hover b { color: inherit; }

/* Subida en lote: los estados de fila con los mismos tonos */
.pastilla-ok { background: #dff3e9; color: #1a6650; }
.pastilla-espera { background: #fdeed9; color: #7a4c08; }
.pastilla-mal { background: #fbe5e3; color: #983226; }
.pastilla-duplicado { background: #f5e7f5; color: #7a3a80; box-shadow: inset 0 0 0 1px #e3bfe6; }
.pastilla-neutro { background: #e9eef4; color: #44576a; }
.pastilla-marca { background: #e2f0f9; color: #1d5d84; }

@media (max-width: 1023px) {
  .cifras, .cifras-con-antiguedad { gap: 10px; }
  .cifra, .cifra-pendiente, .cifra-facturado, .cifra-gastos { padding: 12px 14px; border: 0; }
  .cifra-pendiente { padding: 14px 16px; }
  .antiguedad { padding: 14px 16px; }
  .avatar { width: 30px; height: 30px; }
  .chips button { min-height: 40px; }
}
