/* =========================================================
   panel.css  — Estilos comunes para CDR, Colas y Extensiones
   ========================================================= */

/* =========================================================
   LAYOUT CON SIDEBAR
   Sidebar fijo a la izquierda + topbar sticky. El contenido se empuja con
   padding en el body (clase añadida por navbar.html). En móvil el sidebar es
   off-canvas con overlay.
   ========================================================= */
:root { --app-sidebar-w: 16rem; --app-sidebar-w-collapsed: 4.5rem; }

.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--app-sidebar-w);
  display: flex;
  flex-direction: column;
  z-index: 50;
  background: var(--app-sidebar-bg, #1c1a17);
  color: var(--app-sidebar-text, #fff);
  overflow: hidden;
  border-right: 1px solid color-mix(in srgb, var(--app-sidebar-text, #fff) 10%, transparent);
  box-shadow: 12px 0 32px -28px rgb(15 23 42 / .9);
  transition: transform 0.25s ease, width 0.25s ease, box-shadow 0.25s ease;
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  position: relative;
  height: 4rem;
  padding: 0 1rem;
  flex-shrink: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--app-sidebar-text, #fff) 10%, transparent);
}
.app-sidebar__brand img { height: 1.8rem; width: auto; max-width: 11.5rem; object-fit: contain; }
.app-sidebar__brand .app-brand-icon { display: none; height: 2rem; max-width: 2.4rem; }
.app-sidebar__close {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .65rem;
  color: inherit;
  opacity: .72;
}
.app-sidebar__close:hover { background: color-mix(in srgb, var(--app-sidebar-text, #fff) 12%, transparent); opacity: 1; }

.app-sidebar__nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: .7rem .65rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.app-sidebar__footer {
  flex-shrink: 0;
  padding: .7rem .65rem;
  border-top: 1px solid color-mix(in srgb, var(--app-sidebar-text, #fff) 10%, transparent);
  background: color-mix(in srgb, var(--app-sidebar-bg, #1c1a17) 88%, #000);
}

.app-nav-item {
  display: flex;
  align-items: center;
  position: relative;
  gap: .7rem;
  min-height: 2.5rem;
  padding: .55rem .7rem;
  border-radius: .65rem;
  font-size: .8125rem;
  font-weight: 560;
  color: color-mix(in srgb, var(--app-sidebar-text, #fff) 72%, transparent);
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.app-nav-item:hover { background: color-mix(in srgb, var(--app-sidebar-text, #fff) 9%, transparent); color: var(--app-sidebar-text, #fff); }
.app-nav-item.is-active {
  background: color-mix(in srgb, var(--app-sidebar-text, #fff) 15%, transparent);
  color: var(--app-sidebar-text, #fff);
  font-weight: 700;
}
.app-nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  width: .2rem;
  height: 1.15rem;
  border-radius: 999px;
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgb(96 165 250 / .14);
}
.app-nav-item svg, .app-nav-item [data-lucide] { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.app-nav-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-nav-section {
  padding: .1rem .7rem .35rem;
  font-size: .625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: color-mix(in srgb, var(--app-sidebar-text, #fff) 46%, transparent);
}

.app-nav-group { display: flex; flex-direction: column; gap: 2px; }
.app-nav-group--primary { margin-bottom: .1rem; }
.app-nav-group--collapsible { gap: 0; }
.app-nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 2rem;
  padding: .25rem .7rem .35rem;
  color: color-mix(in srgb, var(--app-sidebar-text, #fff) 52%, transparent);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
  transition: color .15s ease;
}
.app-nav-group-toggle:hover { color: var(--app-sidebar-text, #fff); }
.app-nav-group-toggle svg { width: .9rem; height: .9rem; transition: transform .18s ease; }
.app-nav-group--collapsible.is-open .app-nav-group-toggle svg { transform: rotate(180deg); }
.app-nav-group__items { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.app-nav-group--collapsible.is-collapsed .app-nav-group__items { display: none; }
.app-nav-profile { min-height: 3.4rem; padding-top: .45rem; padding-bottom: .45rem; }
.app-nav-profile:hover { transform: translateY(-1px); }

.app-nav-item--logout { color: color-mix(in srgb, var(--app-sidebar-text, #fff) 62%, transparent); }
.app-nav-item--logout:hover {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af; /* rose-300 */
}

/* Topbar sticky en el área de contenido */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 3.25rem;
  padding: 0 1rem;
  background: #fff;
  border-bottom: 1px solid rgb(226 232 240);
}

.app-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.app-sidebar-overlay.is-open { opacity: 1; pointer-events: auto; }

/* Móvil: sidebar oculto fuera de pantalla */
@media (max-width: 1023px) {
  .app-sidebar {
    width: min(19rem, calc(100vw - 2.5rem));
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  }
  .app-sidebar.is-open { transform: translateX(0); }
  body.sidebar-mobile-open { overflow: hidden; }
}

/* Desktop: el contenido deja sitio al sidebar y se oculta el overlay */
@media (min-width: 1024px) {
  /* :has() empuja sin esperar al JS (sin salto); la clase es el fallback. */
  body.has-sidebar,
  body:has(.app-sidebar) {
    padding-left: var(--app-sidebar-w);
    transition: padding-left 0.25s ease;
  }
  .app-sidebar-overlay { display: none; }
  .app-topbar__burger { display: none; }

  /* Sidebar colapsado: se queda como "rail" estrecho, solo iconos. */
  body.sidebar-collapsed.has-sidebar,
  body.sidebar-collapsed:has(.app-sidebar) { padding-left: var(--app-sidebar-w-collapsed); }
  body.sidebar-collapsed .app-sidebar { width: var(--app-sidebar-w-collapsed); }
  body.sidebar-collapsed .app-sidebar__nav { padding-left: .55rem; padding-right: .55rem; gap: .45rem; }
  body.sidebar-collapsed .app-nav-item { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
  body.sidebar-collapsed .app-nav-item > span:not(.app-nav-avatar) { display: none; }
  body.sidebar-collapsed .app-nav-section {
    height: 1px; padding: 0; margin: .3rem .15rem;
    background: color-mix(in srgb, var(--app-sidebar-text, #fff) 16%, transparent); color: transparent; overflow: hidden;
  }
  body.sidebar-collapsed .app-sidebar__brand { justify-content: center; padding: 0 .4rem; }
  body.sidebar-collapsed .app-sidebar__brand .app-brand-full { display: none; }
  body.sidebar-collapsed .app-sidebar__brand .app-brand-icon { display: block; }
  body.sidebar-collapsed .app-nav-group-toggle { display: none; }
  body.sidebar-collapsed .app-nav-group--collapsible .app-nav-group__items { display: flex !important; }
  body.sidebar-collapsed .app-nav-profile { min-height: 2.75rem; }
  body.sidebar-collapsed .app-nav-profile .app-nav-avatar { display: inline-flex; }
  body.sidebar-collapsed .app-nav-item.is-active::before { left: -.55rem; }
}

/* Tipografía / suavizado 
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
*/

body {
  font-family: "Inter", "Roboto", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f1f5f9;
  /* si ya lo tienes */
  color: #0f172a;
}

/* -------------------- Layout base de paneles -------------------- */

.panel {
  background-color: #ffffff;
  border-radius: 0.75rem;
  /* ~ rounded-xl */
  border: 1px solid #e2e8f0;
  /* slate-200 */
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  /* shadow-sm */
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  /* slate-100 */
  background-color: rgba(248, 250, 252, 0.8);
  /* slate-50 */
}

.panel-header-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  /* slate-500 */
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-body {
  padding: 1.5rem;
}

/* -------------------- Botones genéricos -------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  color: #f9fafb;
  background-color: #1f2937;
  /* slate-800 */
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
}

.btn-primary:hover {
  background-color: #020617;
  /* slate-950 */
  box-shadow: 0 4px 6px rgba(15, 23, 42, 0.35);
  transform: translateY(-0.5px);
}

.btn-primary:disabled,
.btn-primary[disabled] {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

/* Botón tipo chip (filtros, toggles…) */
.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  /* slate-200 */
  background-color: #f9fafb;
  /* slate-50 */
  font-size: 0.625rem;
  font-weight: 500;
  color: #475569;
  /* slate-600 */
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.btn-chip:hover {
  background-color: #f1f5f9;
  /* slate-100 */
  border-color: #cbd5e1;
  /* slate-300 */
  color: #0f172a;
  /* slate-900 */
}

/* Chips de estado tipo "Sistema activo", "AMI conectado" */
.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* -------------------- Scroll fino (colas, listados largos) -------------------- */

.slim-scroll {
  scrollbar-width: thin;
  /* Firefox */
  scrollbar-color: #e2e8f0 transparent;
  /* Firefox */
}

.slim-scroll::-webkit-scrollbar {
  width: 4px;
}

.slim-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.slim-scroll::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  /* slate-300 */
  border-radius: 9999px;
}

.slim-scroll::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
  /* slate-400 */
}

/* -------------------- Animaciones (extensiones) -------------------- */

@keyframes flash-online {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    /* emerald-400 */
    transform: scale(1);
    border-color: #34d399;
  }

  50% {
    box-shadow: 0 0 25px 5px rgba(52, 211, 153, 0.4);
    transform: scale(1.05);
    border-color: #10b981;
    /* emerald-500 */
    z-index: 10;
  }

  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    transform: scale(1);
  }
}

.just-connected {
  animation: flash-online 2s ease-out forwards;
}

@keyframes pulse-orange-border {
  0% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    /* orange-500 */
  }

  70% {
    box-shadow: 0 0 0 6px rgba(249, 115, 22, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
  }
}

.in-call-anim {
  animation: pulse-orange-border 2s infinite;
  z-index: 5;
}

/* -------------------- DataTables (CDR) -------------------- */
/* Copiado de cdr.html para que tenga el mismo look en todas :contentReference[oaicite:1]{index=1} */

.dt-button {
  background-color: white !important;
  color: #475569 !important;
  /* slate-600 */
  border: 1px solid #e2e8f0 !important;
  /* slate-200 */
  border-radius: 0.5rem !important;
  padding: 0.4rem 0.8rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s !important;
}

.dt-button:hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

/* Menú de columnas */
div.dt-button-collection {
  width: 200px !important;
  background: white !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

div.dt-button-collection button.dt-button {
  border: none !important;
  background: transparent !important;
  width: 100%;
  text-align: left;
  margin: 0 !important;
  padding: 0.5rem !important;
  color: #64748b !important;
}

div.dt-button-collection button.dt-button:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

div.dt-button-collection button.dt-button.dt-button-active {
  font-weight: bold !important;
  color: #2563eb !important;
  /* blue-600 */
  background-color: #eff6ff !important;
  /* blue-50 */
}

/* Paginación */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: #334155 !important;
  /* slate-700 */
  color: white !important;
  border: 1px solid #334155 !important;
  border-radius: 0.375rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 0.375rem !important;
  border: 1px solid #e2e8f0 !important;
  background: white !important;
  margin: 0 2px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Inputs y selects */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  color: #334155;
  background-color: #ffffff;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  outline: none;
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}

/* Tabla */
table.dataTable.no-footer {
  border-bottom: 1px solid #e2e8f0 !important;
}

table.dataTable thead th {
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #64748b !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  font-size: 0.65rem !important;
  letter-spacing: 0.05em;
  padding: 12px 16px !important;
}

table.dataTable tbody td {
  padding: 10px 16px !important;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

/* -------------------- Drag & Drop Indicators -------------------- */

/* Indicador de drop arriba */
.drop-indicator-top {
  position: relative;
  transition: all 0.2s ease;
}

.drop-indicator-top::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  /* blue-600 to blue-400 */
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  z-index: 50;
  animation: pulse-drop-indicator 1s ease-in-out infinite;
}

/* Indicador de drop abajo */
.drop-indicator-bottom {
  position: relative;
  transition: all 0.2s ease;
}

.drop-indicator-bottom::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  /* blue-600 to blue-400 */
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  z-index: 50;
  animation: pulse-drop-indicator 1s ease-in-out infinite;
}

/* Indicador de drop izquierda (para vista grid) */
.drop-indicator-left {
  position: relative;
  transition: all 0.2s ease;
}

.drop-indicator-left::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #3b82f6, #60a5fa);
  /* blue-600 to blue-400 */
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  z-index: 50;
  animation: pulse-drop-indicator 1s ease-in-out infinite;
}

/* Indicador de drop derecha (para vista grid) */
.drop-indicator-right {
  position: relative;
  transition: all 0.2s ease;
}

.drop-indicator-right::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #3b82f6, #60a5fa);
  /* blue-600 to blue-400 */
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  z-index: 50;
  animation: pulse-drop-indicator 1s ease-in-out infinite;
}

/* Animación del indicador de drop */
@keyframes pulse-drop-indicator {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  }

  50% {
    opacity: 0.7;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.8);
  }
}

/* Transiciones suaves para las tarjetas */
[draggable="true"] {
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: grab;
}

[draggable="true"]:active {
  cursor: grabbing;
}

/* Efecto de escala durante el drag */
.scale-95 {
  transform: scale(0.95);
}

/* -------------------- Vista Grid - Mejoras -------------------- */

/* En vista grid, las tarjetas tienen mejor hover */
[data-queue-name] {
  transition: all 0.2s ease;
}

/* Mejorar el espaciado en vista grid */
.grid [data-queue-name] {
  min-height: 180px;
}

/* Hover más pronunciado en vista grid */
.grid [data-queue-name]:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.15);
}

/* Altura fija para tarjetas en vista grid */
.grid [data-queue-name] {
  height: 380px;
  display: flex;
  flex-direction: column;
}

/* Contenedor de extensiones con scroll */
.grid [data-queue-name] .members-container {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.grid [data-queue-name] .members-container::-webkit-scrollbar {
  width: 4px;
}

.grid [data-queue-name] .members-container::-webkit-scrollbar-track {
  background: transparent;
}

.grid [data-queue-name] .members-container::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}

.grid [data-queue-name] .members-container::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

/* Título en vista grid: permitir ajuste de texto */
.grid [data-queue-name] h2 {
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

@keyframes pulse-red-border {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.in-call-anim-red {
  animation: pulse-red-border 2s infinite;
  z-index: 5;
}

/* Animación de vibración para teléfono sonando */
@keyframes phone-ring {

  0%,
  100% {
    transform: rotate(0deg);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: rotate(-12deg);
  }

  20%,
  40%,
  60%,
  80% {
    transform: rotate(12deg);
  }
}

.phone-ringing {
  animation: phone-ring 1s ease-in-out infinite;
  transform-origin: center center;
}

/* -------------------- Polish operativo: extensiones / colas -------------------- */

.active-calls-shell {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px -18px rgba(15, 23, 42, 0.35);
}

.active-calls-shell__header {
  min-height: 2.25rem;
}

.active-call-row {
  isolation: isolate;
}

.active-call-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: #94a3b8;
}

.active-call-row--orange::before { background: #f59e0b; }
.active-call-row--red::before { background: #e11d48; }
.active-call-row--blue::before { background: #2563eb; }

/* ============ TOOLTIP DIDÁCTICO PARA MÉTRICAS ============
   Icono ⓘ junto a la etiqueta de un KPI. El texto se muestra con un tooltip
   SINGLETON position:fixed (ui-feedback.js) para que nunca lo recorten los
   contenedores con overflow-hidden (tarjetas KPI, drawers, tablas). */
.kpi-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  vertical-align: -2px;
  color: #cbd5e1;
  cursor: help;
  border-radius: 9999px;
}
.kpi-help:hover, .kpi-help:focus-visible { color: #64748b; }
.kpi-help svg { width: 13px; height: 13px; }

/* El globo del tooltip (creado una sola vez por ui-feedback.js) */
.app-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  background: #0f172a;
  color: #e2e8f0;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  max-width: 250px;
  text-align: left;
  pointer-events: none;
  box-shadow: 0 6px 20px -4px rgb(15 23 42 / 0.35);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.app-tooltip.is-visible { opacity: 1; }

/* Chips de filtro del Centro IA */
.ia-chip {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ia-chip:hover { background: #f8fafc; }
.ia-chip.is-active {
  background: #2456eb;
  border-color: #2456eb;
  color: #fff;
}

/* Drawer de perfil de agente */
.ap-range-chip {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.ap-range-chip:hover { background: #f8fafc; }
.ap-range-chip.is-active {
  background: #2456eb;
  border-color: #2456eb;
  color: #fff;
}
.ap-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* Entrada suave al aparecer una llamada nueva */
.active-call-row.is-entering {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
}

/* Salida: al colgar la llamada se desvanece y colapsa (no desaparece de golpe) */
.active-call-row.is-leaving {
  animation: activeCallOut 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  overflow: hidden;
  pointer-events: none;
}

@keyframes activeCallOut {
  0% {
    opacity: 1;
    max-height: 220px;
  }
  100% {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .active-call-row.is-leaving { animation-duration: 0.01ms; }
  .active-call-row.is-entering { opacity: 1; transform: none; }
}

.extension-status-card {
  transform: translateZ(0);
}

.extension-status-card:hover {
  border-color: #bfd6fe;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 12px 24px -12px rgba(15, 23, 42, 0.16);
}

.extension-status-card__band {
  min-height: 1.85rem;
}

.extension-status-card__body {
  min-height: 6.75rem;
}

.queue-overview-card {
  min-height: 0;
}

.queue-overview-card--waiting {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 22px -18px rgba(217, 119, 6, 0.55);
}

.queue-waiting-block {
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.65), rgba(255, 255, 255, 0));
  border-radius: 0.75rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.queue-waiting-call {
  box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.55);
}

/* -------------------- Admin usuarios -------------------- */

.admin-users-stat {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px -20px rgba(15, 23, 42, 0.28);
}

.admin-user-row {
  transition: background-color 140ms ease;
}

.admin-user-row:hover {
  background: #f8fafc;
}

/* -------------------- Toasts -------------------- */

.app-toast {
  animation: app-toast-in 180ms ease-out both;
}

.app-toast--leaving {
  animation: app-toast-out 180ms ease-in both;
}

@keyframes app-toast-in {
  from {
    opacity: 0;
    transform: translateY(-0.35rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes app-toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-0.35rem) scale(0.98);
  }
}

@media (max-width: 640px) {
  .active-call-row {
    padding-left: 1rem;
  }

  .extension-status-card__body {
    min-height: auto;
  }
}

/* -------------------- Morph Extensiones (tarjeta <-> círculo) --------------------
   Anima el cambio a Modo supervisión con la View Transitions API. La clase
   .ext-vt-active (en <html>) acota el ajuste de duración/curva al toggle, para
   no afectar a otras transiciones de la página. */
:root.ext-vt-active::view-transition-group(*) {
  animation-duration: 480ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

:root.ext-vt-active::view-transition-image-pair(*) {
  animation-duration: 480ms;
}

/* El contenido (banda + nombre frente al número) cruza con un fundido suave */
:root.ext-vt-active::view-transition-old(*),
:root.ext-vt-active::view-transition-new(*) {
  animation-duration: 340ms;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  :root.ext-vt-active::view-transition-group(*),
  :root.ext-vt-active::view-transition-image-pair(*),
  :root.ext-vt-active::view-transition-old(*),
  :root.ext-vt-active::view-transition-new(*) {
    animation: none !important;
  }
}

/* -------------------- Skeletons (placeholders de carga) --------------------
   Bloque gris con un brillo que recorre de izquierda a derecha. Se usa para
   el primer pintado de extensiones/colas mientras llegan los datos. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e8edf3;
  border-radius: 6px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: skeleton-shimmer 1.3s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}

/* -------------------- Selector global de empresa -------------------- */
.app-company-chevron { transition: transform 0.18s ease; }
#app-company-trigger[aria-expanded="true"] .app-company-chevron { transform: rotate(180deg); }

#app-company-menu:not(.hidden) {
  animation: app-company-menu-in 140ms ease-out both;
  transform-origin: top left;
}
@keyframes app-company-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -------------------- Spinner de botón (estado de carga) -------------------- */
.ui-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.125em;
  animation: ui-spin 0.6s linear infinite;
}

@keyframes ui-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ui-spinner { animation-duration: 1.2s; }
}

/* -------------------- Transición entre páginas --------------------
   Cross-fade suave al navegar entre páginas (View Transitions MPA) en los
   navegadores que lo soportan. En el resto, navegación normal sin cambios.
   Los view-transition-name propios (extensiones) se limpian en 'pageswap'
   desde ui-feedback.js para que esta transición sea un fundido limpio. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: ease;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
