:root {
  /* ── Alma Diosa brand: borgoña/carmín profundo + oro + plata ── */
  --bg-deep:        #05000A;           /* negro con tinte carmín */
  --surface:        #0F0015;           /* borgoña muy oscuro */
  --surface-raised: #1A0020;           /* borgoña oscuro */
  --crimson:        #8B1040;           /* carmín principal del logo */
  --crimson-dim:    rgba(139,16,64,0.22);
  --gold:           #D4AF37;
  --gold-light:     #ECC84A;
  --gold-muted:     #C5A55A;
  --silver:         #C8C0D0;           /* plata "Diosa" */
  --cream:          #F5EEF8;           /* crema con tinte frío */
  --muted:          #8070A0;
  --border:         rgba(139,16,64,0.30);
  --border-strong:  rgba(212,175,55,0.40);
  --success: #38A169;
  --danger:  #E53E3E;
  --warning: #D69E2E;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-deep);
  color: var(--cream);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- background atmosphere ---- */
/* Replica el fondo del logo: borgoña/carmín centrado degradando a negro profundo */
.bg-atmosphere {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 2400px 1600px at 50% 35%, rgba(110,8,45,0.72),   transparent 55%),
    radial-gradient(ellipse 1400px 1000px at 15%  0%, rgba(90,5,35,0.50),    transparent 58%),
    radial-gradient(ellipse 1200px  900px at 90% 90%, rgba(80,4,30,0.38),    transparent 60%),
    radial-gradient(ellipse 2000px 1600px at 50% 50%, rgba(4,0,10,0.92),     transparent 70%);
}
.bg-particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.5; }
.particle {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 6px rgba(212,175,55,0.6);
  animation: float linear infinite;
}
@keyframes float {
  0%   { transform: translateY(100vh) translateX(0); opacity: 0; }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.8; }
  100% { transform: translateY(-10vh) translateX(40px); opacity: 0; }
}

/* ---- shell ---- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.main { padding: 24px 28px 48px; min-width: 0; }

/* ---- header ---- */
.header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.header-left { display: flex; align-items: center; gap: 16px; }

/* ---- landing tabs (sub-header) ---- */
.landing-tabs {
  display: flex; gap: 8px; margin-bottom: 18px; padding: 6px;
  border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,0,30,0.5), rgba(8,0,14,0.5));
  backdrop-filter: blur(10px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.landing-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-family: 'Manrope'; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
  flex-shrink: 0;
}
.landing-tab:hover { color: var(--cream); background: rgba(255,255,255,0.03); }
.landing-tab.active {
  color: var(--cream); border-color: var(--tab-color, var(--gold));
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--tab-color, var(--gold)) 22%, transparent),
    color-mix(in srgb, var(--tab-color, var(--gold)) 8%, transparent));
  box-shadow: 0 0 18px color-mix(in srgb, var(--tab-color, var(--gold)) 30%, transparent);
}
.landing-tab-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.landing-tab-name { font-size: 12px; }
.landing-tab-sub {
  font-size: 9px; color: var(--muted); letter-spacing: 0.04em;
  font-family: 'JetBrains Mono', monospace;
}
.landing-tab.active .landing-tab-sub { color: var(--gold-muted); }

/* Banner contextual cuando se selecciona una landing */
.landing-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 10px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 14%, transparent),
    color-mix(in srgb, var(--accent) 4%, transparent));
  font-size: 12px; color: var(--cream);
}
.landing-banner-dot {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}
.landing-banner b { color: var(--gold-light); font-weight: 600; }
.landing-banner-sub { color: var(--muted); font-size: 11px; }
.landing-banner-clear {
  margin-left: auto; padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--gold-light); cursor: pointer; font-size: 11px; font-weight: 600;
  transition: all 0.18s;
}
.landing-banner-clear:hover { border-color: var(--border-strong); background: rgba(212,175,55,0.08); }

/* ---- landing comparison table ---- */
.lc-table-wrap { overflow-x: auto; }
.lc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.lc-table th {
  text-align: left; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.lc-table td { padding: 14px 10px; border-bottom: 1px dashed rgba(212,175,55,0.07); vertical-align: middle; }
.lc-row { cursor: pointer; transition: background 0.18s; }
.lc-row:hover { background: rgba(212,175,55,0.04); }
.lc-name { display: flex; align-items: center; gap: 10px; }
.lc-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 10px currentColor; }
.lc-name-text { color: var(--cream); font-weight: 600; }
.lc-name-sub { color: var(--muted); font-size: 10px; margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.lc-bar-wrap {
  height: 8px; background: rgba(212,175,55,0.06); border-radius: 4px; overflow: hidden;
  margin-bottom: 4px;
}
.lc-bar { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(.2,.7,.2,1); }
.lc-bar-pct { font-size: 10px; color: var(--muted); }
.lc-num { font-family: 'Noto Serif'; font-size: 16px; color: var(--cream); font-weight: 500; }
.lc-rate {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid;
}
.lc-rate-hi  { color: var(--success); border-color: rgba(56,161,105,0.35); background: rgba(56,161,105,0.10); }
.lc-rate-mid { color: var(--gold-light); border-color: rgba(212,175,55,0.35); background: rgba(212,175,55,0.10); }
.lc-rate-lo  { color: var(--danger); border-color: rgba(229,62,62,0.35); background: rgba(229,62,62,0.10); }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(212,175,55,0.55);
  background: radial-gradient(circle at 35% 35%, rgba(139,16,64,0.80), rgba(5,0,10,1));
  display: grid; place-items: center;
  font-family: 'Noto Serif'; font-size: 20px; color: var(--gold-light);
  box-shadow: 0 0 36px rgba(139,16,64,0.55), 0 0 14px rgba(212,175,55,0.20), inset 0 0 14px rgba(212,175,55,0.12);
}
.brand-stack { display: flex; flex-direction: column; }
.brand-name { font-family: 'Noto Serif'; font-size: 22px; letter-spacing: 0.02em; color: var(--cream); display: flex; align-items: center; gap: 10px; }
.brand-alma { background: linear-gradient(135deg, #E9C349, #C5A55A, #E9C349); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 400; letter-spacing: 0.04em; }
.brand-analytics { font-size: 13px; font-family: 'Manrope'; font-weight: 300; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; -webkit-text-fill-color: var(--muted); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border: 1px solid rgba(229,62,62,0.4); border-radius: 999px;
  background: rgba(229,62,62,0.08);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: #ff8a8a;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #E53E3E;
  box-shadow: 0 0 8px rgba(229,62,62,0.8);
  animation: blink 1.4s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes pulse { 0%, 100% { opacity: 0.6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.15); } }

.header-right { display: flex; align-items: center; gap: 16px; }
.range-selector {
  display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(28,9,0,0.65); backdrop-filter: blur(8px);
}
.range-btn {
  padding: 7px 14px; border: 0; background: transparent; color: var(--muted);
  font-family: 'Manrope'; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  border-radius: 7px; cursor: pointer; transition: all 0.2s;
}
.range-btn:hover { color: var(--cream); }
.range-btn.active {
  background: linear-gradient(180deg, rgba(139,16,64,0.55), rgba(139,16,64,0.22));
  color: var(--gold-light);
  box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 14px rgba(212,175,55,0.18);
}

.last-update { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.sync-icon { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.user-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: rgba(15,0,22,0.60); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #C5A55A, #6b0030); display: grid; place-items: center; font-family: 'Noto Serif'; color: var(--cream); font-size: 12px; font-weight: 700; }

/* ---- card base ---- */
.card {
  background: linear-gradient(180deg, rgba(20,0,30,0.88), rgba(8,0,14,0.94));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(212,175,55,0.04), transparent 30%);
}
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-family: 'Noto Serif'; font-size: 17px; color: var(--cream); letter-spacing: 0.01em; }
.card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: 0.02em; }

/* ---- KPI row ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-card {
  background: linear-gradient(180deg, rgba(20,0,30,0.88), rgba(8,0,14,0.94));
  border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px;
  backdrop-filter: blur(12px); position: relative; overflow: hidden;
  transition: transform 0.25s, border-color 0.25s;
  cursor: default;
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi-glow {
  box-shadow: 0 0 30px rgba(212,175,55,0.08), inset 0 0 0 1px rgba(212,175,55,0.08);
}
.kpi-glow::after {
  content: ''; position: absolute; top: -40%; right: -20%; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(212,175,55,0.18), transparent 70%);
  pointer-events: none;
}
.kpi-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi-value {
  font-family: 'Noto Serif'; font-size: 38px; line-height: 1.1; color: var(--gold-light);
  margin-top: 6px; letter-spacing: -0.01em; position: relative; z-index: 1;
}
.kpi-sub { font-size: 12px; color: var(--cream); margin-top: 4px; }
.kpi-sub-muted { color: var(--muted); }
.kpi-tip { font-size: 10px; color: var(--muted); margin-top: 8px; opacity: 0; transition: opacity 0.2s; font-family: 'JetBrains Mono', monospace; }
.kpi-card:hover .kpi-tip { opacity: 0.6; }

/* ---- bento grid ---- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.bento > * { min-width: 0; }
.span-7  { grid-column: span 7; }
.span-5  { grid-column: span 5; }
.span-6  { grid-column: span 6; }
.span-4  { grid-column: span 4; }
.span-8  { grid-column: span 8; }
.span-12 { grid-column: span 12; }

/* ---- chart ---- */
.chart { width: 100%; height: 240px; display: block; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-dotted { background: linear-gradient(90deg, var(--muted) 50%, transparent 50%); background-size: 4px 1px; height: 2px; width: 14px; border-radius: 0; }

.tooltip {
  background: rgba(15,3,3,0.96); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 11px; color: var(--cream); box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.tt-date { font-family: 'Noto Serif'; color: var(--gold-light); margin-bottom: 4px; font-size: 12px; }
.tt-row { display: flex; justify-content: space-between; gap: 12px; }
.tt-row b { color: var(--cream); }

/* ---- UTM ---- */
.utm-body { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: center; }
.donut { width: 200px; height: 200px; }
.donut-num { font-family: 'Noto Serif'; font-size: 26px; fill: var(--cream); }
.donut-lbl { font-size: 10px; fill: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.utm-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.utm-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); }
.utm-table td { padding: 8px; border-bottom: 1px dashed rgba(212,175,55,0.08); color: var(--cream); }
.utm-table td:first-child { display: flex; align-items: center; gap: 8px; }
.utm-table tbody tr:hover { background: rgba(212,175,55,0.04); }
.src-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.utm-group-header td { padding: 6px 8px 4px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; border-bottom: none; background: rgba(212,175,55,0.03); }
.utm-sep td { padding: 0; height: 1px; background: rgba(212,175,55,0.15); border: none; }
.utm-summary td { padding: 8px; font-weight: 600; color: var(--cream); border-bottom: none; }
.utm-summary:first-of-type td { padding-top: 10px; }

/* ---- funnel ---- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-stage { padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; transition: all 0.25s; }
.funnel-stage:hover { background: rgba(212,175,55,0.04); }
.funnel-worst { border-color: var(--gold) !important; background: linear-gradient(90deg, rgba(212,175,55,0.08), transparent); box-shadow: 0 0 24px rgba(212,175,55,0.1); }
.funnel-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.funnel-label { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; }
.funnel-idx {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border-strong); font-size: 11px; color: var(--gold-light); font-family: 'Noto Serif';
}
.funnel-vals { display: inline-flex; align-items: baseline; gap: 10px; }
.funnel-num { font-family: 'Noto Serif'; font-size: 18px; color: var(--cream); }
.funnel-drop { font-size: 11px; color: var(--danger); font-weight: 600; }
.funnel-bar-wrap { height: 8px; background: rgba(212,175,55,0.06); border-radius: 4px; overflow: hidden; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, var(--gold-light), var(--gold-muted)); border-radius: 4px; transition: width 0.6s cubic-bezier(.2,.7,.2,1); }
.warn-pill { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(214,158,46,0.15); color: var(--warning); border: 1px solid rgba(214,158,46,0.3); margin-left: 6px; }

/* ---- video distribution ---- */
.hist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; height: 170px; padding: 0 4px; }
.hist-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.hist-num { font-family: 'Noto Serif'; font-size: 16px; color: var(--cream); }
.hist-bar-wrap { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.hist-bar { width: 100%; background: linear-gradient(180deg, rgba(212,175,55,0.45), rgba(212,175,55,0.15)); border: 1px solid var(--border-strong); border-radius: 6px 6px 0 0; transition: height 0.6s; }
.hist-hero .hist-bar { background: linear-gradient(180deg, var(--gold-light), rgba(212,175,55,0.3)); box-shadow: 0 0 24px rgba(212,175,55,0.25); }
.hist-hero .hist-num { color: var(--gold-light); }
.hist-lbl { font-size: 10px; color: var(--muted); text-align: center; letter-spacing: 0.02em; }
.video-avg { text-align: right; }
.video-avg-num { font-family: 'Noto Serif'; font-size: 30px; color: var(--gold-light); line-height: 1; }
.video-avg-lbl { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.ref-line { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.ref-line b { color: var(--gold-light); }
.ref-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* ---- cohort ---- */
.cohort { display: flex; flex-direction: column; gap: 8px; }
.cohort-row { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 12px; }
.cohort-lbl { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--gold-muted); text-align: right; }
.cohort-bar-wrap { position: relative; height: 26px; background: rgba(212,175,55,0.04); border-radius: 6px; overflow: hidden; }
.cohort-bar { height: 100%; background: linear-gradient(90deg, var(--gold), rgba(212,175,55,0.3)); border-radius: 6px; transition: width 0.6s; }
.cohort-num { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); font-size: 11px; color: var(--cream); font-weight: 600; }
.cohort-pct { color: var(--muted); font-weight: 400; }

/* ---- meta rings ---- */
.meta-rings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ring-wrap { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px dashed var(--border); border-radius: 10px; }
.ring { width: 64px; height: 64px; flex-shrink: 0; }
.ring-meta { min-width: 0; }
.ring-label { font-size: 12px; color: var(--cream); font-weight: 600; }
.ring-sub { font-size: 10px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.meta-extra { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.meta-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.meta-row b { font-family: 'Noto Serif'; font-size: 16px; color: var(--cream); margin-left: auto; }
.meta-pct { color: var(--gold-muted); font-size: 11px; }
.meta-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---- leads table ---- */
.search-wrap { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(15,0,20,0.6); }
.search { background: transparent; border: 0; outline: none; color: var(--cream); font-family: inherit; font-size: 12px; width: 220px; }
.search::placeholder { color: var(--muted); }

/* Filtros por etapa */
.stage-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.stage-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-family: 'Manrope'; font-size: 11px;
  font-weight: 600; letter-spacing: 0.03em; cursor: pointer; transition: all 0.18s;
}
.stage-filter:hover { color: var(--cream); border-color: var(--border-strong); }
.stage-filter.active { color: var(--gold-light); border-color: var(--border-strong); background: rgba(212,175,55,0.08); }
.stage-count { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--muted); }
.stage-filter.active .stage-count { background: rgba(212,175,55,0.15); color: var(--gold-light); }

.leads-table-wrap { overflow-x: auto; }
.leads-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.leads-table th { text-align: left; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
.leads-table td { padding: 11px 10px; border-bottom: 1px dashed rgba(212,175,55,0.07); vertical-align: middle; }
.leads-table tbody tr:hover { background: rgba(212,175,55,0.03); }
.lead-name { color: var(--cream); font-weight: 500; }
.lead-email { color: var(--muted); font-size: 11px; margin-top: 1px; }
.lead-date { color: var(--gold-muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; white-space: nowrap; }
.utm-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(212,175,55,0.04); border: 1px solid var(--border); font-size: 11px; white-space: nowrap; }
.utm-pill-unknown { opacity: 0.45; font-style: italic; }
.utm-pill-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.video-mini { display: flex; align-items: center; gap: 8px; min-width: 80px; }
.video-mini-bar { height: 4px; background: linear-gradient(90deg, var(--gold), rgba(212,175,55,0.3)); border-radius: 2px; flex: 1; min-width: 4px; max-width: 50px; }
.state-badge { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; border: 1px solid; white-space: nowrap; }
.state-success { color: var(--success); border-color: rgba(56,161,105,0.35); background: rgba(56,161,105,0.10); }
.state-gold    { color: var(--gold-light); border-color: rgba(212,175,55,0.35); background: rgba(212,175,55,0.10); }
.state-warning { color: var(--warning); border-color: rgba(214,158,46,0.35); background: rgba(214,158,46,0.10); }
.state-muted   { color: var(--muted); border-color: var(--border); background: rgba(128,112,160,0.06); }

/* Celda "Agendó" */
.booked-cell { display: flex; flex-direction: column; gap: 2px; }
.booked-icon { color: var(--success); font-size: 14px; font-weight: 700; line-height: 1; }
.booked-date { color: var(--gold-muted); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.wa-link { display: inline-flex; align-items: center; gap: 5px; color: #25D366; font-size: 11px; text-decoration: none; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.wa-link:hover { text-decoration: underline; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 11px; color: var(--muted); }
.pager { display: inline-flex; align-items: center; gap: 8px; }
.pager button {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: transparent;
  color: var(--gold-light); cursor: pointer; font-size: 14px; transition: all 0.2s;
}
.pager button:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(212,175,55,0.06); }
.pager button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---- copilot ---- */
.copilot { display: flex; flex-direction: column; height: 100%; }
.copilot-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.copilot-title { display: inline-flex; align-items: center; gap: 12px; }
.copilot-glyph {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 38% 38%, rgba(139,16,64,0.7), rgba(5,0,10,0.9));
  border: 1px solid rgba(212,175,55,0.38);
  box-shadow: 0 0 18px rgba(139,16,64,0.5), 0 0 8px rgba(212,175,55,0.14);
  flex-shrink: 0;
}
.cp-name { font-family: 'Noto Serif'; font-size: 16px; color: var(--cream); }
.cp-status { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-top: 1px; }
.cp-status .live-dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.cp-icon-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; transition: all 0.2s; }
.cp-icon-btn:hover { color: var(--cream); border-color: var(--border-strong); }
.cp-icon-active { color: var(--terra); border-color: rgba(196,98,42,0.45); }
.cp-icon-active:hover { color: var(--gold-light); }

.copilot-feed { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.copilot-feed::-webkit-scrollbar { width: 4px; }
.copilot-feed::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.ai-msg { display: flex; gap: 10px; max-width: 100%; }
.ai-msg-bot { align-items: flex-start; }
.ai-msg-user { flex-direction: column; align-items: flex-end; gap: 2px; }
.ai-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #C4622A, #7A3010);
  border: 1px solid rgba(196,98,42,0.4);
  box-shadow: 0 0 10px rgba(196,98,42,0.25);
  display: grid; place-items: center; font-family: 'Noto Serif'; font-size: 11px; color: var(--gold-light); font-weight: 700; flex-shrink: 0;
}
.ai-bubble {
  background: rgba(38,20,8,0.75); border: 1px solid rgba(196,98,42,0.18); border-radius: 14px 14px 14px 4px;
  padding: 12px 14px; font-size: 13px; max-width: 90%; line-height: 1.5;
}
.ai-bubble-user {
  background: linear-gradient(180deg, rgba(212,175,55,0.18), rgba(212,175,55,0.08));
  border: 1px solid var(--border-strong);
  border-radius: 14px 14px 4px 14px;
  color: var(--cream);
  max-width: 80%;
}
.ai-time { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.ai-msg-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
/* ── Audio bubble ── */
.audio-bubble {
  display: flex; align-items: center; gap: 10px;
  background: rgba(38,18,6,0.90); border: 1px solid rgba(196,98,42,0.28);
  border-radius: 18px 18px 18px 4px; padding: 10px 14px; min-width: 210px; max-width: 90%;
}
.audio-play-btn {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #C4622A, #7A3010);
  border: none; color: var(--gold-light); cursor: pointer;
  display: grid; place-items: center; transition: transform 0.15s;
}
.audio-play-btn:hover { transform: scale(1.08); }
.audio-playing { background: linear-gradient(135deg, #7A3010, #C4622A); }
.audio-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 24px; }
.audio-bar { width: 3px; border-radius: 2px; background: rgba(196,98,42,0.22); transition: background 0.08s; flex-shrink: 0; }
.audio-bar-on { background: var(--terra); }
.audio-dur { font-family: 'JetBrains Mono',monospace; font-size: 10px; color: var(--muted); white-space: nowrap; min-width: 28px; text-align: right; }
.ai-headline { font-family: 'Noto Serif'; font-size: 13px; color: var(--cream); margin-bottom: 10px; }
.ai-foot { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.4; }
.ai-insight { font-size: 11px; color: var(--gold-light); margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(212,175,55,0.06); border: 1px dashed var(--border-strong); }

.ai-bars { display: flex; flex-direction: column; gap: 8px; }
.ai-bar-row { display: grid; grid-template-columns: 80px 1fr 36px auto; align-items: center; gap: 8px; font-size: 11px; }
.ai-bar-lbl { color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 10px; }
.ai-bar-track { height: 6px; background: rgba(212,175,55,0.08); border-radius: 3px; overflow: hidden; }
.ai-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-light), var(--gold-muted)); border-radius: 3px; }
.ai-bar-val { color: var(--cream); font-weight: 600; text-align: right; font-family: 'JetBrains Mono', monospace; }
.winner .ai-bar-lbl { color: var(--gold-light); }
.winner .ai-bar-fill { background: linear-gradient(90deg, var(--gold-light), var(--gold)); box-shadow: 0 0 12px rgba(212,175,55,0.3); }
.ai-winner-badge { color: var(--gold-light); font-size: 12px; }

.ai-spark { width: 100%; height: 44px; }
.ai-spark-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.ai-kpi-block { text-align: right; }
.ai-kpi-num { font-family: 'Noto Serif'; font-size: 24px; color: var(--cream); line-height: 1; }
.ai-kpi-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.ai-kpi-delta { font-size: 11px; color: var(--success); font-weight: 600; margin-top: 4px; }

.ai-vid-cmp { display: flex; flex-direction: column; gap: 8px; }
.ai-vid-row { display: grid; grid-template-columns: 80px 1fr 36px; align-items: center; gap: 8px; font-size: 11px; }
.ai-vid-lbl { display: inline-flex; align-items: center; gap: 6px; color: var(--cream); font-size: 11px; }
.ai-vid-track { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.ai-vid-fill { height: 100%; border-radius: 3px; }
.ai-vid-val { font-family: 'JetBrains Mono', monospace; color: var(--cream); font-weight: 600; text-align: right; }

.ai-thinking { display: inline-flex; gap: 4px; padding: 14px 16px; }
.ai-thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-muted); animation: pulse 1.4s infinite; }
.ai-thinking span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

.copilot-suggestions { display: flex; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap; }
.cp-chip {
  font-size: 11px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: rgba(28,9,0,0.65); color: var(--muted); cursor: pointer; font-family: inherit;
  transition: all 0.2s;
}
.cp-chip:hover { color: var(--gold-light); border-color: var(--border-strong); background: rgba(212,175,55,0.06); }

.copilot-input {
  display: flex; align-items: center; gap: 6px; padding: 12px 14px 16px;
  border-top: 1px solid var(--border); margin-top: 10px;
}
.copilot-input input {
  flex: 1; background: rgba(17,6,3,0.6); border: 1px solid var(--border); color: var(--cream);
  border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 13px; outline: none;
  transition: border-color 0.2s;
}
.copilot-input input:focus { border-color: var(--border-strong); box-shadow: 0 0 0 2px rgba(212,175,55,0.08); }
.cp-mic, .cp-send {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(17,6,3,0.6); color: var(--gold-muted); cursor: pointer; display: grid; place-items: center;
  transition: all 0.2s;
}
.cp-send { background: linear-gradient(180deg, rgba(212,175,55,0.25), rgba(212,175,55,0.08)); color: var(--gold-light); border-color: var(--border-strong); }
.cp-mic:hover { color: var(--gold-light); border-color: var(--border-strong); }
.cp-send:hover { background: linear-gradient(180deg, rgba(212,175,55,0.4), rgba(212,175,55,0.15)); }

/* ---- mobile FAB & modal ---- */
.fab {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold-muted));
  color: var(--bg-deep); font-size: 22px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(212,175,55,0.4), 0 0 0 1px rgba(212,175,55,0.4);
  display: none;
}
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(14,4,0,0.85); backdrop-filter: blur(8px);
  display: grid; place-items: end center;
}
.modal-sheet {
  width: 100%; max-width: 480px; height: 85vh; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
}
.modal-close { position: absolute; top: 14px; right: 14px; background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 22px; z-index: 10; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .span-7, .span-5, .span-6, .span-4, .span-8 { grid-column: span 12; }
  .utm-body { grid-template-columns: 1fr; }
  .donut { margin: 0 auto; }
}
@media (max-width: 768px) {
  .main { padding: 18px 14px 80px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 30px; }
  .header { gap: 12px; }
  .header-right { width: 100%; justify-content: space-between; }
  .last-update { display: none; }
  .range-btn { padding: 6px 10px; font-size: 11px; }
  .brand-name { font-size: 18px; }
  /* Search bar flexible en tablet */
  .search { width: 100%; min-width: 0; }
  .search-wrap { flex: 1; max-width: 100%; }
  .card-header { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 480px) {
  .main { padding: 14px 10px 80px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 14px 14px; }
  .kpi-value { font-size: 26px; }
  .kpi-label { font-size: 9px; }
  .bento { gap: 8px; }
  .card { padding: 14px; }
  .card-title { font-size: 15px; }
  /* Header compacto */
  .brand-mark { width: 34px; height: 34px; font-size: 16px; }
  .brand-name { font-size: 15px; gap: 8px; }
  .live-badge { font-size: 9px; padding: 2px 7px; }
  .brand-sub { display: none; }
  .range-selector { gap: 0; }
  .range-btn { padding: 5px 8px; font-size: 10px; }
  .user-pill span { display: none; }
  /* UTM donut más pequeño */
  .donut { width: 150px; height: 150px; }
  .utm-body { gap: 10px; }
  /* Tabla de leads scroll horizontal */
  .leads-table-wrap { -webkit-overflow-scrolling: touch; }
  .leads-table th, .leads-table td { padding: 8px 6px; font-size: 11px; }
  /* Funnel */
  .funnel-num { font-size: 16px; }
  .funnel-idx { width: 18px; height: 18px; font-size: 10px; }
  /* Cohort */
  .cohort-row { grid-template-columns: 40px 1fr; }
  /* Pagination compacta */
  .pagination { font-size: 10px; }
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* ═══════════════════ AUTH — Bloque 5 ══════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════ */

.auth-screen {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  width: 100%; max-width: 360px;
  padding: 40px 32px 36px;
  background: linear-gradient(180deg, rgba(22,2,32,0.97), rgba(5,0,10,0.99));
  border: 1px solid rgba(212,175,55,0.22);
  border-radius: 24px;
  box-shadow: 0 0 80px rgba(139,16,64,0.35), 0 28px 80px rgba(0,0,0,0.8);
  animation: overlay-in 0.4s cubic-bezier(.2,.7,.2,1);
}
.auth-logo-wrap {
  margin-bottom: 20px;
  filter: drop-shadow(0 0 24px rgba(212,175,55,0.25));
}
.auth-ring-spin { animation: fab-rotate 80s linear infinite; }
.auth-brand {
  font-family: 'Noto Serif'; font-size: 32px; color: var(--gold-light);
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #F0D060, #D4AF37, #C5A55A);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 6px;
}
.auth-sub {
  font-size: 11px; color: var(--muted); letter-spacing: 0.14em;
  text-transform: uppercase; margin-bottom: 32px;
}
.google-btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 13px 24px; border-radius: 12px; width: 100%; justify-content: center;
  background: #fff; color: #1a1a1a;
  border: none; cursor: pointer;
  font-family: 'Manrope'; font-size: 14px; font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.google-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.google-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.google-btn-loading { background: rgba(255,255,255,0.12); color: var(--muted); border: 1px solid var(--border); }
.auth-note { margin-top: 18px; font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; text-align: center; }

/* Access Denied */
.denied-icon {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--danger);
  display: grid; place-items: center;
  color: var(--danger); font-size: 22px; font-weight: 700;
  background: rgba(229,62,62,0.08);
  box-shadow: 0 0 28px rgba(229,62,62,0.25);
  margin-bottom: 16px;
}
.denied-title { font-family: 'Noto Serif'; font-size: 22px; color: var(--cream); margin-bottom: 10px; }
.denied-email {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--gold-muted); margin-bottom: 12px;
  padding: 6px 12px; border-radius: 6px; background: rgba(212,175,55,0.06);
  border: 1px solid var(--border); word-break: break-all; text-align: center;
}
.denied-msg { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.55; margin-bottom: 28px; }
.denied-btn {
  padding: 12px 24px; border-radius: 10px; width: 100%;
  border: 1px solid var(--border-strong); background: transparent;
  color: var(--gold-light); cursor: pointer;
  font-family: 'Manrope'; font-size: 13px; font-weight: 600;
  transition: all 0.18s;
}
.denied-btn:hover { background: rgba(212,175,55,0.08); }

/* Easter Egg — Primera vez de Michelle */
.easter-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3,0,7,0.95);
}
.easter-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 32px;
  max-width: 480px; padding: 40px 32px; text-align: center;
}
.easter-ring { transition: filter 1.2s ease; filter: brightness(0.6); }
.easter-ring-glow {
  filter: brightness(1) drop-shadow(0 0 40px rgba(212,175,55,0.5));
}
.easter-msg {
  font-family: 'Noto Serif'; font-size: 18px; line-height: 1.7;
  color: var(--cream); opacity: 0; transform: translateY(12px);
  transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}
.easter-btn {
  padding: 14px 36px; border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(212,175,55,0.2), rgba(212,175,55,0.06));
  color: var(--gold-light); cursor: pointer;
  font-family: 'Noto Serif'; font-size: 16px; letter-spacing: 0.04em;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s, background 0.2s;
}
.easter-btn:hover { background: linear-gradient(135deg, rgba(212,175,55,0.32), rgba(212,175,55,0.12)); }
.easter-show { opacity: 1 !important; transform: translateY(0) !important; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* ══════════════ FAB CONSTELACIÓN + OVERLAY — Bloque 4 ══════════════════ */
/* ═══════════════════════════════════════════════════════════════════════ */

/* ── FAB flotante ── */
.aura-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 200;
  width: 70px; height: 70px; border-radius: 50%; padding: 0; cursor: pointer;
  background: radial-gradient(circle at 38% 38%, #3d0e1e 0%, #1a0410 55%, #05000A 100%);
  border: 1.5px solid rgba(212,175,55,0.45);
  box-shadow:
    0 0 0 1px rgba(212,175,55,0.12),
    0 0 32px rgba(139,16,64,0.65),
    0 0 64px rgba(139,16,64,0.28),
    0 10px 36px rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s cubic-bezier(.2,.7,.2,1), box-shadow 0.2s;
  animation: fab-breathe 3.5s ease-in-out infinite;
}
.aura-fab:hover {
  transform: scale(1.1);
  box-shadow:
    0 0 0 2px rgba(212,175,55,0.32),
    0 0 44px rgba(139,16,64,0.85),
    0 0 90px rgba(139,16,64,0.40),
    0 0 26px rgba(212,175,55,0.18),
    0 14px 44px rgba(0,0,0,0.72);
}
@keyframes fab-breathe {
  0%, 100% {
    box-shadow: 0 0 0 1px rgba(212,175,55,0.12), 0 0 32px rgba(139,16,64,0.65), 0 0 64px rgba(139,16,64,0.28), 0 10px 36px rgba(0,0,0,0.65);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(212,175,55,0.28), 0 0 44px rgba(139,16,64,0.85), 0 0 90px rgba(139,16,64,0.42), 0 0 22px rgba(212,175,55,0.14), 0 10px 36px rgba(0,0,0,0.65);
  }
}
.aura-fab-ring {
  width: 52px; height: 52px;
  animation: fab-rotate 80s linear infinite;
}
@keyframes fab-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Overlay backdrop ── */
.aura-overlay-backdrop {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(5,0,10,0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 20px 24px;
  transition: opacity 0.22s, visibility 0.22s;
}
.aura-overlay-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ── Overlay panel ── */
.aura-overlay-panel {
  width: 100%; max-width: 460px;
  height: 80vh; max-height: 720px;
  background: linear-gradient(180deg, rgba(22,2,32,0.98), rgba(5,0,10,0.99));
  border: 1px solid rgba(212,175,55,0.22);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(139,16,64,0.18),
    0 0 70px rgba(139,16,64,0.32),
    0 28px 90px rgba(0,0,0,0.85);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: overlay-in 0.26s cubic-bezier(.2,.7,.2,1);
}
@keyframes overlay-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Forzar layout correcto del copilot dentro del overlay (anula reglas mobile fixed) */
.aura-overlay-panel .copilot        { height: 100%; overflow: hidden; }
.aura-overlay-panel .copilot-feed   { padding: 14px !important; }
.aura-overlay-panel .copilot-input  {
  position: relative !important; bottom: auto !important;
  left: auto !important; right: auto !important;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  background: linear-gradient(180deg, rgba(10,2,16,0.7), rgba(5,0,10,0.97)) !important;
}
.aura-overlay-panel .copilot-suggestions {
  position: relative !important; bottom: auto !important;
  left: auto !important; right: auto !important;
  background: transparent !important;
}

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}

/* Card entrance — KPIs */
.kpi-card { animation: fadeInUp 0.4s ease-out both; }
.kpi-row .kpi-card:nth-child(1) { animation-delay: 0.02s; }
.kpi-row .kpi-card:nth-child(2) { animation-delay: 0.07s; }
.kpi-row .kpi-card:nth-child(3) { animation-delay: 0.12s; }
.kpi-row .kpi-card:nth-child(4) { animation-delay: 0.17s; }

/* Card entrance — bento */
.card { animation: fadeInUp 0.45s ease-out both; }
.bento > *:nth-child(1) .card  { animation-delay: 0.10s; }
.bento > *:nth-child(2) .card  { animation-delay: 0.15s; }
.bento > *:nth-child(3) .card  { animation-delay: 0.20s; }
.bento > *:nth-child(4) .card  { animation-delay: 0.25s; }
.bento > *:nth-child(5) .card  { animation-delay: 0.30s; }
.bento > *:nth-child(6) .card  { animation-delay: 0.35s; }
.bento > *:nth-child(7) .card  { animation-delay: 0.40s; }

/* New message slide-in */
.ai-msg-enter { animation: msgSlide 0.2s ease-out both; }

/* ─── Aura markdown text ─────────────────────────────────────────────────── */
.ai-text {
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--cream);
}
.ai-markdown {
  display: flex; flex-direction: column; gap: 3px;
  line-height: 1.58; color: var(--cream); font-size: 13px;
}
.ai-markdown .ai-line  { line-height: 1.58; }
.ai-markdown .ai-spacer { height: 6px; }
.ai-markdown .ai-list  { display: flex; flex-direction: column; gap: 4px; margin: 2px 0; }
.ai-markdown .ai-bullet {
  display: flex; align-items: flex-start; gap: 7px;
  padding-left: 2px; line-height: 1.5;
}
.ai-markdown .ai-bullet-dot {
  color: var(--gold-muted); font-size: 12px; flex-shrink: 0; margin-top: 1px;
}
.ai-markdown .ai-bold {
  color: var(--gold-light); font-weight: 600;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; gap: 10px; text-align: center;
}
.empty-icon {
  font-size: 28px; color: var(--gold-muted); opacity: 0.5;
  animation: blink 2.5s infinite;
}
.empty-title { font-family: 'Noto Serif'; font-size: 16px; color: var(--cream); }
.empty-sub   { font-size: 12px; color: var(--muted); max-width: 280px; line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* ═══════════════════ MOBILE PWA — Bloque 3 ════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════ */

/* Helpers desktop/mobile (defaults para desktop) */
.mobile-only  { display: none; }
.desktop-only { display: block; }

/* Bottom Nav: invisible en desktop */
.bottom-nav { display: none; }

/* FAB: invisible (Aura ahora vive en su propio tab/sidebar) */
.fab, .modal-backdrop { display: none; }

/* ─────────── TABLET (769–1024px) — pequeños ajustes ─────────── */
@media (max-width: 1024px) {
  .span-7, .span-5, .span-6, .span-4, .span-8 { grid-column: span 12; }
  .utm-body { grid-template-columns: 180px 1fr; }
}

/* ════════════ MOBILE (≤768px) — transformación completa ════════════ */
@media (max-width: 768px) {
  /* Toggles globales */
  .mobile-only  { display: block; }
  .desktop-only { display: none; }

  body { font-size: 14px; }

  /* Layout: una sola columna, sin sidebar lateral */
  .app {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }
  .main {
    padding: 14px 14px calc(80px + env(safe-area-inset-bottom)) 14px;
  }

  /* ────── Header compacto en mobile ────── */
  .header {
    margin-bottom: 12px;
    gap: 12px;
    padding-top: env(safe-area-inset-top, 0);
  }
  .header-left { gap: 10px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 18px; }
  .brand-analytics { font-size: 10px; letter-spacing: 0.10em; }
  .brand-sub { font-size: 9px; }
  /* Range selector y user pill se ocultan del header en mobile */
  .header-right .range-selector,
  .header-right .last-update,
  .header-right .user-pill { display: none; }
  .header-right { gap: 8px; }
  .live-badge { padding: 2px 7px; font-size: 9px; }

  /* Range selector que aparece dentro del Dashboard tab */
  .m-range-bar {
    display: flex; gap: 6px; padding: 4px;
    border: 1px solid var(--border); border-radius: 12px;
    background: rgba(20,0,30,0.6); backdrop-filter: blur(10px);
    margin-bottom: 14px;
  }
  .m-range-bar .range-btn {
    flex: 1; padding: 10px 8px; font-size: 12px;
    border: 0; background: transparent; color: var(--muted);
    border-radius: 8px; cursor: pointer; font-weight: 600;
  }
  .m-range-bar .range-btn.active {
    background: linear-gradient(180deg, rgba(139,16,64,0.55), rgba(139,16,64,0.22));
    color: var(--gold-light);
    box-shadow: inset 0 0 0 1px var(--border-strong);
  }

  /* ────── Sistema de bloques navegables por tab ────── */
  .block-dashboard, .block-landings, .block-leads { display: none; }
  .block-aura { display: none; }

  .app[data-mtab="dashboard"] .block-dashboard { display: block; }
  .app[data-mtab="landings"]  .block-landings  { display: block; }
  .app[data-mtab="leads"]     .block-leads     { display: block; }
  .app[data-mtab="aura"]      .block-aura      { display: flex; }

  /* Sidebar (Aura) en mobile = pantalla completa cuando tab activo */
  .sidebar {
    position: fixed !important;
    inset: 0;
    width: 100%; height: 100dvh;
    border-left: none;
    z-index: 40;
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  /* ────── Bento → 1 columna, espaciado más compacto ────── */
  .bento { gap: 10px; }
  .span-7, .span-5, .span-6, .span-4, .span-8, .span-12 { grid-column: span 12; }
  .card { padding: 14px; border-radius: 12px; }
  .card-title { font-size: 15px; }
  .card-sub { font-size: 10px; }
  .card-header { margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }

  /* ────── KPI Row → grid 2×2 con números grandes ────── */
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .kpi-card { padding: 14px 14px; }
  .kpi-label { font-size: 9px; letter-spacing: 0.10em; }
  .kpi-value { font-size: 32px; }
  .kpi-sub { font-size: 11px; }
  .kpi-tip { display: none; } /* hover tip no aplica en touch */

  /* ────── Landing Tabs → scroll horizontal cómodo ────── */
  .landing-tabs {
    margin-bottom: 12px; padding: 4px;
    border-radius: 10px;
  }
  .landing-tab {
    padding: 8px 12px;
    min-height: 44px;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
  }
  .landing-tab-name { font-size: 11px; }
  .landing-tab-sub { font-size: 8px; }

  .landing-banner {
    padding: 8px 10px; gap: 8px;
    font-size: 11px;
  }
  .landing-banner-sub { display: none; }
  .landing-banner-clear {
    margin-left: auto; padding: 6px 10px; font-size: 10px;
    min-height: 36px;
  }

  /* ────── Charts: alturas reducidas ────── */
  .chart { height: 180px; }
  .legend { font-size: 10px; gap: 12px; flex-wrap: wrap; }

  /* ────── UTM Distribution: sin donut, lista vertical ────── */
  .utm-body {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .donut { display: none; }
  .utm-table th { font-size: 9px; padding: 6px 6px 6px; }
  .utm-table td { padding: 8px 6px; font-size: 11px; }
  .utm-table td:first-child { font-size: 11px; }

  /* ────── Funnel: barras compactas ────── */
  .funnel-stage { padding: 8px 10px; }
  .funnel-num { font-size: 16px; }
  .funnel-label { font-size: 12px; }

  /* ────── Video Distribution: 2×2 ────── */
  .hist {
    grid-template-columns: 1fr 1fr;
    height: auto;
    gap: 14px;
  }
  .hist-col { height: 110px; }
  .video-avg-num { font-size: 24px; }

  /* ────── Cohort + Meta: tipografía más compacta ────── */
  .cohort-row { grid-template-columns: 44px 1fr; gap: 8px; }
  .cohort-lbl { font-size: 11px; }
  .meta-rings { grid-template-columns: 1fr; gap: 10px; }
  .ring { width: 56px; height: 56px; }

  /* ────── Filtros de leads: chips scrolleables ────── */
  .stage-filters {
    flex-wrap: nowrap; overflow-x: auto;
    margin: 0 -14px 14px -14px;
    padding: 0 14px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .stage-filters::-webkit-scrollbar { display: none; }
  .stage-filter { flex-shrink: 0; min-height: 38px; padding: 7px 12px; font-size: 12px; }

  .search-wrap { width: 100%; min-height: 42px; }
  .search { width: 100%; font-size: 16px; /* prevents iOS zoom */ }

  /* ────── Tabla de leads → cards ────── */
  .lead-cards { display: flex; flex-direction: column; gap: 10px; }
  .lead-card {
    padding: 12px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(20,0,30,0.50), rgba(8,0,14,0.55));
  }
  .lc-card-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 6px 0;
  }
  .lc-card-head { padding-bottom: 8px; border-bottom: 1px dashed rgba(212,175,55,0.10); }
  .lc-card-foot {
    padding-top: 8px; border-top: 1px dashed rgba(212,175,55,0.10);
  }
  .lc-card-meta {
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed rgba(212,175,55,0.10);
    font-size: 10px; color: var(--muted);
    text-align: right;
  }
  .pagination { font-size: 11px; padding: 8px 0; }
  .pager button { width: 36px; height: 36px; font-size: 16px; }

  /* ────── BLOQUE LANDINGS (mobile only) ────── */
  .m-landings { display: flex; flex-direction: column; gap: 0; }
  .m-landing-cards {
    display: flex; gap: 10px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: 0 -8px; padding: 4px 8px 8px;
    scrollbar-width: none;
  }
  .m-landing-cards::-webkit-scrollbar { display: none; }
  .m-landing-card {
    flex-shrink: 0;
    min-width: 130px; max-width: 170px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(20,0,30,0.55), rgba(8,0,14,0.65));
    color: var(--cream);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; flex-direction: column; gap: 2px;
  }
  .m-landing-card.active {
    border-color: var(--lc-color, var(--gold));
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--lc-color, var(--gold)) 25%, transparent),
      color-mix(in srgb, var(--lc-color, var(--gold)) 8%, transparent));
    box-shadow: 0 0 18px color-mix(in srgb, var(--lc-color, var(--gold)) 35%, transparent);
  }
  .m-lc-dot {
    width: 10px; height: 10px; border-radius: 50%;
    box-shadow: 0 0 10px currentColor; margin-bottom: 4px;
  }
  .m-lc-name { font-family: 'Noto Serif'; font-size: 14px; color: var(--cream); }
  .m-lc-leads { font-family: 'Noto Serif'; font-size: 26px; color: var(--gold-light); margin-top: 4px; }
  .m-lc-leads-lbl { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
  .m-lc-rate { font-size: 10px; color: var(--gold-muted); margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(212,175,55,0.15); }

  /* Mini KPIs de landing seleccionada */
  .m-mini-kpis {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  }
  .m-mk-item {
    padding: 12px; border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(15,0,22,0.45);
  }
  .m-mk-label { font-size: 10px; color: var(--muted); letter-spacing: 0.10em; text-transform: uppercase; font-weight: 600; }
  .m-mk-value { font-family: 'Noto Serif'; font-size: 26px; color: var(--gold-light); margin-top: 4px; }

  .m-toggle-btn {
    padding: 7px 12px; border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: rgba(212,175,55,0.08); color: var(--gold-light);
    font-family: 'Manrope'; font-size: 11px; font-weight: 600; cursor: pointer;
    min-height: 38px;
  }

  .m-compare-list { display: flex; flex-direction: column; gap: 10px; }
  .m-compare-row {
    width: 100%; text-align: left; cursor: pointer;
    padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 10px;
    background: rgba(15,0,22,0.40); color: var(--cream);
    display: flex; flex-direction: column; gap: 6px;
  }
  .m-cr-head { display: flex; align-items: center; gap: 8px; }
  .m-cr-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
  .m-cr-name { font-size: 13px; font-weight: 600; flex: 1; }
  .m-cr-leads { font-family: 'Noto Serif'; font-size: 16px; color: var(--gold-light); }
  .m-cr-bar-wrap { height: 6px; background: rgba(212,175,55,0.06); border-radius: 3px; overflow: hidden; }
  .m-cr-bar { height: 100%; border-radius: 3px; transition: width 0.5s; }
  .m-cr-stats { display: flex; gap: 6px; font-size: 10px; color: var(--muted); flex-wrap: wrap; }

  /* ────── BLOQUE AURA fullscreen ────── */
  .copilot { height: 100dvh; }
  .copilot-feed {
    padding: 14px 14px calc(80px + env(safe-area-inset-bottom)) 14px;
  }
  .copilot-input {
    position: fixed; bottom: calc(70px + env(safe-area-inset-bottom));
    left: 0; right: 0; padding: 10px 14px;
    background: linear-gradient(180deg, rgba(8,2,12,0.6), rgba(5,0,10,0.95));
    border-top: 1px solid var(--border);
    z-index: 41;
  }
  .copilot-input input { font-size: 16px; min-height: 44px; }
  .cp-send { min-width: 44px; min-height: 44px; }
  .copilot-suggestions {
    position: fixed; bottom: calc(130px + env(safe-area-inset-bottom));
    left: 0; right: 0; padding: 8px 14px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: linear-gradient(180deg, transparent, rgba(5,0,10,0.7));
    z-index: 41;
  }
  .copilot-suggestions::-webkit-scrollbar { display: none; }
  .cp-chip { flex-shrink: 0; white-space: nowrap; min-height: 36px; }
  .ai-msg { max-width: 100%; }
  .audio-bubble { max-width: 100%; }

  /* ────── FAB mobile — encima del bottom nav ────── */
  .aura-fab {
    bottom: calc(70px + env(safe-area-inset-bottom) + 14px);
    right: 16px;
    width: 58px; height: 58px;
  }
  .aura-fab-ring { width: 42px; height: 42px; }

  /* ────── Overlay mobile — hoja desde abajo ────── */
  .aura-overlay-backdrop {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
  }
  .aura-overlay-panel {
    width: 100%; max-width: none;
    height: 92dvh; max-height: none;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  /* ────── BOTTOM NAV ────── */
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom)) 4px;
    background: linear-gradient(180deg, rgba(15,0,22,0.92), rgba(5,0,10,0.98));
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    z-index: 50;
    justify-content: space-around;
  }
  .bn-tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 6px;
    background: transparent; border: 0;
    color: var(--muted); cursor: pointer;
    font-family: 'Manrope'; font-size: 10px; font-weight: 600;
    min-height: 52px;
    border-radius: 10px;
    transition: color 0.15s;
    position: relative;
  }
  .bn-tab.active {
    color: var(--gold-light);
  }
  .bn-tab.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 28px; height: 3px; border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    box-shadow: 0 2px 12px rgba(212,175,55,0.5);
  }
  .bn-icon { display: flex; align-items: center; justify-content: center; height: 22px; }
  .bn-label { font-size: 10px; letter-spacing: 0.04em; }

  /* ────── Touch targets mínimos ────── */
  button, .range-btn, .stage-filter, .landing-tab, .pager button { min-height: 38px; }

  /* Inputs no zoom en iOS */
  input, textarea, select { font-size: 16px; }

  /* Particles más sutiles en mobile */
  .bg-particles { opacity: 0.3; }

  /* ────── Comparativa de landings desktop oculta en mobile dashboard ────── */
  /* (ya se oculta con .desktop-only) */
}

/* ────── Pantallas extra pequeñas (iPhone SE 375px) ────── */
@media (max-width: 380px) {
  .main { padding: 12px 10px calc(80px + env(safe-area-inset-bottom)) 10px; }
  .kpi-value { font-size: 28px; }
  .brand-name { font-size: 16px; }
  .m-landing-card { min-width: 120px; }
  .lead-card { padding: 10px; }
}

/* ────── Reduce motion ────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .bg-particles { display: none; }
}
