/* Auditoría 360 (ADR 0057): la ficha 360 de una persona (encabezado, cinco cifras, pestañas Qué hizo,
   Actividad y Accesos) y los agregados de la lista de Personas. Las filas de la Huella están en
   command-center.css; las tablas, los KPI y las tarjetas compartidas, en usage.css. */

.person-360 { min-width: 0; }
.person-360 > .btn-ghost { justify-self: start; }

/* Encabezado */
.person-hero {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 18px; padding: 24px 26px; border: 0; border-radius: var(--r-xl); background: var(--grad-deep); color: var(--on-color); box-shadow: var(--shadow-deep);
}
.person-hero-glow {
  position: absolute; z-index: -1; top: -55%; right: -8%; width: 420px; height: 420px; border-radius: 50%;
  background: var(--grad-violet); opacity: .32; filter: blur(70px); animation: drift 18s var(--ease) infinite; pointer-events: none;
}
.person-hero::after {
  position: absolute; z-index: -1; inset: 0; content: ""; background: var(--brand-pattern); background-size: 56px; opacity: .06; pointer-events: none;
}
.person-hero-main { display: flex; align-items: center; gap: 18px; min-width: 0; flex: 1 1 420px; }
.person-hero-avatar { position: relative; flex: none; border-radius: 50%; box-shadow: 0 0 0 3px var(--glass-line); transition: transform .35s var(--spring); }
.person-hero:hover .person-hero-avatar { transform: scale(1.04) rotate(-2deg); }
.person-hero-dot {
  position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--green-500); box-shadow: 0 0 0 3px var(--navy-900);
}
.person-hero-dot::after { position: absolute; inset: 0; border-radius: 50%; content: ""; background: var(--green-500); animation: pulse 1.8s var(--ease) infinite; }
.person-hero-id { display: grid; gap: 6px; min-width: 0; }
.person-hero-id .eyebrow { color: var(--on-color-2); }
.person-hero-id h3 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.person-hero-mail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13.5px; color: var(--on-color-2); overflow-wrap: anywhere; }
.person-hero-online {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  background: var(--glass-soft); border: 1px solid var(--glass-soft-line); font-size: 12px; font-weight: 700; color: var(--on-color);
}
.person-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.person-hero-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 11px 3px 8px; border-radius: 999px;
  background: var(--tone-soft); color: var(--tone-ink); font-size: 12px; font-weight: 750;
  animation: pop .35s var(--spring) both; animation-delay: calc(var(--i, 0) * 40ms);
}
.person-hero-chip:nth-child(2) { --i: 1; }
.person-hero-chip:nth-child(3) { --i: 2; }
.person-hero-chip:nth-child(n + 4) { --i: 3; }
.person-hero-chip .i { width: 14px; height: 14px; }
.person-hero-last { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--on-color-2); }
.person-hero-last strong { color: var(--on-color); font-weight: 750; }
.person-hero-last .i { width: 16px; height: 16px; flex: none; }
.person-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.person-hero-btn {
  min-height: 44px; border: 1px solid var(--glass-line); background: var(--glass-soft); color: var(--on-color);
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.person-hero-btn:hover:not(:disabled) { background: var(--glass); border-color: var(--on-color-2); transform: translateY(-1px); }
.person-hero-btn:focus-visible { outline: 3px solid var(--on-color); outline-offset: 2px; }

/* Cinco cifras */
.usage-kpis.is-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.usage-kpi .tile-value.is-text { font-size: 22px; letter-spacing: -.02em; }

/* Pestañas internas */
.person-tabs { min-width: 0; }
.person-360 > .tab-panel { margin-top: 0; }
.person-pane { display: grid; gap: 18px; min-width: 0; }
.person-pane.is-entering { animation: cc-enter .22s var(--ease) both; }

/* Qué hizo */
.person-cats { padding-top: 16px; }
.person-cat { min-height: 44px; padding: 6px 8px 6px 12px; }
.person-cat[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--tone); }
.person-cat-count {
  display: grid; place-items: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px;
  background: var(--surface); color: var(--tone-ink); font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-xs);
}
.person-cat:nth-child(-n + 8) { animation: pop .32s var(--spring) both; }
.person-cat:nth-child(2) { animation-delay: 30ms; }
.person-cat:nth-child(3) { animation-delay: 60ms; }
.person-cat:nth-child(4) { animation-delay: 90ms; }
.person-cat:nth-child(5) { animation-delay: 120ms; }
.person-cat:nth-child(6) { animation-delay: 150ms; }
.person-cat:nth-child(7) { animation-delay: 180ms; }
.person-cat:nth-child(8) { animation-delay: 210ms; }
.person-did-search { flex: 0 1 320px; min-width: 0; }
.person-did-search .input { width: 100%; }
.person-did .empty { margin: 4px 0; }

/* Accesos */
.person-device { display: inline-flex; align-items: center; gap: 6px; }
.person-device .i { width: 15px; height: 15px; color: var(--ink-3); }
.person-sessions .chip { gap: 6px; }
.person-ended { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.person-failed { display: grid; gap: 8px; margin: 0; padding: 0 22px 22px; list-style: none; }
.person-failed-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.person-failed-row:hover { transform: translateY(-1px); border-color: var(--tone-soft); }
.person-failed-text { display: grid; gap: 2px; min-width: 0; font-size: 13.5px; }
.person-failed-text strong { color: var(--ink); }
.person-failed-text small { overflow: hidden; font-size: 12px; color: var(--ink-3); text-overflow: ellipsis; white-space: nowrap; }
.person-failed-row time { font-size: 12.5px; font-weight: 650; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Lista de Personas: grupos con privilegios y la columna «Hizo» */
.people-groups { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; animation: fade .3s var(--ease) both; }
.people-groups .chip { height: 22px; padding: 0 8px; gap: 4px; font-size: 10.5px; }
.people-groups .chip .i { width: 12px; height: 12px; }
.people-deeds { display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink); font-weight: 800; animation: pop .3s var(--spring) both; }
.people-deeds-sk { display: inline-block; width: 32px; height: 14px; border-radius: 999px; vertical-align: middle; }
.people-deeds-note { margin-top: -4px; }

@media (max-width: 1280px) {
  .usage-kpis.is-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .usage-kpis.is-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person-did-search { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .person-hero { padding: 18px 16px; }
  .person-hero-main { flex-basis: 100%; align-items: flex-start; gap: 14px; }
  .person-hero-actions { width: 100%; }
  .person-hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .person-failed { padding: 0 14px 16px; }
  .person-failed-row { grid-template-columns: auto minmax(0, 1fr); }
  .person-failed-row time { grid-column: 2; }
  /* Los ingresos pasan de tabla a tarjetas: cada dato lleva su rótulo. */
  .person-sessions thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .person-sessions, .person-sessions tbody, .person-sessions tr, .person-sessions th, .person-sessions td { display: block; width: 100%; }
  .person-sessions tr { margin-bottom: 10px; padding: 6px 4px; border: 1px solid var(--line); border-radius: var(--r-md); }
  .person-sessions th, .person-sessions td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border: 0; white-space: normal; text-align: right; }
  .person-sessions th::before, .person-sessions td::before { content: attr(data-label); flex: none; font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-align: left; }
}
@media (max-width: 420px) {
  .usage-kpis.is-five { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .person-hero-glow, .person-hero-dot::after, .person-hero-chip, .person-cat, .person-pane.is-entering, .people-groups, .people-deeds { animation: none; }
  .person-hero:hover .person-hero-avatar { transform: none; }
}
