/* ==========================================================================
   QUICK RABBIT 2026 — capa visual de la página de incidencias
   Aplicación horizontal a pantalla completa: la página nunca hace scroll;
   cada columna (resumen, registro, envío) desplaza su propio contenido.
   Tarjetas blancas sobre lienzo gris frío, tinta azul noche para la acción
   principal, zanahoria para marca y foco, verde ruta para "completo".
   Tipografía: Figtree (una sola familia, cifras tabulares en datos).
   Sustituye a layout.css y dark-mode.css solo en index.html.
   ========================================================================== */

:root {
  /* Paleta base */
  --qr-canvas: #F3F4F6;
  --qr-paper: #FFFFFF;
  --qr-paper-2: #F7F8FA;
  --qr-ink: #1B1C29;
  --qr-ink-hover: #2C2E40;
  --qr-on-ink: #FFFFFF;
  --qr-text-2: #474B5B;
  --qr-muted: #5C6070;
  --qr-line: #E3E5EA;
  --qr-line-strong: #CDD0D8;
  --qr-chip: #ECEEF2;
  --qr-carrot: #E4570B;
  --qr-carrot-text: #B4430A;
  --qr-carrot-soft: #FFF1E8;
  --qr-route: #1F6B4B;
  --qr-route-soft: #E7F2EC;
  --qr-amber: #B7791F;
  --qr-focus: rgba(228, 87, 11, 0.28);

  /* Canales (paleta categórica validada: claro sobre #FFFFFF, CVD ≥ 9.5) */
  --ch-email: #3563D6;
  --ch-wa: #1C8A64;
  --ch-dsp: #D9540A;

  /* Movimiento */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Geometría */
  --qr-r-card: 18px;
  --qr-r-inner: 14px;
  --qr-r-field: 12px;
  --qr-topbar-h: 60px;

  /* Tokens heredados (components.css, JS con estilos inline) */
  --font-sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: var(--font-sans);
  --primary: var(--qr-carrot);
  --primary-hover: #C2470A;
  --primary-light: var(--qr-carrot-soft);
  --primary-text: var(--qr-carrot-text);
  --primary-glow: rgba(228, 87, 11, 0.18);
  --primary-glow-focus: var(--qr-focus);
  --bg-app: var(--qr-canvas);
  --bg-cream: var(--qr-canvas);
  --bg-surface: var(--qr-paper);
  --card-bg: var(--qr-paper);
  --sidebar-bg: var(--qr-paper);
  --bg-surface-subtle: var(--qr-paper-2);
  --bg-surface-inset: var(--qr-canvas);
  --bg-surface-elevated: var(--qr-paper);
  --border-color: var(--qr-line);
  --border-subtle: #EEF0F3;
  --border-strong: var(--qr-line-strong);
  --border-accent: rgba(228, 87, 11, 0.4);
  --border-focus: var(--qr-carrot);
  --text-primary: var(--qr-ink);
  --text-dark: var(--qr-ink);
  --text-secondary: var(--qr-text-2);
  --text-muted: var(--qr-muted);
  --text-light: #8A8E9C;
  --text-inverse: #FFFFFF;
  --btn-dark: var(--qr-ink);
  --btn-dark-hover: var(--qr-ink-hover);
  --btn-dark-text: var(--qr-on-ink);
  --success: var(--qr-route);
  --success-hover: #185A3E;
  --success-bg: var(--qr-route-soft);
  --success-border: #BFDCCB;
  --success-text: #185A3E;
  --accent-lime: var(--qr-route);
  --accent-lime-bg: var(--qr-route-soft);
  --accent-lime-text: #185A3E;
  --shadow-subtle: 0 1px 2px rgba(27, 28, 41, 0.04);
  --shadow-sm: 0 1px 2px rgba(27, 28, 41, 0.05);
  --shadow-md: 0 4px 12px -4px rgba(27, 28, 41, 0.10);
  --shadow-lg: 0 16px 40px -12px rgba(27, 28, 41, 0.22), 0 2px 6px rgba(27, 28, 41, 0.05);
  --shadow-command: var(--shadow-lg);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

body.dark-mode {
  --qr-canvas: #111218;
  --qr-paper: #1A1B24;
  --qr-paper-2: #20212C;
  --qr-ink: #F1F1F4;
  --qr-ink-hover: #FFFFFF;
  --qr-on-ink: #15161E;
  --qr-text-2: #C6C8D2;
  --qr-muted: #9C9FAD;
  --qr-line: #2C2E3B;
  --qr-line-strong: #3B3E4E;
  --qr-chip: #262836;
  --qr-carrot: #F2803F;
  --qr-carrot-text: #F59A63;
  --qr-carrot-soft: rgba(242, 128, 63, 0.14);
  --qr-route: #52B786;
  --qr-route-soft: rgba(82, 183, 134, 0.14);
  --qr-amber: #E0A54A;
  --qr-focus: rgba(242, 128, 63, 0.35);

  /* Canales en oscuro (validados sobre #1A1B24) */
  --ch-email: #5B84E6;
  --ch-wa: #2FA074;
  --ch-dsp: #E06A28;

  --primary-hover: #F59A63;
  --border-subtle: #242633;
  --text-light: #767A89;
  --text-inverse: #15161E;
  --success-hover: #6FC99B;
  --success-border: rgba(82, 183, 134, 0.35);
  --success-text: #7AD0A5;
  --accent-lime-text: #7AD0A5;
  --danger: #F87171;
  --danger-hover: #FCA5A5;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.35);
  --danger-text: #FCA5A5;
  --warning: #E0A54A;
  --warning-bg: rgba(224, 165, 74, 0.12);
  --warning-border: rgba(224, 165, 74, 0.35);
  --warning-text: #F0C27E;
  --info: #60A5FA;
  --info-bg: rgba(96, 165, 250, 0.12);
  --info-border: rgba(96, 165, 250, 0.35);
  --info-text: #93C5FD;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

html:has(body.dark-mode) {
  color-scheme: dark;
}

/* ==========================================================================
   Armazón: la página ocupa exactamente la ventana y no desplaza
   ========================================================================== */
html:root,
html body.qr-app {
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.qr-app {
  display: grid !important;
  grid-template-rows: var(--qr-topbar-h) minmax(0, 1fr) auto;
  height: 100vh !important;
  height: 100dvh !important;
  background: var(--qr-canvas);
  color: var(--qr-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 200ms ease, color 200ms ease;
}

body.qr-app button,
body.qr-app input,
body.qr-app select,
body.qr-app textarea {
  font-family: inherit;
}

body.qr-app button,
body.qr-app a,
body.qr-app label,
body.qr-app [role="tab"],
body.qr-app [role="option"] {
  touch-action: manipulation;
}

body.qr-app .material-symbols-outlined {
  font-size: 20px;
  vertical-align: middle;
}

body.qr-app ::selection {
  background: var(--qr-carrot-soft);
  color: var(--qr-ink);
}

body.qr-app :focus-visible {
  outline: 2px solid var(--qr-carrot);
  outline-offset: 2px;
}

.qr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.qr-skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10001;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-weight: 600;
  text-decoration: none;
  transition: transform 200ms var(--ease-out);
}

.qr-skip:focus-visible {
  transform: translateY(64px);
}

/* Barras de desplazamiento discretas en las columnas */
body.qr-app .qr-col-scroll,
body.qr-app .qr-history-list,
body.qr-app .qr-listbox,
body.qr-app .modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--qr-line-strong) transparent;
}

/* ==========================================================================
   Barra superior
   ========================================================================== */
.qr-topbar {
  position: relative;
  z-index: 900;
  display: flex;
  align-items: stretch;
  gap: 20px;
  min-width: 0;
  padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  background: var(--qr-paper);
  border-bottom: 1px solid var(--qr-line);
}

.qr-topbar > * {
  align-self: center;
}

.qr-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--qr-ink);
  text-decoration: none;
  flex-shrink: 0;
  border-radius: 999px;
}

.qr-brand-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}

/* La cola de la Q: un punto zanahoria, la única nota de marca */
.qr-brand-mark::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--qr-carrot);
  border: 2px solid var(--qr-paper);
}

.qr-brand-mark-lg {
  width: 52px;
  height: 52px;
  font-size: 24px;
}

.qr-brand-mark-lg::after {
  width: 14px;
  height: 14px;
}

.qr-brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Canales: pestañas subrayadas a toda la altura de la barra */
body.qr-app .qr-channels.nav-tabs {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.qr-app .qr-channels .tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: auto;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--qr-muted);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease;
}

body.qr-app .qr-channels .tab-btn .material-symbols-outlined {
  font-size: 18px;
}

body.qr-app .qr-channels .tab-btn::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--qr-ink);
  transform: scaleX(0);
  transition: transform 200ms var(--ease-out);
}

body.qr-app .qr-channels .tab-btn.active {
  color: var(--qr-ink);
  font-weight: 600;
  background: transparent;
  box-shadow: none;
}

body.qr-app .qr-channels .tab-btn.active::after {
  transform: scaleX(1);
}

.qr-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 340px;
  min-width: 0;
  height: 42px;
  margin-left: auto;
  padding: 0 8px 0 14px;
  border: 1px solid var(--qr-line-strong);
  border-radius: 999px;
  background: var(--qr-paper-2);
  color: var(--qr-muted);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}

.qr-search .material-symbols-outlined {
  color: var(--qr-text-2);
}

.qr-search-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-search kbd {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  color: var(--qr-muted);
  box-shadow: none;
  white-space: nowrap;
}

.qr-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Estado de sincronización con la nube */
.qr-sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--qr-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.qr-sync-chip .material-symbols-outlined { font-size: 18px; }
.qr-sync-chip[data-state="ok"] .material-symbols-outlined { color: var(--qr-route); }
.qr-sync-chip[data-state="busy"] { color: var(--qr-text-2); }
.qr-sync-chip[data-state="offline"],
.qr-sync-chip[data-state="warn"] { background: var(--warning-bg); color: var(--warning-text); }
.qr-sync-chip[data-state="error"] { background: var(--danger-bg); color: var(--danger); }

@media (hover: hover) and (pointer: fine) {
  .qr-sync-chip:hover { background: var(--qr-chip); color: var(--qr-ink); }
}

@media (max-width: 1220px) {
  .qr-sync-chip[data-state="ok"] .qr-sync-text,
  .qr-sync-chip[data-state="busy"] .qr-sync-text { display: none; }
  .qr-sync-chip { padding: 0 8px; }
}

.qr-menu-wrap {
  position: relative;
}

.qr-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--qr-text-2);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
}

.qr-icon-btn-sm {
  width: 36px;
  height: 36px;
}

.qr-icon-btn-sm .material-symbols-outlined {
  font-size: 19px;
}

.qr-icon-btn[aria-expanded="true"] {
  background: var(--qr-chip);
  color: var(--qr-ink);
}

.qr-icon-btn.qr-danger {
  color: var(--danger);
}

.qr-icon-btn.is-confirming {
  width: auto;
  display: inline-flex;
  gap: 4px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.qr-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}

/* ==========================================================================
   Cuenta del agente (disparador + panel)
   ========================================================================== */
body.qr-app .agent-switcher-wrap {
  position: relative;
  display: inline-flex;
  margin-left: 6px;
}

body.qr-app .btn-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 8px 0 3px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--qr-ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}

body.qr-app .profile-avatar-mini {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--qr-chip);
  color: var(--qr-text-2);
  font-size: 14px;
  font-weight: 700;
  border: 0;
  box-shadow: none;
}

body.qr-app .profile-name-mini {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.qr-app .switcher-caret {
  font-size: 20px;
  color: var(--qr-muted);
  transition: transform 200ms var(--ease-out);
}

body.qr-app .btn-profile-pill[aria-expanded="true"] {
  background: var(--qr-chip);
}

body.qr-app .btn-profile-pill[aria-expanded="true"] .switcher-caret {
  transform: rotate(180deg);
}

.qr-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--qr-chip);
  color: var(--qr-text-2);
  font-weight: 700;
}

.qr-avatar-md { width: 36px; height: 36px; font-size: 14px; }
.qr-avatar-lg { width: 48px; height: 48px; font-size: 18px; background: var(--qr-ink); color: var(--qr-on-ink); }

.qr-account-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--qr-line);
}

.qr-account-current:empty {
  display: none;
}

.qr-account-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.qr-account-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--qr-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.qr-account-role {
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-session-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: var(--qr-route-soft);
  color: var(--success-text);
  font-size: 12px;
  font-weight: 600;
}

.qr-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--qr-route);
}

.qr-account-label {
  padding: 12px 16px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--qr-muted);
}

.qr-account-empty {
  padding: 8px 16px 12px;
  font-size: 14px;
  color: var(--qr-muted);
}

body.qr-app .agent-switcher-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px 8px;
  max-height: 280px;
  overflow-y: auto;
}

body.qr-app .agent-switcher-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--qr-ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, transform 160ms var(--ease-out);
}

body.qr-app .agent-switcher-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.qr-app .agent-switcher-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--qr-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.qr-app .agent-switcher-item-role {
  font-size: 12px;
  color: var(--qr-muted);
}

.qr-account-go {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--qr-line-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-ink);
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

body.qr-app .agent-switcher-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--qr-line);
  background: transparent;
}

body.qr-app .agent-switcher-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--qr-ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

body.qr-app .agent-switcher-footer-btn .material-symbols-outlined {
  font-size: 18px;
}

body.qr-app .agent-switcher-footer-btn.danger {
  color: var(--danger);
}

/* ==========================================================================
   Menús flotantes. Entrada: escala desde el disparador, 180 ms ease-out.
   ========================================================================== */
body.qr-app .header-dropdown-menu,
body.qr-app .agent-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 260px;
  padding: 6px;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: none;
  opacity: 1;
  transform: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

body.qr-app .agent-switcher-menu {
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 0;
  gap: 0;
  overflow: hidden;
}

body.qr-app .qr-popover {
  position: fixed;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  min-width: 240px;
  max-width: min(380px, calc(100vw - 16px));
  padding: 6px;
  overflow-y: auto;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  opacity: 1;
  transform: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

@starting-style {
  body.qr-app .header-dropdown-menu,
  body.qr-app .agent-switcher-menu,
  body.qr-app .qr-popover,
  body.qr-app .qr-listbox {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
}

body.qr-app .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--qr-ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease;
}

body.qr-app .dropdown-item .material-symbols-outlined {
  font-size: 19px;
  color: var(--qr-muted);
}

body.qr-app .dropdown-item.danger,
body.qr-app .dropdown-item.danger .material-symbols-outlined {
  color: var(--danger);
}

body.qr-app .dropdown-divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--qr-line);
}

.qr-pop-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.qr-pop-section + .qr-pop-section {
  border-top: 1px solid var(--qr-line);
  padding-top: 8px;
  margin-top: 4px;
}

.qr-pop-label {
  padding: 4px 12px 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-muted);
}

.qr-pop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
}

.qr-pop-row > .qr-select,
.qr-pop-row > .form-input {
  flex: 1 1 auto;
  min-width: 0;
}

.qr-range {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  padding: 6px 8px 4px;
}

.qr-range[style*="display:none"],
.qr-range[style*="display: none"] {
  display: none !important;
}

.qr-range label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--qr-text-2);
}

.qr-range .form-input {
  width: auto;
  min-height: 36px;
}

/* ==========================================================================
   Espacio de trabajo: tres columnas, scroll solo dentro de cada una
   ========================================================================== */
.qr-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 12px;
  min-height: 0;
  padding: 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

body.qr-app .qr-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  padding: 0;
  gap: 0;
  overflow: hidden;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: var(--qr-r-card);
  box-shadow: none;
  animation: none;
}

body.qr-app .qr-col-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

body.qr-app .panel-body.qr-col-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: none;
  padding: 4px 20px 24px;
}

/* ==========================================================================
   Columna 1: resumen del día
   ========================================================================== */
.qr-rail .qr-col-scroll {
  display: flex;
  flex-direction: column;
}

.qr-day {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.qr-greeting {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--qr-ink);
  text-wrap: balance;
}

.qr-hero-sub {
  margin-top: -10px;
  font-size: 14px;
  color: var(--qr-muted);
}

.qr-day-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: var(--qr-r-inner);
  background: var(--qr-paper-2);
  border: 1px solid var(--qr-line);
}

.qr-day-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qr-day-total-label {
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-day-total strong {
  font-size: 40px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--qr-ink);
}

/* Anillo "Ficha": el elemento memorable, se llena al completar datos clave */
.qr-ring {
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
}

.qr-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.qr-ring circle {
  fill: none;
  stroke-width: 13;
}

.qr-ring-track {
  stroke: var(--qr-chip);
}

.qr-ring-fill {
  stroke: var(--qr-amber);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 520ms var(--ease-out), stroke 200ms ease;
}

.qr-ring[data-state="empty"] .qr-ring-fill {
  stroke-linecap: butt;
}

.qr-ring[data-state="complete"] .qr-ring-fill {
  stroke: var(--qr-route);
}

.qr-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-ring-label strong {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--qr-ink);
  font-variant-numeric: tabular-nums;
}

.qr-ring-label span {
  font-size: 12px;
  color: var(--qr-muted);
}

/* Mezcla por canal: una barra apilada + leyenda con cifras */
.qr-mix {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--qr-chip);
}

.qr-mix-seg {
  flex: 0 1 0;
  min-width: 0;
  transition: flex-grow 400ms var(--ease-out);
}

.qr-mix-seg[data-ch="email"] { background: var(--ch-email); }
.qr-mix-seg[data-ch="wa"] { background: var(--ch-wa); }
.qr-mix-seg[data-ch="dsp"] { background: var(--ch-dsp); }

body.qr-app .qr-kpis {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}

.qr-kpi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px;
}

.qr-kpi dt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--qr-text-2);
}

.qr-kpi dt::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--ch-color);
}

.qr-kpi[data-ch="email"] { --ch-color: var(--ch-email); }
.qr-kpi[data-ch="wa"] { --ch-color: var(--ch-wa); }
.qr-kpi[data-ch="dsp"] { --ch-color: var(--ch-dsp); }

.qr-kpi dd {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--qr-ink);
}

/* Accesos de gestión */
.qr-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-top: 1px solid var(--qr-line);
}

body.qr-app .qr-shortcut.btn-notification {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  height: auto;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent !important;
  color: var(--qr-ink) !important;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 120ms ease, transform 160ms var(--ease-out);
}

body.qr-app .qr-shortcut.btn-review-queue-pill {
  border: 0 !important;
  font-weight: 500 !important;
}

body.qr-app .qr-shortcut .material-symbols-outlined {
  color: var(--qr-muted);
}

body.qr-app .qr-shortcut .btn-label {
  flex: 1;
}

body.qr-app .qr-shortcut .notification-badge {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--qr-chip);
  color: var(--qr-ink);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 0;
  box-shadow: none;
  transform: none;
}

body.qr-app .btn-review-queue-pill.qr-shortcut .notification-badge {
  background: var(--qr-carrot-text);
  color: #FFFFFF;
}

body.dark-mode.qr-app .btn-review-queue-pill.qr-shortcut .notification-badge {
  color: #15161E;
}

/* Reglas desplegables */
body.qr-app .rules-footer {
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--qr-line);
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

body.qr-app .rules-footer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: var(--qr-ink);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.rules-footer-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.rules-footer-title .material-symbols-outlined {
  color: var(--qr-muted);
}

body.qr-app .toggle-chevron {
  color: var(--qr-muted);
  transition: transform 200ms var(--ease-out);
}

body.qr-app .rules-footer-toggle[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
}

body.qr-app .rules-footer-content {
  display: grid;
  grid-template-rows: 0fr;
  max-height: none;
  padding: 0;
  opacity: 0;
  transition: grid-template-rows 260ms var(--ease-out), opacity 180ms ease;
}

body.qr-app .rules-footer-content.expanded {
  grid-template-rows: 1fr;
  opacity: 1;
}

.rules-footer-inner {
  min-height: 0;
  overflow: hidden;
}

.qr-rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0 20px 20px 20px;
  list-style: none;
  font-size: 14px;
  line-height: 1.45;
  color: var(--qr-text-2);
}

.qr-rules-list li {
  position: relative;
  padding-left: 16px;
}

.qr-rules-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--qr-carrot);
}

.qr-rules-list strong {
  color: var(--qr-ink);
  font-weight: 600;
}

/* ==========================================================================
   Cabecera de columna (pasos 1 y 2)
   ========================================================================== */
body.qr-app .panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  min-height: 64px;
  padding: 12px 14px 12px 20px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--qr-line);
  background: transparent;
}

body.qr-app .panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--qr-ink);
  text-transform: none;
  white-space: nowrap;
}

/* Números de paso: la página sí es una secuencia (registrar → enviar) */
body.qr-app .step-badge {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--qr-ink);
  color: var(--qr-ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

body.qr-app .panel-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--qr-paper-2) !important;
  color: var(--qr-muted) !important;
  border: 1px solid var(--qr-line);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body.qr-app .panel-timer-badge .material-symbols-outlined {
  font-size: 16px;
}

body.qr-app .panel-timer-badge[data-state="running"] {
  color: var(--qr-carrot-text) !important;
  background: var(--qr-carrot-soft) !important;
  border-color: transparent;
}

body.qr-app .panel-timer-badge[data-state="stopped"] {
  color: var(--success-text) !important;
  background: var(--qr-route-soft) !important;
  border-color: transparent;
}

#form-progress-wrap {
  display: none;
}

/* Botón dividido "Pegar TMS": acción rápida + pegado manual */
.qr-split {
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--qr-chip);
}

.qr-split button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--qr-ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}

.qr-split .material-symbols-outlined {
  font-size: 18px;
}

body.qr-app #btn-auto-paste-tms,
body.qr-app #btn-auto-paste-tms:hover {
  padding: 0 12px 0 12px;
  border-radius: 999px 0 0 999px;
  background: transparent;
  color: var(--qr-ink);
  border: 0;
  box-shadow: none;
  overflow: visible;
  transform: none;
}

body.qr-app #btn-auto-paste-tms::after {
  display: none;
}

.qr-split-main .material-symbols-outlined {
  color: var(--qr-carrot);
  font-variation-settings: 'FILL' 1;
}

.qr-split-more {
  position: relative;
  padding: 0 10px 0 9px;
  border-radius: 0 999px 999px 0;
  color: var(--qr-text-2) !important;
}

.qr-split-more::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--qr-line-strong);
}

/* ==========================================================================
   Botones
   ========================================================================== */
body.qr-app .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
}

body.qr-app .btn .material-symbols-outlined {
  font-size: 18px;
}

body.qr-app .btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

body.qr-app .qr-btn-ink {
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  border: 0;
}

body.qr-app .qr-btn-ink .qr-caret {
  margin-right: -4px;
  opacity: 0.8;
}

body.qr-app .btn-primary-action,
body.qr-app .btn-send-review {
  width: 100%;
  min-height: 50px;
  background: var(--qr-ink) !important;
  color: var(--qr-on-ink) !important;
  border: 0 !important;
  font-size: 16px;
  box-shadow: none !important;
}

body.qr-app .btn-copy,
body.qr-app .btn-secondary-action,
body.qr-app .btn-channel-alt,
body.qr-app .btn-export-action,
body.qr-app .btn-history-action {
  background: var(--qr-paper);
  color: var(--qr-ink);
  border: 1px solid var(--qr-line-strong);
}

body.qr-app .qr-danger-ghost {
  width: 100%;
  color: var(--danger);
  border-color: var(--danger-border);
}

body.qr-app .btn-mark-done {
  width: 100%;
  min-height: 46px;
  background: var(--qr-route) !important;
  color: #FFFFFF !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.dark-mode.qr-app .btn-mark-done {
  color: #0E1F17 !important;
}

/* Pulsación: todo lo pulsable responde (120–160 ms) */
body.qr-app .btn:active,
body.qr-app .qr-new-btn:active,
body.qr-app .qr-icon-btn:active,
body.qr-app .btn-profile-pill:active,
body.qr-app .qr-shortcut:active,
body.qr-app .qr-search:active,
body.qr-app .qr-split button:active,
body.qr-app .agent-switcher-item:active,
body.qr-app .qr-select-trigger:active,
body.qr-app .qr-pager button:active,
body.qr-app .qr-segmented .tab-btn:active {
  transform: scale(0.97);
}

/* ==========================================================================
   Formulario
   ========================================================================== */
body.qr-app .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

body.qr-app .form-row-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 14px;
}

body.qr-app .form-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--qr-text-2);
  text-transform: none;
  letter-spacing: 0;
}

body.qr-app .form-label .subtext {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--qr-muted);
}

body.qr-app .form-label .subtext .material-symbols-outlined {
  font-size: 14px;
}

body.qr-app .form-input,
body.qr-app .form-select,
body.qr-app .form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--qr-line-strong);
  border-radius: var(--qr-r-field);
  background: var(--qr-paper);
  color: var(--qr-ink);
  font-size: 15px;
  line-height: 1.4;
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

body.qr-app .form-textarea {
  min-height: 84px;
  resize: vertical;
}

body.qr-app .form-input::placeholder,
body.qr-app .form-textarea::placeholder {
  color: var(--text-light);
}

body.qr-app .form-input:focus,
body.qr-app .form-select:focus,
body.qr-app .form-textarea:focus {
  outline: none;
  border-color: var(--qr-carrot);
  box-shadow: 0 0 0 4px var(--qr-focus);
}

body.qr-app .form-input[readonly] {
  background: var(--qr-paper-2);
  color: var(--qr-muted);
}

body.qr-app #tracking_code,
body.qr-app #client_phone {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Secciones del formulario: sin tarjeta dentro de tarjeta */
body.qr-app .form-segment-card {
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.qr-app .form-segment-card + .form-segment-card {
  margin-top: 16px !important;
}

body.qr-app .form-segment-header {
  display: flex;
  align-items: center;
  margin: 12px 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

body.qr-app .form-segment-title,
body.qr-app .section-divider-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--qr-ink);
  text-transform: none;
  letter-spacing: 0;
}

body.qr-app .form-segment-title .material-symbols-outlined,
body.qr-app .section-divider-title .material-symbols-outlined {
  font-size: 18px !important;
  color: var(--qr-muted);
}

body.qr-app .section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--qr-line);
  background: transparent;
}

body.qr-app .section-divider::before,
body.qr-app .section-divider::after {
  display: none;
}

body.qr-app .form-sub-card,
body.qr-app .false-report-card {
  margin-top: 12px !important;
  padding: 14px;
  border: 1px solid var(--qr-line);
  border-radius: var(--qr-r-inner);
  background: var(--qr-paper-2);
  box-shadow: none;
}

body.qr-app .false-report-card label {
  color: var(--qr-ink) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

body.qr-app input[type="checkbox"],
body.qr-app input[type="radio"] {
  accent-color: var(--qr-ink);
}

/* Tarjetas de opción */
body.qr-app .incident-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

body.qr-app .radio-card {
  position: relative;
}

body.qr-app .radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

body.qr-app .radio-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--qr-line-strong);
  border-radius: var(--qr-r-inner);
  background: var(--qr-paper);
  cursor: pointer;
  box-shadow: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 160ms var(--ease-out);
}

body.qr-app .radio-label:active {
  transform: scale(0.985);
}

body.qr-app .radio-label-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--qr-ink);
}

body.qr-app .radio-label-title .material-symbols-outlined {
  font-size: 18px !important;
  color: var(--qr-muted);
  transition: color 150ms ease;
}

body.qr-app .radio-label-desc {
  font-size: 13px;
  color: var(--qr-muted);
  line-height: 1.35;
}

body.qr-app .radio-card input:checked + .radio-label {
  border-color: var(--qr-ink);
  background: var(--qr-paper-2);
  box-shadow: inset 0 0 0 1px var(--qr-ink);
}

body.qr-app .radio-card input:checked + .radio-label {
  transform: none;
}

body.qr-app .radio-card input:checked + .radio-label .radio-label-title {
  color: var(--qr-ink);
}

body.qr-app .radio-card input:checked + .radio-label .radio-label-title .material-symbols-outlined {
  color: var(--qr-carrot);
}

body.qr-app .radio-card input:focus-visible + .radio-label {
  outline: 2px solid var(--qr-carrot);
  outline-offset: 2px;
}

/* ==========================================================================
   Select personalizado
   ========================================================================== */
.qr-select {
  position: relative;
  min-width: 0;
}

body.qr-app select.qr-native {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.qr-select-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px 6px 12px;
  border: 1px solid var(--qr-line-strong);
  border-radius: var(--qr-r-field);
  background: var(--qr-paper);
  color: var(--qr-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 160ms var(--ease-out);
}

.qr-select.is-open .qr-select-trigger {
  border-color: var(--qr-carrot);
  box-shadow: 0 0 0 4px var(--qr-focus);
}

.qr-select-trigger > .material-symbols-outlined:first-child {
  color: var(--qr-muted);
  font-size: 19px;
}

.qr-select-trigger > .material-symbols-outlined:last-child {
  margin-left: auto;
  color: var(--qr-muted);
  font-size: 18px;
}

.qr-select-value {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.qr-select-title {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-select-hint {
  font-size: 12px;
  color: var(--qr-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-select-compact .qr-select-trigger {
  min-height: 38px;
  padding: 0 8px 0 12px;
  border-radius: 999px;
  gap: 8px;
}

.qr-select-compact .qr-select-title {
  font-size: 14px;
  font-weight: 500;
}

.qr-select-compact .qr-select-trigger > .material-symbols-outlined:first-child {
  font-size: 17px;
}

.qr-opt-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--qr-chip);
  color: var(--qr-text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.qr-app .qr-listbox {
  position: fixed;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: calc(100vw - 16px);
  max-height: 340px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  outline: none;
  opacity: 1;
  transform: none;
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.qr-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--qr-ink);
  cursor: pointer;
}

.qr-option.is-active {
  background: var(--qr-paper-2);
}

body.qr-app .qr-listbox:focus-visible .qr-option.is-active {
  box-shadow: inset 0 0 0 2px var(--qr-focus);
}

.qr-option[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.qr-option-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.qr-option-title {
  font-size: 14px;
  font-weight: 500;
}

.qr-option[aria-selected="true"] .qr-option-title {
  font-weight: 600;
}

.qr-option-hint {
  font-size: 12px;
  color: var(--qr-muted);
}

.qr-option-check {
  margin-left: auto;
  font-size: 18px !important;
  color: var(--qr-carrot);
  opacity: 0;
}

.qr-option[aria-selected="true"] .qr-option-check {
  opacity: 1;
}

.qr-option[aria-selected="true"] .qr-opt-avatar {
  background: var(--qr-ink);
  color: var(--qr-on-ink);
}

/* ==========================================================================
   Columna 3: vista previa y envío
   ========================================================================== */
.qr-preview-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Control segmentado (vista previa, métricas, login) */
body.qr-app .nav-tabs:not(.qr-channels) {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--qr-line);
  border-radius: 999px;
  background: var(--qr-paper-2);
  box-shadow: none;
}

body.qr-app .nav-tabs:not(.qr-channels) .tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  min-width: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--qr-muted);
  font-size: 14px;
  font-weight: 600;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 160ms var(--ease-out);
}

body.qr-app .nav-tabs:not(.qr-channels) .tab-btn .material-symbols-outlined {
  font-size: 18px;
}

body.qr-app .nav-tabs:not(.qr-channels) .tab-btn.active {
  background: var(--qr-paper);
  color: var(--qr-ink);
  box-shadow: 0 1px 2px rgba(27, 28, 41, 0.08), 0 0 0 1px var(--qr-line);
}

/* El segmentado ya muestra el canal: la etiqueta solo se anuncia a lectores de pantalla */
body.qr-app .preview-badge {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.qr-app .preview-badge-visible {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--qr-carrot-soft);
  color: var(--qr-carrot-text);
  border: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
  text-transform: none;
  letter-spacing: 0;
}

body.qr-app .qr-preview-scroll {
  display: flex;
  flex-direction: column;
  padding: 16px 20px 12px;
}

body.qr-app .preview-box {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--qr-line);
  border-radius: 16px;
  background: var(--qr-paper-2);
  box-shadow: none;
}

body.qr-app .preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--qr-line);
  background: transparent;
  font-size: 13px;
  color: var(--qr-muted);
}

body.qr-app .preview-header .material-symbols-outlined {
  font-size: 18px;
}

body.qr-app .editable-template {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: none;
  overflow-y: auto;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--qr-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  box-shadow: none;
  overscroll-behavior: contain;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

body.qr-app .editable-template:focus {
  outline: none;
  background: var(--qr-paper);
  box-shadow: inset 0 0 0 2px var(--qr-carrot);
}

.qr-col-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--qr-line);
  background: var(--qr-paper);
}

.qr-utility-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qr-contextual {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.qr-contextual:empty {
  display: none;
}

.qr-utility-row #btn-copy-template {
  flex: 1 1 140px;
}

body.qr-app .btn-action-code {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.qr-action-code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--qr-carrot-soft);
  color: var(--qr-carrot-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

body.qr-app .action-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

body.qr-app #email-direct-actions:not(.hidden) {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Aviso de choque: otro asesor atiende el mismo cliente */
.qr-conflict {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--danger-border);
  border-left: 4px solid var(--danger);
  border-radius: var(--qr-r-inner);
  background: var(--danger-bg);
  color: var(--qr-ink);
  font-size: 14px;
  line-height: 1.45;
}

.qr-conflict .material-symbols-outlined { color: var(--danger); }
.qr-conflict strong { display: block; font-weight: 600; }
.qr-conflict span:not(.material-symbols-outlined) { color: var(--qr-text-2); }

body.qr-app .alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--qr-r-inner);
  font-size: 14px;
  line-height: 1.45;
}

/* ==========================================================================
   Navegación entre columnas (solo pantallas estrechas)
   ========================================================================== */
.qr-pager {
  display: none;
}

/* ==========================================================================
   Modales: fondo en fundido, caja con escala centrada.
   Entrada 220 ms, salida 150 ms (la salida siempre más rápida).
   ========================================================================== */
body.qr-app .modal-overlay {
  background: rgba(17, 18, 24, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 150ms ease;
}

body.qr-app .modal-overlay.active {
  transition: opacity 220ms var(--ease-out);
}

body.qr-app .modal-container {
  max-height: min(88dvh, 860px);
  border: 1px solid var(--qr-line);
  border-radius: 20px;
  background: var(--qr-paper);
  box-shadow: var(--shadow-lg);
  animation: none;
  opacity: 0;
  transform: scale(0.97) translateY(6px);
  transition: opacity 150ms ease, transform 150ms ease;
}

body.qr-app .modal-overlay.active .modal-container {
  opacity: 1;
  transform: none;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}

body.qr-app .modal-header {
  flex-shrink: 0;
  padding: 16px 16px 16px 24px;
  background: transparent;
  border-bottom: 1px solid var(--qr-line);
}

body.qr-app .modal-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--qr-ink);
}

body.qr-app .modal-header h3 > .material-symbols-outlined {
  color: var(--qr-muted);
}

body.qr-app .modal-header > button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  line-height: 1;
}

body.qr-app .modal-body {
  padding: 20px 24px 24px;
  overscroll-behavior: contain;
}

/* --- Atendidos --- */
body.qr-app .qr-history {
  max-width: 980px;
  height: min(86dvh, 820px);
}

.qr-count-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--qr-chip);
  color: var(--qr-text-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.qr-history-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 16px 12px 24px;
  border-bottom: 1px solid var(--qr-line);
}

.qr-search-field {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}

.qr-search-field .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 19px;
  color: var(--qr-muted);
  pointer-events: none;
}

body.qr-app .qr-search-field .form-input {
  min-height: 38px;
  padding: 6px 14px 6px 38px;
  border-radius: 999px;
  font-size: 14px;
}

.qr-history-toolbar .qr-select {
  flex: 0 1 180px;
}

.qr-history-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 16px 24px;
}

body.qr-app .history-date-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -16px 0 -24px;
  padding: 14px 16px 8px 24px;
  border: 0;
  border-radius: 0;
  background: var(--qr-paper);
  color: var(--qr-ink);
  box-shadow: 0 1px 0 var(--qr-line);
}

.qr-day-title {
  font-size: 15px;
  font-weight: 600;
}

.qr-day-date {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--qr-muted);
  font-variant-numeric: tabular-nums;
}

.qr-day-tools {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.qr-day-count {
  font-size: 13px;
  color: var(--qr-muted);
}

body.qr-app .btn-clear-day {
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

body.qr-app .qr-hrow {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: start;
  margin: 0;
  padding: 12px 0;
  border: 0 !important;
  border-bottom: 1px solid var(--qr-line) !important;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.qr-hrow-time {
  padding-top: 1px;
  font-size: 13px;
  font-weight: 600;
  color: var(--qr-muted);
  font-variant-numeric: tabular-nums;
}

.qr-hrow-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.qr-hrow-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.qr-hrow-track {
  font-size: 15px;
  font-weight: 600;
  color: var(--qr-ink);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-chan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--qr-text-2);
}

.qr-chan::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--ch-color);
}

.qr-chan[data-ch="email"] { --ch-color: var(--ch-email); }
.qr-chan[data-ch="wa"] { --ch-color: var(--ch-wa); }
.qr-chan[data-ch="dsp"] { --ch-color: var(--ch-dsp); }

.qr-hrow-sub {
  font-size: 14px;
  color: var(--qr-text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-hrow-meta {
  color: var(--qr-muted);
}

.qr-hrow-action {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--qr-muted);
}

.qr-hrow-edit:empty {
  display: none;
}

.qr-hrow-edit {
  margin-top: 8px;
}

.qr-hrow-msg summary {
  display: inline-flex;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--qr-carrot-text);
  cursor: pointer;
  list-style: none;
}

.qr-hrow-msg summary::-webkit-details-marker {
  display: none;
}

.qr-hrow-msg[open] summary {
  color: var(--qr-muted);
}

.qr-hrow-msg-body {
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--qr-line);
  border-radius: 12px;
  background: var(--qr-paper-2);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--qr-ink);
}

.qr-hrow-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.qr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 56px 16px;
  text-align: center;
  color: var(--qr-muted);
  font-size: 14px;
}

.qr-empty .material-symbols-outlined {
  font-size: 32px;
}

.qr-empty strong {
  font-size: 16px;
  color: var(--qr-ink);
}

/* --- Métricas --- */
body.qr-app .qr-metrics {
  max-width: 920px;
}

.qr-metrics-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.qr-metrics-who {
  margin-left: auto;
  font-size: 14px;
  color: var(--qr-muted);
}

.qr-metrics-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.qr-mcard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--qr-line);
  border-radius: 16px;
  background: var(--qr-paper);
}

.qr-mcard-wide {
  grid-column: 1 / -1;
}

.qr-mcard-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.qr-mcard-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--qr-ink);
}

.qr-mcard-label {
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-mcard-note {
  font-size: 13px;
  color: var(--qr-muted);
}

.qr-hero-number {
  margin-top: -6px;
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--qr-ink);
}

.qr-delta {
  font-size: 13px;
  font-weight: 600;
  color: var(--qr-text-2);
}

.qr-delta[data-dir="up"]::before { content: '▲ '; font-size: 10px; }
.qr-delta[data-dir="down"]::before { content: '▼ '; font-size: 10px; }

.qr-mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--qr-line);
}

.qr-mini-stat strong {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.qr-mini-note {
  font-size: 12px;
  color: var(--qr-muted);
}

.qr-stack {
  display: flex;
  gap: 2px;
  height: 14px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--qr-chip);
}

.qr-stack-seg { position: relative; min-width: 4px; }
.qr-stack-seg[data-ch="email"] { background: var(--ch-email); }
.qr-stack-seg[data-ch="wa"] { background: var(--ch-wa); }
.qr-stack-seg[data-ch="dsp"] { background: var(--ch-dsp); }

.qr-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qr-legend li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.qr-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--ch-color);
}

.qr-legend li[data-ch="email"] { --ch-color: var(--ch-email); }
.qr-legend li[data-ch="wa"] { --ch-color: var(--ch-wa); }
.qr-legend li[data-ch="dsp"] { --ch-color: var(--ch-dsp); }

.qr-legend-label { color: var(--qr-text-2); }
.qr-legend strong { font-variant-numeric: tabular-nums; }
.qr-legend-pct { text-align: right; color: var(--qr-muted); font-variant-numeric: tabular-nums; }

.qr-vbars {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 140px;
}

.qr-vbar {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  gap: 6px;
}

.qr-vbar-col {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: flex-end;
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 -1px 0 var(--qr-line-strong);
}

.qr-vbar-col {
  justify-content: center;
}

.qr-vbar-fill {
  display: block;
  width: min(100%, 22px);
  min-height: 0;
  border-radius: 4px 4px 0 0;
  background: var(--qr-ink);
  opacity: 0.82;
  transition: opacity 120ms ease;
}

.qr-vbar-label {
  font-size: 11px;
  text-align: center;
  color: var(--qr-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qr-hbars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qr-hbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  min-height: 28px;
  font-size: 14px;
}

.qr-hbar-label {
  color: var(--qr-text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-hbar-track {
  height: 10px;
  border-radius: 0 4px 4px 0;
  box-shadow: inset 1px 0 0 var(--qr-line-strong);
}

.qr-hbar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--qr-ink);
  opacity: 0.82;
}

.qr-hbar-value {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.qr-idle,
.qr-metrics-empty {
  font-size: 13px;
  color: var(--qr-muted);
}

/* Tooltip de hover para barras (puntero fino) */
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.qr-stack [data-tip]:hover::after {
  bottom: auto;
  top: calc(100% + 6px);
}

.qr-stack {
  overflow: visible;
}

.qr-metrics-table {
  font-size: 14px;
}

.qr-metrics-table summary {
  font-weight: 600;
  color: var(--qr-carrot-text);
  cursor: pointer;
}

.qr-metrics-table table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
}

.qr-metrics-table th,
.qr-metrics-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--qr-line);
  text-align: left;
  font-weight: 500;
}

.qr-metrics-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Perfil --- */
body.qr-app .qr-profile {
  max-width: 460px;
}

.qr-profile .modal-body {
  gap: 16px;
}

.qr-profile-id {
  display: flex;
  align-items: center;
  gap: 16px;
}

.qr-profile-avatar {
  position: relative;
  flex-shrink: 0;
}

.qr-profile-avatar img,
.qr-profile-initials {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.qr-profile-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-size: 28px;
  font-weight: 700;
}

.qr-profile-photo-btn {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--qr-paper);
  border: 1px solid var(--qr-line-strong);
  color: var(--qr-ink);
  cursor: pointer;
}

.qr-profile-photo-btn .material-symbols-outlined {
  font-size: 16px;
}

.qr-profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.qr-profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--qr-ink);
}

.qr-profile-role {
  font-size: 14px;
  color: var(--qr-muted);
}

.qr-profile-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--qr-line);
}

.qr-profile-section .qr-pop-row {
  padding: 0;
}

/* Componentes heredados con "transition: all": propiedades explícitas */
body.qr-app .form-segment-card,
body.qr-app .false-report-card,
body.qr-app .preview-box,
body.qr-app .history-card,
body.qr-app .wall-profile-radio-dot,
body.qr-app .mobile-menu-item {
  transition-property: background-color, border-color, color, box-shadow, opacity, transform;
  transition-duration: 150ms;
  transition-timing-function: ease;
}

/* ==========================================================================
   Toast: sube desde abajo, con transiciones interrumpibles
   ========================================================================== */
body.qr-app .toast {
  left: 50%;
  right: auto;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--qr-ink);
  color: var(--qr-on-ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, calc(100% + 32px));
  transition: transform 260ms var(--ease-out), opacity 200ms ease;
}

body.qr-app .toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.qr-app .toast .material-symbols-outlined {
  color: var(--qr-carrot) !important;
}

/* ==========================================================================
   Pantalla de acceso
   ========================================================================== */
/* Plano nocturno de la ciudad: igual en tema claro y oscuro */
body.qr-app #login-wall-overlay {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 50% 45%, rgba(40, 44, 66, 0.55), transparent 70%),
    #0A0B12;
}

.qr-login-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
}

/* Viñeta: oscurece bordes y el centro detrás de la tarjeta para que se lea bien */
.qr-login-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(520px 520px at 50% 50%, rgba(11, 12, 20, 0.72), transparent 70%),
    radial-gradient(ellipse at center, transparent 55%, rgba(5, 6, 12, 0.75) 100%);
}

body.qr-app .auth-card {
  position: relative;
  gap: 16px !important;
  padding: 32px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 24px !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 30px 80px -20px rgba(0, 0, 0, 0.75),
    0 0 120px -30px rgba(228, 87, 11, 0.45) !important;
  animation: qr-card-in 520ms var(--ease-out) both;
}

@keyframes qr-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* La marca brilla sobre el fondo oscuro */
body.qr-app .auth-card .qr-brand-mark-lg {
  box-shadow: 0 0 0 6px rgba(228, 87, 11, 0.12), 0 10px 30px -6px rgba(228, 87, 11, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  body.qr-app .auth-card { animation: none; }
}

.qr-auth-title {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--qr-ink);
}

.qr-auth-sub {
  font-size: 15px;
  color: var(--qr-muted);
}

.qr-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qr-auth-form .form-group { margin: 0; }

.qr-pass { position: relative; }
.qr-pass .form-input { padding-right: 44px; }

.qr-pass-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--qr-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.qr-pass-eye .material-symbols-outlined { font-size: 20px; }
.qr-pass-eye:focus-visible { outline: 2px solid var(--qr-ink); outline-offset: 1px; }

.qr-auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-bg, rgba(220, 38, 38, 0.08));
  color: var(--danger-text, #B91C1C);
  font-size: 14px;
  line-height: 1.4;
}

.qr-auth-error[hidden] { display: none; }

body.qr-app .qr-auth-submit {
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
}

body.qr-app .qr-auth-submit:disabled { opacity: .7; cursor: progress; }

.qr-auth-alt {
  margin: 2px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--qr-muted);
}

.qr-auth-link {
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--qr-carrot-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.qr-auth-link:focus-visible,
.qr-auth-back:focus-visible { outline: 2px solid var(--qr-ink); outline-offset: 2px; border-radius: 6px; }

.qr-auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--qr-text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.qr-auth-back .material-symbols-outlined { font-size: 18px; }

/* Los 3 pasos del alta, en una fila */
.qr-auth-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qr-auth-steps li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--qr-line);
  border-radius: 12px;
  background: var(--qr-paper-2);
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--qr-text-2);
}

.qr-auth-steps li span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--qr-ink);
  color: var(--qr-on-ink, #fff);
  font-size: 12px;
  font-weight: 700;
}

.qr-auth-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.qr-auth-done.hidden { display: none; }

.qr-auth-done-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(82, 183, 134, 0.14);
  color: var(--qr-route, #1F6B4B);
}

.qr-auth-done-icon .material-symbols-outlined { font-size: 28px; }
.qr-auth-done-title { margin: 0; font-size: 19px; font-weight: 600; color: var(--qr-ink); }
.qr-auth-done-msg { margin: 0 0 6px; font-size: 15px; line-height: 1.5; color: var(--qr-text-2); text-wrap: pretty; }

@media (max-width: 420px) {
  body.qr-app .auth-card { padding: 22px !important; }
  .qr-auth-steps { grid-template-columns: 1fr; }
  .qr-auth-steps li { flex-direction: row; align-items: center; }
}

/* ==========================================================================
   Hover: solo con puntero fino (sin hover pegado en táctil)
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
  .qr-search:hover { border-color: var(--qr-muted); background: var(--qr-paper); }
  .qr-icon-btn:hover { background: var(--qr-chip); color: var(--qr-ink); }
  .qr-icon-btn.qr-danger:hover { background: var(--danger-bg); color: var(--danger); }
  .qr-new-btn:hover,
  body.qr-app .qr-btn-ink:hover { background: var(--qr-ink-hover); }
  body.qr-app .btn-profile-pill:hover { background: var(--qr-chip); }
  body.qr-app .dropdown-item:hover,
  body.qr-app .agent-switcher-footer-btn:hover { background: var(--qr-paper-2); }
  body.qr-app .dropdown-item.danger:hover { background: var(--danger-bg); }
  body.qr-app .agent-switcher-item:hover { background: var(--qr-paper-2); }
  body.qr-app .agent-switcher-item:hover .qr-account-go { background: var(--qr-ink); border-color: var(--qr-ink); color: var(--qr-on-ink); }
  body.qr-app .qr-channels .tab-btn:hover:not(.active) { color: var(--qr-ink); }
  body.qr-app .qr-shortcut.btn-notification:hover { background: var(--qr-paper-2) !important; }
  .qr-split button:hover,
  body.qr-app #btn-auto-paste-tms:hover { background: var(--qr-line); }
  body.qr-app .btn-primary-action:hover,
  body.qr-app .btn-send-review:hover { background: var(--qr-ink-hover) !important; }
  body.qr-app .btn-copy:hover,
  body.qr-app .btn-secondary-action:hover,
  body.qr-app .btn-channel-alt:hover,
  body.qr-app .btn-export-action:hover,
  body.qr-app .btn-history-action:hover { background: var(--qr-paper-2); border-color: var(--qr-muted); }
  body.qr-app .qr-danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger); }
  body.qr-app .radio-label:hover { border-color: var(--qr-muted); }
  .qr-select-trigger:hover,
  body.qr-app .form-input:hover:not(:focus),
  body.qr-app .form-textarea:hover:not(:focus) { border-color: var(--qr-muted); }
  body.qr-app .nav-tabs:not(.qr-channels) .tab-btn:hover:not(.active) { color: var(--qr-ink); }
  body.qr-app .rules-footer-toggle:hover { background: var(--qr-paper-2); }
  body.qr-app .btn-clear-day:hover { background: var(--danger-bg); }
  .qr-pass-eye:hover { background: var(--qr-chip); color: var(--qr-ink); }
  .qr-auth-link:hover { text-decoration: underline; }
  .qr-auth-back:hover { color: var(--qr-ink); }
  .qr-vbar:hover .qr-vbar-fill,
  .qr-hbar:hover .qr-hbar-fill { opacity: 1; }
}

/* ==========================================================================
   Entrada orquestada: una vez, tras el login (60 ms entre columnas)
   ========================================================================== */
@keyframes qr-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

body.qr-ready .qr-workspace > .qr-col {
  animation: qr-rise 420ms var(--ease-out) backwards;
}

body.qr-ready .qr-workspace > .qr-col:nth-child(2) { animation-delay: 60ms; }
body.qr-ready .qr-workspace > .qr-col:nth-child(3) { animation-delay: 120ms; }

/* ==========================================================================
   Responsive: siempre horizontal y sin scroll de página
   ========================================================================== */
@media (max-width: 1360px) {
  .qr-workspace { grid-template-columns: 260px minmax(0, 1.1fr) minmax(340px, 0.9fr); }
  .qr-search { flex-basis: 260px; }
}

@media (max-width: 1220px) {
  .qr-brand-name { display: none; }
  .qr-new-btn span:last-child { display: none; }
  .qr-new-btn { width: 42px; padding: 0; justify-content: center; }
  .qr-search { flex: 0 0 42px; width: 42px; padding: 0; justify-content: center; }
  .qr-search-text,
  .qr-search kbd { display: none; }
  .qr-workspace { grid-template-columns: 240px minmax(0, 1fr) minmax(320px, 0.9fr); }
  body.qr-app #btn-auto-paste-tms { font-size: 0; gap: 0; padding: 0 10px; }
  .qr-split-main .material-symbols-outlined { font-size: 18px; }
  body.qr-app .panel-timer-badge { display: none; }
}

/* Pantallas estrechas: las tres columnas se deslizan en horizontal (scroll-snap) */
@media (max-width: 1023px) {
  body.qr-app { grid-template-rows: var(--qr-topbar-h) minmax(0, 1fr) auto; }
  .qr-topbar { gap: 8px; padding: 0 12px; }
  body.qr-app .qr-channels .tab-btn { padding: 0 10px; }
  .qr-workspace {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 12px;
    scrollbar-width: none;
  }
  .qr-workspace::-webkit-scrollbar { display: none; }
  body.qr-app .qr-workspace > .qr-col {
    flex: 0 0 calc(100% - 28px);
    max-width: 640px;
    scroll-snap-align: start;
  }
  .qr-pager {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px max(8px, env(safe-area-inset-bottom));
    background: var(--qr-paper);
    border-top: 1px solid var(--qr-line);
  }
  .qr-pager button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1 1 0;
    max-width: 140px;
    min-height: 48px;
    padding: 4px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--qr-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
  }
  .qr-pager button[aria-current="true"] {
    color: var(--qr-ink);
    background: var(--qr-chip);
  }
  .qr-metrics-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  body.qr-app .qr-channels .tab-text { display: none; }
  body.qr-app .qr-channels .tab-btn .material-symbols-outlined { font-size: 22px; }
  .qr-brand { display: none; }
  body.qr-app .profile-name-mini,
  body.qr-app .switcher-caret { display: none; }
  body.qr-app .btn-profile-pill { padding: 0 3px; }
  body.qr-app .agent-switcher-wrap { margin-left: 0; }
  #btn-theme-toggle-header { display: none; }
  body.qr-app .header-dropdown-menu,
  body.qr-app .agent-switcher-menu { position: fixed; top: calc(var(--qr-topbar-h) + 6px); right: 12px; }
  body.qr-app .qr-workspace > .qr-col { flex-basis: calc(100% - 20px); }
  body.qr-app .panel-body.qr-col-scroll { padding: 4px 16px 20px; }
  body.qr-app .panel-header { padding: 10px 10px 10px 16px; }
  body.qr-app .form-row-2col,
  body.qr-app .incident-selector { grid-template-columns: minmax(0, 1fr); }
  body.qr-app #email-direct-actions:not(.hidden) { grid-template-columns: minmax(0, 1fr); }
  .qr-history-toolbar { flex-wrap: wrap; padding: 12px 16px; }
  .qr-search-field { flex-basis: 100%; }
  .qr-history-toolbar .qr-select { flex: 1 1 140px; }
  .qr-history-list { padding: 0 12px 12px 16px; }
  body.qr-app .history-date-header { margin: 0 -12px 0 -16px; padding: 12px 12px 8px 16px; }
  body.qr-app .qr-hrow { grid-template-columns: minmax(0, 1fr) auto; }
  .qr-hrow-time { grid-column: 1 / -1; }
  .qr-hbar { grid-template-columns: minmax(0, 1fr) 90px 32px; }
  body.qr-app .modal-overlay { padding: 8px; align-items: flex-end; }
  body.qr-app .modal-container { max-height: 92dvh; }
  body.qr-app .qr-history { height: 92dvh; }

  /* Evita el zoom automático de iOS al enfocar campos */
  body.qr-app .form-input,
  body.qr-app .form-select,
  body.qr-app .form-textarea { font-size: 16px; }
}

/* Movimiento reducido: sin desplazamientos, solo fundidos y color */
@media (prefers-reduced-motion: reduce) {
  body.qr-ready .qr-workspace > .qr-col { animation: none; }
  body.qr-app *,
  body.qr-app *::before,
  body.qr-app *::after {
    transition-property: opacity, background-color, border-color, color, box-shadow, stroke !important;
  }
  body.qr-app .modal-container,
  body.qr-app .modal-overlay.active .modal-container { transform: none; }
  body.qr-app .toast { transform: translate(-50%, 0); }
  .qr-skip:focus-visible { top: 16px; transform: none; }
  .qr-workspace { scroll-behavior: auto; }
}

/* ==========================================================================
   Acento naranja: detalles tenues sobre la base tinta/neutra
   (indicadores activos, títulos, selección). Sin rellenos grandes.
   ========================================================================== */
body.qr-app { accent-color: var(--qr-carrot); }

/* Línea de marca bajo la barra superior */
.qr-topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--qr-carrot) 0, rgba(228, 87, 11, 0.35) 16%, rgba(228, 87, 11, 0) 48%);
}

/* Pestañas activas: subrayado e icono en naranja */
body.qr-app .qr-channels .tab-btn::after { background: var(--qr-carrot); }
body.qr-app .qr-channels .tab-btn.active .material-symbols-outlined { color: var(--qr-carrot); }

/* Tarjeta de tipo elegida: filo naranja suave */
body.qr-app .radio-card input:checked + .radio-label {
  border-color: color-mix(in srgb, var(--qr-carrot) 55%, var(--qr-line));
  background: color-mix(in srgb, var(--qr-carrot-soft) 45%, var(--qr-paper));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--qr-carrot) 55%, transparent);
}

/* Títulos de tarjeta y de sección con una marca naranja */
.qr-card-title::before,
.qr-mcard-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 0.85em;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--qr-carrot);
  vertical-align: -1px;
  opacity: 0.9;
}

/* Etiquetas de sección en menús */
.qr-pop-label {
  color: var(--qr-carrot-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Contadores y fila seleccionada */
.qr-count-chip { background: var(--qr-carrot-soft); color: var(--qr-carrot-text); }
.qr-table tbody tr[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--qr-carrot); }
.qr-kpi-main { box-shadow: inset 3px 0 0 var(--qr-carrot); }
.qr-option[aria-selected="true"] .qr-option-check { color: var(--qr-carrot); }

/* ==========================================================================
   Menú Exportar: periodo + un botón
   ========================================================================== */
.qr-export { width: 300px; padding: 12px; }
.qr-export:not(.hidden) { display: flex; flex-direction: column; gap: 10px; }
.qr-export .qr-pop-label { padding: 0; }
.qr-export-period { display: grid !important; grid-template-columns: repeat(3, 1fr); }
.qr-export-period .tab-btn { justify-content: center; }
.qr-export-hint { margin: 0; font-size: 13px; color: var(--qr-muted); }
.qr-export-hint[hidden],
.qr-export-opt[hidden] { display: none !important; }
.qr-export .qr-range { padding: 0; }
.qr-export-opt > .qr-select { width: 100%; }
body.qr-app .qr-export-go { justify-content: center; width: 100%; min-height: 40px; }
.qr-export-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--qr-line);
}

.qr-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--qr-text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.qr-link-btn .material-symbols-outlined { font-size: 16px; color: var(--qr-carrot); }
.qr-link-btn[hidden] { display: none; }
.qr-link-btn:focus-visible { outline: 2px solid var(--qr-carrot); outline-offset: 1px; }

@media (hover: hover) and (pointer: fine) {
  .qr-link-btn:hover { background: var(--qr-paper-2); color: var(--qr-ink); }
}

/* Recordarme */
.qr-remember {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  min-height: 32px;
  font-size: 14px;
  color: var(--qr-text-2);
  cursor: pointer;
  user-select: none;
}

.qr-remember input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--qr-carrot); }

/* ==========================================================================
   Modales en pantallas pequeñas
   Un modal oculto con contenido ancho ensanchaba la página en el móvil
   (el navegador la "alejaba" y los menús fijos quedaban fuera de la vista).
   ========================================================================== */
body.qr-app .modal-overlay {
  overflow: hidden;
  visibility: hidden;
  transition: opacity 150ms ease, visibility 0s linear 150ms;
}

body.qr-app .modal-overlay.active {
  visibility: visible;
  transition: opacity 220ms var(--ease-out), visibility 0s;
}

body.qr-app .modal-container {
  min-width: 0;
  max-width: min(100%, 860px);
}

body.qr-app .modal-body { min-width: 0; overflow-wrap: anywhere; }

/* Menús de cuenta y herramientas nunca más anchos que la pantalla */
body.qr-app .agent-switcher-menu,
body.qr-app .header-dropdown-menu { max-width: calc(100vw - 24px); }

/* La página nunca se desplaza en horizontal: evita que un estado momentáneo
   al cargar ensanche la vista del móvil y deje menús fuera de la pantalla. */
html { overflow-x: hidden; }

/* ==========================================================================
   Tutorial guiado (js/modules/tour.js)
   Foco recortado sobre el sector + tarjeta de explicación.
   ========================================================================== */
.qr-tour { position: fixed; inset: 0; z-index: 20000; }
.qr-tour-mask { position: absolute; inset: 0; }

.qr-tour-spot {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--qr-carrot), 0 0 0 9999px rgba(11, 12, 20, 0.62);
  pointer-events: none;
  transition: top 280ms var(--ease-out), left 280ms var(--ease-out), width 280ms var(--ease-out), height 280ms var(--ease-out);
}

.qr-tour-spot.is-empty { top: 50% !important; left: 50% !important; width: 0 !important; height: 0 !important; box-shadow: 0 0 0 9999px rgba(11, 12, 20, 0.62); }

.qr-tour-card {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  padding: 18px 18px 14px;
  border: 1px solid var(--qr-line);
  border-radius: 18px;
  background: var(--qr-paper);
  color: var(--qr-ink);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.45);
  outline: none;
}

.qr-tour-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--qr-carrot);
}

.qr-tour-card.is-in { animation: qr-tour-in 220ms var(--ease-out); }
@keyframes qr-tour-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.qr-tour.is-still .qr-tour-spot { transition: none; }
.qr-tour.is-still .qr-tour-card.is-in { animation: none; }

.qr-tour-top { display: flex; align-items: center; justify-content: space-between; }
.qr-tour-step { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--qr-carrot-text); font-variant-numeric: tabular-nums; }
.qr-tour-skip { padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--qr-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.qr-tour-title { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.qr-tour-text { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--qr-text-2); text-wrap: pretty; }
.qr-tour-text strong { color: var(--qr-ink); font-weight: 600; }

.qr-tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qr-tour-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-right: auto; max-width: 150px; }
.qr-tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--qr-line-strong); }
.qr-tour-dots span.on { width: 16px; border-radius: 3px; background: var(--qr-carrot); }

.qr-tour-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--qr-line-strong);
  border-radius: 999px;
  background: var(--qr-paper);
  color: var(--qr-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.qr-tour-btn[hidden] { display: none; }
.qr-tour-next { border-color: var(--qr-ink); background: var(--qr-ink); color: var(--qr-on-ink, #fff); }
.qr-tour-btn:focus-visible,
.qr-tour-skip:focus-visible { outline: 2px solid var(--qr-carrot); outline-offset: 2px; }

@media (hover: hover) and (pointer: fine) {
  .qr-tour-prev:hover { background: var(--qr-paper-2); }
  .qr-tour-next:hover { background: var(--qr-ink-hover); }
  .qr-tour-skip:hover { color: var(--qr-ink); background: var(--qr-paper-2); }
}

/* ==========================================================================
   Por recontactar (js/modules/followups.js)
   ========================================================================== */
.qr-fu-help { margin: 0; padding: 0 20px 10px; font-size: 13px; line-height: 1.5; color: var(--qr-muted); }
.qr-fu-count { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--qr-chip); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tab-btn.active .qr-fu-count { background: var(--qr-carrot-soft); color: var(--qr-carrot-text); }

.qr-fu-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 4px 14px 14px;
  border-bottom: 1px solid var(--qr-line);
  border-left: 3px solid transparent;
}
.qr-fu-card[data-level="ok"] { border-left-color: var(--qr-route); }
.qr-fu-card[data-level="warn"] { border-left-color: #D97706; }
.qr-fu-card[data-level="late"] { border-left-color: var(--danger); }
.qr-fu-card[data-level="failed"] { border-left-color: var(--qr-muted); }

.qr-fu-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qr-fu-track { font-size: 14px; font-weight: 600; color: var(--qr-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.qr-fu-reason { padding: 2px 8px; border-radius: 999px; background: var(--qr-chip); color: var(--qr-text-2); font-size: 12px; font-weight: 600; }
.qr-fu-state { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; font-weight: 600; color: var(--qr-muted); white-space: nowrap; }
.qr-fu-state .material-symbols-outlined { font-size: 15px; }
.qr-fu-card[data-level="warn"] .qr-fu-state { color: #B45309; }
.qr-fu-card[data-level="late"] .qr-fu-state { color: var(--danger); }
.qr-fu-state[data-s="resolved"] { color: var(--qr-route); }

.qr-fu-sub { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--qr-text-2); }
.qr-fu-attempts { font-weight: 600; }
.qr-fu-res { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--qr-text-2); }
.qr-fu-res .material-symbols-outlined { font-size: 16px; color: var(--qr-route); }

.qr-fu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.qr-fu-actions .btn { display: inline-flex; align-items: center; gap: 4px; }
.qr-fu-actions .btn .material-symbols-outlined { font-size: 16px; }
.qr-fu-fail { color: var(--danger); }
.qr-fu-fail.is-early { color: var(--qr-muted); }

.qr-fu-panel { padding: 10px 12px; border-radius: 12px; background: var(--qr-paper-2); }
.qr-fu-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.qr-fu-form label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; font-size: 12px; font-weight: 600; color: var(--qr-text-2); }
.qr-fu-form .form-input { min-height: 36px; }
.qr-fu-warn { flex-basis: 100%; display: flex; gap: 6px; margin: 0; font-size: 13px; line-height: 1.45; color: var(--qr-text-2); }
.qr-fu-warn .material-symbols-outlined { font-size: 18px; color: #B45309; }
body.qr-app .qr-fu-failbtn { background: var(--danger); border-color: var(--danger); color: #fff; }

.qr-fu-log { list-style: none; margin: 4px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--qr-line); display: flex; flex-direction: column; gap: 8px; }
.qr-fu-log li { position: relative; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.qr-fu-log li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--qr-muted); box-shadow: 0 0 0 3px var(--qr-paper); }
.qr-fu-log li[data-type="resolved"]::before { background: var(--qr-route); }
.qr-fu-log li[data-type="failed"]::before { background: var(--danger); }
.qr-fu-log li[data-type="attempt"]::before,
.qr-fu-log li[data-type="sent"]::before { background: var(--qr-carrot); }
.qr-fu-log strong { font-weight: 600; color: var(--qr-ink); }
.qr-fu-log span { color: var(--qr-text-2); overflow-wrap: anywhere; }
.qr-fu-log time { font-size: 12px; color: var(--qr-muted); }

/* Estado del paquete en el TMS dentro de "Por recontactar" */
.qr-fu-tms { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--qr-text-2); }
.qr-fu-tms .material-symbols-outlined { font-size: 16px; color: var(--qr-carrot); }
.qr-fu-tms span { font-weight: 400; color: var(--qr-muted); }
.qr-fu-tms.is-none { font-weight: 400; color: var(--qr-muted); }
.qr-fu-tms.is-none .material-symbols-outlined { color: var(--qr-muted); }
a.qr-link-btn { text-decoration: none; }
.qr-fu-recont { display: inline-flex; align-items: center; gap: 3px; background: rgba(31, 107, 75, 0.1) !important; color: var(--qr-route) !important; }
.qr-fu-recont .material-symbols-outlined { font-size: 14px; }

/* Por recontactar: margen de 24 h tras el primer contacto */
.qr-fu-card[data-level="margin"] { border-left-color: var(--qr-line-strong, #C9CDD6); }
.qr-fu-card[data-level="margin"] .qr-fu-state { color: var(--qr-muted, #8A90A2); }
.qr-fu-card button[disabled] { opacity: .45; cursor: not-allowed; }

/* Entregas: seguimiento de soluciones enviadas a la DSP */
.qr-dl-times { font-size: 12.5px; color: var(--qr-muted); }
.qr-dl-fake { background: #FDECEC; color: #C4302B; }
.qr-dl-card[data-level="ok"] .qr-fu-state { color: var(--qr-route); }

/* Casos recién cerrados: resaltan en verde y se desvanecen hacia su apartado (solo visual) */
.qr-leaving { animation: qrLeave 6s ease forwards; background: rgba(31, 107, 75, .08); border-left-color: var(--qr-route) !important; pointer-events: none; }
.qr-leaving .qr-fu-state { color: var(--qr-route) !important; }
@keyframes qrLeave {
  0% { opacity: 0; transform: translateY(-4px); }
  8% { opacity: 1; transform: none; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(16px); }
}
@media (prefers-reduced-motion: reduce) { .qr-leaving { animation: none; } }

/* ---------- Avisos: salto del botón cuando sube un contador ---------- */
.qr-bump { animation: qrBump 1.2s cubic-bezier(.3, 1.6, .5, 1); }
.qr-bump .notification-badge { animation: qrBadgeGlow 1.2s ease; }
@keyframes qrBump { 0% { transform: none; } 18% { transform: translateY(-3px) scale(1.04); } 36% { transform: none; } 54% { transform: translateY(-1.5px); } 72%, 100% { transform: none; } }
@keyframes qrBadgeGlow { 0% { box-shadow: 0 0 0 0 rgba(228, 87, 11, .55); } 100% { box-shadow: 0 0 0 10px rgba(228, 87, 11, 0); } }

/* ---------- Pausas activas ---------- */
.qr-pause {
  position: fixed; left: 18px; bottom: 18px; z-index: 9000; width: min(340px, calc(100vw - 32px));
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 12px;
  background: var(--qr-paper, #fff); color: var(--qr-ink, #1B1C29);
  border: 1px solid var(--qr-line, #E3E5EC); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(27, 28, 41, .16), 0 2px 6px rgba(27, 28, 41, .06);
  opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2);
}
.qr-pause.is-in { opacity: 1; transform: none; }
.qr-pause.is-out { opacity: 0; transform: translateY(10px); }
.qr-pause.is-done { border-color: var(--qr-route, #1F6B4B); }
.qr-pause-icon { font-size: 26px; line-height: 1; margin-top: 2px; animation: qrPauseWiggle 2.4s ease 1; }
@keyframes qrPauseWiggle { 0%, 100% { transform: none; } 10% { transform: rotate(-12deg); } 20% { transform: rotate(10deg); } 30% { transform: rotate(-6deg); } 40% { transform: none; } }
.qr-pause-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.qr-pause-body { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.qr-pause-title { font-size: 14.5px; font-weight: 700; }
.qr-pause-text { font-size: 13px; line-height: 1.4; color: var(--qr-text-2, #4A4F5C); }
.qr-pause-stats { font-size: 11.5px; font-weight: 600; color: var(--qr-carrot-text, #B4430A); margin-top: 2px; }
.qr-pause-actions { display: flex; gap: 10px; align-items: center; }
.qr-pause-btn { border: 0; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; background: var(--qr-carrot, #E4570B); color: #fff; }
.qr-pause-btn:hover { filter: brightness(1.05); }
.qr-pause-link { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--qr-muted, #8A90A2); cursor: pointer; }
.qr-pause-link:hover { color: var(--qr-ink, #1B1C29); }
.qr-pause-close { border: 0; background: none; font-size: 18px; line-height: 1; color: var(--qr-muted, #8A90A2); cursor: pointer; padding: 0 2px; }
.qr-pause-ring {
  --p: 0; width: 64px; height: 64px; border-radius: 50%; margin: 6px 0 2px; display: grid; place-items: center;
  background: conic-gradient(var(--qr-carrot, #E4570B) calc(var(--p) * 1%), var(--qr-line, #E3E5EC) 0);
  transition: background .9s linear;
}
.qr-pause-ring b { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--qr-paper, #fff); font-size: 18px; font-variant-numeric: tabular-nums; }
.qr-breath { width: 64px; height: 64px; margin: 6px 0 2px; border-radius: 50%; background: radial-gradient(circle, rgba(31, 107, 75, .35), rgba(31, 107, 75, .08)); transition: transform 4s ease-in-out; }
.qr-breath.is-in { transform: scale(1.25); }
.qr-breath.is-out { transform: scale(.7); }
@media (prefers-reduced-motion: reduce) {
  .qr-bump, .qr-bump .notification-badge, .qr-pause-icon { animation: none; }
  .qr-pause, .qr-breath { transition: none; }
}

.qr-country-chips { flex-wrap: wrap; gap: 6px; }
.qr-country-chips .qr-pause-btn { padding: 6px 12px; }

/* ---------- Reloj de tarjetas: hora de Venezuela y de España ---------- */
.qr-clocks { --fc-card: #1B1C29; --fc-ink: #FFFFFF; --fc-line: rgba(255, 255, 255, .14); display: flex; align-items: center; gap: 12px; margin-right: 4px; }
body.dark-mode .qr-clocks { --fc-card: #2A2C3A; --fc-ink: #F1F1F4; --fc-line: rgba(0, 0, 0, .35); }
.fc-zone { display: inline-flex; align-items: center; gap: 5px; cursor: default; }
.fc-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--qr-muted, #8A90A2); }
.fc-digits { display: inline-flex; align-items: center; gap: 2px; }
.fc-card {
  position: relative; display: inline-block; width: 14px; height: 20px; perspective: 90px;
  font: 700 12.5px/20px 'Figtree', system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--fc-ink);
  border-radius: 3.5px; box-shadow: 0 1px 1.5px rgba(27, 28, 41, .18);
}
.fc-half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; background: var(--fc-card); backface-visibility: hidden; }
.fc-half span { display: block; height: 20px; line-height: 20px; text-align: center; }
.fc-top { top: 0; border-radius: 3.5px 3.5px 0 0; }
.fc-bottom { bottom: 0; border-radius: 0 0 3.5px 3.5px; }
.fc-bottom span { margin-top: -10px; }
.fc-card::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; margin-top: -.5px; background: var(--fc-line); z-index: 3; }
.fc-flap { z-index: 2; }
.fc-flap-top { transform-origin: 50% 100%; animation: fcTop .26s ease-in forwards; }
.fc-flap-bottom { transform-origin: 50% 0; transform: rotateX(90deg); animation: fcBottom .26s ease-out .26s forwards; }
@keyframes fcTop { from { transform: rotateX(0); } to { transform: rotateX(-90deg); filter: brightness(.7); } }
@keyframes fcBottom { from { transform: rotateX(90deg); filter: brightness(1.25); } to { transform: rotateX(0); } }
.fc-colon { position: relative; width: 3px; height: 12px; margin: 0 1px; }
.fc-colon::before, .fc-colon::after { content: ''; position: absolute; left: 0; width: 3px; height: 3px; border-radius: 50%; background: var(--qr-muted, #8A90A2); animation: fcBlink 2s steps(1) infinite; }
.fc-colon::before { top: 1px; }
.fc-colon::after { bottom: 1px; }
@keyframes fcBlink { 50% { opacity: .25; } }
.fc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1100px) { .fc-label { display: none; } .qr-clocks { gap: 8px; } }
@media (max-width: 760px) { .qr-clocks { display: none; } }
@media (prefers-reduced-motion: reduce) { .fc-flap-top, .fc-flap-bottom, .fc-colon::before, .fc-colon::after { animation: none; } }

/* Entregas: sin entrega en amarillo (el verde queda solo para entregados) */
.qr-dl-card[data-level="wait"] { border-left-color: #EAB308; }
.qr-dl-card[data-level="wait"] .qr-fu-state { color: #A16207; }
body.dark-mode .qr-dl-card[data-level="wait"] .qr-fu-state { color: #FACC15; }
