* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #111;
  height: 100vh;
  /* 100vh en mobile Chrome/Safari no descuenta la barra inferior del navegador cuando esta
     visible, asi que el contenido queda mas alto de lo que en verdad se puede ver y el scroll
     interno se corta. 100dvh (altura dinamica) si la descuenta -- queda como fallback para
     navegadores viejos que no soportan dvh. */
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.oculto { display: none !important; }

/* El banner de ambiente de prueba ocupa su alto real y nunca se achica */
.banner-ambiente-prueba { flex-shrink: 0; }

#app {
  flex: 1;
  min-height: 0;
}

/* LOGIN */
.pantalla { width: 100%; height: 100%; }

/* #pantalla-login y #pantalla-registro no llevan background/flex acá: su diseño lo define
   Tailwind directamente en el HTML (ver public/index.html) -- si se agregara acá, el selector
   por id le ganaria en especificidad a la clase de Tailwind y lo taparia. */

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icono {
  font-size: 48px;
  margin-bottom: 12px;
}

.logo h1 {
  font-size: 20px;
  font-weight: 600;
  color: #111;
  margin-bottom: 4px;
}

.logo p {
  font-size: 14px;
  color: #667781;
}

.campo {
  margin-bottom: 16px;
}

.campo label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #111;
  margin-bottom: 6px;
}

.campo input,
.campo select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e9edef;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.campo input:focus,
.campo select:focus {
  border-color: #3A5A40;
}

.campo input.campo-error,
.campo select.campo-error,
.campo button.campo-error {
  border-color: #e53e3e;
}

.campo input.campo-error:focus,
.campo select.campo-error:focus {
  border-color: #e53e3e;
}

/* Estandar de todo el sistema: cualquier checkbox tildado (formularios, grillas de seleccion,
   "Marcar todos", etc.) usa el mismo verde de marca en vez del azul por defecto del navegador. */
input[type="checkbox"] {
  accent-color: #3A5A40;
}

/* Los checkboxes dentro de .campo no deben heredar el estilo de los inputs de texto (ancho 100%,
   padding, borde) — si no, quedan estirados e invisibles, empujando su texto lejos del cuadrito. */
.campo input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  flex-shrink: 0;
}

/* Wrapper que agrega el boton de "mostrar/ocultar" a un input de clave (ver utils.envolverCamposClave).
   El input conserva su mismo estilo de .campo input; solo se le suma lugar a la derecha para el boton. */
.campo-clave {
  position: relative;
}

.campo-clave input {
  padding-right: 42px;
}

.btn-mostrar-clave {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: #667781;
  cursor: pointer;
}

.btn-mostrar-clave:hover {
  background: #f0f2f5;
  color: #111;
}

/* Secciones dentro de un modal (ej: Enviar mensajes), cada una en su propia tarjeta */
.modal-seccion {
  border: 1.5px solid #e9edef;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.modal-seccion:last-child {
  margin-bottom: 0;
}

.modal-seccion-titulo {
  font-size: 12px;
  font-weight: 700;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 14px;
}

.modal-seccion textarea:focus,
.modal-seccion select:focus,
.modal-seccion input:focus {
  border-color: #3A5A40;
  outline: none;
}

/* Circulo chico con icono, usado al lado de controles dentro de una seccion de modal */
.modal-icono-mini {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eaf0ea;
  color: #3A5A40;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Miniaturas de imagenes seleccionadas (Envio Directo) */
.miniatura-imagen {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.miniatura-imagen.vacia {
  border: 1.5px dashed #d1d7db;
  background: #fafbfc;
  color: #c3cad1;
}

.miniatura-imagen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  cursor: pointer;
}

/* Boton circular rojo de "quitar" estandarizado, usado en miniaturas de imagen y en los chips (audio, archivo) */
.miniatura-eliminar,
.chip-audio-quitar,
.chip-archivo-quitar {
  border-radius: 50%;
  background: #e53e3e;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.miniatura-eliminar:hover,
.chip-audio-quitar:hover,
.chip-archivo-quitar:hover {
  background: #c53030;
}

.miniatura-eliminar {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Boton con icono + texto alineados (usado en pestañas de tipo de envio y en el footer del modal) */
.btn-con-icono {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Chip que muestra el audio elegido para el envio (estilo similar a las tarjetas de Archivos Adjuntos) */
.chip-audio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1.5px solid #e9edef;
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  max-width: 220px;
}

.chip-audio-icono {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.chip-audio-nombre {
  font-size: 13px;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-audio-quitar {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.chip-audio-quitar:hover {
  background: #e53e3e;
  color: white;
}

/* Chip generico para mostrar "un archivo elegido" (ej: Excel de referencia en Nueva Plantilla) */
.chip-archivo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1.5px solid #e9edef;
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  max-width: 280px;
}

.chip-archivo-icono {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eaf0ea;
  color: #3A5A40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-archivo-nombre {
  font-size: 13px;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-archivo-quitar {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* Boton chico para expandir/contraer un textarea (ej: Mensaje en Envio Directo) */
.btn-expandir {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid #e9edef;
  border-radius: 6px;
  background: white;
  color: #667781;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.btn-expandir:hover {
  background: #f0f2f5;
  color: #111;
}

/* Altura uniforme para los 3 botones del sistema (antes cada uno tenia su propio padding vertical
   y hasta font-size distinto, y terminaban con alturas ligeramente distintas entre si). Se fija la
   altura con "height" en vez de dejarla depender del padding + line-height de cada uno, y se centra
   el contenido con flex -- asi da lo mismo el tamano de fuente o si el boton tiene un icono al lado
   (.btn-con-icono), la altura queda igual siempre. Referencia: la altura que ya tenia .btn-secondary. */
.btn-primary,
.btn-secondary,
.btn-danger {
  height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  width: 100%;
  background: #3A5A40;
  color: white;
  border: none;
  font-weight: 600;
  margin-top: 8px;
}

.btn-primary:hover { background: #2E4833; }

.btn-primary.pendiente { background: #d97706; }
.btn-primary.pendiente:hover { background: #b45309; }

.btn-secondary.pendiente { border-color: #d97706; color: #d97706; }
.btn-secondary.pendiente:hover { background: #fffbeb; }

.btn-secondary:disabled {
  background: #f0f2f5;
  color: #9aa5ac;
  border-color: #d1d7db;
  cursor: not-allowed;
}
.btn-secondary:disabled:hover { background: #f0f2f5; }

.btn-secondary {
  background: white;
  color: #3A5A40;
  border: 1.5px solid #3A5A40;
}

.btn-secondary:hover { background: #f0fdf4; }

.btn-danger {
  background: white;
  color: #e53e3e;
  border: 1.5px solid #e53e3e;
}

.btn-danger:disabled {
  background: #f0f2f5;
  color: #9aa5ac;
  border-color: #d1d7db;
  cursor: not-allowed;
}
.btn-danger:disabled:hover { background: #f0f2f5; }

.link-registro {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #667781;
}

.link-registro a {
  color: #3A5A40;
  text-decoration: none;
  font-weight: 500;
}

/* APP PRINCIPAL */
#pantalla-app {
  display: flex;
  height: 100%;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: #111b21;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid #2a3942;
}

.usuario-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #3A5A40;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

#nombre-usuario {
  color: #e9edef;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #8696a0;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.nav-item:hover, .nav-item.activo {
  background: #2a3942;
  color: #e9edef;
}

/* Nivel 1 del menu: Modulo (ej. "Mensajes", "Cobranzas"). Encabezado en mayusculas para que se
   distinga de un vistazo del nivel 2 (grupo de menu) que tiene adentro. */
.nav-modulo-titulo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #667781;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.15s;
}

.nav-modulo-titulo:hover {
  background: #2a3942;
  color: #e9edef;
}

.nav-modulo-flecha {
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.15s;
}

.nav-modulo.expandido .nav-modulo-flecha {
  transform: rotate(90deg);
}

.nav-modulo-items.oculto {
  display: none;
}

/* Separador arriba de CADA menu principal (Mensajeria / Cobranzas / Configuracion General / lo que
   se agregue despues) -- incluida la primera (contra "Página Principal"). No esta atada a un modulo
   puntual, asi que cualquier menu principal nuevo lo hereda solo, sin tocar el HTML. */
.nav-modulo {
  border-top: 1px solid #2a3942;
  margin-top: 8px;
  padding-top: 8px;
}

/* Todo lo que vive adentro de un modulo se corre un poco a la derecha, para que la jerarquia de
   3 niveles (modulo > grupo > submenu) se note de un vistazo sin tener que duplicar reglas base. */
.nav-modulo-items > .nav-grupo-titulo,
.nav-modulo-items > .nav-item,
.nav-modulo-items > .nav-grupo > .nav-grupo-titulo {
  padding-left: 26px;
}

.nav-modulo-items .nav-subitem {
  padding-left: 50px;
}

.nav-grupo-titulo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #8696a0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.nav-grupo-titulo:hover {
  background: #2a3942;
  color: #e9edef;
}

.nav-grupo-flecha {
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.15s;
}

.nav-grupo.expandido .nav-grupo-flecha {
  transform: rotate(90deg);
}

.nav-grupo-items.oculto {
  display: none;
}

.nav-subitem {
  padding-left: 40px;
  font-size: 13px;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 8px 0;
  border-top: 1px solid #2a3942;
}

/* CONTENIDO */
.contenido {
  flex: 1;
  overflow-y: auto;
  background: #f0f2f5;
}

/* ── VERSION MOBILE ──
   Ocultas en escritorio por defecto; el @media de abajo las activa. El patron: el sidebar pasa a ser
   un cajon (drawer) que se desliza por encima del contenido en vez de empujarlo, con una barra
   superior fija para abrirlo y un fondo oscuro para cerrarlo tocando afuera. */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  #pantalla-app {
    flex-direction: column;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    height: 52px;
    background: #111b21;
    color: #e9edef;
    padding: 0 16px;
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    color: #e9edef;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 6px;
    margin: -6px;
  }

  .mobile-topbar-titulo {
    font-size: 15px;
    font-weight: 600;
  }

  /* El sidebar deja de empujar el contenido y pasa a ser un cajon superpuesto, oculto fuera
     de pantalla a la izquierda hasta que se le agrega la clase "abierto" */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,0.25);
  }

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

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .seccion {
    padding: 16px;
  }

  .seccion-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .seccion-header h2 {
    font-size: 18px;
  }

  /* iOS/Android hacen zoom automatico al tocar un campo de texto con letra menor a 16px, y ese zoom
     no se deshace solo al cerrar el teclado. Forzamos 16px en todos los campos (el !important es
     necesario porque muchos inputs de filtros traen su propio font-size chico inline). */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Objetivos de touch mas grandes que con mouse */
  .nav-item, .nav-grupo-titulo, .nav-modulo-titulo {
    padding: 14px 16px;
    font-size: 15px;
  }

  .btn-primary, .btn-secondary, .btn-danger {
    min-height: 44px;
  }

  /* Grupos de botones de encabezado (Personalizar columnas / Importar / Nuevo, etc.) se envuelven
     en vez de desbordar horizontalmente cuando no entran los 3 en una fila */
  .seccion-header > div {
    flex-wrap: wrap;
  }

  /* TABLA -> TARJETAS. Misma tabla que en escritorio (misma logica de JS), pero "desarmada"
     visualmente: cada <tr> pasa a ser una tarjeta propia, y cada <td> muestra su etiqueta arriba
     del valor usando el atributo data-label (position label:valor en vez de columnas alineadas). */
  .tabla-contenedor {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  .tabla-mobile-cards thead {
    display: none;
  }

  .tabla-mobile-cards, .tabla-mobile-cards tbody, .tabla-mobile-cards tr, .tabla-mobile-cards td {
    display: block;
    width: 100%;
  }

  .tabla-mobile-cards tr {
    background: white !important;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 12px;
    padding: 4px 16px;
  }

  .tabla-mobile-cards td {
    border-top: none !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .tabla-mobile-cards tr td:last-child {
    border-bottom: none;
  }

  .tabla-mobile-cards td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: #667781;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
  }

  /* Celda marcada explicitamente como titulo de la tarjeta (ej: Nombre), sin etiqueta.
     No se usa :first-child porque en grillas con checkbox de seleccion (Cuotas) la primera
     celda es el checkbox, no el dato principal -- y si se reordenan columnas tampoco es fiable. */
  .tabla-mobile-cards td.celda-titulo {
    font-size: 15px;
    font-weight: 600;
    color: #111;
  }

  .tabla-mobile-cards td.celda-titulo::before {
    content: none;
  }

  /* Celda de checkbox de seleccion (Cuotas): sin etiqueta, pegada a la celda de titulo que sigue */
  .tabla-mobile-cards td.celda-checkbox {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  .tabla-mobile-cards td.celda-checkbox::before {
    content: none;
  }

  /* Los botones de Acciones van alineados a la derecha, sin la etiqueta de columna */
  .tabla-mobile-cards td.celda-acciones {
    justify-content: flex-end;
  }
}

.seccion {
  padding: 24px;
}

.seccion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.seccion-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #111;
}

.seccion-header .btn-primary {
  width: auto;
  margin-top: 0;
}

/* CARDS */
.lista-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow 0.2s;
  min-width: 0;
}

.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.card-titulo {
  font-size: 15px;
  font-weight: 600;
  color: #111;
  margin-bottom: 6px;
}

.card-subtitulo {
  font-size: 13px;
  color: #667781;
  margin-bottom: 12px;
  line-height: 1.4;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid #f0f2f5;
}

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-verde { background: #dcfce7; color: #166534; }
.badge-azul { background: #dbeafe; color: #1e40af; }
.badge-gris { background: #f1f5f9; color: #475569; }
.badge-rojo { background: #fee2e2; color: #991b1b; }
.badge-violeta { background: #ede9fe; color: #5b21b6; }

/* Icono girando para estados "buscando..." / "cargando..." (ej: filtro de contactos por modulo) */
@keyframes girar-spinner {
  to { transform: rotate(360deg); }
}
.spinner-girando {
  animation: girar-spinner 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .spinner-girando { animation: none; }
}

.menu-contextual {
  background: white;
  border: 1px solid #e9edef;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 180px;
}

.menu-contextual-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  color: #111;
  cursor: pointer;
}

.menu-contextual-item:hover { background: #f0f2f5; }

.menu-contextual-separador {
  height: 1px;
  background: #e9edef;
  margin: 4px 6px;
}

.btn-icono {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-sizing: border-box;
  border: 1.5px solid #94a3b8;
  background: white;
  color: #3b4a54;
  transition: background 0.15s;
}
.btn-icono:hover { background: #f0f2f5; }
.btn-icono.primario { border-color: #3A5A40; color: #3A5A40; }
.btn-icono.primario:hover { background: #dcfce7; }
.btn-icono.peligro { border-color: #e53e3e; color: #e53e3e; }
.btn-icono.peligro:hover { background: #fee2e2; }

/* TABLA CONTACTOS */
.busqueda {
  margin-bottom: 16px;
}

.busqueda input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e9edef;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: white;
}

.lista-tabla table {
  width: 100%;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-collapse: collapse;
}

.lista-tabla th {
  background: #3A5A40;
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lista-tabla td {
  padding: 12px 16px;
  font-size: 14px;
  color: #111;
  border-top: 1px solid #f0f2f5;
}

.lista-tabla tr:hover td { background: #f8fafc; }

/* Estandar de fila con hover en las grillas nuevas (Tailwind): Administrar Contactos, Administrar
   Cuotas y Generar Cuotas comparten el wrapper .tabla-contenedor, asi que definiendolo aca una sola
   vez alcanza para las tres sin repetirlo por pantalla. Fondo mas oscuro que las franjas alternadas
   + un borde marcado alrededor de toda la fila, para que se note mas que un simple cambio de color. */
.tabla-contenedor tbody tr:hover > td {
  background-color: #e2e8f0;
}

.tabla-contenedor tbody tr:hover {
  outline: 1.5px solid #1e293b;
  outline-offset: -1px;
}

/* GRILLA IMAGENES */
.grilla-imagenes {
  display: block;
  width: 100%;
}

.imagen-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.imagen-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.imagen-card-footer {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.imagen-nombre {
  font-size: 12px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ESTADO VACIO */
.estado-vacio {
  text-align: center;
  padding: 48px 24px;
  color: #667781;
}

.estado-vacio-icono { font-size: 48px; margin-bottom: 12px; }
.estado-vacio h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.estado-vacio p { font-size: 14px; }

/* GRAFICOS DE BARRAS (Informe de cobranzas): la marca se ilumina levemente al pasar el mouse, para
   que quede claro que responde -- ademas del tooltip que aparece al lado del cursor (ver informes.js). */
.chart-bar {
  cursor: pointer;
  transition: opacity 0.1s;
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-tooltip {
  position: fixed;
  z-index: 10001;
  background: #111b21;
  color: #e9edef;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chart-tooltip.oculto {
  display: none;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: min(760px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  position: relative;
}

/* Separador en degrade (mismo criterio que .separador-fecha: claro-oscuro-claro, sin la pildora
   del medio porque un modal no tiene una fecha/etiqueta para mostrar ahi), en vez de la linea gris
   comun -- estandar para TODOS los modales, arriba del cuerpo y abajo antes de los botones. */
.modal-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, #AEC7B2, #3A5A40, #AEC7B2);
}

.modal-header h3 {
  margin-bottom: 0;
}

.modal-header-icono {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #3A5A40;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-header-texto {
  flex: 1;
  min-width: 0;
}

.modal-subtitulo {
  font-size: 13px;
  color: #667781;
  margin-top: 2px;
}

.modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #667781;
  cursor: pointer;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #111b21;
  color: white;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(420px, 90vw);
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-exito { border-left: 4px solid #3A5A40; }
.toast-error { border-left: 4px solid #e53e3e; }

.modal-close:hover {
  background: #f0f2f5;
  color: #111;
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  position: relative;
}

.modal-footer::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, #AEC7B2, #3A5A40, #AEC7B2);
}

.mensaje-error {
  background: #fef2f2;
  color: #e53e3e;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.mensaje-exito {
  background: #f0fdf4;
  color: #166534;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.whatsapp-estado {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #2a3942;
}

.wa-indicador {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e53e3e;
  flex-shrink: 0;
}

.wa-indicador.conectado { background: #3A5A40; }
.wa-indicador.conectando { background: #f6ad55; }

#wa-texto {
  color: #8696a0;
  font-size: 13px;
  flex: 1;
}

#btn-wa {
  background: transparent;
  border: 1px solid #3A5A40;
  color: #3A5A40;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

/* FILTROS ADJUNTOS */
.filtros-adjuntos {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filtros-botones {
  display: flex;
  gap: 6px;
}

.btn-filtro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid #e9edef;
  background: white;
  font-size: 13px;
  cursor: pointer;
  color: #667781;
  transition: all 0.15s;
}

.btn-filtro.activo {
  background: #3A5A40;
  border-color: #3A5A40;
  color: white;
  font-weight: 500;
}

.btn-filtro:hover:not(.activo) {
  background: #f0f2f5;
}

.busqueda-adjuntos {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.busqueda-adjuntos input {
  width: 100%;
  height: 36px;
  padding: 0 14px 0 36px;
  border: 1.5px solid #e9edef;
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  background: white;
  box-sizing: border-box;
}

.busqueda-adjuntos input:focus {
  border-color: #3A5A40;
}

.busqueda-adjuntos .icono-lupa {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #667781;
  font-size: 14px;
}

/* SEPARADOR FECHA ESTILO WHATSAPP */
.separador-fecha {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.separador-fecha-linea {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  /* Degrade entre dos tonos de verde de marca, sin "transparent" -- con transparent la parte mas
     lejana del texto se perdia contra el fondo gris de la pagina y parecia que faltaba un pedazo. */
  background: linear-gradient(to right, #AEC7B2, #3A5A40);
}

.separador-fecha-linea.derecha {
  background: linear-gradient(to left, #AEC7B2, #3A5A40);
}

.separador-fecha-texto {
  background: linear-gradient(135deg, #3A5A40, #2E4833);
  color: white;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 16px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(58,90,64,0.3);
}

/* Filas del modal generico app.seleccionarArchivo() (elegir un Excel/imagen/audio ya subido) */
.selector-archivo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.selector-archivo-item:hover {
  background: #f0f2f5;
}

.selector-archivo-nombre {
  font-size: 13px;
  font-weight: 500;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-archivo-fecha {
  font-size: 11px;
  color: #667781;
  margin-top: 2px;
}

/* Filas arrastrables del modal "Personalizar columnas" (Administrar Contactos) */
.columna-drag-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1.5px solid #e9edef;
  border-radius: 8px;
  margin-bottom: 6px;
  background: white;
  transition: opacity 0.15s, border-color 0.15s;
}

.columna-drag-item.arrastrando {
  opacity: 0.4;
}

.columna-drag-item.sobre {
  border-color: #3A5A40;
}

.columna-drag-agarre {
  cursor: grab;
  color: #9aa5ac;
  flex-shrink: 0;
}

/* PESTAÑAS CONFIGURACION */
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #667781;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: #111;
}

.tab-btn.activo {
  color: white;
  background: #3A5A40;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
}