:root {
  /* ── Colores base ─────────────────────────────────────────────────────── */
  --color-texto: #2a2a2a;
  --color-texto-secundario: #6b6659;
  --color-fondo: #f1f0ee;
  --color-primario: #c81517;
  --color-primario-oscuro: #a11013;
  --color-primario-fondo: rgba(200, 21, 23, 0.08);
  --color-error: #b3261e;
  --color-error-fondo: rgba(179, 38, 30, 0.08);
  --color-advertencia: #c9932e;
  --color-ok: #3a9257;
  --sidebar-fondo: #2a2a2a;
  --sidebar-texto: #ffffff;

  /* ── Sombras ──────────────────────────────────────────────────────────── */
  --sombra-sm: 0 1px 2px rgba(20, 15, 10, 0.05), 0 1px 4px rgba(20, 15, 10, 0.06);
  --sombra-md: 0 4px 12px rgba(20, 15, 10, 0.10);
  --sombra-modal: 0 16px 40px rgba(20, 15, 10, 0.22);

  /* ── Tokens semánticos de UI ──────────────────────────────────────────── */
  --fondo-pagina:   #f1f0ee;          /* fondo del área de contenido */
  --fondo-tarjeta:  #ffffff;          /* fondo de tarjetas y modales */
  --texto-principal: #3d3830;         /* texto de cuerpo oscuro */
  --texto-secundario: #6b6457;        /* texto de apoyo / etiquetas */
  --texto-tenue:    #736d67;          /* texto muy secundario — mínimo 4.5:1 contra fondo blanco */
  --borde-suave:    #e5e2da;          /* bordes de cards, separadores */
  --borde-input:    #cfcabd;          /* bordes de inputs */
  --hover-fila:     #fbfaf7;          /* hover en filas de tabla */

  /* ── Escala de z-index (#15) ─────────────────────────────────────────── */
  --z-backdrop:  20;   /* fondo oscuro detrás del sidebar mobile */
  --z-sidebar:   30;   /* panel sidebar en mobile */
  --z-modal:    100;   /* overlays de modal y dropdowns */
  --z-modal-top: 200;  /* modales apilados y sugerencias de búsqueda */

  /* ── Chips de color ───────────────────────────────────────────────────── */
  --chip-rojo-fondo: #fbe1e1;
  --chip-rojo-texto: #a11013;
  --chip-azul-fondo: #dcecf5;
  --chip-azul-texto: #2b6a8c;
  --chip-ambar-fondo: #faedd3;
  --chip-ambar-texto: #93650f;
  --chip-verde-fondo: #e6f4ea;
  --chip-verde-texto: #2e7d32;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-texto);
  background: var(--color-fondo);
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a[href]:focus-visible,
[tabindex]:focus-visible,
.sidebar-item:focus-visible {
  outline: 2px solid var(--color-primario);
  outline-offset: 2px;
}

.btn-primario {
  background: var(--color-primario);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--sombra-sm);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn-primario:hover:not(:disabled) {
  background: var(--color-primario-oscuro);
  box-shadow: var(--sombra-md);
}

.btn-primario:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primario svg,
.btn-secundario svg {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  margin-right: 4px;
}

.btn-banner {
  display: block;
  width: 100%;
  text-align: center;
  padding: 13px 16px;
  font-size: 1rem;
  border-radius: 8px;
  margin-bottom: 20px;
}

.banner-error {
  background: var(--color-error-fondo);
  color: var(--color-error);
  border: 1px solid var(--color-error);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

/* Login */
.login-pantalla {
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(200, 21, 23, 0.06), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(200, 21, 23, 0.05), transparent 45%),
    var(--color-fondo);
}

.login-card {
  width: 340px;
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 10px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--sombra-modal);
}

.login-logo {
  width: 64px;
  height: 64px;
  border: 2px dashed #c9c5ba;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  color: var(--color-texto-secundario);
  font-size: 0.75rem;
  text-align: center;
}

.login-logo-img {
  max-width: 180px;
  max-height: 80px;
  align-self: center;
  object-fit: contain;
}

.login-titulo {
  text-align: center;
  margin: 0 0 8px;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.campo label {
  font-size: 0.85rem;
  color: #5a5648;
}

.campo input,
.campo select {
  padding: 8px 10px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-texto);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campo input:focus,
.campo select:focus {
  outline: none;
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px var(--color-primario-fondo);
}

.campo-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-texto-secundario);
}

.campo-hint-error {
  color: var(--color-error);
}

.campo-con-boton {
  display: flex;
  gap: 8px;
}

.campo-con-boton select {
  flex: 1;
  min-width: 0;
}

.campo-con-boton .btn-secundario {
  flex-shrink: 0;
  white-space: nowrap;
}

.campo-encabezado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.campo-encabezado label {
  margin-bottom: 0;
}

.btn-link-accion {
  background: none;
  border: none;
  color: var(--color-primario);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  border-radius: 4px;
}
.btn-link-accion:hover { background: var(--color-primario-tenue); }
.btn-link-accion:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-link-accion svg { width: 14px; height: 14px; }

.cliente-buscador-wrap {
  position: relative;
}

.cliente-buscador-wrap input {
  width: 100%;
}

.cliente-dropdown-lista {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--color-superficie);
  border: 1px solid var(--color-borde);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  z-index: var(--z-modal);
  max-height: 180px;
  overflow-y: auto;
}

.cliente-dropdown-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--color-texto);
  transition: background 0.12s;
}
.cliente-dropdown-item:hover { background: var(--color-primario-tenue); color: var(--color-primario); }

.cliente-dropdown-vacio {
  padding: 10px 14px;
  color: var(--color-texto-secundario);
  font-size: 0.88rem;
}

.campo-password {
  position: relative;
}

.campo-password input {
  width: 100%;
  padding-right: 38px;
}

.btn-ver-password {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  border-radius: 4px;
  padding: 6px;
  font-size: 1rem;
  line-height: 1;
  color: #5a5648;
  user-select: none;
}

.btn-ver-password:hover {
  background: rgba(0,0,0,0.05);
}

/* Shell */
.app-shell {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-fondo);
  color: var(--sidebar-texto);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}

.sidebar-marca {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 16px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
}

.sidebar-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.sidebar-marca .nombre {
  font-weight: 600;
  font-size: 0.95rem;
}

.sidebar-marca .subtitulo {
  font-size: 0.7rem;
  opacity: 0.7;
}

.sidebar-seccion {
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  opacity: 0.6;
  padding: 0 20px;
  margin-bottom: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 1.02rem;
  opacity: 0.85;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.sidebar-item-icono {
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  opacity: 1;
}

.sidebar-item.activo {
  opacity: 1;
  background: linear-gradient(90deg, rgba(200, 21, 23, 0.22), rgba(200, 21, 23, 0.04));
  border-left-color: var(--color-primario);
  font-weight: 600;
}

.btn-colapsar {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.btn-colapsar:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.icono-flecha {
  display: inline-flex;
  transition: transform 0.2s ease;
}

.icono-flecha svg {
  width: 16px;
  height: 16px;
}

.icono-flecha-invertida {
  transform: rotate(180deg);
}

.sidebar-usuario {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.avatar-circulo.avatar-circulo-sidebar {
  width: 34px;
  height: 34px;
  background: var(--color-primario);
  color: #fff;
  font-size: 0.9rem;
}

.sidebar-usuario-info {
  min-width: 0;
  flex: 1;
}

.sidebar-usuario-nombre {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-usuario-rol {
  font-size: 0.72rem;
  opacity: 0.65;
}

.btn-logout-sidebar {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-logout-sidebar svg {
  width: 17px;
  height: 17px;
}

.btn-logout-sidebar:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Sidebar colapsado (solo íconos) — desktop */
.sidebar.sidebar-colapsado {
  width: 76px;
}

.sidebar.sidebar-colapsado .sidebar-marca {
  padding: 0 0 20px;
  flex-direction: column;
  gap: 8px;
}

.sidebar.sidebar-colapsado .btn-colapsar {
  margin-left: 0;
}

.sidebar.sidebar-colapsado .sidebar-marca-texto,
.sidebar.sidebar-colapsado .sidebar-seccion,
.sidebar.sidebar-colapsado .sidebar-item-label,
.sidebar.sidebar-colapsado .sidebar-usuario-info {
  display: none;
}

.sidebar.sidebar-colapsado .sidebar-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.sidebar-colapsado .sidebar-usuario {
  justify-content: center;
  padding: 14px 0;
}

.contenido {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid #e5e2da;
}

.btn-hamburguesa {
  display: inline-block;
  background: none;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
}

.area-modulo {
  padding: 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.placeholder-modulo {
  color: var(--color-texto-secundario);
  font-size: 0.95rem;
}

/* ── Cabecera unificada de módulo ────────────────────────────────────────── */
.modulo-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.modulo-titulo {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--texto-principal);
}
.modulo-acciones {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* alias legacy — no rompe módulos que todavía no se migraron */
.modulo-header {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.campo-filtro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.campo-filtro label {
  font-size: 0.72rem;
  color: var(--color-texto-secundario);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.input-busqueda,
.input-fecha,
.campo-texto {
  padding: 8px 12px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-texto);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-busqueda {
  flex: 1;
  max-width: 320px;
}

.input-fecha {
  color-scheme: light;
}

.input-busqueda:focus,
.input-fecha:focus,
.campo-texto:focus {
  outline: none;
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px var(--color-primario-fondo);
}

.campo-input-error {
  border-color: var(--color-peligro, #e53e3e) !important;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15) !important;
}
.campo-error-msg {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--color-peligro, #e53e3e);
  line-height: 1.3;
}

.campo-valor-fijo {
  margin: 4px 0 0;
  padding: 8px 12px;
  background: var(--color-fondo, #f5f0eb);
  border: 1px solid #ddd5c8;
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--color-texto);
  cursor: default;
}

.btn-reintentar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--color-error);
  color: var(--color-error);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  margin-left: 10px;
}

.btn-reintentar svg {
  width: 13px;
  height: 13px;
}

.tabla-wrap {
  overflow-x: auto;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  box-shadow: var(--sombra-sm);
}

.tabla {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}

.tabla .acciones {
  white-space: nowrap;
}

/* Ancho proporcional fijo por columna, para que la distribución se vea
   equilibrada en vez de una columna absorbiendo todo el espacio sobrante.
   Acciones usa px fijo (no %): es lo único que table-layout:fixed respeta
   de forma consistente como piso real en pantallas angostas. */
.tabla-clientes th:nth-child(1) { width: 28%; }
.tabla-clientes th:nth-child(2) { width: 17%; }
.tabla-clientes th:nth-child(3) { width: 30%; }
.tabla-clientes th:nth-child(4) { width: 15%; }
.tabla-clientes th:nth-child(5),
.tabla-clientes td:nth-child(5) { width: 120px; white-space: nowrap; }

.tabla-proveedores th:nth-child(1) { width: 25%; }
.tabla-proveedores th:nth-child(2) { width: 18%; }
.tabla-proveedores th:nth-child(3) { width: 14%; }
.tabla-proveedores th:nth-child(4) { width: 30%; }
.tabla-proveedores th:nth-child(5),
.tabla-proveedores td:nth-child(5) { width: 80px; white-space: nowrap; }

.tabla-vehiculos th:nth-child(1) { width: 14%; }
.tabla-vehiculos th:nth-child(2) { width: 20%; }
.tabla-vehiculos th:nth-child(3) { width: 22%; }
.tabla-vehiculos th:nth-child(4) { width: 12%; }
.tabla-vehiculos th:nth-child(5) { width: 22%; }
.tabla-vehiculos th:nth-child(6),
.tabla-vehiculos td:nth-child(6) { width: 90px; white-space: nowrap; }

/* 11 columnas: Producto SKU Marca Ubicación Unidad Stock P.Compra P.Venta Margen Estado Acciones */
.tabla-inventario th:nth-child(1)  { min-width: 160px; }
.tabla-inventario th:nth-child(2)  { width: 8%; }
.tabla-inventario th:nth-child(3)  { width: 8%; }
.tabla-inventario th:nth-child(4)  { width: 7%; }
.tabla-inventario th:nth-child(5)  { width: 7%; }
.tabla-inventario th:nth-child(6)  { width: 8%; }
.tabla-inventario th:nth-child(7)  { width: 10%; }
.tabla-inventario th:nth-child(8)  { width: 10%; }
.tabla-inventario th:nth-child(9)  { width: 7%; }
.tabla-inventario th:nth-child(10) { width: 7%; }
.tabla-inventario th:nth-child(11),
.tabla-inventario td:nth-child(11) { width: 80px; white-space: nowrap; }
.fila-inactiva { opacity: 0.55; }

.tabla th, .tabla td {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid #eee9de;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tabla th {
  color: var(--color-texto-secundario);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.tabla tbody tr:hover {
  background: #fbfaf7;
}

.acciones button + button {
  margin-left: 10px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primario);
  font-size: 0.85rem;
  padding: 0;
}

.btn-link.btn-peligro {
  color: var(--color-error);
}

.accion-cuadro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.accion-cuadro svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.acciones .accion-cuadro + .accion-cuadro {
  margin-left: 6px;
}

.accion-cuadro:hover {
  filter: brightness(0.94);
}

.accion-cuadro:active {
  transform: translateY(1px);
}

.accion-cuadro-ver {
  background: var(--chip-azul-fondo);
  color: var(--chip-azul-texto);
}

.accion-cuadro-editar {
  background: var(--chip-ambar-fondo);
  color: var(--chip-ambar-texto);
}

.accion-cuadro-eliminar {
  background: var(--chip-rojo-fondo);
  color: var(--chip-rojo-texto);
}

.btn-secundario {
  background: none;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  transition: background-color 0.15s ease;
}

.btn-secundario:hover:not(:disabled) {
  background: #f5f3ee;
}

.btn-peligro-solido {
  background: var(--color-error);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  transition: background-color 0.15s ease;
}

.btn-peligro-solido:hover:not(:disabled) {
  background: #8f1f19;
}

.overlay-modal.overlay-modal-top { z-index: var(--z-modal-top); }

.overlay-modal,
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}

.modal-card,
.modal-contenido {
  width: 560px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--sombra-modal);
}

.modal-card h3,
.modal-contenido h3 {
  margin: 0;
}

.modal-encabezado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.modal-encabezado h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-pie {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid #e5e2da;
  margin-top: 4px;
}

.btn-cerrar-modal {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #6b6457;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.btn-cerrar-modal:hover { background: #f0ede7; color: var(--color-primario); }

.modal-card-chica {
  width: 360px;
}

.modal-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.detalle-campo {
  font-size: 0.9rem;
  color: #4a4636;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab-item {
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-texto-secundario);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tab-item.activo {
  background: var(--color-primario);
  border-color: var(--color-primario);
  color: #fff;
  box-shadow: var(--sombra-sm);
}

.tabla-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tabla-mini th, .tabla-mini td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #eee9de;
}

.tabla-mini select {
  padding: 4px 6px;
  border: 1px solid #cfcabd;
  border-radius: 4px;
  font-size: 0.85rem;
}

.chip {
  display: inline-block;
  background: #f0eee7;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.78rem;
  margin: 2px 4px 2px 0;
}

.fila-con-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-circulo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primario-fondo);
  color: var(--color-primario-oscuro);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.resultados-buscador {
  border: 1px solid #e5e2da;
  border-radius: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.resultado-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #f0eee7;
  font-size: 0.85rem;
}

.resultado-item select {
  padding: 4px 6px;
  border: 1px solid #cfcabd;
  border-radius: 4px;
  font-size: 0.8rem;
}

.filtro-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #5a5648;
  white-space: nowrap;
}

.badge-stock {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.85rem;
}

.badge-stock-bajo {
  background: var(--color-advertencia);
  color: #fff;
  font-weight: 600;
}

.paginacion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: #5a5648;
}

.paginacion .btn-secundario {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Servicios — layout tipo POS */
.pos-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.pos-panel-izquierdo {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pos-panel-derecho {
  width: 340px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  box-shadow: var(--sombra-sm);
}

.pos-panel-derecho h3 {
  margin: 0;
  font-size: 1rem;
}

.resultado-clicable {
  cursor: pointer;
}

.resultado-clicable:hover {
  background: #f0eee7;
}

.cliente-seleccionado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
}

/* Dropdown tipo combobox */
.busqueda-combobox {
  position: relative;
  width: 100%;
}

.busqueda-combobox .input-busqueda {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.lista-sugerencias {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #cfcabd;
  border-radius: 8px;
  box-shadow: var(--sombra-md);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
  z-index: var(--z-modal-top);
}

.lista-sugerencias li {
  padding: 9px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--color-texto);
  border-bottom: 1px solid #f0ede7;
}

.lista-sugerencias li:last-child { border-bottom: none; }

.lista-sugerencias li:hover {
  background: var(--color-primario-fondo);
  color: var(--color-primario-oscuro);
}

.info-seleccion {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f3f0;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.mano-obra-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mano-obra-form label {
  font-size: 0.85rem;
  color: #5a5648;
}

.mano-obra-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mano-obra-inputs input[type="text"] {
  flex: 2;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.9rem;
}

.mano-obra-inputs input[type="number"] {
  flex: 1;
  min-width: 90px;
  padding: 8px 10px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.9rem;
}

.mano-obra-inputs select {
  flex: 1.5;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-texto);
}

.responsables-seccion {
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 12px 14px;
  background: #faf9f7;
}

.responsables-encabezado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.responsables-titulo {
  font-size: 0.88rem;
  font-weight: 600;
  color: #5a5648;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.responsable-fila {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.responsable-select {
  flex: 1.4;
  min-width: 120px;
  padding: 7px 10px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-texto);
}

.responsable-desc {
  flex: 2;
  min-width: 100px;
  padding: 7px 10px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
}

.responsables-detalle {
  margin-top: 10px;
}

.responsable-chip-detalle {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid #f0ede7;
  font-size: 0.9rem;
}

.responsable-chip-detalle:last-child {
  border-bottom: none;
}

.responsable-chip-nombre {
  font-weight: 600;
  color: #3d3a32;
}

.responsable-chip-desc {
  color: #6b6457;
}

.carrito-total {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: right;
  border-top: 1px solid #e5e2da;
  padding-top: 10px;
}

.btn-generar-recibo {
  width: 100%;
}

.tabla-servicios th:nth-child(1) { width: 16%; }
.tabla-servicios th:nth-child(2) { width: 26%; }
.tabla-servicios th:nth-child(3) { width: 32%; }
.tabla-servicios th:nth-child(4) { width: 16%; }
.tabla-servicios th:nth-child(5),
.tabla-servicios td:nth-child(5) { width: 60px; white-space: nowrap; }

/* Dashboard */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.dash-grid-trabajador {
  grid-template-columns: 1fr;
  max-width: 260px;
}

.dash-card {
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 16px;
  min-height: 100px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--sombra-sm);
}

.dash-card-cuerpo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.dash-card-icono {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.dash-icono-rojo { background: var(--chip-rojo-fondo); }
.dash-icono-ambar { background: var(--chip-ambar-fondo); }

.dash-card h3 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-texto-secundario);
  font-weight: 600;
}

.dash-valor {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-numero {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-texto);
}

.dash-numero-alerta {
  color: var(--color-advertencia);
}

.dash-sub {
  font-size: 0.8rem;
  color: var(--color-texto-secundario);
}

.dash-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.dash-chart-card {
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--sombra-sm);
}

.dash-chart-card h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #5a5648;
  font-weight: 600;
}

.dash-chart-hint {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: var(--color-texto-secundario);
}

.dash-chart-contenedor {
  width: 100%;
}

@media (max-width: 900px) {
  .dash-charts-row {
    grid-template-columns: 1fr;
  }
}

.dash-accesos {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.dash-accion-principal {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1.1rem;
  padding: 18px 24px;
  margin-bottom: 20px;
}

.dash-subtitulo {
  font-size: 0.95rem;
  margin: 20px 0 12px;
}

@media (max-width: 900px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Configuración */
.config-seccion {
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--sombra-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.config-seccion-form {
  max-width: 500px;
}

.config-fila {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.config-fila .config-seccion {
  flex: 1 1 320px;
  max-width: none;
  min-width: 0;
  margin-bottom: 0;
}

.config-seccion > .btn-primario {
  align-self: flex-start;
}

.input-porcentaje {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid #cfcabd;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.input-porcentaje:focus {
  outline: none;
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px var(--color-primario-fondo);
}

.config-seccion h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.config-logo-preview {
  width: 140px;
  height: 100px;
  border: 1px solid #e5e2da;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: #fbfaf7;
}

.config-logo-img {
  max-width: 120px;
  max-height: 80px;
  object-fit: contain;
}

.config-logo-placeholder {
  color: var(--color-texto-secundario);
  font-size: 0.8rem;
}

.config-logo-controles {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.config-logo-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-success {
  background: #eaf7ee;
  color: var(--color-ok);
  border: 1px solid var(--color-ok);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.tabla-usuarios th:nth-child(1) { width: 28%; }
.tabla-usuarios th:nth-child(2) { width: 22%; }
.tabla-usuarios th:nth-child(3) { width: 20%; }
.tabla-usuarios th:nth-child(4) { width: 16%; }
.tabla-usuarios th:nth-child(5),
.tabla-usuarios td:nth-child(5) { width: 60px; white-space: nowrap; }

/* Responsivo */
@media (max-width: 860px) {
  .topbar {
    display: flex;
  }

  .btn-colapsar {
    display: none;
  }

  .sidebar,
  .sidebar.sidebar-colapsado {
    width: 220px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--z-sidebar);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.25);
  }

  .sidebar.sidebar-colapsado .sidebar-marca-texto,
  .sidebar.sidebar-colapsado .sidebar-seccion,
  .sidebar.sidebar-colapsado .sidebar-item-label,
  .sidebar.sidebar-colapsado .sidebar-usuario-info {
    display: block;
  }

  .sidebar.sidebar-colapsado .sidebar-marca {
    flex-direction: row;
    justify-content: flex-start;
  }

  .sidebar.sidebar-colapsado .sidebar-item,
  .sidebar.sidebar-colapsado .sidebar-usuario {
    justify-content: flex-start;
    padding-left: 20px;
  }

  .sidebar.sidebar-abierto {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: var(--z-backdrop);
  }

  .modulo-header {
    flex-wrap: wrap;
  }

  .input-busqueda {
    max-width: none;
  }

  .dash-accesos {
    flex-wrap: wrap;
  }

  .mano-obra-inputs input[type="text"],
  .mano-obra-inputs input[type="number"],
  .mano-obra-inputs select {
    flex: 1 1 100%;
  }
}

@media (max-width: 760px) {
  .pos-layout {
    flex-direction: column;
  }

  .pos-panel-derecho {
    width: 100%;
    position: static;
  }
}

@media (max-width: 600px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════ KANBAN ═══════════════════════════════════════ */
.kanban-barra { /* alias → .modulo-barra */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.kanban-resumen {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.kanban-resumen-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  border-left: 4px solid transparent;
  box-shadow: var(--sombra-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}

.kanban-resumen-card.estado-recibido   { border-color: #c9932e; }
.kanban-resumen-card.estado-en_proceso { border-color: #2b6a8c; }
.kanban-resumen-card.estado-listo      { border-color: #3a9257; }
.kanban-resumen-card.estado-entregado  { border-color: #888; }

.kanban-resumen-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2a2a2a;
  line-height: 1;
}

.kanban-resumen-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b6457;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 600px) {
  .kanban-resumen { grid-template-columns: 1fr 1fr; }
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}

.kanban-columna {
  background: #f5f3f0;
  border-radius: 10px;
  padding: 12px 10px;
  min-height: 120px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid transparent;
}

.kanban-col-header.estado-recibido   { border-color: #c9932e; }
.kanban-col-header.estado-en_proceso { border-color: #2b6a8c; }
.kanban-col-header.estado-listo      { border-color: #3a9257; }
.kanban-col-header.estado-entregado  { border-color: #888; }

.kanban-col-titulo {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a5648;
}

.kanban-col-badge {
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 1px 7px;
  color: #5a5648;
}

.kanban-columna.drag-sobre {
  background: #ede9e2;
  outline: 2px dashed var(--color-primario);
  outline-offset: -2px;
}

.kanban-tarjeta {
  background: #fff;
  border: 1px solid #e5e2da;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.1s, opacity 0.15s;
}

.kanban-tarjeta:hover {
  box-shadow: var(--sombra-md);
  transform: translateY(-1px);
}

.kanban-tarjeta.arrastrando {
  opacity: 0.4;
  cursor: grabbing;
}

.kanban-tarjeta-placa {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-primario);
  letter-spacing: 0.03em;
}

.kanban-tarjeta-vehiculo {
  font-size: 0.82rem;
  color: #6b6457;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-tarjeta-cliente {
  font-size: 0.83rem;
  color: #3d3a32;
  margin-top: 4px;
  font-weight: 500;
}

.kanban-tarjeta-pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.kanban-tarjeta-falla {
  font-size: 0.8rem;
  color: #7a4e0a;
  background: #faedd3;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-tarjeta-resps {
  font-size: 0.78rem;
  color: #7a7264;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.kanban-tarjeta-total {
  font-size: 0.83rem;
  font-weight: 700;
  color: #3d3a32;
}

.modal-orden-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-orden-titulo-bloque { flex: 1; }

.modal-orden-placa {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primario);
  letter-spacing: 0.04em;
}

.modal-orden-vehiculo {
  font-size: 0.88rem;
  color: #6b6457;
}

.modal-orden-cliente {
  font-size: 0.92rem;
  font-weight: 500;
  margin-top: 2px;
}

.modal-falla-reportada {
  background: #faedd3;
  border-left: 3px solid #c9932e;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: #5a3a08;
  margin-bottom: 12px;
}

.modal-falla-etiqueta {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #93650f;
  margin-bottom: 3px;
}

.modal-orden-estado-fila {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.btn-estado {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid #cfcabd;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a5648;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-estado:hover { background: #f0ede7; }

.btn-estado.activo.recibido   { background: #faedd3; border-color: #c9932e; color: #7a4e0a; }
.btn-estado.activo.en_proceso { background: #dcecf5; border-color: #2b6a8c; color: #1a4d6a; }
.btn-estado.activo.listo      { background: #d4edda; border-color: #3a9257; color: #1e6b3a; }
.btn-estado.activo.entregado  { background: #e8e8e8; border-color: #888; color: #444; }
.btn-estado.btn-estado-bloqueado,
.btn-estado:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-estado.btn-estado-bloqueado:hover { background: #fff; }
.btn-estado.btn-estado-cerrar { border-color: #1b5e99; color: #1b5e99; }
.btn-estado.btn-estado-cerrar:hover:not(:disabled) { background: #e8f0fb; }

.chip-cerrado {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  background: #e8f5e9;
  border: 1.5px solid #3a9257;
  color: #1e6b3a;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* modal cierre de servicio legacy – se mantiene por si se reutiliza */
.btn-cerrar-servicio {
  padding: 8px 18px;
  border-radius: 8px;
  background: #1b5e99;
  color: #fff;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-cerrar-servicio:hover:not(:disabled) { background: #154d80; }
.btn-cerrar-servicio:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Modal cierre de servicio (rediseñado) ───────────────────────────────── */
.modal-cierre-servicio {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 32px 28px;
  max-width: 460px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.30);
  isolation: isolate;
}
@media (prefers-color-scheme: dark) {
  .modal-cierre-servicio { background: #2a2520; }
}
.modal-cierre-x {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--texto-secundario);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.modal-cierre-x:hover { background: var(--borde-suave); color: var(--texto-principal); }
.modal-cierre-icono {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 14px;
  color: #c9762a;
}
.modal-cierre-titulo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--texto-principal);
  margin: 0 0 10px;
}
.modal-cierre-texto {
  font-size: 0.9rem;
  color: var(--texto-secundario);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* Opciones de pago al cierre */
.cierre-pago-opciones {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  text-align: left;
}
.cierre-pago-opcion {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 2px solid var(--borde-suave);
  border-radius: 10px;
  background: var(--fondo-pagina);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.cierre-pago-opcion:hover { border-color: var(--color-primario); }
.cierre-pago-opcion.activo {
  border-color: var(--color-primario);
  background: color-mix(in srgb, var(--color-primario) 8%, transparent);
}
.cierre-pago-icono { font-size: 1.2rem; margin-bottom: 4px; }
.cierre-pago-label { font-size: 0.88rem; font-weight: 700; color: var(--texto-principal); }
.cierre-pago-desc { font-size: 0.75rem; color: var(--texto-secundario); }

/* Campos adicionales pago pendiente */
.cierre-pago-detalle {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--fondo-pagina);
  border: 1px solid var(--borde-suave);
  border-radius: 10px;
  margin-bottom: 16px;
  text-align: left;
}
.cierre-pago-detalle .campo { margin: 0; }
.cierre-pago-detalle label { font-size: 0.8rem; }

.modal-cierre-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--fondo-pagina);
  border: 1px solid var(--borde-suave);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.83rem;
  color: var(--texto-secundario);
  text-align: left;
  margin-bottom: 22px;
}
.modal-cierre-info-icon { font-size: 1.1rem; flex-shrink: 0; }
.modal-cierre-acciones {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-cierre-btn-cancelar {
  flex: 1;
  max-width: 130px;
}
.btn-cierre-confirmar {
  flex: 1;
  max-width: 220px;
  padding: 10px 18px;
  border-radius: 8px;
  background: #1b5e99;
  color: #fff;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-cierre-confirmar:hover:not(:disabled) { background: #154d80; }
.btn-cierre-confirmar:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Vista historial de cerrados ─────────────────────────────────────────── */
.cerrados-barra {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.cerrados-barra .input-busqueda { flex: 1; max-width: 360px; }

/* ── Sistema de tabla secundario (historial, listas) ─────────────────────
   Visual idéntico a .tabla pero sin table-layout:fixed               */
.tabla-datos {
  width: 100%;
  border-collapse: collapse;
  background: var(--fondo-tarjeta);
  font-size: 0.88rem;
}
.tabla-datos thead th {
  background: #f5f3f0;
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-secundario);
  border-bottom: 2px solid var(--borde-suave);
  white-space: nowrap;
}
.tabla-datos tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #ede9e2;
  vertical-align: middle;
  color: var(--texto-principal);
}
.tabla-datos tbody tr:hover td { background: var(--hover-fila); }
.td-num   { font-variant-numeric: tabular-nums; font-size: 0.83rem; color: var(--texto-secundario); }
.td-fecha { font-size: 0.82rem; color: var(--texto-secundario); white-space: nowrap; }
.td-muted { font-size: 0.82rem; color: var(--texto-tenue); }

/* ── Historial expandible ─────────────────────────────────────────────────── */
.tabla-historial .historial-fila { cursor: pointer; }
.tabla-historial .historial-fila:hover td { background: #f5f3f0; }
.tabla-historial .historial-fila.expandida td { background: #f0ede7; }
.td-toggle { width: 32px; padding: 0 4px 0 10px !important; color: #9a9088; }
.toggle-icono {
  display: inline-block;
  font-size: 0.65rem;
  transition: transform 0.2s;
  user-select: none;
}
.toggle-icono.abierto { transform: rotate(90deg); }

.historial-detalle-fila td { padding: 0 !important; border-bottom: 2px solid #c8c2b8 !important; }
.historial-detalle {
  background: #f7f5f1;
  padding: 14px 20px;
}
.historial-items-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.historial-items-tabla th {
  padding: 6px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a7264;
  border-bottom: 1px solid #ddd8d0;
}
.historial-items-tabla td {
  padding: 7px 10px;
  border-bottom: 1px solid #eae7e0;
  color: #3d3830;
  vertical-align: middle;
}

.modal-orden-seccion {
  border-top: 1px solid #e5e2da;
  padding-top: 14px;
  margin-top: 14px;
}

.modal-orden-seccion-titulo {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a7264;
  margin-bottom: 10px;
}

.items-tabla { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.items-tabla th { font-size: 0.78rem; font-weight: 600; color: #7a7264; text-align: left; padding: 4px 6px; border-bottom: 1px solid #e5e2da; }
.items-tabla td { padding: 5px 6px; vertical-align: middle; border-bottom: 1px solid #f0ede7; }

.items-agregar-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.kanban-total-linea {
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 2px solid #e5e2da;
  color: #2a2a2a;
}

.responsable-modal-fila {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.responsable-nombre-modal { font-weight: 600; font-size: 0.9rem; }
.responsable-desc-modal { font-size: 0.83rem; color: #6b6457; }

@media (max-width: 700px) {
  .kanban-board { grid-template-columns: 1fr; }
}
/* ── TAREAS ─────────────────────────────────────────────────────────────────── */
.area-modulo-tareas {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 12px;
}

.tareas-modulo-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tareas-cal-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tareas-barra { /* alias → .modulo-barra */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.tareas-barra-acciones { /* alias → .modulo-acciones */
  display: flex;
  align-items: center;
  gap: 10px;
}
.tareas-filtro-usuario {
  min-width: 180px;
}

/* ── Toggle calendario/lista ─────────────────────────────────────────────── */
.tareas-vista-toggle {
  display: flex;
  border: 1px solid var(--borde-suave, #ddd);
  border-radius: 8px;
  overflow: hidden;
}
.tareas-vista-btn {
  background: none;
  border: none;
  padding: 6px 11px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--texto-secundario, #7a7264);
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.tareas-vista-btn:hover { background: #f0ede7; }
.tareas-vista-btn.activo {
  background: #3d3830;
  color: #fff;
}

/* ── Vista lista ────────────────────────────────────────────────────────── */
.tareas-lista-wrap { margin-top: 4px; }
.tareas-lista-tabla { cursor: default; }
.tareas-lista-fila {
  cursor: pointer;
  transition: background 0.1s;
}
.tareas-lista-fila:hover td { background: #f5f3f0; }

.tarea-lista-titulo { font-weight: 600; font-size: 0.9rem; color: #3d3830; }
.tarea-lista-desc {
  font-size: 0.8rem;
  color: #7a7264;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.tarea-lista-fecha { font-weight: 500; }
.fecha-vencida  { color: #c0392b !important; }
.fecha-pendiente { color: #3d3830; }
.fecha-completada { color: #7a7264; text-decoration: line-through; }

.tarea-lista-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pendiente  { background: #edf3fb; color: #1b5e99; }
.badge-vencida    { background: #fdecea; color: #c0392b; }
.badge-completada { background: #edf7ed; color: #2e7d32; }

.tarea-lista-comentarios { max-width: 280px; }
.tarea-comentarios-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #5a5248;
  margin-right: 6px;
  white-space: nowrap;
}
.tarea-ultimo-comentario {
  font-size: 0.8rem;
  color: #7a7264;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* fila vencida tiene leve tint rojo */
.tarea-fila-vencida td { background: #fff8f8; }
.tarea-fila-vencida:hover td { background: #fdecea !important; }

.tareas-cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.tareas-cal-mes-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2a2a2a;
  min-width: 180px;
  text-align: center;
}
.btn-cal-nav {
  background: none;
  border: 1px solid #d4c9b8;
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: #5a4f3c;
  line-height: 1.4;
  transition: background 0.15s;
}
.btn-cal-nav:hover {
  background: #f5f0e8;
}
.btn-cal-hoy {
  background: #fff;
  border: 1px solid #c4a96d;
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: #8a6c2a;
  transition: background 0.15s, color 0.15s;
  margin-left: 0.5rem;
}
.btn-cal-hoy:hover {
  background: #fdf3e0;
  color: #5a4010;
}
.tareas-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
  flex: 1;
  min-height: 0;
}
.tareas-cal-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.tareas-cal-header {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #5a4f3c;
  padding: 0;
  line-height: 1;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: default !important;
}
.tareas-cal-dia {
  background: #fff;
  border: 1px solid #e8e2d8;
  border-radius: 8px;
  padding: 0.35rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.tareas-cal-dia:not(.tareas-cal-header):not(.tareas-cal-dia-vacio):hover {
  background: #faf7f2;
  border-color: #c4a96d;
}
.tareas-cal-dia-vacio {
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.tareas-cal-dia-hoy {
  border-color: #c4a96d;
  background: #fdf9f2;
}
.tareas-cal-dia-hoy .tareas-cal-num {
  background: #c4a96d;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tareas-cal-num {
  font-size: 0.82rem;
  font-weight: 600;
  color: #5a4f3c;
  display: block;
  margin-bottom: 0.25rem;
}
.tareas-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tarea-chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: opacity 0.15s;
}
.tarea-chip:hover {
  opacity: 0.8;
}
.tarea-chip-pendiente {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.tarea-chip-vencida {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.tarea-chip-completada {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  text-decoration: line-through;
  opacity: 0.85;
}

/* Detalle tarea modal */
.tarea-detalle-bloque {
  padding: 0.75rem 0;
}
.tarea-detalle-titulo {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2a2a2a;
  margin-bottom: 0.4rem;
}
.tarea-detalle-desc {
  font-size: 0.92rem;
  color: #5a4f3c;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
}
.tarea-detalle-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #4a4034;
}
.tarea-estado-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-left: 0.35rem;
}

.tareas-cal-dia-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.tareas-cal-dia-festivo {
  background: #fdf4f4;
  border-color: #f5c0b8;
}
.tareas-cal-dia-festivo:hover {
  background: #faeae8 !important;
  border-color: #e8877a !important;
}

.tareas-festivo-etiqueta {
  font-size: 0.65rem;
  font-weight: 700;
  color: #c0392b;
  background: #fde8e8;
  border: 1px solid #f5c0b8;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
  line-height: 1.5;
}

/* Comentarios de tarea */
.tarea-comentarios-seccion {
  border-top: 1px solid #ede8df;
  margin-top: 1rem;
  padding-top: 0.75rem;
}
.tarea-comentarios-titulo {
  font-size: 0.88rem;
  font-weight: 700;
  color: #5a4f3c;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tarea-comentarios-vacio {
  font-size: 0.85rem;
  color: #9a8f80;
  margin-bottom: 0.75rem;
}
.tarea-comentarios-lista {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding-right: 2px;
}
.tarea-comentario {
  background: #faf7f2;
  border: 1px solid #ede8df;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}
.tarea-comentario-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}
.tarea-comentario-autor {
  font-size: 0.82rem;
  font-weight: 700;
  color: #3a3228;
}
.tarea-comentario-fecha {
  font-size: 0.75rem;
  color: #9a8f80;
  flex: 1;
}
.tarea-comentario-acciones {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.tarea-comentario:hover .tarea-comentario-acciones {
  opacity: 1;
}
.btn-coment-accion {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.1s;
}
.btn-coment-accion:hover { background: #ede8df; }
.tarea-comentario-texto {
  font-size: 0.88rem;
  color: #3a3228;
  white-space: pre-wrap;
  margin: 0;
}
.tarea-coment-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-size: 0.88rem;
}
.tarea-coment-edicion-botones {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.tarea-nuevo-comentario {
  margin-top: 0.5rem;
}
.tarea-nuevo-coment-pie {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
}
.tarea-coment-hint {
  font-size: 0.75rem;
  color: #9a8f80;
}
.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .tareas-cal-grid {
    gap: 2px;
  }
  .tareas-cal-dia {
    min-height: 64px;
    padding: 0.25rem;
  }
  .tarea-chip {
    font-size: 0.65rem;
    padding: 1px 4px;
  }
}

/* ── Gastos ─────────────────────────────────────────────────────────────── */
.tabla-gastos th:nth-child(1) { width: 100px; }
.tabla-gastos th:nth-child(2) { width: auto; }
.tabla-gastos th:nth-child(3) { width: 140px; }
.tabla-gastos th:nth-child(4) { width: 90px; }
.tabla-gastos th:nth-child(5) { width: 110px; }
.tabla-gastos th:nth-child(6) { width: 110px; }
.tabla-gastos th:nth-child(7) { width: 100px; }
.tabla-gastos th:nth-child(8) { width: 110px; text-align: right; }
.tabla-gastos th:nth-child(9) { width: 88px; }

.gastos-resumen {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.gastos-resumen-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--fondo-tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: 10px;
  padding: 10px 18px;
  min-width: 140px;
}
.gastos-resumen-chip--pendiente {
  border-color: var(--color-advertencia);
}
.gastos-resumen-label {
  font-size: 0.75rem;
  color: var(--texto-tenue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gastos-resumen-valor {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--texto-principal);
}

.chip-azul  { background: var(--chip-azul-fondo,  #e3f2fd); color: var(--chip-azul-texto,  #1565c0); }
.chip-ambar { background: var(--chip-ambar-fondo, #fff8e1); color: var(--chip-ambar-texto, #b45309); }
.chip-verde { background: var(--chip-verde-fondo, #e6f4ea); color: var(--chip-verde-texto, #2e7d32); }
.chip-rojo  { background: var(--chip-rojo-fondo,  #fdecea); color: var(--chip-rojo-texto,  #c62828); }

.gastos-cat-nueva {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.gastos-cat-nueva .campo-texto {
  flex: 1;
}
.gastos-cat-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.gastos-cat-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--fondo-pagina);
  font-size: 0.9rem;
  color: var(--texto-principal);
}
.gastos-cat-fila:hover {
  background: var(--hover-fila);
}

.modal-contenido-sm {
  width: 420px;
}

.text-right {
  text-align: right;
}

.gastos-grupo-mes {
  margin-bottom: 16px;
}
.gastos-mes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--fondo-pagina);
  border: 1px solid var(--borde-suave);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.gastos-mes-header:hover {
  background: #e8e6e0;
}
.gastos-mes-izq {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gastos-mes-toggle {
  font-size: 0.7rem;
  color: var(--texto-tenue);
  transition: transform 0.2s;
  display: inline-block;
}
.gastos-mes-toggle.colapsado {
  transform: rotate(-90deg);
}
.gastos-mes-nombre {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--texto-principal);
}
.gastos-mes-count {
  font-size: 0.78rem;
  color: var(--texto-tenue);
}
.gastos-mes-totales {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}
.gastos-mes-total {
  font-weight: 700;
  color: var(--texto-principal);
}
.gastos-mes-pendiente {
  color: var(--color-advertencia);
  font-weight: 600;
}

.accion-cuadro-pagar {
  background: var(--chip-verde-fondo, #e6f4ea);
  color: var(--chip-verde-texto, #2e7d32);
  border: 1px solid #b7dfbd;
  font-size: 1rem;
  font-weight: 700;
}
.accion-cuadro-pagar:hover {
  background: #c8eacf;
}
.accion-cuadro-pagar-activo {
  background: #2e7d32;
  color: #fff;
  border: 1px solid #256427;
  font-size: 1rem;
  font-weight: 700;
}
.accion-cuadro-pagar-activo:hover {
  background: #1b5e20;
}

/* ── Gastos: nav de mes ──────────────────────────────────────────────────── */
.gastos-nav-mes {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gastos-nav-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--texto-principal);
  min-width: 160px;
  text-align: center;
}

/* ── Gastos: dashboard KPI ───────────────────────────────────────────────── */
.gastos-dashboard {
  margin-bottom: 16px;
}
.gastos-kpi {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.gastos-kpi-card {
  flex: 1;
  min-width: 140px;
  background: var(--fondo-tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--sombra-sm);
}
.gastos-kpi-card--pagado {
  border-left: 3px solid var(--color-ok);
}
.gastos-kpi-card--pendiente {
  border-left: 3px solid var(--color-advertencia);
}
.gastos-kpi-label {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--texto-tenue);
}
.gastos-kpi-valor {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--texto-principal);
  line-height: 1.2;
}
.gastos-kpi-sub {
  font-size: 0.75rem;
  color: var(--texto-secundario);
}

/* ── Gastos: barra de progreso ───────────────────────────────────────────── */
.gastos-progreso-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gastos-progreso-barra {
  flex: 1;
  height: 8px;
  background: var(--borde-suave);
  border-radius: 999px;
  overflow: hidden;
}
.gastos-progreso-fill {
  height: 100%;
  background: var(--color-ok);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.gastos-progreso-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--texto-secundario);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* ── Gastos: filtros de estado ───────────────────────────────────────────── */
.gastos-filtros-barra {
  margin-bottom: 14px;
}
.gastos-estado-tabs {
  display: flex;
  gap: 4px;
  background: var(--fondo-tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
}
.gastos-tab {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--texto-secundario);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.gastos-tab:hover {
  background: var(--hover-fila);
  color: var(--texto-principal);
}
.gastos-tab.activo {
  background: var(--color-primario);
  color: #fff;
  font-weight: 700;
}

/* ── Gastos: tabla actualizada ───────────────────────────────────────────── */
.tabla-gastos {
  table-layout: fixed;
  width: 100%;
}
.tabla-gastos th,
.tabla-gastos td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Fecha */       .tabla-gastos th:nth-child(1),  .tabla-gastos td:nth-child(1)  { width: 108px; }
/* Concepto */    .tabla-gastos th:nth-child(2),  .tabla-gastos td:nth-child(2)  { width: 180px; white-space: normal; }
/* Categoría */   .tabla-gastos th:nth-child(3),  .tabla-gastos td:nth-child(3)  { width: 128px; }
/* Tipo */        .tabla-gastos th:nth-child(4),  .tabla-gastos td:nth-child(4)  { width: 76px; }
/* Responsable */ .tabla-gastos th:nth-child(5),  .tabla-gastos td:nth-child(5)  { width: 104px; }
/* Método */      .tabla-gastos th:nth-child(6),  .tabla-gastos td:nth-child(6)  { width: 124px; }
/* Estimado */    .tabla-gastos th:nth-child(7),  .tabla-gastos td:nth-child(7)  { width: 100px; text-align: right; }
/* Real */        .tabla-gastos th:nth-child(8),  .tabla-gastos td:nth-child(8)  { width: 90px;  text-align: right; }
/* Estado */      .tabla-gastos th:nth-child(9),  .tabla-gastos td:nth-child(9)  { width: 90px; }
/* Acciones */    .tabla-gastos th:nth-child(10), .tabla-gastos td:nth-child(10) { width: 108px; }

/* ── Eliminar opciones ───────────────────────────────────────────────────── */
.eliminar-opciones {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.eliminar-opcion {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: start;
  padding: 14px 16px;
  border: 1.5px solid var(--borde-suave);
  border-radius: 10px;
  background: var(--fondo-tarjeta);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.eliminar-opcion:hover:not(:disabled) {
  border-color: var(--color-error);
  background: var(--color-error-fondo);
}
.eliminar-opcion--todos {
  border-color: #f5c2c2;
}
.eliminar-opcion--todos:hover:not(:disabled) {
  border-color: var(--color-error);
  background: var(--color-error-fondo);
}
.eliminar-opcion:disabled { opacity: 0.55; cursor: not-allowed; }
.eliminar-opcion-icono {
  grid-row: 1 / 3;
  font-size: 1.4rem;
  line-height: 1;
  padding-top: 2px;
}
.eliminar-opcion-titulo {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--texto-principal);
}
.eliminar-opcion-desc {
  font-size: 0.78rem;
  color: var(--texto-secundario);
  margin-top: 2px;
}

.fila-pagada td { opacity: 0.72; }
.td-periodicity {
  display: block;
  font-size: 0.7rem;
  color: var(--texto-tenue);
  text-transform: capitalize;
}
.td-metodo { font-size: 0.82rem; }
.td-real-ok { color: var(--color-ok); font-weight: 700; }

/* ── Cuentas por cobrar ───────────────────────────────────────────────────── */
.tabla-cc {
  table-layout: fixed;
  width: 100%;
  min-width: 960px;
}
/* Deudor */  .tabla-cc th:nth-child(1), .tabla-cc td:nth-child(1) { width: 160px; }
/* Concepto */.tabla-cc th:nth-child(2), .tabla-cc td:nth-child(2) { width: 180px; white-space: normal; }
/* Vence */   .tabla-cc th:nth-child(3), .tabla-cc td:nth-child(3) { width: 108px; }
/* Total */   .tabla-cc th:nth-child(4), .tabla-cc td:nth-child(4) { width: 110px; text-align: right; }
/* Abonado */ .tabla-cc th:nth-child(5), .tabla-cc td:nth-child(5) { width: 110px; text-align: right; }
/* Saldo */   .tabla-cc th:nth-child(6), .tabla-cc td:nth-child(6) { width: 110px; text-align: right; }
/* Estado */  .tabla-cc th:nth-child(7), .tabla-cc td:nth-child(7) { width: 116px; }
/* Acciones */.tabla-cc th:nth-child(8), .tabla-cc td:nth-child(8) { width: 116px; }

.fila-vencida td { background: var(--color-error-fondo, rgba(220,53,69,0.05)); }
.cc-deudor { font-weight: 600; display: block; }
.cc-saldo-vencido { color: var(--color-error); font-weight: 700; }
.td-fecha { font-size: 0.85rem; color: var(--texto-secundario); }
.td-num { font-size: 0.9rem; }
.text-right { text-align: right !important; }

/* Saldo resumen en modal de abonos */
.cc-saldo-resumen {
  display: flex;
  gap: 24px;
  padding: 14px 18px;
  background: var(--fondo-tarjeta);
  border: 1px solid var(--borde-suave);
  border-radius: 10px;
  margin-bottom: 16px;
}
.cc-saldo-item { display: flex; flex-direction: column; gap: 2px; }
.cc-saldo-label { font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texto-tenue); }
.cc-saldo-valor { font-size: 1.05rem; font-weight: 700; color: var(--texto-principal); }

/* Lista de abonos */
.cc-abonos-lista {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  max-height: 220px;
  overflow-y: auto;
}
.cc-abono-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--fondo-pagina);
  border: 1px solid var(--borde-suave);
  border-radius: 8px;
}
.cc-abono-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cc-abono-monto { font-weight: 700; font-size: 0.95rem; }
.cc-abono-fecha { font-size: 0.82rem; color: var(--texto-secundario); }
.cc-abono-metodo { font-size: 0.72rem; text-transform: capitalize; }
.cc-abono-notas { font-size: 0.78rem; color: var(--texto-tenue); font-style: italic; }

/* Sección nuevo abono */
.cc-nuevo-abono { border-top: 1px solid var(--borde-suave); padding-top: 16px; margin-top: 4px; }
.cc-nuevo-abono-titulo { font-size: 0.88rem; font-weight: 700; color: var(--texto-secundario); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }

/* Botón abono en tabla */
.accion-cuadro-pagar {
  background: var(--fondo-pagina);
  border: 1.5px solid var(--color-ok);
  color: var(--color-ok);
  font-weight: 800;
  font-size: 1rem;
}
.accion-cuadro-pagar:hover { background: var(--color-ok); color: #fff; }

/* ── Accesibilidad: skip link y sr-only (#45) ────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: var(--z-modal-top);
  padding: 8px 16px;
  background: var(--color-primario);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Skeleton screens (#10) ──────────────────────────────────────────────── */
@keyframes sk-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.sk {
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--fondo-tarjeta) 25%,
    #e4ddd5 50%,
    var(--fondo-tarjeta) 75%
  );
  background-size: 1200px 100%;
  animation: sk-shimmer 1.5s infinite linear;
}
/* Bloques KPI */
.sk-kpi   { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.sk-n     { height: 34px; width: 110px; border-radius: 6px; }
.sk-s     { height: 13px; width: 75px; }
/* Gráficos */
.sk-chart { height: 160px; border-radius: 6px; margin-top: 4px; }
/* Filas de tabla */
.sk-tabla { display: flex; flex-direction: column; gap: 11px; padding: 14px 0; }
.sk-fila  { display: flex; gap: 14px; align-items: center; }
.sk-c1    { height: 13px; flex: 1; min-width: 0; }
.sk-c2    { height: 13px; flex: 2; min-width: 0; }
.sk-c3    { height: 13px; flex: 1.5; min-width: 0; }
.sk-c4    { height: 13px; flex: 0.7; min-width: 0; }
/* Kanban */
.sk-kanban     { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; padding: 8px 0; }
.sk-kanban-col { display: flex; flex-direction: column; gap: 10px; }
.sk-card       { height: 78px; border-radius: 8px; }
/* Servicio reciente row */
.sk-reciente      { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.sk-reciente-fila { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid #eee9de; padding-bottom: 10px; }

/* ── Toast de feedback global (#34/#82) ──────────────────────────────────── */
.toast-global {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-modal-top);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.toast-exito  { background: #2e7d32; }
.toast-error  { background: #c62828; }
.toast-aviso  { background: #e65100; }
.toast-fade-enter-active { transition: opacity 0.2s, transform 0.2s; }
.toast-fade-leave-active { transition: opacity 0.3s, transform 0.3s; }
.toast-fade-enter-from  { opacity: 0; transform: translateY(12px); }
.toast-fade-leave-to    { opacity: 0; transform: translateY(12px); }

/* ── Empty-state con CTA (#79) ───────────────────────────────────────────── */
.placeholder-modulo-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ── Inventario: nuevos estilos ──────────────────────────────────────────── */
.celda-mono { font-family: monospace; font-size: 0.88rem; }

.badge-estado-prod {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-activo   { background: #e6f4ea; color: #2e7d32; }
.badge-inactivo { background: #fce8e6; color: #c62828; }
.fila-inactiva  { opacity: 0.55; }

/* Modal ancho para el formulario de producto */
.modal-card-ancho {
  max-width: 680px;
  width: 95vw;
}

/* Sección dentro del modal */
.modal-seccion-titulo {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-tenue);
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5dfd4;
}

/* Fila de campos horizontales */
.campo-fila {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.campo-flex1 { flex: 1; min-width: 0; }
.campo-flex2 { flex: 2; min-width: 0; }
.campo-flex3 { flex: 3; min-width: 0; }

/* Campo con sufijo (margen %) */
.campo-con-sufijo {
  position: relative;
  display: flex;
  align-items: center;
}
.campo-con-sufijo .campo-texto { flex: 1; padding-right: 48px; }
.campo-sufijo {
  position: absolute;
  right: 10px;
  font-size: 0.82rem;
  color: var(--texto-tenue);
  pointer-events: none;
  white-space: nowrap;
}

/* Precio calculado (readonly display) */
.campo-precio-calculado {
  font-weight: 700;
  color: var(--color-primario);
  font-size: 1rem;
}

/* Asterisco de campo requerido */
.campo-req { color: var(--color-error, #c62828); font-size: 0.85em; }

/* Hint inline junto al título de sección */
.campo-hint-inline { font-size: 0.78rem; font-weight: 400; color: var(--color-texto-suave); }

/* ── Lista de proveedores en modal de producto ───────────────────────────── */
.proveedores-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.proveedor-fila { display: flex; align-items: center; gap: 8px; }
.proveedor-fila-inputs { display: flex; flex: 1; align-items: center; gap: 8px; flex-wrap: wrap; }
.proveedor-fila-inputs .campo-texto { min-width: 0; }
.proveedor-fila-inputs .campo-texto:first-child { flex: 2; }
.proveedor-precio { flex: 1 !important; max-width: 140px; }
.proveedor-venta-calc { font-size: 0.82rem; color: var(--color-primario); white-space: nowrap; font-weight: 600; }
.badge-mejor-prov {
  background: #e8f5e9; color: #2e7d32;
  font-size: 0.72rem; font-weight: 700;
  border-radius: 10px; padding: 2px 8px;
  white-space: nowrap; border: 1px solid #a5d6a7;
}
.badge-mejor-prov-small { font-size: 0.68rem; padding: 1px 6px; }
.btn-quitar-prov {
  background: none; border: none; cursor: pointer;
  color: var(--color-texto-suave); font-size: 1rem;
  padding: 4px 6px; border-radius: 4px; line-height: 1;
  flex-shrink: 0;
}
.btn-quitar-prov:hover:not(:disabled) { color: var(--color-error); background: #fdecea; }
.btn-quitar-prov:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-agregar-prov {
  background: none; border: 1px dashed var(--color-borde);
  color: var(--color-texto-suave); font-size: 0.85rem;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  width: 100%; text-align: center; margin-top: 2px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-agregar-prov:hover:not(:disabled) { border-color: var(--color-primario); color: var(--color-primario); }
.btn-agregar-prov:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Picker de proveedor en orden de servicio ────────────────────────────── */
.picker-proveedor-panel {
  background: var(--color-fondo-card);
  border: 1px solid var(--color-borde);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.picker-proveedor-titulo { font-size: 0.9rem; margin-bottom: 10px; color: var(--color-texto); }
.picker-proveedor-lista { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.picker-prov-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 6px;
  border: 2px solid var(--color-borde);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.picker-prov-item:hover { border-color: var(--color-primario); }
.picker-prov-seleccionado { border-color: var(--color-primario) !important; background: color-mix(in srgb, var(--color-primario) 8%, transparent); }
.picker-prov-nombre { font-weight: 600; font-size: 0.9rem; }
.picker-prov-precios { font-size: 0.82rem; color: var(--color-texto-suave); flex: 1; }
.picker-prov-acciones { display: flex; gap: 8px; }

/* ── Accesibilidad: reduced motion (#9) ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
