:root {
  /* Marca */
  --navy-900: #0b1f34;
  --navy: #122d48;
  --navy-700: #1d3f60;
  --navy-500: #35597c;
  --cian: #20c8d8;
  --cian-600: #14aab9;
  --cian-700: #0f8a97;
  --sky: #78c3d5;
  --sky-tint: #e8f6f9;
  --sky-tint-2: #f2fafc;
  --yellow: #f2df4b;
  --yellow-tint: #fdf7d8;
  /* Neutros */
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e7edf4;
  --border-strong: #d8e2ec;
  --text: #16304a;
  --text-muted: #6a7d90;
  --text-soft: #94a4b4;
  /* Semánticos */
  --danger: #d64f3f;
  --danger-tint: #fdecea;
  --warn: #c8871a;
  --warn-tint: #fbf1dd;
  --ok: #17936a;
  --ok-tint: #e4f5ee;
  /* Sombras */
  --sh-xs: 0 1px 2px rgba(16, 42, 68, 0.06);
  --sh-sm: 0 2px 8px rgba(16, 42, 68, 0.07);
  --sh-md: 0 8px 24px rgba(16, 42, 68, 0.10);
  --sh-lg: 0 20px 48px rgba(16, 42, 68, 0.18);
  --sh-cian: 0 8px 22px rgba(32, 200, 216, 0.34);
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.011em;
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(1100px 620px at 88% -12%, rgba(32, 200, 216, 0.13), transparent 60%),
    radial-gradient(900px 560px at -8% 110%, rgba(120, 195, 213, 0.16), transparent 58%),
    linear-gradient(160deg, #f5fbfc 0%, #eef4f9 52%, #e9f1f7 100%);
  background-attachment: fixed;
}
h1, h2, h3 { letter-spacing: -0.02em; }

svg.icon { width: 18px; height: 18px; display: block; flex-shrink: 0; }

/* ================= Topbar ================= */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 66px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(16, 42, 68, 0.06);
  flex-shrink: 0;
  z-index: 20;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cian), rgba(120, 195, 213, 0.6), transparent);
  opacity: 0.75;
}
.topbar__brand { display: flex; align-items: center; gap: 16px; }
.brand-lockup { display: inline-flex; align-items: flex-end; gap: 8px; }
.brand-logo { height: 27px; width: auto; display: block; }
.brand-logo-leads { height: 27px; width: auto; display: block; margin-bottom: 5px; }
.brand-sep { width: 1px; height: 28px; background: var(--border-strong); }
.brand-sub { font-size: 13.5px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.2px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }

/* ================= Botones ================= */
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    transform 0.08s var(--ease), box-shadow 0.2s var(--ease), border-color 0.18s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 17px; height: 17px; }

.btn--primary {
  background: linear-gradient(135deg, var(--cian), var(--cian-600));
  color: #fff;
  box-shadow: var(--sh-cian);
}
.btn--primary:hover { filter: brightness(1.06); box-shadow: 0 12px 28px rgba(32, 200, 216, 0.42); }
.btn--primary:disabled { opacity: 0.6; cursor: default; filter: none; box-shadow: var(--sh-xs); }

.btn--secondary {
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--border-strong);
  box-shadow: var(--sh-xs);
}
.btn--secondary:hover { border-color: var(--cian); color: var(--cian-700); }

.btn--ghost { background: transparent; color: var(--text-muted); padding: 9px 12px; }
.btn--ghost:hover { background: var(--surface-2); color: var(--navy); }

.btn--icon {
  width: 38px; height: 38px; padding: 0;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--navy);
  box-shadow: var(--sh-xs);
}
.btn--icon:hover { border-color: var(--cian); color: var(--cian-700); }
.btn--icon .icon { width: 19px; height: 19px; }

/* Contenido interno: por encima de los brillos (texto siempre nítido) */
.btn__in { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 8px; }

/* Aprobar — teal metálico (positivo, on-brand) */
.btn--approve {
  position: relative; overflow: hidden;
  color: #fff;
  flex: 1; justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 45%),
    linear-gradient(180deg, #35d2df 0%, #20c8d8 46%, #0f9dac 100%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 20px rgba(20, 160, 180, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(0, 40, 50, 0.12);
  text-shadow: 0 1px 1px rgba(0, 55, 65, 0.25);
}
.btn--approve:hover { filter: brightness(1.04); box-shadow: 0 10px 26px rgba(20, 160, 180, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(0, 40, 50, 0.12); }

/* Rechazar — plata/acero metálico (neutro, rojo sutil al hover) */
.btn--reject {
  position: relative; overflow: hidden;
  color: var(--navy);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 46%),
    linear-gradient(180deg, #fdfefe 0%, #eef3f8 48%, #d9e4ee 100%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 3px 10px rgba(16, 42, 68, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(16, 42, 68, 0.07);
}
.btn--reject:hover { color: var(--danger); border-color: #e6b4ab; }

/* Brillos compartidos: barrido al entrar + reflejo que sigue al cursor */
.btn--approve::before, .btn--reject::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: 1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-18deg); opacity: 0; pointer-events: none;
}
.btn--approve:hover::before, .btn--reject:hover::before { animation: btnSheen 0.9s var(--ease); }
.btn--approve::after, .btn--reject::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0; transition: opacity 0.3s var(--ease);
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 55%);
}
.btn--approve:hover::after, .btn--reject:hover::after { opacity: 1; }

.btn:disabled, .btn.is-disabled { opacity: 0.5; pointer-events: none; box-shadow: none; }

.spin-anim { animation: spin 0.6s var(--ease); }

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
}
.count-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cian);
  box-shadow: 0 0 0 3px rgba(32, 200, 216, 0.25);
  animation: pulse 2s ease-in-out infinite;
}

/* Contador de leads saltados (cabecera) */
.skip-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--navy); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 5px 6px 5px 12px; cursor: pointer;
  box-shadow: var(--sh-xs);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.08s var(--ease);
}
.skip-badge .icon { width: 15px; height: 15px; color: var(--text-muted); transition: color 0.18s var(--ease); }
.skip-badge:hover { border-color: var(--cian); color: var(--cian-700); box-shadow: var(--sh-sm); }
.skip-badge:hover .icon { color: var(--cian); }
.skip-badge:active { transform: scale(0.96); }
.skip-badge.bump { animation: skipBump 0.5s var(--ease-spring); }
.skip-badge #skipped-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--navy); color: #fff;
  font-size: 12px; font-weight: 700; border-radius: 999px;
}

/* Toasts */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 40px)); pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative;
  display: flex; align-items: flex-start; gap: 11px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid var(--border-strong); border-left: 3px solid var(--cian);
  border-radius: var(--r-md); padding: 12px 14px 12px 13px;
  box-shadow: var(--sh-md);
  animation: toastIn 0.32s var(--ease-spring) both;
}
.toast.is-leaving { animation: toastOut 0.28s var(--ease) forwards; }
.toast__ic {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--sky-tint); color: var(--cian-700);
}
/* Éxito (correo generado) — cian */
.toast--ok { border-left-color: var(--cian); }
.toast--ok .toast__ic { background: var(--sky-tint); color: var(--cian-700); }
/* Saltado (falta email/web) — navy neutro */
.toast--skip { border-left-color: var(--navy-500); }
.toast--skip .toast__ic { background: var(--surface-2); color: var(--navy); }
.toast__ic .icon { width: 17px; height: 17px; }
.toast__tx { min-width: 0; flex: 1; }
.toast__title { font-size: 13.5px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.toast__desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.toast__desc b { color: var(--cian-700); font-weight: 600; }
.toast__desc .tkv { display: inline-block; min-width: 44px; color: var(--text-soft); font-weight: 600; }
.toast__close {
  border: none; background: transparent; color: var(--text-soft); cursor: pointer;
  padding: 2px; border-radius: 6px; flex-shrink: 0; display: flex;
}
.toast__close:hover { color: var(--danger); }
.toast__close .icon { width: 15px; height: 15px; }

/* Lista de saltados (modal) */
.skipped-list { display: flex; flex-direction: column; gap: 10px; }
.skipped-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; background: var(--surface);
}
.skipped-item__av {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-700));
  color: var(--cian); font-weight: 700; font-size: 15px;
}
.skipped-item__tx { min-width: 0; flex: 1; }
.skipped-item__name { font-weight: 700; font-size: 14px; color: var(--navy); }
.skipped-item__meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Iconos de motivo (sustituyen al pill de texto): 1 o 2 según lo que falte */
.skipped-item__flags { flex-shrink: 0; display: inline-flex; gap: 6px; }
.skip-flag {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--navy-500); background: var(--surface-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.08s var(--ease);
}
.skip-flag:hover { color: var(--cian-700); background: #fff; border-color: var(--cian); box-shadow: var(--sh-xs); transform: translateY(-1px); }
.skip-flag:active { transform: scale(0.94); }
.skip-flag .icon { width: 17px; height: 17px; }

/* ================= Layout ================= */
.layout {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(330px, 40%) 1fr;
  gap: 22px;
  padding: 22px 28px;
  overflow: hidden;
  min-height: 0;
}

/* ================= Fondo dinámico (orbes + luz de cursor) ================= */
.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
/* .orb = caja posicionada que lleva el parallax del ratón (transform vía JS).
   .orb__glow = capa visual (blur + degradado) que lleva el drift ambiental. */
.bg-orbs .orb { position: absolute; will-change: transform; transform: translate3d(0, 0, 0); }
.bg-orbs .orb__glow { position: absolute; inset: 0; border-radius: 50%; filter: blur(64px); opacity: 0.7; will-change: transform; }
.orb--1 { width: 520px; height: 520px; left: -120px; top: -120px; }
.orb--2 { width: 460px; height: 460px; left: 4%; bottom: -160px; }
.orb--3 { width: 380px; height: 380px; left: 24%; top: 42%; }
.orb--1 .orb__glow { background: radial-gradient(circle, rgba(32, 200, 216, 0.85), transparent 66%); animation: orb1 24s ease-in-out infinite; }
.orb--2 .orb__glow { background: radial-gradient(circle, rgba(23, 169, 184, 0.75), transparent 66%); animation: orb2 30s ease-in-out infinite; }
.orb--3 .orb__glow { background: radial-gradient(circle, rgba(120, 195, 213, 0.7), transparent 68%); animation: orb3 36s ease-in-out infinite; }
@keyframes orb1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(160px, 120px) scale(1.18); } }
@keyframes orb2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(140px, -110px) scale(1.14); } }
@keyframes orb3 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(180px, 80px) scale(1.22); } }

/* Luz suave que sigue al cursor (se coloca por su centro vía JS) */
.cursor-glow {
  position: absolute; top: 0; left: 0; width: 460px; height: 460px; margin: -230px 0 0 -230px;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(32, 200, 216, 0.18), rgba(32, 200, 216, 0.07) 42%, transparent 68%);
  transition: opacity 0.6s var(--ease); will-change: transform;
}
.cursor-glow.is-on { opacity: 1; }

/* ================= Columna lista ================= */
.list-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 14px;
}
.col-head__title { display: flex; align-items: baseline; gap: 9px; }
.col-head__title h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--navy); }
.col-head__hint {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-soft);
}
.col-head__hint .live {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}

.list-scroll { flex: 1; overflow-y: auto; padding: 3px 6px 8px 3px; min-height: 0; }
.list-scroll::-webkit-scrollbar { width: 10px; }
.list-scroll::-webkit-scrollbar-thumb {
  background: #d3dfea; border-radius: 999px;
  border: 3px solid transparent; background-clip: content-box;
}
.list-scroll::-webkit-scrollbar-thumb:hover { background: #bccbd9; background-clip: content-box; }

.mail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.mail-card {
  position: relative;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--r-lg);
  padding: 16px 18px 16px 20px;
  cursor: pointer;
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
  animation: cardIn 0.5s var(--ease) backwards;
}
.mail-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--cian), var(--sky));
  transform: scaleY(0.001); transition: transform 0.28s var(--ease);
}
.mail-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--border-strong); }
.mail-card:hover::before { transform: scaleY(1); }
.mail-card.is-active {
  border-color: var(--cian);
  box-shadow: 0 0 0 1.5px var(--cian), var(--sh-md);
  background: linear-gradient(180deg, #fff, var(--sky-tint-2));
}
.mail-card.is-active::before { transform: scaleY(1); }

.mail-card__top { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.mail-card__avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-700));
  color: var(--cian); font-weight: 700; font-size: 14px;
}
.mail-card__empresa { font-weight: 700; font-size: 14.5px; color: var(--navy); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-card__estado {
  flex-shrink: 0; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--warn); background: var(--warn-tint); border: 1px solid #f0e2b4;
  padding: 3px 9px; border-radius: 999px;
}
/* Icono de web (sustituye al badge de estado) */
.mail-card__web {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--cian-700); background: var(--sky-tint);
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease-spring), box-shadow 0.18s var(--ease);
}
.mail-card__web .icon { width: 17px; height: 17px; }
.mail-card__web:hover { color: var(--cian); background: #fff; border-color: var(--cian); transform: translateY(-1px) rotate(12deg) scale(1.06); box-shadow: var(--sh-sm); }
.mail-card__web:active { transform: scale(0.92); }
.mail-card__web.is-off { color: var(--text-soft); background: var(--surface-2); cursor: default; }
.mail-card__web.is-off:hover { transform: none; border-color: transparent; box-shadow: none; color: var(--text-soft); background: var(--surface-2); }
.mail-card__email { font-size: 12.5px; color: var(--cian-700); font-weight: 600; margin: 0 0 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-card__asunto { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ================= Columna preview ================= */
.preview-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.preview-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; color: var(--text-muted); text-align: center; padding: 40px;
  animation: fadeIn 0.4s var(--ease) both;
}
.preview-empty__icon {
  width: 84px; height: 84px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  color: var(--cian); background: var(--sky-tint);
  animation: floaty 3.6s ease-in-out infinite;
}
.preview-empty__icon .icon { width: 38px; height: 38px; }
.preview-empty p { font-size: 14.5px; margin: 0; max-width: 260px; line-height: 1.5; }

.preview-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.preview-content.reveal { animation: fadeUp 0.4s var(--ease) both; }

.preview-head { padding: 18px 24px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; background: linear-gradient(180deg, #fff, #fbfdfe); }
.preview-head__row { display: flex; align-items: center; gap: 12px; }
.preview-head__av {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-700)); color: var(--cian); font-weight: 700; font-size: 17px;
}
.preview-head__meta { flex: 1; min-width: 0; }
.pv-empresa { display: block; font-weight: 700; font-size: 16px; color: var(--navy); line-height: 1.2; }
.pv-email { font-size: 12.5px; color: var(--cian-700); font-weight: 600; }
.preview-head__tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pv-asunto { margin: 14px 0 0; font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.4; }

.preview-frame-wrap { flex: 1; min-height: 0; background: #eef2f6; padding: 16px; }
.preview-frame { width: 100%; height: 100%; border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; box-shadow: var(--sh-xs); }

.preview-foot {
  flex-shrink: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px);
}
.action-status { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; animation: fadeIn 0.25s var(--ease) both; }
.action-status.is-ok { color: var(--ok); background: var(--ok-tint); }
.action-status.is-error { color: var(--danger); background: var(--danger-tint); }
.action-status.is-busy { color: var(--cian-700); background: var(--sky-tint); }

/* Barra de carga de la ejecución (fina, arriba del todo) */
.run-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90;
  background: rgba(32, 200, 216, 0.14); overflow: hidden;
}
.run-progress::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 38%;
  background: linear-gradient(90deg, transparent, var(--cian), var(--cian-600));
  border-radius: 999px;
  animation: runbar 1.15s ease-in-out infinite;
}
@keyframes runbar { 0% { left: -40%; } 100% { left: 100%; } }

/* ================= Estados ================= */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 15px; padding: 46px 28px; text-align: center; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.4s var(--ease) both;
}
.state__icon { width: 78px; height: 78px; border-radius: 22px; display: flex; align-items: center; justify-content: center; }
.state__icon .icon { width: 34px; height: 34px; }
.state__icon.ok { background: var(--ok-tint); color: var(--ok); }
.state__icon.warn { background: var(--warn-tint); color: var(--warn); }
.state h3 { margin: 0; color: var(--navy); font-size: 17px; }
.state p { margin: 0; font-size: 13.5px; max-width: 300px; line-height: 1.5; }
.state .btn { margin-top: 4px; }

/* Skeletons */
.skeleton-list { list-style: none; margin: 0; padding: 3px; display: flex; flex-direction: column; gap: 12px; }
.skeleton-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh-xs); }
.sk-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef3f7 25%, #dfe8f0 37%, #eef3f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.sk-line + .sk-line { margin-top: 10px; }
.sk-line.w-60 { width: 60%; } .sk-line.w-40 { width: 40%; } .sk-line.w-90 { width: 90%; } .sk-line.w-75 { width: 75%; }

/* ================= Modal estadísticas ================= */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 3vh 24px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(11, 31, 52, 0.5); backdrop-filter: blur(3px); animation: fadeIn 0.22s var(--ease) both; }
.modal__card {
  position: relative; background: var(--surface); border-radius: 20px; box-shadow: var(--sh-lg);
  width: min(920px, 100%); max-height: 94vh; display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn 0.32s var(--ease-spring) both;
}
.modal__head { display: flex; align-items: center; gap: 14px; padding: 20px 26px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #fff, #fbfdfe); }
.modal__head-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--sky-tint); color: var(--cian-700); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal__head-tx { flex: 1; min-width: 0; }
.modal__head h3 { margin: 0; font-size: 18px; color: var(--navy); }
.modal__head p { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.modal__close { border: none; background: var(--surface-2); color: var(--text-muted); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s var(--ease); }
.modal__close:hover { background: var(--danger-tint); color: var(--danger); }
.modal__body { padding: 22px 26px 26px; overflow-y: auto; }

/* Resumen superior */
.stats-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; }
.stat-tile .num { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -0.5px; }
.stat-tile .lbl { font-size: 12px; color: var(--text-muted); margin-top: 7px; font-weight: 500; }
.stat-tile.accent { background: linear-gradient(135deg, var(--navy), var(--navy-700)); border-color: transparent; }
.stat-tile.accent .num { color: #fff; }
.stat-tile.accent .lbl { color: rgba(255, 255, 255, 0.72); }
.stat-tile.danger .num { color: var(--danger); }
.stat-tile.warn .num { color: var(--warn); }

/* Resumen del estado de la web */
.stats-summary { display: flex; gap: 24px; align-items: center; background: linear-gradient(140deg, #10304c, #0b4a58); border-radius: 16px; padding: 22px 26px; margin-bottom: 22px; color: #eaf3f8; position: relative; overflow: hidden; }
.stats-summary::after { content: ""; position: absolute; right: -50px; top: -50px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(32, 200, 216, 0.22), transparent 70%); pointer-events: none; }
.stats-summary__ring { position: relative; flex-shrink: 0; width: 104px; height: 104px; z-index: 1; }
.stats-summary__ring svg { width: 104px; height: 104px; transform: rotate(-90deg); }
.stats-summary__ring .pct { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stats-summary__ring .pct b { font-size: 27px; font-weight: 800; color: #fff; line-height: 1; }
.stats-summary__ring .pct span { font-size: 9.5px; color: rgba(255, 255, 255, 0.6); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.6px; }
.stats-summary__tx { flex: 1; min-width: 0; z-index: 1; }
.stats-summary__verdict { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.stats-summary__verdict .lead { font-size: 15px; font-weight: 700; color: #fff; }
.stats-summary__verdict .tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 11px; border-radius: 999px; }
.stats-summary__verdict .tag.ok { background: rgba(23, 147, 106, 0.3); color: #74e6ba; }
.stats-summary__verdict .tag.mid { background: rgba(200, 135, 26, 0.3); color: #f6d079; }
.stats-summary__verdict .tag.high { background: rgba(214, 79, 63, 0.32); color: #f4a89d; }
.stats-summary__diag { font-size: 13.5px; color: rgba(234, 243, 248, 0.82); margin: 0 0 13px; line-height: 1.5; }
.stats-summary__hi { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px 20px; }
.stats-summary__hi li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #dbe8ef; }
.stats-summary__hi .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--cian); }
@media (max-width: 560px) { .stats-summary { flex-direction: column; text-align: center; } }

.stats-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-soft); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }

/* ===== Análisis con IA ===== */
.ai-block { margin: 0 0 22px; }
.btn--ai {
  width: 100%; justify-content: center; color: #fff;
  background: linear-gradient(120deg, var(--navy), var(--cian-700) 62%, var(--cian));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 22px rgba(20, 160, 180, 0.26);
}
.btn--ai:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(20, 160, 180, 0.34); }
.btn--ai .icon { width: 17px; height: 17px; }

.ai-result { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); padding: 16px 18px; animation: fadeUp 0.4s var(--ease) both; }
.ai-head { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--cian-700); margin-bottom: 12px; }
.ai-head .icon { width: 15px; height: 15px; }
.ai-verdict { margin: 0 0 15px; font-size: 15px; font-weight: 700; color: var(--navy); line-height: 1.45; }
.ai-subtitle { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-soft); margin: 0 0 10px; }
.ai-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ai-item { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); padding: 12px 14px; }
.ai-item__head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.ai-item__title { font-size: 14px; font-weight: 700; color: var(--navy); }
.ai-item__desc { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.ai-imp { flex-shrink: 0; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 3px 9px; border-radius: 999px; }
.ai-imp--alto { color: var(--cian-700); background: var(--sky-tint); border: 1px solid #bfe6ec; }
.ai-imp--medio { color: var(--navy-500); background: var(--surface-2); border: 1px solid var(--border-strong); }
.ai-imp--bajo { color: var(--text-soft); background: var(--surface-2); border: 1px solid var(--border); }
.ai-valor { font-size: 13.5px; color: var(--navy); background: var(--sky-tint); border-radius: var(--r-md); padding: 13px 16px; line-height: 1.5; }
.ai-valor__lbl { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--cian-700); margin-bottom: 5px; }
.ai-text { font-size: 13.5px; color: var(--text); line-height: 1.6; }
.ai-loading { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-muted); padding: 6px 0; }
.ai-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--sky-tint); border-top-color: var(--cian); animation: spin 0.8s linear infinite; flex-shrink: 0; }
.ai-error { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-muted); }
.ai-error .icon { color: var(--warn); width: 20px; height: 20px; flex-shrink: 0; }
.ai-error b { color: var(--navy); }

/* Tarjetas de problemas */
.prob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 11px; margin-bottom: 22px; }
.prob-card { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); animation: fadeUp 0.4s var(--ease) backwards; }
.prob-card__ic { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.prob-card__ic .icon { width: 20px; height: 20px; }
.prob-card.sev-high .prob-card__ic { background: var(--danger-tint); color: var(--danger); }
.prob-card.sev-mid .prob-card__ic { background: var(--warn-tint); color: var(--warn); }
.prob-card.sev-ok .prob-card__ic { background: var(--ok-tint); color: var(--ok); }
.prob-card__tx { min-width: 0; }
.prob-card__val { font-size: 19px; font-weight: 700; color: var(--navy); line-height: 1; }
.prob-card__lbl { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* Detalle por página */
.stats-page { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 12px; background: var(--surface); }
.stats-page__url { font-size: 12.5px; font-weight: 600; color: var(--cian-700); margin: 0 0 12px; word-break: break-all; }
.stats-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.stats-row:first-of-type { border-top: none; }
.stats-row .k { color: var(--text-muted); width: 130px; flex-shrink: 0; font-weight: 500; }
.stats-row .v { color: var(--text); flex: 1; word-break: break-word; }
.stats-row .v .len { color: var(--text-soft); font-size: 12px; }
.stats-row .v.empty { color: var(--danger); font-style: italic; }
.stats-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.stats-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  color: var(--navy-500); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 5px 12px;
  cursor: default;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease-spring), box-shadow 0.18s var(--ease);
}
.stats-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--border-strong);
  transition: background 0.18s var(--ease), transform 0.18s var(--ease-spring);
}
.stats-tag:hover {
  color: var(--cian-700); background: #fff; border-color: var(--cian);
  transform: translateY(-2px); box-shadow: var(--sh-sm);
}
.stats-tag:hover::before { background: var(--cian); transform: scale(1.4); }
.stats-diag { font-size: 14px; color: var(--navy); background: var(--sky-tint); border-radius: var(--r-md); padding: 13px 16px; margin: 0 0 20px; display: flex; gap: 10px; align-items: flex-start; }
.stats-diag .icon { color: var(--cian-700); margin-top: 1px; }

/* ================= Muñequito (rediseño) ================= */
.ecope-walker { position: fixed; left: 0; bottom: 24px; z-index: 15; pointer-events: none; will-change: transform; animation: ecWalk 30s linear infinite; }
.ecope-walker svg { overflow: visible; }
.ecope-walker__inner { transform-origin: bottom center; animation: ecBob 0.5s ease-in-out infinite alternate; pointer-events: auto; cursor: pointer; }
.ecope-walker__body { transform-box: fill-box; transform-origin: bottom center; transition: transform 0.55s var(--ease-spring); }
.ecope-walker .shadow { transform-origin: center; animation: ecShadow 0.5s ease-in-out infinite alternate; }
.ecope-walker .limb { transform-box: fill-box; transform-origin: top center; }
.ecope-walker .leg-a { animation: ecStepA 0.5s ease-in-out infinite; }
.ecope-walker .leg-b { animation: ecStepB 0.5s ease-in-out infinite; }
.ecope-walker .antenna-dot { animation: ecBlink 2.4s ease-in-out infinite; }
.ecope-walker .face-x, .ecope-walker .face-trip { display: none; }

.ecope-walker:hover, .ecope-walker:hover .ecope-walker__inner, .ecope-walker:hover .limb, .ecope-walker:hover .shadow { animation-play-state: paused; }
.ecope-walker:hover .face-normal { display: none; }
.ecope-walker:hover .face-x { display: block; }

.ecope-walker.is-tripped, .ecope-walker.is-tripped .ecope-walker__inner, .ecope-walker.is-tripped .limb, .ecope-walker.is-tripped .shadow { animation-play-state: paused; }
.ecope-walker.is-tripped .ecope-walker__body { animation: ecTrip 0.75s var(--ease) forwards; }
.ecope-walker.is-tripped .face-normal, .ecope-walker.is-tripped .face-x { display: none; }
.ecope-walker.is-tripped .face-trip { display: block; }

/* ================= Calendario de citas ================= */
.modal__card--wide { width: min(1060px, 100%); }
.btn-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 3px; border-radius: 999px; background: var(--cian); color: #fff; font-size: 11px; font-weight: 700; }

.cal-toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 26px 4px; }
.cal-toolbar .btn--icon { width: 34px; height: 34px; }
.cal-range { margin-left: 6px; font-size: 14.5px; font-weight: 700; color: var(--navy); text-transform: capitalize; }

.cal { display: grid; grid-template-columns: 58px repeat(5, 1fr); gap: 8px; }
.cal__corner { }
.cal__dayhead { text-align: center; padding: 7px 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.cal__dayhead .d { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-soft); font-weight: 700; }
.cal__dayhead .n { display: block; font-size: 16px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.cal__dayhead.is-today { background: var(--sky-tint); border-color: #bfe6ec; }
.cal__dayhead.is-today .n { color: var(--cian-700); }
.cal__hour { display: flex; align-items: flex-start; justify-content: flex-end; padding: 8px 6px 0 0; font-size: 12px; color: var(--text-soft); font-weight: 600; }
.cal__cell { min-height: 46px; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 4px; transition: background 0.15s var(--ease); }
.cal__cell.is-today { background: rgba(32, 200, 216, 0.05); }

.cita-card { border-radius: 8px; padding: 7px 9px; cursor: pointer; border: 1px solid transparent; transition: transform 0.1s var(--ease), box-shadow 0.16s var(--ease); }
.cita-card:hover { transform: translateY(-1px); box-shadow: var(--sh-sm); }
.cita-card__emp { display: block; font-size: 12.5px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cita-card__meta { display: block; font-size: 10.5px; font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.4px; }
.cita-card.is-pendiente { background: var(--surface-2); border-color: var(--border-strong); }
.cita-card.is-pendiente .cita-card__emp { color: var(--navy); }
.cita-card.is-pendiente .cita-card__meta { color: var(--text-soft); }
.cita-card.is-aprobada { background: var(--sky-tint); border-color: #bfe6ec; }
.cita-card.is-aprobada .cita-card__emp { color: var(--cian-700); }
.cita-card.is-aprobada .cita-card__meta { color: var(--cian-700); }

/* Detalle / administración de una cita */
.cita-detail__card { width: min(460px, 100%); }
.cita-detail__av { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy), var(--navy-700)); color: var(--cian); font-weight: 700; font-size: 18px; }
.cita-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.cita-row:first-child { border-top: none; }
.cita-row .k { color: var(--text-muted); width: 82px; flex-shrink: 0; font-weight: 500; }
.cita-row .v { color: var(--text); flex: 1; word-break: break-word; }
.cita-row .v a { color: var(--cian-700); font-weight: 600; text-decoration: none; }
.cita-row .v a:hover { text-decoration: underline; }
.cita-estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.cita-estado.is-pendiente { color: var(--navy-500); background: var(--surface-2); border: 1px solid var(--border-strong); }
.cita-estado.is-aprobada { color: var(--cian-700); background: var(--sky-tint); border: 1px solid #bfe6ec; }
.cita-move { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.cita-move label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cita-move select { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--navy); cursor: pointer; }
.cita-actions { display: flex; gap: 10px; margin-top: 18px; }
.cita-actions .btn { flex: 1; justify-content: center; }
.btn--danger { background: var(--danger-tint); color: var(--danger); border: 1px solid #f0cbc5; }
.btn--danger:hover { background: #fbe0dc; border-color: #e6a79e; }

/* ================= Animaciones ================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes ecWalk { from { transform: translateX(-100px); } to { transform: translateX(calc(100vw + 60px)); } }
@keyframes ecBob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes ecShadow { from { transform: scaleX(1); opacity: 0.22; } to { transform: scaleX(0.82); opacity: 0.14; } }
@keyframes ecStepA { 0% { transform: rotate(20deg); } 50% { transform: rotate(-20deg); } 100% { transform: rotate(20deg); } }
@keyframes ecStepB { 0% { transform: rotate(-20deg); } 50% { transform: rotate(20deg); } 100% { transform: rotate(-20deg); } }
@keyframes ecBlink { 0%, 92%, 100% { opacity: 1; } 96% { opacity: 0.25; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(0.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(0.96); } }
@keyframes skipBump { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.18); } }
@keyframes btnSheen { 0% { left: -60%; opacity: 0; } 18% { opacity: 1; } 100% { left: 120%; opacity: 0; } }
@keyframes ecTrip {
  0%   { transform: rotate(0deg); }
  16%  { transform: rotate(-13deg); }   /* tropieza hacia atrás */
  52%  { transform: rotate(86deg); }    /* se vuelca */
  70%  { transform: rotate(68deg); }    /* rebote */
  85%  { transform: rotate(80deg); }
  100% { transform: rotate(76deg); }    /* se queda tumbado */
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .ecope-walker { display: none !important; }
}
