/* ═══════════════════════════════════════════════════════
   SEGUIMIENTO — seg-base.css
   Layout principal, panel izquierdo, selector empresa, búsqueda, lista clientes, área principal, hero
═══════════════════════════════════════════════════════ */

/* ── Layout principal ── */
#page-seguimiento {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

/* ── Panel izquierdo ── */
.seg-left-panel {
  width: 260px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden; /* contiene los hijos */
}

.seg-lp-header {
  padding: 12px 12px 10px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.seg-lp-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.seg-lp-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seg-lp-icon i {
  font-size: 12px;
  color: #9961FF;
}

.seg-lp-title {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
}

/* Company selector */
.seg-company-sel {
  width: 100%;
  margin-bottom: 9px;
}

.seg-company-select {
  width: 100%;
  padding: 7px 10px;
  border: 0.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 12px;
  color: #374151;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s;
  outline: none;
  appearance: auto;
}

.seg-company-select:hover,
.seg-company-select:focus {
  border-color: #C9D9FF;
}

/* Search */
.seg-search-wrap {
  position: relative;
}

.seg-search-wrap i {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #9ca3af;
}

.seg-search-input {
  width: 100%;
  padding: 7px 10px 7px 28px;
  border: 0.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 12px;
  color: #374151;
  background: #f9fafb;
  outline: none;
  transition: all .15s;
}

.seg-search-input:focus {
  border-color: #9961FF;
  background: #fff;
  box-shadow: 0 0 0 3px #9961FF12;
}

.seg-search-input::placeholder {
  color: #b0b9c8;
}

/* ── Lista de entidades ── */
.seg-entity-list {
  flex: 1;
  overflow-y: auto;
}

.seg-info-banner {
  margin: 8px 10px 4px;
  padding: 7px 10px;
  background: #EFF6FF;
  border: 0.5px solid #C9D9FF;
  border-radius: 8px;
  font-size: 10px;
  color: #7D84C1;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.4;
}

.seg-info-banner strong {
  color: #9961FF;
}

.seg-entity-item {
  display: flex;
  align-items: flex-start;
  padding: 9px 10px;
  gap: 9px;
  cursor: pointer;
  transition: all .12s;
  border-left: 2px solid transparent;
  margin: 4px 8px;
  border-radius: 10px;
  border: 0.5px solid #e5e7eb;
  background: #fff;
}

.seg-entity-item:hover {
  background: #f5f0ff;
  border-color: #C9D9FF;
}

.seg-entity-item.active {
  background: #f5f0ff;
  border-color: #9961FF;
  border-left-color: #9961FF;
}

.seg-entity-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1.5px solid #C9D9FF;
}

.seg-entity-info {
  flex: 1;
  min-width: 0;
}

.seg-entity-name {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-entity-meta {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-entity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.seg-entity-dot.dot-active  { background: #9961FF; }
.seg-entity-dot.dot-pending { background: #f59e0b; }
.seg-entity-dot.dot-sent    { background: #10b981; }

/* Leyenda */
.seg-list-legend {
  padding: 8px 12px 8px;
  font-size: 9px;
  color: #b0b9c8;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 0.5px solid #f3f4f6;
  margin-top: 4px;
}

.seg-legend-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Estado vacío lista */
.seg-list-empty {
  padding: 24px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

.seg-list-empty i {
  font-size: 22px;
  color: #C9D9FF;
  display: block;
  margin-bottom: 8px;
}

/* ── Área principal ── */
.seg-main-area {
  flex: 1;
  min-width: 0; /* necesario para que flex expanda correctamente al colapsar panel izq */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f3f4f6;
  position: relative; /* para el botón flotante de expandir */
}

/* Empty state */
.seg-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  gap: 10px;
}

/* Loading state — mientras carga el contexto del cliente */
.seg-loading-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #9ca3af;
  font-size: 12px;
}

.seg-empty-state i {
  font-size: 36px;
  color: #C9D9FF;
}

.seg-empty-state p {
  font-size: 14px;
  font-weight: 500;
}

.seg-empty-state span {
  font-size: 12px;
}

/* ── Contenido del registro ── */
.seg-registro-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Área scrolleable entre hero y footer */
.seg-scroll-area {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.seg-scroll-area::-webkit-scrollbar { width: 4px; }
.seg-scroll-area::-webkit-scrollbar-thumb { background: #e0e7ff; border-radius: 99px; }

/* Hero */
.seg-hero {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.seg-hero-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  border: 2px solid #C9D9FF;
}

.seg-hero-info {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.seg-hero-col-left {
  flex-shrink: 0;
}

.seg-hero-name {
  font-size: 15px;
  font-weight: 700;
  color: #1e2d5a;
  margin-bottom: 2px;
}

.seg-hero-sub {
  font-size: 11px;
  color: #7D84C1;
}

.seg-hero-col-right {
  flex: 1;
  min-width: 0;
}

.seg-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 3px;
}

.seg-hero-nota {
  font-size: 10.5px;
  font-style: italic;
  color: #9ca3af;
  line-height: 1.4;
}

.seg-hchip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  cursor: default;
}

.seg-hchip.t1 { background: #fff5f5; color: #b45f5f; border: 0.5px solid #fecaca; }
.seg-hchip.t2 { background: #eff6ff; color: #4a7fc0; border: 0.5px solid #bfdbfe; }
.seg-hchip.t3 { background: #f5f0ff; color: #7c3aed; border: 0.5px solid #ddd6fe; }
.seg-hchip-freq {
  background: #f5f3ff;
  color: #7D84C1;
  border: 0.5px solid #ddd6fe;
  font-weight: 600;
}
.seg-hchip-freq strong { color: #9961FF; font-weight: 700; }

.seg-hchip-trabajar {
  background: #f0fdf4;
  color: #16a34a;
  border: 0.5px solid #86efac;
  font-weight: 600;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: grab;
  user-select: none;
}
.seg-hchip-trabajar:active { cursor: grabbing; opacity: .75; }
.seg-hchip-main {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;
  gap: 5px;
}
.seg-hchip-main-label {
  flex: 1;
  min-width: 0;
}
.seg-hchip-sub {
  font-size: 8px;
  color: #6b7280;
  margin-top: 2px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  align-self: flex-start;
  padding-left: 10px;
}
.seg-hchip-sub::before {
  content: '·  ';
  margin-left: -10px;
  color: #9ca3af;
}

.seg-hero-nota {
  font-size: 10.5px;
  font-style: italic;
  color: #9ca3af;
  margin-top: 5px;
  line-height: 1.4;
}

.seg-hero-status {
  font-size: 9px;
  padding: 2px 8px;
  background: #E1DEFF;
  color: #7c3aed;
  border-radius: 20px;
  font-weight: 700;
  white-space: nowrap;
  margin-right: 4px;
  align-self: center;
}
.seg-hero-status.estado-en-curso  { background: #E1DEFF; color: #7c3aed; }
.seg-hero-status.estado-enviado   { background: #d1fae5; color: #065f46; }
.seg-hero-status.estado-pendiente { background: #fef3c7; color: #92400e; }
.seg-hero-status.estado-cerrado   { background: #f1f5f9; color: #475569; }
/* ── Filtros agenda (Hoy / Semana / Todos) ── */
.seg-agenda-filtros {
  display: flex;
  gap: 5px;
  padding: 8px 10px 6px;
  border-bottom: 0.5px solid #f3f4f6;
  flex-shrink: 0;
}
.seg-agenda-filtro-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.seg-agenda-filtro-chip:hover { border-color: #9961FF; color: #9961FF; }
.seg-agenda-filtro-chip.activo {
  background: #f5f0ff;
  border-color: #9961FF;
  color: #9961FF;
}

/* ── Hora en tarjeta de paciente ── */
.seg-entity-hora {
  font-weight: 700;
  color: #9961FF;
  font-size: 10px;
}

/* ── Fecha (día de semana) en tarjeta de paciente ── */
.seg-entity-fecha {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ── Chips de estado de cita (Presente / Ausente) ── */
.seg-cita-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 5px;
}

.seg-cita-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  border: 0.5px solid #e5e7eb;
  color: #9ca3af;
  background: #f9fafb;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
  white-space: nowrap;
}

.seg-cita-chip:hover {
  border-color: #c4b5fd;
  color: #7c3aed;
  background: #f5f0ff;
}

/* Estados activos */
.seg-cita-chip.activo.status-arrived {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.seg-cita-chip.activo.status-no_show {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* Tooltip JS — appended to body */
.seg-tooltip-body {
  position: fixed;
  background: #f5f0ff;
  color: #7c3aed;
  border: 0.5px solid #c4b5fd;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  transition: opacity .12s;
}

/* ── Tarjeta agenda — layout propuesto ── */
.seg-entity-avatar--sm {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.seg-entity-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.seg-entity-name-row .seg-entity-name {
  margin-bottom: 0;
}

.seg-entity-name-row .seg-entity-fecha {
  font-size: 9px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0;
}

/* Chips con más separación */
.seg-entity-item--agenda .seg-cita-chips {
  gap: 8px;
}

/* Quitar dot en tarjetas de agenda */
.seg-entity-item--agenda .seg-entity-dot {
  display: none;
}

/* ── Botón cerrar sesión — usa estilos de seg-btn-guardar-principal ── */

/* ── Campo en modo lectura (sesión cerrada) ── */
.seg-campo-cerrado {
  opacity: 0.65;
  cursor: default;
  pointer-events: none;
  background: #f8fafc !important;
}

/* ── Badge cerrado en historial ── */
.seg-hist-badge.cerrado {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

/* ── Grupo botones acciones (guardar + cerrar juntos) ── */
.seg-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Side panel historial — eliminar espacios vacíos ── */
.seg-side-panel {
  border: 0.5px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0;
}
.seg-col-side > .seg-side-panel:first-child {
  margin-top: 0;
}
.seg-side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #f4f7fc;
  border-bottom: 1px solid #e8ecf5;
  cursor: pointer;
  user-select: none;
}
.seg-side-panel-title {
  font-size: 10px;
  font-weight: 700;
  color: #7D84C1;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.seg-side-panel-chev {
  font-size: 9px;
  color: #9ca3af;
  transition: transform .2s;
}
.seg-side-panel-body {
  padding: 0;
}
.seg-side-panel-scroll {
  max-height: 340px;
  overflow-y: auto;
}
.seg-side-panel-scroll::-webkit-scrollbar { width: 3px; }
.seg-side-panel-scroll::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 99px; }