.gestion-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.gestion-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.gestion-actions .btn { border: none; cursor: pointer; }

/* Inputs y etiquetas de los formularios (modal de padrón/reclamos) —
   mismas clases que usa la página de Afiliaciones */
.afiliacion-msg { margin-top: 1.5rem; padding: 0.9rem 1.1rem; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; }
.afiliacion-msg.ok { background: color-mix(in oklab, var(--primary) 18%, transparent); color: var(--primary); border: 1px solid var(--primary); }
.afiliacion-msg.error { background: color-mix(in oklab, var(--destructive) 18%, transparent); color: var(--destructive); border: 1px solid var(--destructive); }
.afiliacion-label { display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted-foreground); }
.afiliacion-input { margin-top: 0.5rem; width: 100%; border-radius: var(--radius); border: 1px solid var(--border); background: var(--background); padding: 0.6rem 0.75rem; font-size: 0.9rem; color: var(--foreground); font-family: var(--font-body); box-sizing: border-box; }
.afiliacion-input:focus { outline: none; border-color: var(--primary); }
.block { display: block; }

.gestion-stats {
  margin-top: 2.5rem;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .gestion-stats { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .gestion-stats { grid-template-columns: repeat(3, 1fr); } }

.gestion-stat-card { overflow: hidden; display: block; }
.gestion-stat-link { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.gestion-stat-link:hover { border-color: var(--primary); transform: translateY(-2px); }
.gestion-stat-card .card-pad { padding: 1.5rem; }
.gestion-stat-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--muted-foreground);
}
.gestion-stat-value {
  margin-top: 0.75rem; font-family: var(--font-display);
  font-size: 2.25rem; font-weight: 800;
}

.gestion-table-wrap { margin-top: 1.5rem; overflow-x: auto; max-width: 100%; }
.gestion-cell-link { display: block; color: inherit; }
.gestion-cell-link:hover { color: var(--primary); text-decoration: underline; }
.gestion-table { width: 100%; min-width: 680px; font-size: 0.875rem; border-collapse: collapse; }
.gestion-table th {
  text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: 0.14em; color: var(--muted-foreground);
}
.gestion-table td {
  padding: 0.75rem 1rem; border-bottom: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
  color: var(--muted-foreground);
}
.gestion-table td.strong { color: var(--foreground); font-weight: 600; }
.gestion-table td.right { text-align: right; }
.gestion-table tbody tr:last-child td { border-bottom: none; }

.gestion-search {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.gestion-search input {
  flex: 1; border: none; background: transparent; outline: none;
  color: var(--foreground); font-family: var(--font-body); font-size: 0.9rem;
}

.gestion-icon-btn {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.45rem; background: transparent; color: var(--muted-foreground); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.gestion-icon-btn svg { display: block; }
.gestion-icon-btn:hover { background: var(--accent); }
.gestion-icon-btn.danger:hover { color: #e5484d; background: color-mix(in oklab, #e5484d 12%, transparent); }

.gestion-modal-overlay {
  /* top/right/bottom/left en vez de "inset" y sin backdrop-filter: en notebooks/netbooks viejas
     o con placa de video básica el modal se salía de la pantalla y no dejaba scrollear. */
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60; display: none;
  align-items: flex-start; justify-content: center;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--background); /* respaldo para navegadores sin color-mix */
  background: color-mix(in oklab, var(--background) 82%, transparent);
  padding: 1.5rem;
}
.gestion-modal-overlay.open { display: flex; }
.gestion-modal { width: 100%; max-width: 46rem; margin: 2rem 0; padding: 1.75rem; }
.gestion-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.gestion-modal-grid { margin-top: 1.5rem; display: grid; gap: 1rem; }
.form-seccion-titulo { grid-column: 1 / -1; margin: 0.5rem 0 0; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border, rgba(0,0,0,0.12)); font-size: 0.95rem; font-weight: 800; }
.gestion-modal-grid > .form-seccion-titulo:first-child { margin-top: 0; }
@media (min-width: 640px) { .gestion-modal-grid { grid-template-columns: 1fr 1fr; } }
/* Los botones quedan siempre visibles abajo, aunque el formulario sea más alto que la pantalla. */
.gestion-modal-actions {
  margin-top: 2rem; display: flex; justify-content: flex-end; gap: 0.75rem;
  position: sticky; bottom: 0; padding: 0.75rem 0; background: var(--card);
}
/* Pantallas bajas (notebooks y netbooks): formulario más compacto. */
@media (max-height: 760px) {
  .gestion-modal-overlay { padding: 0.5rem; }
  .gestion-modal { margin: 0.5rem 0; padding: 1rem 1.25rem; }
  .gestion-modal-grid { margin-top: 0.75rem; gap: 0.6rem; }
  .gestion-modal-actions { margin-top: 1rem; }
}
.gestion-modal-actions .btn { border: none; cursor: pointer; }

.gestion-empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted-foreground); }
.gestion-loading { height: 12rem; border-radius: var(--radius); background: var(--card); }

/* Botones de archivos: misma apariencia que "+ Nuevo afiliado". */
.gestion-archivos {
  grid-column: 1 / -1;
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
@media (min-width: 640px) {
  .gestion-archivos { grid-template-columns: 1fr 1fr; }
}
.gestion-archivo { display: block; }
.gestion-archivo-control {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.gestion-archivo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.gestion-archivo-control input[type="file"] {
  display: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.gestion-archivo-nombre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

/* ---------- Historial de visitas ---------- */
.historial-filtros {
  margin-top: 2rem; padding: 1rem 1.25rem;
  display: grid; gap: 1rem; grid-template-columns: 1fr;
}
@media (min-width: 640px) { .historial-filtros { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .historial-filtros { grid-template-columns: 11rem 12rem 12rem 1fr auto; } }
.historial-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.85rem 1rem; margin-top: 0.6rem;
}
.historial-item-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.historial-nota { margin-top: 0.5rem; font-size: 0.9rem; white-space: pre-wrap; }
.historial-meta { margin-top: 0.35rem; font-size: 0.75rem; color: var(--muted-foreground); }
.historial-acciones { margin-top: 0.5rem; display: flex; gap: 0.5rem; align-items: center; }
.historial-acciones:empty { display: none; }
.historial-btn-mini { border: none; cursor: pointer; padding: 0.4rem 0.9rem; font-size: 0.75rem; }
.historial-badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.historial-badge.pendiente { background: color-mix(in oklab, #d99a00 20%, transparent); color: #b07c00; }
.historial-badge.recibido { background: color-mix(in oklab, var(--primary) 18%, transparent); color: var(--primary); }

/* Notas con fecha y hora (delegados / superusuario con notas) */
.notas-seccion { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border, rgba(0,0,0,0.12)); grid-column: 1 / -1; }
.notas-titulo { font-size: 0.95rem; font-weight: 800; }
.notas-ayuda { margin-top: 0.25rem; font-size: 0.75rem; color: var(--muted-foreground); }
.notas-nueva { margin-top: 0.75rem; }
.notas-nueva-pie { margin-top: 0.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.notas-lista { margin-top: 0.75rem; }

/* ---------- Actas: resultados del buscador de afiliados ---------- */
.actas-resultado {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; color: var(--foreground, inherit); font: inherit;
}
.actas-resultado:hover, .actas-resultado:focus-visible { background: var(--muted, rgba(0,0,0,0.04)); }

/* ---------- Paritarias (planilla editable) ---------- */
.parit-barra { margin-top: 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.parit-barra-grupo { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.parit-barra .btn { cursor: pointer; }
.parit-mini { padding: 0.45rem 0.8rem !important; font-size: 0.8rem !important; }
.parit-estado { margin-top: 0.75rem; min-height: 1.4rem; font-size: 0.85rem; font-weight: 600; color: var(--muted-foreground); }
.parit-estado.sucio { color: #b45309; }
.parit-estado.ok { color: var(--primary); }
.parit-estado.error { color: var(--destructive); }

.parit-hojas { margin-top: 0.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.parit-hoja { border: 1px solid var(--border); background: var(--background); color: var(--foreground); border-radius: var(--radius); padding: 0.4rem 0.85rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.parit-hoja:hover { border-color: var(--primary); }
.parit-hoja.activa { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground, #fff); }
.parit-hoja-acc { border: 1px dashed var(--border); background: transparent; color: var(--muted-foreground); border-radius: var(--radius); padding: 0.4rem 0.7rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.parit-hoja-acc:hover { border-color: var(--primary); color: var(--primary); }

.parit-wrap { margin-top: 0.75rem; overflow: auto; max-width: 100%; max-height: 70vh; padding: 0; }
.parit-tabla { border-collapse: separate; border-spacing: 0; font-size: 0.85rem; min-width: 100%; }
.parit-tabla th, .parit-tabla td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0; }
.parit-tabla thead th { position: sticky; top: 0; z-index: 2; background: var(--muted, #f1f1f1); color: var(--muted-foreground); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-align: center; padding: 0.4rem 0.5rem; min-width: 8rem; }
.parit-tabla tbody th { position: sticky; left: 0; z-index: 1; background: var(--muted, #f1f1f1); color: var(--muted-foreground); font-size: 0.7rem; font-weight: 700; text-align: center; padding: 0 0.5rem; min-width: 2.5rem; }
.parit-tabla thead th:first-child { left: 0; z-index: 3; min-width: 2.5rem; }
.parit-tabla th.sel, .parit-tabla tbody th.sel { background: color-mix(in oklab, var(--primary) 22%, var(--muted, #f1f1f1)); color: var(--foreground); }
.parit-celda { display: block; width: 100%; min-width: 8rem; box-sizing: border-box; border: 0; border-radius: 0; background: transparent; color: var(--foreground); font: inherit; padding: 0.5rem 0.6rem; resize: none; overflow: hidden; height: 2.25rem; line-height: 1.25rem; white-space: pre; }
.parit-celda:focus { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--background); white-space: pre-wrap; height: auto; min-height: 2.25rem; overflow: auto; position: relative; z-index: 1; }
.parit-ayuda { margin-top: 0.6rem; font-size: 0.75rem; color: var(--muted-foreground); }
@media (max-width: 640px) { .parit-celda { font-size: 16px; } /* evita el zoom automático en iPhone */ }
