/* ============================================================
   Culligan Biofy · Plataforma Inteligente de Análisis Comercial
   ------------------------------------------------------------
   Hoja de estilos principal.
   Tema oscuro tecnológico: superficies navy profundas, acentos
   azul/cian, tarjetas con sombras marcadas y bordes sutiles.
   ============================================================ */

/* ------------------------------------------------------------
   1 · VARIABLES DE DISEÑO (design tokens)
   ------------------------------------------------------------ */
:root {
  /* Paleta corporativa */
  --navy-900: #081426;      /* azul más oscuro (fondos hero) */
  --navy-800: #0B1F3A;      /* sidebar / superficies fuertes */
  --navy-700: #12305C;
  --blue-600: #2563EB;      /* azul principal (Biofy) */
  --blue-500: #3B82F6;
  --sky-500:  #0EA5E9;      /* azul claro (Aquasimply) */
  --sky-400:  #38BDF8;
  --green-500:#10B981;      /* indicadores positivos */
  --red-500:  #EF4444;      /* indicadores negativos (uso mínimo) */

  /* Neutros — tema oscuro */
  --bg:       #0A1220;      /* fondo general de la app */
  --surface:  #111B2E;      /* tarjetas */
  --surface-2:#0D1626;      /* superficies algo más oscuras (filas hover, insets) */
  --border:   #223049;
  --text-1:   #F1F5F9;      /* titulares */
  --text-2:   #94A3B8;      /* texto secundario */
  --text-3:   #64748B;      /* texto terciario / etiquetas */

  /* Gradientes reutilizables */
  --grad-blue: linear-gradient(135deg, #2563EB 0%, #38BDF8 100%);
  --grad-navy: linear-gradient(160deg, #0B1F3A 0%, #12305C 60%, #14488F 100%);

  /* Sombras marcadas (elevación sobre fondo oscuro) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .22);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .38), 0 1px 3px rgba(0, 0, 0, .25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);

  /* Radios y transiciones */
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .8, .32, 1);
}

/* ------------------------------------------------------------
   2 · RESET Y BASE
   ------------------------------------------------------------ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  /* Los orbes decorativos de .welcome (position:fixed) se salen a propósito
     del viewport para el efecto de brillo difuminado; sin esto, provocan
     scroll horizontal en TODO el documento (los fixed no quedan contenidos
     por el overflow de <body>, solo por el de <html>). */
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
canvas { max-width: 100%; }

/* Utilidad para ocultar bloques */
.is-hidden { display: none !important; }

/* ------------------------------------------------------------
   2b · LANDING Y ACCESO APP SMART
   ------------------------------------------------------------ */
.login {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: #071427;
  color: #F7FBFF;
  transition: opacity .5s var(--ease), visibility .5s;
}
.login.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.login-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.login-bg .bg-particles { opacity: .65; }

.landing-nav, .landing-main, .landing-footer { position: relative; z-index: 1; }
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  width: min(100% - 48px, 1240px);
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.landing-nav::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: rgba(5, 18, 35, .72);
  border-bottom: 1px solid rgba(154, 220, 248, .14);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transition: opacity .28s var(--ease);
}
.landing-nav.is-scrolled::before { opacity: 1; }
.landing-brand { display: inline-flex; align-items: center; }
.landing-brand img { display: block; width: 164px; height: auto; }
.landing-nav-links { display: flex; align-items: center; gap: 30px; margin-left: auto; }
.landing-nav-links a, .landing-login-link {
  color: rgba(241,245,249,.68);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.landing-nav-links a:hover, .landing-login-link:hover { color: #fff; }
.landing-login-link { display: inline-flex; align-items: center; gap: 8px; color: #fff; padding: 10px 14px; border-radius: 9px; border: 1px solid rgba(186,230,253,.23); }
.landing-login-link:hover { border-color: rgba(125,211,252,.72); background: rgba(255,255,255,.06); transform: translateY(-1px); }

.landing-main { width: min(100% - 48px, 1240px); margin: 0 auto; }
.landing-hero { min-height: 675px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(510px, 1.1fr); align-items: center; gap: clamp(42px, 7vw, 100px); padding: 76px 0 86px; }
.hero-copy { animation: landingReveal .75s var(--ease) both; }
.landing-eyebrow, .section-kicker { display: inline-flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #76DFFF; }
.eyebrow-pulse { width: 8px; height: 8px; border-radius: 50%; background: #28D8A7; box-shadow: 0 0 0 0 rgba(40,216,167,.55); animation: landingPulse 2s ease-out infinite; }
.hero-copy h1 { max-width: 670px; margin-top: 19px; font-size: clamp(42px, 5vw, 70px); line-height: 1.02; letter-spacing: -2.8px; font-weight: 800; }
.hero-copy h1 span { background: linear-gradient(100deg, #78E5FF 0%, #4AA3FF 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { max-width: 590px; margin-top: 24px; color: rgba(226,239,255,.72); font-size: 17px; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; margin-top: 34px; }
.landing-primary { display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-height: 50px; padding: 0 21px; border-radius: 11px; background: linear-gradient(115deg, #2D69F5 0%, #36C8F2 100%); color: #fff; font-size: 14px; font-weight: 750; box-shadow: 0 15px 30px rgba(37,99,235,.3); transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.landing-primary:hover { transform: translateY(-3px); box-shadow: 0 22px 36px rgba(37,99,235,.43); }
.landing-primary i { transition: transform .22s var(--ease); }
.landing-primary:hover i { transform: translateX(4px); }
.landing-secondary { display: inline-flex; align-items: center; gap: 8px; color: #C6E9FF; font-size: 14px; font-weight: 650; text-decoration: none; }
.landing-secondary i { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid rgba(186,230,253,.33); border-radius: 50%; font-size: 8px; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 34px; color: rgba(226,239,255,.58); font-size: 11.5px; font-weight: 600; }
.hero-trust span { display: inline-flex; align-items: center; gap: 7px; }
.hero-trust i { color: #44DBB1; }

.hero-visual { position: relative; min-height: 470px; display: flex; align-items: center; justify-content: center; animation: landingReveal .85s .12s var(--ease) both; }
.visual-glow { position: absolute; inset: 9% 7%; border-radius: 50%; background: radial-gradient(circle, rgba(33,105,245,.34), transparent 67%); filter: blur(24px); animation: glowBreath 5s ease-in-out infinite; }
.dashboard-preview { position: relative; z-index: 1; width: min(100%, 650px); padding: 10px; overflow: hidden; border: 1px solid rgba(186,230,253,.25); border-radius: 19px; background: linear-gradient(135deg, rgba(18,42,75,.95), rgba(9,22,43,.93)); box-shadow: 0 32px 70px rgba(0,0,0,.4); transform: perspective(1400px) rotateY(-5deg) rotateX(3deg); animation: dashboardFloat 7s ease-in-out infinite; }
.preview-topbar { height: 44px; display: flex; align-items: center; gap: 14px; padding: 0 9px 9px; border-bottom: 1px solid rgba(186,230,253,.1); }
.preview-app { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 750; letter-spacing: -.3px; }
.preview-mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--grad-blue); color: #071A34; font-size: 12px; font-weight: 900; }
.preview-live { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: #A7BED8; font-size: 9px; font-weight: 600; }
.preview-live span { width: 6px; height: 6px; background: #29D4A6; border-radius: 50%; box-shadow: 0 0 8px #29D4A6; animation: liveBlink 1.5s infinite; }
.preview-avatar { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: #2859A2; color: #D9E8FB; font-size: 8px; font-weight: 700; }
.preview-layout { display: grid; grid-template-columns: 43px 1fr; min-height: 336px; }
.preview-sidebar { display: flex; flex-direction: column; align-items: center; gap: 17px; padding-top: 20px; border-right: 1px solid rgba(186,230,253,.09); }
.preview-sidebar span { display: block; width: 16px; height: 4px; border-radius: 6px; background: rgba(186,230,253,.22); }
.preview-sidebar .side-active { width: 21px; background: #42C7F3; box-shadow: 0 0 10px rgba(66,199,243,.65); }
.preview-content { padding: 18px 18px 13px; }
.preview-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.preview-title-row strong { display: block; font-size: 13px; }
.preview-title-row small { display: block; margin-top: 3px; color: #8399B8; font-size: 8px; }
.preview-filter { padding: 6px 7px; border: 1px solid rgba(186,230,253,.12); border-radius: 6px; color: #A8BCD6; font-size: 7px; }
.preview-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 15px; }
.preview-kpis > div, .preview-chart-card, .preview-insight { border: 1px solid rgba(186,230,253,.09); border-radius: 9px; background: rgba(255,255,255,.035); }
.preview-kpis > div { padding: 9px; }
.preview-kpis small { display: block; color: #90A5C0; font-size: 7px; }
.preview-kpis strong { display: block; margin-top: 4px; font-size: 13px; letter-spacing: -.4px; }
.preview-kpis em { display: block; margin-top: 3px; color: #36D6A9; font-size: 7px; font-style: normal; font-weight: 700; }
.preview-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 8px; margin-top: 9px; }
.preview-chart-card { min-height: 139px; padding: 10px; }
.preview-card-head { display: flex; align-items: center; justify-content: space-between; color: #E5F0FC; font-size: 8px; }
.preview-card-head span { color: #86A1C3; font-size: 7px; }
.preview-chart { position: relative; height: 91px; display: flex; align-items: flex-end; gap: 8px; padding: 12px 3px 4px; border-bottom: 1px solid rgba(186,230,253,.11); overflow: hidden; }
.preview-chart i { width: 11%; height: var(--h); border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, #2E86F5, #194783); transform-origin: bottom; animation: chartGrow .9s var(--ease) both; }
.preview-chart i:nth-child(2) { animation-delay: .07s; }.preview-chart i:nth-child(3) { animation-delay: .14s; }.preview-chart i:nth-child(4) { animation-delay: .21s; }.preview-chart i:nth-child(5) { animation-delay: .28s; }.preview-chart i:nth-child(6) { animation-delay: .35s; }
.preview-chart b { position: absolute; left: 3px; right: 3px; bottom: 34px; height: 1px; border-top: 2px solid #3FD5AE; transform: rotate(-8deg); box-shadow: 0 0 8px rgba(63,213,174,.7); }
.preview-insight { display: flex; flex-direction: column; justify-content: center; padding: 11px; }
.preview-insight span { color: #58CDF3; font-size: 7px; font-weight: 700; }.preview-insight strong { margin-top: 7px; font-size: 9px; line-height: 1.4; }.preview-insight small { margin-top: 6px; color: #8299B8; font-size: 7px; line-height: 1.35; }
.preview-pipeline { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: #9DB2CD; font-size: 7px; }.preview-pipeline > div { display: flex; flex: 1; height: 6px; gap: 3px; }.preview-pipeline i { flex: 1; border-radius: 5px; background: #245B9E; }.preview-pipeline i:nth-child(2) { background: #2778C0; }.preview-pipeline i:nth-child(3) { background: #2B9BD7; }.preview-pipeline i:nth-child(4) { background: #35D2A8; }.preview-pipeline strong { color: #D4E5F7; font-size: 7px; }
.floating-signal { position: absolute; z-index: 2; display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid rgba(186,230,253,.21); border-radius: 10px; background: rgba(10,28,53,.84); box-shadow: 0 15px 35px rgba(0,0,0,.3); backdrop-filter: blur(10px); animation: signalFloat 5s ease-in-out infinite; }.floating-signal i { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: rgba(32,132,246,.18); color: #64D9FA; font-size: 12px; }.floating-signal small, .floating-signal strong { display: block; }.floating-signal small { color: #8EA6C3; font-size: 8px; }.floating-signal strong { margin-top: 2px; font-size: 10px; }.signal-one { top: 9%; right: -3%; }.signal-two { bottom: 6%; left: -6%; animation-delay: -2.3s; }

.landing-proofbar { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 20px 0; border-top: 1px solid rgba(186,230,253,.1); border-bottom: 1px solid rgba(186,230,253,.1); color: #8EA5C2; font-size: 11px; font-weight: 650; }.landing-proofbar > div { display: flex; flex-wrap: wrap; gap: 22px; }.landing-proofbar b { display: inline-flex; align-items: center; gap: 7px; color: #C2D5E9; font-size: 11px; }.landing-proofbar i { color: #68DDF7; font-size: 14px; }
.landing-section { padding: 130px 0; }.section-intro { max-width: 655px; }.section-intro h2, .results-copy h2, .landing-cta h2 { margin-top: 16px; font-size: clamp(31px, 4vw, 48px); line-height: 1.1; letter-spacing: -1.6px; }.section-intro > p { margin-top: 17px; color: #99AEC9; font-size: 16px; line-height: 1.7; }.section-intro.compact { max-width: 590px; }
.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-top: 42px; }.value-card { position: relative; min-height: 286px; overflow: hidden; padding: 27px; border: 1px solid rgba(186,230,253,.12); border-radius: 16px; background: rgba(15,35,63,.54); transition: transform .25s var(--ease), border-color .25s, background .25s; }.value-card:hover { transform: translateY(-6px); border-color: rgba(100,217,250,.36); background: rgba(18,44,79,.75); }.value-card.featured { background: linear-gradient(145deg, rgba(28,82,160,.68), rgba(14,39,72,.75)); }.value-number { position: absolute; top: 22px; right: 24px; color: rgba(163,204,243,.22); font-size: 27px; font-weight: 800; }.value-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(59,153,246,.16); color: #70DEFA; font-size: 17px; }.value-card h3 { margin-top: 46px; font-size: 19px; letter-spacing: -.4px; }.value-card p { max-width: 280px; margin-top: 10px; color: #94AAC5; font-size: 13.5px; line-height: 1.65; }.value-card a { position: absolute; bottom: 27px; color: #7EE5FF; font-size: 12px; font-weight: 700; text-decoration: none; }.value-card a i { margin-left: 5px; transition: transform .2s; }.value-card a:hover i { transform: translateX(4px); }
.results-section { padding-top: 20px; }.results-panel { display: grid; grid-template-columns: 1fr .75fr; gap: 50px; align-items: center; overflow: hidden; padding: clamp(34px, 5vw, 68px); border: 1px solid rgba(110,211,247,.19); border-radius: 24px; background: linear-gradient(135deg, #103565 0%, #0B2342 56%, #071A32 100%); }.results-copy p { margin-top: 18px; color: #AAC2DA; font-size: 15px; line-height: 1.7; }.results-copy ul { display: grid; gap: 12px; margin-top: 27px; list-style: none; color: #D2E2F2; font-size: 13px; }.results-copy li { display: flex; gap: 10px; align-items: flex-start; }.results-copy li i { margin-top: 3px; color: #48D7B2; }.results-metrics { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 290px; align-items: center; }.metric-orbit { position: absolute; inset: 11% 6%; border: 1px solid rgba(112,224,255,.22); border-radius: 50%; animation: orbitSpin 16s linear infinite; }.metric-orbit::after { content: ''; position: absolute; top: 10%; left: 10%; width: 7px; height: 7px; border-radius: 50%; background: #6CE4FF; box-shadow: 0 0 15px #6CE4FF; }.result-metric { position: relative; z-index: 1; min-height: 105px; padding: 18px; border: 1px solid rgba(186,230,253,.18); border-radius: 14px; background: rgba(6,22,43,.38); backdrop-filter: blur(8px); }.result-metric.main { grid-column: span 2; min-height: 132px; text-align: center; }.result-metric small, .result-metric span { display: block; color: #9BB3CF; font-size: 10px; }.result-metric strong { display: block; margin: 5px 0 4px; font-size: 17px; }.result-metric.main strong { font-size: 45px; line-height: 1; color: #77E2FF; letter-spacing: -2px; }.result-metric i { color: #72DFFF; }
.integration-section { padding-top: 24px; }.integration-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 36px; }.integration-list > div { padding: 20px; border: 1px solid rgba(186,230,253,.1); border-radius: 12px; background: rgba(255,255,255,.025); }.integration-list i { color: #6BDCF9; font-size: 20px; }.integration-list span { display: block; margin-top: 15px; font-size: 13px; font-weight: 700; }.integration-list small { display: block; margin-top: 5px; color: #8BA3C0; font-size: 10px; line-height: 1.5; }
.landing-cta { display: flex; align-items: center; justify-content: space-between; gap: 32px; margin: 0 0 72px; padding: clamp(32px, 5vw, 60px); overflow: hidden; border-radius: 20px; background: linear-gradient(110deg, #2B67F0, #1394DE 60%, #25C8EE); box-shadow: 0 20px 55px rgba(27,108,216,.3); }.landing-cta .section-kicker { color: rgba(234,249,255,.77); }.landing-cta h2 { margin-top: 11px; }.landing-cta p { margin-top: 12px; color: rgba(235,249,255,.8); }.landing-primary.light { flex-shrink: 0; background: #fff; color: #1250A6; box-shadow: 0 12px 28px rgba(6,44,105,.25); }.landing-primary.light:hover { box-shadow: 0 17px 32px rgba(6,44,105,.32); }
.landing-footer { width: min(100% - 48px, 1240px); display: flex; align-items: center; gap: 24px; margin: 0 auto; padding: 24px 0 34px; border-top: 1px solid rgba(186,230,253,.1); color: #7187A4; font-size: 11px; }.landing-footer img { width: 110px; height: auto; }.landing-footer span:last-child { margin-left: auto; }

.access-modal { position: fixed; z-index: 6; inset: 0; display: grid; place-items: center; padding: 24px; }.access-backdrop { position: absolute; inset: 0; background: rgba(1,9,20,.68); backdrop-filter: blur(9px); }.login-card { position: relative; z-index: 1; width: min(100%, 430px); padding: 38px 36px 28px; border: 1px solid rgba(186,230,253,.2); border-radius: 22px; background: linear-gradient(155deg, rgba(15,43,79,.97), rgba(8,22,43,.98)); box-shadow: 0 30px 80px rgba(0,0,0,.52); color: #fff; animation: modalIn .35s var(--ease) both; }.access-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: rgba(218,239,255,.7); }.access-close:hover { color: #fff; background: rgba(255,255,255,.08); }.login-card-head { margin-bottom: 30px; }.login-lock { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--sky-400); background: rgba(14,165,233,.14); }.login-eyebrow { margin-top: 21px; color: #bde9ff; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }.login-title { font-size: 28px; font-weight: 700; letter-spacing: -.7px; margin-top: 5px; }.login-sub { font-size: 14px; color: rgba(255,255,255,.62); margin-top: 7px; }.login-form { display: flex; flex-direction: column; gap: 18px; }.login-field { display: flex; flex-direction: column; gap: 7px; }.login-field > span { font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.75); }.login-input-wrap { position: relative; }.login-input-wrap > i:not(.fa-eye):not(.fa-eye-slash) { position: absolute; top: 50%; left: 15px; transform: translateY(-50%); color: rgba(186,230,253,.58); font-size: 14px; pointer-events: none; }.login-field input { width: 100%; font-family: inherit; font-size: 15px; color: #fff; background: rgba(255,255,255,.055); border: 1px solid rgba(186,230,253,.15); border-radius: 11px; padding: 13px 15px 13px 42px; transition: border-color .2s, background .2s, box-shadow .2s; }.login-field input::placeholder { color: rgba(255,255,255,.35); }.login-field input:focus { outline: none; border-color: var(--sky-400); background: rgba(255,255,255,.09); box-shadow: 0 0 0 3px rgba(56,189,248,.15); }.login-pass-wrap input { padding-right: 48px; }.login-toggle-pass { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: rgba(255,255,255,.5); font-size: 14px; }.login-toggle-pass:hover { color: #fff; background: rgba(255,255,255,.08); }.login-toggle-pass:focus-visible, .login-submit:focus-visible, .landing-primary:focus-visible, .landing-login-link:focus-visible { outline: 3px solid rgba(125,211,252,.78); outline-offset: 3px; }.login-error { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #FCA5A5; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); border-radius: 9px; padding: 10px 13px; margin: -2px 0; animation: loginShake .4s var(--ease); }.login-submit { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 6px; padding: 14px 24px; border-radius: 11px; background: var(--grad-blue); color: #fff; font-size: 15px; font-weight: 600; box-shadow: 0 10px 26px rgba(37,99,235,.4); transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .2s; }.login-submit:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(37,99,235,.5); }.login-submit:disabled { opacity: .7; cursor: wait; transform: none; }.login-submit i.fa-arrow-right { transition: transform .2s var(--ease); }.login-submit:hover i.fa-arrow-right { transform: translateX(4px); }.login-submit.is-loading i { animation: spin .9s linear infinite; }.login-foot { display: flex; justify-content: center; align-items: center; gap: 7px; text-align: center; font-size: 11.5px; color: rgba(255,255,255,.44); margin-top: 24px; }.login-foot i { color: rgba(125,211,252,.8); }

@keyframes landingReveal { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes landingPulse { 70% { box-shadow: 0 0 0 8px rgba(40,216,167,0); } 100% { box-shadow: 0 0 0 0 rgba(40,216,167,0); } }
@keyframes glowBreath { 50% { transform: scale(1.12); opacity: .65; } }
@keyframes dashboardFloat { 0%, 100% { transform: perspective(1400px) rotateY(-5deg) rotateX(3deg) translateY(0); } 50% { transform: perspective(1400px) rotateY(-3deg) rotateX(2deg) translateY(-10px); } }
@keyframes chartGrow { from { transform: scaleY(.08); opacity: .25; } to { transform: scaleY(1); opacity: 1; } }
@keyframes signalFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes liveBlink { 50% { opacity: .35; transform: scale(.75); } }
@keyframes orbitSpin { to { transform: rotate(360deg); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes loginShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (max-width: 960px) { .landing-nav, .landing-main, .landing-footer { width: min(100% - 36px, 720px); }.landing-hero { grid-template-columns: 1fr; padding-top: 64px; }.hero-copy { text-align: center; }.landing-eyebrow { justify-content: center; }.hero-lead { margin-left: auto; margin-right: auto; }.hero-actions, .hero-trust { justify-content: center; }.hero-visual { max-width: 680px; width: 100%; margin: 10px auto 0; }.landing-proofbar { flex-direction: column; align-items: flex-start; }.value-grid { grid-template-columns: 1fr; }.value-card { min-height: 238px; }.results-panel { grid-template-columns: 1fr; }.integration-list { grid-template-columns: 1fr 1fr; }.landing-cta { align-items: flex-start; flex-direction: column; }.signal-one { right: -2%; }.signal-two { left: -2%; } }
@media (max-width: 620px) { .landing-nav, .landing-main, .landing-footer { width: min(100% - 32px, 480px); }.landing-nav { min-height: 70px; }.landing-brand img { width: 133px; }.landing-nav-links { display: none; }.landing-login-link { margin-left: auto; padding: 8px 10px; font-size: 12px; }.landing-hero { min-height: auto; gap: 26px; padding: 51px 0 60px; }.hero-copy h1 { font-size: 42px; letter-spacing: -1.8px; }.hero-lead { font-size: 15px; }.hero-actions { gap: 14px; }.landing-primary { width: 100%; }.landing-secondary { width: 100%; justify-content: center; }.hero-trust { gap: 10px 14px; }.hero-visual { min-height: 310px; }.dashboard-preview { transform: none; }.preview-layout { min-height: 246px; }.preview-content { padding: 13px 10px 9px; }.preview-sidebar { gap: 11px; padding-top: 14px; }.preview-kpis { gap: 5px; margin-top: 10px; }.preview-kpis > div { padding: 6px; }.preview-kpis strong { font-size: 10px; }.preview-grid { grid-template-columns: 1.15fr .85fr; gap: 5px; margin-top: 5px; }.preview-chart-card { min-height: 103px; padding: 7px; }.preview-chart { height: 64px; gap: 5px; padding-top: 8px; }.preview-insight { padding: 7px; }.preview-insight strong { font-size: 7px; }.preview-insight small { font-size: 6px; }.preview-pipeline { gap: 5px; margin-top: 5px; }.floating-signal { padding: 7px 9px; }.floating-signal i { width: 22px; height: 22px; font-size: 9px; }.floating-signal strong { font-size: 8px; }.signal-one { top: -4%; }.signal-two { bottom: -4%; }.landing-proofbar { padding: 18px 0; }.landing-proofbar > div { gap: 10px; }.landing-proofbar b { font-size: 9px; }.landing-section { padding: 80px 0; }.section-intro h2, .results-copy h2, .landing-cta h2 { font-size: 31px; letter-spacing: -1.1px; }.section-intro > p { font-size: 14px; }.results-panel { gap: 28px; padding: 27px 22px; }.results-metrics { min-height: 252px; }.integration-list { grid-template-columns: 1fr; }.landing-cta { margin-bottom: 46px; padding: 29px 23px; }.landing-footer { flex-wrap: wrap; gap: 12px; }.landing-footer span:last-child { width: 100%; margin-left: 0; }.access-modal { align-items: end; padding: 0; }.login-card { width: 100%; border-radius: 22px 22px 0 0; padding: 30px 24px 24px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
/* ------------------------------------------------------------
   3 · PANTALLA DE BIENVENIDA
   ------------------------------------------------------------ */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--grad-navy);
  color: #fff;
  text-align: center;
  padding: 24px;
  overflow: hidden;
  transition: opacity .7s var(--ease), visibility .7s;
}

/* Estado de salida: se desvanece al pulsar "Comenzar" */
.welcome.fade-out { opacity: 0; visibility: hidden; }

/* Fondo decorativo: orbes de luz difuminados */
.welcome-bg { position: absolute; inset: 0; pointer-events: none; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .45;
  animation: float 14s ease-in-out infinite;
}
.orb-1 { width: 480px; height: 480px; background: #2563EB; top: -140px; left: -120px; }
.orb-2 { width: 420px; height: 420px; background: #0EA5E9; bottom: -160px; right: -100px; animation-delay: -5s; }
.orb-3 { width: 300px; height: 300px; background: #38BDF8; top: 40%; left: 60%; opacity: .25; animation-delay: -9s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(30px, -30px) scale(1.06); }
}

/* Retícula sutil sobre el fondo */
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* Fondo animado: red de puntos conectados (representa datos/IA fluyendo) */
.bg-particles {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
/* En la app (fuera de .welcome-bg) hace falta position:fixed para cubrir
   toda la ventana detrás de la sidebar flotante y el contenido, muy sutil
   para no interferir con la lectura de los datos. */
.bg-particles-app {
  position: fixed;
  z-index: -1;
  opacity: .5;
}

.welcome-content {
  position: relative;
  max-width: 860px;
  animation: rise .9s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

.welcome-logo { height: 224px; width: auto; margin: 0 auto 28px; display: block; }


.welcome-title {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin-bottom: 22px;
}

/* Degradado aplicado a parte del titular */
.text-gradient {
  background: linear-gradient(90deg, #7DB8FF, #38BDF8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
  font-size: clamp(16px, 2vw, 19px);
  color: rgba(255,255,255,.72);
  max-width: 620px;
  margin: 0 auto 40px;
  font-weight: 400;
}
.welcome-subtitle strong { color: #fff; font-weight: 600; }

/* Botón principal (CTA) */
.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 38px;
  border-radius: 14px;
  background: var(--grad-blue);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .2px;
  box-shadow: 0 12px 32px rgba(37, 99, 235, .45);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn-hero:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(37, 99, 235, .55); }
.btn-hero i { transition: transform .25s var(--ease); }
.btn-hero:hover i { transform: translateX(4px); }
.btn-hero.small { padding: 12px 26px; font-size: 15px; }

/* Estado de carga: mientras se conecta con Meta Ads / GA4 */
.btn-hero:disabled { cursor: wait; opacity: .82; }
.btn-hero.is-loading:hover { transform: none; box-shadow: 0 12px 32px rgba(37, 99, 235, .45); }
.btn-hero.is-loading i { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chips de valor bajo el CTA */
.welcome-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 52px;
}
.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 13.5px;
  color: rgba(255,255,255,.85);
}
.feature-chip i { color: var(--sky-400); font-size: 13px; }

/* ------------------------------------------------------------
   4 · ESTRUCTURA GENERAL DE LA APLICACIÓN
   ------------------------------------------------------------ */
.app {
  display: grid;
  grid-template-columns: 276px 1fr;
  min-height: 100vh;
  background: var(--bg);
  opacity: 0;
  transition: opacity .6s var(--ease), grid-template-columns .3s var(--ease);
}
.app.visible { opacity: 1; }
.app.sidebar-collapsed { grid-template-columns: 92px 1fr; }

/* ─── Barra lateral flotante ─── */
.sidebar {
  background: var(--grad-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  margin: 16px 0 16px 16px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg), 0 1px 0 rgba(255,255,255,.06) inset;
  overflow: visible;
  transition: padding .3s var(--ease);
}

/* Botón para contraer/expandir, anclado al borde derecho de la sidebar */
.sidebar-toggle {
  position: absolute;
  top: 30px;
  right: -12px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: grid; place-items: center;
  font-size: 10px;
  box-shadow: var(--shadow-sm);
  z-index: 5;
  transition: transform .3s var(--ease), color .2s;
}
.sidebar-toggle:hover { color: var(--blue-600); }
.sidebar-toggle i { transition: transform .3s var(--ease); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 18px;
}
.brand-logo-img { height: 120px; width: auto; align-self: center; transition: opacity .15s; }
.brand-sub  { font-size: 11.5px; color: rgba(255,255,255,.5); }

/* Marca compacta (solo visible con la sidebar contraída) */
.brand-mark {
  display: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--grad-blue);
  color: #fff;
  align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: 0 6px 14px rgba(37,99,235,.4);
}

/* ══════════ ESTADO CONTRAÍDO: solo iconos ══════════ */
.sidebar.collapsed { padding-left: 10px; padding-right: 10px; }
.sidebar.collapsed .brand-logo-img { display: none; }
.sidebar.collapsed .brand-mark { display: flex; }
.sidebar.collapsed .sidebar-brand { padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-tag,
.sidebar.collapsed .user-info,
.sidebar.collapsed .brand-sub { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-item i { width: auto; }
.sidebar.collapsed .user-chip { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-item.active::before { display: none; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }

.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.35);
  padding: 16px 12px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.66);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background .2s, color .2s;
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: 14.5px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37,99,235,.32), rgba(56,189,248,.12));
  color: #fff;
}
/* Indicador lateral del elemento activo */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 20%; bottom: 20%;
  width: 3.5px;
  border-radius: 4px;
  background: var(--sky-400);
}

/* Etiqueta "IA" en el menú */
.nav-tag {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--grad-blue);
  color: #fff;
  letter-spacing: .5px;
}

.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 4px 8px; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-blue);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11.5px; color: rgba(255,255,255,.45); }

/* ─── Zona principal ─── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  background: rgba(10,18,32,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar-left h2 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }

/* Indicador "datos en vivo" */
.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);   /* gris = datos simulados (estado por defecto) */
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.45); }
  50%      { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}
/* Datos reales cargados correctamente */
.live-badge.is-live { color: var(--green-500); background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); }
.live-badge.is-live .live-dot { background: var(--green-500); animation: pulse 2s infinite; }
/* Falló la conexión en vivo y se está usando el respaldo simulado */
.live-badge.is-warning { color: #B45309; background: rgba(217,119,6,.08); border-color: rgba(217,119,6,.25); }
.live-badge.is-warning .live-dot { background: #D97706; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Selector de campaña */
.select-wrap {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
}
.select-wrap i { color: var(--blue-600); font-size: 12.5px; }
.select-wrap select {
  border: none; outline: none; background: none;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text-1); cursor: pointer;
}
/* El desplegable NATIVO (la lista de opciones) no hereda bien el fondo
   transparente del control; sin esto, Chrome lo pinta blanco con texto
   claro encima = ilegible. Se fija explícitamente en <option>. */
.select-wrap select option {
  background: var(--surface);
  color: var(--text-1);
}


.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: color .2s;
}
.icon-btn:hover { color: var(--blue-600); }
.notif-dot {
  position: absolute; top: 9px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red-500);
  border: 1.5px solid var(--surface);
}

/* ─── Contenido ─── */
.content { padding: 30px 32px 60px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* Cada sección se muestra/oculta desde JS con animación */
.section { display: none; }
.section.active { display: block; animation: sectionIn .5s var(--ease) both; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   5 · COMPONENTES GENÉRICOS
   ------------------------------------------------------------ */

/* Tarjeta base */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  transition: box-shadow .3s var(--ease), transform .3s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }

/* Cabecera de tarjeta */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.card-head.wrap { flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }
.card-head p  { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }

/* Contenedores de gráfico con altura fija (requisito Chart.js) */
.chart-box        { position: relative; height: 230px; }
.chart-box.tall   { height: 300px; }
.chart-box.xtall  { height: 380px; }
.chart-box.gauge  { height: 170px; }

/* Rejillas reutilizables */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.span-2 { grid-column: span 2; }

/* Chip identificador de predicción IA */
.chip-ia {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700;
  color: var(--blue-600);
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.18);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Introducción de sección (integraciones / informes) */
.section-intro { max-width: 720px; margin-bottom: 26px; }
.section-intro h3 { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 8px; }
.section-intro p  { color: var(--text-2); font-size: 15px; }

/* ------------------------------------------------------------
   6 · RESUMEN EJECUTIVO
   ------------------------------------------------------------ */

/* Rejilla de tarjetas KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* Icono con fondo tintado según variante */
.kpi-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.kpi-icon.blue  { background: rgba(37,99,235,.1);  color: var(--blue-600); }
.kpi-icon.sky   { background: rgba(14,165,233,.1); color: var(--sky-500); }
.kpi-icon.navy  { background: rgba(148,163,184,.14); color: var(--text-1); }
.kpi-icon.green { background: rgba(16,185,129,.1); color: var(--green-500); }

.kpi-body { display: flex; flex-direction: column; min-width: 0; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -.6px; margin: 2px 0; font-variant-numeric: tabular-nums; }

/* Variación vs periodo anterior */
.kpi-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.kpi-delta.up   { color: var(--green-500); }
.kpi-delta.down { color: var(--red-500); }

/* Franja de análisis IA */
.ai-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, var(--surface) 55%, #14213A 100%);
}
.ai-strip-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--grad-blue);
  color: #fff;
  display: grid; place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(37,99,235,.35);
}
.ai-strip-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--blue-600);
}
.ai-strip-text { font-size: 14.5px; font-weight: 500; color: var(--text-1); margin-top: 2px; min-height: 22px; }

/* Punto luminoso decorativo de la franja IA */
.ai-pulse {
  position: absolute;
  right: 24px; top: 50%;
  width: 10px; height: 10px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--sky-400);
  animation: pulse 2s infinite;
}

/* Distribución de gráficos del resumen */
.grid-resumen { grid-template-columns: 1.5fr 1fr 1fr; }

/* Embudo comercial construido con divs */
.funnel { display: flex; flex-direction: column; gap: 13px; padding-top: 8px; }
.funnel-row { display: flex; flex-direction: column; gap: 5px; }
.funnel-meta { display: flex; justify-content: space-between; font-size: 12.5px; }
.funnel-meta .fname { font-weight: 600; color: var(--text-2); }
.funnel-meta .fval  { font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.funnel-bar {
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--blue-600), var(--sky-400));
  width: var(--w, 50%);
  min-width: 42px;
  transform-origin: left;
  animation: growBar .9s var(--ease) both;
  animation-delay: var(--d, 0s);
}
@keyframes growBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ------------------------------------------------------------
   7 · EVOLUCIÓN TEMPORAL
   ------------------------------------------------------------ */

/* Selector de rango de fechas (botón + panel desplegable) */
.date-range { position: relative; }
.date-range-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-1);
  font-size: 13px; font-weight: 600;
  transition: border-color .2s, box-shadow .2s;
}
.date-range-btn:hover { border-color: var(--blue-500); }
.date-range-btn i:first-child { color: var(--text-3); }
.date-range-caret { font-size: 10px; color: var(--text-3); transition: transform .2s; }
.date-range.is-open .date-range-btn { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.date-range.is-open .date-range-caret { transform: rotate(180deg); }

.date-range-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 40;
  overflow: hidden;
  min-width: 640px;
}

.date-range-presets {
  display: flex; flex-direction: column;
  padding: 10px;
  gap: 2px;
  border-right: 1px solid var(--border);
  min-width: 168px;
  background: var(--bg);
}
.date-range-presets button {
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.date-range-presets button:hover { background: var(--surface); color: var(--text-1); }
.date-range-presets button.active { background: var(--blue-600); color: #fff; font-weight: 600; }

.date-range-cal { display: flex; flex-direction: column; padding: 16px 18px; flex: 1; }
.date-range-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.date-range-nav {
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background .15s;
}
.date-range-nav:hover { background: var(--bg); color: var(--text-1); }
.date-range-months { display: flex; gap: 56px; font-size: 13px; font-weight: 700; color: var(--text-1); }

.date-range-grids { display: flex; gap: 24px; }
.date-range-grid { border-collapse: collapse; }
.date-range-grid th {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  padding: 4px 0; width: 30px;
}
.date-range-grid td { padding: 1px; text-align: center; }
.date-range-grid button {
  width: 28px; height: 28px;
  border-radius: 8px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-1);
  transition: background .15s, color .15s;
}
.date-range-grid button:disabled { color: var(--text-3); opacity: .4; cursor: not-allowed; }
.date-range-grid button:not(:disabled):hover { background: var(--bg); }
.date-range-grid td.in-range button { background: rgba(37,99,235,.1); border-radius: 0; }
.date-range-grid td.range-start button, .date-range-grid td.range-end button {
  background: var(--blue-600); color: #fff; font-weight: 700;
}
.date-range-grid td.range-start.range-end button { border-radius: 8px; }
.date-range-grid td.range-start button { border-radius: 8px 0 0 8px; }
.date-range-grid td.range-end button { border-radius: 0 8px 8px 0; }
.date-range-grid button.is-today:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--blue-500); }

.date-range-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.date-range-preview { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.date-range-actions { display: flex; gap: 8px; }

.btn-mini {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--blue-600);
  color: #fff;
  font-size: 13px; font-weight: 600;
  transition: background .2s;
}
.btn-mini:hover { background: var(--navy-700); }
.btn-mini.ghost { background: transparent; color: var(--text-2); }
.btn-mini.ghost:hover { background: var(--bg); color: var(--text-1); }

/* Conmutadores de series del gráfico */
.series-toggles { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px; font-weight: 600;
  color: var(--text-3);
  transition: all .2s;
}
.toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #ccc); opacity: .35; transition: opacity .2s; }
.toggle.active { color: var(--text-1); border-color: rgba(37,99,235,.3); background: rgba(37,99,235,.04); }
.toggle.active .dot { opacity: 1; }

/* Mini-estadísticas bajo el gráfico de evolución */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.mini-stat {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
}
.mini-stat i {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(37,99,235,.08);
  color: var(--blue-600);
  font-size: 15px;
}
.ms-label { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; }
.ms-value { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   8 · ANÁLISIS DEL CLIENTE POTENCIAL
   ------------------------------------------------------------ */

/* Mapa + ranking */
.grid-mapa { grid-template-columns: 1.6fr 1fr; margin-bottom: 20px; }

.map-wrap { position: relative; }
#map-spain { width: 100%; height: auto; display: block; }

/* Silueta del territorio */
.map-land {
  fill: #1B2740;
  stroke: #2E4166;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.map-inset rect { fill: none; stroke: #2E4166; stroke-width: 1.2; stroke-dasharray: 5 4; }
.map-inset-label { font-size: 10px; fill: var(--text-3); font-weight: 600; }

/* Burbujas de leads (generadas por JS) */
.map-bubble {
  fill: rgba(37, 99, 235, .55);
  stroke: #fff;
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill .2s;
  /* La escala se anima sobre el propio círculo (transform-box) */
  transform-box: fill-box;
  transform-origin: center;
  animation: bubbleIn .6s var(--ease) both;
}
.map-bubble:hover { fill: rgba(14, 165, 233, .8); }
.map-bubble.hot { fill: rgba(11, 31, 58, .72); }
@keyframes bubbleIn {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}

.map-city-label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-1);
  pointer-events: none;
}

/* Leyenda del mapa */
.map-legend {
  display: flex; gap: 20px; justify-content: center;
  margin-top: 8px;
  font-size: 12px; color: var(--text-2); font-weight: 500;
}
.map-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend-bubble {
  display: inline-block; border-radius: 50%;
  background: rgba(37,99,235,.55); border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(37,99,235,.3);
}
.legend-bubble.s { width: 8px;  height: 8px; }
.legend-bubble.m { width: 13px; height: 13px; }
.legend-bubble.l { width: 19px; height: 19px; background: rgba(11,31,58,.72); }

/* Ranking de provincias */
.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: flex; align-items: center; gap: 13px; }
.rank-pos {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-2);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.rank-row:nth-child(-n+3) .rank-pos { background: rgba(37,99,235,.1); color: var(--blue-600); }
.rank-info { flex: 1; min-width: 0; }
.rank-meta { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.rank-name { font-weight: 600; }
.rank-name small { color: var(--text-3); font-weight: 500; }
.rank-val  { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-bar  { height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.rank-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--blue-600), var(--sky-400));
  width: var(--w, 40%);
  transform-origin: left;
  animation: growBar .8s var(--ease) both;
}

/* Rejilla de perfiles demográficos */
.grid-perfil { grid-template-columns: repeat(4, 1fr); }

/* Indicador de frecuencia (medio donut con valor central) */
.gauge-wrap { position: relative; }
.gauge-center {
  position: absolute;
  left: 50%; top: 62%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.gauge-value { display: block; font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.gauge-sub   { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; }

/* ------------------------------------------------------------
   9 · COMPARATIVA DE CAMPAÑAS
   ------------------------------------------------------------ */
.grid-comp { grid-template-columns: repeat(4, 1fr); margin-top: 20px; }

/* Tarjetas cabecera de campaña */
.camp-card { position: relative; overflow: hidden; }
.camp-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.camp-biofy::before { background: var(--grad-blue); }
.camp-aqua::before  { background: linear-gradient(90deg, #0EA5E9, #67E8F9); }

.camp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.camp-head h3 { font-size: 17px; font-weight: 800; }
.camp-head p  { font-size: 12.5px; color: var(--text-3); }
.camp-pill {
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  color: var(--green-500);
  background: rgba(16,185,129,.09);
  border: 1px solid rgba(16,185,129,.2);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.camp-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.camp-stats > div {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.camp-stats span   { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.camp-stats strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.3px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Tabla comparativa */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }
.data-table td:first-child { font-weight: 600; color: var(--text-2); }

/* Mejor valor de la fila resaltado en verde */
.best {
  color: var(--green-500);
  font-weight: 700;
  position: relative;
}
.best::after {
  content: '✓';
  margin-left: 7px;
  font-size: 11px;
}

/* ------------------------------------------------------------
   10 · PREDICCIONES IA
   ------------------------------------------------------------ */

/* Cabecera del motor de predicción */
.ai-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  background: var(--grad-navy);
  color: #fff;
  border: none;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ai-hero-left { display: flex; align-items: center; gap: 18px; max-width: 620px; }
.ai-hero-icon {
  width: 54px; height: 54px;
  border-radius: 16px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 22px;
  color: var(--sky-400);
  flex-shrink: 0;
}
.ai-hero h3 { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
.ai-hero p  { font-size: 13.5px; color: rgba(255,255,255,.65); line-height: 1.55; }

.ai-hero-metrics { display: flex; gap: 34px; }
.ai-hero-metrics > div { text-align: center; }
.ahm-value { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.5px; color: var(--sky-400); }
.ahm-label { display: block; font-size: 11.5px; color: rgba(255,255,255,.55); font-weight: 500; margin-top: 3px; }

/* Tarjetas de predicción */
.pred-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.pred-card { display: flex; flex-direction: column; gap: 7px; position: relative; overflow: hidden; }
.pred-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-blue);
}
.pred-tag {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--blue-600);
  background: rgba(37,99,235,.08);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 4px;
}
.pred-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.pred-value { font-size: 31px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.pred-range { font-size: 12px; color: var(--text-3); }
.pred-trend {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700;
  margin-top: 4px;
}
.pred-trend.up      { color: var(--green-500); }
.pred-trend.down    { color: var(--red-500); }
.pred-trend.neutral { color: var(--text-2); }

.grid-pred { grid-template-columns: repeat(2, 1fr); }

/* ------------------------------------------------------------
   11 · INTEGRACIONES (diagrama de flujo)
   ------------------------------------------------------------ */
.flow-card { padding: 34px 26px; margin-bottom: 22px; }

.flow {
  display: grid;
  grid-template-columns: 1fr 90px auto 90px 1fr;
  align-items: center;
  gap: 0;
  max-width: 1080px;
  margin: 0 auto;
}

.flow-col { display: flex; flex-direction: column; gap: 16px; }

/* Nodo de fuente / salida */
.flow-node {
  display: flex;
  align-items: center;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  animation: nodeIn .6s var(--ease) both;
  animation-delay: var(--delay, 0s);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.flow-node:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.flow-node strong { display: block; font-size: 14px; }
.flow-node span   { display: block; font-size: 11.5px; color: var(--text-3); }

@keyframes nodeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Iconos de cada plataforma con su color de marca suavizado */
.fn-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.fn-icon.meta { background: linear-gradient(135deg, #1877F2, #4293FB); }
.fn-icon.ga   { background: linear-gradient(135deg, #F9AB00, #FBC02D); }
.fn-icon.crm  { background: linear-gradient(135deg, #7C3AED, #A78BFA); }
.fn-icon.web  { background: linear-gradient(135deg, #0F766E, #14B8A6); }
.fn-icon.ia   { background: var(--grad-blue); }
.fn-icon.out1 { background: linear-gradient(135deg, #2563EB, #3B82F6); }
.fn-icon.out2 { background: linear-gradient(135deg, #0EA5E9, #38BDF8); }
.fn-icon.out3 { background: linear-gradient(135deg, #0B1F3A, #12305C); }

/* Conectores SVG con flujo animado */
.flow-links { height: 380px; }
.flow-links svg { width: 100%; height: 100%; overflow: visible; }
.flow-line {
  fill: none;
  stroke: #C7D6EE;
  stroke-width: 2;
  stroke-dasharray: 6 7;
  animation: dashFlow 1.6s linear infinite;
}
@keyframes dashFlow { to { stroke-dashoffset: -26; } }

/* Nodo central: la plataforma */
.flow-center { display: grid; place-items: center; }
.flow-platform {
  position: relative;
  width: 260px;
  padding: 34px 22px;
  border-radius: 26px;
  background: var(--grad-navy);
  color: #fff;
  text-align: center;
  box-shadow: 0 18px 44px rgba(11,31,58,.35);
}
.flow-platform-logo { height: 78px; width: auto; margin: 0 auto 14px; display: block; }
.flow-platform strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.flow-platform span   { display: block; font-size: 13px; color: rgba(255,255,255,.65); margin-top: 8px; line-height: 1.5; }

/* Halo pulsante alrededor de la plataforma */
.fp-glow {
  position: absolute;
  inset: -14px;
  border-radius: 30px;
  border: 2px solid rgba(56,189,248,.35);
  animation: glow 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glow {
  0%, 100% { opacity: .9; transform: scale(1); }
  50%      { opacity: .25; transform: scale(1.06); }
}

/* Tarjetas de características */
.feat-card { text-align: left; }
.feat-card i {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(37,99,235,.09);
  color: var(--blue-600);
  font-size: 16px;
  margin-bottom: 14px;
}
.feat-card h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 6px; }
.feat-card p  { font-size: 13px; color: var(--text-2); line-height: 1.55; }

/* ------------------------------------------------------------
   12 · EXPORTACIÓN DE INFORMES
   ------------------------------------------------------------ */
.grid-informes { grid-template-columns: 1fr 1.4fr; align-items: start; }

.export-options { display: flex; flex-direction: column; gap: 4px; margin-bottom: 22px; }
.export-check {
  display: flex; align-items: center; gap: 11px;
  font-size: 14px; font-weight: 500;
  color: var(--text-1);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s;
}
.export-check:hover { background: var(--bg); }
.export-check input { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; }

.export-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-export {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  white-space: nowrap;
}
.btn-export:hover { transform: translateY(-2px); }
.btn-export.pdf   { background: var(--grad-navy); box-shadow: 0 8px 20px rgba(11,31,58,.3); }
.btn-export.excel { background: linear-gradient(135deg, #0E9F6E, #10B981); box-shadow: 0 8px 20px rgba(16,185,129,.3); }
.btn-export i { font-size: 16px; }

/* Barra de progreso de generación */
.export-progress { margin-top: 22px; }
.ep-info {
  display: flex; justify-content: space-between;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.ep-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.ep-fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: var(--grad-blue);
  transition: width .18s linear;
}

/* Vistas previas de informes */
.report-previews { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.report-doc { display: flex; flex-direction: column; gap: 10px; }
.rd-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.rd-logo { display: flex; align-items: center; }
.rd-logo img { height: 15px; width: auto; }
.rd-type {
  font-size: 10.5px; font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: .6px;
}
.rd-type.pdf   { background: rgba(148,163,184,.15); color: var(--text-1); }
.rd-type.excel { background: rgba(16,185,129,.1); color: #0E9F6E; }
.report-doc h4 { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.rd-date { font-size: 12px; color: var(--text-3); }

/* Mini gráfico de barras decorativo */
.rd-chart {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 86px;
  padding: 10px 4px 0;
  border-bottom: 1px solid var(--border);
}
.rd-chart span {
  flex: 1;
  height: var(--h, 40%);
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--sky-400), var(--blue-600));
  opacity: .9;
  transform-origin: bottom;
  animation: growV .8s var(--ease) both;
}
@keyframes growV { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Mini tabla decorativa */
.rd-table { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font-size: 12.5px; }
.rd-tr { display: grid; grid-template-columns: 1.4fr 1fr 1fr; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.rd-tr:last-child { border-bottom: none; }
.rd-tr.head { background: var(--bg); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); }
.rd-tr span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

.rd-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.rd-rows > div { display: flex; justify-content: space-between; font-size: 13px; }
.rd-rows span   { color: var(--text-2); }
.rd-rows strong { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   13 · VISIÓN FUTURA
   ------------------------------------------------------------ */
.vision-hero { text-align: center; max-width: 760px; margin: 10px auto 30px; }
.vision-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--blue-600);
  background: rgba(37,99,235,.08);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.vision-hero h3 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -.8px; line-height: 1.16; margin-bottom: 12px; }
.vision-hero p  { color: var(--text-2); font-size: 16px; }

/* Diagrama radial de convergencia */
.vision-card { padding: 30px; margin-bottom: 26px; }
.vision-diagram { position: relative; max-width: 900px; margin: 0 auto; aspect-ratio: 900 / 520; }
.vision-diagram svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.v-line {
  fill: none;
  stroke: #C7D6EE;
  stroke-width: 2;
  stroke-dasharray: 6 7;
  animation: dashFlow 1.8s linear infinite;
}

/* Nodos periféricos posicionados de forma absoluta sobre el SVG */
.v-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 700;
  transform: translateY(-50%);
  white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  z-index: 2;
}
.v-node:hover { transform: translateY(calc(-50% - 3px)); box-shadow: var(--shadow-md); }
.v-node .fn-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 13.5px; }
.v-node.right { flex-direction: row-reverse; }

/* Núcleo central del diagrama */
.v-center {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}
.vc-core {
  position: relative;
  width: 172px; height: 172px;
  border-radius: 50%;
  background: var(--grad-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(11,31,58,.4);
}
.vc-core i { font-size: 25px; color: var(--sky-400); }
.vc-core strong { font-size: 14px; font-weight: 800; line-height: 1.3; letter-spacing: -.2px; }
.vc-ring {
  position: absolute;
  left: 50%; top: 50%;
  width: 210px; height: 210px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px dashed rgba(37,99,235,.3);
  animation: spin 24s linear infinite;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Hoja de ruta por fases */
.roadmap {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}
.road-step { display: flex; flex-direction: column; gap: 8px; }
.rs-num { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); }
.road-step i {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(37,99,235,.09);
  color: var(--blue-600);
  font-size: 16px;
  margin: 4px 0;
}
.road-step h4 { font-size: 14.5px; font-weight: 700; }
.road-step p  { font-size: 12.5px; color: var(--text-2); line-height: 1.55; flex: 1; }
.rs-status {
  align-self: flex-start;
  font-size: 11px; font-weight: 700;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}
.rs-status.now {
  color: var(--green-500);
  background: rgba(16,185,129,.09);
  border-color: rgba(16,185,129,.25);
}

/* Cierre con llamada a la acción */
.vision-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--grad-navy);
  color: #fff;
  border: none;
  padding: 30px 34px;
}
.vision-cta h3 { font-size: 19px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 6px; }
.vision-cta p  { font-size: 14px; color: rgba(255,255,255,.65); }

/* ------------------------------------------------------------
   14 · TOAST (notificación flotante)
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--navy-800);
  color: #fff;
  padding: 14px 24px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toastIn .45s var(--ease) both;
}
.toast i { color: var(--green-500); font-size: 16px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ------------------------------------------------------------
   15 · RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .grid-resumen { grid-template-columns: 1fr 1fr; }
  .grid-resumen .card:first-child { grid-column: span 2; }
  .grid-perfil { grid-template-columns: repeat(2, 1fr); }
  .pred-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-comp { grid-template-columns: repeat(2, 1fr); }
  .roadmap { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .ai-hero-metrics { gap: 22px; }
}

@media (max-width: 960px) {
  .login-shell { width: min(100%, 430px); display: block; }
  .login-showcase { display: none; }
  .login-card { justify-self: stretch; }

  /* La barra lateral pasa a cabecera horizontal. El modo "solo iconos"
     es un concepto de sidebar vertical: en la barra horizontal móvil se
     ignora siempre, aunque el usuario lo haya dejado activado en escritorio. */
  .app, .app.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    padding: 14px 16px;
    margin: 12px;
    border-radius: 16px;
  }
  .sidebar-toggle { display: none; }
  .sidebar-brand { border-bottom: none; padding-bottom: 8px; margin-bottom: 4px; }
  .sidebar.collapsed .brand-logo-img,
  .brand-logo-img { display: block; height: 34px; }
  .sidebar.collapsed .brand-mark { display: none; }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
  }
  .nav-label { display: none; }
  .sidebar.collapsed .nav-item span,
  .nav-item span { display: inline; }
  .nav-item { white-space: nowrap; width: auto; padding: 9px 14px; justify-content: flex-start; }
  .nav-item.active::before { display: none; }
  .sidebar.collapsed .user-info,
  .sidebar-footer { display: none; }

  .topbar { padding: 14px 18px; flex-wrap: wrap; }
  .topbar-right { flex-wrap: wrap; row-gap: 8px; }
  .content { padding: 20px 18px 50px; }

  .grid-mapa, .grid-informes, .grid-2, .grid-pred { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .grid-resumen { grid-template-columns: 1fr; }
  .grid-resumen .card:first-child { grid-column: span 1; }

  /* Diagrama de integraciones en vertical */
  .flow { grid-template-columns: 1fr; gap: 22px; }
  .flow-links { display: none; }
  .flow-center { order: 2; }
  .flow-sources { order: 1; }
  .flow-outputs { order: 3; }

  /* Diagrama de visión en columna */
  .vision-diagram { aspect-ratio: auto; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
  .vision-diagram svg { display: none; }
  .v-node { position: static; transform: none; justify-content: flex-start; }
  .v-node.right { flex-direction: row; }
  .v-node:hover { transform: translateY(-2px); }
  .v-center { position: static; transform: none; margin: 10px auto; }
}

@media (max-width: 620px) {
  .login { padding: 16px; }
  .login-card { padding: 30px 24px 24px; border-radius: 20px; }
  .login-card-head { margin-bottom: 25px; }
  .login-title { font-size: 25px; }
  .login-proof { flex-direction: column; gap: 12px; }

  .grid-perfil, .pred-grid, .grid-comp, .roadmap, .grid-4,
  .mini-stats, .report-previews, .camp-stats { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 19px; }
  .welcome-logo { height: 140px; margin-bottom: 20px; }
  .welcome-title { letter-spacing: -.8px; }

  /* El botón de fechas vive en el topbar (borde derecho): el panel se
     ancla también a la derecha para no salirse de pantalla por la izquierda. */
  .date-range-panel { right: 0; left: auto; min-width: 0; max-width: calc(100vw - 32px); flex-direction: column; }
  .date-range-presets { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--border); }
  .date-range-grids { flex-direction: column; gap: 12px; }
  /* Oculta el texto largo del rango ("18/06/2026 - 17/07/2026") y deja
     solo el icono + flecha, para que quepa junto al resto de la cabecera. */
  .date-range-btn { padding: 9px 10px; }
  .date-range-btn span { display: none; }

  .ai-hero { flex-direction: column; align-items: flex-start; }
  .camp-stats { grid-template-columns: 1fr 1fr; }
  .grok-panel { width: calc(100vw - 32px); right: -8px; height: min(72vh, 560px); }
  .grok-widget { right: 16px; bottom: 16px; }
}

/* ------------------------------------------------------------
   16 · ASISTENTE IA (Grok) — widget flotante
   ------------------------------------------------------------ */
.grok-widget { position: fixed; right: 24px; bottom: 24px; z-index: 90; }

.grok-toggle {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--navy-800);
  box-shadow: 0 12px 32px rgba(11,31,58,.4), 0 0 0 4px rgba(255,255,255,.9);
  display: grid; place-items: center;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.grok-toggle:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 18px 40px rgba(11,31,58,.5), 0 0 0 4px rgba(255,255,255,.9); }
.grok-toggle.is-open { background: var(--blue-600); }

.grok-toggle-ring {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(56,189,248,.5);
  animation: grokRing 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes grokRing {
  0%, 100% { opacity: .8; transform: scale(1); }
  50%      { opacity: 0; transform: scale(1.22); }
}

.grok-face { width: 38px; height: 38px; overflow: visible; }
.grok-face-mini { width: 34px; height: 34px; flex-shrink: 0; }

/* Parpadeo periódico de los ojos */
.grok-eye { transform-origin: center; animation: grokBlink 4.5s ease-in-out infinite; }
.grok-eye-r { animation-delay: .05s; }
@keyframes grokBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(.15); }
}

/* Antena: pulso suave constante */
.grok-antenna-tip { animation: grokPulse 1.8s ease-in-out infinite; transform-origin: 50px 8px; }
@keyframes grokPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(1.25); }
}

/* Boca: quieta en reposo */
.grok-mouth { transition: all .25s var(--ease); transform-origin: 50px 62px; }

/* Estado "pensando" (esperando respuesta de Grok): ojos oscilan y la
   antena parpadea más rápido, para dar sensación de actividad. */
.grok-toggle.is-thinking .grok-eye { animation: grokThinkEyes .7s ease-in-out infinite; }
@keyframes grokThinkEyes {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
.grok-toggle.is-thinking .grok-antenna-tip { animation: grokPulse .6s ease-in-out infinite; }
.grok-toggle.is-thinking .grok-mouth { animation: grokThinkMouth .5s ease-in-out infinite; }
@keyframes grokThinkMouth {
  0%, 100% { transform: scaleX(1); }
  50%      { transform: scaleX(.5); }
}

/* Panel de chat */
.grok-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 360px;
  height: 500px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
}
.grok-panel.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.grok-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--grad-navy);
  color: #fff;
  flex-shrink: 0;
}
.grok-panel-title { display: flex; align-items: center; gap: 10px; }
.grok-panel-name { display: block; font-size: 13.5px; font-weight: 700; }
.grok-panel-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: rgba(255,255,255,.6); }
.grok-panel-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green-500); }
.grok-panel-head .icon-btn { color: rgba(255,255,255,.7); }
.grok-panel-head .icon-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.grok-messages {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}
.grok-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.grok-msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-bottom-left-radius: 4px;
}
.grok-msg.user {
  align-self: flex-end;
  background: var(--blue-600);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.grok-msg.typing { color: var(--text-3); font-style: italic; }
.grok-msg.error { border-color: rgba(239,68,68,.35); color: var(--red-500); }

.grok-form {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.grok-form input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-1);
}
.grok-form input:focus { outline: none; border-color: var(--blue-500); }
.grok-send { background: var(--blue-600); color: #fff; }
.grok-send:hover { background: var(--navy-700); }

/* ------------------------------------------------------------
   17 · GEO (Generative Engine Optimization)
   ------------------------------------------------------------ */
.geo-block { margin: 28px 0 14px; }
.geo-block h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.geo-lead { font-size: 13.5px; color: var(--text-2); }

/* Vista previa de datos (mockup de la futura sección con tracking real) */
.geo-preview-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.geo-preview-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  color: #D97706;
  background: rgba(217,119,6,.1);
  border: 1px solid rgba(217,119,6,.25);
  padding: 6px 13px;
  border-radius: 999px;
  white-space: nowrap;
}
.geo-preview-kpis { margin-bottom: 20px; }
.geo-preview-chart-card { margin-bottom: 8px; }

/* Acordeón "¿Qué es GEO?" */
.geo-accordion {
  margin-top: 36px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}
.geo-accordion summary {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-size: 15px; font-weight: 700;
  padding: 4px 0;
  color: var(--text-1);
}
.geo-accordion summary::-webkit-details-marker { display: none; }
.geo-accordion summary span { display: inline-flex; align-items: center; gap: 10px; }
.geo-accordion summary i.fa-circle-question { color: var(--blue-600); }
.geo-accordion-caret { font-size: 13px; color: var(--text-3); transition: transform .25s var(--ease); }
.geo-accordion[open] .geo-accordion-caret { transform: rotate(180deg); }
.geo-accordion-body { animation: sectionIn .35s var(--ease) both; }

/* Comparación "Antes / Ahora" */
.geo-compare-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600;
  color: var(--text-3);
  margin-bottom: 12px;
}
.geo-compare-tag.accent { color: var(--sky-400); }
.geo-compare-q { font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.geo-compare-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.geo-compare-hl { border: 1.5px solid var(--blue-500); background: linear-gradient(160deg, rgba(37,99,235,.1), transparent 60%); }

/* Mini-diagnóstico */
.geo-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.geo-stat .ms-value { font-size: 20px; }
.geo-stat .ms-value.warn  { color: #D97706; }
.geo-stat .ms-value.ok    { color: var(--green-500); }
.geo-stat .ms-value.accent{ color: var(--sky-400); }
.geo-stat-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }

.geo-pillars { margin-bottom: 6px; }
.geo-roadmap { margin-bottom: 6px; }

/* Propuesta de servicio */
.geo-price-box { padding: 26px; margin-top: 28px; }
.geo-price-head { margin-bottom: 18px; }
.geo-price-head h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.geo-price-lbl { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.geo-price-val { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.geo-tag-recommended {
  display: inline-block; margin-bottom: 10px;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: var(--grad-blue); color: #fff;
}
.geo-cta { margin-top: 20px; }

/* ─── Cuenta y seguridad ─── */
.account-area { position: relative; }
.user-chip { width: 100%; color: inherit; text-align: left; transition: background .2s var(--ease); }
.user-chip:hover, .user-chip:focus-visible { background: rgba(255,255,255,.07); border-radius: 10px; outline: none; }
.account-caret { margin-left: auto; color: rgba(255,255,255,.42); font-size: 11px; transition: transform .2s var(--ease); }
.user-chip[aria-expanded="true"] .account-caret { transform: rotate(180deg); }
.account-menu { position: absolute; z-index: 30; bottom: calc(100% + 10px); left: 0; width: 100%; min-width: 220px; padding: 6px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: #14243d; box-shadow: var(--shadow-lg); }
.account-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 8px; color: rgba(255,255,255,.78); font-size: 13px; text-align: left; transition: background .2s, color .2s; }
.account-menu button:hover, .account-menu button:focus-visible { color: #fff; background: rgba(255,255,255,.09); outline: none; }
.account-menu .account-logout { color: #fda4af; }
.account-menu .account-logout:hover { color: #fecdd3; background: rgba(244,63,94,.12); }
.security-modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; opacity: 0; visibility: hidden; transition: opacity .2s var(--ease), visibility .2s; }
.security-modal.is-open { opacity: 1; visibility: visible; }
.security-modal-backdrop { position: absolute; inset: 0; background: rgba(2,8,23,.72); backdrop-filter: blur(5px); }
.security-dialog { position: relative; width: min(100%, 460px); padding: 36px; color: var(--text-1); background: #111f35; border: 1px solid rgba(186,230,253,.16); border-radius: 22px; box-shadow: 0 28px 80px rgba(0,0,0,.55); transform: translateY(12px) scale(.98); transition: transform .25s var(--ease); }
.security-modal.is-open .security-dialog { transform: translateY(0) scale(1); }
.security-close { position: absolute; top: 15px; right: 15px; width: 34px; height: 34px; border-radius: 9px; color: var(--text-2); }
.security-close:hover, .security-close:focus-visible { color: #fff; background: rgba(255,255,255,.08); outline: none; }
.security-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--sky-400); background: rgba(14,165,233,.14); border-radius: 14px; }
.security-eyebrow { margin-top: 21px; color: #bde9ff; font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.security-dialog h2 { margin-top: 5px; font-size: 25px; letter-spacing: -.6px; }
.security-dialog > p { margin-top: 10px; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.security-status { display: flex; gap: 11px; margin-top: 24px; padding: 14px; background: rgba(255,255,255,.045); border: 1px solid var(--border); border-radius: 12px; }
.security-status > span { width: 9px; height: 9px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 0 4px rgba(251,191,36,.12); }
.security-status strong, .security-status small { display: block; }
.security-status strong { font-size: 13px; }
.security-status small { margin-top: 3px; color: var(--text-2); font-size: 12px; line-height: 1.45; }
.security-action { width: 100%; margin-top: 18px; padding: 13px; border-radius: 10px; color: rgba(255,255,255,.48); background: rgba(255,255,255,.07); font-weight: 600; cursor: not-allowed; }
.security-note { display: flex; gap: 8px; margin-top: 15px !important; color: var(--text-3) !important; font-size: 12px !important; }
.security-note i { color: var(--sky-400); margin-top: 3px; }
@media (max-width: 620px) { .security-dialog { padding: 30px 23px 24px; } .account-menu { position: fixed; left: 16px; right: 16px; bottom: 16px; width: auto; } }
/* ─── Navegación lateral AppSmart ─── */
.app { grid-template-columns: 288px 1fr; }
.app.sidebar-collapsed { grid-template-columns: 92px 1fr; }
.sidebar {
  padding: 16px 12px;
  background: linear-gradient(180deg, #0b2448 0%, #091b35 52%, #07162c 100%);
  border: 1px solid rgba(125,211,252,.12);
  box-shadow: 0 20px 52px rgba(1,8,20,.34), inset 0 1px 0 rgba(255,255,255,.05);
}
.sidebar::before { content: ''; position: absolute; inset: 0 0 auto; height: 116px; border-radius: 20px 20px 0 0; background: radial-gradient(ellipse at 25% 0%, rgba(56,189,248,.16), transparent 70%); pointer-events: none; }
.sidebar-brand { position: relative; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 10px 17px; margin-bottom: 13px; border-bottom-color: rgba(186,230,253,.12); }
.brand-logo-img { height: 42px; max-width: 174px; align-self: auto; }
.sidebar-context { display: inline-flex; align-items: center; width: 100%; gap: 7px; color: rgba(226,242,255,.58); font-size: 11.5px; font-weight: 500; }
.context-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.brand-mark { background: linear-gradient(145deg, #1d72d8, #35bae9); box-shadow: 0 8px 20px rgba(37,99,235,.28); }
.sidebar-nav { gap: 4px; padding: 0 2px 10px; scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.32) transparent; }
.nav-label { display: flex; align-items: center; gap: 8px; padding: 18px 9px 7px; color: rgba(186,230,253,.48); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.nav-label::after { content: ''; height: 1px; flex: 1; background: rgba(186,230,253,.11); }
.nav-item { min-height: 42px; gap: 11px; padding: 10px 11px; border: 1px solid transparent; border-radius: 11px; color: rgba(226,242,255,.7); font-size: 13.5px; transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s; }
.nav-item i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: rgba(186,230,253,.72); background: rgba(148,163,184,.08); font-size: 13px; transition: color .2s, background .2s; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); border-color: rgba(186,230,253,.09); transform: translateX(2px); }
.nav-item:hover i { color: var(--sky-400); background: rgba(56,189,248,.12); }
.nav-item.active { background: linear-gradient(100deg, rgba(37,99,235,.34), rgba(14,165,233,.16)); border-color: rgba(125,211,252,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 7px 18px rgba(3,35,78,.24); }
.nav-item.active i { color: #fff; background: linear-gradient(135deg, #2563eb, #38bdf8); box-shadow: 0 5px 12px rgba(37,99,235,.3); }
.nav-item.active::before { left: -15px; top: 24%; bottom: 24%; width: 4px; box-shadow: 0 0 12px rgba(56,189,248,.8); }
.nav-item:focus-visible, .sidebar-toggle:focus-visible { outline: 2px solid var(--sky-400); outline-offset: 2px; }
.nav-tag { padding: 3px 7px; font-size: 8.5px; color: #dff7ff; background: rgba(56,189,248,.16); border: 1px solid rgba(125,211,252,.2); }
.sidebar-footer { padding: 13px 3px 2px; border-top-color: rgba(186,230,253,.12); }
.user-chip { padding: 9px; border: 1px solid rgba(186,230,253,.09); border-radius: 12px; background: rgba(255,255,255,.035); }
.user-chip:hover, .user-chip:focus-visible { background: rgba(255,255,255,.075); border-color: rgba(125,211,252,.17); }
.user-avatar { width: 34px; height: 34px; background: linear-gradient(145deg, #2773db, #42c4ec); box-shadow: 0 5px 12px rgba(37,99,235,.25); }
.user-name { font-size: 13px; }
.user-role { max-width: 148px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-toggle { top: 27px; right: -13px; width: 28px; height: 28px; color: var(--sky-400); background: #102849; border-color: rgba(125,211,252,.2); }
.sidebar-toggle:hover { color: #fff; background: var(--blue-600); }
.sidebar.collapsed .sidebar-context { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding-bottom: 16px; }
.sidebar.collapsed .nav-item { padding-left: 0; padding-right: 0; }
.sidebar.collapsed .nav-item i { width: 30px; height: 30px; }
.sidebar.collapsed .user-chip { border-color: transparent; background: transparent; }
@media (max-width: 960px) {
  .sidebar { padding: 13px 15px; }
  .sidebar-brand { flex-wrap: nowrap; padding: 3px 0 9px; }
  .sidebar-context { display: none; }
  .brand-logo-img { height: 35px; }
  .nav-item { min-height: 38px; }
  .nav-item i { width: 22px; height: 22px; font-size: 12px; }
}
/* ─── Co-branding y modo compacto de la sidebar ─── */
.client-brand-logo { display: block; width: auto; height: 34px; max-width: 132px; object-fit: contain; object-position: left center; opacity: .82; }
.sidebar-brand { row-gap: 8px; }
.sidebar-brand .client-brand-logo { flex-basis: 100%; margin-top: -2px; }
.brand-mark { font-family: Inter, Arial, sans-serif; font-weight: 800; letter-spacing: -.04em; }
.brand-mark span { line-height: 1; }
.user-avatar { flex: 0 0 34px; width: 34px; height: 34px; aspect-ratio: 1 / 1; border-radius: 50%; }
.sidebar.collapsed .client-brand-logo { display: none; }
.sidebar.collapsed .brand-mark { display: grid; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; }
.sidebar.collapsed .account-caret { display: none; }
.sidebar.collapsed .user-chip { min-width: 0; gap: 0; }
.sidebar.collapsed .user-avatar { flex: 0 0 34px; width: 34px; height: 34px; min-width: 34px; min-height: 34px; max-width: 34px; max-height: 34px; border-radius: 50%; }
@media (max-width: 960px) { .client-brand-logo { display: none; } }
/* ─── Escala de marca Culligan ─── */
.client-brand-logo { height: 76px; max-width: 186px; opacity: .98; }
.brand-mark { background: #123b72; box-shadow: 0 8px 20px rgba(4,26,62,.38); }
.brand-mark .culligan-monogram { display: block; width: 27px; height: 30px; object-fit: contain; }
.sidebar.collapsed .brand-mark { flex-basis: 44px; width: 44px; height: 44px; background: #123b72; border: 1px solid rgba(255,255,255,.14); }
.sidebar.collapsed .brand-mark .culligan-monogram { width: 29px; height: 33px; }
@media (max-width: 960px) { .client-brand-logo { height: 38px; } }
/* ─── Logo Culligan Biofy al doble de escala ─── */
.client-brand-logo { height: 152px; max-width: 250px; }
@media (max-width: 960px) { .client-brand-logo { height: 76px; } }

/* ─── Sidebar fija real en escritorio ─── */
@media (min-width: 961px) {
  .sidebar, .app.sidebar-collapsed .sidebar {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 80;
    height: calc(100vh - 32px);
    margin: 0;
  }
  .main { grid-column: 2; }
  .sidebar { width: 272px; }
  .app.sidebar-collapsed .sidebar { width: 76px; }
}
/* ------------------------------------------------------------
   18 · EXPERIENCIA MÓVIL: LANDING Y APLICACIÓN
   ------------------------------------------------------------ */
@media (max-width: 760px) {
  /* La cabecera comercial ocupa todo el ancho: no queda suspendida ni separada del borde. */
  .landing-nav {
    width: 100%;
    min-height: 64px;
    margin: 0;
    padding: 0 16px;
  }
  .landing-nav::before { width: 100vw; }

  /* La aplicación se transforma en una experiencia de una sola columna. */
  .app, .app.sidebar-collapsed { display: block; min-height: 100dvh; }
  .sidebar, .sidebar.collapsed {
    position: sticky;
    top: 0;
    z-index: 80;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 9px 12px 8px;
    border: 0;
    border-radius: 0;
    background: rgba(7, 23, 45, .96);
    box-shadow: 0 7px 20px rgba(0, 0, 0, .22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .sidebar-brand {
    display: flex;
    align-items: center;
    min-height: 30px;
    margin: 0 0 7px;
    padding: 0 4px;
    border: 0;
  }
  .brand-logo-img, .sidebar.collapsed .brand-logo-img { display: block; width: 119px; height: auto; }
  .client-brand-logo, .brand-mark, .sidebar-context, .sidebar-toggle, .sidebar-footer { display: none !important; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 2px 2px 1px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-label, .nav-item > span:not(.nav-tag), .nav-item .nav-tag { display: none !important; }
  .nav-item, .sidebar.collapsed .nav-item {
    display: grid;
    flex: 0 0 43px;
    place-items: center;
    width: 43px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(186, 230, 253, .1);
    border-radius: 11px;
    background: rgba(255, 255, 255, .035);
  }
  .nav-item i, .sidebar.collapsed .nav-item i { width: 28px; height: 28px; margin: 0; }
  .nav-item.active { border-color: rgba(93, 204, 247, .55); background: rgba(32, 129, 226, .23); }
  .nav-item.active::before { display: none; }

  .main { min-width: 0; width: 100%; }
  .topbar {
    position: static;
    gap: 12px;
    padding: 16px;
    border-bottom-color: rgba(148, 163, 184, .16);
  }
  .topbar-left { width: 100%; }
  .topbar-left h2 { font-size: 19px; letter-spacing: -.35px; }
  .live-badge { margin-top: 5px; font-size: 10px; }
  .topbar-right { width: 100%; justify-content: space-between; gap: 8px; }
  .select-wrap { flex: 1; min-width: 0; }
  .select-wrap select { min-width: 0; width: 100%; }
  .date-range { flex: 0 0 auto; }
  .content { padding: 18px 14px 42px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { min-width: 0; padding: 14px; }
  .kpi-icon { width: 35px; height: 35px; font-size: 14px; }
  .kpi-label { font-size: 10px; }
  .kpi-value { font-size: 19px; }
  .kpi-delta { font-size: 9px; }
  .ai-strip { align-items: flex-start; gap: 11px; padding: 15px; }
  .ai-strip-icon { width: 37px; height: 37px; border-radius: 10px; font-size: 14px; }
  .ai-strip-text { font-size: 13px; line-height: 1.55; }
  .chart-box { height: 245px; }
  .chart-box.tall, .chart-box.xtall { height: 290px; }
  .card { border-radius: 14px; }
  .card-head { gap: 12px; }
  .card-head h3 { font-size: 15px; }
  .data-table { min-width: 590px; }
}

@media (max-width: 420px) {
  .landing-nav { padding: 0 13px; }
  .landing-brand img { width: 122px; }
  .landing-login-link { padding: 8px 9px; }
  .topbar-right { flex-wrap: wrap; }
  .select-wrap { min-width: calc(100% - 48px); }
  .kpi-grid { grid-template-columns: 1fr; }
  .chart-box, .chart-box.tall, .chart-box.xtall { height: 255px; }
}
/* Ajustes finos para comparativa y navegación en móvil. */
@media (max-width: 760px) {
  .sidebar-nav { justify-content: flex-start; }
  .nav-item, .sidebar.collapsed .nav-item {
    justify-content: center;
    align-content: center;
  }
  .nav-item i, .sidebar.collapsed .nav-item i {
    display: grid;
    place-items: center;
    justify-self: center;
    align-self: center;
    margin: 0 !important;
    line-height: 1;
  }

  #comparativa > .grid-2,
  #comparativa .grid-comp { grid-template-columns: 1fr; }
  #comparativa .grid-comp .span-2 { grid-column: auto; }
  #comparativa .camp-card { padding: 18px 16px; }
  #comparativa .camp-head { align-items: flex-start; margin-bottom: 14px; }
  #comparativa .camp-head h3 { font-size: 18px; }
  #comparativa .camp-head p { line-height: 1.45; }
  #comparativa .camp-pill { margin-left: 0; }
  #comparativa .camp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #comparativa .camp-stats > div { min-width: 0; padding: 11px 10px; }
  #comparativa .camp-stats span { font-size: 10px; }
  #comparativa .camp-stats strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; }
  #comparativa .grid-comp { gap: 14px; margin-top: 14px; }
  #comparativa .grid-comp .chart-box.tall { height: 270px; }
  #comparativa .grid-comp .chart-box { height: 240px; }
  #comparativa .table-wrap { margin: 0 -4px; padding: 0 4px 5px; }
  #comparativa .data-table { min-width: 540px; font-size: 12px; }
  #comparativa .data-table th, #comparativa .data-table td { padding: 11px 10px; }
}

@media (max-width: 420px) {
  #comparativa .camp-stats { grid-template-columns: 1fr; }
  #comparativa .grid-comp .chart-box.tall { height: 245px; }
}
/* Correcciones de contenido y controles móviles. */
@media (max-width: 760px) {
  .sidebar-brand { justify-content: space-between; gap: 10px; }
  .client-brand-logo {
    display: block !important;
    flex: 0 1 auto;
    width: auto;
    height: 28px;
    max-width: 128px;
    margin: 0 0 0 auto !important;
    object-fit: contain;
    object-position: right center;
    opacity: .95;
  }

  .topbar-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }
  .date-range-btn { min-height: 38px; padding: 8px 10px; }
  .date-range-btn span, .date-range-btn #date-range-label {
    display: block !important;
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #comparativa, #comparativa .grid, #comparativa .grid > *, #comparativa .card {
    min-width: 0;
    max-width: 100%;
  }
  #comparativa .grid-comp > * { width: 100%; }
  #comparativa .chart-box { overflow: hidden; }
  #comparativa canvas { max-width: 100% !important; }
  #comparativa .table-wrap {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
}

@media (max-width: 420px) {
  .topbar-right { grid-template-columns: minmax(0, 1fr) auto; }
  .topbar-right > .icon-btn { display: none; }
  .select-wrap { grid-column: 1; min-width: 0; }
  .date-range { grid-column: 2; }
  .date-range-btn span, .date-range-btn #date-range-label { max-width: 92px; }
  .client-brand-logo { height: 25px; max-width: 112px; }
}
/* Jerarquía móvil final: marcas visibles y filtros utilizables. */
@media (max-width: 760px) {
  .sidebar-brand {
    min-height: 54px;
    padding: 2px 5px 8px;
  }
  .brand-logo-img, .sidebar.collapsed .brand-logo-img { width: 132px; }
  .client-brand-logo {
    height: 48px;
    max-width: 86px;
    flex: 0 0 auto;
  }

  .topbar-right {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 9px;
  }
  .topbar-right > .icon-btn { display: none; }
  .select-wrap, .date-range { width: 100%; min-width: 0; }
  .select-wrap { padding: 8px 10px; gap: 7px; }
  .select-wrap select { font-size: 12px; }
  .date-range-btn {
    width: 100%;
    min-height: 40px;
    justify-content: center;
    gap: 7px;
    padding: 8px 9px;
    background: rgba(37, 99, 235, .1);
    border-color: rgba(96, 187, 247, .3);
    font-size: 12px;
  }
  .date-range-btn span, .date-range-btn #date-range-label {
    display: block !important;
    max-width: none;
    color: #D8EEFF;
  }
}

@media (max-width: 360px) {
  .topbar-right { grid-template-columns: 1fr; }
  .client-brand-logo { height: 43px; max-width: 77px; }
}
@media (max-width: 760px) {
  .sidebar-brand .client-brand-logo {
    flex-basis: auto;
    margin: 0 0 0 auto !important;
  }
}
/* Cierre de sesión accesible desde la cabecera móvil. */
.mobile-logout {
  display: none;
}

@media (max-width: 760px) {
  .mobile-logout {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    margin-left: 8px;
    padding: 0;
    color: #fecdd3;
    background: rgba(244, 63, 94, .12);
    border: 1px solid rgba(251, 113, 133, .28);
    border-radius: 11px;
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
  }

  .mobile-logout:hover,
  .mobile-logout:focus-visible {
    color: #fff;
    background: rgba(244, 63, 94, .26);
    border-color: rgba(251, 113, 133, .65);
    outline: none;
  }
}
