/* ==========================================================================
   QUICK RABBIT 2026 — Panel de supervisión
   Hereda tokens y componentes de rabbit.css. Aplicación horizontal sin
   scroll de página: cada tarjeta o lista desplaza su propio contenido.
   Gráficas: paleta de canal validada (--ch-*) y rampa secuencial de un
   solo tono (--seq) mezclada con la superficie para el mapa de calor.
   ========================================================================== */

body.qr-sup {
  --seq: var(--ch-email);
  grid-template-rows: var(--qr-topbar-h) auto minmax(0, 1fr);
}

/* ---------- Acceso ---------- */
.qr-gate {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--qr-canvas);
}

.qr-gate[hidden] { display: none; }

.qr-gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(420px, 100%);
  padding: 32px;
  text-align: center;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.qr-gate-title { font-size: 22px; font-weight: 600; }
.qr-gate-msg { font-size: 15px; color: var(--qr-muted); }

/* ---------- Barra superior ---------- */
.qr-brand-sub {
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--qr-line-strong);
  font-weight: 500;
  color: var(--qr-muted);
}

.qr-sup .qr-channels { margin-left: 8px; }

.qr-tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--qr-carrot-text);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body.dark-mode .qr-tab-count { color: #15161E; }
.qr-tab-count[hidden] { display: none; }

.qr-sup .qr-topbar-actions { margin-left: auto; }

.qr-sync {
  font-size: 13px;
  color: var(--qr-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#sup-refresh.is-spinning .material-symbols-outlined {
  animation: qr-spin 700ms linear infinite;
}

@keyframes qr-spin { to { transform: rotate(360deg); } }

.qr-back { margin: 0 4px; text-decoration: none; }

.qr-avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

/* ---------- Filtros ---------- */
.qr-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 20px;
  background: var(--qr-paper);
  border-bottom: 1px solid var(--qr-line);
  overflow-x: auto;
  scrollbar-width: none;
}

.qr-filterbar::-webkit-scrollbar { display: none; }
.qr-filterbar > * { flex-shrink: 0; }
.qr-filterbar .qr-select { width: 220px; }

.qr-filterbar .qr-swatch,
.qr-mini-table .qr-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--ch-color);
}

.qr-filterbar .qr-swatch { margin-right: 6px; }

.qr-swatch[data-ch="email"], [data-ch="email"] > .qr-swatch { --ch-color: var(--ch-email); }
.qr-swatch[data-ch="wa"], [data-ch="wa"] > .qr-swatch { --ch-color: var(--ch-wa); }
.qr-swatch[data-ch="dsp"], [data-ch="dsp"] > .qr-swatch { --ch-color: var(--ch-dsp); }

.qr-filter-summary {
  margin-left: auto;
  font-size: 13px;
  color: var(--qr-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Vistas ---------- */
.qr-sup-main {
  position: relative;
  min-height: 0;
  padding: 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.qr-view {
  height: 100%;
  min-height: 0;
}

.qr-view[hidden] { display: none; }

.qr-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--qr-line-strong) transparent;
}

.qr-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: var(--qr-r-card);
  overflow: hidden;
}

.qr-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 18px 8px;
}

.qr-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--qr-ink);
}

.qr-card-note {
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-card-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 18px 16px;
}

.qr-link-btn {
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--qr-carrot-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.qr-legend-inline {
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--qr-text-2);
}

.qr-legend-inline li { display: inline-flex; align-items: center; gap: 6px; }
.qr-legend-inline .qr-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--ch-color); }
.qr-legend-inline li[data-ch="email"] { --ch-color: var(--ch-email); }
.qr-legend-inline li[data-ch="wa"] { --ch-color: var(--ch-wa); }
.qr-legend-inline li[data-ch="dsp"] { --ch-color: var(--ch-dsp); }

/* Segmentos de canal usados en todas las gráficas */
[data-ch="email"] { --ch-color: var(--ch-email); }
[data-ch="wa"] { --ch-color: var(--ch-wa); }
[data-ch="dsp"] { --ch-color: var(--ch-dsp); }

/* ==========================================================================
   Resumen: rejilla de panel que llena la pantalla
   ========================================================================== */
.qr-dash {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.qr-kpi-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.qr-a-trend { grid-column: 1 / 9; }
.qr-a-mix { grid-column: 9 / 13; }
.qr-a-heat { grid-column: 1 / 6; }
.qr-a-cats { grid-column: 6 / 10; }
.qr-a-agents { grid-column: 10 / 13; }

/* ---------- KPIs ---------- */
.qr-kpi-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px 18px;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: var(--qr-r-card);
  text-align: left;
  color: var(--qr-ink);
  font: inherit;
}

.qr-kpi-link {
  cursor: pointer;
  transition: border-color 150ms ease, transform 160ms var(--ease-out);
}

.qr-kpi-link:active { transform: scale(0.98); }

.qr-kpi-label {
  font-size: 13px;
  color: var(--qr-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-kpi-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.qr-kpi-value {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.qr-kpi-main .qr-kpi-value { font-size: 42px; }
.qr-kpi-value-sm { font-size: 26px; line-height: 1.3; }

.qr-kpi-tile .qr-delta {
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-delta[data-dir="up"] { color: var(--qr-text-2); }
.qr-delta[data-dir="down"] { color: var(--qr-text-2); }

.qr-spark {
  width: min(160px, 50%);
  height: 38px;
  color: var(--seq);
  flex-shrink: 1;
}

/* ---------- Columnas apiladas por canal ---------- */
.qr-cols {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  height: 100%;
  min-height: 120px;
}

.qr-cols-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 22px;
  font-size: 11px;
  color: var(--qr-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.qr-cols-axis span { transform: translateY(-50%); }
.qr-cols-axis span:last-child { transform: translateY(50%); }

.qr-cols-plot {
  position: relative;
  min-width: 0;
  height: 100%;
}

.qr-cols-grid {
  position: absolute;
  inset: 0 0 22px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.qr-cols-grid span {
  height: 1px;
  background: var(--qr-line);
}

.qr-cols-grid span:last-child { background: var(--qr-line-strong); }

.qr-cols-bars {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 2px;
}

.qr-col-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1 1 0;
  min-width: 0;
  padding-bottom: 22px;
  cursor: default;
}

.qr-col-slot:hover { background: color-mix(in oklab, var(--qr-chip) 60%, transparent); border-radius: 6px 6px 0 0; }

.qr-col-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: min(100%, 26px);
  margin: 0 auto;
  min-height: 0;
}

.qr-col-stack span {
  flex-basis: 0;
  min-height: 2px;
  background: var(--ch-color);
}

.qr-col-stack span:first-child { border-radius: 4px 4px 0 0; }

.qr-col-peak {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--qr-ink);
  font-variant-numeric: tabular-nums;
}


.qr-col-label {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--qr-muted);
  white-space: nowrap;
}

/* ---------- Reparto por canal ---------- */
.qr-mix-big {
  display: flex;
  gap: 2px;
  height: 28px;
  margin: 6px 0 16px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--qr-chip);
}

.qr-mix-big span { min-width: 4px; background: var(--ch-color); }
.qr-mix-empty { flex: 1; background: var(--qr-chip) !important; }

.qr-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.qr-mini-table th,
.qr-mini-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--qr-line);
  text-align: left;
  font-weight: 500;
  color: var(--qr-text-2);
}

.qr-mini-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-muted);
}

.qr-mini-table tbody th { color: var(--qr-ink); }
.qr-mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.qr-mini-table td.num { color: var(--qr-ink); font-weight: 600; }

/* ---------- Mapa de calor (rampa secuencial de un tono) ---------- */
.qr-heat {
  display: grid;
  grid-template-columns: 34px repeat(16, minmax(0, 1fr));
  grid-auto-rows: minmax(14px, 1fr);
  gap: 3px;
  height: calc(100% - 28px);
  min-height: 150px;
}

.qr-heat-h {
  align-self: end;
  font-size: 11px;
  color: var(--qr-muted);
  font-variant-numeric: tabular-nums;
}

.qr-heat-d {
  align-self: center;
  font-size: 12px;
  color: var(--qr-muted);
}

.qr-heat-cell,
.qr-heat-scale i {
  border-radius: 4px;
  background: color-mix(in oklab, var(--seq) var(--v), var(--qr-chip));
}

.qr-heat-cell[data-empty="true"] { background: var(--qr-paper-2); box-shadow: inset 0 0 0 1px var(--qr-line); }
.qr-heat-cell:hover { outline: 2px solid var(--qr-ink); outline-offset: 1px; }

.qr-heat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--qr-muted);
}

.qr-heat-foot strong { color: var(--qr-ink); font-weight: 600; }

.qr-heat-scale {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.qr-heat-scale i {
  display: inline-block;
  width: 14px;
  height: 10px;
}

/* ---------- Rankings (categorías y agentes) ---------- */
.qr-rank {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qr-rank-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(60px, 1fr) 34px 40px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--qr-text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.qr-rank-agents .qr-rank-row { grid-template-columns: minmax(110px, 1.2fr) minmax(50px, 1fr) 34px; }

.qr-rank-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-rank-track {
  height: 10px;
  border-radius: 0 4px 4px 0;
  box-shadow: inset 1px 0 0 var(--qr-line-strong);
}

.qr-rank-fill,
.qr-rank-stack {
  display: flex;
  gap: 2px;
  height: 100%;
  min-width: 3px;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
}

.qr-rank-fill { background: var(--qr-ink); opacity: 0.82; }
.qr-rank-stack span { background: var(--ch-color); }

.qr-rank-value {
  text-align: right;
  font-weight: 600;
  color: var(--qr-ink);
  font-variant-numeric: tabular-nums;
}

.qr-rank-delta {
  font-size: 12px;
  text-align: right;
  color: var(--qr-muted);
  font-variant-numeric: tabular-nums;
}

.qr-rank-delta[data-dir="up"]::before { content: '▲'; font-size: 8px; margin-right: 2px; }
.qr-rank-delta[data-dir="down"]::before { content: '▼'; font-size: 8px; margin-right: 2px; }

/* ==========================================================================
   Incidencias: lista + detalle
   ========================================================================== */
.qr-explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.qr-explorer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 14px 16px 8px;
}

.qr-explorer-tools .qr-select { width: 240px; flex-shrink: 0; }

.qr-cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 16px 10px;
}

.qr-cat-chips:empty { display: none; }

.qr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--qr-line-strong);
  border-radius: 999px;
  background: var(--qr-paper);
  color: var(--qr-text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.qr-chip span {
  font-weight: 700;
  color: var(--qr-ink);
  font-variant-numeric: tabular-nums;
}

.qr-chip[aria-pressed="true"] {
  background: var(--qr-ink);
  border-color: var(--qr-ink);
  color: var(--qr-on-ink);
}

.qr-chip[aria-pressed="true"] span { color: var(--qr-on-ink); }

.qr-chip-static {
  cursor: default;
  background: var(--qr-paper-2);
  border-color: var(--qr-line);
}

.qr-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border-top: 1px solid var(--qr-line);
}

.qr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.qr-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  background: var(--qr-paper);
  box-shadow: 0 1px 0 var(--qr-line);
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-muted);
  text-align: left;
  white-space: nowrap;
}

.qr-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--qr-line);
  color: var(--qr-text-2);
  vertical-align: middle;
}

.qr-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.qr-table tbody tr {
  cursor: pointer;
  transition: background-color 100ms ease;
}

.qr-table tbody tr:focus-visible {
  outline: 2px solid var(--qr-carrot);
  outline-offset: -2px;
}

.qr-table tbody tr[aria-selected="true"] {
  background: var(--qr-paper-2);
  box-shadow: inset 3px 0 0 var(--qr-ink);
}

.qr-td-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--qr-ink) !important;
  font-weight: 500;
}

.qr-td-date span {
  margin-left: 6px;
  color: var(--qr-muted);
  font-weight: 400;
}

.qr-td-track {
  font-weight: 600;
  color: var(--qr-ink) !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qr-td-client,
.qr-td-agent,
.qr-td-cat {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--qr-muted);
}

/* ---------- Detalle ---------- */
.qr-detail {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.qr-detail > .qr-empty { height: 100%; justify-content: center; }

.qr-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--qr-line);
}

.qr-detail-track {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.qr-detail-when {
  margin-top: 2px;
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-detail-when::first-letter { text-transform: uppercase; }

.qr-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--qr-line);
}

.qr-detail-grid dt,
.qr-detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-muted);
}

.qr-detail-grid dd {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--qr-ink);
  word-break: break-word;
}

.qr-detail-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--qr-line);
}

.qr-detail-action {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--qr-text-2);
}

.qr-detail-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qr-detail-msg-wrap { border-bottom: 0; }

.qr-detail-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qr-detail-msg {
  padding: 14px 16px;
  border: 1px solid var(--qr-line);
  border-radius: 12px;
  background: var(--qr-paper-2);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--qr-ink);
}

/* ==========================================================================
   Equipo
   ========================================================================== */
.qr-team {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
  height: 100%;
  align-content: start;
}

.qr-agent {
  gap: 14px;
  padding: 18px;
  overflow: visible;
}

.qr-agent-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qr-agent-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-right: auto;
}

.qr-agent-name {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-agent-sub {
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-agent-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.qr-agent-kpis > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qr-agent-kpis span:first-child {
  font-size: 12px;
  color: var(--qr-muted);
}

.qr-agent-kpis strong {
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.qr-agent-head .qr-link-btn { white-space: nowrap; flex-shrink: 0; }

.qr-agent-delta {
  margin-top: -8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-muted);
}

.qr-agent-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.qr-agent-mix {
  display: flex;
  gap: 2px;
  height: 10px;
  min-width: 12px;
  border-radius: 4px;
  overflow: hidden;
}

.qr-agent-mix span { background: var(--ch-color); }

.qr-agent-spark {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qr-mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 44px;
  box-shadow: inset 0 -1px 0 var(--qr-line-strong);
}

.qr-mini-bars span {
  flex: 1 1 0;
  border-radius: 3px 3px 0 0;
  background: var(--seq);
  opacity: 0.85;
}

.qr-agent-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ==========================================================================
   Tiempos: flujo completo (llegada → atención → solución → entrega)
   La vista desplaza por dentro; cada tarjeta tiene altura fija.
   ========================================================================== */
.qr-times {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding-bottom: 4px;
}

.qr-times-kpis { grid-column: 1 / -1; }
.qr-t-funnel { grid-column: 1 / 8; min-height: 250px; }
.qr-t-dist { grid-column: 8 / 13; min-height: 250px; }
.qr-t-agents { grid-column: 1 / 6; height: 260px; }
.qr-t-hours { grid-column: 6 / 10; height: 260px; }
.qr-t-daily { grid-column: 10 / 13; height: 260px; }
.qr-t-list { grid-column: 1 / 9; height: 520px; }
.qr-t-detail { grid-column: 9 / 13; height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.qr-t-detail > .qr-empty { height: 100%; justify-content: center; }

.qr-rank-static { cursor: default; grid-template-columns: minmax(90px, 1fr) minmax(60px, 2fr) 34px; }

/* Embudo */
.qr-funnel {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.qr-funnel-stage {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--qr-line);
  border-radius: 14px;
  background: var(--qr-paper-2);
}

.qr-funnel-icon .material-symbols-outlined { font-size: 20px; color: var(--qr-muted); }
.qr-funnel-stage strong { font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.qr-funnel-label { font-size: 13px; color: var(--qr-text-2); }
.qr-funnel-bar { height: 6px; margin-top: 6px; border-radius: 999px; background: var(--qr-chip); overflow: hidden; }
.qr-funnel-bar span { display: block; height: 100%; border-radius: 999px; background: var(--qr-route); }
.qr-funnel-pct { font-size: 12px; color: var(--qr-muted); font-variant-numeric: tabular-nums; }

.qr-funnel-gap {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 64px;
  position: relative;
}

.qr-funnel-gap::before {
  content: '';
  position: absolute;
  left: 6px; right: 6px; top: 50%;
  border-top: 1.5px dashed var(--qr-line-strong);
}

.qr-funnel-gap span {
  position: relative;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  font-size: 11px;
  font-weight: 600;
  color: var(--qr-text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.qr-funnel-states { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* Barras de hora y cumplimiento */
.qr-vbars-24 { gap: 2px; }
.qr-vbar-fill.is-late { background: var(--danger); opacity: .85; }
.qr-vbar-fill.qr-fill-ok { background: var(--qr-route); }

/* Tabla de casos */
.qr-t-list tr[data-level="late"] .qr-td-wait { color: var(--danger); font-weight: 700; }
.qr-t-list tr[data-level="open"] .qr-td-wait { color: var(--qr-carrot-text); font-weight: 600; }

.qr-pill-open {
  margin: 0 !important;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--qr-carrot-soft);
  color: var(--qr-carrot-text) !important;
  font-size: 12px;
  font-weight: 600;
}

/* Línea de tiempo del recorrido */
.qr-timeline {
  list-style: none;
  margin: 0;
  padding: 16px 18px 18px;
}

.qr-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 16px;
}

.qr-timeline li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 8px; top: 16px; bottom: 0;
  width: 2px;
  background: var(--qr-line);
}

.qr-tl-dot {
  width: 12px; height: 12px;
  margin: 3px 0 0 3px;
  border-radius: 50%;
  background: var(--qr-muted);
  box-shadow: 0 0 0 3px var(--qr-paper);
}

.qr-timeline li[data-kind="tms"] .qr-tl-dot { background: var(--ch-dsp); }
.qr-timeline li[data-kind="agent"] .qr-tl-dot { background: var(--ch-email); }
.qr-timeline li[data-kind="msg"] .qr-tl-dot { background: var(--qr-ink); }
.qr-timeline li[data-kind="ok"] .qr-tl-dot { background: var(--qr-route); }

.qr-tl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qr-tl-body strong { font-size: 14px; font-weight: 600; color: var(--qr-ink); }
.qr-tl-body span { font-size: 13px; color: var(--qr-text-2); }
.qr-tl-body time { font-size: 12px; color: var(--qr-muted); font-variant-numeric: tabular-nums; }
.qr-tl-body em { font-style: normal; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--qr-chip); color: var(--qr-text-2); }

@media (max-width: 1360px) {
  .qr-t-funnel { grid-column: 1 / -1; }
  .qr-t-dist { grid-column: 1 / 7; }
  .qr-t-agents { grid-column: 7 / 13; }
  .qr-t-hours { grid-column: 1 / 7; }
  .qr-t-daily { grid-column: 7 / 13; }
}

@media (max-width: 1100px) {
  .qr-times > * { grid-column: 1 / -1 !important; }
  .qr-funnel { flex-direction: column; }
  .qr-funnel-gap { width: auto; height: 34px; }
  .qr-funnel-gap::before { left: 50%; right: auto; top: 4px; bottom: 4px; border-top: 0; border-left: 1.5px dashed var(--qr-line-strong); }
}

/* ==========================================================================
   Cuentas: solicitudes de alta (izquierda) y cuentas del equipo (derecha)
   ========================================================================== */
.qr-accounts {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.qr-acc-tools { display: flex; align-items: center; gap: 12px; }
.qr-acc-tools .btn { display: inline-flex; align-items: center; gap: 6px; }
.qr-acc-tools .material-symbols-outlined { font-size: 18px; }

.qr-acc-req {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--qr-line);
  border-radius: 14px;
  background: var(--qr-paper-2);
}

.qr-acc-req-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.qr-acc-req-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qr-acc-req-who strong { font-size: 15px; font-weight: 600; color: var(--qr-ink); }
.qr-acc-req-who span { font-size: 13px; color: var(--qr-muted); }
.qr-acc-req-who b { font-weight: 600; color: var(--qr-carrot-text); }
.qr-acc-req-note { margin: 0; font-size: 14px; color: var(--qr-text-2); text-wrap: pretty; }

.qr-acc-req-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qr-acc-req-actions .qr-segmented { margin-right: auto; }
.qr-acc-req-actions .btn { display: inline-flex; align-items: center; gap: 4px; }
.qr-acc-req-actions .material-symbols-outlined { font-size: 18px; }

.qr-acc-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--qr-ink); }
.qr-acc-name em { font-style: normal; font-weight: 400; color: var(--qr-muted); }
.qr-avatar-sm { width: 28px; height: 28px; font-size: 11px; }

.qr-acc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.qr-acc-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.qr-acc-status[data-tone="ok"] { background: rgba(31, 107, 75, 0.1); color: var(--qr-route); }
.qr-acc-status[data-tone="warn"] { background: var(--qr-carrot-soft); color: var(--qr-carrot-text); }
.qr-acc-status[data-tone="off"] { background: var(--qr-chip); color: var(--qr-muted); }

.qr-acc-table tr[data-status="suspended"] td,
.qr-acc-table tr[data-status="rejected"] td { color: var(--qr-muted); }

.qr-acc-actions { text-align: right; white-space: nowrap; }
.qr-acc-actions .qr-icon-btn { margin-left: 2px; }

/* Diálogos (crear cuenta, clave temporal) */
.qr-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--qr-line);
  border-radius: 20px;
  background: var(--qr-paper);
  color: var(--qr-ink);
  box-shadow: var(--shadow-lg, 0 30px 80px -20px rgba(0, 0, 0, .35));
}

.qr-dialog::backdrop { background: rgba(11, 12, 20, 0.45); }

.qr-dialog[open] { animation: qr-dialog-in 200ms var(--ease-out) both; }

@keyframes qr-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .qr-dialog[open] { animation: none; }
}

.qr-dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.qr-dialog-title { margin: 0; font-size: 19px; font-weight: 600; }
.qr-dialog-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--qr-text-2); }
.qr-dialog-hint { margin: 0; font-size: 13px; color: var(--qr-muted); }
.qr-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.qr-dialog .form-group { margin: 0; }

.qr-acc-role { display: flex; gap: 16px; margin: 0; padding: 0; border: 0; }
.qr-acc-role legend { margin-bottom: 6px; }
.qr-acc-role label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

.qr-secret {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--qr-line-strong);
  border-radius: 12px;
  background: var(--qr-paper-2);
}

.qr-secret code { font-size: 20px; font-weight: 600; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; user-select: all; }
.qr-secret .btn { display: inline-flex; align-items: center; gap: 4px; }
.qr-secret .material-symbols-outlined { font-size: 16px; }

.qr-auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-bg, rgba(220, 38, 38, 0.08));
  color: var(--danger-text, #B91C1C);
  font-size: 14px;
}

.qr-auth-error[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1000px) {
  .qr-accounts { grid-template-columns: 1fr; grid-auto-rows: minmax(260px, auto); overflow-y: auto; }
}

/* ==========================================================================
   Tooltip de gráficas (sigue al puntero)
   ========================================================================== */
.qr-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4000;
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.qr-tooltip[hidden] { display: none; }
.qr-tooltip strong { font-weight: 700; }
.qr-tooltip .d { display: inline-block; width: 8px; height: 8px; margin-right: 3px; border-radius: 2px; background: var(--ch-color); }
.qr-tooltip::first-letter { text-transform: uppercase; }

/* ---------- Hover (puntero fino) ---------- */
@media (hover: hover) and (pointer: fine) {
  .qr-link-btn:hover { background: var(--qr-carrot-soft); }
  .qr-kpi-link:hover { border-color: var(--qr-muted); }
  .qr-rank-row:hover { background: var(--qr-paper-2); }
  .qr-rank-row:hover .qr-rank-fill { opacity: 1; }
  .qr-chip:not(.qr-chip-static):not([aria-pressed="true"]):hover { border-color: var(--qr-muted); color: var(--qr-ink); }
  .qr-table tbody tr:hover { background: var(--qr-paper-2); }
  .qr-mini-bars span:hover { opacity: 1; }
}

/* ---------- Entrada orquestada ---------- */
body.qr-ready .qr-view.is-active .qr-kpi-strip,
body.qr-ready .qr-view.is-active .qr-card {
  animation: qr-rise 380ms var(--ease-out) backwards;
}

body.qr-ready .qr-dash > :nth-child(2) { animation-delay: 40ms; }
body.qr-ready .qr-dash > :nth-child(3) { animation-delay: 80ms; }
body.qr-ready .qr-dash > :nth-child(4) { animation-delay: 120ms; }
body.qr-ready .qr-dash > :nth-child(5) { animation-delay: 160ms; }
body.qr-ready .qr-dash > :nth-child(6) { animation-delay: 200ms; }

/* ==========================================================================
   Responsive: horizontal siempre; en pantallas bajas o estrechas, cada
   bloque conserva su altura mínima y el panel desplaza dentro de la vista
   ========================================================================== */
@media (max-width: 1360px) {
  .qr-a-heat { grid-column: 1 / 7; }
  .qr-a-cats { grid-column: 7 / 13; }
  .qr-a-agents { display: none; }
  .qr-sync { display: none; }
}

/* Pantallas bajas: el resumen pasa a desplazar dentro de la vista */
@media (max-height: 760px) {
  .qr-view.is-active { overflow-y: auto; overscroll-behavior: contain; }
  .qr-dash { height: auto; grid-template-rows: auto 320px 320px; }
  .qr-explorer { height: 100%; }
}

@media (max-width: 1100px) {
  .qr-view.is-active { overflow-y: auto; overscroll-behavior: contain; }
  .qr-dash {
    height: auto;
    grid-template-rows: auto 320px 300px 300px;
  }
  .qr-a-trend { grid-column: 1 / -1; }
  .qr-a-mix { grid-column: 1 / 7; }
  .qr-a-heat { grid-column: 7 / 13; }
  .qr-a-cats { grid-column: 1 / 7; }
  .qr-a-agents { display: flex; grid-column: 7 / 13; }
  .qr-kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .qr-kpi-main { grid-column: 1 / -1; }
  .qr-explorer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 0.9fr); }
  .qr-back-text { display: none; }
}

@media (max-width: 760px) {
  .qr-filterbar { padding: 8px 12px; }
  .qr-filter-summary { display: none; }
  .qr-sup .qr-brand-sub { display: none; }
  .qr-dash { grid-template-rows: auto 280px 260px 280px 300px 300px; }
  .qr-a-trend, .qr-a-mix, .qr-a-heat, .qr-a-cats, .qr-a-agents { grid-column: 1 / -1; }
  .qr-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-legend-inline { display: none; }
  .qr-team { grid-template-columns: minmax(0, 1fr); }
  .qr-explorer-tools { flex-wrap: wrap; }
  .qr-explorer-tools .qr-select { width: auto; flex: 1 1 160px; }
  .qr-table th:nth-child(3), .qr-table td:nth-child(3),
  .qr-table th:nth-child(5), .qr-table td:nth-child(5),
  .qr-table th:nth-child(7), .qr-table td:nth-child(7) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body.qr-ready .qr-view.is-active .qr-kpi-strip,
  body.qr-ready .qr-view.is-active .qr-card { animation: none; }
  #sup-refresh.is-spinning .material-symbols-outlined { animation: none; }
}

.qr-sup-export { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }
.qr-sup-export .material-symbols-outlined { font-size: 18px; }
.qr-acc-email { color: var(--qr-text-2); font-size: 13px; }

/* Barra superior del panel en móvil: solo iconos para que todo quepa */
@media (max-width: 720px) {
  .qr-sup .qr-sync,
  .qr-sup #sup-agent-avatar,
  .qr-sup .qr-back-text { display: none; }
  .qr-sup .qr-topbar-actions { gap: 2px; }
  .qr-sup .qr-topbar-actions .qr-icon-btn { width: 36px; height: 36px; }
  .qr-sup .qr-sup-export,
  .qr-sup .qr-back { width: 36px; height: 36px; margin: 0; padding: 0; justify-content: center; }
  .qr-sup .qr-channels { overflow-x: auto; scrollbar-width: none; }
  .qr-sup .qr-channels::-webkit-scrollbar { display: none; }
}

/* ==========================================================================
   Permisos por cuenta
   ========================================================================== */
.qr-perm-list { display: flex; flex-direction: column; gap: 8px; }
.qr-acc-perms { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
.qr-acc-perms legend { margin-bottom: 6px; }

.qr-perm {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--qr-line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.qr-perm > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qr-perm strong { font-size: 14px; font-weight: 600; color: var(--qr-ink); }
.qr-perm small { font-size: 13px; line-height: 1.4; color: var(--qr-muted); }
.qr-perm:has(input:checked) { border-color: color-mix(in srgb, var(--qr-carrot) 50%, var(--qr-line)); background: color-mix(in srgb, var(--qr-carrot-soft) 45%, var(--qr-paper)); }
.qr-perm:has(input:disabled) { cursor: default; opacity: 0.75; }

/* Interruptor */
.qr-perm input,
.qr-perm-pills input {
  appearance: none;
  flex-shrink: 0;
  position: relative;
  width: 36px;
  height: 22px;
  margin: 1px 0 0;
  border-radius: 999px;
  background: var(--qr-line-strong);
  cursor: pointer;
  transition: background-color 160ms ease;
}

.qr-perm input::after,
.qr-perm-pills input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 160ms var(--ease-out);
}

.qr-perm input:checked,
.qr-perm-pills input:checked { background: var(--qr-carrot); }
.qr-perm input:checked::after,
.qr-perm-pills input:checked::after { transform: translateX(14px); }
.qr-perm input:focus-visible,
.qr-perm-pills input:focus-visible { outline: 2px solid var(--qr-carrot); outline-offset: 2px; }
.qr-perm input:disabled { cursor: default; }

/* Accesos rápidos en la tarjeta de solicitud */
.qr-perm-pills { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-right: auto; }
.qr-perm-pills label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--qr-text-2); cursor: pointer; }
.qr-perm-pills input { width: 30px; height: 18px; margin: 0; }
.qr-perm-pills input::after { top: 2px; left: 2px; width: 14px; height: 14px; }
.qr-perm-pills input:checked::after { transform: translateX(12px); }

/* Resumen de accesos en la tabla */
.qr-perm-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.qr-perm-chip { padding: 2px 8px; border-radius: 999px; background: var(--qr-chip); color: var(--qr-text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.qr-perm-chip[data-k="supervisor"] { background: var(--qr-carrot-soft); color: var(--qr-carrot-text); }
.qr-perm-chip.is-basic { background: transparent; border: 1px dashed var(--qr-line-strong); color: var(--qr-muted); }
.qr-perm-btn { display: inline-flex; align-items: center; gap: 4px; }
.qr-perm-btn .material-symbols-outlined { font-size: 16px; }

@media (hover: hover) and (pointer: fine) {
  .qr-perm:hover { border-color: var(--qr-muted); }
}

/* ==========================================================================
   DSP: falsas tipificaciones frente a incidencias verdaderas
   Falsas en rojo (desmentidas por el cliente), verdaderas en gris pizarra.
   ========================================================================== */
[data-ch="fake"] { --ch-color: var(--danger, #C2410C); }
[data-ch="real"] { --ch-color: #8A90A2; }
body.dark-mode [data-ch="real"] { --ch-color: #6B7185; }
.qr-legend-inline li[data-ch="fake"],
.qr-legend-inline li[data-ch="real"] { --ch-color: inherit; }
.qr-legend-inline li[data-ch="fake"] .qr-swatch { background: var(--danger, #C2410C); }
.qr-legend-inline li[data-ch="real"] .qr-swatch { background: #8A90A2; }

.qr-dsp {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.qr-dsp-kpis { grid-column: 1 / -1; }
.qr-kpi-fake .qr-kpi-value { color: var(--danger, #C2410C); }
.qr-d-split { grid-column: 1 / 6; min-height: 230px; }
.qr-d-prov { grid-column: 6 / 13; min-height: 230px; }
.qr-d-types { grid-column: 1 / 6; height: 280px; }
.qr-d-fleets { grid-column: 6 / 13; height: 280px; }
.qr-d-trend { grid-column: 1 / 8; height: 260px; }
.qr-d-agents { grid-column: 8 / 13; height: 260px; }
.qr-d-list { grid-column: 1 / -1; height: 360px; }

/* Barra grande de proporción */
.qr-dsp-split { display: flex; flex-direction: column; justify-content: center; gap: 18px; height: 100%; }
.qr-dsp-bar { display: flex; gap: 3px; height: 28px; border-radius: 8px; overflow: hidden; }
.qr-dsp-bar span { background: var(--ch-color); min-width: 6px; }
.qr-dsp-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-dsp-figures > div { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 4px solid var(--ch-color); }
.qr-dsp-figures strong { font-size: 34px; font-weight: 600; line-height: 1.05; color: var(--qr-ink); font-variant-numeric: tabular-nums; }
.qr-dsp-figures span { font-size: 13px; color: var(--qr-muted); }

/* Filas: etiqueta · barra · falsas · total */
.qr-dsp-rank { position: relative; padding-top: 22px; }
.qr-dsp-rank .qr-rank-row { grid-template-columns: minmax(140px, 1.2fr) minmax(60px, 1fr) 44px 40px; }
.qr-dsp-rank-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(60px, 1fr) 44px 40px;
  gap: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--qr-muted);
  text-align: right;
}
.qr-dsp-fakecount { color: var(--danger, #C2410C); }

/* Columnas por día */
.qr-dsp-cols { display: flex; align-items: stretch; gap: 3px; height: 100%; min-height: 150px; }
.qr-dsp-col { position: relative; flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; padding-bottom: 20px; }
.qr-dsp-colstack { display: flex; flex-direction: column; gap: 2px; min-height: 0; border-radius: 4px 4px 0 0; overflow: hidden; }
.qr-dsp-colstack span { background: var(--ch-color); min-height: 3px; }
.qr-dsp-collabel { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--qr-muted); white-space: nowrap; }

@media (max-width: 1100px) {
  .qr-dsp > * { grid-column: 1 / -1 !important; }
}

/* Por flota: una columna más con el % de falsas */
.qr-dsp-fleet .qr-rank-row,
.qr-dsp-fleet .qr-dsp-rank-head { grid-template-columns: minmax(160px, 1.2fr) minmax(80px, 2fr) 44px 40px 64px; }
.qr-dsp-rate { color: var(--qr-muted); font-weight: 500; }
.qr-dsp-rate.is-on { color: var(--danger, #C2410C); font-weight: 700; }

/* Mensaje enviado bajo cada falsa tipificación */
.qr-dsp-msgcell { width: 1%; white-space: nowrap; text-align: right; }
.qr-dsp-msgbtn { display: inline-flex; align-items: center; gap: 4px; }
.qr-dsp-msgbtn .material-symbols-outlined { font-size: 16px; }
.qr-dsp-msgbtn[aria-expanded="true"] { border-color: var(--qr-carrot); color: var(--qr-carrot-text); }
.qr-dsp-msgrow td { padding-top: 0; }
.qr-dsp-msg {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-left: 3px solid var(--danger, #C2410C);
  border-radius: 0 12px 12px 0;
  background: var(--qr-paper-2);
}
.qr-dsp-msg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--qr-muted); }
.qr-dsp-msg-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--qr-ink); white-space: pre-wrap; overflow-wrap: anywhere; }

/* KPIs de la vista DSP: 5 tarjetas */
.qr-dsp-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }

/* Por provincia: una tarjeta por provincia, la peor resaltada */
.qr-dsp-provs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; height: 100%; align-content: center; }
.qr-dsp-prov { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--qr-line); border-radius: 14px; background: var(--qr-paper-2); }
.qr-dsp-prov.is-worst { border-color: color-mix(in srgb, var(--danger, #C2410C) 45%, var(--qr-line)); background: color-mix(in srgb, var(--danger-bg, #FDECEA) 60%, var(--qr-paper)); }
.qr-dsp-prov-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qr-dsp-prov-head strong { font-size: 16px; font-weight: 600; color: var(--qr-ink); }
.qr-dsp-flag { padding: 2px 8px; border-radius: 999px; background: var(--danger, #C2410C); color: #fff; font-size: 11px; font-weight: 700; }
.qr-dsp-prov-rate { display: flex; align-items: baseline; gap: 6px; }
.qr-dsp-prov-rate span { font-size: 30px; font-weight: 600; line-height: 1; color: var(--qr-ink); font-variant-numeric: tabular-nums; }
.qr-dsp-prov.is-worst .qr-dsp-prov-rate span { color: var(--danger, #C2410C); }
.qr-dsp-prov-rate small { font-size: 12px; color: var(--qr-muted); }
.qr-dsp-bar-sm { height: 10px; border-radius: 5px; }
.qr-dsp-prov-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--qr-muted); }
.qr-dsp-prov-foot b { font-weight: 700; }

.qr-dsp-sub { display: block; font-size: 12px; font-weight: 400; color: var(--qr-muted); }
.qr-dsp-dist { font-weight: 600; color: var(--danger, #C2410C); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 1100px) {
  .qr-dsp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Diálogo de exportación */
.qr-export-dialog { width: min(520px, calc(100vw - 32px)); }
.qr-export-dialog .qr-dialog-body { max-height: min(86dvh, 760px); overflow-y: auto; }
.qr-exp-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--qr-muted); }
.qr-exp-tools .form-label { margin: 0; }
.qr-exp-tools .qr-link-btn { padding: 2px 4px; }
.qr-perm-sub { margin-left: 28px; padding: 10px 12px; }
.qr-perm-sub strong { font-size: 13px; }
#exp-go { display: inline-flex; align-items: center; gap: 6px; }
#exp-go .material-symbols-outlined { font-size: 18px; }

/* ==========================================================================
   Recontacto
   ========================================================================== */
[data-ch="fu-res"] { --ch-color: var(--qr-route); }
[data-ch="fu-pend"] { --ch-color: #E08A2E; }
[data-ch="fu-fail"] { --ch-color: var(--danger, #C2410C); }
.qr-legend-inline li[data-ch="fu-res"] .qr-swatch { background: var(--qr-route); }
.qr-legend-inline li[data-ch="fu-pend"] .qr-swatch { background: #E08A2E; }
.qr-legend-inline li[data-ch="fu-fail"] .qr-swatch { background: var(--danger, #C2410C); }

.qr-fus {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
  height: 100%;
  min-height: 0;
}
.qr-fu-kpis { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.qr-fu-split { grid-column: 1 / 7; min-height: 220px; }
.qr-fu-aging { grid-column: 7 / 13; min-height: 220px; }
.qr-fu-reasons { grid-column: 1 / 7; height: 250px; }
.qr-fu-agents { grid-column: 7 / 13; height: 250px; }
.qr-fu-list { grid-column: 1 / -1; height: 420px; }
.qr-fu-figures { grid-template-columns: repeat(3, 1fr) !important; }
.qr-rank-fill.is-late { background: var(--danger, #C2410C); opacity: .85; }
.qr-fu-pendcount { color: #B45309; }
.qr-fu-row { cursor: pointer; }
.qr-fu-row[aria-expanded="true"] { background: var(--qr-paper-2); }
.qr-fu-logbox { display: flex; flex-direction: column; gap: 6px; border-left-color: #E08A2E; }
.qr-fu-logbox div { font-size: 13px; line-height: 1.45; }
.qr-fu-logbox span { color: var(--qr-text-2); }
.qr-fu-logbox time { font-size: 12px; color: var(--qr-muted); margin-left: 6px; }

@media (max-width: 1100px) {
  .qr-fus > * { grid-column: 1 / -1 !important; }
  .qr-fu-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
.qr-fu-tmslink { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--qr-carrot-text); }
.qr-fu-tmslink .material-symbols-outlined { font-size: 16px; }

/* Resultados de Recontacto */
[data-ch="fu-del"] { --ch-color: #134E36; }
[data-ch="fu-self"] { --ch-color: #8A90A2; }
.qr-legend-inline li[data-ch="fu-del"] .qr-swatch { background: #134E36; }
.qr-legend-inline li[data-ch="fu-self"] .qr-swatch { background: #8A90A2; }
.qr-fu-figures { grid-template-columns: repeat(5, 1fr) !important; }
.qr-fu-figures strong { font-size: 28px !important; }
@media (max-width: 1100px) { .qr-fu-figures { grid-template-columns: repeat(2, 1fr) !important; } }

.qr-funnel-help { margin: 12px 0 0; font-size: 12.5px; color: var(--qr-ink-3, #8A90A2); }

.qr-shift { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--qr-accent-soft, #FFF1E8); color: var(--qr-accent, #F26B1D); font-size: 11px; font-weight: 700; white-space: nowrap; }

.qr-delta-note { display: block; margin-top: 2px; font-size: 11.5px; color: var(--qr-muted, #8A90A2); }

/* Recontacto: estado de cada pendiente */
.qr-fu-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--qr-carrot-soft, #FFF1E8); color: var(--qr-carrot-text, #B4430A); }
.qr-fu-pill[data-level="done"] { background: var(--qr-surface-2, #F1F2F6); color: var(--qr-muted, #8A90A2); }
.qr-fu-pill[data-level="late"] { background: #FDECEC; color: #C4302B; }

/* Recontacto: pestañas de la tabla de clientes */
.qr-fu-list .qr-card-head { flex-wrap: wrap; gap: 10px; }
.qr-fu-tabnote { margin: 0; padding: 0 20px 10px; font-size: 12.5px; color: var(--qr-muted, #8A90A2); }

/* Entregas */
.qr-dl-figures { grid-template-columns: repeat(4, 1fr) !important; }
.qr-dl-figures strong { font-size: 28px !important; }
.qr-dl-sep { height: 1px; background: var(--qr-line, #E3E5EC); margin: 10px 0; }
.qr-dl-late { color: #C4302B; font-weight: 700; }
.qr-dl-row em { font-style: normal; color: var(--qr-muted, #8A90A2); }
@media (max-width: 1100px) { .qr-dl-figures { grid-template-columns: repeat(2, 1fr) !important; } }
