/* Trenio — sistema visual unificado (tipografía, tarjetas, iconos neutros) */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* ─── COLORES DE MARCA ──────────────────────────────────────────────────── */
  /* UN solo azul principal + profundo. #3877ff eliminado del sistema. */
  --color-brand:        #38b6ff;   /* azul Trenio — botones primarios, links activos */
  --color-brand-deep:   #3838ff;   /* índigo — acentos, iconos activos, texto destacado */
  --color-brand-hover:  #0f99e8;   /* hover del brand (no el antiguo #3877ff) */
  --color-brand-soft:   rgba(56, 182, 255, 0.14);
  --color-brand-tint:   #e8f7fe;

  /* Aliases legacy (mantienen compatibilidad con clases existentes) */
  --trenio-cyan:         #38f5ff;
  --trenio-accent:       var(--color-brand);
  --trenio-indigo:       var(--color-brand-deep);
  --trenio-navy:         var(--color-brand-deep);
  --trenio-primary:      var(--color-brand);
  --trenio-primary-hover: var(--color-brand-hover);
  --trenio-primary-soft: var(--color-brand-soft);
  --trenio-primary-muted: rgba(56, 182, 255, 0.62);
  --trenio-primary-tint: var(--color-brand-tint);
  --trenio-qr-dark:      #12122f;

  /* ─── GRISES SEMÁNTICOS ─────────────────────────────────────────────────── */
  --text-primary:   #111827;   /* cuerpo principal */
  --text-secondary: #4b5563;   /* metadatos, fechas */
  --text-muted:     #6b7280;   /* labels, hints */
  --text-disabled:  #9ca3af;   /* placeholders, desactivados */
  --border:         #e5e7eb;   /* bordes estándar */
  --bg-subtle:      #f9fafb;   /* fondos de tabla, inputs */

  /* Aliases legacy */
  --trenio-surface:  #ffffff;
  --trenio-bg:       #f4faff;
  --trenio-border:   var(--border);
  --trenio-text:     var(--text-primary);
  --trenio-muted:    var(--text-muted);
  --trenio-subtle:   var(--text-disabled);
  --trenio-icon-bg:  #e4e8f2;
  --trenio-icon-fg:  #3f4b5c;

  /* ─── ESTADOS (warning / danger / success) ──────────────────────────────── */
  --trenio-warn-bg:      #fffbeb;
  --trenio-warn-border:  #fde68a;
  --trenio-warn-text:    #92400e;
  --trenio-danger-bg:    #fef2f2;
  --trenio-danger-border: #fecaca;
  --trenio-danger-text:  #b91c1c;

  /* ─── ESCALA TIPOGRÁFICA (6 pasos) ──────────────────────────────────────── */
  --text-xs:   11px;   /* badges, tags secundarios */
  --text-sm:   13px;   /* tabla body, metadatos */
  --text-md:   15px;   /* párrafo, modales */
  --text-lg:   17px;   /* subtítulos de sección */
  --text-xl:   20px;   /* títulos de card, KPI valores */
  --text-2xl:  24px;   /* títulos de página */

  /* ─── ESCALA DE ESPACIADO (base 8px) ────────────────────────────────────── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* ─── BORDER-RADIUS (4 tokens) ──────────────────────────────────────────── */
  --radius-sm:   6px;    /* badges, chips, inputs */
  --radius-md:   10px;   /* botones, dropdowns */
  --radius-lg:   14px;   /* cards, modales, paneles */
  --radius-full: 999px;  /* avatares, pills de estado */

  /* Aliases legacy */
  --trenio-radius:    var(--radius-lg);
  --trenio-radius-lg: 16px;

  /* ─── SOMBRAS (3 niveles) ────────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.07), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.07), 0 12px 28px rgba(15, 23, 42, 0.08);

  /* Alias legacy */
  --trenio-shadow: var(--shadow-md);
}

html {
  font-size: 16px;
}

@media (min-width: 1024px) {
  html {
    font-size: 17px;
  }
}

/* ─── ESCALA TIPOGRÁFICA — clases de utilidad ────────────────────────────── */
.t-xs  { font-size: var(--text-xs);  line-height: 1.4; }
.t-sm  { font-size: var(--text-sm);  line-height: 1.45; }
.t-md  { font-size: var(--text-md);  line-height: 1.5; }
.t-lg  { font-size: var(--text-lg);  line-height: 1.35; }
.t-xl  { font-size: var(--text-xl);  line-height: 1.25; }
.t-2xl { font-size: var(--text-2xl); line-height: 1.2; }

/* ─── SISTEMA DE BOTONES (3 variantes) ───────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: 40px;
  background: var(--color-brand);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--color-brand-hover); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: 40px;
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: var(--bg-subtle); border-color: #d1d5db; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  background: transparent;
  color: var(--color-brand-deep);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--color-brand-tint); }

body,
#pantalla-dashboard,
#pantalla-login,
#pantalla-onboarding {
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--trenio-text);
  -webkit-font-smoothing: antialiased;
  background-color: var(--trenio-bg);
  min-height: 100vh;
}

/* Tailwind `bg-gray-50` en index: mismo canvas que --trenio-bg (evita gris plano bajo el topbar) */
body.bg-gray-50,
#pantalla-auth-loading.bg-gray-50,
#pantalla-login.bg-gray-50 {
  background-color: var(--trenio-bg) !important;
}

/* Jerarquía tipográfica (contenido principal) */
.app-page-title {
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 700;
  color: var(--trenio-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

.app-page-sub {
  font-size: 0.94rem;
  color: var(--trenio-muted);
  font-weight: 500;
  margin: 0;
  line-height: 1.45;
}

.app-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--trenio-muted);
  margin: 0 0 0.75rem;
}

/* Tarjetas diferenciadas */
/* .panel y .metrica son aliases de .trenio-card — mismos estilos, un solo sistema */
.trenio-card,
.panel,
.metrica {
  background: var(--trenio-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.trenio-card--accent {
  border-left: 4px solid var(--trenio-primary);
}

.trenio-card--navy {
  border-left: 4px solid var(--trenio-navy);
}

.trenio-card--soft {
  background: linear-gradient(180deg, #f6f7fb 0%, #fafbfc 100%);
  border: 1px solid var(--trenio-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* Cola del día: acento arriba (no franja izquierda, no compite con secciones internas) */
.trenio-card--queue {
  border-left: 1px solid var(--trenio-border);
  border-top: 3px solid var(--trenio-primary);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 44px);
  box-shadow: 0 2px 10px rgba(56, 182, 255, 0.12), 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* Actividad reciente: acento superior navy, separado de la cola del día */
.trenio-card--feed {
  border-top: 3px solid var(--trenio-navy);
  background: linear-gradient(180deg, #f4f7fb 0%, #ffffff 40px);
  box-shadow: 0 2px 10px rgba(30, 43, 60, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
}

.trenio-card-head {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--trenio-border);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--trenio-navy);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.72);
}

.trenio-card-body {
  padding: 1rem 1.15rem;
}

/* Icono neutro (sin emoji de color) */
.trenio-ico {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(145deg, #eef1f8, #dfe5f2);
  color: var(--trenio-icon-fg);
  border: 1px solid rgba(30, 43, 60, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.trenio-ico--lg {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.8rem;
  border-radius: 0.6rem;
}

/* Últimos movimientos — iconos por tipo */
.trenio-ico-feed {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.trenio-ico-feed svg {
  display: block;
}

.trenio-ico-feed--alta {
  background: linear-gradient(145deg, #34d399, #16a34a);
  color: #fff;
  border: 1px solid rgba(22, 163, 74, 0.45);
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.35);
}

.trenio-ico-feed--baja {
  background: linear-gradient(145deg, #f87171, #dc2626);
  color: #fff;
  border: 1px solid rgba(220, 38, 38, 0.45);
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
}

.trenio-ico-feed--impagado {
  background: linear-gradient(145deg, #fbbf24, #d97706);
  color: #fff;
  border: 1px solid rgba(217, 119, 6, 0.45);
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.35);
}

.trenio-ico-feed--pago {
  background: rgba(34, 197, 94, 0.12);
  color: rgba(21, 128, 61, 0.72);
  border: 1px solid rgba(34, 197, 94, 0.26);
  box-shadow: none;
}

.trenio-ico-feed--neutral {
  background: linear-gradient(145deg, #eef1f8, #dfe5f2);
  color: var(--trenio-icon-fg);
  border: 1px solid rgba(30, 43, 60, 0.08);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
}

/* KPI dashboard */
.dash-kpi {
  padding: 0.65rem 0.75rem;
  border-radius: var(--trenio-radius);
  border: 1px solid var(--trenio-border);
  background: linear-gradient(165deg, #ffffff 0%, #f8f9fd 100%);
  box-shadow: var(--trenio-shadow);
}

.dash-kpi__label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--trenio-muted);
  margin-bottom: 0.22rem;
}

.dash-kpi__value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--trenio-text);
  line-height: 1.1;
}

.dash-kpi__value--primary {
  color: var(--trenio-primary);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.dash-kpi__hint {
  font-size: 0.65rem;
  color: var(--trenio-subtle);
  margin-top: 0.18rem;
}

.dash-kpi__value--product {
  color: #047857;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Grid KPI dashboard: 5 columnas en escritorio, más denso en tablet/móvil */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.dash-today-total {
  font-size: 0.75rem;
  color: var(--trenio-muted);
  font-weight: 500;
  margin: 0 0 0.45rem 0;
  line-height: 1.35;
}

.dash-today-total__sum {
  font-weight: 700;
  color: var(--trenio-text);
  font-size: 0.88rem;
}

.dash-today-total__sub {
  font-weight: 500;
  color: var(--trenio-subtle);
  font-size: 0.72rem;
}

.dash-kpi--warn {
  background: linear-gradient(165deg, #fffbeb 0%, #fff7e0 100%);
  border-color: #fcd34d;
}

.dash-kpi--danger {
  background: linear-gradient(165deg, #fef2f2 0%, #feecec 100%);
  border-color: #fca5a5;
}

/* Salud del centro — misma familia visual que el bloque «Ingresos mes» (gradiente marca) */
.dash-health {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.15rem;
  max-width: min(100%, 22rem);
  padding: 0.5rem 0.85rem 0.55rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
  border: none;
  box-shadow: 0 6px 20px rgba(56, 56, 255, 0.18);
  color: rgba(255, 255, 255, 0.92);
}

.dash-health__title {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.78);
}

.dash-health__body {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.dash-health__body strong {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dash-health__hint {
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}

.dash-health--ok {
  background: linear-gradient(135deg, var(--color-brand-deep) 0%, var(--color-brand) 100%);
}

.dash-health--mid {
  background: linear-gradient(135deg, var(--color-brand-deep) 0%, var(--color-brand) 100%);
  box-shadow: 0 6px 20px rgba(56, 182, 255, 0.24);
}

.dash-health--bad {
  background: linear-gradient(135deg, #3156d8 0%, var(--color-brand-deep) 100%);
  box-shadow: 0 6px 22px rgba(56, 56, 255, 0.24);
}

/* Dashboard: atajos compactos (alta, cuota, producto) */
.dash-operativa {
  margin-bottom: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  padding: 0.4rem 0.55rem 0.42rem;
}

/* Atajos encima del bloque «Hoy en cifras» (fuera de .dash-top-grid) */
#vista-dashboard .dash-operativa--above-kpi {
  width: 100%;
  box-sizing: border-box;
}

.dash-operativa-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.5rem;
  margin-bottom: 0.2rem;
}

.dash-operativa-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
}

.dash-operativa-sub {
  font-size: 0.6875rem;
  color: #9ca3af;
  line-height: 1.3;
  margin: 0;
}

.dash-operativa-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

/* Tres atajos: misma cromía que topbar / ítem activo del sidebar */
.dash-operativa-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  text-align: left;
  padding: 0.4rem 0.52rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, background 0.15s ease;
  font: inherit;
  box-sizing: border-box;
  min-height: 0;
  min-width: 0;
  background: linear-gradient(135deg, #1f2a44, #121a2f);
  box-shadow: 0 8px 22px rgba(18, 26, 47, 0.28);
}

.dash-operativa-card:hover {
  border-color: rgba(125, 211, 252, 0.35);
  background: linear-gradient(135deg, #243152, #151d33);
  box-shadow: 0 12px 28px rgba(18, 26, 47, 0.36);
}

.dash-operativa-card:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 4px 14px rgba(18, 26, 47, 0.35);
}

.dash-operativa-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 7px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #7dd3fc;
}

.dash-operativa-card__title {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(248, 250, 252, 0.95);
  line-height: 1.22;
  flex: 1;
  min-width: 0;
}

.dash-operativa-card__textstack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
}

.dash-operativa-card__planlock {
  font-size: 0.625rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.72);
  line-height: 1.25;
}

@media (max-width: 900px) {
  .dash-operativa-grid {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .dash-operativa-card {
    padding: 0.4rem 0.5rem;
  }
}

/* Dashboard: panel lateral (altas/bajas) — ya no es grid, el queue está en urgentes-section */
.dash-layout-main {
  display: block;
  margin-bottom: 0.75rem;
}

/* ─── DASHBOARD HERO LAYOUT ──────────────────────────────────────────────── */
.dash-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 0.45rem;
  margin-bottom: 0;
  align-items: stretch;
}

.dash-hero-card {
  background: linear-gradient(135deg, var(--color-brand-deep), var(--color-brand));
  border-radius: var(--radius-lg);
  padding: 0.5rem 0.85rem;
  color: #fff;
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.1s ease;
  box-shadow: 0 4px 14px rgba(56, 56, 255, 0.18);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

.dash-hero-card:hover {
  box-shadow: 0 12px 32px rgba(56, 56, 255, 0.32);
  transform: translateY(-1px);
}

.dash-hero-card__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.82;
}

.dash-hero-card__value {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.dash-hero-card__trend {
  font-size: 0.8125rem;
  font-weight: 600;
}

.dash-hero-card__trend--up   { color: #86efac; }
.dash-hero-card__trend--down { color: #fca5a5; }

.dash-hero-card__sub {
  font-size: 0.75rem;
  opacity: 0.72;
  margin-top: 0.1rem;
}

.dash-hero-card__sep {
  margin: 0 0.3em;
  opacity: 0.55;
}

/* Secondary KPI grid — 2×2 on the right of the hero */
.dash-kpi-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

.dash-kpi-sec {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.dash-kpi-sec:hover {
  background: var(--bg-subtle);
  border-color: var(--color-brand);
  box-shadow: var(--shadow-md);
}

.dash-kpi-sec--danger {
  border-color: var(--trenio-danger-border);
  background: var(--trenio-danger-bg);
}

.dash-kpi-sec--warn {
  border-color: var(--trenio-warn-border);
  background: var(--trenio-warn-bg);
}

.dash-kpi-sec__val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.dash-kpi-sec--danger .dash-kpi-sec__val { color: var(--trenio-danger-text); }
.dash-kpi-sec--warn   .dash-kpi-sec__val { color: var(--trenio-warn-text); }
.dash-kpi-sec--new    .dash-kpi-sec__val { color: var(--color-brand-deep); }

.dash-kpi-sec__lbl {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dash-kpi-sec__hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ─── URGENTES SECTION ───────────────────────────────────────────────────── */
.dash-urgentes-section {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0;
  overflow: hidden;
}

.dash-urgentes-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dash-urgentes-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  flex: 1;
}

.dash-urgentes-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
}

.dash-urgentes-ok {
  font-size: 0.75rem;
  font-weight: 600;
  color: #16a34a;
}

.dash-urgentes-empty {
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.dash-urgentes-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-urgentes-col {
  padding: 0.4rem 0.6rem;
  border-right: 1px solid var(--border);
}

.dash-urgentes-col:last-child { border-right: none; }

.dash-urgentes-col__head {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .dash-hero-layout {
    grid-template-columns: 1fr;
  }
  .dash-urgentes-cols {
    grid-template-columns: 1fr 1fr;
  }
  .dash-urgentes-col:nth-child(2) { border-right: none; }
  .dash-urgentes-col:nth-child(3) { border-top: 1px solid var(--border); }
  .dash-urgentes-col:nth-child(4) { border-top: 1px solid var(--border); border-right: none; }
}

.dash-top-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.7rem;
}

.dash-top-grid > .dash-operativa {
  grid-column: span 12;
}

.dash-top-grid > .dash-clases-hoy {
  grid-column: span 6;
}

/* Mini rejilla altas/bajas (dashboard) */
.dash-movimiento-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

/* Últimos movimientos: lista apilada (sin minmax fijo que rompe móvil) */
.dash-feed-list {
  display: flex;
  flex-direction: column;
}

.dash-feed-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--trenio-border);
  min-width: 0;
}

.dash-feed-item:last-child {
  border-bottom: none;
}

.dash-feed-head-sub {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
}

.dash-feed-empty {
  text-align: center;
  padding: 22px 16px;
  color: #6b7280;
  font-size: 13px;
}

.dash-feed-item__main {
  flex: 1;
  min-width: 0;
}

.dash-feed-item__name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-feed-item__detail {
  font-size: 11px;
  color: #6b7280;
}

.dash-feed-item__time {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}

.dash-queue-count {
  background: rgba(56, 182, 255, 0.1);
  color: #38b6ff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.dash-queue-empty {
  text-align: center;
  padding: 28px 20px;
}

.dash-queue-empty__ico {
  margin: 0 auto 10px;
}

.dash-queue-empty__title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.dash-queue-empty__sub {
  font-size: 13px;
  color: #6b7280;
}

.dash-queue-list {
  max-height: min(300px, 52vh);
  overflow-y: auto;
}

.dash-queue-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.65rem;
}

.dash-queue-col {
  border: 1px solid var(--trenio-border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfdff 0%, #ffffff 48px);
  overflow: hidden;
  min-width: 0;
}

.dash-queue-col .dash-queue-list {
  max-height: min(320px, 52vh);
}

.dash-queue-group {
  padding: 10px 20px;
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-queue-dot--warn { background: #d97706; }
.dash-queue-dot--primary { background: #38b6ff; }
.dash-queue-dot--danger { background: #dc2626; }

.dash-queue-dot--late {
  background: #ea580c;
}

.dash-queue-group__title {
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Cola del día: una fila como antes; botones en columna (menos ancho, tarjeta más baja que texto+barra completa) */
.dash-queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
}

.dash-queue-row > .trenio-ico {
  flex-shrink: 0;
}

.dash-queue-row__main {
  flex: 1;
  min-width: 0;
}

.dash-queue-row__name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-queue-row__name--strong {
  font-weight: 600;
}

.dash-queue-row__meta {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-queue-row__debt {
  color: #b91c1c;
  font-weight: 600;
}

.dash-queue-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex-shrink: 0;
}

.dash-queue-row > .dash-queue-btn {
  flex-shrink: 0;
}

.dash-queue-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}

.dash-queue-btn--primary {
  background: #38b6ff;
  color: #fff;
  border: none;
}

.dash-queue-btn--ghost {
  background: #fff;
  color: #374151;
  border-color: #e5e7eb;
}

.dash-queue-more {
  padding: 10px 20px;
  text-align: center;
}

.dash-queue-more__btn {
  font-size: 12px;
  color: #38b6ff;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

/* Tabs: simplified, straight-to-point */
.stats-tabs-wrap {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: #fff;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.stats-tab-btn {
  flex: 1;
  min-width: 92px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
  background: transparent;
  color: #6b7280;
}

.stats-tab-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.stats-tab-btn.is-active {
  background: #111827;
  color: #fff;
}

#vista-clientes .clientes-estado-tab {
  padding: 0.34rem 0.62rem;
  font-size: 0.74rem;
}

@media (max-width: 1180px) {
  .dash-queue-board {
    grid-template-columns: 1fr;
  }
}

/* Reference-inspired UX layer (Taskly-style) */
body.ux-ref-shell {
  --trenio-topbar-inset-y: 12px;
  --trenio-topbar-inset-x: 14px;
  --trenio-topbar-height: 72px;
  --trenio-topbar-radius: 12px;
  --trenio-topbar-gap: 10px;
  --trenio-topbar-stack: calc(
    var(--trenio-topbar-inset-y) + var(--trenio-topbar-height) + var(--trenio-topbar-gap)
  );
  /* Alturas reservadas bajo la topbar para barra Estado + búsqueda (buffer para que el thead no quede tapado ni coma la 1ª fila) */
  --trenio-clientes-toolbar-sticky-h: 90px;
  --trenio-clientes-search-sticky-h: 76px;
  background: #f5f6fb !important;
  overflow-x: clip;
}

/* Evita scroll horizontal en el documento (dashboard / módulos dentro del shell) */
html:has(body.ux-ref-shell) {
  overflow-x: clip;
}

.ux-ref-shell .trenio-main-area {
  padding-top: var(--trenio-topbar-stack);
  background:
    radial-gradient(1200px 520px at 15% -10%, rgba(122, 92, 255, 0.08), transparent 65%),
    radial-gradient(900px 420px at 95% 0%, rgba(56, 182, 255, 0.08), transparent 60%),
    #f5f6fb;
}

/*
 * Cabecero del viewport: solo bajo la topbar (+ un poco de sombra), sin invadir tarjetas.
 * Máscara larga + degradado suave: sin “línea” dura del backdrop, transición tipo sombra.
 */
body.ux-ref-shell #pantalla-dashboard::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(
    env(safe-area-inset-top, 0px) + var(--trenio-topbar-inset-y) + var(--trenio-topbar-height) + 18px
  );
  z-index: 12;
  pointer-events: none;
  -webkit-backdrop-filter: blur(20px) saturate(158%);
  backdrop-filter: blur(20px) saturate(158%);
  background: linear-gradient(
    to bottom,
    rgba(245, 246, 251, 0.4) 0%,
    rgba(245, 246, 251, 0.16) 36%,
    rgba(245, 246, 251, 0.05) 68%,
    rgba(245, 246, 251, 0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgb(0 0 0 / 1) 0%,
    rgb(0 0 0 / 0.95) 32%,
    rgb(0 0 0 / 0.55) 58%,
    rgb(0 0 0 / 0.18) 82%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgb(0 0 0 / 1) 0%,
    rgb(0 0 0 / 0.95) 32%,
    rgb(0 0 0 / 0.55) 58%,
    rgb(0 0 0 / 0.18) 82%,
    transparent 100%
  );
}

@media (prefers-reduced-transparency: reduce) {
  body.ux-ref-shell #pantalla-dashboard::before {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: linear-gradient(
      to bottom,
      rgba(245, 246, 251, 0.92) 0%,
      rgba(245, 246, 251, 0.55) 45%,
      rgba(245, 246, 251, 0.12) 78%,
      rgba(245, 246, 251, 0) 100%
    );
    mask-image: linear-gradient(
      to bottom,
      rgb(0 0 0 / 1) 0%,
      rgb(0 0 0 / 0.7) 55%,
      transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      to bottom,
      rgb(0 0 0 / 1) 0%,
      rgb(0 0 0 / 0.7) 55%,
      transparent 100%
    );
  }

}

.trenio-topbar-search {
  flex: 1;
  max-width: 520px;
  min-width: 220px;
  align-items: center;
  gap: 8px;
  background: #f7f8fc;
  border: 1px solid #e6e9f2;
  border-radius: 12px;
  padding: 0 11px;
  height: 40px;
}

.trenio-topbar-search svg {
  width: 16px;
  height: 16px;
  color: #98a2b3;
  flex-shrink: 0;
}

.trenio-topbar-search input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.83rem;
  color: #1f2937;
  font-family: inherit;
}

.trenio-topbar-search input::placeholder {
  color: #98a2b3;
}

/* Topbar = misma cromía que la pestaña/módulo activo en sidebar; barra flotante con radio como el sidebar */
.ux-ref-shell #pantalla-dashboard > nav {
  top: var(--trenio-topbar-inset-y) !important;
  left: var(--trenio-topbar-inset-x) !important;
  right: var(--trenio-topbar-inset-x) !important;
  width: auto !important;
  height: var(--trenio-topbar-height) !important;
  border-radius: var(--trenio-topbar-radius) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: linear-gradient(135deg, #1f2a44, #121a2f) !important;
  box-shadow: 0 8px 28px rgba(18, 26, 47, 0.38);
}

.ux-ref-shell #pantalla-dashboard > nav .text-gray-500,
.ux-ref-shell #pantalla-dashboard > nav .text-gray-700 {
  color: rgba(255, 255, 255, 0.88) !important;
}

.ux-ref-shell #pantalla-dashboard > nav .hover\:bg-gray-100:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

.ux-ref-shell #pantalla-dashboard > nav .trenio-topbar-search {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.ux-ref-shell #pantalla-dashboard > nav .trenio-topbar-search input {
  color: #f8fafc;
}

.ux-ref-shell #pantalla-dashboard > nav .trenio-topbar-search input::placeholder {
  color: rgba(248, 250, 252, 0.45);
}

.ux-ref-shell #pantalla-dashboard > nav .trenio-topbar-search svg {
  color: rgba(255, 255, 255, 0.65);
}

.ux-ref-shell #pantalla-dashboard > nav #perfil-avatar {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.ux-ref-shell #sidebar {
  background: #ffffff;
  border-right: 1px solid #eceff5;
  padding-top: var(--trenio-topbar-stack) !important;
}

.ux-ref-shell #sidebar .sidebar-inner-scroll {
  height: calc(100vh - var(--trenio-topbar-stack)) !important;
  max-height: calc(100vh - var(--trenio-topbar-stack)) !important;
}

.ux-ref-shell .sidebar-inner-scroll {
  padding-top: 14px !important;
}

.ux-ref-shell .sidebar-btn {
  border-radius: 12px !important;
  min-height: 42px;
}

.ux-ref-shell .sidebar-btn:hover {
  background: #f4f6fb !important;
  box-shadow: none;
}

.ux-ref-shell .sidebar-item-active {
  background: linear-gradient(135deg, #1f2a44, #121a2f) !important;
  box-shadow: 0 8px 20px rgba(18, 26, 47, 0.24);
}

.ux-ref-shell .sidebar-item-active span,
.ux-ref-shell .sidebar-item-active svg {
  color: #ffffff !important;
}

/* Pestaña activa + hover: el :hover genérico ganaba y dejaba fondo claro con texto blanco (ilegible). Misma línea que topbar: fondo oscuro + texto claro. */
.ux-ref-shell .sidebar-btn.sidebar-item-active:hover {
  background: linear-gradient(135deg, #2a3754, #1e2738) !important;
  box-shadow: 0 10px 26px rgba(18, 26, 47, 0.32);
}

.ux-ref-shell .sidebar-btn.sidebar-item-active:hover span,
.ux-ref-shell .sidebar-btn.sidebar-item-active:hover svg {
  color: rgba(255, 255, 255, 0.92) !important;
}

.ux-ref-shell .sidebar-btn.trenio-nav-locked.sidebar-item-active:hover span.text-sm,
.ux-ref-shell .sidebar-btn.trenio-nav-locked.sidebar-item-active:hover svg {
  color: rgba(226, 232, 240, 0.82) !important;
}

.ux-ref-shell .trenio-content-shell {
  max-width: min(1480px, 100%);
  padding-top: 10px;
}

.ux-ref-shell .panel,
.ux-ref-shell .trenio-card,
.ux-ref-shell .tabla-section,
.ux-ref-shell .dash-kpi-strip,
.ux-ref-shell .dash-kpi {
  border-radius: 16px !important;
  border: 1px solid #e9edf5 !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06) !important;
}

.ux-ref-shell .dash-kpi-strip {
  background: #ffffff;
}

.ux-ref-shell .dash-layout-main {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.6fr);
  gap: 1rem;
}

.ux-ref-shell .dash-top-grid {
  gap: 0.85rem;
}

.ux-ref-shell .dash-clases-hoy,
.ux-ref-shell .dash-operativa,
.ux-ref-shell .dash-kpi {
  background: #ffffff;
}

.ux-ref-shell .dash-operativa-card {
  border-radius: 12px;
}

/* Solo la barra de pestañas «Estado» en Socios sigue en panel claro; filtros de actividades van a cromía topbar */
.ux-ref-shell #vista-clientes .clientes-crm-toolbar {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e9edf5;
}

@media (max-width: 1023px) {
  .trenio-topbar-search {
    display: none !important;
  }

  .ux-ref-shell .dash-layout-main {
    grid-template-columns: 1fr;
  }
}

/* Shell del contenido: centrado real respecto al área útil (evita sensación “pegado a la derecha”) */
.trenio-content-shell {
  width: 100%;
  max-width: min(1280px, 100%);
  margin-inline: auto;
  box-sizing: border-box;
  min-width: 0;
  overflow-x: clip;
}

/* Área principal: inset por sidebar; fondo = canvas (monitores, clientes, etc.) */
.trenio-main-area {
  box-sizing: border-box;
  background-color: var(--trenio-bg);
  padding-top: 72px; /* topbar fija */
  overflow-x: clip;
  max-width: 100%;
}

@media (min-width: 1024px) {
  .trenio-main-area {
    padding-left: 16rem; /* alineado con aside w-64 */
  }
}

/* Cabecera dashboard: fecha a la izquierda, salud arriba a la derecha */
.dash-page-header {
  margin-bottom: 0.2rem;
}

.dash-page-header__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.5rem 1rem;
}

.dash-page-header__titles {
  flex: 0 1 auto;
  min-width: 0;
}

@media (min-width: 1024px) {
  .dash-page-header__top {
    justify-content: space-between;
  }

  .dash-page-header__titles {
    flex: 1 1 200px;
  }
}

.dash-page-header__titles .app-page-sub {
  margin-top: 0.35rem;
}

.dash-page-header__salud {
  flex: 0 1 auto;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

/* 3 alertas accionables — reemplazan el score de salud */
.dash-alertas-rapidas {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-left: auto;
}
.dash-alerta-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
  transition: opacity 0.15s;
}
.dash-alerta-chip:hover { opacity: 0.8; }
.dash-alerta-chip__ico { font-size: 11px; flex-shrink: 0; }
.dash-alerta-chip__body { display: flex; flex-direction: column; gap: 1px; }
.dash-alerta-chip__body strong { font-size: 12px; font-weight: 700; }
.dash-alerta-chip--danger {
  border-color: #FECACA;
  background: #FEF2F2;
  color: #991B1B;
}
.dash-alerta-chip--warn {
  border-color: #FDE68A;
  background: #FFFBEB;
  color: #92400E;
}
.dash-alerta-chip--ok {
  border-color: #BBF7D0;
  background: #F0FDF4;
  color: #166534;
}
.dash-alerta-chip--info {
  border-color: #BFDBFE;
  background: #EFF6FF;
  color: #1E40AF;
}
@media (max-width: 640px) {
  .dash-alertas-rapidas {
    margin-left: 0;
    width: 100%;
    margin-top: 12px;
  }
  .dash-alerta-chip { flex: 1; min-width: 120px; }
}

[id^="vista-"] {
  min-width: 0;
  box-sizing: border-box;
}

#pantalla-dashboard {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

#vista-dashboard .app-section-title {
  margin-bottom: 0.45rem;
}

#vista-dashboard .app-page-title {
  margin-bottom: 0.12rem;
}

#vista-dashboard .app-page-sub {
  font-size: 0.86rem;
  line-height: 1.35;
}

#vista-dashboard .trenio-card,
#vista-dashboard .dash-kpi {
  border: none !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

/* Perfil */
.perfil-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--trenio-border);
}

.perfil-tab {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--trenio-border);
  background: #fff;
  color: var(--trenio-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.perfil-tab:hover {
  color: var(--trenio-text);
  border-color: #d1d5db;
}

.perfil-tab--active {
  border-color: var(--trenio-primary);
  background: var(--trenio-primary-soft);
  color: var(--trenio-primary);
}

.perfil-hero {
  border-radius: var(--trenio-radius-lg);
  border: 1px solid var(--trenio-border);
  background: linear-gradient(135deg, var(--trenio-indigo) 0%, var(--trenio-blue-600) 52%, var(--trenio-accent) 100%);
  color: #fff;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.perfil-hero h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.perfil-hero p {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.88;
  line-height: 1.45;
}

/* Onboarding icon neutro */
.onb-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: var(--trenio-icon-bg);
  color: var(--trenio-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0 auto 1rem;
  letter-spacing: 0.02em;
}

.onb-icon--lg {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.05rem;
}

/* Encabezados de vista (perfil y similares) */
.page-header {
  margin-bottom: 0.5rem;
}

.page-title {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--trenio-text);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.94rem;
  color: var(--trenio-muted);
  margin-top: 0.2rem;
}

.panel-titulo {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--trenio-muted);
  margin-bottom: 0.75rem;
}

/* —— Notificaciones (popover flotante, no barra lateral) —— */
.notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 1055;
  background: rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.notif-overlay.notif-overlay--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.22s ease, visibility 0s;
}

.notif-panel {
  position: fixed;
  top: calc(72px + 10px);
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 1060;
  width: min(392px, calc(100vw - 20px));
  max-height: min(560px, calc(100vh - 76px));
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px) scale(0.97);
  transform-origin: top right;
  transition:
    opacity 0.22s ease,
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.24s;
}

body.ux-ref-shell .notif-panel {
  top: calc(var(--trenio-topbar-stack) + 4px);
  max-height: min(560px, calc(100vh - var(--trenio-topbar-stack) - 16px));
}

.notif-panel.notif-panel--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.22s ease,
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}

.notif-panel__inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  border-radius: 14px;
  border: 1px solid rgba(30, 43, 60, 0.1);
  background: linear-gradient(165deg, #ffffff 0%, #f8f9fd 100%);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.12),
    0 8px 20px rgba(56, 182, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  overflow: hidden;
}

.notif-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 253, 0.6) 100%);
}

.notif-panel__toolbar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.notif-panel__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  min-width: 2rem;
  padding: 0 0.35rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.05);
  color: var(--trenio-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.notif-panel__tool:hover:not(:disabled) {
  background: rgba(56, 182, 255, 0.1);
  color: var(--trenio-primary);
}

.notif-panel__tool:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.notif-panel__tool--text {
  width: auto;
  min-width: unset;
  padding: 0 0.45rem;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.notif-panel__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--trenio-navy);
}

.notif-panel__meta {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--trenio-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.notif-panel__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.05);
  color: var(--trenio-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.notif-panel__close:hover {
  background: rgba(56, 182, 255, 0.1);
  color: var(--trenio-primary);
}

.notif-panel__resumen {
  padding: 0.65rem 0.85rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  background: rgba(255, 255, 255, 0.5);
}

.notif-chip {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.38rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  color: var(--trenio-text);
  cursor: pointer;
  text-align: left;
  line-height: 1.25;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.notif-chip:hover {
  border-color: rgba(56, 182, 255, 0.35);
  box-shadow: 0 2px 8px rgba(56, 182, 255, 0.12);
  transform: translateY(-1px);
}

.notif-chip__muted {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--trenio-muted);
  margin-top: 0.08rem;
}

.notif-chip--money {
  border-color: rgba(34, 197, 94, 0.25);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(255, 255, 255, 0.9));
}

.notif-chip--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), #fff);
}

.notif-chip--danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.6), #fff);
}

.notif-panel__lista {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem 0 0.5rem;
}

.notif-panel__section {
  padding: 0.45rem 0.85rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--trenio-muted);
}

.notif-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: calc(100% - 1rem);
  margin: 0 0.5rem 0.35rem;
  padding: 0;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
  transition: background 0.12s, box-shadow 0.15s, border-color 0.15s;
}

.notif-item:hover {
  background: #fafbff;
  border-color: rgba(56, 182, 255, 0.18);
  box-shadow: 0 4px 12px rgba(56, 182, 255, 0.08);
}

.notif-item::before {
  content: '';
  width: 3px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 2.75rem;
  border-radius: 10px 0 0 10px;
  background: var(--trenio-border);
}

.notif-item--rojo::before {
  background: #ef4444;
}

.notif-item--ambar::before {
  background: #f59e0b;
}

.notif-item--verde::before {
  background: #22c55e;
}

.notif-item--info::before {
  background: var(--trenio-primary);
}

.notif-item__body {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.65rem 0.65rem 0.55rem;
}

.notif-item__tit {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--trenio-text);
  line-height: 1.25;
}

.notif-item__txt {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--trenio-muted);
  line-height: 1.35;
}

.notif-item__chev {
  flex-shrink: 0;
  width: 1rem;
  color: #c4c9d4;
  margin: auto 0.5rem auto 0;
}

.notif-empty {
  text-align: center;
  padding: 1.75rem 1rem 1.5rem;
}

.notif-empty__icon {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  font-size: 1.25rem;
}

.notif-empty__icon--muted {
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.notif-empty__tit {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--trenio-text);
  margin: 0 0 0.25rem;
}

.notif-empty__sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--trenio-muted);
  line-height: 1.45;
  max-width: 16rem;
  margin-left: auto;
  margin-right: auto;
}

.notif-empty__btn {
  margin-top: 0.85rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(56, 182, 255, 0.35);
  background: rgba(56, 182, 255, 0.1);
  color: var(--trenio-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.notif-empty__btn:hover {
  background: rgba(56, 182, 255, 0.16);
  border-color: rgba(56, 182, 255, 0.5);
}

.notif-panel__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.55rem 0.85rem 0.75rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.85);
}

.notif-panel__foot-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--trenio-muted);
  margin-right: 0.15rem;
}

.notif-foot-link {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
  border: none;
  background: rgba(56, 182, 255, 0.08);
  color: var(--trenio-primary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.notif-foot-link:hover {
  background: rgba(56, 182, 255, 0.16);
}

@media (max-width: 1023px) {
  body.notif-open {
    overflow: hidden;
  }
}

/* Dashboard — clases de hoy (confirmación app) */
.dash-clases-hoy {
  margin: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  padding: 0.35rem 0.55rem;
}

.dash-clases-hoy__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dash-clase-hoy-card {
  font-family: inherit;
  text-align: left;
  min-width: 150px;
  max-width: 220px;
  flex: 1 1 150px;
  padding: 0.46rem 0.62rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(165deg, #fff 0%, #f4faff 100%);
  box-shadow: 0 8px 20px rgba(56, 182, 255, 0.11);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.dash-clase-hoy-card:hover {
  box-shadow: 0 12px 24px rgba(56, 182, 255, 0.18);
  transform: translateY(-1px);
}

.dash-clase-hoy-card__name {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--trenio-navy);
  margin-bottom: 0.12rem;
}

.dash-clase-hoy-card__time {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--trenio-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.18rem;
}

.dash-clase-hoy-card__count {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--trenio-primary);
  background: rgba(56, 182, 255, 0.12);
  padding: 0.16rem 0.4rem;
  border-radius: 999px;
}

/* Ficha cliente — historial de asistencias colapsable */
.ficha-historial-asist {
  border: 1px solid var(--trenio-border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.ficha-historial-asist > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  background: linear-gradient(180deg, #fafbff 0%, #f0f7ff 100%);
  font-family: inherit;
}

.ficha-historial-asist > summary::-webkit-details-marker {
  display: none;
}

.ficha-historial-asist__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--trenio-muted);
  flex-shrink: 0;
}

.ficha-historial-asist__chev {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid #9ca3af;
  border-bottom: 2px solid #9ca3af;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-top: -2px;
}

.ficha-historial-asist[open] .ficha-historial-asist__chev {
  transform: rotate(45deg);
  margin-top: 2px;
}

.ficha-historial-asist__resumen {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4b5563;
  text-align: right;
  line-height: 1.35;
  max-width: 58%;
  text-transform: none;
  letter-spacing: 0;
}

.ficha-historial-asist[open] > summary {
  border-bottom: 1px solid var(--trenio-border);
}

.ficha-historial-asist__body {
  max-height: min(320px, 45vh);
  overflow-y: auto;
  padding: 8px 8px 12px;
}

.ficha-historial-asist__body .client-table {
  margin: 0;
}

/* ---------- Estadísticas — pestaña Productos (KPIs + evolución) ---------- */
.stats-productos-toolbar {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 560px) {
  .stats-productos-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-productos-toolbar .stats-productos-period {
    width: 100%;
    justify-content: center;
  }
}

.stats-productos-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .stats-productos-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .stats-productos-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.stats-productos-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  min-width: 0;
}

@media (max-width: 900px) {
  .stats-productos-layout {
    grid-template-columns: 1fr;
  }
}

.stats-prod-evolucion-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.stats-prod-evolucion-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 200px;
  height: 200px;
  box-sizing: border-box;
  padding: 4px 6px 24px;
}

.stats-prod-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 0;
  min-width: 0;
}

.stats-prod-bar-col .stats-prod-bar-label {
  font-size: 9px;
  color: #6b7280;
  margin-top: 5px;
  text-align: center;
  max-width: 100%;
  line-height: 1.1;
  word-break: break-word;
  hyphens: auto;
}

.stats-productos-catalogo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

@media (max-width: 480px) {
  .stats-productos-catalogo-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Actividades (KPIs + tarjetas, móvil) ---------- */
.actividades-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 1100px) {
  .actividades-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .actividades-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 400px) {
  .actividades-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.actividades-lista-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

@media (max-width: 520px) {
  .actividades-lista-grid {
    grid-template-columns: 1fr;
  }
}

.actividades-filtros {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .actividades-filtros {
    flex-direction: column;
    align-items: stretch;
  }

  .actividades-filtros > input,
  .actividades-filtros > select {
    width: 100%;
    min-width: 0 !important;
    max-width: none;
  }
}

.actividad-tarjeta__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.actividad-tarjeta__head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 140px;
}

.actividad-tarjeta__head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.actividad-tarjeta__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

@media (max-width: 380px) {
  .actividad-tarjeta__stats {
    grid-template-columns: 1fr;
  }
}

/* ---------- Responsive global (módulos + dashboard) ---------- */
@media (max-width: 1100px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .dash-top-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .dash-top-grid > .dash-operativa,
  .dash-top-grid > .dash-clases-hoy {
    grid-column: span 1;
  }

  .dash-layout-main {
    grid-template-columns: 1fr;
  }

  .dash-page-header__top {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.65rem;
  }

  .dash-page-header__titles {
    flex: 0 0 auto;
  }

  .dash-page-header {
    margin-bottom: 0.85rem;
  }

  .dash-page-header__salud {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  /* Ancho completo en móvil: evita franja vacía (antes flex-end + inline-flex estrecho) */
  .dash-health {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 560px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-kpi {
    padding: 0.58rem 0.65rem;
  }
}

@media (max-width: 380px) {
  .dash-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.mobile-scroll-x {
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* ——— Clientes: lista / tablero (paleta Trenio) ——— */
/* Offset del thead sticky: en ≤1023px las barras dejan de ser sticky → solo topbar (ver media query) */
#vista-clientes {
  --clientes-thead-sticky-top: calc(138px + 76px);
}

body.ux-ref-shell #vista-clientes {
  --clientes-thead-sticky-top: calc(
    var(--trenio-topbar-stack) +
    var(--trenio-clientes-toolbar-sticky-h) +
    var(--trenio-clientes-search-sticky-h)
  );
}

#vista-clientes .clientes-tabla-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

#vista-clientes .clientes-tabla-title {
  margin: 0;
  font-size: 1.1rem;
  flex: 1 1 auto;
  min-width: 0;
}

#vista-clientes .clientes-tabla-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

#vista-clientes .clientes-vista-toggle {
  display: inline-flex;
  border: 1px solid var(--trenio-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--trenio-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#vista-clientes .clientes-vista-toggle__btn {
  border: none;
  background: transparent;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--trenio-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#vista-clientes .clientes-vista-toggle__btn:hover {
  color: var(--trenio-text);
  background: rgba(56, 182, 255, 0.08);
}

#vista-clientes .clientes-vista-toggle__btn.is-active {
  background: var(--trenio-primary-tint);
  color: var(--trenio-blue-600);
}

#vista-clientes.clientes-vista-tablero #clientes-toolbar-estado {
  display: none;
}

#vista-clientes .clientes-crm-wrap {
  margin-bottom: 1rem;
}

#vista-clientes .clientes-crm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 900px) {
  #vista-clientes .clientes-crm-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#vista-clientes .clientes-kpi-stat.panel {
  position: relative;
  overflow: hidden;
}

#vista-clientes .clientes-kpi-stat.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--trenio-accent);
  opacity: 0.4;
  border-radius: 2px 0 0 2px;
}

#vista-clientes .clientes-crm-toolbar {
  padding: 0.65rem 1rem 0.75rem;
  border-bottom: 1px solid var(--trenio-border);
  background: linear-gradient(180deg, rgba(56, 182, 255, 0.04) 0%, transparent 100%);
}

#vista-clientes .clientes-crm-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.5rem;
}

#vista-clientes .clientes-crm-toolbar__row:last-child {
  margin-bottom: 0;
}

#vista-clientes .clientes-crm-toolbar__title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--trenio-subtle);
  width: 100%;
  margin-bottom: 0.15rem;
}

#vista-clientes .clientes-crm-toolbar__title--inline {
  width: auto;
  margin: 0 0.35rem 0 0;
  flex-shrink: 0;
}

#vista-clientes .clientes-crm-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

#vista-clientes .clientes-estado-tab {
  border: 1px solid var(--trenio-border);
  background: var(--trenio-surface);
  color: var(--trenio-muted);
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#vista-clientes .clientes-estado-tab:hover {
  border-color: rgba(56, 182, 255, 0.35);
  color: var(--trenio-text);
  background: #f8fafc;
}

#vista-clientes .clientes-estado-tab.active {
  background: var(--trenio-primary-tint);
  border-color: rgba(56, 182, 255, 0.45);
  color: var(--trenio-blue-600);
  box-shadow: 0 0 0 1px rgba(56, 182, 255, 0.2);
}

/* Dashboard móvil: ocultar KPI «Clientes activos» y una sola columna (evita hueco 2+1) */
@media (max-width: 639px) {
  #vista-dashboard .dash-kpi--activos-kpi {
    display: none !important;
  }

  #vista-dashboard .dash-kpi-grid--bankdash {
    grid-template-columns: 1fr !important;
    gap: 0.65rem;
  }

  #vista-dashboard .dash-kpi-strip--bankdash {
    padding: 0.95rem 0.85rem 1rem !important;
  }
}

#vista-clientes .clientes-kanban-hint {
  margin: 0 1rem 0.65rem;
  font-size: 0.78rem;
  color: var(--trenio-muted);
  line-height: 1.4;
}

#vista-clientes .clientes-kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0 1rem 1rem;
  align-items: stretch;
  min-height: 220px;
}

#vista-clientes .clientes-kanban-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--trenio-radius-lg);
  border: 1px solid var(--trenio-border);
  background: linear-gradient(180deg, #fafcfe 0%, var(--trenio-surface) 48px);
  box-shadow: var(--trenio-shadow);
  overflow: hidden;
}

#vista-clientes .clientes-kanban-col--activos {
  border-top: 3px solid var(--trenio-mint);
}

#vista-clientes .clientes-kanban-col--impagados {
  border-top: 3px solid #f87171;
}

#vista-clientes .clientes-kanban-col--inactivos {
  border-top: 3px solid var(--trenio-subtle);
}

#vista-clientes .clientes-kanban-col__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.5rem;
  border-bottom: 1px solid var(--trenio-border);
  background: rgba(255, 255, 255, 0.85);
}

#vista-clientes .clientes-kanban-col__head-text {
  flex: 1;
  min-width: 0;
}

#vista-clientes .clientes-kanban-col__title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--trenio-text);
  letter-spacing: -0.02em;
}

#vista-clientes .clientes-kanban-col__sub {
  font-size: 0.68rem;
  color: var(--trenio-muted);
  margin-top: 0.15rem;
}

#vista-clientes .clientes-kanban-col__count {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--trenio-indigo);
  background: rgba(56, 56, 255, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  line-height: 1.2;
}

#vista-clientes .clientes-kanban-col__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  max-height: min(62vh, 520px);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

#vista-clientes .clientes-kanban__empty {
  margin: 0;
  padding: 1rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--trenio-subtle);
}

#vista-clientes .clientes-kanban-card {
  text-align: left;
  border: 1px solid var(--trenio-border);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  background: var(--trenio-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#vista-clientes .clientes-kanban-card--sel {
  border-color: rgba(56, 182, 255, 0.65);
  box-shadow: 0 0 0 2px var(--trenio-primary-soft);
}

#vista-clientes .clientes-kanban-card__top {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

#vista-clientes .clientes-kanban-card__cb input {
  width: 15px;
  height: 15px;
  accent-color: var(--trenio-accent);
  cursor: pointer;
  margin-top: 0.2rem;
}

#vista-clientes .clientes-kanban-card__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

#vista-clientes .clientes-kanban-card__ico {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #eef1f8, #dfe5f2);
  color: var(--trenio-icon-fg);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(30, 43, 60, 0.08);
}

#vista-clientes .clientes-kanban-card__name {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--trenio-text);
  line-height: 1.25;
  word-break: break-word;
}

#vista-clientes .clientes-kanban-card__acts {
  display: block;
  font-size: 0.68rem;
  color: var(--trenio-muted);
  margin-top: 0.1rem;
  line-height: 1.3;
}

#vista-clientes .clientes-kanban-card__badges {
  margin: 0.35rem 0 0.25rem;
}

#vista-clientes .clientes-kanban-card__row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--trenio-muted);
  padding: 0.12rem 0;
}

#vista-clientes .clientes-kanban-card__row strong {
  color: var(--trenio-text);
  font-weight: 600;
}

#vista-clientes .clientes-kanban-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

#vista-clientes .clientes-kanban-btn {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--trenio-border);
  background: #f8fafc;
  border-radius: 7px;
  padding: 0.28rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--trenio-text);
  cursor: pointer;
}

#vista-clientes .clientes-kanban-btn:hover {
  border-color: rgba(56, 182, 255, 0.45);
  background: var(--trenio-primary-tint);
  color: var(--trenio-blue-600);
}

#vista-clientes .clientes-search-wrap {
  position: relative;
  flex: 1;
  min-width: 140px;
}

#vista-clientes .clientes-search-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding-left: 2.1rem;
  border-radius: 10px;
  border: 1px solid var(--trenio-border);
}

#vista-clientes .clientes-search-wrap::before {
  content: "";
  position: absolute;
  left: 0.65rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  opacity: 0.45;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23556273'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  pointer-events: none;
}

#vista-clientes .search-row.clientes-search-row {
  align-items: stretch;
  gap: 0.5rem;
}

#vista-clientes .search-row.clientes-search-row .select-estado {
  border-radius: 10px;
}

@media (max-width: 1100px) {
  #vista-clientes .clientes-kanban {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.65rem;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  #vista-clientes .clientes-kanban-col {
    flex: 0 0 min(78vw, 300px);
    scroll-snap-align: start;
    max-width: 100%;
  }

  #vista-clientes .clientes-kanban-col__body {
    max-height: min(52vh, 420px);
  }
}

@media (max-width: 768px) {
  #vista-clientes .clientes-crm-toolbar__row {
    flex-direction: column;
    align-items: stretch;
  }

  #vista-clientes .clientes-crm-toolbar__title--inline {
    width: 100%;
    margin-bottom: 0.2rem;
  }

  #vista-clientes .clientes-crm-pill-row {
    width: 100%;
  }

  #vista-clientes .clientes-tabla-header {
    flex-direction: column;
    align-items: stretch;
  }

  #vista-clientes .clientes-tabla-actions {
    width: 100%;
  }

  #vista-clientes .clientes-vista-toggle {
    display: flex;
    width: 100%;
    justify-content: stretch;
  }

  #vista-clientes .clientes-vista-toggle__btn {
    flex: 1;
    text-align: center;
  }

  #vista-clientes .clientes-tabla-actions .btn-nuevo {
    flex: 1;
    justify-content: center;
  }
}

/* Calendario operativo premium: layout y controles */
.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.cal-head__title {
  font-size: clamp(1.2rem, 2vw, 1.35rem);
  font-weight: 700;
  color: var(--trenio-text);
  margin: 0 0 0.2rem;
  letter-spacing: -0.02em;
}

.cal-head__sub {
  font-size: 0.82rem;
  color: var(--trenio-muted);
  margin: 0;
}

.cal-toast {
  display: none;
  font-size: 0.75rem;
  border: 1px solid #b8e8ff;
  border-radius: 0.55rem;
  padding: 0.5rem 0.65rem;
  max-width: 20rem;
}

.cal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.62rem;
  margin-bottom: 0.75rem;
}

.cal-kpi-card {
  background: linear-gradient(170deg, var(--trenio-surface) 0%, #f8fbff 100%);
  border: 1px solid var(--trenio-border);
  border-radius: 0.78rem;
  padding: 0.72rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.cal-kpi-card__label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--trenio-muted);
}

.cal-kpi-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--trenio-text);
  margin-top: 0.15rem;
}

.cal-kpi-card__value--primary { color: var(--trenio-primary); }
.cal-kpi-card__value--danger { color: #b91c1c; }
.cal-kpi-card__value--ok { color: #0f766e; }

.cal-legend {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.cal-legend__label {
  font-size: 0.68rem;
  color: var(--trenio-muted);
  font-weight: 600;
}

.cal-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.72rem;
  color: var(--trenio-text);
  background: var(--trenio-surface);
  border: 1px solid var(--trenio-border);
  border-radius: 999px;
  padding: 0.25rem 0.52rem;
}

.cal-legend-chip__line {
  width: 3px;
  height: 14px;
  border-radius: 2px;
  display: inline-block;
}

.cal-legend-chip__line--activity { background: #38b6ff; }
.cal-legend-chip__line--close-hours { background: #dc2626; }

.cal-legend-chip__bg-close {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.12);
}

.cal-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.cal-main-panel,
.cal-side-panel {
  border-radius: 1rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.cal-main-panel { padding: 0.9rem; }

.cal-side-panel__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--trenio-text);
  margin-bottom: 0.1rem;
}

.cal-side-panel__sub {
  font-size: 0.75rem;
  color: var(--trenio-muted);
  margin-bottom: 0.72rem;
}

.cal-form-grid {
  display: grid;
  gap: 0.52rem;
  margin-bottom: 0.55rem;
}

.cal-form-field {
  display: grid;
  gap: 0.25rem;
}

.cal-form-field label,
.cal-form-label {
  font-size: 0.75rem;
  color: var(--trenio-text);
}

.cal-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--trenio-text);
}

.cal-hours-grid {
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.cal-input {
  width: 100%;
  border: 1px solid var(--trenio-border);
  border-radius: 0.55rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.81rem;
  font-family: inherit;
  background: var(--trenio-surface);
  color: var(--trenio-text);
  box-sizing: border-box;
}

.cal-input:focus {
  outline: none;
  border-color: var(--trenio-primary);
  box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.14);
}

.cal-btn {
  border: none;
  border-radius: 0.52rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cal-btn:active { transform: translateY(1px); }

.cal-btn--primary {
  background: linear-gradient(135deg, var(--color-brand) 0%, var(--color-brand-deep) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(56, 56, 255, 0.2);
}

.cal-btn--primary:hover {
  box-shadow: 0 10px 22px rgba(56, 119, 255, 0.26);
}

.cal-btn--danger {
  background: #fee2e2;
  color: #b91c1c;
}

.cal-btn--full { width: 100%; }
.cal-btn--xs { padding: 0.3rem 0.5rem; font-size: 0.68rem; }

.cal-form-error {
  font-size: 0.72rem;
  color: #dc2626;
  min-height: 16px;
}

.cal-side-list-block {
  border-top: 1px solid var(--trenio-border);
  margin-top: 0.65rem;
  padding-top: 0.65rem;
}

.cal-side-list-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--trenio-text);
  margin-bottom: 0.5rem;
}

.cal-side-list {
  display: grid;
  gap: 0.5rem;
  max-height: 280px;
  overflow: auto;
}

.cal-cierre-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.62rem;
  border: 1px solid var(--trenio-border);
  border-radius: 0.55rem;
  background: var(--trenio-surface);
}

.cal-cierre-item__date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--trenio-text);
}

.cal-cierre-item__meta {
  font-size: 0.69rem;
  color: var(--trenio-muted);
  line-height: 1.3;
}

.cal-side-empty {
  font-size: 0.75rem;
  color: var(--trenio-subtle);
}

/* Topbar + sidebar premium */
#pantalla-dashboard > nav {
  background: color-mix(in srgb, var(--trenio-surface) 92%, #f8fbff 8%);
  border-bottom: 1px solid color-mix(in srgb, var(--trenio-border) 88%, #ffffff 12%);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  backdrop-filter: saturate(120%) blur(6px);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
}

#sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border-right: 1px solid var(--trenio-border);
  box-shadow:
    6px 0 24px -8px rgba(15, 23, 42, 0.14),
    2px 0 12px -4px rgba(15, 23, 42, 0.08);
}

.sidebar-btn {
  border-radius: 12px !important;
  transition: transform 0.08s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease !important;
}

.sidebar-btn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%) !important;
  box-shadow: 0 4px 12px rgba(56, 119, 255, 0.1);
}

.sidebar-btn:active {
  transform: translateY(1px);
}

.sidebar-item-active {
  background: linear-gradient(135deg, rgba(56, 182, 255, 0.2), rgba(56, 119, 255, 0.1)) !important;
  box-shadow: inset 0 0 0 1px rgba(56, 182, 255, 0.28), 0 8px 18px rgba(56, 182, 255, 0.14);
}

#perfil-avatar {
  border: 1px solid rgba(56, 182, 255, 0.3);
  box-shadow: 0 3px 10px rgba(56, 182, 255, 0.2);
}

/* Dashboard premium details */
.dash-inline-title {
  margin-bottom: 0.25rem !important;
}

.dash-inline-sub {
  font-size: 0.79rem;
  color: var(--trenio-muted);
  margin: 0 0 0.5rem;
  line-height: 1.35;
}

.dash-empty-note {
  margin: 0;
  font-size: 0.79rem;
  color: #9ca3af;
}

.dash-access-list {
  display: grid;
  gap: 0.5rem;
}

.dash-access-item {
  background: linear-gradient(165deg, #ffffff 0%, #f3f9ff 100%);
  border: 1px solid rgba(56, 182, 255, 0.2);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.06);
}

.dash-access-item__main {
  min-width: 0;
}

.dash-access-item__name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--trenio-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-access-item__activity {
  font-size: 0.74rem;
  color: var(--trenio-muted);
}

.dash-access-item__time {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f5c85;
  flex-shrink: 0;
}

.dash-access-foot {
  margin-top: 0.65rem;
}

.dash-action-btn {
  padding: 0.5rem 0.72rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.dash-action-btn:hover {
  border-color: rgba(56, 182, 255, 0.45);
  background: #f4faff;
  color: #0f5c85;
}

.dash-kpi--clickable {
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.dash-kpi--clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.1);
}

/* Clientes premium polish */
.btn-nuevo--ghost {
  background: #fff !important;
  color: #111827 !important;
  border: 1px solid #e5e7eb !important;
}

.clientes-kpi-stat__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: linear-gradient(145deg, #eef4ff, #e3edf9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 0.35rem;
}

.clientes-kpi-stat__label {
  font-size: 0.66rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.clientes-kpi-stat__value {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.2rem;
}
.clientes-kpi-stat__value--ok { color: #16a34a; }
.clientes-kpi-stat__value--danger { color: #dc2626; }
.clientes-kpi-stat__value--warn { color: #d97706; }
.clientes-kpi-stat__value--primary { color: #38b6ff; }

.clientes-crm-toolbar__row--compact {
  margin-bottom: 0 !important;
}

.clientes-pill-count {
  opacity: 0.75;
  font-weight: 700;
}

.clientes-search-row--premium {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.clientes-selection-bar {
  display: none;
  padding: 10px 20px;
  background: #e8f7fe;
  border-bottom: 1px solid #b8e8ff;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.clientes-selection-bar__count {
  font-size: 13px;
  font-weight: 500;
  color: #38b6ff;
}

.clientes-selection-bar__btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
}

.clientes-selection-bar__btn--primary {
  background: #38b6ff;
  color: #fff;
  border-color: #38b6ff;
}

.clientes-selection-bar__btn--ghost {
  background: #fff;
  border-color: #b8e8ff;
  color: #6b7280;
}

.badge-ice {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.clientes-selection-bar__btn--wa {
  background: #25D366;
  border-color: #25D366;
  color: #fff;
}

.clientes-selection-bar__btn--wa:hover {
  background: #1ebe5d;
  border-color: #1ebe5d;
}

/* ─── SOCIOS — tarjeta móvil compacta con expand ────────────────────────── */
.socio-mobil-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.socio-mobil-card--sel { border-color: var(--color-brand); border-width: 2px; }

.socio-mobil-card__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.socio-mobil-card__info { flex: 1; min-width: 0; }
.socio-mobil-card__name {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.socio-mobil-card__sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.socio-mobil-card__right { flex-shrink: 0; }

.socio-mobil-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 10px;
  flex-wrap: nowrap;
}
.socio-mobil-btn {
  padding: 6px 10px;
  min-height: 34px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.socio-mobil-btn--expand { padding: 6px 8px; }

.socio-mobil-card__expand {
  display: none;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.socio-mobil-card__expand.is-open { display: block; }

.socio-mobil-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.socio-mobil-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.socio-mobil-detail-grid span { font-size: var(--text-xs); color: var(--text-muted); }
.socio-mobil-detail-grid strong { font-size: var(--text-sm); color: var(--text-primary); }

/* Actividades premium polish */
.act-head-wrap { margin-bottom: 20px; }

.act-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.act-head-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.act-head-sub {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

.act-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.act-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

.act-btn--soft {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.act-btn--ghost {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
}

/* Botón eliminar monitor (modal Monitores desde Actividades) */
.act-monitor-delete-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.act-monitor-delete-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}
.act-monitor-delete-btn:focus-visible {
  outline: 2px solid #f87171;
  outline-offset: 2px;
}

.act-plan-limit {
  font-size: 13px;
  color: #6b7280;
  align-self: center;
}

.act-kpi-card { padding: 14px 16px; }
.act-kpi-card__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: linear-gradient(145deg, #eef4ff, #e3edf9);
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}
.act-kpi-card__label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.25;
}
.act-kpi-card__value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.actividades-filtros--premium {
  padding: 12px 14px !important;
  margin-bottom: 16px !important;
}

.act-filter-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
}

.act-filter-select {
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
}

/* ── Barras de búsqueda/filtros: misma cromía que la topbar pero translúcida (jerarquía bajo la barra) ── */
#vista-actividades .panel.actividades-filtros,
#vista-monitores .panel.monitores-filtros-bar,
#vista-clientes .search-row.clientes-search-row {
  background: linear-gradient(
    135deg,
    rgba(31, 42, 68, 0.55),
    rgba(18, 26, 47, 0.58)
  ) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(18, 26, 47, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  border-bottom: none !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

body.ux-ref-shell #vista-actividades .panel.actividades-filtros,
body.ux-ref-shell #vista-monitores .panel.monitores-filtros-bar,
body.ux-ref-shell #vista-clientes .search-row.clientes-search-row {
  border-radius: var(--trenio-topbar-radius);
}

#vista-monitores .monitores-filtros-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#vista-monitores .monitores-filtros-bar--premium {
  padding: 12px 14px !important;
  margin-bottom: 16px !important;
}

#vista-monitores .monitores-filter-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
}

#vista-monitores .monitores-filter-input::placeholder {
  color: rgba(255, 255, 255, 0.62) !important;
  font-weight: 500;
}

#vista-monitores .monitores-filtros-bar__hint {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

#vista-monitores .monitores-filtros-bar__hint strong {
  color: #ffffff;
  font-weight: 800;
}

#vista-actividades .act-filter-input,
#vista-actividades .act-filter-select,
#vista-clientes .clientes-search-row input,
#vista-clientes .clientes-search-row select.select-estado {
  background: rgba(255, 255, 255, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  font-weight: 600;
}

#vista-actividades .act-filter-input::placeholder,
#vista-clientes .clientes-search-row input::placeholder {
  color: rgba(255, 255, 255, 0.62) !important;
  font-weight: 500;
}

#vista-actividades .act-filter-select option,
#vista-clientes .clientes-search-row select option {
  background: #1f2a44;
  color: #ffffff;
  font-weight: 600;
}

#vista-actividades .act-filter-input:focus,
#vista-actividades .act-filter-select:focus,
#vista-monitores .monitores-filter-input:focus,
#vista-clientes .clientes-search-row input:focus,
#vista-clientes .clientes-search-row select:focus {
  outline: 2px solid rgba(56, 182, 255, 0.45);
  outline-offset: 1px;
}

#vista-clientes .clientes-search-row .clientes-search-wrap::before {
  opacity: 0.7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
}

.act-empty-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 0.75rem;
  background: linear-gradient(145deg, #eef4ff, #e3edf9);
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.act-card-glyph {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e8f7fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #0f5c85;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.act-mini-btn {
  background: #f3f4f6;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.53rem;
  font-weight: 800;
  color: #334155;
}

.act-mini-btn--danger {
  background: #fef2f2;
  color: #b91c1c;
}

.act-monitor-pill {
  font-size: 11px;
  background: #f3f4f6;
  border-radius: 20px;
  padding: 2px 10px;
  color: #374151;
}

.act-app-pill {
  font-size: 11px;
  background: #e8f7fe;
  border-radius: 20px;
  padding: 2px 10px;
  color: #3838ff;
}

/* Modal system polish */
.modal {
  border-radius: 18px !important;
  border: 1px solid color-mix(in srgb, var(--trenio-border) 88%, #fff 12%);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16) !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}

.modal-botones {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, #ffffff 28%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-cancelar,
.btn-guardar {
  border-radius: 10px !important;
  font-weight: 700 !important;
}

/* UX redistribution v2: layout first */
.trenio-content-shell {
  max-width: min(1400px, 100%);
}

#vista-dashboard {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

/* ─── Dashboard estilo BankDash: KPIs arriba, tarjetas blancas, iconos pastel ─── */
.dash-page-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b92a8;
  margin: 0 0 0.1rem;
}

.dash-page-header--bankdash .dash-page-title-main {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  letter-spacing: -0.02em;
}

.dash-page-header--bankdash .app-page-sub {
  color: #6b7280;
  font-size: 0.75rem;
}

.dash-page-header--bankdash .dash-health {
  background: #fff;
  border: 1px solid #e8ecf4;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
  color: #111827;
  border-left: 4px solid #396aff;
}

.dash-page-header--bankdash .dash-health__title {
  color: #6b7280;
}

.dash-page-header--bankdash .dash-health__body {
  color: #111827;
}

.dash-page-header--bankdash .dash-health__body strong {
  color: #396aff;
}

.dash-page-header--bankdash .dash-health__hint {
  color: #6b7280;
}

.dash-page-header--bankdash .dash-health--ok {
  border-left-color: #396aff;
}

.dash-page-header--bankdash .dash-health--mid {
  border-left-color: #d97706;
}

.dash-page-header--bankdash .dash-health--bad {
  border-left-color: #dc2626;
}

.dash-page-header--bankdash .dash-health--bad .dash-health__body strong {
  color: #dc2626;
}

.dash-kpi-strip--bankdash {
  background: #fff !important;
  border: 1px solid #e8ecf4 !important;
  border-radius: 16px !important;
  padding: 0.6rem 0.85rem 0.65rem !important;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06) !important;
}

.dash-kpi-strip__intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.2rem 0.4rem;
  margin-bottom: 0.3rem;
  min-width: 0;
}

.dash-kpi-strip__intro-text {
  min-width: 0;
  flex: 1 1 12rem;
}

.dash-kpi-strip__eyebrow {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b92a8;
  margin: 0 0 0.1rem;
}

.dash-kpi-strip__heading {
  font-size: 0.82rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

.dash-today-total--bankdash {
  margin: 0;
  text-align: right;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 640px) {
  .dash-today-total--bankdash {
    text-align: left;
    width: 100%;
  }
}

.dash-kpi-grid--bankdash {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0;
}

@media (max-width: 1100px) {
  .dash-kpi-grid--bankdash {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .dash-kpi-grid--bankdash {
    grid-template-columns: 1fr;
  }
}

.dash-kpi--bankdash {
  padding: 0.55rem 0.7rem !important;
  border-radius: 12px !important;
  border: 1px solid #eef0f5 !important;
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}

.dash-kpi--bankdash .dash-kpi__bankdash-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.dash-kpi--bankdash .dash-kpi__icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-kpi--bankdash .dash-kpi__icon svg {
  display: block;
}

.dash-kpi__icon--income {
  background: #fff7e8;
  color: #d97706;
}

.dash-kpi__icon--cuota {
  background: #e8f1ff;
  color: #396aff;
}

.dash-kpi__icon--users {
  background: #e8f7ef;
  color: #16a34a;
}

.dash-kpi__icon--alert {
  background: #fef2f2;
  color: #dc2626;
}

.dash-kpi--bankdash .dash-kpi__main {
  min-width: 0;
  flex: 1;
}

.dash-kpi--bankdash .dash-kpi__label {
  font-size: 0.6rem;
  margin-bottom: 0.06rem;
  color: #8b92a8;
}

.dash-kpi--bankdash .dash-kpi__value {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
}

.dash-kpi--bankdash .dash-kpi__hint {
  font-size: 0.62rem;
  color: #9ca3af;
  margin-top: 0;
  padding-top: 0.3rem;
  border-top: 1px solid #f1f3f8;
}

.dash-kpi--bankdash.dash-kpi--danger {
  border-color: #fecaca !important;
  background: linear-gradient(180deg, #fffefe 0%, #fff5f5 100%) !important;
}

#vista-dashboard .dash-queue-btn--primary {
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #396aff, #38b6ff);
  box-shadow: 0 4px 14px rgba(57, 106, 255, 0.28);
}

#vista-dashboard .dash-queue-btn--ghost {
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  border-color: #d8dee8;
  color: #396aff;
  font-weight: 600;
}

#vista-dashboard .dash-queue-btn--ghost:hover {
  background: #f4f7ff;
  border-color: #396aff;
}

#vista-dashboard .dash-queue-btn--queue-wa {
  color: #166534;
  border-color: #bbf7d0;
}

#vista-dashboard .dash-queue-btn--queue-wa:hover {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #14532d;
}

.dash-kpi-strip {
  background: linear-gradient(180deg, rgba(56, 182, 255, 0.05), rgba(255, 255, 255, 0));
  border: 1px solid rgba(56, 182, 255, 0.16);
  border-radius: 14px;
  padding: 0.6rem 0.75rem 0.72rem;
}

.dash-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-layout-main {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 0.85rem;
  align-items: start;
}

.dash-queue-card,
.dash-feed-card {
  overflow: hidden;
}

.dash-side-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 96px;
}

.dash-fin-card,
.dash-move-card {
  padding: 0 !important;
}

.dash-fin-card__head,
.dash-move-card__head {
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}

.dash-move-card__head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

/* Clientes / actividades: toolbars persistent */
#vista-clientes .tabla-section,
#vista-actividades > .panel,
#vista-actividades .actividades-lista-grid {
  scroll-margin-top: 88px;
}

#vista-clientes .clientes-crm-toolbar {
  position: sticky;
  top: 84px;
  z-index: 15;
}

#vista-clientes .clientes-search-row {
  position: sticky;
  top: 138px;
  z-index: 14;
}

#vista-actividades .actividades-filtros {
  position: sticky;
  top: 90px;
  z-index: 14;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

/* Topbar flotante (ux-ref-shell): sticky / paneles alineados con --trenio-topbar-stack */
body.ux-ref-shell .dash-side-stack {
  top: calc(var(--trenio-topbar-stack) + 12px);
}

body.ux-ref-shell #vista-actividades > .panel,
body.ux-ref-shell #vista-actividades .actividades-lista-grid {
  scroll-margin-top: calc(var(--trenio-topbar-stack) + 4px);
}

body.ux-ref-shell #vista-clientes .clientes-crm-toolbar {
  top: var(--trenio-topbar-stack);
}

body.ux-ref-shell #vista-clientes .clientes-search-row {
  top: calc(var(--trenio-topbar-stack) + var(--trenio-clientes-toolbar-sticky-h));
}

/* Espacio bajo filtros/búsqueda: la primera fila de socios no queda medio tapada al hacer scroll */
body.ux-ref-shell #vista-clientes #tabla-clientes {
  margin-top: 0.75rem;
  padding-top: 0.25rem;
}

body.ux-ref-shell #vista-clientes .tabla-section {
  scroll-margin-top: calc(
    var(--trenio-topbar-stack) + var(--trenio-clientes-toolbar-sticky-h) +
      var(--trenio-clientes-search-sticky-h) + 12px
  );
}

body.ux-ref-shell #vista-actividades .actividades-filtros {
  top: calc(var(--trenio-topbar-stack) + 6px);
}

body.ux-ref-shell #trenio-plan-banner {
  top: var(--trenio-topbar-stack) !important;
}

body.ux-ref-shell #ficha-panel {
  top: var(--trenio-topbar-stack) !important;
  height: calc(100vh - var(--trenio-topbar-stack)) !important;
}

/* Calendario 70/30 real en escritorio */
.cal-main-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
}

@media (max-width: 1280px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-kpi-grid .dash-kpi:last-child {
    grid-column: span 1;
  }
}

@media (max-width: 1023px) {
  .dash-side-stack {
    position: static;
  }

  #vista-clientes .clientes-crm-toolbar,
  #vista-clientes .clientes-search-row,
  #vista-actividades .actividades-filtros {
    position: static;
  }

  /* Toolbars en flujo normal: el thead solo debe quedar bajo la topbar flotante */
  #vista-clientes {
    --clientes-thead-sticky-top: 84px;
  }

  body.ux-ref-shell #vista-clientes {
    --clientes-thead-sticky-top: var(--trenio-topbar-stack);
  }
}

/* ── Topbar search dropdown ─────────────────────────────────────────────── */
.tsearch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #F3F4F6;
  transition: background 0.1s;
}
.tsearch-item:last-child { border-bottom: none; }
.tsearch-item:hover,
.tsearch-item--active { background: #F4FAFF; }
.tsearch-item__tipo {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--color-brand);
  border-radius: 20px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.tsearch-item__tipo--act { background: #16A34A; }
.tsearch-item__tipo--mon { background: #7C3AED; }
.tsearch-item__nom { font-weight: 600; color: #111827; flex: 1; }
.tsearch-item__meta { font-size: 12px; color: #9CA3AF; }

/* ── Sticky thead Socios: cabecera neutra (sin cromía topbar; tabla alineada al resto del panel) ── */
#vista-clientes .client-table {
  border-collapse: separate;
  border-spacing: 0;
}

#vista-clientes .client-table thead th {
  position: sticky;
  top: var(--clientes-thead-sticky-top);
  z-index: 12;
  background: #f4faff;
  padding: 10px 12px;
  box-shadow: 0 1px 0 #e5e7eb;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280 !important;
  border-top: none !important;
  border-bottom: 1px solid #e5e7eb !important;
  border-left: none !important;
  border-right: none !important;
  vertical-align: middle;
}

#vista-clientes .client-table thead th input[type='checkbox'] {
  accent-color: var(--color-brand);
}

#vista-clientes .client-table tbody tr:first-child td {
  padding-top: 14px;
}

/* Actividades + Equipo (monitores): mismas cabeceras de tabla que Socios */
#vista-actividades,
#vista-monitores {
  --modulo-thead-radius: 12px;
}

body.ux-ref-shell #vista-actividades,
body.ux-ref-shell #vista-monitores {
  --modulo-thead-radius: var(--trenio-topbar-radius);
}

#vista-actividades .client-table,
#vista-monitores .client-table {
  border-collapse: separate;
  border-spacing: 0;
}

#vista-actividades .client-table thead th,
#vista-monitores .client-table thead th {
  position: sticky;
  top: 84px;
  z-index: 11;
  background: linear-gradient(135deg, #1f2a44, #121a2f);
  padding: 12px 12px;
  box-shadow: none;
  color: #ffffff !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.18) !important;
  vertical-align: middle;
}

body.ux-ref-shell #vista-actividades .client-table thead th,
body.ux-ref-shell #vista-monitores .client-table thead th {
  top: var(--trenio-topbar-stack);
}

#vista-actividades .client-table thead th:not(:last-child),
#vista-monitores .client-table thead th:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#vista-actividades .client-table thead th:first-child,
#vista-monitores .client-table thead th:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-top-left-radius: var(--modulo-thead-radius);
}

#vista-actividades .client-table thead th:last-child,
#vista-monitores .client-table thead th:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-top-right-radius: var(--modulo-thead-radius);
}

#vista-actividades .client-table tbody tr:first-child td,
#vista-monitores .client-table tbody tr:first-child td {
  padding-top: 14px;
}
