/* Centro de seguimiento (centro_seguimiento.html). Prefijo seg-
   Paleta de la aplicación: azul marino #17324d, azul #256ee8, fondos suaves y colores por estado. */

.seg-body {
  background: #f4f7fb;
}

/* Ocupa todo el ancho que deja el menú lateral, como las demás pantallas (no limitar el ancho: #main-content fija el margen
   izquierdo y un bloque más angosto quedaría pegado a un lado). */
.seg-page {
  box-sizing: border-box;
  min-width: 0;
  padding-bottom: 40px;
  color: #18314f;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.seg-page [hidden],
.seg-modal[hidden],
.seg-toast[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- cabecera y botones */
.seg-cabecera {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 58px 10px 2px; /* deja libre la campana */
  border-bottom: 1px solid #dbe5f1;
}

.seg-cabecera h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0; /* la hoja general pone línea y relleno a los h1 */
  font-size: 1.55rem;
  color: #17324d;
}

.seg-cabecera h1 i {
  color: #256ee8;
}

.seg-cabecera p {
  margin: 4px 0 0;
  color: #5b6b80;
  font-size: 13.5px;
}

.seg-cabecera-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  margin: 0;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  font: 700 12.5px 'Segoe UI', system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.seg-btn.primario {
  background: #256ee8;
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 110, 232, 0.22);
}

.seg-btn.secundario {
  background: #fff;
  border-color: #d6e0ec;
  color: #163554;
}

.seg-btn.suave {
  background: #e8f1fd;
  border-color: #cfe0fa;
  color: #1a5fc0;
}

.seg-btn:hover:not(:disabled) {
  filter: brightness(0.97);
}

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

.seg-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.seg-enlace {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #1a63c9;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
}

.seg-btn:focus-visible,
.seg-enlace:focus-visible,
.seg-tarjeta:focus-visible,
.seg-seccion-cabecera:focus-visible,
.seg-buscar-limpiar:focus-visible,
.seg-pestanas button:focus-visible {
  outline: 3px solid #2f80ed;
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- tonos y piezas comunes */
.seg-burbuja {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e8f1fd;
  color: #1a63c9;
  font-size: 14px;
}

.seg-burbuja.grave { background: #fdecea; color: #b3261e; }
.seg-burbuja.aviso { background: #fff3e0; color: #a85a00; }
.seg-burbuja.envio { background: #e7f6ec; color: #1b7a43; }

.seg-burbuja.grande {
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  border-radius: 16px;
  font-size: 22px;
}

.seg-contador-titulo {
  padding: 2px 10px;
  border-radius: 999px;
  background: #e8eef8;
  color: #17324d;
  font-size: 12px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- tarjetas de resumen */
.seg-resumen {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.seg-tarjeta {
  --tono: #8fa3bf;
  --tono-suave: #eef2f8;
  --tono-texto: #46587a;
  display: flex;
  align-items: center;
  gap: 13px;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #dfe7f2;
  border-top: 3px solid var(--tono);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(16, 42, 86, 0.05);
  font-family: 'Segoe UI', system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.seg-tarjeta.grave { --tono: #c0392b; --tono-suave: #fdecea; --tono-texto: #b3261e; }
.seg-tarjeta.aviso { --tono: #e08a00; --tono-suave: #fff3e0; --tono-texto: #a85a00; }
.seg-tarjeta.info { --tono: #2f80ed; --tono-suave: #e8f1fd; --tono-texto: #1a63c9; }
.seg-tarjeta.envio { --tono: #1f9254; --tono-suave: #e7f6ec; --tono-texto: #1b7a43; }

.seg-tarjeta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(16, 42, 86, 0.11);
}

.seg-tarjeta.activa {
  border-color: var(--tono);
  background: linear-gradient(180deg, var(--tono-suave), #fff 70%);
}

.seg-tarjeta-icono {
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 13px;
  background: var(--tono-suave);
  color: var(--tono-texto);
  font-size: 18px;
}

.seg-tarjeta-texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.seg-numero {
  color: #12284b;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.15;
}

.seg-tarjeta-rotulo {
  color: #5b6b80;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}

/* ---------------------------------------------------------------- pestañas */
.seg-pestanas {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 2px solid #dbe5f1;
}

.seg-pestanas button {
  width: auto;
  margin: 0 0 -2px;
  padding: 10px 18px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 10px 10px 0 0;
  background: none;
  color: #5b6b80;
  font: 700 13.5px 'Segoe UI', system-ui, sans-serif;
  cursor: pointer;
}

.seg-pestanas button:hover {
  background: #eaf2fd;
  color: #1a5fc0;
}

.seg-pestanas button.activa {
  border-bottom-color: #0b72ee;
  background: #fff;
  color: #0b62d6;
}

/* ---------------------------------------------------------------- Mi día: secciones plegables con cuadrícula */
.seg-seccion {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid #dfe7f2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(16, 42, 86, 0.05);
  scroll-margin-top: 12px;
}

.seg-seccion-h {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: inherit;
}

.seg-page .seg-seccion-cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: #17324d;
  font-family: 'Segoe UI', system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}

.seg-page .seg-seccion.grave .seg-seccion-cabecera { background: linear-gradient(90deg, #fdf0ee, #fff 45%); }
.seg-page .seg-seccion.aviso .seg-seccion-cabecera { background: linear-gradient(90deg, #fff6e6, #fff 45%); }
.seg-page .seg-seccion.info .seg-seccion-cabecera { background: linear-gradient(90deg, #edf4ff, #fff 45%); }

.seg-seccion-titulo {
  font-size: 15px;
  font-weight: 700;
}

.seg-seccion-resumen {
  color: #6b7a92;
  font-size: 12.5px;
  font-weight: 400;
}

.seg-flecha {
  margin-left: auto;
  color: #8a98ad;
  transition: transform 0.22s ease;
}

.seg-seccion.abierta .seg-flecha {
  transform: rotate(180deg);
}

.seg-seccion-cuerpo {
  padding: 14px 16px 16px;
  border-top: 1px solid #eef2f8;
  container-type: inline-size;
}

/* Diez por página: dos filas de cinco cuando hay ancho. */
.seg-rejilla {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

@container (max-width: 1050px) {
  .seg-rejilla {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (max-width: 520px) {
  .seg-rejilla {
    grid-template-columns: minmax(0, 1fr);
  }
}

.seg-td {
  --tono: #2f80ed;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px 13px 10px;
  border: 1px solid #e3eaf4;
  border-left: 4px solid var(--tono);
  border-radius: 12px;
  background: #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.seg-td.grave { --tono: #c0392b; }
.seg-td.aviso { --tono: #e08a00; }

.seg-td.enlazada {
  cursor: pointer;
}

.seg-td.enlazada:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(16, 42, 86, 0.11);
}

.seg-td-arriba {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seg-td-modulo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #5b6b80;
  font-size: 11.5px;
  font-weight: 600;
}

.seg-td-modulo span,
.seg-td-meta span,
.seg-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-pildora {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #e8f1fd;
  color: #1a5fc0;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.seg-pildora.grave { background: #fdecea; color: #a52a1e; }
.seg-pildora.aviso { background: #fff3e0; color: #8f4d00; }

.seg-page .seg-td h3 {
  margin: 0;
  overflow: hidden;
  color: #12284b;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-td-detalle {
  display: -webkit-box;
  min-height: 36px;
  margin: 0;
  overflow: hidden;
  color: #46587a;
  font-size: 12.5px;
  line-height: 18px;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.seg-td-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: #6b7a92;
  font-size: 11.5px;
}

.seg-td-pie {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #e3eaf4;
}

.seg-td-ref {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: #6b7a92;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-page .seg-abrir-tarjeta {
  flex: 0 0 auto;
  padding: 5px 10px;
  font-size: 12px;
}

.seg-grupo-vacio {
  margin: 0;
  padding: 18px;
  border: 1px dashed #c9d5e6;
  border-radius: 12px;
  color: #67768f;
  text-align: center;
  font-size: 13px;
}

.seg-rezago {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 4px;
  padding: 11px 16px;
  border: 1px solid #f0e2c6;
  border-radius: 14px;
  background: #fffaf0;
}

.seg-page .seg-rezago h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
  color: #7c4a03;
  font-size: 13px;
}

.seg-rezago-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.seg-rezago-lista li {
  padding: 4px 12px;
  border: 1px solid #ecd9ae;
  border-radius: 999px;
  background: #fff;
  color: #5c3b00;
  font-size: 12px;
}

/* ---------------------------------------------------------------- barra de filtros (Avisos y Equipo) */
.seg-barra {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid #dfe7f2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(16, 42, 86, 0.05);
}

.seg-page .seg-barra .seg-campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  color: #46587a;
  font-size: 12px;
  font-weight: 700;
}

.seg-page .seg-barra .seg-campo > label {
  margin: 0;
  font: inherit;
  color: inherit;
}

.seg-page .seg-barra .seg-campo-buscar {
  flex: 1 1 250px;
  max-width: 420px;
}

.seg-page .seg-barra select,
.seg-page .seg-barra input[type="text"] {
  box-sizing: border-box;
  height: 38px;
  margin: 0;
  border: 1px solid #cfd9e8;
  border-radius: 10px;
  background-color: #f8fafd;
  color: #17324d;
  font: 400 13px 'Segoe UI', system-ui, sans-serif;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.seg-page .seg-barra select {
  width: auto;
  min-width: 170px;
  padding: 0 10px;
}

.seg-page .seg-barra select:focus,
.seg-page .seg-barra input[type="text"]:focus {
  border-color: #2f80ed;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.16);
  outline: none;
}

.seg-buscar {
  position: relative;
}

.seg-buscar > i {
  position: absolute;
  top: 50%;
  left: 13px;
  color: #8a98ad;
  transform: translateY(-50%);
  pointer-events: none;
}

.seg-page .seg-barra .seg-buscar input[type="text"] {
  width: 100%;
  padding: 0 34px 0 36px;
}

.seg-page .seg-buscar-limpiar {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e3eaf4;
  box-shadow: none;
  color: #46587a;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.seg-barra-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.seg-barra-acciones .seg-btn {
  height: 38px;
}

/* ---------------------------------------------------------------- avisos */
.seg-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seg-item {
  --tono: #2f80ed;
  --tono-suave: #e8f1fd;
  --tono-texto: #1a63c9;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #e3eaf4;
  border-left: 4px solid var(--tono);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(16, 42, 86, 0.04);
  transition: box-shadow 0.18s ease;
}

.seg-item:hover {
  box-shadow: 0 10px 22px rgba(16, 42, 86, 0.09);
}

.seg-item.grave { --tono: #c0392b; --tono-suave: #fdecea; --tono-texto: #b3261e; }
.seg-item.aviso { --tono: #e08a00; --tono-suave: #fff3e0; --tono-texto: #a85a00; }
.seg-item.envio { --tono: #1f9254; --tono-suave: #e7f6ec; --tono-texto: #1b7a43; }

/* Sin leer: un velo azul; leído: en reposo. */
.seg-item:not(.leido) {
  background: linear-gradient(90deg, #f3f8ff, #fff 38%);
}

.seg-item.leido h3 {
  color: #46587a;
}

.seg-item-icono {
  display: inline-flex;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 12px;
  background: var(--tono-suave);
  color: var(--tono-texto);
}

.seg-item-cuerpo {
  flex: 1 1 200px; /* se queda junto al icono; las acciones bajan si no caben */
  min-width: 0;
}

.seg-item-cabeza {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.seg-page .seg-item h3 {
  margin: 0;
  color: #12284b;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.seg-item-fecha {
  flex: 0 0 auto;
  color: #8a98ad;
  font-size: 11.5px;
  white-space: nowrap;
}

.seg-item-detalle {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: #3d4f6b;
  font-size: 13px;
  white-space: pre-line;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.seg-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.seg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 280px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5fa;
  color: #46587a;
  font-size: 11.5px;
  font-weight: 600;
}

.seg-chip i {
  color: #8a98ad;
}

.seg-chip.tono { background: #e8f1fd; color: #1a5fc0; }
.seg-chip.tono.grave { background: #fdecea; color: #a52a1e; }
.seg-chip.tono.aviso { background: #fff3e0; color: #8f4d00; }
.seg-chip.tono.envio { background: #e7f6ec; color: #1b7a43; }

.seg-item-fallo {
  margin: 6px 0 0;
  color: #b3261e;
  font-size: 12.5px;
}

.seg-nuevo {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #2f80ed;
  color: #fff;
  font-size: 10.5px;
  vertical-align: middle;
}

.seg-item-acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: center;
  gap: 6px;
  max-width: 520px; /* los cuatro botones de un aviso al cliente caben en una línea */
}

.seg-nota {
  margin: 0 0 10px;
  color: #5b6b80;
  font-size: 13px;
}

.seg-nota-aviso {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border: 1px solid #cfe0fa;
  border-radius: 12px;
  background: #eef5ff;
  color: #17497f;
}

.seg-vacio {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 32px 18px;
  border: 1px dashed #cfd9e8;
  border-radius: 14px;
  background: #fff;
  color: #5b6b80;
  text-align: center;
  font-size: 13.5px;
}

.seg-vacio-titulo {
  margin: 0 0 6px;
  color: #17324d;
  font-size: 15px;
  font-weight: 700;
}

.seg-vacio-texto {
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.55;
}

.seg-vacio-acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

/* ---------------------------------------------------------------- paginador */
/* Toma el aspecto de .facturas-pagination (el de Gestión de cobranzas); aquí solo su encaje en esta página. */
.seg-page .seg-paginacion {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
  border: 1px solid #e1e8f2;
  border-radius: 12px;
  container-type: inline-size;
}

.seg-page .seg-paginacion:empty {
  display: none;
}

.seg-page .seg-paginacion.en-seccion {
  border-color: transparent;
  border-top-color: #eef2f8;
  border-radius: 0;
  padding-bottom: 0;
}

.seg-paginacion .facturas-pagination-controls {
  flex-wrap: wrap;
}

.seg-page .seg-paginacion button {
  width: auto;
  margin: 0;
  padding: 0 10px;
  white-space: nowrap;
}

/* Donde no cabe el texto quedan las flechas (los botones conservan su nombre para lectores de pantalla). */
@container (max-width: 400px) {
  .seg-pag-texto {
    display: none;
  }
}

/* ---------------------------------------------------------------- Equipo: paneles y tablas de alto fijo */
.seg-panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #dfe7f2;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(16, 42, 86, 0.06);
}

.seg-page .seg-panel-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  color: #17324d;
  font-size: 15px;
  text-align: left;
}

.seg-panel .seg-barra {
  background: #f8fafd;
  box-shadow: none;
}

.seg-panel .seg-barra select,
.seg-page .seg-panel .seg-barra input[type="text"] {
  background-color: #fff;
}

.seg-tabla-marco {
  overflow-x: auto;
  border: 1px solid #dce6f0;
  border-radius: 12px;
  background: #fff;
}

.seg-page table.seg-tabla {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 13px;
}

/* Anchos fijos: ni el alto ni las columnas cambian al pasar de página o filtrar. */
.seg-page table.seg-tabla.fija {
  table-layout: fixed;
}

#segTablaUsuarios col.c-usuario { width: 36%; }
#segTablaUsuarios col.c-cifra { width: 17%; }
#segTablaUsuarios col.c-medida { width: 30%; }
#segTablaCasos col.c-caso { width: 22%; }
#segTablaCasos col.c-cliente { width: 20%; }
#segTablaCasos col.c-estatus { width: 12%; }
#segTablaCasos col.c-asignado { width: 16%; }
#segTablaCasos col.c-fecha { width: 112px; }
#segTablaCasos col.c-abrir { width: 112px; }

.seg-page .seg-tabla th,
.seg-page .seg-tabla td {
  box-sizing: border-box;
  max-width: none;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
}

/* Encabezado con el azul de la aplicación (el degradado va en la fila para que no se repita en cada celda). */
.seg-page .seg-tabla thead tr {
  background: linear-gradient(100deg, #0f2f4f 0%, #17497f 60%, #1f6aa5 100%);
}

.seg-page .seg-tabla thead th {
  height: 48px; /* cabe un rótulo en dos líneas: el encabezado no cambia de alto */
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: normal;
}

/* Más alto que el contenido más grande (botón o iniciales): todas las filas miden igual, con datos o de relleno. */
.seg-page .seg-tabla tbody td {
  height: 53px;
  overflow: hidden;
  background: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-page .seg-tabla tbody tr:nth-child(even) td {
  background: #f7faff;
}

.seg-page .seg-tabla tbody tr:hover {
  cursor: default;
}

.seg-page .seg-tabla tbody tr:hover td {
  background: #eaf3ff;
}

.seg-page .seg-tabla tbody tr.seg-fila-relleno td,
.seg-page .seg-tabla tbody tr.seg-fila-relleno:hover td {
  border-bottom-color: transparent;
  background: #fff;
}

.seg-page .seg-tabla tbody tr:last-child td {
  border-bottom: 0;
}

.seg-page .seg-tabla tbody td.seg-vacio {
  display: table-cell;
  padding: 12px;
  border: 0;
  border-radius: 0;
  text-align: center;
  white-space: normal;
}

.seg-corto {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-persona {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.seg-page .seg-persona .seg-enlace {
  min-width: 0;
  overflow: hidden;
  color: #12284b;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-page .seg-persona .seg-enlace:hover {
  color: #1a63c9;
  text-decoration: underline;
}

.seg-avatar {
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 50%;
  background: #e8f1fd;
  color: #1a63c9;
  font-size: 12px;
  font-weight: 800;
}

.seg-avatar.c1 { background: #e7f6ec; color: #1b7a43; }
.seg-avatar.c2 { background: #fff3e0; color: #a85a00; }
.seg-avatar.c3 { background: #f1eafd; color: #6b3fc4; }
.seg-avatar.c4 { background: #e2f5f4; color: #0f6f68; }
.seg-avatar.c5 { background: #fdecf1; color: #b4235a; }

.seg-cifra {
  display: inline-block;
  min-width: 38px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  text-align: center;
}

.seg-cifra.grave { background: #fdecea; color: #a52a1e; }
.seg-cifra.pronto { background: #e8f1fd; color: #1a63c9; }
.seg-cifra.cero { background: #f1f4f9; color: #7b8aa3; }

.seg-medida {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seg-medida-barra {
  flex: 1 1 auto;
  max-width: 220px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.seg-medida-barra span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f80ed, #56a8f5);
}

.seg-medida b {
  min-width: 34px;
  color: #12284b;
  text-align: right;
}

.seg-solo-lector {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------------------------------------------------------------- avisos de la página, ventana y mensajes */
.seg-error,
.seg-mensaje-estado {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
}

.seg-error {
  background: #fdecea;
  color: #8c1d18;
}

.seg-mensaje-estado {
  margin-top: 16px;
  background: #eef4fd;
  color: #17324d;
}

.seg-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(13, 27, 51, 0.55);
}

.seg-modal-caja {
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.seg-modal-caja header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e7ecf4;
}

.seg-modal-caja h2 {
  margin: 0;
  font-size: 17px;
  color: #17324d;
}

.seg-cerrar {
  width: auto;
  margin: 0;
  padding: 0 6px;
  border: 0;
  background: none;
  color: #5b6b80;
  font-size: 24px;
  cursor: pointer;
}

.seg-modal-caja form {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin: 0;
  padding: 16px 18px;
}

.seg-modal-caja label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: #46587a;
}

.seg-modal-caja label[hidden] {
  display: none;
}

.seg-modal-caja input,
.seg-modal-caja select,
.seg-modal-caja textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #cfd9e8;
  border-radius: 8px;
  font: 400 13.5px 'Segoe UI', system-ui, sans-serif;
}

.seg-modal-caja textarea {
  resize: vertical;
}

.seg-modal-referencia {
  margin: 0;
  color: #5b6b80;
  font-size: 13px;
}

.seg-modal-caja footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.seg-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10000;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 16px;
  border-radius: 10px;
  background: #14532d;
  color: #fff;
  font: 600 13.5px 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.seg-toast.aviso {
  background: #7c4a03;
}

@media (prefers-reduced-motion: reduce) {
  .seg-tarjeta,
  .seg-td,
  .seg-flecha {
    transition: none;
  }

  .seg-tarjeta:hover,
  .seg-td.enlazada:hover {
    transform: none;
  }
}

/* ---------------------------------------------------------------- pantallas más angostas */
@media (max-width: 1200px) {
  .seg-resumen {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .seg-resumen {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .seg-tarjeta {
    gap: 10px;
    padding: 10px 12px;
  }

  .seg-tarjeta:last-child {
    grid-column: 1 / -1;
  }

  .seg-tarjeta-icono {
    flex-basis: 36px;
    height: 36px;
    font-size: 15px;
  }

  .seg-numero {
    font-size: 21px;
  }

  .seg-item {
    flex-wrap: wrap;
  }

  .seg-item-acciones {
    align-self: auto;
    max-width: none;
    width: 100%;
    justify-content: flex-start;
  }

  .seg-barra-acciones {
    margin-left: 0;
  }
}

/* Con el menú lateral, la tabla de siete columnas deja de caber antes de llegar a teléfono: pasa a tarjetas. */
@media (max-width: 1000px) {
  #segTablaCasos thead,
  #segTablaCasos colgroup,
  #segTablaCasos .seg-fila-relleno {
    display: none !important;
  }

  .seg-page table.seg-tabla#segTablaCasos,
  #segTablaCasos tbody,
  #segTablaCasos tr,
  .seg-page #segTablaCasos td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
  }

  #segTablaCasos tr {
    border-bottom: 8px solid #f4f7fb;
  }

  .seg-page #segTablaCasos tbody td {
    display: flex !important;
    justify-content: space-between;
    gap: 12px;
    height: auto;
    text-align: right;
    white-space: normal;
  }

  #segTablaCasos td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #46587a;
    text-align: left;
  }

  #segTablaCasos .seg-corto {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .seg-page #segTablaCasos td.seg-vacio::before {
    content: none;
  }
}

/* La hoja general convierte en teléfono cada fila y celda en una tabla aparte: aquí se mantienen las columnas. */
@media (max-width: 768px) {
  .seg-page table#segTablaUsuarios { display: table; }
  .seg-page table#segTablaUsuarios thead { display: table-header-group; }
  .seg-page table#segTablaUsuarios tbody { display: table-row-group; }
  .seg-page table#segTablaUsuarios tr { display: table-row; width: auto; }

  .seg-page table#segTablaUsuarios th,
  .seg-page table#segTablaUsuarios td {
    display: table-cell;
    width: auto;
  }
}

@media (max-width: 640px) {
  .seg-page .seg-barra .seg-campo,
  .seg-page .seg-barra .seg-campo-buscar {
    flex: 1 1 100%;
    max-width: none;
  }

  .seg-page .seg-barra select {
    min-width: 0;
    width: 100%;
  }

  .seg-barra-acciones {
    width: 100%;
  }

  .seg-barra-acciones .seg-btn {
    flex: 1 1 auto;
  }

  .seg-panel {
    padding: 12px;
  }

  /* Las cuatro pestañas en una sola línea. */
  .seg-pestanas {
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .seg-pestanas button {
    flex: 1 0 auto;
    margin: 0;
    padding: 9px 6px;
    font-size: 13px;
  }

  /* Usuarios: cuatro columnas sin desplazamiento lateral ni nombres partidos por la mitad. */
  .seg-medida-barra,
  .seg-avatar {
    display: none;
  }

  #segTablaUsuarios col.c-usuario { width: 36%; }
  #segTablaUsuarios col.c-cifra:nth-of-type(2) { width: 26%; }
  #segTablaUsuarios col.c-cifra:nth-of-type(3) { width: 19%; }
  #segTablaUsuarios col.c-medida { width: 19%; }

  .seg-page .seg-tabla thead th {
    padding: 8px 4px;
    font-size: 10.5px;
    letter-spacing: 0;
    text-overflow: clip;
    text-transform: none;
  }

  .seg-page .seg-tabla tbody td {
    padding: 8px 6px;
  }

  .seg-page #segTablaUsuarios tbody td {
    text-align: center;
  }

  .seg-page #segTablaUsuarios tbody td:first-child {
    text-align: left;
  }

  .seg-page #segTablaUsuarios th:nth-child(n + 2) {
    text-align: center;
  }

  .seg-cifra {
    min-width: 28px;
    padding: 2px 7px;
  }

  .seg-medida {
    justify-content: center;
  }

  .seg-medida b {
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .seg-pestanas button i {
    display: none;
  }
}
