/* R47 (h24, 2026-09-30) · BACKLOG 1.1: pestaña «Rendimiento» de Avance del equipo
   (team-performance-view.js). Usa los tokens de styles.css (tema claro y oscuro). */
.team-performance { display: grid; gap: 18px; min-width: 0; }
.team-performance .tp-heading { padding: 18px 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.team-performance .tp-heading h3 { margin: 4px 0 6px; }
.team-performance .tp-heading p { max-width: 860px; margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.team-performance .tp-filters { grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(200px, 1fr); }
.team-performance .tp-filters :where(input, select) { box-sizing: border-box; width: 100%; min-height: 40px; }
.team-performance .tp-status { margin: -6px 4px 0; }
.team-performance .tp-results { display: grid; gap: 18px; min-width: 0; }
.team-performance .tp-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 0; }
.team-performance .tp-metrics small { line-height: 1.45; }
.team-performance .tp-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.team-performance .tp-panel { min-width: 0; }
/* Keep every profile reachable inside this panel, including keyboard scrolling.
   Wrapped columns retain all six values without a clipped horizontal tail. */
.team-performance .tp-profile-scroll { max-width: 100%; max-height: min(60dvh, 540px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.team-performance .tp-profile-scroll:focus-visible { outline: 3px solid #00a6b8; outline-offset: -3px; }
.team-performance .tp-profile-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.team-performance .tp-profile-table { table-layout: fixed; }
.team-performance .tp-profile-table :is(th, td) { white-space: normal; overflow-wrap: anywhere; }
.team-performance .tp-profile-table :is(th, td):nth-child(1) { width: 20%; }
.team-performance .tp-profile-table :is(th, td):nth-child(2),
.team-performance .tp-profile-table :is(th, td):nth-child(3) { width: 10%; }
.team-performance .tp-profile-table :is(th, td):nth-child(4) { width: 12%; }
.team-performance .tp-profile-table :is(th, td):nth-child(5) { width: 20%; }
.team-performance .tp-profile-table :is(th, td):nth-child(6) { width: 28%; }
.team-performance .tp-panel .panel-heading h4 { margin: 2px 0 0; font-size: 14px; }
.team-performance .tp-table td { vertical-align: top; }
.team-performance .tp-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; white-space: normal; }
.team-performance .tp-table td:has(.tp-failed-list) { min-width: 220px; white-space: normal; }
.team-performance .tp-person { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 750; text-align: left; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.team-performance .tp-person:hover { color: var(--brand-strong); }
.team-performance :is(.tp-person, .tp-more, select, input):focus-visible,
.tp-dialog :is(button, summary, [tabindex="-1"]):focus-visible { outline: 3px solid #00a6b8; outline-offset: 2px; }
.team-performance .tp-progress { display: inline-block; width: 54px; height: 6px; margin-right: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-strong); vertical-align: middle; }
.team-performance .tp-progress i { display: block; height: 100%; background: var(--brand); }
.team-performance .tp-failed-count { display: block; margin-bottom: 4px; }
.team-performance .tp-failed-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.team-performance .tp-failed-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.team-performance .tp-badge { font-size: 9px; }
.status-badge.neutral { background: var(--surface-strong); color: var(--text-soft); }
.team-performance .tp-muted, .tp-dialog .tp-muted { color: var(--muted); }
.team-performance .tp-top { display: grid; gap: 0; margin: 0; padding: 0 0 0 34px; }
.team-performance .tp-top li { padding: 10px 14px 10px 4px; border-top: 1px solid var(--border-soft); font-size: 12px; }
.team-performance .tp-top li:first-child { border-top: 0; }
.team-performance .tp-top li small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.team-performance .tp-top li .tp-course { color: var(--text-soft); }
.team-performance .tp-more { margin: 10px 14px 14px; }
.team-performance .tp-empty, .team-performance .tp-note { margin: 0; padding: 16px 20px; border: 1px dashed var(--border); border-radius: 14px; background: var(--surface-subtle); color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.team-performance .tp-panel .tp-empty { margin: 12px 14px 14px; }
.team-performance .tp-note { border-style: solid; background: var(--yellow-soft); color: var(--yellow); }
.team-performance .tp-hint { margin: 0; padding: 0 14px 10px; color: var(--muted); font-size: 11px; }
.team-performance .tp-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 11px; }
.team-performance .tp-pager .tp-more { margin: 10px 0; }
.team-performance .tp-pager > span { padding: 12px 0; }

/* Historial de una persona: <dialog> modal accesible (Escape o «Cerrar»). */
.tp-dialog { box-sizing: border-box; width: min(920px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.tp-dialog::backdrop { background: rgba(8, 13, 20, .58); backdrop-filter: blur(2px); }
.tp-dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tp-dialog-head h2 { margin: 4px 0; font-size: 18px; }
.tp-dialog-head p { margin: 0; color: var(--text-soft); font-size: 12px; overflow-wrap: anywhere; }
.tp-dialog-body { display: grid; gap: 14px; padding: 18px 20px; min-width: 0; }
.tp-dialog-actions { display: flex; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
.tp-dialog .tp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 0; }
.tp-dialog .tp-facts div { min-width: 0; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface-subtle); }
.tp-dialog .tp-facts dt { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.tp-dialog .tp-facts dd { margin: 4px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.tp-dialog .tp-person-stats, .tp-dialog .tp-person-failed { margin: 0; font-size: 12px; line-height: 1.55; }
.tp-dialog .tp-history-heading { margin: 6px 0 0; font-size: 14px; }
.tp-dialog .tp-lesson { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.tp-dialog .tp-lesson > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-size: 12px; }
.tp-dialog .tp-lesson > summary small { flex-basis: 100%; color: var(--muted); font-size: 10px; }
.tp-dialog .tp-lesson[open] > summary { border-bottom: 1px solid var(--border-soft); }
.tp-dialog .tp-activity { padding: 12px 14px; }
.tp-dialog .tp-activity + .tp-activity { border-top: 1px dashed var(--border); }
.tp-dialog .tp-activity h4 { margin: 0 0 4px; font-size: 12px; }
.tp-dialog .tp-activity-summary { margin: 0 0 8px; color: var(--text-soft); font-size: 11px; }
.tp-dialog .tp-attempts { display: grid; gap: 8px; margin: 0; padding: 0 0 0 20px; }
.tp-dialog .tp-attempt { padding: 8px 10px; border-radius: 10px; background: var(--surface-subtle); font-size: 11px; }
.tp-dialog .tp-attempt p { margin: 2px 0; line-height: 1.5; overflow-wrap: anywhere; }
.tp-dialog .tp-empty { margin: 0; color: var(--text-soft); font-size: 12px; }
body:has(.tp-dialog[open]) { overflow: clip; }

@media (max-width: 1080px) {
  .team-performance .tp-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .team-performance .tp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .team-performance .tp-filters { grid-template-columns: minmax(0, 1fr); }
  .team-performance .tp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-performance .tp-metrics > div { border-bottom: 1px solid var(--border-soft); }
  .team-performance .tp-table td:has(.tp-failed-list) { min-width: 0; }
  .team-performance .tp-profile-table :is(tbody, tr, td) { box-sizing: border-box; width: 100%; max-width: 100%; }
  .team-performance .tp-profile-table td:nth-child(n) { width: 100%; }
  .tp-dialog-head, .tp-dialog-body, .tp-dialog-actions { padding-inline: 14px; }
}
