.admin-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.admin-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.6rem;
  font-weight: 800;
  white-space: nowrap;
}

#adminRefreshBtn {
  width: auto;
  min-width: 170px;
  max-width: 240px;
  flex: 0 0 auto;
  padding-left: 18px;
  padding-right: 18px;
}

#adminExportPdfBtn {
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #fff;
  min-width: 145px;
  padding-left: 16px;
  padding-right: 16px;
}

#adminExportPdfBtn:hover {
  background: #f8fafc;
}

.admin-filters {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.admin-filter-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.admin-filter-btn:hover {
  background: #f8fafc;
}

.admin-filter-btn.is-active {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}

.admin-status {
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, #eff6ff, #eef2ff);
  color: #1d4ed8;
  font-weight: 700;
  border: 1px solid #dbeafe;
}

.admin-status.is-error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.admin-warnings {
  margin: -6px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
  font-weight: 600;
  list-style: disc;
  list-style-position: inside;
  display: grid;
  gap: 4px;
}

/* Asegura que [hidden] funcione aunque haya display:grid definido */
.admin-warnings[hidden] { display: none !important; }

.admin-overview {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: stretch;
}

.admin-health-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.admin-health-card h3 {
  margin: 0 0 12px;
  color: #0f172a;
  font-size: 1.15rem;
}

.admin-health-card p {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.admin-gauge {
  --p: 0;
  width: 170px;
  height: 170px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(#7dd3fc calc(var(--p) * 1%), #e2e8f0 0);
  display: grid;
  place-items: center;
}

.admin-gauge-inner {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.admin-gauge-inner strong {
  color: #0f172a;
  font-size: 2rem;
  line-height: 1;
}

.admin-gauge-inner span {
  color: #64748b;
  font-size: 12px;
  margin-top: 6px;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.admin-kpi-card p {
  margin: 0;
  color: #64748b;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.3;
}

.admin-kpi-card strong {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 1.7rem;
  line-height: 1;
}

.admin-kpi-card.is-traffic strong {
  color: #0369a1;
}

.admin-kpi-card.is-total {
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
  border-color: #bae6fd;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-monthly {
  display: block;
}

.admin-module-details {
  display: block;
}

.admin-module-detail-card {
  margin-bottom: 2px;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-detail-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbff;
}

.admin-detail-item h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #0f172a;
}

.admin-detail-item p {
  margin: 3px 0;
  font-size: 12px;
  color: #334155;
}

.admin-monthly-card {
  padding-bottom: 10px;
}

.admin-monthly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-monthly-actions {
  display: inline-flex;
  gap: 8px;
}

.admin-monthly-actions .btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 12px;
}

.admin-monthly-actions .btn:hover {
  background: #f8fafc;
}

.admin-monthly-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.admin-monthly-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fff;
}

.admin-monthly-table th,
.admin-monthly-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.admin-monthly-table th:first-child,
.admin-monthly-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.admin-monthly-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-monthly-table tbody tr:hover {
  background: #f8fbff;
}

.admin-monthly-table tbody tr.is-current-month {
  background: #ecfeff;
}

.admin-monthly-table td.is-up {
  color: #15803d;
  font-weight: 700;
}

.admin-monthly-table td.is-down {
  color: #b91c1c;
  font-weight: 700;
}

.admin-monthly-table td.is-neutral {
  color: #64748b;
}

.admin-overview-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.admin-thematic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-thematic-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  min-height: 124px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.admin-thematic-card:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}

.admin-thematic-card.is-selected {
  border-color: #7dd3fc;
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.35);
}

.admin-thematic-card > .admin-thematic-meta {
  min-width: 0;
  width: 100%;
}

.admin-thematic-card h4 {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.admin-thematic-card p {
  margin: 0;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-donut {
  --p: 0;
  --c: #3b82f6;
  width: 46px;
  height: 46px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e2e8f0 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.admin-donut span {
  width: 32px;
  height: 32px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  color: #1e3a8a;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.admin-panel-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.04);
}

.admin-panel-card header {
  margin-bottom: 12px;
}

.admin-panel-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1.05rem;
}

.admin-panel-card p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
}

.admin-panel-card ol,
.admin-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-panel-card li {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  background: #fafcff;
  transition: background 0.15s ease;
}

.admin-panel-card li:hover {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.admin-rank {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.admin-more {
  margin-top: 8px;
}

.admin-more > summary {
  cursor: pointer;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
  list-style: none;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
}

.admin-more > summary::-webkit-details-marker {
  display: none;
}

.admin-more > summary::before {
  content: '▸';
  font-size: 11px;
  transform: translateY(-1px);
}

.admin-more[open] > summary::before {
  content: '▾';
}

.admin-more[open] > summary {
  margin-bottom: 8px;
}

.admin-name {
  color: #0f172a;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-value {
  color: #334155;
  font-weight: 700;
}

.admin-empty {
  color: #64748b;
  font-style: italic;
}

@media (max-width: 1080px) {
  .admin-overview {
    grid-template-columns: 1fr;
  }

  .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-thematic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .admin-head h2 {
    white-space: normal;
  }

  #adminRefreshBtn {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  #adminExportPdfBtn {
    width: 100%;
    min-width: 0;
  }

  .admin-filters {
    width: 100%;
    justify-content: flex-start;
  }

  .admin-monthly-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-monthly-actions {
    width: 100%;
    display: flex;
  }

  .admin-kpis {
    grid-template-columns: 1fr;
  }

  .admin-thematic-grid {
    grid-template-columns: 1fr;
  }
}

/* ── KPI cards clickeables ──────────────────────────────────────────────── */
.admin-kpi-card.is-clickable {
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.admin-kpi-card.is-clickable:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  border-color: #bae6fd;
}
.admin-kpi-card.is-clickable:active { transform: scale(0.98); }
.admin-kpi-card.is-clickable:focus-visible { outline: 2px solid #0369a1; outline-offset: 2px; }

.admin-panel-card.is-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.admin-panel-card.is-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
  border-color: #bae6fd;
}
.admin-panel-card.is-clickable:active { transform: scale(0.99); }
.admin-panel-card.is-clickable:focus-visible { outline: 2px solid #0369a1; outline-offset: 2px; }
.admin-panel-card.is-clickable:hover .admin-kpi-hint { color: #0369a1; }

.admin-kpi-hint {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.03em;
}
.admin-kpi-card.is-clickable:hover .admin-kpi-hint { color: #0369a1; }

/* ── Indicador de pulso "online" ─────────────────────────────────────────── */
.admin-online-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
}
#admin-online-card.is-online-active .admin-online-pulse {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: admin-pulse-ring 1.4s ease-out infinite;
}
#admin-online-card.is-online-active {
  border-color: #bbf7d0 !important;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
}
#admin-online-card.is-online-active strong {
  color: #16a34a !important;
}
@keyframes admin-pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ── Modal overlay ──────────────────────────────────────────────────────── */
#admin-kpi-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 35, 0.5);
  backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  animation: admKpiIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes admKpiIn { from { opacity: 0; } to { opacity: 1; } }

#admin-kpi-modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.28);
  width: 100%;
  max-width: 780px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: admKpiSlide 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes admKpiSlide {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.akm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1.5px solid #f1f5f9;
  flex-shrink: 0;
}
.akm-title {
  margin: 0;
  font-size: 0.97rem;
  font-weight: 800;
  color: #0f172a;
  flex: 1;
  min-width: 0;
  padding-right: 10px;
}
.akm-close {
  width: 32px; height: 32px; border-radius: 9px;
  background: #f1f5f9; border: none; cursor: pointer;
  display: grid; place-items: center;
  font-size: 0.85rem; color: #475569; flex-shrink: 0;
  transition: background 0.15s;
}
.akm-close:hover { background: #e2e8f0; }

.akm-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: #334155;
  flex: 1;
}
.akm-sub {
  margin: 0 0 10px;
  font-size: 0.76rem;
  color: #64748b;
  font-weight: 500;
}
.akm-empty {
  padding: 28px; text-align: center;
  color: #94a3b8; font-weight: 600;
}
.akm-formula {
  margin-top: 12px;
  background: #f8fafc; border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.73rem; color: #64748b; line-height: 1.6;
}

/* Tabla dentro del modal */
.akm-table-wrap { overflow-x: auto; border-radius: 10px; border: 1.5px solid #e2e8f0; }
.akm-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; min-width: 560px; }
.akm-table thead tr { background: #f8fafc; }
.akm-table th {
  padding: 8px 10px; font-size: 0.68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; color: #64748b;
  border-bottom: 2px solid #e2e8f0; text-align: left; white-space: nowrap;
}
.akm-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; white-space: nowrap; }
.akm-table td:nth-child(2) { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.akm-table tbody tr:last-child td { border-bottom: none; }
.akm-table tbody tr:hover:not(.akm-detail-row) { background: #f8fafc; }
.akm-num { color: #94a3b8; font-weight: 700; font-size: 0.72rem; text-align: center; width: 28px; }
.akm-ts { color: #64748b; font-size: .8rem; }

/* Barra de acciones del modal de usuarios */
.akm-users-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.akm-users-actions { display: flex; gap: 8px; flex-shrink: 0; }
.akm-action-btn {
  padding: 5px 12px; border-radius: 8px; border: 1.5px solid #e2e8f0;
  background: #f8fafc; color: #334155; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.akm-action-btn:hover { background: #e0f2fe; border-color: #7dd3fc; }
.akm-action-btn--danger { border-color: #fecaca; color: #b91c1c; background: #fff5f5; }
.akm-action-btn--danger:hover { background: #fee2e2; border-color: #f87171; }
.akm-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Headers ordenables */
.akm-th-sortable { cursor: pointer; user-select: none; }
.akm-th-sortable:hover { color: #0369a1; }
.akm-sort-icon::after { content: '⇅'; margin-left: 4px; opacity: 0.3; font-size: 0.75em; }
.akm-th-asc .akm-sort-icon::after  { content: '↑'; opacity: 1; color: #0369a1; }
.akm-th-desc .akm-sort-icon::after { content: '↓'; opacity: 1; color: #0369a1; }

/* Fila expandible */
.akm-user-row.is-expandable { cursor: pointer; }
.akm-user-row.is-expanded { background: #f0f9ff !important; }
.akm-expand-cell { width: 28px; text-align: center; }
.akm-expand-btn {
  background: #e0f2fe; color: #0369a1; border: none; border-radius: 5px;
  width: 22px; height: 22px; font-size: 0.7rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.akm-expand-btn:hover { background: #bae6fd; }

/* Panel de historial desplegable */
.akm-detail-row td { background: #f8fafc; border-bottom: 2px solid #e0f2fe; padding: 0; }
.akm-visit-history { padding: 8px 12px 10px 44px; display: flex; flex-direction: column; gap: 5px; }
.akm-visit-item { display: flex; align-items: center; gap: 10px; font-size: 0.75rem; }
.akm-visit-time { color: #94a3b8; white-space: nowrap; min-width: 115px; }

/* Badge de sección/módulo */
.akm-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700;
  background: #e0f2fe; color: #0369a1; white-space: nowrap;
}

/* Barras de módulo */
.akm-mod-grid { display: flex; flex-direction: column; gap: 8px; }
.akm-mod-item { display: flex; align-items: center; gap: 10px; }
.akm-mod-count { font-weight: 800; font-size: 0.9rem; color: #0f172a; min-width: 30px; text-align: right; }
.akm-mod-bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.akm-mod-bar { display: block; height: 100%; border-radius: 999px; transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.akm-mod-pct { font-size: 0.72rem; color: #64748b; font-weight: 600; min-width: 32px; text-align: right; }

@media (max-width: 600px) {
  #admin-kpi-modal { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 88dvh; }
  #admin-kpi-overlay { align-items: flex-end; padding: 0; }
}

/* ── Tabs principales del admin ─────────────────────────────────────────── */
.admin-main-tabs {
  display: inline-flex;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
}

.admin-main-tab {
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 9px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.admin-main-tab:hover {
  background: #e2e8f0;
  color: #334155;
}

.admin-main-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Panel de permisos de usuarios ─────────────────────────────────────── */
.admin-perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.admin-perm-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-weight: 600;
}

.admin-perm-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-top: 3px solid var(--perm-color, #e2e8f0);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  min-width: 0;
  overflow: hidden;
}

.admin-perm-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.admin-perm-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.admin-perm-card-head div {
  flex: 1;
  min-width: 0;
}

.admin-perm-card-head h3 {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
}

.admin-perm-card-head p {
  margin: 0;
  font-size: 0.73rem;
  color: #64748b;
  line-height: 1.4;
}

.admin-perm-badge {
  flex-shrink: 0;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  margin-top: 2px;
}

.admin-perm-email-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.admin-perm-empty {
  font-size: 0.78rem;
  color: #94a3b8;
  text-align: center;
  padding: 10px 0;
  margin: 0;
}

.admin-perm-tip {
  margin: -6px 0 0;
  font-size: 0.72rem;
  color: #64748b;
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px 10px;
  border-left: 3px solid var(--perm-color, #e2e8f0);
  line-height: 1.4;
}

.admin-perm-email-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
}

.admin-perm-email-text {
  font-size: 0.78rem;
  color: #334155;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-perm-remove-btn {
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 6px;
  flex-shrink: 0;
  transition: background 0.15s;
}

.admin-perm-remove-btn:hover {
  background: #fee2e2;
}

.admin-perm-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.admin-perm-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 0.78rem;
  color: #334155;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.admin-perm-input:focus {
  border-color: #7dd3fc;
}

.admin-perm-input.is-error {
  border-color: #ef4444;
  animation: permShake 0.3s;
}

@keyframes permShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.admin-perm-add-btn {
  flex: 0 0 auto;
  font-size: 0.78rem;
  padding: 7px 16px;
  border-radius: 9px;
  white-space: nowrap;
  min-width: unset !important;
  width: auto !important;
}

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

/* ── Revisar bajas del sheet ───────────────────────────────────────────── */
.admin-perm-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 16px;
}

.admin-perm-toolbar-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.admin-perm-toolbar .btn {
  width: auto;
  margin-top: 0;
}

.admin-checkbajas-btn {
  background: linear-gradient(90deg, #f59e0b, #fbbf24) !important;
}

.admin-bajas-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #16a34a;
  max-width: 100%;
}

.admin-bajas-summary[hidden] {
  display: none;
}

.admin-bajas-summary.is-warn {
  color: #b45309;
}

.admin-bajas-summary-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.admin-bajas-email-chip {
  display: inline-block;
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  white-space: nowrap;
}

.admin-bajas-close {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.72rem;
  opacity: 0.7;
  padding: 2px 4px;
}

.admin-bajas-close:hover {
  opacity: 1;
}

/* Punto rojo sutil junto al correo que ya no aparece en el sheet de RRHH */
.admin-perm-email-row.is-baja {
  background: #fef2f2;
  border-color: #fecaca;
}

.admin-perm-baja-dot {
  flex-shrink: 0;
  color: #ef4444;
  font-size: 0.55rem;
  line-height: 1;
}

/* ── Dar de baja ──────────────────────────────────────────────────────── */
.admin-offboard-toggle {
  background: linear-gradient(90deg, #ef4444, #f87171) !important;
}

.admin-perm-offboard-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  border-radius: 6px;
  padding: 2px 6px;
  flex-shrink: 0;
  transition: background 0.15s;
}

.admin-perm-offboard-btn:hover {
  background: #fee2e2;
}

.admin-offboard-panel {
  background: #fff;
  border: 1.5px solid #fecaca;
  border-radius: 16px;
  padding: 16px;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-offboard-panel[hidden] {
  display: none;
}

.admin-offboard-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-offboard-search .admin-perm-input {
  flex: 1 1 220px;
  width: auto;
}

.admin-offboard-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.admin-offboard-groups-label {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
}

.admin-offboard-groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.admin-offboard-chip {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 4px 10px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.admin-offboard-photo {
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 12px;
  font-size: 0.78rem;
  color: #334155;
}

.admin-offboard-photo code {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.68rem;
  color: #94a3b8;
}

.admin-offboard-photo-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.admin-offboard-photo-row p {
  margin: 0;
}

.admin-offboard-photo-row strong {
  display: none;
}

.admin-offboard-photo-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
  background: #f1f5f9;
}

.admin-offboard-photo.is-ambiguous {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.admin-offboard-warn {
  color: #b45309;
  font-weight: 600;
  margin: 6px 0 2px;
}

.admin-offboard-copy {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.admin-offboard-copy:hover {
  background: #f1f5f9;
}

.admin-offboard-hint {
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 0;
}

.admin-offboard-candidates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-offboard-candidate {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.78rem;
  color: #334155;
}

.admin-offboard-candidate:hover {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.admin-offboard-candidate strong {
  font-size: 0.82rem;
  color: #0f172a;
}

.admin-offboard-candidate code {
  font-size: 0.72rem;
  color: #64748b;
}

.admin-offboard-delete-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.76rem;
  color: #334155;
  cursor: pointer;
}

.admin-offboard-delete-check code {
  background: #e2e8f0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.72rem;
}

