/**
 * Sales Analytics — estilos aislados.
 * Scope: body.analytics-body / #analytics-app / #analytics-login / modal.
 * Prefijo: analytics-
 * No importa CSS del portal.
 */

.analytics-body {
  --analytics-ink: #0a1628;
  --analytics-primary: #1d4f91;
  --analytics-accent: #c9a84c;
  --analytics-bg: #f3f5f8;
  --analytics-surface: #ffffff;
  --analytics-line: #dde3ea;
  --analytics-muted: #5b6b7c;
  --analytics-ok: #1f7a4d;
  --analytics-warn: #b78100;
  --analytics-bad: #b42318;
  --analytics-soft: #eef2f6;
  --analytics-soft-bad: #fdeceb;
  --analytics-soft-warn: #fff6e0;
  --analytics-soft-ok: #e8f6ee;
  --analytics-soft-info: #e8eef7;
  --analytics-radius: 12px;
  --analytics-shadow: 0 1px 2px rgba(10, 22, 40, 0.04);
  margin: 0;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  color: var(--analytics-ink);
  background: var(--analytics-bg);
  line-height: 1.45;
  min-height: 100vh;
}

.analytics-body.is-modal-open {
  overflow: hidden;
}

.analytics-body *,
.analytics-body *::before,
.analytics-body *::after {
  box-sizing: border-box;
}

.analytics-body a {
  color: var(--analytics-primary);
}

.analytics-body a:focus-visible,
.analytics-body button:focus-visible,
.analytics-body select:focus-visible,
.analytics-body input:focus-visible,
.analytics-body summary:focus-visible {
  outline: 2px solid var(--analytics-primary);
  outline-offset: 2px;
}

/* display:grid/flex anula el [hidden] nativo → forzar ocultar (mismo fix que admin-dashboard) */
[hidden],
#analytics-login[hidden],
#analytics-app[hidden],
.analytics-login[hidden],
.analytics-shell[hidden] {
  display: none !important;
}

/* —— Login —— */
.analytics-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top left, rgba(29, 79, 145, 0.08), transparent 50%),
    var(--analytics-bg);
}

.analytics-login-card {
  width: min(420px, 100%);
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: 16px;
  padding: 28px 26px;
  box-shadow: var(--analytics-shadow);
}

.analytics-login-card h1 {
  margin: 4px 0 8px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.analytics-login-lead {
  margin: 0 0 18px;
  color: var(--analytics-muted);
  font-size: 0.95rem;
}

.analytics-login-form {
  display: grid;
  gap: 12px;
}

.analytics-btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  background: #fff !important;
  color: var(--analytics-ink) !important;
  border: 1px solid var(--analytics-line) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.analytics-btn-google:hover:not(:disabled) {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.analytics-google-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.analytics-login-form label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--analytics-muted);
}

.analytics-login-form input {
  padding: 10px 12px;
  border: 1px solid var(--analytics-line);
  border-radius: 8px;
  font: inherit;
  color: var(--analytics-ink);
  background: #fff;
}

.analytics-turnstile-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 320px;
}

.analytics-write-captcha-panel {
  margin: 8px 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--analytics-line);
  border-radius: 10px;
  background: #fff;
  max-width: 420px;
}

.analytics-turnstile {
  min-height: 70px;
  min-width: 300px;
  width: 100%;
  margin: 4px 0;
  overflow: visible;
}

.analytics-turnstile-status,
.saa-turnstile-status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--analytics-muted);
}

.analytics-turnstile-status.is-warn,
.saa-turnstile-status.is-warn {
  color: var(--analytics-warn);
}

.analytics-turnstile-status.is-ok,
.saa-turnstile-status.is-ok {
  color: var(--analytics-ok);
}

.analytics-turnstile-status.is-error,
.saa-turnstile-status.is-error {
  color: var(--analytics-bad);
}

.analytics-error-inline {
  color: var(--analytics-bad);
  font-size: 0.88rem;
  margin: 10px 0 0;
}

.analytics-login-hint {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--analytics-muted);
}

.analytics-login-hint-warn {
  color: var(--analytics-bad);
}

.analytics-login-progress {
  margin: 12px 0 0;
  font-size: 0.86rem;
  color: var(--analytics-primary);
  font-weight: 650;
}

.analytics-login-lead-busy {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.analytics-login.is-busy .analytics-login-card {
  outline: 1px solid rgba(29, 79, 145, 0.18);
}

.analytics-btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  opacity: 1;
  cursor: wait;
}

.analytics-btn-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: analytics-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.analytics-login-lead-busy .analytics-btn-spinner {
  border-color: rgba(29, 79, 145, 0.25);
  border-top-color: var(--analytics-primary);
}

.analytics-btn-spinner-dark {
  border-color: rgba(29, 79, 145, 0.25);
  border-top-color: var(--analytics-primary, #1d4f91);
}

@keyframes analytics-spin {
  to {
    transform: rotate(360deg);
  }
}

.analytics-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(248, 250, 252, 0.62);
  backdrop-filter: blur(2px);
  /* No bloquear Buscar/Cancelar ni la barra de filtros */
  pointer-events: none;
  cursor: wait;
}

.analytics-header,
.analytics-toolbar {
  position: relative;
  z-index: 90;
}

.analytics-loading-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 160px;
  padding: 24px 12px;
}

.analytics-loading-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(29, 79, 145, 0.18);
  border-top-color: var(--analytics-primary, #1d4f91);
  border-radius: 50%;
  animation: analytics-spin 0.7s linear infinite;
}

.analytics-loading-msg {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--analytics-ink, #1a2332);
}

.analytics-loading-inline .analytics-loading-msg {
  color: var(--analytics-muted);
  font-weight: 500;
}

/* —— Shell —— */
.analytics-shell,
.analytics-module {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 0 40px;
}

.analytics-header {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.analytics-eyebrow {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--analytics-primary);
}

.analytics-title {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.analytics-subtitle {
  margin: 6px 0 0;
  color: var(--analytics-muted);
  font-size: 0.95rem;
  max-width: 42ch;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
}

.analytics-field {
  display: grid;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--analytics-muted);
}

.analytics-field-inline {
  align-items: end;
}

.analytics-field select,
.analytics-field input[type='date'],
.analytics-toolbar select {
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--analytics-line);
  border-radius: 8px;
  background: var(--analytics-surface);
  font: inherit;
  font-size: 0.9rem;
  color: var(--analytics-ink);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
}

.analytics-btn {
  appearance: none;
  border: 1px solid var(--analytics-primary);
  background: var(--analytics-primary);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.analytics-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.analytics-btn.is-loading:disabled {
  opacity: 1;
  cursor: wait;
}

.analytics-btn-ghost {
  background: var(--analytics-surface);
  color: var(--analytics-ink);
  border-color: var(--analytics-line);
}

.analytics-btn-ghost:hover {
  border-color: var(--analytics-primary);
  color: var(--analytics-primary);
}

.analytics-btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--analytics-primary);
  padding: 6px 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.analytics-meta-bar {
  margin: 0 0 18px;
  font-size: 0.82rem;
  color: var(--analytics-muted);
}

.analytics-leads-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  font-size: 0.9rem;
  font-weight: 600;
}

.analytics-leads-loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
  animation: analytics-pulse 1s ease-in-out infinite;
}

@keyframes analytics-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.analytics-module-leads.is-loading-period .analytics-section,
.analytics-module.is-loading-period .analytics-section,
.analytics-module.is-loading-period .reu-reading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.analytics-meta-bar strong {
  color: var(--analytics-ink);
  font-weight: 650;
}

.analytics-meta-bar .is-stale {
  color: var(--analytics-bad);
  font-weight: 650;
}

/* —— Alerts —— */
.analytics-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.analytics-alert {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid var(--analytics-line);
  background: var(--analytics-soft-info);
  font-size: 0.9rem;
}

.analytics-alert.is-info {
  background: var(--analytics-soft-info);
  border-color: #c5d4e8;
}

.analytics-alert.is-attention {
  background: var(--analytics-soft-warn);
  border-color: #efd59a;
}

.analytics-alert.is-critical {
  background: var(--analytics-soft-bad);
  border-color: #f0b4ae;
  margin-bottom: 16px;
}

.analytics-alert-list {
  margin: 0;
  padding-left: 18px;
}

/* —— Critical summary —— */
.analytics-critical {
  margin-bottom: 22px;
}

.analytics-critical-card {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-left: 5px solid var(--analytics-primary);
  border-radius: var(--analytics-radius);
  padding: 20px 22px;
  box-shadow: var(--analytics-shadow);
}

.analytics-critical-card.is-urgent {
  border-left-color: var(--analytics-bad);
  background: linear-gradient(180deg, #fff8f7 0%, var(--analytics-surface) 70%);
}

.analytics-critical-card.is-ok {
  border-left-color: var(--analytics-ok);
}

.analytics-critical-value {
  margin: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.analytics-critical-card.is-urgent .analytics-critical-value {
  color: var(--analytics-bad);
}

.analytics-critical-sub {
  margin: 8px 0 0;
  color: var(--analytics-muted);
  font-size: 0.98rem;
  max-width: 70ch;
}

/* —— Radiografía comercial (3 ciclos) —— */
/* Apilados: cada ciclo a ancho completo para que las tablas se lean bien. */
.analytics-commercial-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.analytics-cycle-card {
  padding: 16px 18px;
}

.analytics-cycle-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2px;
}

.analytics-cycle-titlewrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.analytics-cycle-total {
  font-size: clamp(2rem, 4vw, 2.9rem);
  font-weight: 800;
  line-height: 1;
  color: var(--analytics-text, #0f172a);
  font-variant-numeric: tabular-nums;
}

.analytics-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.analytics-chip.is-live {
  background: #ecfeff;
  color: #0e7490;
}
.analytics-chip.is-period {
  background: #f1f5f9;
  color: #475569;
}

/* Affordance de expandir más evidente */
.analytics-expand-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.analytics-expand-hint {
  font-size: 0.72rem;
  color: var(--analytics-primary, #2563eb);
  font-weight: 600;
  margin-top: 2px;
}
.analytics-expand[open] > summary .analytics-expand-hint::after {
  content: ' (ocultar)';
  color: var(--analytics-muted, #64748b);
  font-weight: 500;
}

.analytics-cycle-card .analytics-critical-card {
  margin-bottom: 12px;
}

/* Expandir estado interno → Embudo/Etapa Kommo */
.analytics-expand {
  margin: 0;
}
.analytics-expand > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  user-select: none;
}
.analytics-expand > summary::-webkit-details-marker {
  display: none;
}
.analytics-expand > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  color: var(--analytics-muted, #64748b);
  font-size: 0.75rem;
  transition: transform 0.12s ease;
}
.analytics-expand[open] > summary::before {
  transform: rotate(90deg);
}
.analytics-expand > summary strong {
  display: inline;
}
.analytics-kommo-wrap {
  display: none;
}
.analytics-state-row:has(details[open]) + .analytics-kommo-wrap {
  display: table-row;
}
.analytics-kommo-panel {
  margin: 4px 0 10px 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--analytics-line, #e2e8f0);
  background: rgba(15, 23, 42, 0.02);
  border-radius: 0 6px 6px 0;
}
.analytics-kommo-table {
  margin: 0;
  font-size: 0.92em;
}
.analytics-kommo-pipe {
  font-weight: 600;
  display: block;
}
.analytics-kommo-row td {
  color: var(--analytics-muted, #475569);
}

/* —— Sections —— */
.analytics-section {
  margin-bottom: 28px;
}

.analytics-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.analytics-section-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.analytics-section-note {
  margin: 0 0 12px;
  color: var(--analytics-muted);
  font-size: 0.88rem;
}

.analytics-entry-campaign-row td {
  background: #f8fafc;
  font-size: 0.9em;
}

.analytics-entry-campaign-label {
  padding-left: 1.1rem !important;
  font-weight: 500;
}

.analytics-entry-channels-sep td {
  padding: 14px 8px 8px;
  border-top: 2px solid var(--analytics-line, #cbd5e1);
  background: transparent;
  vertical-align: middle;
}

.analytics-entry-channels-sep-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--analytics-muted, #64748b);
}

.analytics-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--analytics-soft-info);
  color: var(--analytics-primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.analytics-panel {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 16px 18px;
  box-shadow: var(--analytics-shadow);
}

.analytics-panel-flush {
  border: 0;
  box-shadow: none;
  padding: 12px 0 0;
  background: transparent;
}

.analytics-panel-scroll {
  overflow-x: auto;
}

.analytics-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px 22px;
  margin-bottom: 8px;
}

.analytics-empty {
  margin: 0;
  color: var(--analytics-muted);
  font-size: 0.92rem;
}

/* —— KPIs —— */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.analytics-kpi-card {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 14px 14px 12px;
  box-shadow: var(--analytics-shadow);
  border-top: 3px solid var(--analytics-primary);
  min-width: 0;
}

.analytics-kpi-card.is-bad {
  border-top-color: var(--analytics-bad);
}

.analytics-kpi-card.is-warn {
  border-top-color: var(--analytics-warn);
}

.analytics-kpi-card.is-ok {
  border-top-color: var(--analytics-ok);
}

.analytics-kpi-card.is-muted {
  border-top-color: #9aa8b6;
}

.analytics-kpi-card.is-info {
  border-top-color: #60a5fa;
}

.analytics-kpi-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--analytics-muted);
  cursor: help;
}

.analytics-kpi-value {
  margin: 8px 0 4px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  word-break: break-word;
}

.analytics-kpi-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--analytics-muted);
  line-height: 1.35;
}

/* —— Bars / funnel —— */
.analytics-bars {
  display: grid;
  gap: 10px;
}

.analytics-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(0, 1.6fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.88rem;
}

.analytics-bar-row.is-dominant .analytics-bar-fill {
  background: var(--analytics-bad);
}

.analytics-bar-track {
  height: 10px;
  background: var(--analytics-soft);
  border-radius: 999px;
  overflow: hidden;
}

.analytics-bar-fill {
  height: 100%;
  background: var(--analytics-primary);
  border-radius: inherit;
  min-width: 0;
}

.analytics-bar-fill.is-warn {
  background: var(--analytics-warn);
}

.analytics-bar-fill.is-accent {
  background: var(--analytics-accent);
}

/* —— Barras duales (inversión + leads por día) —— */
.analytics-dual-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-dual-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--analytics-muted, #64748b);
}

.analytics-dual-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.analytics-dual-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.analytics-dual-swatch.is-spend {
  background: var(--analytics-primary);
}

.analytics-dual-swatch.is-leads {
  background: var(--analytics-accent);
}

.analytics-dual-key-cpl {
  margin-left: auto;
  font-style: italic;
}

.analytics-dual-row {
  display: grid;
  grid-template-columns: 92px 1fr 120px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--analytics-border, #e2e8f0);
}

.analytics-dual-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--analytics-text, #1e293b);
}

.analytics-dual-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.analytics-dual-track {
  position: relative;
  height: 14px;
  background: var(--analytics-soft);
  border-radius: 999px;
  overflow: hidden;
}

.analytics-dual-fill {
  height: 100%;
  border-radius: inherit;
  min-width: 2px;
}

.analytics-dual-fill.is-spend {
  background: var(--analytics-primary);
}

.analytics-dual-fill.is-leads {
  background: var(--analytics-accent);
}

.analytics-dual-num {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--analytics-text, #1e293b);
  line-height: 1;
}

.analytics-dual-cpl {
  text-align: right;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--analytics-muted, #64748b);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .analytics-dual-row {
    grid-template-columns: 64px 1fr 84px;
    gap: 6px;
  }
}

/* —— Pie / donut —— */
.analytics-pie {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 1.25rem 1.75rem;
  align-items: center;
}

.analytics-pie-visual {
  position: relative;
  width: min(100%, 200px);
  aspect-ratio: 1;
  margin: 0 auto;
}

.analytics-pie-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(10, 22, 40, 0.06);
}

.analytics-pie-hole {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--analytics-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px var(--analytics-line);
}

.analytics-pie-total {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.analytics-pie-total-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--analytics-muted);
}

.analytics-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.analytics-pie-legend-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 0.5rem 0.65rem;
  align-items: center;
  font-size: 0.86rem;
}

.analytics-pie-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.analytics-pie-legend-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-pie-legend-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.analytics-pie-legend-pct {
  color: var(--analytics-muted);
  font-variant-numeric: tabular-nums;
  min-width: 3.5ch;
  text-align: right;
}

@media (max-width: 720px) {
  .analytics-pie {
    grid-template-columns: 1fr;
  }
}

.analytics-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
  min-width: 3ch;
}

.analytics-exec-line {
  margin: 0 0 14px;
  font-size: 0.98rem;
  font-weight: 650;
}

.analytics-exec-line strong {
  color: var(--analytics-bad);
}

.analytics-aging-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  color: var(--analytics-muted);
}

.analytics-funnel-list {
  display: grid;
  gap: 14px;
}

.analytics-camino-wrap {
  margin: 0 0 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.analytics-camino {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  min-width: min-content;
}

.analytics-camino-step {
  display: flex;
  align-items: center;
  gap: 0;
}

.analytics-camino-arrow {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  color: var(--analytics-muted, #64748b);
  font-size: 1rem;
  font-weight: 600;
}

.analytics-camino-card {
  min-width: 7.5rem;
  padding: 10px 12px;
  border: 1px solid var(--analytics-border, #e2e8f0);
  border-radius: 10px;
  background: var(--analytics-surface, #fff);
}

.analytics-camino-label {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--analytics-muted, #64748b);
  line-height: 1.2;
}

.analytics-camino-value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--analytics-ink, #0f172a);
}

.analytics-funnel-row {
  display: grid;
  gap: 6px;
}

.analytics-funnel-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  align-items: baseline;
}

.analytics-funnel-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.analytics-funnel-stats {
  font-size: 0.82rem;
  color: var(--analytics-muted);
}

.analytics-funnel-stats strong {
  color: var(--analytics-ink);
}

.analytics-sla-stack {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--analytics-soft);
  margin-top: 6px;
}

.analytics-sla-seg {
  min-width: 2px;
}

.analytics-sla-seg.is-ok {
  background: var(--analytics-ok);
}

.analytics-sla-seg.is-warn {
  background: var(--analytics-warn);
}

.analytics-sla-seg.is-bad {
  background: var(--analytics-bad);
}

.analytics-sla-seg.is-hold {
  background: #64748b;
}

.analytics-sla-seg.is-unknown {
  background: #9aa8b6;
}

.analytics-sla-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.78rem;
  color: var(--analytics-muted);
}

.analytics-sla-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.analytics-sla-swatch.is-ok {
  background: var(--analytics-ok);
}

.analytics-sla-swatch.is-warn {
  background: var(--analytics-warn);
}

.analytics-sla-swatch.is-bad {
  background: var(--analytics-bad);
}

.analytics-sla-swatch.is-hold {
  background: #64748b;
}

.analytics-funnel-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.78rem;
  color: var(--analytics-muted);
}

.analytics-funnel-foot .is-bad {
  color: var(--analytics-bad);
  font-weight: 700;
}

.analytics-funnel-foot .is-hold {
  color: #475569;
  font-weight: 600;
}

.analytics-funnel-foot .is-warn {
  color: var(--analytics-warn);
  font-weight: 600;
}

.analytics-details {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 0 16px 4px;
}

.analytics-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  font-weight: 750;
  font-size: 1.05rem;
}

.analytics-details > summary::-webkit-details-marker {
  display: none;
}

.analytics-details > summary::before {
  content: '▸ ';
  color: var(--analytics-primary);
}

.analytics-details[open] > summary::before {
  content: '▾ ';
}

.analytics-closed-list {
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
}

.analytics-closed-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--analytics-soft);
  border-radius: 8px;
  font-size: 0.88rem;
}

.analytics-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  background: var(--analytics-soft);
  color: var(--analytics-muted);
  white-space: nowrap;
}

.analytics-badge.is-ok {
  background: var(--analytics-soft-ok);
  color: var(--analytics-ok);
}

.analytics-badge.is-warn {
  background: var(--analytics-soft-warn);
  color: var(--analytics-warn);
}

.analytics-badge.is-bad {
  background: var(--analytics-soft-bad);
  color: var(--analytics-bad);
}

.analytics-badge.is-info {
  background: var(--analytics-soft-info);
  color: var(--analytics-primary);
}

/* —— Cohort story —— */
.analytics-story {
  display: grid;
  gap: 0;
}

.analytics-story-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--analytics-line);
}

.analytics-story-step:last-child {
  border-bottom: 0;
}

.analytics-story-marker {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--analytics-primary);
  box-shadow: 0 0 0 4px var(--analytics-soft-info);
}

.analytics-story-step.is-final .analytics-story-marker {
  background: var(--analytics-muted);
  box-shadow: 0 0 0 4px var(--analytics-soft);
}

.analytics-story-step.is-success .analytics-story-marker {
  background: var(--analytics-ok);
  box-shadow: 0 0 0 4px var(--analytics-soft-ok);
}

.analytics-story-step.is-lost .analytics-story-marker {
  background: var(--analytics-bad);
  box-shadow: 0 0 0 4px var(--analytics-soft-bad);
}

.analytics-story-label {
  font-weight: 650;
  font-size: 0.92rem;
}

.analytics-story-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--analytics-muted);
  font-weight: 400;
}

.analytics-story-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* —— Tables —— */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.analytics-table th,
.analytics-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--analytics-line);
  vertical-align: top;
}

.analytics-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--analytics-muted);
  font-weight: 700;
}

.analytics-table th[title] {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.analytics-table td.num,
.analytics-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analytics-table .analytics-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--analytics-muted);
  font-weight: 400;
}

.analytics-crit-bar {
  display: inline-block;
  height: 6px;
  width: 56px;
  background: var(--analytics-soft);
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}

.analytics-crit-bar > span {
  display: block;
  height: 100%;
  background: var(--analytics-bad);
}

.analytics-attention-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.analytics-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.analytics-link-ext {
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}

/* —— Quality —— */
.analytics-quality-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0 0 12px;
  list-style: none;
}

.analytics-quality-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--analytics-soft);
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 0;
}

.analytics-quality-list li > span {
  color: var(--analytics-muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.analytics-quality-list li > strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

/* —— Modal stages —— */
.analytics-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.analytics-modal[hidden] {
  display: none !important;
}

.analytics-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 40, 0.45);
}

.analytics-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--analytics-surface);
  border-radius: 14px;
  border: 1px solid var(--analytics-line);
  padding: 18px 18px 14px;
  overflow: hidden;
}

.analytics-modal-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.analytics-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.analytics-modal-sub {
  margin: 6px 0 0;
  color: var(--analytics-muted);
  font-size: 0.88rem;
}

.analytics-modal-sub code {
  font-size: 0.85em;
  background: var(--analytics-soft);
  padding: 1px 6px;
  border-radius: 4px;
}

.analytics-stage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.analytics-stages-status {
  font-size: 0.85rem;
  color: var(--analytics-muted);
}

.analytics-stages-status.is-ok {
  color: var(--analytics-ok);
}

.analytics-stages-status.is-error {
  color: var(--analytics-bad);
}

.analytics-stages-status.is-warn {
  color: var(--analytics-warn);
}

.analytics-modal-body {
  overflow: auto;
  flex: 1;
  min-height: 180px;
  border: 1px solid var(--analytics-line);
  border-radius: 10px;
  padding: 4px;
  background: var(--analytics-soft);
}

.analytics-modal-body .analytics-table {
  background: #fff;
  border-radius: 8px;
}

.analytics-table select {
  max-width: 160px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--analytics-line);
  background: #fff;
  font-size: 0.82rem;
}

.analytics-table input[type='checkbox'] {
  width: 16px;
  height: 16px;
}

.analytics-stages-panel .analytics-panel-scroll {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.analytics-stages-panel .reu-split {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.analytics-select {
  width: 100%;
  max-width: 200px;
  padding: 4px 8px;
  border: 1px solid var(--analytics-line, #e2e8f0);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}

.analytics-input {
  width: 100%;
  max-width: 280px;
  padding: 4px 8px;
  border: 1px solid var(--analytics-line, #e2e8f0);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}

.analytics-csv-tags-panel {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--analytics-line, #e2e8f0);
  border-radius: 8px;
  background: var(--analytics-surface-2, #f8fafc);
  display: grid;
  gap: 10px;
}

.analytics-csv-stage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}

.analytics-csv-stage-row .analytics-field {
  display: grid;
  gap: 4px;
  min-width: 220px;
  flex: 1 1 220px;
}

.analytics-csv-stage-row .analytics-select {
  max-width: none;
  width: 100%;
}

.analytics-csv-tags-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
}

.analytics-csv-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}

.analytics-csv-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--analytics-line, #cbd5e1);
  background: #fff;
  font-size: 0.85rem;
  line-height: 1.2;
}

.analytics-csv-tag.is-preview {
  background: #eef2ff;
  border-color: #c7d2fe;
  margin-right: 4px;
}

.analytics-csv-tag.is-fixed {
  background: #ecfdf5;
  border-color: #a7f3d0;
  font-weight: 600;
}

.analytics-csv-tag-remove {
  border: 0;
  background: transparent;
  color: var(--analytics-muted, #64748b);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.analytics-csv-tag-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.analytics-csv-tags-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.analytics-csv-tags-add .analytics-input {
  max-width: 260px;
}

.analytics-csv-tags-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.analytics-csv-tag-suggest {
  font-size: 0.8rem;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-csv-tags-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.9rem;
  cursor: pointer;
}

.analytics-csv-tags-preview {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.analytics-table tr.is-force-create td {
  background: #fffbeb;
}

.analytics-origin-campaign-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.analytics-origin-campaign-fields .analytics-select,
.analytics-origin-campaign-fields .analytics-input {
  max-width: none;
}

.analytics-lead-probe-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.analytics-lead-probe-input {
  flex: 1 1 280px;
  max-width: 560px;
}

.analytics-lead-probe-card {
  margin-top: 10px;
  padding: 12px 14px;
}

.analytics-lead-probe-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.analytics-lead-probe-dl {
  margin: 8px 0 0;
  display: grid;
  gap: 8px;
}

.analytics-lead-probe-dl > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.analytics-lead-probe-dl dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--analytics-muted, #64748b);
}

.analytics-lead-probe-dl dd {
  margin: 0;
}

.analytics-lead-probe-tag {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.analytics-error-inline {
  color: #b91c1c;
  font-size: 0.9rem;
  margin: 6px 0;
}

.analytics-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.analytics-origins-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analytics-origins-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-origin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.analytics-origin-badge.is-meta {
  background: #dbeafe;
  color: #1d4ed8;
}

.analytics-origin-badge.is-other {
  background: #fef3c7;
  color: #b45309;
}

.analytics-origin-badge.is-muted {
  background: #f1f5f9;
  color: #64748b;
}

.analytics-origin-card.is-meta {
  border-left: 3px solid #3b82f6;
}

.analytics-origin-card.is-other {
  border-left: 3px solid #f59e0b;
}

.analytics-origin-card.is-muted {
  border-left: 3px solid #94a3b8;
}

.analytics-origin-filter {
  position: relative;
  min-width: 180px;
}

.analytics-origin-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 180px;
  max-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--analytics-line);
  border-radius: 8px;
  background: var(--analytics-surface);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--analytics-ink);
  cursor: pointer;
  text-align: left;
}

.analytics-origin-filter-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.analytics-origin-filter-trigger.is-open {
  border-color: var(--analytics-primary);
}

.analytics-origin-filter-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-origin-filter-caret {
  color: var(--analytics-muted);
  font-size: 0.75rem;
}

.analytics-origin-filter-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  min-width: 260px;
  max-width: 320px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--analytics-line);
  border-radius: 10px;
  background: var(--analytics-surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.analytics-origin-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--analytics-line);
}

.analytics-origin-filter-group + .analytics-origin-filter-group {
  margin-top: 10px;
}

.analytics-origin-filter-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--analytics-muted);
  margin-bottom: 4px;
}

.analytics-origin-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 0.88rem;
  font-weight: 550;
  text-transform: none;
  letter-spacing: normal;
  color: var(--analytics-ink);
  cursor: pointer;
  border-radius: 6px;
}

.analytics-origin-filter-option:hover {
  background: rgba(15, 23, 42, 0.04);
}

.analytics-origin-filter-option.is-meta span::after {
  content: ' Meta';
  font-size: 0.68rem;
  font-weight: 700;
  color: #2563eb;
  margin-left: 4px;
}

.analytics-origin-filter-option.is-other span::after {
  content: ' No Meta';
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  margin-left: 4px;
}

.analytics-origin-filter-option input {
  accent-color: var(--analytics-primary);
}

.reu-inline-input {
  width: 100%;
  max-width: 220px;
  padding: 4px 6px;
  border: 1px solid var(--analytics-line);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
}

.reu-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--analytics-line);
}

.reu-pill-ok {
  background: var(--analytics-soft-ok);
  color: var(--analytics-ok);
  border-color: transparent;
}

.reu-pill-bad {
  background: var(--analytics-soft-bad);
  color: var(--analytics-bad);
  border-color: transparent;
}

.analytics-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--analytics-line);
  color: var(--analytics-muted);
  font-size: 0.82rem;
}

.analytics-footer p {
  margin: 0 0 6px;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .analytics-shell,
  .analytics-module {
    width: 100%;
    padding-top: 8px;
  }

  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .analytics-toolbar .analytics-btn,
  .analytics-toolbar .analytics-field {
    flex: 1 1 auto;
  }

  .analytics-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .analytics-story-step {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .analytics-story-value {
    grid-column: 2;
  }
}

@media (max-width: 480px) {
  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Plataforma multi-módulo —— */
.analytics-platform {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  align-items: stretch;
}

.analytics-sidenav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 14px;
  background: #0a1628;
  color: #e8eef7;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.analytics-sidenav-brand {
  padding: 4px 10px 12px;
}

.analytics-sidenav .analytics-eyebrow {
  color: rgba(201, 168, 76, 0.95);
}

.analytics-sidenav-title {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.analytics-sidenav-title:hover {
  color: #fff;
  opacity: 0.92;
}

.analytics-sidenav-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
}

.analytics-sidenav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(232, 238, 247, 0.82);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.analytics-sidenav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.analytics-sidenav-link.is-active {
  background: rgba(29, 79, 145, 0.55);
  color: #fff;
}

.analytics-sidenav-link.is-soon {
  opacity: 0.72;
}

.analytics-sidenav-soon {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(201, 168, 76, 0.95);
}

.analytics-sidenav-foot {
  padding: 12px 10px 4px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-sidenav-email {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(232, 238, 247, 0.55);
  word-break: break-all;
}

.analytics-sidenav-foot .analytics-btn-ghost {
  color: #e8eef7;
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
}

.analytics-sidenav-foot .analytics-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.analytics-sidenav-refresh {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(29, 79, 145, 0.9);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
}

.analytics-sidenav-refresh:hover:not(:disabled) {
  background: rgba(37, 99, 175, 0.95);
}

.analytics-sidenav-refresh:disabled {
  opacity: 0.7;
  cursor: wait;
}

.analytics-platform-main {
  min-width: 0;
  background: var(--analytics-bg);
}

.analytics-platform-content {
  padding: 24px 28px 48px;
}

.analytics-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.analytics-module-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--analytics-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 140px;
}

.analytics-module-card:hover {
  border-color: rgba(29, 79, 145, 0.35);
  box-shadow: 0 4px 14px rgba(10, 22, 40, 0.06);
}

.analytics-module-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.analytics-module-card p {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  color: var(--analytics-muted);
}

.analytics-module-card-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--analytics-soft-info);
  color: var(--analytics-primary);
}

.analytics-module-card.is-soon .analytics-module-card-badge {
  background: var(--analytics-soft);
  color: var(--analytics-muted);
}

.analytics-module-card-cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--analytics-primary);
}

.analytics-home-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.analytics-home-kpi {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analytics-home-kpi-label {
  font-size: 0.78rem;
  color: var(--analytics-muted);
  font-weight: 600;
}

.analytics-home-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.analytics-coming-soon-panel {
  padding: 20px;
  max-width: 560px;
}

@media (max-width: 900px) {
  .analytics-platform {
    grid-template-columns: 1fr;
  }

  .analytics-sidenav {
    position: relative;
    height: auto;
    max-height: none;
  }

  .analytics-sidenav-nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 4px;
  }

  .analytics-platform-content {
    padding: 16px 14px 40px;
  }

  .analytics-home-kpis {
    grid-template-columns: 1fr;
  }
}

/* —— Reuniones presentación (módulo aislado) —— */
.reu-reading {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: var(--analytics-radius);
  border: 1px solid var(--analytics-line);
  background: var(--analytics-soft-info);
}

.reu-reading.is-ok {
  background: var(--analytics-soft-ok);
  border-color: rgba(31, 122, 77, 0.25);
}

.reu-reading.is-warn {
  background: var(--analytics-soft-warn);
  border-color: rgba(183, 129, 0, 0.3);
}

.reu-reading.is-muted {
  background: var(--analytics-soft);
}

.reu-reading-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--analytics-muted);
}

.reu-reading-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.reu-reading-body {
  margin: 0;
  font-size: 0.92rem;
  color: var(--analytics-muted);
  line-height: 1.45;
  max-width: 62ch;
}

.reu-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.reu-kpi {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 12px 14px;
  box-shadow: var(--analytics-shadow);
}

.reu-kpi-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--analytics-muted);
  line-height: 1.3;
}

.reu-kpi-value {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.reu-kpi-hint {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--analytics-muted);
  line-height: 1.3;
}

.reu-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}

.reu-funnel {
  display: grid;
  gap: 10px;
}

.reu-funnel-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.85fr) minmax(0, 1.5fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.88rem;
}

.reu-funnel-track {
  height: 12px;
  background: var(--analytics-soft);
  border-radius: 999px;
  overflow: hidden;
}

.reu-funnel-fill {
  height: 100%;
  background: var(--analytics-primary);
  border-radius: inherit;
  min-width: 2px;
}

.reu-funnel-nodata {
  display: block;
  padding: 0 8px;
  font-size: 0.75rem;
  color: var(--analytics-muted);
  line-height: 12px;
}

.reu-funnel-value {
  font-weight: 700;
  min-width: 3ch;
  text-align: right;
}

.reu-weeks {
  min-height: 180px;
}

.reu-week-cols {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 160px;
  padding-top: 8px;
}

.reu-week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.reu-week-bar-wrap {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.reu-week-bar {
  width: 70%;
  max-width: 36px;
  background: var(--analytics-primary);
  border-radius: 6px 6px 2px 2px;
  min-height: 8px;
}

.reu-week-val {
  font-size: 0.8rem;
  font-weight: 700;
}

.reu-week-lbl {
  font-size: 0.68rem;
  color: var(--analytics-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.reu-rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.reu-rank-table th,
.reu-rank-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--analytics-line);
  text-align: left;
  vertical-align: middle;
}

.reu-rank-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--analytics-muted);
}

.reu-rank-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.reu-rank-name {
  font-weight: 650;
  margin-bottom: 4px;
}

.reu-rank-share-track {
  height: 4px;
  background: var(--analytics-soft);
  border-radius: 999px;
  overflow: hidden;
}

.reu-rank-share-fill {
  height: 100%;
  background: var(--analytics-accent);
  border-radius: inherit;
}

@media (max-width: 960px) {
  .reu-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reu-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .reu-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* —— Lab experimental (no altera métricas oficiales) —— */
.analytics-sidenav-group {
  margin: 10px 12px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(232, 238, 247, 0.45);
  display: flex;
  align-items: center;
  gap: 6px;
}

.analytics-sidenav-group-hint {
  margin: 0 12px 6px;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(232, 238, 247, 0.4);
}

.analytics-sidenav-nav--lab {
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
}

.analytics-sidenav-link.is-lab.is-active {
  background: rgba(201, 168, 76, 0.22);
}

.lab-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 76, 0.45);
  background: rgba(201, 168, 76, 0.1);
  color: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
}

.lab-banner strong {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #8a6a1a;
}

.lab-muted {
  color: rgba(15, 23, 42, 0.62);
  font-size: 0.9rem;
}

.lab-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(15, 23, 42, 0.08);
}

.lab-chip.is-gap {
  background: rgba(185, 28, 28, 0.12);
  color: #9b1c1c;
}

.lab-chip.is-partial {
  background: rgba(180, 120, 20, 0.15);
  color: #8a5a00;
}

.lab-chip.is-ok {
  background: rgba(21, 128, 61, 0.12);
  color: #166534;
}

.lab-attention-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lab-attention-list li {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.lab-tracker-table-wrap,
.lab-def-wrap {
  overflow-x: auto;
}

.lab-tracker-table,
.lab-def-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.lab-tracker-table th,
.lab-tracker-table td,
.lab-def-table th,
.lab-def-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: top;
}

.lab-tracker-table th,
.lab-def-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(15, 23, 42, 0.55);
}

.lab-tracker-table tr.is-disabled td {
  color: rgba(15, 23, 42, 0.55);
  font-style: italic;
  background: rgba(15, 23, 42, 0.03);
}

.lab-gap-list,
.lab-howto {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.45;
}

.lab-gap-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 16px;
}

.lab-metas-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.lab-metas-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
}

.lab-metas-form input,
.lab-metas-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: #fff;
}

.lab-metas-notes {
  grid-column: 1 / -1;
}

.lab-metas-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

@media (max-width: 720px) {
  .lab-metas-form {
    grid-template-columns: 1fr;
  }

  .lab-def-table {
    min-width: 720px;
  }
}

/* —— Asistente ayuda Analytics (ana-aa-) —— */
.ana-aa-root {
  z-index: 12000;
}

.ana-aa-fab {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 12001;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: linear-gradient(145deg, #1d4f91 0%, #0a1628 100%);
  color: #f8fafc;
  border-radius: 999px;
  padding: 10px 16px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(10, 22, 40, 0.28);
}

.ana-aa-fab:hover {
  border-color: var(--analytics-accent);
}

.ana-aa-fab-label {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
}

.ana-aa-fab-sub {
  font-size: 0.68rem;
  opacity: 0.8;
  line-height: 1.1;
}

.ana-aa-panel {
  position: fixed;
  right: 18px;
  bottom: 78px;
  z-index: 12002;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(10, 22, 40, 0.18);
  overflow: hidden;
}

.ana-aa-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--analytics-line);
  background: var(--analytics-soft);
}

.ana-aa-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.ana-aa-sub {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--analytics-muted);
}

.ana-aa-close {
  border: 0;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--analytics-muted);
}

.ana-aa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 0;
}

.ana-aa-chip {
  border: 1px solid var(--analytics-line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--analytics-ink);
}

.ana-aa-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ana-aa-messages {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
}

.ana-aa-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--analytics-muted);
}

.ana-aa-bubble {
  max-width: 92%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.86rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.ana-aa-bubble.is-user {
  align-self: flex-end;
  background: var(--analytics-soft-info);
  border: 1px solid #d5e2f2;
}

.ana-aa-bubble.is-bot {
  align-self: flex-start;
  background: var(--analytics-soft);
  border: 1px solid var(--analytics-line);
  white-space: normal;
}

.ana-aa-bubble.is-bot code {
  font-size: 0.8em;
  background: rgba(10, 22, 40, 0.06);
  padding: 1px 4px;
  border-radius: 4px;
}

.ana-aa-typing {
  margin: 0;
  font-size: 0.8rem;
  color: var(--analytics-muted);
}

.ana-aa-error {
  margin: 0;
  padding: 0 12px 6px;
  font-size: 0.75rem;
  color: var(--analytics-warn);
}

.ana-aa-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--analytics-line);
}

.ana-aa-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--analytics-line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.88rem;
}

.ana-aa-send {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--analytics-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.ana-aa-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.analytics-muted {
  color: var(--analytics-muted);
  font-weight: 400;
}

/* —— Old nav group —— */
.analytics-sidenav-nav--old {
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding: 0 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.analytics-sidenav-details {
  margin: 0;
}

.analytics-sidenav-details > summary {
  list-style: none;
  cursor: pointer;
  margin-bottom: 0;
}

.analytics-sidenav-details > summary::-webkit-details-marker {
  display: none;
}

.analytics-sidenav-details > summary::after {
  content: '▸';
  margin-left: auto;
  font-size: 0.72rem;
  opacity: 0.55;
}

.analytics-sidenav-details[open] > summary::after {
  content: '▾';
}

.analytics-sidenav-details[open] > summary {
  margin-bottom: 4px;
}

/* —— Cohorte home —— */
.analytics-cohort-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.analytics-cohort-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.analytics-cohort-pies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.analytics-cohort-pies .analytics-section {
  margin: 0;
}

.analytics-cohort-pies .analytics-pie {
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  gap: 0.9rem 1rem;
}

.analytics-cohort-pies .analytics-pie-visual {
  width: min(100%, 168px);
}

.analytics-cohort-pies .analytics-pie-legend {
  max-height: 220px;
  overflow: auto;
}

@media (max-width: 900px) {
  .analytics-cohort-pies {
    grid-template-columns: 1fr;
  }
}

.analytics-cohort-page a,
.analytics-meeting-map-page a {
  color: var(--analytics-primary);
}

.analytics-cohort-h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.analytics-cohort-note {
  margin: 0;
  color: var(--analytics-muted);
  font-size: 0.88rem;
}

.analytics-cohort-warn {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--analytics-soft-warn);
  color: var(--analytics-ink);
  font-size: 0.9rem;
}

.analytics-cohort-states-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.analytics-cohort-state-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analytics-cohort-state-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--analytics-line);
  border-radius: 10px;
  background: var(--analytics-surface);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.analytics-cohort-state-row:hover {
  border-color: var(--analytics-primary);
}

.analytics-cohort-state-row.is-active {
  border-color: var(--analytics-primary);
  background: var(--analytics-soft-info);
}

.analytics-cohort-state-name {
  position: relative;
  z-index: 1;
  font-weight: 600;
}

.analytics-cohort-state-count {
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.analytics-cohort-state-pct {
  margin-left: 8px;
  color: var(--analytics-muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.analytics-cohort-state-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(201, 168, 76, 0.5) 0%,
    rgba(29, 79, 145, 0.22) 70%,
    rgba(29, 79, 145, 0.08) 100%
  );
  pointer-events: none;
}

.analytics-cohort-state-row.is-active .analytics-cohort-state-bar {
  background: linear-gradient(
    90deg,
    rgba(201, 168, 76, 0.62) 0%,
    rgba(29, 79, 145, 0.28) 100%
  );
}

.analytics-cohort-camp-option {
  padding-left: 28px;
}

.analytics-cohort-camp-option.is-disabled {
  opacity: 0.45;
}

/* —— Fugas Meta: filtros y acciones con aire —— */
.fugas-meta-page .analytics-header {
  margin-bottom: 4px;
}

.fugas-meta-page .analytics-subtitle {
  max-width: 62ch;
}

.fugas-meta-page > .analytics-toolbar {
  justify-content: flex-start;
  gap: 12px 18px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--analytics-line);
  border-radius: 10px;
  background: var(--analytics-surface);
}

.fugas-meta-page > .analytics-toolbar .analytics-field select,
.fugas-meta-page > .analytics-toolbar .analytics-field input[type='date'] {
  min-width: 180px;
}

.fugas-meta-tabs {
  gap: 8px;
  margin: 12px 0 20px;
}

.fugas-meta-tabs .leads-subnav-link {
  padding: 8px 14px;
  border: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
}

.fugas-meta-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr);
  gap: 12px 16px;
  align-items: end;
  margin: 0 0 16px;
}

.fugas-meta-campaign select {
  min-width: 0;
  width: 100%;
  max-width: none;
}

.fugas-meta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 16px;
}

.fugas-meta-toolbar .fugas-meta-actions {
  margin: 0;
}

.fugas-meta-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
  color: var(--analytics-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.fugas-meta-file input[type='file'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.fugas-meta-file:hover {
  background: var(--analytics-soft-info, #eef4fb);
}

.fugas-meta-file.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fugas-meta-file.is-disabled input {
  cursor: not-allowed;
}

.fugas-meta-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.fugas-meta-seg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
  color: var(--analytics-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
}

.fugas-meta-seg-btn:hover {
  border-color: rgba(29, 79, 145, 0.35);
  background: var(--analytics-soft-info, #eef4fb);
}

.fugas-meta-seg-btn.is-active {
  border-color: var(--analytics-primary);
  background: var(--analytics-soft-info, #eef4fb);
  color: var(--analytics-primary);
}

.fugas-meta-seg-count {
  min-width: 1.5em;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.fugas-meta-seg-btn.is-active .fugas-meta-seg-count {
  background: rgba(29, 79, 145, 0.16);
}

@media (min-width: 720px) {
  .fugas-meta-toolbar {
    grid-template-columns: minmax(280px, 1.4fr) auto;
  }
}

@media (max-width: 520px) {
  .ana-aa-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 72px;
  }

  .ana-aa-fab {
    right: 12px;
    bottom: 14px;
  }
}


/* Extensiones de plataforma (topbar, subnav, shared KPI). */

.analytics-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
}

.analytics-topbar-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
}

.analytics-topbar-product {
  font-weight: 800;
  color: var(--analytics-ink);
}

.analytics-topbar-email {
  font-size: 0.82rem;
  color: var(--analytics-muted);
}

.leads-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 16px;
}

.leads-subnav-link {
  padding: 7px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--analytics-muted);
  border: 1px solid transparent;
}

.leads-subnav-link:hover {
  color: var(--analytics-primary);
  background: var(--analytics-soft-info);
}

.leads-subnav-link.is-active {
  color: var(--analytics-primary);
  background: var(--analytics-soft-info);
  border-color: rgba(29, 79, 145, 0.2);
}

button.leads-subnav-link {
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.shared-kpi-card {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 14px 16px;
}

.shared-kpi-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--analytics-muted);
  font-weight: 600;
}

.shared-kpi-value {
  margin: 4px 0 0;
  font-size: 1.4rem;
  font-weight: 800;
}

.shared-kpi-hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--analytics-muted);
}

.shared-kpi-card.is-warn {
  border-color: rgba(180, 83, 9, 0.35);
  background: var(--analytics-soft-warn, #fff7ed);
}

.shared-kpi-card.is-warn .shared-kpi-value {
  color: var(--analytics-warn, #b45309);
}

.shared-kpi-card.is-bad {
  border-color: rgba(185, 28, 28, 0.35);
  background: var(--analytics-soft-bad, #fef2f2);
}

.shared-kpi-card.is-bad .shared-kpi-value {
  color: var(--analytics-bad, #b91c1c);
}

.shared-kpi-card.is-ok {
  border-color: rgba(21, 128, 61, 0.35);
  background: var(--analytics-soft-ok, #f0fdf4);
}

.shared-kpi-card.is-ok .shared-kpi-value {
  color: var(--analytics-ok, #15803d);
}

.shared-kpi-card.is-clickable {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.shared-kpi-card.is-clickable:hover {
  border-color: var(--analytics-primary);
}

.shared-kpi-card.is-selected {
  border-color: var(--analytics-primary);
  background: var(--analytics-soft-info);
  box-shadow: 0 0 0 1px var(--analytics-primary);
}

.analytics-table td.num.is-warn {
  color: var(--analytics-warn, #b45309);
  font-weight: 700;
}

.analytics-table td.num.is-bad {
  color: var(--analytics-bad, #b91c1c);
  font-weight: 700;
}

.analytics-ciclo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.analytics-ciclo-badge.is-sin_procesar {
  background: #eef2ff;
  color: #3730a3;
}
.analytics-ciclo-badge.is-en_proceso {
  background: #ecfeff;
  color: #0e7490;
}
.analytics-ciclo-badge.is-terminado {
  background: #ecfdf5;
  color: #047857;
}

.shared-metric-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--analytics-soft);
  color: var(--analytics-muted);
}

.shared-metric-badge.is-ok {
  background: var(--analytics-soft-ok);
  color: var(--analytics-ok);
}

.shared-metric-badge.is-bad {
  background: var(--analytics-soft-bad);
  color: var(--analytics-bad);
}

.analytics-source-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  border: 1px solid var(--analytics-line);
  background: var(--analytics-soft-info);
  color: var(--analytics-ink);
}

.analytics-source-banner.is-demo {
  background: var(--analytics-soft-warn);
}

.analytics-source-banner.is-ok {
  background: var(--analytics-soft-ok, #e8f5ee);
  border-color: rgba(31, 122, 77, 0.35);
}

.analytics-source-banner.is-error {
  background: var(--analytics-soft-bad, #fdecea);
  border-color: rgba(180, 35, 24, 0.35);
}

.analytics-source-banner strong {
  font-weight: 700;
}

.shared-kpi-skeleton {
  min-height: 88px;
  background: linear-gradient(90deg, #eef2f6 0%, #f7f9fb 50%, #eef2f6 100%);
  background-size: 200% 100%;
  animation: ga-skel 1.2s ease-in-out infinite;
}

@keyframes ga-skel {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.analytics-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analytics-bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 160px) 1fr 48px;
  gap: 10px;
  align-items: center;
}

.analytics-bar-label {
  font-size: 0.85rem;
  color: var(--analytics-muted);
  font-weight: 600;
}

.analytics-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--analytics-soft);
  overflow: hidden;
  position: relative;
}

.analytics-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--analytics-primary);
  transition: width 0.25s ease;
}

.analytics-bar-nodata {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.72rem;
  color: var(--analytics-muted);
}

.analytics-bar-value {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
}

.analytics-alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analytics-alert-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--analytics-soft);
}

.analytics-alert-item p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--analytics-muted);
}

.analytics-integration-card {
  background: var(--analytics-surface);
  border: 1px solid var(--analytics-line);
  border-radius: var(--analytics-radius);
  padding: 14px 16px;
}

.analytics-integration-card h3 {
  margin: 0;
  font-size: 1rem;
}

.analytics-integration-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.analytics-integration-meta {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--analytics-muted);
}

.analytics-role-list {
  margin: 0;
  padding-left: 1.2rem;
}

.analytics-table-search {
  margin-bottom: 10px;
  max-width: 280px;
}

.analytics-th-sortable {
  padding: 0;
}

.analytics-th-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: inherit;
  cursor: pointer;
}

.analytics-th-sort-btn:hover,
.analytics-th-sort-btn.is-active {
  color: var(--analytics-accent, #0f766e);
}

/* Contactos Kommo — planilla densa: caben las 9 columnas en el panel */
.contacts-inv-sheet {
  overflow-x: auto;
  max-width: 100%;
}

.contacts-inv-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.7rem;
}

.contacts-inv-table th,
.contacts-inv-table td {
  padding: 3px 4px !important;
  font-size: 0.7rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contacts-inv-table th {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.contacts-inv-th {
  vertical-align: top;
  padding: 3px 4px !important;
  min-width: 0;
}

.contacts-inv-th.has-filter {
  min-width: 0;
}

.contacts-inv-th-title {
  margin-bottom: 2px;
  min-width: 0;
}

.contacts-inv-th-title .analytics-th-sort-btn,
.contacts-inv-th-title > span {
  padding: 0;
  width: auto;
  max-width: 100%;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contacts-inv-th-filter {
  display: block;
  min-width: 0;
}

.contacts-inv-th-filter select,
.contacts-inv-th-tags-btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 1px 3px;
  border: 1px solid var(--analytics-line, #d0d5dd);
  border-radius: 3px;
  background: var(--analytics-surface, #fff);
  color: inherit;
}

.contacts-inv-th-filter.is-active select,
.contacts-inv-th-tags.is-active .contacts-inv-th-tags-btn {
  border-color: var(--analytics-accent, #0f766e);
  background: color-mix(in srgb, var(--analytics-accent, #0f766e) 8%, white);
}

.contacts-inv-th-tags {
  position: relative;
}

.contacts-inv-th-tags-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  cursor: pointer;
  text-align: left;
}

.contacts-inv-th-tags-btn > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.contacts-inv-th-tags-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 2px);
  left: 0;
  min-width: 180px;
  max-width: min(280px, 70vw);
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--analytics-line, #d0d5dd);
  border-radius: 4px;
  background: var(--analytics-surface, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.contacts-inv-th-tags-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.contacts-inv-th-tags-option {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 2px 1px;
  font-size: 0.68rem;
  white-space: normal;
  cursor: pointer;
}

.contacts-inv-th-creado-custom {
  display: grid;
  gap: 2px;
  margin-top: 2px;
}

.contacts-inv-th-creado-custom input[type='date'] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.58rem;
  padding: 1px 2px;
  border: 1px solid var(--analytics-line, #d0d5dd);
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.config-tabs {
  margin-bottom: 16px;
}

.config-tabs .leads-subnav-link {
  border: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
  cursor: pointer;
  font: inherit;
  appearance: none;
}

@media (max-width: 720px) {
  .analytics-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


.analytics-sidenav-foot {
  display: flex;
}

@media (max-width: 900px) {
  .analytics-topbar {
    padding: 10px 14px;
  }
}

/* —— Resumen Ejecutivo —— */
.exec-meta {
  margin: 0 0 18px;
  color: var(--analytics-muted);
  font-size: 0.92rem;
}

.exec-panel {
  padding: 20px 22px;
}

.exec-status {
  display: grid;
  gap: 12px;
  padding: 22px 24px;
  margin-bottom: 22px;
  border-radius: var(--analytics-radius);
  border: 1px solid var(--analytics-line);
  background:
    linear-gradient(135deg, rgba(29, 79, 145, 0.08), transparent 55%),
    var(--analytics-surface);
}

.exec-status--ok {
  border-color: rgba(31, 122, 77, 0.35);
  background:
    linear-gradient(135deg, rgba(31, 122, 77, 0.1), transparent 55%),
    var(--analytics-surface);
}

.exec-status--warn {
  border-color: rgba(183, 129, 0, 0.4);
  background:
    linear-gradient(135deg, rgba(183, 129, 0, 0.1), transparent 55%),
    var(--analytics-surface);
}

.exec-status--muted {
  opacity: 0.95;
}

.exec-status-label {
  margin: 4px 0 10px;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 700;
  color: var(--analytics-ink);
  letter-spacing: -0.02em;
}

.exec-status-toggle {
  border: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--analytics-primary);
}

.exec-status-toggle:focus-visible {
  outline: 2px solid var(--analytics-accent);
  outline-offset: 2px;
}

.exec-status-reasons {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--analytics-ink);
  line-height: 1.5;
}

.exec-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 520px;
}

.exec-flow-item {
  display: flex;
  flex-direction: column;
}

.exec-flow-node {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--analytics-line);
  background: #fff;
}

.exec-flow-node.is-available {
  border-color: rgba(29, 79, 145, 0.35);
  box-shadow: 0 1px 0 rgba(10, 22, 40, 0.04);
}

.exec-flow-node.is-unavailable {
  background: #f7f8fa;
  color: var(--analytics-muted);
}

.exec-flow-label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--analytics-muted);
}

.exec-flow-value {
  margin: 6px 0 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--analytics-ink);
  letter-spacing: -0.02em;
}

.exec-flow-node.is-unavailable .exec-flow-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--analytics-muted);
}

.exec-flow-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--analytics-muted);
}

.exec-flow-edge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 0 6px 18px;
  color: var(--analytics-muted);
}

.exec-flow-arrow {
  font-size: 1rem;
  line-height: 1;
}

.exec-flow-conv {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--analytics-primary);
}

.exec-flow-conv.is-muted {
  font-weight: 500;
  color: var(--analytics-muted);
}

.exec-flow-delta.is-down {
  color: var(--analytics-bad);
}

.exec-flow-delta.is-up {
  color: var(--analytics-ok);
}

.exec-econ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.exec-econ-card {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--analytics-line);
  background: var(--analytics-surface);
}

.exec-econ-card h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--analytics-ink);
}

.exec-econ-value {
  margin: 10px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.exec-econ-card.is-unavailable .exec-econ-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--analytics-muted);
}

.exec-econ-hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--analytics-muted);
  line-height: 1.4;
}

.exec-bottleneck-label {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.exec-estimate {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(183, 129, 0, 0.08);
  border: 1px solid rgba(183, 129, 0, 0.25);
  line-height: 1.45;
}

.exec-reading {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.55;
}

.exec-alert-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 12px 0 0;
}

.exec-alert-link {
  color: var(--analytics-primary);
  font-weight: 600;
  text-decoration: none;
}

.exec-alert-link:hover {
  text-decoration: underline;
}

.exec-proposal-conv-rate {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--analytics-ink);
}

@media (max-width: 720px) {
  .exec-status {
    padding: 16px;
  }

  .exec-flow {
    max-width: none;
  }

  .exec-econ-grid {
    grid-template-columns: 1fr;
  }
}

