/* ── Performance Lab (pl-*) ─────────────────────────────────────────── */
.pl-wrap {
  --pl-panel: rgba(16,16,17,.92); --pl-line: rgba(255,255,255,.09);
  --pl-dim: rgba(245,245,247,.55); --pl-faint: rgba(245,245,247,.32);
  --ch-panel: #121213; --ch-muted: rgba(245,245,247,.78);
}
.pl { position: relative; display: flex; flex-direction: column; gap: 14px; }
.pl-card { background: var(--pl-panel); border: 1px solid var(--pl-line); border-radius: 16px; }

.pl-auto { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--pl-dim); cursor: pointer; }
.pl-auto .switch { --w: 36px; --h: 20px; padding: 0; cursor: pointer; font: inherit; }

/* Estado en vivo */
.pl-live { display: flex; align-items: center; gap: 18px; padding: 14px 18px; min-height: 64px; box-sizing: border-box; }
.pl-rec { width: 8px; height: 8px; border-radius: 50%; background: #f5f5f5; flex: none; animation: plBlink 1.6s ease-in-out infinite; }
.pl-rec.is-idle { background: rgba(245,245,247,.32); animation: none; }
.pl-live.is-warn .pl-rec { background: #fbbf24; }
@keyframes plBlink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pl-rec { animation: none; } }
.pl-live-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-live-t b { font-size: 14px; font-weight: 650; }
.pl-live-t span { font-size: 12px; color: var(--pl-dim); }
.pl-live-m { margin-left: auto; display: flex; gap: 22px; font-variant-numeric: tabular-nums; }
.pl-live-m div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pl-live-m em { font-style: normal; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--pl-faint); }
.pl-live-m strong { font-size: 15px; font-weight: 650; }
.pl-live-time { font-family: var(--font-mono); font-size: 13px; color: var(--pl-dim); padding-left: 18px; border-left: 1px solid var(--pl-line); }
.pl-btn { margin-left: auto; flex: none; padding: 8px 14px; border-radius: 9px; border: 0; background: #f5f5f5; color: #0a0a0a; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.pl-btn:hover { background: #fff; }

/* Layout */
.pl-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .pl-body { grid-template-columns: minmax(0, 1fr); } }

/* Lista de sesiones */
.pl-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 230px); overflow-y: auto; }
.pl-list h3 { margin: 8px 10px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pl-faint); }
.pl-list-empty { margin: 4px 10px 12px; font-size: 12.5px; color: var(--pl-dim); }
.pl-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.pl-item:hover { background: rgba(255,255,255,.035); }
.pl-item:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: -2px; }
.pl-item.sel { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
.pl-item b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item span { font-size: 11.5px; color: var(--pl-dim); }
.pl-item strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pl-item strong small { display: block; font-size: 10px; font-weight: 500; color: var(--pl-faint); letter-spacing: .04em; }

/* Detalle */
.pl-det { padding: 22px 24px 18px; display: flex; flex-direction: column; gap: 20px; min-width: 0; min-height: 360px; box-sizing: border-box; }
.pl-det-h { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pl-det-h h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-det-h span { font-size: 12.5px; color: var(--pl-dim); white-space: nowrap; }
.pl-ibtn { margin-left: auto; flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--pl-line); background: transparent; color: var(--pl-dim); cursor: pointer; }
.pl-ibtn + .pl-ibtn { margin-left: 0; }
.pl-det.is-exporting .pl-ibtn { visibility: hidden; }
.pl-ibtn:hover { color: #f5f5f5; border-color: rgba(255,255,255,.2); }

.pl-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--pl-line); border-radius: 12px; overflow: hidden; }
.pl-kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pl-kpi + .pl-kpi { border-left: 1px solid var(--pl-line); }
.pl-kpi em { font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pl-faint); white-space: nowrap; }
.pl-kpi b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; line-height: 1; }
.pl-kpi b small { font-size: 12px; font-weight: 600; color: var(--pl-dim); margin-left: 3px; letter-spacing: 0; }
@media (max-width: 1250px) { .pl-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pl-kpi:nth-child(4) { border-left: 0; } .pl-kpi:nth-child(n+4) { border-top: 1px solid var(--pl-line); } }

/* Gráficas */
.pl-charts { position: relative; display: flex; flex-direction: column; gap: 6px; }
.pl-ch-h { display: flex; align-items: baseline; gap: 14px; margin: 0 0 4px; }
.pl-ch-h b { font-size: 12px; font-weight: 650; }
.pl-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--pl-dim); }
.pl-leg.is-nd { color: var(--pl-faint); }
.pl-leg i { width: 14px; height: 0; border-top: 2px solid #f5f5f5; }
.pl-leg i.b { border-top: 2px dashed #8e8e95; }
.pl-ch svg, .pl-xax { display: block; width: 100%; overflow: visible; }
.pl-grid line { stroke: rgba(255,255,255,.06); }
.pl-ax text, .pl-xax text { fill: var(--pl-faint); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.pl-ch .l1 { fill: none; stroke: #f5f5f5; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.pl-ch .l2 { fill: none; stroke: #8e8e95; stroke-width: 1.5; stroke-dasharray: 4 3; stroke-linejoin: round; }
.pl-band { fill: rgba(255,255,255,.08); }
.pl-avg { stroke: rgba(255,255,255,.28); stroke-dasharray: 2 4; }
.pl-stut { stroke: #f87171; stroke-width: 1.5; }
.pl-dl { font-size: 10.5px; font-weight: 600; fill: var(--pl-dim); }
.pl-empty-t { font-size: 12px; fill: var(--pl-faint); }
.pl-cross { position: absolute; top: 0; bottom: 18px; width: 1px; background: rgba(255,255,255,.35); pointer-events: none; display: none; }
.pl-dot { position: absolute; width: 7px; height: 7px; margin: -4px 0 0 -4px; border-radius: 50%; background: #f5f5f5; box-shadow: 0 0 0 2px #101011; pointer-events: none; display: none; }
.pl-tip {
  position: absolute; top: 24px; z-index: 2; pointer-events: none; display: none; min-width: 150px; padding: 10px 12px; border-radius: 10px;
  background: #141415; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 12px 30px rgba(0,0,0,.6); font-size: 12px;
}
.pl-tip h4 { margin: 0 0 7px; font-size: 11px; font-weight: 600; color: var(--pl-dim); font-variant-numeric: tabular-nums; }
.pl-tip div { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.pl-tip div span { color: var(--pl-dim); }
.pl-tip div b { font-weight: 650; }
.pl-sum { border: 1px solid var(--pl-line); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.pl-sum > b { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pl-faint); }
.pl-sum ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pl-sum li { display: flex; align-items: baseline; gap: 10px; font-size: 13px; line-height: 1.45; color: var(--ch-muted); }
.pl-sum li::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-1px); background: #60a5fa; }
.pl-sum li.is-ok::before { background: #34d399; }
.pl-sum li.is-warn::before { background: #fbbf24; }
.pl-foot { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 11.5px; color: var(--pl-faint); }
.pl-foot span { display: inline-flex; align-items: center; gap: 6px; }
.pl-foot i { width: 2px; height: 10px; background: #f87171; }

/* Vacío y carga */
.pl-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 40px 20px; color: var(--pl-dim); }
.pl-empty svg { width: 34px; height: 34px; color: var(--pl-faint); margin-bottom: 4px; }
.pl-empty b { font-size: 15px; color: var(--text); }
.pl-empty span { font-size: 12.5px; max-width: 360px; }
.pl-spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.12); border-top-color: #f5f5f5; animation: plSpin .8s linear infinite; }
@keyframes plSpin { to { transform: rotate(360deg); } }

/* Free: vista bloqueada */
.pl-wrap.is-demo .pl-body, .pl-wrap.is-demo .pl-live { opacity: .6; }
