:root {
  --bg: #f2f7fb;
  --card: #ffffff;
  --primary: #0f7482;
  --primary-dark: #0b4f58;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #d9e2ec;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
/* El atributo hidden siempre oculta (evita que display:flex/inline-flex lo anule) */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #e8f6f8, var(--bg));
}

.topbar {
  background: linear-gradient(125deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.03em;
}
.topbar .meta {
  font-size: 0.82rem;
  opacity: 0.9;
}

.container {
  max-width: 1220px;
  margin: 18px auto;
  padding: 0 14px 22px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  padding: 14px;
  margin-bottom: 14px;
}

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

label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea, button {
  font: inherit;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

button, .btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
}
button:hover, .btn:hover { filter: brightness(0.97); }
.btn.secondary { background: #fff; color: var(--primary-dark); border-color: #b7c7d9; }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); }
.btn.start { background: #4f46e5; }   /* Iniciar atención (índigo) */
.btn.hold { background: #0891b2; }    /* Poner en espera (cian) */
.btn.ring { background: #d97706; }    /* Sonar en pantalla (ámbar) */
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* El atributo hidden debe ocultar los botones (display:inline-flex lo anulaba) */
button[hidden], .btn[hidden] { display: none !important; }
/* Botón táctil grande y redondo */
.btn-xl {
  width: 100%;
  padding: 18px 22px;
  font-size: 1.2rem;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15, 116, 130, 0.28);
}

/* Modal flotante del turno generado */
.ticket-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ticket-modal[hidden] { display: none; }
.ticket-modal-card {
  width: min(92vw, 360px); aspect-ratio: 1 / 1;
  background: linear-gradient(150deg, #0f7482, #0b4f58);
  color: #fff; border-radius: 24px;
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.42);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
  animation: ticketPop 0.28s ease;
}
.ticket-check {
  width: 56px; height: 56px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; margin-bottom: 12px;
}
.ticket-modal-label { font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.ticket-modal-number {
  font-size: clamp(2.2rem, 12vw, 3.6rem);
  font-weight: 800; letter-spacing: 0.02em; line-height: 1.05;
  max-width: 100%; overflow-wrap: anywhere;
}
.ticket-modal-sub { font-size: 0.95rem; opacity: 0.9; margin-top: 8px; }
@keyframes ticketPop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.kpi {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fcff);
  padding: 12px;
}
.kpi .label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi .value { font-size: 1.45rem; font-weight: 700; margin-top: 4px; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: #fff;
}
th, td {
  border-bottom: 1px solid #e5edf5;
  padding: 9px 10px;
  text-align: left;
  font-size: 0.85rem;
}
th {
  background: #f6fbff;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.73rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  border: 1px solid transparent;
}
.badge.waiting { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.badge.called { background: #fffbeb; color: #a16207; border-color: #fde68a; }
.badge.in_service { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.badge.completed { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.cancelled, .badge.no_show { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.notice {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.notice.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.notice.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.notice.info { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }

.queue-display {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
  align-items: start;   /* cada panel toma la altura de su contenido (sin huecos) */
}
.ticket-big {
  border-radius: 16px;
  background: linear-gradient(145deg, #0f7482, #0b4f58);
  color: #fff;
  padding: 16px;
}
.ticket-big .code {
  font-size: clamp(2.3rem, 6vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.05em;
}
.ticket-big .counter {
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  margin-top: 8px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
  background: #dbeafe;
}

.area-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.area-card {
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: linear-gradient(160deg, #ffffff, #f2f8ff);
  padding: 14px;
  text-align: left;
  color: #1f2937;
  min-height: 122px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.area-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  border-color: #8fb8de;
}

.area-card[hidden] { display: none; }

.area-card.active {
  border-color: #0f7482;
  box-shadow: 0 0 0 2px rgba(15, 116, 130, 0.18);
  background: linear-gradient(160deg, #ecfeff, #e6f9ff);
}

.area-card-code {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .03em;
  color: #0b4f58;
}

.area-card-name {
  font-size: 1.02rem;
  font-weight: 700;
}

.area-card-foot {
  font-size: .78rem;
  color: #64748b;
}

/* ---------- Marca / logo en el headbar ---------- */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 30px; width: auto; display: block; }
.topbar-title {
  color: #fff; font-weight: 600; font-size: 0.95rem; opacity: 0.95;
  padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.35);
}

/* Separación entre el grupo de KPIs y el siguiente grupo de tarjetas */
.kpi-row { margin-bottom: 26px; }

/* Ranking en el centro del headbar */
.rank-bar {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 14px; color: #fff;
}
.rank-group { display: flex; align-items: center; gap: 8px; }
.rank-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.28); }
.rank-title {
  font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.12em;
  opacity: 0.82; font-weight: 700; white-space: nowrap;
}
.rank-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px; padding: 5px 13px; font-weight: 800; line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.rank-chip svg { width: 18px; height: 18px; opacity: 0.95; }
.rank-pos { font-size: 1.02rem; display: inline-flex; align-items: center; gap: 5px; }
.rank-star { color: #fff; font-size: 0.95rem; filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6)); }
/* Resalta cuando es #1 */
.rank-chip.is-first {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.32), rgba(255, 215, 0, 0.16));
  border-color: rgba(255, 223, 89, 0.7);
}

@media (max-width: 1240px) {
  .rank-title { display: none; }
}
@media (max-width: 1040px) {
  .rank-bar { position: static; transform: none; gap: 10px; }
}
@media (max-width: 860px) {
  .rank-bar { display: none; }
}

/* ---------- Lista de clientes en espera (hold) ---------- */
.held-card { border: 1px solid #bae6fd; background: linear-gradient(180deg, #f0f9ff, #ffffff); }
.held-list { display: flex; flex-direction: column; gap: 8px; }
.held-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; color: var(--ink);
  border: 1px solid #bae6fd; border-radius: 10px; padding: 10px 12px;
  width: 100%; text-align: left; justify-content: flex-start;
}
.held-item:hover { filter: none; background: #e0f2fe; border-color: #7dd3fc; }
.held-code { font-weight: 800; font-size: 1.1rem; color: #0b5563; }
.held-area { font-size: 0.85rem; color: #475569; flex: 1; }
.held-since { font-size: 0.75rem; color: #64748b; }

/* ---------- Avatar con inicial (sin foto) ---------- */
.avatar-initial {
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1rem; text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ---------- Cronómetro sutil de atención ---------- */
.attend-timer {
  text-align: center; color: #0b5563; font-weight: 600; font-size: 0.9rem;
  margin-bottom: 8px; letter-spacing: 0.02em;
}
.attend-timer-label { color: #64748b; font-weight: 500; }

/* ---------- Cuenta regresiva "No se presentó" (tras 2 llamados) ---------- */
.noshow-countdown {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; margin-bottom: 12px; padding: 12px 14px;
  background: #fff4f4; border: 1px solid #f3c6c6; border-radius: 12px;
}
.noshow-countdown .nsc-label { color: #9b1c1c; font-weight: 600; font-size: 0.9rem; }
.noshow-countdown .nsc-num {
  font-size: 2.4rem; font-weight: 800; line-height: 1; color: #dc2626;
  font-variant-numeric: tabular-nums; animation: nscPulse 1s ease-in-out infinite;
}
.noshow-countdown .nsc-hint { color: #64748b; font-size: 0.78rem; }
@keyframes nscPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ---------- Estadística del colaborador (colapsable) ---------- */
/* ---------- Panel de control (admin) ---------- */
.panel-hero { margin: 4px 0 18px; }
.module-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.module-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  padding: 16px; color: var(--ink); text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
a.module-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14); border-color: #8fb8de; }
.module-icon {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  background: linear-gradient(160deg, #ecfeff, #e6f9ff); border: 1px solid #cdeff4;
}
.module-body { flex: 1; }
.module-body h3 { margin: 0 0 3px; font-size: 1.02rem; color: #0b4f58; }
.module-body p { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.35; }
.module-go { color: #0f7482; font-size: 1.3rem; font-weight: 800; }
.shortcut-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;
}
.module-card.is-soon { opacity: 0.72; cursor: default; }
.module-card.is-soon .module-icon { background: #f1f5f9; border-color: #e2e8f0; filter: grayscale(0.3); }
.soon-badge {
  display: inline-block; font-size: 0.64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
  border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle;
}

/* Tarjetas colapsables (encabezado con chevron) */
.collap-head {
  width: 100%; background: transparent; border: 0; color: var(--ink);
  font-weight: 700; font-size: 1.05rem; justify-content: space-between;
  padding: 0; margin: 0; cursor: pointer;
}
.collap-head:hover { filter: none; opacity: 0.85; }
.collap-head .chev { transition: transform 0.18s ease; color: var(--muted); }
.collap-body { margin-top: 12px; }

.stats-summary { padding: 0; overflow: hidden; }
.stats-summary-head {
  width: 100%; background: #f8fbff; border: 0; border-bottom: 1px solid #e5edf5;
  color: #0b4f58; font-weight: 700; justify-content: space-between;
  padding: 12px 14px; border-radius: 0;
}
.stats-summary-head:hover { filter: none; background: #eff6fb; }
.stats-summary-head .chev { transition: transform 0.18s ease; }
.stats-summary-body { padding: 14px; }
.stats-summary-body[hidden] { display: none; }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin-bottom: 12px; }
.mini-kpi { background: #fff; border: 1px solid #e5edf5; border-radius: 10px; padding: 9px; text-align: center; }
.mk-value { font-size: 1.15rem; font-weight: 800; color: #0b5563; }
.mk-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-top: 2px; }
/* Tonos diferentes por indicador */
.mk-avg { background: #eff6ff; border-color: #bfdbfe; }
.mk-avg .mk-value { color: #1d4ed8; }
.mk-count { background: #ecfdf5; border-color: #a7f3d0; }
.mk-count .mk-value { color: #047857; }
.mk-branch { background: #fef3c7; border-color: #fde68a; }
.mk-branch .mk-value { color: #b45309; }
.mk-company { background: #f5f3ff; border-color: #ddd6fe; }
.mk-company .mk-value { color: #6d28d9; }

.stats-summary-list { display: flex; flex-direction: column; gap: 6px; }
/* Encabezados + filas alineados en columnas */
.ss-head, .ss-item { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; }
.ss-head {
  padding: 2px 10px 6px; font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--muted); font-weight: 700;
}
/* Todos los encabezados con el mismo tamaño */
.ss-head span { font-size: 0.66rem; font-weight: 700; color: var(--muted); }
.ss-item { padding: 7px 10px; border: 1px solid #eef2f7; border-radius: 8px; background: #fff; }
.ss-code { font-weight: 800; color: #0b5563; white-space: nowrap; }
.ss-area { font-size: 0.85rem; color: #475569; }
.ss-dur { font-size: 0.82rem; color: #475569; text-align: right; padding-right: 18px; }
.ss-time { font-size: 0.78rem; color: #64748b; white-space: nowrap; text-align: right; }
.ss-empty { color: var(--muted); font-size: 0.88rem; padding: 6px 0; }

/* ---------- Menú de perfil (headbar) ---------- */
.profile-menu { position: relative; }
.profile-trigger {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  gap: 8px;
}
.profile-trigger:hover { filter: none; background: rgba(255, 255, 255, 0.22); }
.profile-trigger .avatar { width: 32px; height: 32px; }
.profile-name { font-size: 0.85rem; font-weight: 600; }
.profile-trigger .caret { font-size: 0.7rem; opacity: 0.9; }
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  min-width: 220px;
  padding: 6px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-dropdown[hidden] { display: none; }
.profile-dropdown a,
.profile-dropdown button {
  background: #fff;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  justify-content: flex-start;
  font-weight: 500;
  font-size: 0.9rem;
  width: 100%;
}
.profile-dropdown a:hover,
.profile-dropdown button:hover { background: #f1f6fb; filter: none; }
.profile-dropdown button.danger { color: var(--danger); }
.profile-dropdown button.danger:hover { background: #fef2f2; }

/* ---------- Atención: layout ---------- */
.attention-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  align-items: start;
}
.attention-side { position: sticky; top: 70px; }
.area-any {
  background: linear-gradient(160deg, #ecfeff, #d7f4fb) !important;
  border-color: #7cc4d1 !important;
}

/* ---------- Panel de atención ---------- */
.counter-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.counter-display {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 14px; border-radius: 12px;
  background: linear-gradient(180deg, #f0fbfd, #ffffff);
  border: 1px solid #bfe3e9;
}
.counter-tag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: #0b5563; opacity: 0.8; }
.counter-value { font-size: 1.08rem; font-weight: 800; color: #0b4f58; }
.counter-edit { flex: 1; }
.counter-row .btn { align-self: stretch; }
.active-ticket {
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  color: #fff;
  background: linear-gradient(150deg, #64748b, #475569);
  margin-bottom: 12px;
  transition: background .2s ease;
}
.active-ticket.idle { background: linear-gradient(150deg, #94a3b8, #64748b); }
.active-ticket.called { background: linear-gradient(150deg, #d97706, #b45309); }
.active-ticket.in_service { background: linear-gradient(150deg, #0f7482, #0b4f58); }
.active-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.9; }
.active-number { font-size: clamp(2.4rem, 7vw, 3.4rem); font-weight: 800; letter-spacing: 0.04em; line-height: 1.1; }
.active-sub { font-size: 1rem; opacity: 0.95; }

.action-stack { display: flex; flex-direction: column; gap: 8px; }
.btn-lg { padding: 14px; font-size: 1.02rem; }
.action-row { display: flex; gap: 8px; }
.action-row .btn { flex: 1; }

.transfer-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #d4dde7;
}
.transfer-row { display: flex; gap: 8px; margin-top: 4px; }
.transfer-row select { flex: 1; }
.transfer-row .btn { white-space: nowrap; }

/* ---------- Tarjeta de estadísticas del turno ---------- */
.stats-card { border: 1px solid #a7f3d0; background: linear-gradient(180deg, #f0fdf4, #ffffff); }
.stats-ticket { font-size: 1.2rem; font-weight: 800; color: #0b5563; margin-bottom: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #fff; border: 1px solid #e5edf5; border-radius: 10px; padding: 10px; text-align: center; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat-value { font-size: 1.05rem; font-weight: 700; margin-top: 4px; color: #1f2937; }

/* ---------- Modal genérico ---------- */
.pgtu-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 1000; overflow-y: auto;
}
.pgtu-modal-backdrop[hidden] { display: none; }
.pgtu-modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35); overflow: hidden;
}
.pgtu-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid #e5edf5; background: #f8fbff;
}
.pgtu-modal-body { padding: 18px 20px; }

/* ---------- Modal: ajustar foto de perfil (recorte circular) ---------- */
.avatar-modal { max-width: 400px; }
.avatar-crop {
  position: relative; width: 260px; height: 260px; margin: 4px auto 0;
  border-radius: 50%; overflow: hidden; background: #0b1220;
  touch-action: none; cursor: grab;
}
.avatar-crop:active { cursor: grabbing; }
.avatar-crop canvas { display: block; width: 100%; height: 100%; }
.avatar-crop-ring {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85), 0 0 0 9999px rgba(15,23,42,0.05) inset;
}
.avatar-zoom { display: flex; align-items: center; gap: 12px; margin: 16px 2px 0; font-weight: 600; color: #475569; }
.avatar-zoom input[type=range] { flex: 1; accent-color: #0f7482; }
.avatar-hint { margin: 8px 0 0; font-size: 0.82rem; color: #64748b; text-align: center; }
.avatar-success {
  margin: 12px 0 0; text-align: center; font-weight: 700; color: #147a3f;
  background: #e8f7ee; border: 1px solid #b6e4c6; border-radius: 10px; padding: 9px;
}
.avatar-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- Display: paneles llamando / atendiendo ---------- */
.panel-tag {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: #d2f4f9; margin-bottom: 6px;
}
.calling-panel { display: flex; flex-direction: column; }
.attending-panel { background: linear-gradient(150deg, #1e293b, #0f172a); }
.mini-tickets { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.mini-ticket {
  background: rgba(255, 255, 255, 0.14); border-radius: 10px; padding: 6px 10px;
  display: flex; flex-direction: column;
}
.mini-code { font-weight: 800; font-size: 1.1rem; }
.mini-meta { font-size: 0.72rem; opacity: 0.85; }

.attend-list { display: flex; flex-direction: column; gap: 8px; }
.attend-row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 9px 14px;
}
.attend-code { font-size: clamp(1.2rem, 2.8vw, 1.8rem); font-weight: 800; letter-spacing: 0.03em; }
.attend-meta { display: flex; flex-direction: column; font-size: 1rem; font-weight: 600; }
.attend-meta small { font-size: 0.78rem; opacity: 0.8; font-weight: 400; }
.attend-empty { opacity: 0.7; font-size: 1rem; padding: 8px 0; }

/* Panel "Llamando ahora": el turno llamado (si hay) arriba; próximos siempre debajo */
.calling-active {
  display: flex; flex-direction: column;
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.calling-next { display: flex; flex-direction: column; }
.idle-title {
  font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: #d2f4f9; margin-bottom: 10px; text-align: center;
}
.next-tickets { display: flex; flex-direction: column; gap: 9px; }
.next-ticket {
  background: rgba(255, 255, 255, 0.14); border-radius: 12px;
  padding: 10px 16px; display: flex; align-items: baseline; gap: 12px;
}
.nt-code { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; letter-spacing: 0.03em; }
.nt-area { font-size: 0.95rem; opacity: 0.85; }

/* Texto del llamado: área + "Pase por Puesto X" */
.counter { display: flex; flex-direction: column; gap: 2px; }
.cc-area { font-size: 0.55em; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.05em; }
.cc-go { font-weight: 800; }
.idle-empty { color: var(--muted); font-size: 0.95rem; text-align: center; padding: 8px 0; }
.calling-idle .idle-empty { color: #d2f4f9; }
/* Sobre tarjetas de fondo oscuro (teal/ámbar) el gris no contrasta: usar texto claro */
.ticket-big .idle-empty, .waiting-card .idle-empty { color: rgba(255, 255, 255, 0.82); }

/* Tarjeta "En espera": ámbar cálido para distinguirla de "Llamando" (teal) y "Atendiendo" (pizarra) */
.waiting-card {
  margin: 26px 0 0;
  background: linear-gradient(145deg, #b45309, #7c3d06);
  border: 0;
  color: #fff;
}
.waiting-card h3 { color: #fff; }
.waiting-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wait-chip {
  display: flex; align-items: baseline; gap: 8px;
  background: #fff7ed; border: 1px solid #fbd9a8; border-radius: 999px;
  padding: 6px 14px;
}
.wc-code { font-weight: 800; color: #9a530c; font-size: 1.05rem; }
.wc-area { font-size: 0.78rem; color: #92703f; }
.wait-chip-more { background: #fdefdc; color: #92530c; font-weight: 600; }

/* Aviso flotante para activar el sonido (autoplay bloqueado) */
.sound-enable {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 1200; background: var(--ok); color: #fff; border: 0;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 1rem;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3); cursor: pointer;
  animation: pulseSound 1.6s ease-in-out infinite;
}
@keyframes pulseSound {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

/* Botón de icono en el headbar (sin caja de fondo) */
.icon-btn {
  background: transparent; border: 0; color: #fff;
  font-size: 1.35rem; line-height: 1; padding: 4px 6px; cursor: pointer;
}
.icon-btn:hover { filter: none; opacity: 0.82; }
.icon-btn.is-off { opacity: 0.45; }

@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-display { grid-template-columns: 1fr; }
  .attention-layout { grid-template-columns: 1fr; }
  .attention-side { position: static; }
}

@media (max-width: 640px) {
  .container { padding: 0 10px 18px; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .btn, button { width: 100%; }
  .profile-trigger, .sound-select, .brand { width: auto; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* ==================================================================
   Colaboradores y Ranking (ranking/index.php)
   ================================================================== */
/* Tamaños de avatar reutilizables */
.avatar-sm { width: 30px; height: 30px; font-size: 0.8rem; }
.avatar-md { width: 60px; height: 60px; font-size: 1.4rem; }
.avatar-lg { width: 74px; height: 74px; font-size: 1.7rem; }

/* ----- Filtros ----- */
.rk-filters { margin-bottom: 22px; }
.rk-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1px solid #b7c7d9; background: #fff; color: var(--primary-dark);
  border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: 0.86rem;
  cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--primary); }
.chip-on { background: linear-gradient(125deg, var(--primary-dark), var(--primary)); color: #fff; border-color: transparent; }
.rk-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; align-items: end;
}
.rk-field label { display: block; font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.rk-field select, .rk-field input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.rk-field-btn { display: flex; align-items: flex-end; }
.rk-field-btn .btn { width: 100%; }

.rk-weights { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.rk-weights summary { cursor: pointer; font-weight: 600; color: var(--primary-dark); }
.rk-weight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 12px; }
.rk-weight-grid label { display: block; font-weight: 600; font-size: 0.85rem; }
.rk-weight-grid input[type=range] { width: 100%; margin: 6px 0 2px; accent-color: var(--primary); }
.rk-weight-grid small { color: var(--muted); font-weight: 400; }
.rk-weight-grid b { color: var(--primary); float: right; }

/* ----- KPIs ----- */
.rk-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rk-kpis .kpi { display: flex; align-items: center; gap: 12px; }
.rk-kpis .kpi-ico { font-size: 1.7rem; line-height: 1; }
.rk-kpis .kpi b { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.rk-kpis .kpi small { color: var(--muted); font-size: 0.76rem; }
.kpi-agents { border-left: 4px solid #6366f1; }
.kpi-clients { border-left: 4px solid #0f7482; }
.kpi-time { border-left: 4px solid #d97706; }
.kpi-rating { border-left: 4px solid #eab308; }
.kpi-alert { border-left: 4px solid #94a3b8; }
.kpi-alert.is-hot { border-left-color: var(--danger); background: linear-gradient(180deg, #fff, #fef2f2); }
.kpi-alert.is-hot b { color: var(--danger); }
.rk-rangenote { margin: 0 0 18px; }

/* ----- Detalle enfocado ----- */
.rk-focus { margin-bottom: 22px; }
.rk-focus-head { display: flex; align-items: center; gap: 14px; }
.rk-focus-head > div:nth-child(2) { flex: 1; }
.rk-focus-score { text-align: center; background: linear-gradient(125deg, var(--primary-dark), var(--primary)); color: #fff; border-radius: 12px; padding: 10px 16px; }
.rk-focus-score b { display: block; font-size: 1.7rem; font-weight: 800; }
.rk-focus-score small { font-size: 0.72rem; opacity: .85; }
.rk-focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.rk-focus-grid > div { background: #f8fcff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.rk-focus-grid span { display: block; font-size: 0.72rem; color: var(--muted); }
.rk-focus-grid b { font-size: 1.15rem; }
.rk-bad { color: var(--danger); }

/* ----- Explicación colapsable del puntaje ----- */
.rk-explain { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }
.rk-explain summary { cursor: pointer; font-weight: 600; color: var(--primary-dark); }
.rk-explain-body { margin-top: 12px; }
.rk-explain-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.rk-explain-table th, .rk-explain-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 0.85rem; text-align: center; }
.rk-explain-table th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fcff; }
.rk-explain-table td:first-child, .rk-explain-table th:first-child { text-align: left; }
.rk-explain-table td small { color: var(--muted); font-weight: 400; }
.rk-explain-table .rk-aport b { color: var(--primary-dark); }
.rk-explain-table tfoot td { font-weight: 700; background: #ecfeff; border-bottom: none; }
.rk-explain-table tfoot .rk-aport b { color: var(--primary); font-size: 1.05rem; }
.rk-explain-notes { margin: 12px 0 0; padding-left: 18px; line-height: 1.5; }
.rk-explain-notes li { margin-bottom: 4px; }

/* ----- Podio ----- */
.rk-podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: end; margin-bottom: 22px; }
.podium-col { display: flex; flex-direction: column; align-items: center; text-align: center; }
.podium-medal { font-size: 1.8rem; }
.podium-name { font-weight: 700; font-size: 0.9rem; margin-top: 6px; }
.podium-score { color: var(--primary-dark); font-weight: 600; font-size: 0.82rem; }
.podium-bar { width: 100%; border-radius: 12px 12px 0 0; margin-top: 8px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); }
.p1 .podium-bar { height: 70px; }
.p2 .podium-bar { height: 46px; background: linear-gradient(180deg, #94a3b8, #64748b); }
.p3 .podium-bar { height: 30px; background: linear-gradient(180deg, #d19a66, #b3703b); }
.podium-empty { opacity: .35; }
.podium-empty .podium-bar { height: 18px; background: #cbd5e1; }

/* ----- Gráfico de barras ----- */
.rk-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.rk-metric-sel { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.rk-chart { display: flex; flex-direction: column; gap: 8px; }
.rk-bar-row { display: grid; grid-template-columns: 180px 1fr 90px; align-items: center; gap: 10px; }
.rk-bar-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-bar-track { background: #eef4f8; border-radius: 999px; height: 18px; overflow: hidden; }
.rk-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.rk-bar-top .rk-bar-fill { background: linear-gradient(90deg, #f59e0b, #d97706); }
.rk-bar-val { font-weight: 700; font-size: 0.85rem; text-align: right; }

/* ----- Tabla de ranking ----- */
.rk-table { width: 100%; border-collapse: collapse; }
.rk-table th, .rk-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.rk-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fcff; }
.rk-table tbody tr:hover { background: #f6fbfd; }
.rk-rank { font-size: 1.1rem; font-weight: 700; text-align: center; }
.rk-agent { display: flex; align-items: center; gap: 8px; }
.rk-agent span { font-weight: 600; }
.rk-hl { background: #ecfeff !important; box-shadow: inset 3px 0 0 var(--primary); }
.rk-flag { margin-left: 4px; }
.rk-stars .st-on { color: #eab308; }
.rk-stars .st-off { color: #d9e2ec; }
.rk-stars small { color: var(--muted); }
.rk-nostar { color: var(--muted); font-size: 0.8rem; font-style: italic; }
.rk-score b { font-size: 1rem; }
.rk-score-bar { display: flex; height: 7px; border-radius: 999px; overflow: hidden; background: #eef4f8; margin-top: 4px; min-width: 90px; }
.rk-score-bar span { display: block; height: 100%; }
.sb-time { background: #d97706; }
.sb-count { background: #0f7482; }
.sb-rate { background: #eab308; }
.rk-detail { color: var(--primary); font-weight: 600; text-decoration: none; }
.rk-detail:hover { text-decoration: underline; }
.rk-empty { text-align: center; color: var(--muted); padding: 24px !important; }
.rk-legend { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rk-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin: 0 2px 0 8px; }
.lg-time { background: #d97706; }
.lg-count { background: #0f7482; }
.lg-rate { background: #eab308; }

@media (max-width: 620px) {
  .rk-bar-row { grid-template-columns: 110px 1fr 64px; }
  .rk-podium { gap: 6px; }
}

/* ==================================================================
   PWA — controles flotantes (fullscreen / instalar) y varios
   ================================================================== */
/* ---------- Menú de opciones del headbar (Instalar + Recargar) ---------- */
.pwa-menu { position: relative; display: inline-flex; align-items: center; }
.pwa-menu-trigger {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: 2px 8px; border-radius: 8px;
}
.pwa-menu-trigger:hover { background: rgba(255, 255, 255, 0.16); }
.pwa-menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1200;
  background: #fff; border-radius: 12px; box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
  min-width: 220px; padding: 6px; display: flex; flex-direction: column;
}
.pwa-menu-dropdown[hidden] { display: none; }
.pwa-menu-dropdown button {
  background: transparent; border: 0; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 8px; font-size: 0.95rem; color: #1f2937;
}
.pwa-menu-dropdown button:hover { background: #f1f5f9; }

.pwa-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 900;
  display: flex; gap: 8px; align-items: center;
}
.pwa-fab-btn {
  border: none; cursor: pointer; border-radius: 999px;
  background: rgba(11, 79, 88, 0.82); color: #fff;
  font-size: 1rem; line-height: 1; padding: 10px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); backdrop-filter: blur(3px);
  transition: background .15s, transform .1s;
}
.pwa-fab-btn:hover { background: var(--primary-dark); }
.pwa-fab-btn:active { transform: scale(0.96); }
.pwa-fab .pwa-install { background: var(--primary); font-weight: 700; }
.pwa-fab .pwa-install:hover { background: var(--primary-dark); }
/* En modo app instalada (standalone/fullscreen) se ocultan por innecesarios */
@media (display-mode: standalone), (display-mode: fullscreen) {
  .pwa-fab { display: none; }
}

.remember-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--muted); font-weight: 500; cursor: pointer;
}
.remember-check input { width: auto; margin: 0; }

/* ----- Tarjetas de apps PWA en el panel ----- */
.pwa-app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.pwa-app-card {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: linear-gradient(160deg, #ffffff, #f2f8ff); color: var(--ink);
  text-decoration: none; transition: transform .14s, box-shadow .14s, border-color .14s;
}
.pwa-app-card:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15,23,42,.12); border-color: #8fb8de; }
.pwa-app-icon { font-size: 1.8rem; }
.pwa-app-body h4 { margin: 0; font-size: 1rem; }
.pwa-app-body p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.35; }
.pwa-app-go { margin-top: auto; color: var(--primary); font-weight: 700; font-size: 0.85rem; }
.pwa-app-card.is-soon { opacity: 0.7; background: #f8fafc; cursor: default; }

/* ==================================================================
   Modo Evaluación — terminal del counter (attention/terminal.php)
   ================================================================== */
.term-body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(circle at 30% 20%, #0f7482, #0b4f58 70%);
  color: #fff; overflow: hidden;
}
/* Controles flotantes (salir / pantalla completa) */
.term-ctrl {
  position: fixed; top: 12px; z-index: 20;
  width: 42px; height: 42px; border-radius: 999px;
  background: rgba(255,255,255,0.14); color: #fff; border: none;
  font-size: 1.1rem; cursor: pointer; opacity: 0.5;
  display: inline-flex; align-items: center; justify-content: center;
}
.term-ctrl:hover { opacity: 1; background: rgba(255,255,255,0.24); }
.term-exit { left: 12px; }
.term-fs { right: 12px; }
.term-stage { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.term-screen {
  width: min(94vw, 560px); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: termFade 0.35s ease;
}
@keyframes termFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Nombre de la empresa: fijado en la esquina inferior derecha de la pantalla */
.term-brand {
  position: fixed; right: 20px; bottom: 14px; z-index: 5; margin: 0;
  font-size: clamp(0.8rem, 2.2vmin, 1.05rem); letter-spacing: 0.16em;
  text-transform: uppercase; opacity: 0.62; font-weight: 700;
}
.term-figure { display: flex; }
.term-info { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
/* Tamaños en vmin: caben bien tanto en vertical como en horizontal */
.term-avatar {
  width: clamp(104px, 30vmin, 210px); height: clamp(104px, 30vmin, 210px);
  border-radius: 999px; object-fit: cover;
  border: 5px solid rgba(255,255,255,0.35); box-shadow: 0 18px 50px rgba(0,0,0,0.4);
}
.term-avatar-initial { display: inline-flex; align-items: center; justify-content: center; font-size: clamp(2.6rem, 14vmin, 6rem); font-weight: 800; }
.term-hello { font-size: clamp(1.05rem, 3.4vmin, 1.6rem); opacity: 0.85; }
.term-name { font-size: clamp(1.9rem, 8vmin, 3.6rem); font-weight: 800; line-height: 1.05; overflow-wrap: anywhere; }
.term-name-sm { font-size: clamp(1.5rem, 6vmin, 2.6rem); }
.term-ticket {
  margin-top: 4px; font-size: clamp(1.05rem, 3.6vmin, 1.7rem); font-weight: 700;
  background: rgba(255,255,255,0.16); padding: 8px 20px; border-radius: 999px;
}
.term-counter {
  margin-top: 10px; font-size: clamp(1rem, 3.2vmin, 1.5rem); font-weight: 700;
  background: rgba(255,255,255,0.14); padding: 7px 18px; border-radius: 999px; letter-spacing: 0.01em;
}
.term-foot { margin-top: 12px; opacity: 0.7; font-size: 0.95rem; }

.term-rate-title { font-size: clamp(1.2rem, 3.6vmin, 1.8rem); opacity: 0.9; }
.term-rate-meta {
  font-size: clamp(0.95rem, 2.4vmin, 1.25rem); font-weight: 700;
  opacity: 0.82; letter-spacing: 0.02em; margin-top: 6px;
}
.term-stars { display: flex; gap: 6px; margin: 12px 0 4px; }
.term-star {
  position: relative; background: none; border: none; cursor: pointer; padding: 0 4px;
  font-size: clamp(2.9rem, 12.5vmin, 5.2rem); line-height: 1;
  color: rgba(255,255,255,0.28); transition: transform .1s, color .1s;
}
.term-star::before { content: '★'; display: block; }
/* Número dentro de la estrella: guía de escala (1 malo … 5 excelente) */
.term-star .ts-n {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding-top: 0.5em; font-size: 0.2em; font-weight: 800; line-height: 1;
  color: rgba(255,255,255,0.55); pointer-events: none; transition: color .1s;
}
.term-star:hover { transform: scale(1.08); }
/* Encendidas: color según posición, de rojo (malo) a verde (excelente) */
.term-star.on { text-shadow: 0 4px 16px rgba(0,0,0,0.28); }
.term-star.on .ts-n { color: rgba(0,0,0,0.5); }
.term-stars .term-star:nth-child(1).on { color: #e5484d; }
.term-stars .term-star:nth-child(2).on { color: #f2820b; }
.term-stars .term-star:nth-child(3).on { color: #f5c518; }
.term-stars .term-star:nth-child(4).on { color: #86c440; }
.term-stars .term-star:nth-child(5).on { color: #2fb562; }
/* Barra de escala bajo las estrellas: extremos "Malo" y "Excelente" */
.term-stars-scale {
  display: flex; justify-content: space-between; width: min(92%, 22rem);
  margin: 0 auto 2px; font-size: 0.72rem; letter-spacing: 0.04em;
  text-transform: uppercase; font-weight: 700; opacity: 0.55;
}
.term-stars-hint { font-size: 1.05rem; min-height: 1.3em; opacity: 0.9; font-weight: 600; }
/* Botón Enviar: overlay fijo y centrado, aparece al calificar (visible en cualquier pantalla) */
.term-send {
  position: fixed; left: 50%; bottom: max(4vh, 14px); transform: translateX(-50%) translateY(10px);
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  background: #ffd34d; color: #4a3200; border: none; border-radius: 999px;
  padding: clamp(12px, 2.4vmin, 16px) clamp(30px, 7vmin, 46px);
  font-size: clamp(1.05rem, 4.4vmin, 1.4rem); font-weight: 800; cursor: pointer;
  box-shadow: 0 14px 38px rgba(0,0,0,0.45);
}
.term-send.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); animation: termSendPop .25s ease; }
@keyframes termSendPop { from { transform: translateX(-50%) translateY(10px) scale(0.9); } to { transform: translateX(-50%) translateY(0) scale(1); } }
/* Botón sutil para no calificar */
.term-skip {
  margin-top: 4px; background: transparent; border: 0; cursor: pointer;
  color: rgba(255, 255, 255, 0.6); font-size: clamp(0.85rem, 3.4vh, 1rem);
  text-decoration: underline; text-underline-offset: 3px; padding: 6px 10px;
}
.term-skip:hover { color: rgba(255, 255, 255, 0.9); }
.term-thanks-check {
  width: 96px; height: 96px; border-radius: 999px; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; font-size: 3rem; margin: 0 auto;
}
.term-thanks-title { font-size: clamp(1.6rem, 6vmin, 2.6rem); font-weight: 800; margin-top: 8px; }

/* --- Horizontal (landscape): avatar y datos en fila para aprovechar el ancho --- */
@media (orientation: landscape) {
  #screenAgent {
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center; justify-items: start; text-align: left;
    gap: 0 34px; width: min(96vw, 1000px);
  }
  /* La marca ya no ocupa fila: foto e info quedan centradas (la foto sube) */
  #screenAgent .term-figure { grid-row: 1; grid-column: 1; align-self: center; }
  #screenAgent .term-info { grid-row: 1; grid-column: 2; align-self: center; align-items: flex-start; text-align: left; }
  .term-avatar { width: clamp(110px, 42vh, 240px); height: clamp(110px, 42vh, 240px); }
  .term-avatar-initial { font-size: clamp(2.6rem, 20vh, 7rem); }
  #screenAgent .term-name { font-size: clamp(1.9rem, 11vh, 4rem); }
  #screenAgent .term-hello { font-size: clamp(1rem, 4.5vh, 1.7rem); }
  #screenAgent .term-foot { margin-top: 8px; }
  /* Evaluación: compactar para que quepa a lo alto en móvil apaisado */
  .term-rate { gap: 2px; padding-bottom: 64px; } /* deja aire para el botón fijo */
  .term-rate .term-brand { margin-bottom: 0; }
  .term-rate .term-star { font-size: clamp(2.6rem, 15vh, 5rem); }
  .term-rate .term-rate-title { font-size: clamp(1.05rem, 5vh, 1.6rem); }
  .term-rate .term-name-sm { font-size: clamp(1.3rem, 6.5vh, 2.4rem); }
  .term-rate .term-stars { margin: 6px 0 2px; }
  .term-rate .term-stars-scale { margin-bottom: 0; }
  .term-rate .term-stars-hint { font-size: clamp(0.9rem, 3.6vh, 1.1rem); min-height: 1em; }
}

/* ==================================================================
   Responsive — Atención en celular
   ================================================================== */
/* Evita el desbordamiento horizontal (que en iOS hace que la página
   se "aleje"/zoom-out para caber). overflow-x:clip no rompe el topbar
   sticky (a diferencia de hidden). Las tablas anchas ya scrollean en su
   propio contenedor (.table-wrap). */
body { max-width: 100%; overflow-x: clip; }

@media (max-width: 860px) {
  /* Guarda universal (todas las versiones de iOS): el panel sticky ya está
     desactivado en móvil, así que clipar en .container es seguro. */
  .container { overflow-x: hidden; }
  .attention-layout { grid-template-columns: 1fr !important; }
  .attention-layout > *, .attention-side { min-width: 0; }   /* permite encoger dentro del grid */
  .attention-side { order: -1; position: static; }           /* panel de acción primero en móvil */
  .rank-bar { display: none; }                               /* el ranking del headbar se oculta en móvil */
  .topbar { flex-wrap: wrap; }
  .topbar-title { font-size: 0.9rem; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  /* El menú de perfil del headbar (que en móvil queda a la izquierda) se abre
     hacia la derecha y se limita al ancho de pantalla para no salirse. */
  .topbar > .profile-menu .profile-dropdown { left: 0; right: auto; max-width: calc(100vw - 20px); }
  .profile-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* La fila del puesto de atención se apila: etiqueta/selector y botón a lo ancho */
  .counter-row { flex-wrap: wrap; }
  .counter-display, .counter-edit { flex: 1 1 100%; min-width: 0; }
  .counter-row .btn { flex: 1 1 100%; }

  /* Pasar a otra cola: selector y botón a lo ancho */
  .transfer-row { flex-wrap: wrap; }
  .transfer-row select, .transfer-row .btn { flex: 1 1 100%; min-width: 0; }

  /* Botones de acción en dos filas -> una columna a lo ancho */
  .action-row { flex-direction: column; }
  .action-row .btn { width: 100%; }
}

/* ==================================================================
   App del Cliente (client/index.php) — móvil primero
   ================================================================== */
.cli-body { margin: 0; background: #eef4f7; min-height: 100vh; color: var(--ink); }
.cli-top {
  background: linear-gradient(125deg, var(--primary-dark), var(--primary));
  color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.cli-logo { height: 22px; }
.cli-company { margin-left: auto; font-weight: 600; font-size: 0.9rem; opacity: 0.95; }
.cli-main { max-width: 560px; margin: 0 auto; padding: 16px 14px 40px; }
.cli-view { animation: termFade .3s ease; }
.cli-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 10px 24px rgba(15,23,42,.08); margin-bottom: 14px; }
.cli-center { text-align: center; }
.cli-center h2 { margin: 6px 0; }
.cli-emoji { font-size: 2.6rem; }
.cli-muted { color: var(--muted); font-size: 0.92rem; }
.cli-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }
.cli-input { width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 13px 14px; font-size: 1rem; }
.cli-check { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--muted); margin-top: 12px; }
.cli-check input { width: auto; }

.cli-btn {
  width: 100%; border: none; border-radius: 999px; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 1rem;
  padding: 14px 18px; margin-top: 12px;
}
.cli-btn:hover { background: var(--primary-dark); }
.cli-btn.cli-xl { padding: 17px; font-size: 1.15rem; box-shadow: 0 10px 24px rgba(15,116,130,.28); }
.cli-btn.cli-ghost { background: #fff; color: var(--primary-dark); border: 1px solid #b7c7d9; }
.cli-btn.cli-sm { width: auto; padding: 9px 16px; font-size: 0.86rem; margin-top: 8px; }
.cli-btn:disabled { opacity: .5; cursor: not-allowed; }

#scanWrap { margin-top: 12px; }
#scanVideo { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 1/1; object-fit: cover; }

.cli-notif { background: #fffbeb; border: 1px solid #fde68a; color: #92600b; border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-size: 0.86rem; margin-bottom: 12px; }
.cli-notif .cli-btn { width: auto; margin: 0; }

/* Tarjeta de turno seguido */
.cli-ticket { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 10px 24px rgba(15,23,42,.08); margin-bottom: 12px; }
.cli-tk-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cli-tk-area { color: var(--muted); font-weight: 600; font-size: 0.86rem; }
.cli-tk-num { font-size: clamp(2.4rem, 12vw, 3.4rem); font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.cli-tk-pos { color: var(--muted); font-size: 0.95rem; }
.cli-tk-pos b { color: var(--ink); font-size: 1.15rem; }
.cli-tk-call { background: linear-gradient(125deg,#0f7482,#0b4f58); color:#fff; border-radius: 12px; padding: 12px; font-size: 1.15rem; font-weight: 700; margin-top: 6px; animation: cliPulse 1.4s infinite; }
.cli-tk-serv { background: #eef2ff; color: #3730a3; border-radius: 12px; padding: 10px; font-weight: 600; margin-top: 6px; }
.cli-tk-thanks { color: var(--ok); font-weight: 700; margin-top: 8px; }
@keyframes cliPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(15,116,130,.5); } 50% { box-shadow: 0 0 0 10px rgba(15,116,130,0); } }

.cli-badge { border-radius: 999px; padding: 3px 10px; font-size: 0.74rem; font-weight: 600; }
.cli-badge.waiting { background: #ecfeff; color: #0e7490; }
.cli-badge.called { background: #fffbeb; color: #a16207; }
.cli-badge.in_service { background: #eef2ff; color: #3730a3; }
.cli-badge.completed { background: #ecfdf5; color: #047857; }
.cli-badge.no_show, .cli-badge.cancelled { background: #fef2f2; color: #b91c1c; }

.cli-bignum { font-size: clamp(2.6rem, 14vw, 4rem); font-weight: 800; }
.cli-area { color: var(--muted); font-size: 1.05rem; margin-bottom: 6px; }

.cli-areas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.cli-area-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; border: 1px solid #cbd5e1; background: linear-gradient(160deg,#fff,#f2f8ff); border-radius: 14px; padding: 14px; cursor: pointer; }
.cli-area-card:hover { border-color: var(--primary); }
.cli-area-code { font-weight: 800; color: var(--primary-dark); font-size: 1.1rem; }
.cli-area-name { font-size: 0.92rem; }

/* Evaluación inline */
.cli-rate { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.cli-rate-title { font-weight: 600; }
.cli-rate-stars { display: flex; gap: 4px; margin: 8px 0; }
.cli-star { background: none; border: none; cursor: pointer; font-size: 2.2rem; line-height: 1; color: #d9e2ec; padding: 0 2px; }
.cli-star.on { color: #eab308; }
.cli-rate-comment { width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 10px; resize: none; min-height: 44px; }

/* ----- QR de la app del cliente en el dispensador ----- */
.cli-qr-card { text-align: center; }
.cli-qr-box { display: inline-block; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--line); }
.cli-qr-box img, .cli-qr-box canvas { display: block; }

.cli-tk-agent { margin-top: 6px; font-size: 1rem; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.cli-tk-agent::before { content: "👤"; }
.cli-tk-agent b { color: var(--primary-dark); }

/* ----- Nombre del cliente en el turno (atención y visor) ----- */
.active-customer { margin-top: 4px; font-size: 1.05rem; font-weight: 700; opacity: 0.95; }
.q-cust { font-size: 0.74rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.calling-customer {
  font-size: clamp(1.1rem, 2.6vw, 2rem); font-weight: 700; margin-top: 4px;
  opacity: 0.95; overflow-wrap: anywhere;
}

/* ----- Evaluación en estadística del colaborador ----- */
.mk-rating { background: #fefce8; border-color: #fde68a; }
.mk-rating .mk-value { color: #ca8a04; }
.ss-rate { font-size: 0.82rem; font-weight: 700; color: #ca8a04; text-align: right; white-space: nowrap; }
.ss-head .ss-rate { color: var(--muted); font-weight: 700; }
.ss-dur { padding-right: 6px; }

/* ----- Ranking dentro de la tarjeta de estadística ----- */
.ss-rank {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin-bottom: 12px; padding: 8px 10px;
  background: linear-gradient(180deg, #f0fbfd, #fff); border: 1px solid #bfe3e9; border-radius: 10px;
}
.ss-rank-link { font-weight: 700; color: var(--primary-dark); text-decoration: none; white-space: nowrap; }
.ss-rank-link:hover { text-decoration: underline; }
.ss-rank-cols { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-left: auto; font-size: 0.82rem; color: #475569; }
.ss-rank-grp b { color: var(--primary-dark); }

/* ==================================================================
   Informes y Estadísticas (informes/index.php)
   ================================================================== */
.inf-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.inf-tab { padding: 10px 18px; border-radius: 999px; background: #fff; border: 1px solid #b7c7d9; color: var(--primary-dark); font-weight: 700; text-decoration: none; }
.inf-tab:hover { border-color: var(--primary); }
.inf-tab.on { background: linear-gradient(125deg, var(--primary-dark), var(--primary)); color: #fff; border-color: transparent; }
.inf-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.inf-subtab { padding: 7px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.inf-subtab:hover { border-color: var(--primary); color: var(--primary-dark); }
.inf-subtab.on { background: #ecfeff; color: var(--primary-dark); border-color: #7cc4d1; }
.inf-export { margin-bottom: 14px; }

.inf-kpis { display: flex; flex-wrap: wrap; gap: 12px; }
.inf-kpi { background: linear-gradient(180deg, #fff, #f8fcff); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; text-align: center; min-width: 120px; }
.inf-kpi b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--primary-dark); }
.inf-kpi small { color: var(--muted); font-size: 0.76rem; }

.inf-row { display: grid; grid-template-columns: 74px 1fr 110px; align-items: center; gap: 10px; margin-bottom: 8px; }
.inf-row-label { font-weight: 700; font-size: 0.95rem; }
.inf-bar { background: #eef4f8; border-radius: 999px; height: 20px; overflow: hidden; }
.inf-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); min-width: 2px; }
.inf-row-val { text-align: right; font-size: 0.9rem; }
.inf-row-val small { color: var(--muted); }
.inf-mini-bar { display: inline-block; width: 60px; height: 8px; background: #eef4f8; border-radius: 999px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.inf-mini-bar span { display: block; height: 100%; background: #059669; }

.inf-agent-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 50vh; overflow: auto; }
.inf-agent-item { text-align: left; justify-content: flex-start; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-weight: 500; }
.inf-agent-item:hover { background: #f1f6fb; }
#agentSearch { margin-bottom: 6px; }

/* ----- Impresión de informes ----- */
.inf-print-head { display: none; }
.inf-print-title { font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.inf-print-meta { color: #444; font-size: 0.9rem; margin-top: 2px; }
.inf-print-brand { color: #777; font-size: 0.78rem; margin-top: 2px; }

@media print {
  .topbar, .inf-tabs, .inf-subtabs, #filterForm, .inf-export,
  .pgtu-modal-backdrop, .pwa-fab { display: none !important; }
  body { background: #fff; }
  .container { margin: 0; max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #d1d5db; break-inside: avoid; }
  .inf-print-head { display: block; margin-bottom: 12px; border-bottom: 2px solid var(--primary); padding-bottom: 8px; }
  /* Conservar colores de barras/indicadores al imprimir */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table { min-width: 0; }
  .rk-table th, .rk-table td { font-size: 0.72rem; padding: 5px 6px; }
  .table-wrap { overflow: visible; border: none; }
  a[href]::after { content: ""; }
  @page { margin: 12mm; }
}

/* ----- Informe de espera/atención: colores por tipo de tiempo ----- */
.inf-kpi-wait b { color: #b45309; }   /* espera - ámbar */
.inf-kpi-serv b { color: #0f7482; }   /* atención - teal */
.inf-kpi-total b { color: #4f46e5; }  /* total - índigo */
.inf-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
.inf-tag-wait { background: #fef3c7; color: #b45309; }
.inf-tag-serv { background: #ecfeff; color: #0e7490; }
.inf-tag-total { background: #eef2ff; color: #4f46e5; }
.inf-detail td { font-size: 0.8rem; }
.inf-nowrap { white-space: nowrap; }

/* Distribución por rango de tiempo (tiempos/general) — diseño moderno */
.inf-ranges { margin-top: 18px; }
.inf-ranges-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.inf-dist-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: #eef2f4; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .03); margin-bottom: 18px; }
.inf-dist-seg { height: 100%; transition: width .5s ease; }
.inf-dist-seg:not(:last-child) { box-shadow: 1px 0 0 rgba(255, 255, 255, .65); }
.inf-range-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; }
.inf-range-card { position: relative; padding: 14px 14px 12px; border-radius: 16px; background: #fff; border: 1px solid #e8eef1; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.inf-range-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: var(--rc); }
.inf-range-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -14px rgba(15, 23, 42, .3); }
.inf-range-card.is-top { border-color: var(--rc); box-shadow: inset 0 0 0 1px var(--rc); }
.inf-range-top { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.inf-range-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); flex: 0 0 auto; }
.inf-range-label { font-size: 0.82rem; font-weight: 700; color: #334155; }
.inf-range-badge { margin-left: auto; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--rc); background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }
@supports (background: color-mix(in srgb, red 10%, white)) { .inf-range-badge { background: color-mix(in srgb, var(--rc) 15%, #fff); } }
.inf-range-pct { font-size: 1.95rem; font-weight: 800; line-height: 1; color: #0f172a; }
.inf-range-pct span { font-size: 0.95rem; font-weight: 700; color: #94a3b8; margin-left: 2px; }
.inf-range-track { height: 6px; border-radius: 999px; background: #eef2f4; margin: 11px 0 8px; overflow: hidden; }
.inf-range-track > span { display: block; height: 100%; border-radius: 999px; background: var(--rc); transition: width .5s ease; }
.inf-range-count { font-size: 0.75rem; color: #64748b; font-weight: 600; }
.inf-ranges-head { align-items: flex-start; }

/* Selector de vistas (botones) */
.inf-view-btns { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #eef3f5; padding: 4px; border-radius: 12px; }
.inf-view-btn { border: none; background: transparent; color: #52606d; font-weight: 700; font-size: 0.8rem; padding: 6px 12px; border-radius: 9px; cursor: pointer; transition: background .15s ease, color .15s ease; white-space: nowrap; }
.inf-view-btn:hover { color: var(--primary-dark); }
.inf-view-btn.on { background: #fff; color: var(--primary-dark); box-shadow: 0 2px 6px -2px rgba(15, 23, 42, .2); }

/* Vista Columnas */
.inf-cols { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; align-items: end; padding-top: 6px; }
.inf-col { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.inf-col-pct { font-size: 0.85rem; font-weight: 800; color: #0f172a; }
.inf-col-track { width: 100%; max-width: 60px; height: 150px; background: #eef2f4; border-radius: 10px; display: flex; align-items: flex-end; overflow: hidden; }
.inf-col-track > span { display: block; width: 100%; min-height: 3px; background: var(--rc); border-radius: 10px 10px 0 0; transition: height .5s ease; }
.inf-col.is-top .inf-col-track { box-shadow: 0 0 0 2px var(--rc); }
.inf-col-label { font-size: 0.74rem; font-weight: 700; color: #475569; line-height: 1.2; }
.inf-col-count { font-size: 0.72rem; color: #94a3b8; font-weight: 600; }

/* Vista Dona */
.inf-donut-wrap { display: flex; flex-wrap: wrap; gap: 26px; align-items: center; padding: 10px 4px; }
.inf-donut { width: 190px; height: 190px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.inf-donut-hole { width: 120px; height: 120px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px #eef2f4; }
.inf-donut-hole b { font-size: 1.7rem; color: #0f172a; line-height: 1; }
.inf-donut-hole small { font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.inf-legend { display: grid; gap: 8px; flex: 1; min-width: 200px; }
.inf-legend-item { display: flex; align-items: center; gap: 9px; font-size: 0.85rem; }
.inf-legend-dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.inf-legend-label { color: #334155; font-weight: 600; }
.inf-legend-val { margin-left: auto; color: #0f172a; }
.inf-legend-val small { color: #94a3b8; }

/* Vista Tabla (rangos) */
.inf-range-table td .inf-range-dot { display: inline-block; vertical-align: middle; margin-right: 6px; }
.inf-range-table tr.is-top { background: #f8fafc; }
.inf-mini-track { height: 8px; border-radius: 999px; background: #eef2f4; overflow: hidden; min-width: 90px; }
.inf-mini-track > span { display: block; height: 100%; border-radius: 999px; }
.inf-comment { max-width: 320px; white-space: normal; }
.inf-check { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--primary-dark); padding: 9px 0; cursor: pointer; }
.inf-check input { width: auto; margin: 0; }

/* Lista de evaluaciones/comentarios (report=comentarios) */
.inf-comment-list { display: grid; gap: 10px; }
.inf-comment-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid #e6edf0; border-radius: 12px; background: #fbfdfe; }
.inf-comment-score { flex: 0 0 auto; min-width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: #fff; font-weight: 800; font-size: 0.9rem; }
.inf-comment-main { min-width: 0; flex: 1; }
.inf-comment-text { font-size: 0.95rem; color: #1f2937; line-height: 1.35; }
.inf-comment-text.is-empty { color: #9aa5ad; font-style: italic; }
.inf-comment-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 0.78rem; color: #64748b; align-items: center; }
.inf-comment-meta b { color: var(--primary-dark); }
.inf-comment-meta .inf-tag { font-size: 0.72rem; padding: 1px 7px; }

/* Rastros de atención por cliente (report=comentarios) */
.inf-trace-list { display: grid; gap: 14px; }
.inf-trace { padding: 0; overflow: hidden; }
.inf-trace.is-multi { border-left: 4px solid var(--primary); }
.inf-trace-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 14px 16px; background: linear-gradient(120deg, #f2f8fa, #ffffff); border-bottom: 1px solid #e6edf0; }
.inf-trace-id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.inf-trace-avatar { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: var(--primary-dark); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.inf-trace-who { min-width: 0; }
.inf-trace-who > b { font-size: 1.02rem; color: #0f172a; }
.inf-trace-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.8rem; color: #475569; margin-top: 2px; }
.inf-trace-stats { display: flex; gap: 8px; align-items: center; }
.inf-trace-chip { background: #e2edf0; color: var(--primary-dark); font-weight: 700; font-size: 0.8rem; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.inf-trace-rows { display: grid; gap: 10px; padding: 14px 16px; }

/* ==================================================================
   Ranking Live (ATP) — ranking/live.php
   ================================================================== */
.live-hero { text-align: center; margin-bottom: 16px; }
.live-toggle { display: inline-flex; gap: 4px; margin-top: 12px; background: #e8f1f4; border-radius: 999px; padding: 4px; }
.live-tab { border: none; background: transparent; color: var(--primary-dark); font-weight: 700; padding: 8px 22px; border-radius: 999px; cursor: pointer; }
.live-tab.on { background: linear-gradient(125deg, var(--primary-dark), var(--primary)); color: #fff; }

.live-av { width: 44px; height: 44px; border-radius: 999px; object-fit: cover; background: #dbeafe; }
.live-av.sm { width: 40px; height: 40px; }
.live-av.lg { width: 66px; height: 66px; }
.live-av-ini { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; border: 1px solid rgba(255,255,255,.5); }
.live-av.lg.live-av-ini { font-size: 1.6rem; }
.live-flag {
  display: inline-block; font-size: 0.7rem; font-weight: 700; color: #0b5563;
  background: #ecfeff; border: 1px solid #a5f3fc; border-radius: 6px; padding: 1px 8px;
  position: relative; padding-left: 16px;
}
.live-flag::before { content: "⚑"; position: absolute; left: 5px; color: var(--primary); }

/* Podio */
.live-podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; margin-bottom: 16px; }
.live-pod { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: linear-gradient(180deg,#fff,#f4fafc); border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; }
.live-pod.p1 { padding-bottom: 26px; border-color: #fcd34d; box-shadow: 0 8px 20px rgba(234,179,8,.18); }
.live-pod.p2 { padding-bottom: 16px; }
.live-pod.p3 { padding-bottom: 10px; }
.live-pod.empty { opacity: .4; min-height: 120px; }
.live-pod.me { outline: 2px solid var(--primary); }
.live-pod-medal { font-size: 1.5rem; }
.live-pod-name { font-weight: 800; font-size: 0.9rem; line-height: 1.1; }
.live-pod-score { color: var(--primary-dark); font-weight: 700; font-size: 0.85rem; }

/* Lista */
.live-list { display: flex; flex-direction: column; }
.live-row { display: grid; grid-template-columns: 40px 40px 1fr auto auto; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid #eef2f7; }
.live-row:last-child { border-bottom: none; }
.live-row.me { background: #ecfeff; border-radius: 10px; }
.live-rank { font-weight: 800; font-size: 1.05rem; text-align: center; color: #334155; }
.live-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-you { background: var(--primary); color: #fff; font-size: 0.62rem; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.live-metrics { display: flex; gap: 10px; font-size: 0.78rem; color: #475569; white-space: nowrap; }
.live-score { font-weight: 800; font-size: 1.2rem; color: var(--primary-dark); text-align: right; }
.live-score small { font-size: 0.6rem; color: var(--muted); font-weight: 600; margin-left: 2px; }
@media (max-width: 560px) {
  .live-metrics { display: none; }
  .live-row { grid-template-columns: 34px 40px 1fr auto; }
}

/* Mi estadística */
.mi-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
