/* ============================================================================
   LEAD GAME · UI SYSTEM v1.0
   Sistema de diseño unificado para dashboards, apps y contenido.

   Marca:   Primary #CCFF00 · Secondary #121417 · Tipografía Montserrat
   Prefijo: todo va con `lg-` para no chocar con el CSS de GHL / embudos.

   USO
   ---
   1. En el <head>:
      <link rel="preconnect" href="https://fonts.googleapis.com">
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
      <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap" rel="stylesheet">
      <link rel="stylesheet" href="leadgame-ui.css">

      Respaldo si Google Fonts está bloqueado (misma familia, desde jsDelivr):
      https://cdn.jsdelivr.net/npm/@fontsource/montserrat@5/{400,500,600,700,800}.css

   2. Tema: <html data-theme="game"> (por defecto) · "dark" · "light"
      Sin atributo respeta la preferencia del sistema operativo.

   3. Assets de marca — ver LEADGAME-UI.md, sección "Assets públicos".
============================================================================ */

/* ---------------------------------------------------------------------------
   1. PRIMITIVAS — la paleta cruda. No las uses directo en componentes.
--------------------------------------------------------------------------- */
:root {
  /* Rampa Lime — derivada del #CCFF00 de marca */
  --lg-lime-50:  #FAFFE5;
  --lg-lime-100: #F2FFB8;
  --lg-lime-200: #E8FF80;
  --lg-lime-300: #DDFF47;
  --lg-lime-400: #CCFF00;   /* ← Primary de marca */
  --lg-lime-500: #B8E600;
  --lg-lime-600: #9CC400;
  --lg-lime-700: #7A9A00;
  --lg-lime-800: #5C7300;   /* ← texto lime legible sobre blanco */
  --lg-lime-900: #465800;
  --lg-lime-950: #283300;

  /* Rampa Ink — neutros fríos derivados del #121417 */
  --lg-ink-0:    #FFFFFF;
  --lg-ink-25:   #FAFBFB;
  --lg-ink-50:   #F4F6F6;
  --lg-ink-100:  #E8EBEB;
  --lg-ink-200:  #D3D8D9;
  --lg-ink-300:  #B0B7B9;
  --lg-ink-400:  #858E91;
  --lg-ink-500:  #626B6E;
  --lg-ink-600:  #4A5255;
  --lg-ink-700:  #363D40;
  --lg-ink-800:  #22282B;
  --lg-ink-900:  #181C1F;
  --lg-ink-950:  #121417;   /* ← Secondary de marca */
  --lg-ink-1000: #0B0D0F;

  /* Tipografía */
  --lg-font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Mono cargada como webfont: si dependes de las del sistema, el bloque de
     código se ve distinto en cada máquina del equipo (y en Windows suele
     caer en Courier New, que no combina con Montserrat). */
  --lg-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Roboto Mono', monospace;

  /* Escala tipográfica (base 16px, ratio 1.25) */
  --lg-text-2xs: 0.6875rem;  /* 11px · etiquetas, badges */
  --lg-text-xs:  0.75rem;    /* 12px · captions, tabla header */
  --lg-text-sm:  0.875rem;   /* 14px · UI por defecto */
  --lg-text-md:  1rem;       /* 16px · cuerpo de texto */
  --lg-text-lg:  1.125rem;   /* 18px */
  --lg-text-xl:  1.375rem;   /* 22px · título de card */
  --lg-text-2xl: 1.75rem;    /* 28px · título de sección */
  --lg-text-3xl: 2.25rem;    /* 36px · KPI grande */
  --lg-text-4xl: 3rem;       /* 48px · hero */

  --lg-weight-normal: 400;
  --lg-weight-medium: 500;
  --lg-weight-semi:   600;
  --lg-weight-bold:   700;
  --lg-weight-black:  800;

  --lg-leading-tight: 1.15;
  --lg-leading-snug:  1.35;
  --lg-leading-normal:1.6;

  /* Espaciado (base 4px) */
  --lg-sp-1:  0.25rem;
  --lg-sp-2:  0.5rem;
  --lg-sp-3:  0.75rem;
  --lg-sp-4:  1rem;
  --lg-sp-5:  1.25rem;
  --lg-sp-6:  1.5rem;
  --lg-sp-8:  2rem;
  --lg-sp-10: 2.5rem;
  --lg-sp-12: 3rem;
  --lg-sp-16: 4rem;

  /* Radios */
  --lg-radius-sm:   6px;
  --lg-radius-md:   10px;
  --lg-radius-lg:   16px;
  --lg-radius-xl:   22px;
  --lg-radius-full: 999px;

  /* Transiciones */
  --lg-ease: cubic-bezier(.4, 0, .2, 1);
  --lg-fast: 140ms var(--lg-ease);
  --lg-base: 220ms var(--lg-ease);

  /* Layout */
  --lg-sidebar-w: 248px;
  --lg-topbar-h:  64px;
  --lg-container: 1440px;
}

/* ---------------------------------------------------------------------------
   2. TOKENS SEMÁNTICOS — LIGHT (por defecto)
   Estos SÍ se usan en los componentes.
--------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* Superficies */
  --lg-bg:          var(--lg-ink-50);
  --lg-surface:     var(--lg-ink-0);
  --lg-surface-2:   var(--lg-ink-25);
  --lg-surface-3:   var(--lg-ink-100);
  --lg-surface-inv: var(--lg-ink-950);

  /* Bordes */
  --lg-border:        var(--lg-ink-100);
  --lg-border-strong: var(--lg-ink-200);

  /* Texto */
  --lg-fg:        var(--lg-ink-950);
  --lg-fg-muted:  var(--lg-ink-500);
  --lg-fg-subtle: var(--lg-ink-400);
  --lg-fg-inv:    var(--lg-ink-0);

  /* Acento */
  /* Acento — sobre fondo claro el #CCFF00 NO se lee (1,18:1).
     Se oscurece según el tamaño de lo que pintes. Ver tabla abajo. */
  --lg-accent:         var(--lg-lime-400);  /* SOLO como fondo, con texto oscuro encima */
  --lg-accent-hover:   var(--lg-lime-500);
  --lg-on-accent:      var(--lg-ink-950);   /* texto SOBRE el acento */
  --lg-accent-graphic: var(--lg-lime-600);  /* logo, iconos y formas grandes · 2,0:1 */
  --lg-accent-ui:      var(--lg-lime-700);  /* bordes, iconos UI, titulares 24px+ · 3,3:1 */
  --lg-accent-ink:     var(--lg-lime-800);  /* texto normal y links · 5,4:1 (AA) */
  --lg-accent-soft:    var(--lg-lime-100);  /* fondo suave de chips */
  --lg-accent-line:    var(--lg-lime-600);  /* trazos de gráficas */
  --lg-accent-glow:    rgba(204, 255, 0, .30);

  /* CONTRASTE DE LA RAMPA (medido)
     token       hex       sobre blanco   sobre #121417
     lime-400    #CCFF00       1,18            15,70
     lime-500    #B8E600       1,46            12,61
     lime-600    #9CC400       2,04             9,06
     lime-700    #7A9A00       3,26             5,67
     lime-800    #5C7300       5,37             3,43
     Mínimos WCAG: texto normal 4,5:1 · texto 24px+ o bold 18px+ 3:1 · bordes/iconos 3:1 */

  /* Estados */
  --lg-success: #16A34A;  --lg-success-soft: #DCFCE7;
  --lg-warning: #D97706;  --lg-warning-soft: #FEF3C7;
  --lg-danger:  #DC2626;  --lg-danger-soft:  #FEE2E2;
  --lg-info:    #0F766E;  --lg-info-soft:    #CCFBF1;

  /* Sombras (en light sí pesan) */
  --lg-shadow-sm: 0 1px 2px rgba(18, 20, 23, .06);
  --lg-shadow-md: 0 4px 14px rgba(18, 20, 23, .08);
  --lg-shadow-lg: 0 12px 32px rgba(18, 20, 23, .10);

  /* Paleta de gráficas */
  /* CATEGÓRICA — series sin orden entre sí (varias líneas, varias fuentes).
     La escala tonal de verde sirve para datos ORDENADOS (rankings,
     composiciones); para categorías se confunden y hacen falta tonos
     distintos. Estos cuatro primeros son los seguros. */
  --lg-chart-1: #5C7300;   /* oliva  */
  --lg-chart-2: #0F766E;   /* teal   */
  --lg-chart-3: #B45309;   /* ámbar  */
  --lg-chart-4: #C2410C;   /* coral  */
  --lg-chart-5: #5C6B6C;   /* gris verdoso */
  --lg-chart-6: #9CC400;   /* lime medio   */
}

/* ---------------------------------------------------------------------------
   3. TOKENS SEMÁNTICOS — DARK
--------------------------------------------------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;

  --lg-bg:          var(--lg-ink-1000);
  --lg-surface:     var(--lg-ink-950);
  --lg-surface-2:   var(--lg-ink-900);
  --lg-surface-3:   var(--lg-ink-800);
  --lg-surface-inv: var(--lg-ink-0);

  --lg-border:        rgba(255, 255, 255, .08);
  --lg-border-strong: rgba(255, 255, 255, .16);

  --lg-fg:        #E9ECEC;
  --lg-fg-muted:  var(--lg-ink-400);
  --lg-fg-subtle: var(--lg-ink-500);
  --lg-fg-inv:    var(--lg-ink-950);

  /* En dark se invierte: el lime puro es el que mejor contrasta (15,7:1) */
  --lg-accent:         var(--lg-lime-400);
  --lg-accent-hover:   var(--lg-lime-300);
  --lg-on-accent:      var(--lg-ink-950);
  --lg-accent-graphic: var(--lg-lime-400);
  --lg-accent-ui:      var(--lg-lime-400);
  --lg-accent-ink:     var(--lg-lime-300);  /* en dark el texto lime sí brilla */
  --lg-accent-soft:    rgba(204, 255, 0, .12);
  --lg-accent-line:    var(--lg-lime-400);
  --lg-accent-glow:    rgba(204, 255, 0, .38);

  --lg-success: #4ADE80;  --lg-success-soft: rgba(74, 222, 128, .13);
  --lg-warning: #FBBF24;  --lg-warning-soft: rgba(251, 191, 36, .13);
  --lg-danger:  #F87171;  --lg-danger-soft:  rgba(248, 113, 113, .13);
  --lg-info:    #4FE3C1;  --lg-info-soft:    rgba(79, 227, 193, .13);

  /* En dark la sombra no se ve: el volumen lo dan bordes y glow */
  --lg-shadow-sm: 0 1px 2px rgba(0, 0, 0, .40);
  --lg-shadow-md: 0 6px 20px rgba(0, 0, 0, .45);
  --lg-shadow-lg: 0 16px 44px rgba(0, 0, 0, .55);

  --lg-chart-1: #CCFF00;   /* lime     */
  --lg-chart-2: #4FE3C1;   /* turquesa */
  --lg-chart-3: #FBBF24;   /* ámbar    */
  --lg-chart-4: #FF9178;   /* coral    */
  --lg-chart-5: #9FC0C1;   /* gris verdoso */
  --lg-chart-6: #7A9A00;   /* oliva        */
}

/* Sin data-theme: sigue al sistema */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --lg-bg: var(--lg-ink-1000);
    --lg-surface: var(--lg-ink-950);
    --lg-surface-2: var(--lg-ink-900);
    --lg-surface-3: var(--lg-ink-800);
    --lg-surface-inv: var(--lg-ink-0);
    --lg-border: rgba(255,255,255,.08);
    --lg-border-strong: rgba(255,255,255,.16);
    --lg-fg: #E9ECEC;
    --lg-fg-muted: var(--lg-ink-400);
    --lg-fg-subtle: var(--lg-ink-500);
    --lg-fg-inv: var(--lg-ink-950);
    --lg-accent-hover: var(--lg-lime-300);
    --lg-accent-graphic: var(--lg-lime-400);
    --lg-accent-ui: var(--lg-lime-400);
    --lg-accent-ink: var(--lg-lime-300);
    --lg-accent-soft: rgba(204,255,0,.12);
    --lg-accent-line: var(--lg-lime-400);
    --lg-accent-glow: rgba(204,255,0,.38);
    --lg-success: #4ADE80;  --lg-success-soft: rgba(74,222,128,.13);
    --lg-warning: #FBBF24;  --lg-warning-soft: rgba(251,191,36,.13);
    --lg-danger:  #F87171;  --lg-danger-soft:  rgba(248,113,113,.13);
    --lg-info:    #4FE3C1;  --lg-info-soft:    rgba(79,227,193,.13);
    --lg-shadow-sm: 0 1px 2px rgba(0,0,0,.40);
    --lg-shadow-md: 0 6px 20px rgba(0,0,0,.45);
    --lg-shadow-lg: 0 16px 44px rgba(0,0,0,.55);
    --lg-chart-1: #CCFF00; --lg-chart-2: #4FE3C1; --lg-chart-3: #FBBF24;
    --lg-chart-4: #FF9178; --lg-chart-5: #9FC0C1; --lg-chart-6: #7A9A00;
  }
}

/* ---------------------------------------------------------------------------
   3b. TOKENS SEMÁNTICOS — GAME (tema por defecto · el verde petróleo de la app)
   Colores muestreados de la app real:
     sidebar #093F41 · glow del login #08383A · borde del login #031516
   Los grises van teñidos de teal y más claros que en el tema neutro:
   el #858E91 estándar da 3,5:1 sobre el sidebar y ahí es donde el texto
   "desaparece". Estos pasan AA.
--------------------------------------------------------------------------- */
[data-theme="game"] {
  color-scheme: dark;

  /* Rampa petróleo */
  --lg-teal-950: #031314;   /* fondo de página */
  --lg-teal-900: #041B1C;   /* hover */
  --lg-teal-850: #062426;   /* cards y sidebar */
  --lg-teal-800: #0A3335;   /* rieles y tracks */
  --lg-teal-750: #08383A;   /* centro del glow del login */
  --lg-teal-700: #093F41;   /* acento puntual — el petróleo de la app */
  --lg-teal-600: #0C5052;
  --lg-teal-500: #106366;
  --lg-teal-400: #157C80;
  --lg-teal-300: #3E9EA1;

  /* Domina el verde oscuro. El petróleo saturado (#093F41) queda reservado
     para elementos puntuales, no para superficies grandes. */
  --lg-bg:          var(--lg-teal-950);   /* #031314 · casi negro verdoso */
  --lg-surface:     var(--lg-teal-850);   /* #062426 · cards y sidebar */
  --lg-surface-2:   var(--lg-teal-900);   /* #041B1C · hover, más oscuro */
  --lg-surface-3:   var(--lg-teal-800);   /* #0A3335 · rieles, un paso más claro */
  --lg-surface-hi:  var(--lg-teal-700);   /* #093F41 · acentos puntuales */
  --lg-surface-inv: #EAF1F1;

  --lg-border:        rgba(255, 255, 255, .09);
  --lg-border-strong: rgba(255, 255, 255, .19);

  --lg-fg:        #EAF1F1;   /* 10,2:1 sobre el sidebar */
  --lg-fg-muted:  #9FC0C1;   /*  6,0:1 — el que arregla los placeholders */
  --lg-fg-subtle: #7FA6A8;   /*  4,4:1 — mínimo para texto secundario */
  --lg-fg-inv:    var(--lg-teal-900);

  --lg-accent:         var(--lg-lime-400);
  --lg-accent-hover:   var(--lg-lime-300);
  --lg-on-accent:      #052223;
  --lg-accent-graphic: var(--lg-lime-400);
  --lg-accent-ui:      var(--lg-lime-400);
  --lg-accent-ink:     var(--lg-lime-300);
  --lg-accent-soft:    rgba(204, 255, 0, .13);
  --lg-accent-line:    var(--lg-lime-400);
  --lg-accent-glow:    rgba(204, 255, 0, .34);

  --lg-success: #5BE49B;  --lg-success-soft: rgba(91, 228, 155, .14);
  --lg-warning: #FBBF24;  --lg-warning-soft: rgba(251, 191, 36, .14);
  --lg-danger:  #FF8A8A;  --lg-danger-soft:  rgba(255, 138, 138, .14);
  --lg-info:    #4FE3C1;  --lg-info-soft:    rgba(79, 227, 193, .14);

  --lg-shadow-sm: 0 1px 2px rgba(0, 12, 12, .45);
  --lg-shadow-md: 0 6px 22px rgba(0, 12, 12, .50);
  --lg-shadow-lg: 0 18px 48px rgba(0, 12, 12, .60);

  --lg-chart-1: #CCFF00;   /* lime     */
  --lg-chart-2: #4FE3C1;   /* turquesa */
  --lg-chart-3: #FBBF24;   /* ámbar    */
  --lg-chart-4: #FF9178;   /* coral    */
  --lg-chart-5: #9FC0C1;   /* gris verdoso */
  --lg-chart-6: #7A9A00;   /* oliva        */
}

/* Fondos con degradado — el glow radial del login de la app.
   Va en el <body> o en una sección completa, nunca dentro de una card:
   dos degradados anidados se pelean y ensucian el foco. */
.lg-glow {
  background:
    radial-gradient(ellipse 90% 70% at 50% 25%, #0A2F31 0%, #051D1E 45%, #020E0F 100%);
  background-attachment: fixed;
}
[data-theme="dark"] .lg-glow {
  background: radial-gradient(ellipse 90% 70% at 50% 30%, #1A1D1F 0%, #0E1011 48%, #070808 100%);
  background-attachment: fixed;
}
[data-theme="light"] .lg-glow {
  background: radial-gradient(ellipse 90% 70% at 50% 30%, #FFFFFF 0%, #F4F6F6 55%, #E8EBEB 100%);
  background-attachment: fixed;
}

/* Borde superior lime en cards sobre fondo teal — separa sin agregar líneas */
.lg-card--edge { position: relative; overflow: hidden; }
.lg-card--edge::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--lg-accent), transparent 70%);
}

/* ---------------------------------------------------------------------------
   4. RESET Y BASE
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* Red de seguridad: si algún control nativo se escapa del sistema,
   al menos usa el lime y no el azul por defecto del navegador. */
:root { accent-color: var(--lg-accent); }

/* El atributo `hidden` vale 0-1-0 igual que una clase, así que cualquier
   componente con `display:flex` lo anula sin querer. Esto lo blinda. */
[hidden] { display: none !important; }

/* Los controles de formulario NO heredan font-family del padre: el navegador
   les impone la suya. Sin esta línea, cualquier <button>, <input> o <select>
   sin clase del sistema sale en Arial y nadie entiende por qué. */
button, input, select, textarea, optgroup {
  font-family: inherit;
  letter-spacing: inherit;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body.lg, .lg-root {
  margin: 0;
  background: var(--lg-bg);
  color: var(--lg-fg);
  font-family: var(--lg-font);
  font-size: var(--lg-text-md);
  font-weight: var(--lg-weight-normal);
  line-height: var(--lg-leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--lg-base), color var(--lg-base);
}

/* Foco visible en todo — accesibilidad no negociable */
.lg-root :focus-visible,
body.lg :focus-visible {
  outline: 2px solid var(--lg-accent);
  outline-offset: 2px;
  border-radius: var(--lg-radius-sm);
}

::selection { background: var(--lg-accent); color: var(--lg-on-accent); }

/* Scrollbar */
.lg-root ::-webkit-scrollbar, body.lg ::-webkit-scrollbar { width: 10px; height: 10px; }
.lg-root ::-webkit-scrollbar-track, body.lg ::-webkit-scrollbar-track { background: transparent; }
.lg-root ::-webkit-scrollbar-thumb, body.lg ::-webkit-scrollbar-thumb {
  background: var(--lg-border-strong); border-radius: var(--lg-radius-full);
  border: 2px solid transparent; background-clip: content-box;
}
.lg-root ::-webkit-scrollbar-thumb:hover, body.lg ::-webkit-scrollbar-thumb:hover { background: var(--lg-fg-subtle); background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------------------
   5. TIPOGRAFÍA
--------------------------------------------------------------------------- */
.lg-h1, .lg-h2, .lg-h3, .lg-h4 {
  margin: 0; font-weight: var(--lg-weight-bold);
  line-height: var(--lg-leading-tight); letter-spacing: -.02em; color: var(--lg-fg);
}
.lg-h1 { font-size: var(--lg-text-3xl); font-weight: var(--lg-weight-black); letter-spacing: -.03em; }
.lg-h2 { font-size: var(--lg-text-2xl); }
.lg-h3 { font-size: var(--lg-text-xl); }
.lg-h4 { font-size: var(--lg-text-lg); font-weight: var(--lg-weight-semi); letter-spacing: -.01em; }

.lg-display {
  font-size: var(--lg-text-4xl); font-weight: var(--lg-weight-black);
  line-height: 1.02; letter-spacing: -.035em; margin: 0;
}

/* Eyebrow: la etiqueta chiquita en mayúsculas sobre los títulos */
.lg-eyebrow {
  display: inline-block; font-size: var(--lg-text-2xs);
  font-weight: var(--lg-weight-bold); text-transform: uppercase;
  letter-spacing: .14em; color: var(--lg-accent-ink);
}
.lg-eyebrow--muted { color: var(--lg-fg-subtle); }

.lg-lead     { font-size: var(--lg-text-lg); color: var(--lg-fg-muted); line-height: var(--lg-leading-snug); margin: 0; }
.lg-muted    { color: var(--lg-fg-muted); }
.lg-subtle   { color: var(--lg-fg-subtle); }
.lg-caption  { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }
.lg-num      { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.lg-mono     { font-family: var(--lg-font-mono); font-size: .92em; letter-spacing: -.01em; }

.lg-link {
  color: var(--lg-accent-ink); text-decoration: none;
  border-bottom: 1.5px solid var(--lg-accent-glow);
  transition: border-color var(--lg-fast), color var(--lg-fast);
}
.lg-link:hover { border-bottom-color: var(--lg-accent); }

/* Marcador lime — resalte de marca sobre una palabra */
.lg-mark {
  background: linear-gradient(transparent 62%, var(--lg-accent-glow) 62%);
  padding: 0 .12em; font-weight: var(--lg-weight-semi);
}

/* ---------------------------------------------------------------------------
   6. PROSA — para documentos, guías, contenido largo
   Envuelve el contenido en <div class="lg-prose"> y listo.
--------------------------------------------------------------------------- */
.lg-prose { max-width: 72ch; color: var(--lg-fg); font-size: var(--lg-text-md); line-height: var(--lg-leading-normal); }
.lg-prose > * + * { margin-top: var(--lg-sp-4); }
.lg-prose h1, .lg-prose h2, .lg-prose h3, .lg-prose h4 {
  font-weight: var(--lg-weight-bold); line-height: var(--lg-leading-tight);
  letter-spacing: -.02em; margin: var(--lg-sp-10) 0 var(--lg-sp-3);
}
.lg-prose h1 { font-size: var(--lg-text-3xl); font-weight: var(--lg-weight-black); }
.lg-prose h2 { font-size: var(--lg-text-2xl); padding-bottom: var(--lg-sp-2); border-bottom: 1px solid var(--lg-border); }
.lg-prose h3 { font-size: var(--lg-text-xl); }
.lg-prose h4 { font-size: var(--lg-text-lg); }
.lg-prose h1:first-child, .lg-prose h2:first-child, .lg-prose h3:first-child { margin-top: 0; }
.lg-prose p { margin: 0; }
.lg-prose a { color: var(--lg-accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.lg-prose strong { font-weight: var(--lg-weight-bold); color: var(--lg-fg); }
.lg-prose ul, .lg-prose ol { margin: 0; padding-left: var(--lg-sp-5); }
.lg-prose li { margin-bottom: var(--lg-sp-2); }
.lg-prose li::marker { color: var(--lg-accent-ink); font-weight: var(--lg-weight-bold); }
.lg-prose blockquote {
  margin: 0; padding: var(--lg-sp-3) var(--lg-sp-5);
  border-left: 3px solid var(--lg-accent); background: var(--lg-surface-2);
  border-radius: 0 var(--lg-radius-md) var(--lg-radius-md) 0; color: var(--lg-fg-muted);
}
.lg-prose code {
  font-family: var(--lg-font-mono); font-size: .875em;
  background: var(--lg-surface-3); padding: .15em .4em; border-radius: var(--lg-radius-sm);
}
.lg-prose pre {
  background: var(--lg-ink-950); color: var(--lg-ink-100); padding: var(--lg-sp-4);
  border-radius: var(--lg-radius-md); overflow-x: auto; border: 1px solid var(--lg-border);
}
.lg-prose pre code { background: none; padding: 0; color: inherit; }
.lg-prose hr { border: 0; border-top: 1px solid var(--lg-border); margin: var(--lg-sp-10) 0; }
.lg-prose img { max-width: 100%; height: auto; border-radius: var(--lg-radius-md); }

/* ---------------------------------------------------------------------------
   7. LAYOUT — app shell
--------------------------------------------------------------------------- */
.lg-app { display: grid; grid-template-columns: var(--lg-sidebar-w) 1fr; min-height: 100vh; }
.lg-container { width: 100%; max-width: var(--lg-container); margin: 0 auto; padding: 0 var(--lg-sp-6); }
.lg-main { padding: var(--lg-sp-6); min-width: 0; }

.lg-sidebar {
  background: var(--lg-surface); border-right: 1px solid var(--lg-border);
  padding: var(--lg-sp-5) var(--lg-sp-4); display: flex; flex-direction: column; gap: var(--lg-sp-6);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.lg-sidebar__brand { display: flex; align-items: center; gap: var(--lg-sp-2); font-weight: var(--lg-weight-black); font-size: var(--lg-text-lg); letter-spacing: -.02em; }
.lg-sidebar__group { display: flex; flex-direction: column; gap: 2px; }
.lg-sidebar__label { font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold); text-transform: uppercase; letter-spacing: .12em; color: var(--lg-fg-subtle); padding: 0 var(--lg-sp-3) var(--lg-sp-2); }

.lg-navitem {
  display: flex; align-items: center; gap: var(--lg-sp-3);
  padding: var(--lg-sp-3); border-radius: var(--lg-radius-md);
  font-size: var(--lg-text-sm); font-weight: var(--lg-weight-medium);
  color: var(--lg-fg-muted); text-decoration: none; cursor: pointer;
  transition: background var(--lg-fast), color var(--lg-fast);
}
.lg-navitem:hover { background: var(--lg-surface-3); color: var(--lg-fg); }
.lg-navitem--active {
  background: var(--lg-accent); color: var(--lg-on-accent);
  font-weight: var(--lg-weight-bold);
  box-shadow: 0 0 0 1px var(--lg-accent), 0 6px 18px var(--lg-accent-glow);
}
.lg-navitem--active:hover { background: var(--lg-accent-hover); color: var(--lg-on-accent); }
.lg-navitem__badge { margin-left: auto; font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold); background: var(--lg-surface-3); color: var(--lg-fg-muted); padding: 2px 7px; border-radius: var(--lg-radius-full); }
.lg-navitem--active .lg-navitem__badge { background: rgba(18,20,23,.16); color: var(--lg-on-accent); }

.lg-topbar {
  height: var(--lg-topbar-h); display: flex; align-items: center; gap: var(--lg-sp-4);
  padding: 0 var(--lg-sp-6); background: var(--lg-surface);
  border-bottom: 1px solid var(--lg-border); position: sticky; top: 0; z-index: 30;
}

.lg-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--lg-sp-4); flex-wrap: wrap; margin-bottom: var(--lg-sp-6); }

/* Grid de dashboard */
.lg-grid { display: grid; gap: var(--lg-sp-4); grid-template-columns: repeat(12, 1fr); }
/* Las doce completas. Si falta una clase el navegador la ignora y la card
   cae a una sola columna — se ve como una tira angosta. */
.lg-col-1  { grid-column: span 1; }
.lg-col-2  { grid-column: span 2; }
.lg-col-3  { grid-column: span 3; }
.lg-col-4  { grid-column: span 4; }
.lg-col-5  { grid-column: span 5; }
.lg-col-6  { grid-column: span 6; }
.lg-col-7  { grid-column: span 7; }
.lg-col-8  { grid-column: span 8; }
.lg-col-9  { grid-column: span 9; }
.lg-col-10 { grid-column: span 10; }
.lg-col-11 { grid-column: span 11; }
.lg-col-12 { grid-column: span 12; }

/* Tablet: todo lo estrecho pasa a media pantalla, lo ancho a completa */
@media (max-width: 1100px) {
  .lg-col-1, .lg-col-2, .lg-col-3, .lg-col-4 { grid-column: span 6; }
  .lg-col-5, .lg-col-7, .lg-col-8, .lg-col-9,
  .lg-col-10, .lg-col-11 { grid-column: span 12; }
}
/* Móvil: una columna, sin excepciones */
@media (max-width: 860px) {
  .lg-app { grid-template-columns: 1fr; }
  .lg-sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--lg-border); }
  .lg-main { padding: var(--lg-sp-4); }
  [class*="lg-col-"] { grid-column: span 12; }
}

/* ---------------------------------------------------------------------------
   8. CARDS
--------------------------------------------------------------------------- */
.lg-card {
  background: var(--lg-surface); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-lg); padding: var(--lg-sp-5);
  box-shadow: var(--lg-shadow-sm);
  transition: border-color var(--lg-fast), box-shadow var(--lg-fast), transform var(--lg-fast);
}
.lg-card--flat { box-shadow: none; }
.lg-card--hover:hover { border-color: var(--lg-border-strong); box-shadow: var(--lg-shadow-md); transform: translateY(-2px); }
.lg-card--accent { border-color: var(--lg-accent); box-shadow: 0 0 0 3px var(--lg-accent-glow); }
.lg-card--inverse { background: var(--lg-surface-inv); color: var(--lg-fg-inv); border-color: transparent; }
.lg-card--inverse .lg-muted { color: rgba(255,255,255,.6); }
[data-theme="light"] .lg-card--inverse .lg-muted { color: rgba(255,255,255,.6); }

/* Card en gradiente lime — para el bloque destacado (upsell, plan, CTA) */
.lg-card--spot {
  background: linear-gradient(135deg, var(--lg-lime-400) 0%, var(--lg-lime-600) 100%);
  color: var(--lg-ink-950); border-color: transparent;
  box-shadow: 0 10px 30px var(--lg-accent-glow);
}
.lg-card--spot .lg-h3, .lg-card--spot .lg-h2 { color: var(--lg-ink-950); }

.lg-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--lg-sp-3); margin-bottom: var(--lg-sp-4); }
.lg-card__title { font-size: var(--lg-text-lg); font-weight: var(--lg-weight-bold); letter-spacing: -.01em; margin: 0; }
.lg-card__foot { margin-top: var(--lg-sp-4); padding-top: var(--lg-sp-4); border-top: 1px solid var(--lg-border); }

/* ---------------------------------------------------------------------------
   9. KPI / STAT
--------------------------------------------------------------------------- */
.lg-stat { display: flex; flex-direction: column; gap: var(--lg-sp-2); }
.lg-stat__label { font-size: var(--lg-text-xs); font-weight: var(--lg-weight-semi); color: var(--lg-fg-muted); text-transform: uppercase; letter-spacing: .08em; }
.lg-stat__value {
  font-size: var(--lg-text-3xl); font-weight: var(--lg-weight-black);
  line-height: 1; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; font-feature-settings: 'tnum';
}
.lg-stat__meta { display: flex; align-items: center; gap: var(--lg-sp-2); font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }

.lg-delta { display: inline-flex; align-items: center; gap: 4px; font-weight: var(--lg-weight-bold); font-size: var(--lg-text-xs); font-variant-numeric: tabular-nums; }
.lg-delta--up   { color: var(--lg-success); }
.lg-delta--down { color: var(--lg-danger); }
.lg-delta--flat { color: var(--lg-fg-subtle); }

/* ---------------------------------------------------------------------------
   10. BOTONES
--------------------------------------------------------------------------- */
.lg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--lg-sp-2);
  font-family: var(--lg-font); font-size: var(--lg-text-sm); font-weight: var(--lg-weight-bold);
  letter-spacing: -.005em; line-height: 1;
  padding: 0 var(--lg-sp-5); height: 42px;
  border: 1px solid transparent; border-radius: var(--lg-radius-full);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--lg-fast), color var(--lg-fast), border-color var(--lg-fast), box-shadow var(--lg-fast), transform var(--lg-fast);
}
.lg-btn:active { transform: translateY(1px); }
.lg-btn:disabled, .lg-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }

.lg-btn--primary { background: var(--lg-accent); color: var(--lg-on-accent); }
.lg-btn--primary:hover:not(:disabled) { background: var(--lg-accent-hover); box-shadow: 0 6px 20px var(--lg-accent-glow); }

.lg-btn--secondary { background: var(--lg-surface-inv); color: var(--lg-fg-inv); }
.lg-btn--secondary:hover:not(:disabled) { opacity: .88; }

.lg-btn--outline { background: transparent; color: var(--lg-fg); border-color: var(--lg-border-strong); }
.lg-btn--outline:hover:not(:disabled) { border-color: var(--lg-accent); color: var(--lg-accent-ink); }

.lg-btn--ghost { background: transparent; color: var(--lg-fg-muted); }
.lg-btn--ghost:hover:not(:disabled) { background: var(--lg-surface-3); color: var(--lg-fg); }

.lg-btn--danger { background: var(--lg-danger); color: #fff; }
[data-theme="dark"] .lg-btn--danger { color: var(--lg-ink-950); }

.lg-btn--sm { height: 34px; padding: 0 var(--lg-sp-4); font-size: var(--lg-text-xs); }
.lg-btn--lg { height: 52px; padding: 0 var(--lg-sp-8); font-size: var(--lg-text-md); }
.lg-btn--block { width: 100%; }
.lg-btn--icon { width: 40px; height: 40px; padding: 0; border-radius: var(--lg-radius-md); }

/* ---------------------------------------------------------------------------
   11. BADGES Y CHIPS
--------------------------------------------------------------------------- */
.lg-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: var(--lg-radius-full);
  background: var(--lg-surface-3); color: var(--lg-fg-muted); white-space: nowrap;
}
.lg-badge--accent  { background: var(--lg-accent-soft);  color: var(--lg-accent-ink); }
.lg-badge--solid   { background: var(--lg-accent);       color: var(--lg-on-accent); }
.lg-badge--success { background: var(--lg-success-soft); color: var(--lg-success); }
.lg-badge--warning { background: var(--lg-warning-soft); color: var(--lg-warning); }
.lg-badge--danger  { background: var(--lg-danger-soft);  color: var(--lg-danger); }
.lg-badge--info    { background: var(--lg-info-soft);    color: var(--lg-info); }

.lg-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ---------------------------------------------------------------------------
   12. TABLAS
--------------------------------------------------------------------------- */
.lg-table-wrap { overflow-x: auto; border-radius: var(--lg-radius-md); -webkit-overflow-scrolling: touch; }
.lg-table { width: 100%; border-collapse: collapse; font-size: var(--lg-text-sm); }
.lg-table thead th {
  text-align: left; font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold);
  text-transform: uppercase; letter-spacing: .1em; color: var(--lg-fg-subtle);
  padding: var(--lg-sp-3) var(--lg-sp-3); border-bottom: 1px solid var(--lg-border); white-space: nowrap;
}
.lg-table tbody td { padding: var(--lg-sp-3); border-bottom: 1px solid var(--lg-border); vertical-align: middle; }
.lg-table tbody tr:last-child td { border-bottom: 0; }
.lg-table tbody tr { transition: background var(--lg-fast); }
.lg-table tbody tr:hover { background: var(--lg-surface-2); }
.lg-table .num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; font-weight: var(--lg-weight-semi); }
.lg-table--compact tbody td, .lg-table--compact thead th { padding: var(--lg-sp-2) var(--lg-sp-3); }

/* ---------------------------------------------------------------------------
   13. FORMULARIOS
--------------------------------------------------------------------------- */
.lg-field { display: flex; flex-direction: column; gap: var(--lg-sp-2); }
.lg-label { font-size: var(--lg-text-xs); font-weight: var(--lg-weight-bold); color: var(--lg-fg); letter-spacing: .01em; }
.lg-hint  { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }
.lg-error { font-size: var(--lg-text-xs); color: var(--lg-danger); font-weight: var(--lg-weight-medium); }

.lg-input, .lg-select, .lg-textarea {
  width: 100%; font-family: var(--lg-font); font-size: var(--lg-text-sm); color: var(--lg-fg);
  background: var(--lg-surface-2); border: 1px solid var(--lg-border-strong);
  border-radius: var(--lg-radius-md); padding: 0 var(--lg-sp-4); height: 42px;
  transition: border-color var(--lg-fast), box-shadow var(--lg-fast), background var(--lg-fast);
}
.lg-textarea { height: auto; min-height: 110px; padding: var(--lg-sp-3) var(--lg-sp-4); line-height: var(--lg-leading-snug); resize: vertical; }
.lg-input::placeholder, .lg-textarea::placeholder { color: var(--lg-fg-subtle); }
.lg-input:hover, .lg-select:hover, .lg-textarea:hover { border-color: var(--lg-fg-subtle); }
.lg-input:focus, .lg-select:focus, .lg-textarea:focus {
  outline: none; border-color: var(--lg-accent);
  box-shadow: 0 0 0 3px var(--lg-accent-glow); background: var(--lg-surface);
}
.lg-input[aria-invalid="true"] { border-color: var(--lg-danger); }

.lg-select {
  appearance: none; -webkit-appearance: none; padding-right: var(--lg-sp-8); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23858E91' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--lg-sp-4) center;
}

/* LA LISTA QUE ABRE UN <select> NO SE PUEDE ESTILIZAR DE FORMA CONFIABLE.
   La dibuja el sistema operativo. `color-scheme` y los estilos de `option`
   ayudan en algunos navegadores, pero Chrome en Windows sigue pintándola
   blanca con resaltado azul y no hay CSS que lo cambie.

   Solución del sistema: `lgEnhanceSelects()` en leadgame-ui.js convierte
   cualquier <select class="lg-select"> en un desplegable propio, y deja el
   nativo en móvil (donde la rueda del sistema es mejor experiencia).
   Lo de abajo es la red de seguridad para cuando el script no corre. */
[data-theme="game"] .lg-select,
[data-theme="dark"] .lg-select { color-scheme: dark; }
[data-theme="light"] .lg-select { color-scheme: light; }
.lg-select option {
  background: var(--lg-surface);
  color: var(--lg-fg);
  font-family: var(--lg-font);
}
.lg-select option:checked { background: var(--lg-accent); color: var(--lg-on-accent); }

/* Checkbox y radio */
.lg-check { display: flex; align-items: flex-start; gap: var(--lg-sp-3); cursor: pointer; font-size: var(--lg-text-sm); }
.lg-check input[type="checkbox"], .lg-check input[type="radio"],
.lg-option input[type="checkbox"], .lg-option input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.8px solid var(--lg-border-strong); background: var(--lg-surface-2);
  border-radius: var(--lg-radius-sm); cursor: pointer; position: relative;
  transition: background var(--lg-fast), border-color var(--lg-fast);
}
.lg-check input[type="radio"], .lg-option input[type="radio"] { border-radius: 50%; }
.lg-check input:checked, .lg-option input:checked { background: var(--lg-accent); border-color: var(--lg-accent); }
.lg-check input[type="checkbox"]:checked::after,
.lg-option input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid var(--lg-on-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.lg-check input[type="radio"]:checked::after,
.lg-option input[type="radio"]:checked::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--lg-on-accent);
}
.lg-check--done > span { color: var(--lg-fg-muted); text-decoration: line-through; text-decoration-color: var(--lg-accent-glow); }

/* Switch */
.lg-switch { display: inline-flex; align-items: center; gap: var(--lg-sp-3); cursor: pointer; }
.lg-switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 44px; height: 25px; border-radius: var(--lg-radius-full); background: var(--lg-surface-3); border: 1px solid var(--lg-border-strong); position: relative; cursor: pointer; transition: background var(--lg-fast), border-color var(--lg-fast); }
.lg-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--lg-fg-subtle); transition: transform var(--lg-fast), background var(--lg-fast); }
.lg-switch input:checked { background: var(--lg-accent); border-color: var(--lg-accent); }
.lg-switch input:checked::after { transform: translateX(19px); background: var(--lg-on-accent); }

/* ---------------------------------------------------------------------------
   14. PROGRESO
--------------------------------------------------------------------------- */
.lg-progress { height: 10px; background: var(--lg-surface-3); border-radius: var(--lg-radius-full); overflow: hidden; }
.lg-progress__bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--lg-lime-500), var(--lg-lime-400));
  border-radius: var(--lg-radius-full); transition: width 400ms var(--lg-ease);
}
.lg-progress--thin { height: 6px; }

.lg-meter { display: flex; align-items: center; gap: var(--lg-sp-3); }
.lg-meter .lg-progress { flex: 1; }
.lg-meter__pct { font-weight: var(--lg-weight-black); font-size: var(--lg-text-sm); color: var(--lg-accent-ink); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

/* ---------------------------------------------------------------------------
   15. AVISOS (callouts) — para documentos y estados vacíos
--------------------------------------------------------------------------- */
.lg-note {
  display: flex; gap: var(--lg-sp-3);
  padding: var(--lg-sp-4); border-radius: 0 var(--lg-radius-md) var(--lg-radius-md) 0;
  border-left: 3px solid var(--lg-accent); background: var(--lg-accent-soft);
  font-size: var(--lg-text-sm); line-height: var(--lg-leading-snug);
}
.lg-note strong { font-weight: var(--lg-weight-bold); }
.lg-note--warning { border-left-color: var(--lg-warning); background: var(--lg-warning-soft); }
.lg-note--danger  { border-left-color: var(--lg-danger);  background: var(--lg-danger-soft); }
.lg-note--info    { border-left-color: var(--lg-info);    background: var(--lg-info-soft); }
.lg-note--success { border-left-color: var(--lg-success); background: var(--lg-success-soft); }

/* ---------------------------------------------------------------------------
   16. TABS
--------------------------------------------------------------------------- */
.lg-tabs { display: flex; gap: var(--lg-sp-1); border-bottom: 1px solid var(--lg-border); }
.lg-tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  font-family: var(--lg-font); font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi);
  color: var(--lg-fg-muted); padding: var(--lg-sp-3) var(--lg-sp-4);
  cursor: pointer; margin-bottom: -1px; transition: color var(--lg-fast), border-color var(--lg-fast);
}
.lg-tab:hover { color: var(--lg-fg); }
.lg-tab[aria-selected="true"] { color: var(--lg-fg); border-bottom-color: var(--lg-accent); font-weight: var(--lg-weight-bold); }

/* Segmented control */
.lg-segment { display: inline-flex; padding: 3px; gap: 2px; background: var(--lg-surface-3); border-radius: var(--lg-radius-full); }
.lg-segment button {
  background: none; border: 0; font-family: var(--lg-font);
  font-size: var(--lg-text-xs); font-weight: var(--lg-weight-bold); color: var(--lg-fg-muted);
  padding: var(--lg-sp-2) var(--lg-sp-4); border-radius: var(--lg-radius-full); cursor: pointer;
  transition: background var(--lg-fast), color var(--lg-fast);
}
.lg-segment button[aria-pressed="true"] { background: var(--lg-surface); color: var(--lg-fg); box-shadow: var(--lg-shadow-sm); }

/* ---------------------------------------------------------------------------
   17. AVATAR Y LISTA DE PERSONAS
--------------------------------------------------------------------------- */
.lg-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lg-accent); color: var(--lg-on-accent);
  font-weight: var(--lg-weight-bold); font-size: var(--lg-text-xs);
  letter-spacing: .02em; object-fit: cover; overflow: hidden;
}
.lg-avatar--sm { width: 28px; height: 28px; font-size: var(--lg-text-2xs); }
.lg-avatar--lg { width: 48px; height: 48px; font-size: var(--lg-text-sm); }
.lg-avatar--muted { background: var(--lg-surface-3); color: var(--lg-fg-muted); }

.lg-person { display: flex; align-items: center; gap: var(--lg-sp-3); padding: var(--lg-sp-2) 0; }
.lg-person__name { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi); line-height: 1.3; }
.lg-person__meta { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); line-height: 1.3; }

/* ---------------------------------------------------------------------------
   18. ESTADOS: vacío y carga
--------------------------------------------------------------------------- */
.lg-empty { text-align: center; padding: var(--lg-sp-12) var(--lg-sp-6); color: var(--lg-fg-muted); }
.lg-empty__title { font-size: var(--lg-text-lg); font-weight: var(--lg-weight-bold); color: var(--lg-fg); margin: 0 0 var(--lg-sp-2); }

.lg-skeleton {
  background: linear-gradient(90deg, var(--lg-surface-3) 25%, var(--lg-surface-2) 50%, var(--lg-surface-3) 75%);
  background-size: 200% 100%; animation: lg-shimmer 1.4s infinite;
  border-radius: var(--lg-radius-sm); height: 14px;
}
@keyframes lg-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------------------------------------------------------------------
   19. UTILIDADES
--------------------------------------------------------------------------- */
.lg-flex   { display: flex; }
.lg-between{ display: flex; align-items: center; justify-content: space-between; }
.lg-center { display: flex; align-items: center; }
.lg-wrap   { flex-wrap: wrap; }
.lg-col    { display: flex; flex-direction: column; }
.lg-gap-1  { gap: var(--lg-sp-1); } .lg-gap-2 { gap: var(--lg-sp-2); }
.lg-gap-3  { gap: var(--lg-sp-3); } .lg-gap-4 { gap: var(--lg-sp-4); }
.lg-gap-6  { gap: var(--lg-sp-6); } .lg-gap-8 { gap: var(--lg-sp-8); }
.lg-mt-2 { margin-top: var(--lg-sp-2); } .lg-mt-4 { margin-top: var(--lg-sp-4); }
.lg-mt-6 { margin-top: var(--lg-sp-6); } .lg-mt-8 { margin-top: var(--lg-sp-8); }
.lg-mb-2 { margin-bottom: var(--lg-sp-2); } .lg-mb-4 { margin-bottom: var(--lg-sp-4); }
.lg-mb-6 { margin-bottom: var(--lg-sp-6); } .lg-mb-8 { margin-bottom: var(--lg-sp-8); }
.lg-grow { flex: 1; } .lg-auto { margin-left: auto; }
.lg-hr { border: 0; border-top: 1px solid var(--lg-border); margin: var(--lg-sp-6) 0; }
.lg-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------------------
   20. GRÁFICAS SIN LIBRERÍA — SVG + CSS puro
   Para donuts, anillos, barras y sparklines no necesitas cargar 200kb.
   Todo hereda los tokens, así que cambia solo con el tema.
--------------------------------------------------------------------------- */

/* --- Anillo / donut de progreso ---------------------------------------
   <div class="lg-ring" style="--p:74">
     <svg viewBox="0 0 36 36">
       <circle class="lg-ring__track" cx="18" cy="18" r="15.9" pathLength="100"/>
       <circle class="lg-ring__fill"  cx="18" cy="18" r="15.9" pathLength="100"/>
     </svg>
     <div class="lg-ring__center"><b>74%</b><span>de la meta</span></div>
   </div>                                                                  */
.lg-ring { position: relative; width: 100%; max-width: 200px; aspect-ratio: 1; }
.lg-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.lg-ring circle { fill: none; stroke-width: 3.6; }
.lg-ring__track { stroke: var(--lg-surface-3); }
.lg-ring__fill {
  stroke: var(--lg-accent-line);
  stroke-linecap: round;                    /* ← esto da el look orgánico */
  stroke-dasharray: var(--p, 0) 100;
  transition: stroke-dasharray 900ms var(--lg-ease);
}
.lg-ring--thin circle { stroke-width: 2.2; }
.lg-ring--thick circle { stroke-width: 5.5; }
.lg-ring__center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 2px;
}
.lg-ring__center b {
  font-size: var(--lg-text-2xl); font-weight: var(--lg-weight-black);
  letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums;
}
.lg-ring__center span { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }

/* Arco tipo velocímetro — mismo anillo pero abierto abajo (270°) */
.lg-ring--gauge svg { transform: rotate(135deg); }
.lg-ring--gauge .lg-ring__track { stroke-dasharray: 75 100; }
.lg-ring--gauge .lg-ring__fill  { stroke-dasharray: calc(var(--p, 0) * .75) 100; }

/* --- Barras verticales -------------------------------------------------
   <div class="lg-bars">
     <div class="lg-bar" style="--h:40%"><span></span><em>L</em></div>
     <div class="lg-bar lg-bar--pending" style="--h:70%"><span></span><em>M</em></div>
   </div>                                                                  */
.lg-bars { display: flex; align-items: flex-end; gap: var(--lg-sp-3); height: 150px; }
.lg-bar {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; gap: var(--lg-sp-2); height: 100%; position: relative;
}
.lg-bar > span:not(.lg-tip):not(.lg-bar__tip) {
  width: 100%; max-width: 44px; height: var(--h, 30%); min-height: 10px;
  background: var(--lg-accent-line); border-radius: var(--lg-radius-lg);
  transition: height 700ms var(--lg-ease), background var(--lg-fast);
}
.lg-bar > em {
  font-style: normal; font-size: var(--lg-text-xs);
  font-weight: var(--lg-weight-semi); color: var(--lg-fg-subtle);
}
.lg-bar--strong > span:not(.lg-tip) { background: var(--lg-ink-800); }
[data-theme="dark"] .lg-bar--strong > span:not(.lg-tip) { background: var(--lg-lime-700); }
.lg-bar--soft > span:not(.lg-tip) { background: var(--lg-accent-soft); }

/* Rayado diagonal para "pendiente / proyectado" */
.lg-bar--pending > span:not(.lg-tip) {
  background: repeating-linear-gradient(
    -45deg,
    var(--lg-surface-3) 0 5px,
    transparent 5px 10px
  );
  box-shadow: inset 0 0 0 1px var(--lg-border);
}
/* Etiqueta fija sobre una barra. Va SIEMPRE con clase propia: si es un
   <span> pelado, los selectores de barra se lo comen y lo pintan como columna. */
.lg-bar__tip {
  position: absolute; bottom: calc(var(--h, 30%) + 34px); left: 50%;
  transform: translateX(-50%); z-index: 4;
  font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold);
  background: var(--lg-accent); color: var(--lg-on-accent);
  padding: 3px 8px; border-radius: var(--lg-radius-full); white-space: nowrap;
}

/* --- Barras horizontales (ranking) ------------------------------------- */
.lg-hbar { display: flex; flex-direction: column; gap: var(--lg-sp-3); }
.lg-hbar__row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: var(--lg-sp-3); font-size: var(--lg-text-sm); }
.lg-hbar__track { height: 22px; background: var(--lg-surface-3); border-radius: var(--lg-radius-full); overflow: hidden; }
.lg-hbar__fill { height: 100%; width: var(--w, 0%); background: var(--lg-accent-line); border-radius: var(--lg-radius-full); transition: width 700ms var(--lg-ease); }
.lg-hbar__val { font-weight: var(--lg-weight-bold); font-variant-numeric: tabular-nums; font-size: var(--lg-text-sm); }

/* --- Sparkline / área -------------------------------------------------- */
.lg-spark { width: 100%; display: block; overflow: visible; }
.lg-spark__line { fill: none; stroke: var(--lg-accent-line); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.lg-spark__area { fill: var(--lg-accent-glow); }
.lg-spark__dot  { fill: var(--lg-accent); stroke: var(--lg-surface); stroke-width: 3; }

/* --- Leyenda ----------------------------------------------------------- */
.lg-legend { display: flex; flex-wrap: wrap; gap: var(--lg-sp-3) var(--lg-sp-5); }
.lg-legend__item { display: inline-flex; align-items: center; gap: var(--lg-sp-2); font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }
.lg-legend__swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.lg-legend__value { font-weight: var(--lg-weight-bold); color: var(--lg-fg); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   21. BARRAS CON RIEL
   El riel gris de fondo muestra el máximo posible. Hace que una barra baja
   se lea como "le falta" y no como "no hay datos".
--------------------------------------------------------------------------- */
.lg-bars--track .lg-bar { justify-content: flex-end; }
.lg-bars--track .lg-bar > span:not(.lg-tip):not(.lg-bar__tip) {
  position: relative; height: 100%;
  background: var(--lg-surface-3); overflow: hidden;
}
.lg-bars--track .lg-bar > span:not(.lg-tip):not(.lg-bar__tip)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--h, 30%); background: var(--lg-accent-line);
  border-radius: var(--lg-radius-lg);
  transition: height 700ms var(--lg-ease);
}
.lg-bars--track .lg-bar--muted > span:not(.lg-tip)::after { background: var(--lg-fg-subtle); opacity: .45; }
.lg-bars--track .lg-bar--dark > span:not(.lg-tip)::after { background: var(--lg-ink-800); }
[data-theme="dark"] .lg-bars--track .lg-bar--dark > span::after { background: var(--lg-lime-700); }

/* Tooltip flotante sobre una barra */
.lg-tip {
  position: absolute; bottom: calc(var(--h, 30%) + 16px); left: 50%;
  transform: translateX(-50%);
  background: var(--lg-ink-950); color: #fff;
  padding: var(--lg-sp-2) var(--lg-sp-3); border-radius: var(--lg-radius-md);
  font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold);
  white-space: nowrap; box-shadow: var(--lg-shadow-md); z-index: 5;
}
[data-theme="dark"] .lg-tip { background: var(--lg-ink-800); border: 1px solid var(--lg-border-strong); }
.lg-tip::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--lg-ink-950);
}
[data-theme="dark"] .lg-tip::after { border-top-color: var(--lg-ink-800); }

/* ---------------------------------------------------------------------------
   22. DESPLEGABLES (dropdown)
--------------------------------------------------------------------------- */
.lg-dd { position: relative; display: inline-block; }
.lg-dd__toggle {
  display: inline-flex; align-items: center; gap: var(--lg-sp-2);
  font-family: var(--lg-font); font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi);
  color: var(--lg-fg); background: var(--lg-surface);
  border: 1px solid var(--lg-border-strong); border-radius: var(--lg-radius-md);
  padding: 0 var(--lg-sp-4); height: 40px; cursor: pointer; white-space: nowrap;
  transition: border-color var(--lg-fast), background var(--lg-fast);
}
.lg-dd__toggle:hover { border-color: var(--lg-fg-subtle); }
.lg-dd__toggle[aria-expanded="true"] { border-color: var(--lg-accent); box-shadow: 0 0 0 3px var(--lg-accent-glow); }
.lg-dd__toggle::after {
  content: ""; width: 8px; height: 8px; margin-left: 2px;
  border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform var(--lg-fast);
}
.lg-dd__toggle[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
.lg-dd__count {
  background: var(--lg-accent); color: var(--lg-on-accent);
  font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-black);
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--lg-radius-full);
  display: inline-flex; align-items: center; justify-content: center;
}

.lg-dd__panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 260px; max-height: 380px; overflow-y: auto;
  background: var(--lg-surface); border: 1px solid var(--lg-border-strong);
  border-radius: var(--lg-radius-lg); box-shadow: var(--lg-shadow-lg);
  padding: var(--lg-sp-2);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--lg-fast), transform var(--lg-fast), visibility var(--lg-fast);
}
.lg-dd__panel--right { left: auto; right: 0; }
.lg-dd__panel--wide { min-width: 340px; }
.lg-dd.is-open .lg-dd__panel { opacity: 1; visibility: visible; transform: translateY(0); }
.lg-dd__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--lg-sp-3);
  padding: var(--lg-sp-2) var(--lg-sp-3) var(--lg-sp-3);
  border-bottom: 1px solid var(--lg-border); margin-bottom: var(--lg-sp-2);
}
.lg-dd__foot {
  display: flex; gap: var(--lg-sp-2); padding: var(--lg-sp-3) var(--lg-sp-2) var(--lg-sp-1);
  border-top: 1px solid var(--lg-border); margin-top: var(--lg-sp-2);
}
.lg-dd__link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--lg-font); font-size: var(--lg-text-xs);
  font-weight: var(--lg-weight-bold); color: var(--lg-accent-ink);
}
.lg-dd__link:hover { text-decoration: underline; }

/* Fila de opción — toda la fila es clicable, no solo el toggle */
.lg-option {
  display: flex; align-items: center; gap: var(--lg-sp-3);
  padding: var(--lg-sp-2) var(--lg-sp-3); border-radius: var(--lg-radius-md);
  cursor: pointer; font-size: var(--lg-text-sm); user-select: none;
  transition: background var(--lg-fast);
}
.lg-option:hover { background: var(--lg-surface-2); }
.lg-option__text { flex: 1; }
.lg-option__meta { font-size: var(--lg-text-xs); color: var(--lg-fg-subtle); font-variant-numeric: tabular-nums; }
.lg-option input[type="checkbox"] { flex-shrink: 0; }

/* Switch compacto para listas de filtros */
.lg-switch--sm input { width: 36px; height: 20px; }
.lg-switch--sm input::after { width: 14px; height: 14px; }
.lg-switch--sm input:checked::after { transform: translateX(16px); }

/* Chips de filtro activo */
.lg-chips { display: flex; flex-wrap: wrap; gap: var(--lg-sp-2); }
.lg-chip {
  display: inline-flex; align-items: center; gap: var(--lg-sp-2);
  background: var(--lg-accent-soft); color: var(--lg-accent-ink);
  font-size: var(--lg-text-xs); font-weight: var(--lg-weight-semi);
  padding: 5px 6px 5px 12px; border-radius: var(--lg-radius-full);
}
.lg-chip__x {
  background: none; border: 0; cursor: pointer; color: inherit;
  width: 18px; height: 18px; border-radius: 50%; line-height: 1;
  display: grid; place-items: center; font-size: 13px; opacity: .6;
}
.lg-chip__x:hover { opacity: 1; background: rgba(0,0,0,.10); }
[data-theme="dark"] .lg-chip__x:hover { background: rgba(255,255,255,.14); }

/* ---------------------------------------------------------------------------
   23. ACORDEÓN — para paneles de filtros largos
--------------------------------------------------------------------------- */
.lg-acc { border-bottom: 1px solid var(--lg-border); }
.lg-acc:last-child { border-bottom: 0; }
.lg-acc__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: var(--lg-sp-3); background: none; border: 0; cursor: pointer;
  font-family: var(--lg-font); font-size: var(--lg-text-sm); font-weight: var(--lg-weight-bold);
  color: var(--lg-fg); padding: var(--lg-sp-4) var(--lg-sp-2); text-align: left;
}
.lg-acc__head::after {
  content: ""; width: 8px; height: 8px; flex-shrink: 0;
  border-right: 1.8px solid var(--lg-fg-muted); border-bottom: 1.8px solid var(--lg-fg-muted);
  transform: rotate(45deg) translateY(-2px); transition: transform var(--lg-fast);
}
.lg-acc__head[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
.lg-acc__body { display: none; padding: 0 0 var(--lg-sp-4); }
.lg-acc__head[aria-expanded="true"] + .lg-acc__body { display: block; }

/* ---------------------------------------------------------------------------
   24. CALENDARIO Y RANGO DE FECHAS
--------------------------------------------------------------------------- */
.lg-cal { width: 300px; }
.lg-cal__nav { display: flex; align-items: center; justify-content: space-between; padding: var(--lg-sp-2) var(--lg-sp-1) var(--lg-sp-4); }
.lg-cal__month { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-bold); }
.lg-cal__arrow {
  width: 30px; height: 30px; border-radius: var(--lg-radius-md);
  background: none; border: 1px solid var(--lg-border); color: var(--lg-fg-muted);
  cursor: pointer; display: grid; place-items: center; font-size: 14px; line-height: 1;
  transition: border-color var(--lg-fast), color var(--lg-fast);
}
.lg-cal__arrow:hover { border-color: var(--lg-accent); color: var(--lg-accent-ink); }

.lg-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.lg-cal__dow {
  text-align: center; font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold);
  color: var(--lg-fg-subtle); text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: var(--lg-sp-2);
}
.lg-cal__day {
  aspect-ratio: 1; border: 0; background: none; cursor: pointer;
  font-family: var(--lg-font); font-size: var(--lg-text-xs); font-weight: var(--lg-weight-semi);
  color: var(--lg-fg); border-radius: var(--lg-radius-md);
  font-variant-numeric: tabular-nums;
  transition: background var(--lg-fast), color var(--lg-fast);
}
.lg-cal__day:hover:not(:disabled) { background: var(--lg-surface-3); }
.lg-cal__day--out { color: var(--lg-fg-subtle); opacity: .5; }
.lg-cal__day--today { box-shadow: inset 0 0 0 1.5px var(--lg-border-strong); }
/* Rango: los extremos en lime sólido, el medio en lime suave */
.lg-cal__day--in {
  background: var(--lg-accent-soft); color: var(--lg-accent-ink);
  border-radius: 0;
}
.lg-cal__day--start, .lg-cal__day--end {
  background: var(--lg-accent) !important; color: var(--lg-on-accent) !important;
  font-weight: var(--lg-weight-black);
}
.lg-cal__day--start { border-radius: var(--lg-radius-md) 0 0 var(--lg-radius-md); }
.lg-cal__day--end   { border-radius: 0 var(--lg-radius-md) var(--lg-radius-md) 0; }
.lg-cal__day--start.lg-cal__day--end { border-radius: var(--lg-radius-md); }

/* Campos de fecha del rango */
.lg-daterange__fields { display: flex; align-items: center; gap: var(--lg-sp-2); margin-bottom: var(--lg-sp-4); }
.lg-daterange__fields .lg-input { height: 38px; text-align: center; font-size: var(--lg-text-xs); font-weight: var(--lg-weight-semi); font-variant-numeric: tabular-nums; padding: 0 var(--lg-sp-2); }
.lg-daterange__sep { color: var(--lg-fg-subtle); font-size: var(--lg-text-xs); }

/* Atajos de período */
.lg-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.lg-preset {
  background: var(--lg-surface-2); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-md); cursor: pointer;
  font-family: var(--lg-font); font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-bold);
  color: var(--lg-fg-muted); padding: var(--lg-sp-2) 0;
  transition: background var(--lg-fast), color var(--lg-fast), border-color var(--lg-fast);
}
.lg-preset:hover { border-color: var(--lg-accent); color: var(--lg-fg); }
.lg-preset[aria-pressed="true"] { background: var(--lg-accent); border-color: var(--lg-accent); color: var(--lg-on-accent); }

/* ---------------------------------------------------------------------------
   25. LOGO
   Dos archivos oficiales: uno para fondo oscuro, otro para fondo claro.
   Pones los dos en el HTML y el CSS muestra el correcto según el tema —
   sin JavaScript, sin parpadeo al cargar.

   <a class="lg-logo" href="/" aria-label="Lead Game">
     <img class="lg-logo__on-dark"  src="[logo fondo oscuro]" alt="Lead Game">
     <img class="lg-logo__on-light" src="[logo fondo claro]"  alt="" aria-hidden="true">
   </a>
--------------------------------------------------------------------------- */
:root { --lg-logo-h: 34px; }

.lg-logo { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.lg-logo img { display: block; height: var(--lg-logo-h); width: auto; }
.lg-logo--sm { --lg-logo-h: 26px; }
.lg-logo--lg { --lg-logo-h: 52px; }

/* Por defecto (Game y Dark) manda la versión para fondo oscuro.
   OJO con la especificidad: `.lg-logo img` vale 0-1-1, así que estos
   selectores tienen que igualarla o el display:none nunca se aplica. */
.lg-logo img.lg-logo__on-light { display: none; }

[data-theme="light"] .lg-logo img.lg-logo__on-dark  { display: none; }
[data-theme="light"] .lg-logo img.lg-logo__on-light { display: block; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .lg-logo img.lg-logo__on-dark  { display: none; }
  :root:not([data-theme]) .lg-logo img.lg-logo__on-light { display: block; }
}

/* ---------------------------------------------------------------------------
   26. ESCALA TONAL DE BARRAS
   Cuatro tonos del mismo verde para diferenciar series sin meter colores
   ajenos a la marca. Todos pasan 3:1 contra el riel, que es el mínimo para
   elementos gráficos. Más de cuatro categorías → usa --lg-chart-1..6.
--------------------------------------------------------------------------- */
:root {
  --lg-tone-1: #E8FF80;   /* el más claro — la barra protagonista */
  --lg-tone-2: #CCFF00;   /* lime de marca */
  --lg-tone-3: #9CC400;
  --lg-tone-4: #6E8C1E;   /* el más apagado — la cola del ranking */

  /* Degradados. El vertical va de claro arriba a oscuro abajo: da sensación
     de volumen, como si la barra recibiera luz desde arriba. */
  --lg-grad-v: linear-gradient(180deg, #E8FF80 0%, #CCFF00 45%, #8FB800 100%);
  --lg-grad-h: linear-gradient(90deg, #8FB800 0%, #CCFF00 55%, #E8FF80 100%);
}
[data-theme="light"] {
  --lg-tone-1: #7A9A00;
  --lg-tone-2: #9CC400;
  --lg-tone-3: #B8E600;
  --lg-tone-4: #D7E88A;
  --lg-grad-v: linear-gradient(180deg, #B8E600 0%, #9CC400 55%, #7A9A00 100%);
  --lg-grad-h: linear-gradient(90deg, #7A9A00 0%, #9CC400 55%, #B8E600 100%);
}

/* Barras verticales */
.lg-bar--t1 > span, .lg-bars--track .lg-bar--t1 > span:not(.lg-tip)::after { background: var(--lg-tone-1); }
.lg-bar--t2 > span, .lg-bars--track .lg-bar--t2 > span:not(.lg-tip)::after { background: var(--lg-tone-2); }
.lg-bar--t3 > span, .lg-bars--track .lg-bar--t3 > span:not(.lg-tip)::after { background: var(--lg-tone-3); }
.lg-bar--t4 > span, .lg-bars--track .lg-bar--t4 > span:not(.lg-tip)::after { background: var(--lg-tone-4); }

/* Degradado — el look "tech". Úsalo en la serie principal, no en todas:
   si todas las barras brillan, ninguna destaca. */
.lg-bars--grad .lg-bar > span:not(.lg-tip),
.lg-bar--grad > span { background: var(--lg-grad-v); }
.lg-bars--track.lg-bars--grad .lg-bar > span:not(.lg-tip) { background: var(--lg-surface-3); }
.lg-bars--track.lg-bars--grad .lg-bar > span:not(.lg-tip)::after,
.lg-bars--track .lg-bar--grad > span:not(.lg-tip)::after { background: var(--lg-grad-v); }

/* Barras horizontales — el ranking se degrada solo de tono.
   Primero = más claro, último = más apagado. La jerarquía se lee sin leer
   los números. */
.lg-hbar--tonal .lg-hbar__row:nth-child(1) .lg-hbar__fill { background: var(--lg-tone-1); }
.lg-hbar--tonal .lg-hbar__row:nth-child(2) .lg-hbar__fill { background: var(--lg-tone-2); }
.lg-hbar--tonal .lg-hbar__row:nth-child(3) .lg-hbar__fill { background: var(--lg-tone-3); }
.lg-hbar--tonal .lg-hbar__row:nth-child(4) .lg-hbar__fill { background: var(--lg-tone-4); }
.lg-hbar--tonal .lg-hbar__row:nth-child(n+5) .lg-hbar__fill { background: var(--lg-tone-4); opacity: .6; }

.lg-hbar--grad .lg-hbar__fill { background: var(--lg-grad-h); }

/* Leyenda tonal */
.lg-legend__swatch--t1 { background: var(--lg-tone-1); }
.lg-legend__swatch--t2 { background: var(--lg-tone-2); }
.lg-legend__swatch--t3 { background: var(--lg-tone-3); }
.lg-legend__swatch--t4 { background: var(--lg-tone-4); }

/* Anillos y sparklines con degradado */
.lg-ring--grad .lg-ring__fill { stroke: url(#lgGrad); }

/* ---------------------------------------------------------------------------
   27. EMBUDO
   El gráfico más importante para una agencia: dónde se cae la gente.
   Cada paso muestra su volumen y la caída respecto al anterior.
--------------------------------------------------------------------------- */
.lg-funnel { display: flex; flex-direction: column; gap: var(--lg-sp-1); }
.lg-funnel__step { display: grid; grid-template-columns: 130px 1fr 96px; align-items: center; gap: var(--lg-sp-3); }
.lg-funnel__name { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi); }
.lg-funnel__track { height: 38px; display: flex; align-items: center; }
.lg-funnel__bar {
  height: 100%; width: var(--w, 100%);
  background: var(--lg-tone-2); border-radius: var(--lg-radius-md);
  display: flex; align-items: center; padding: 0 var(--lg-sp-3);
  font-size: var(--lg-text-xs); font-weight: var(--lg-weight-bold);
  color: var(--lg-on-accent); transition: width 700ms var(--lg-ease);
  min-width: 54px;
}
.lg-funnel__step:nth-child(1) .lg-funnel__bar { background: var(--lg-tone-1); }
.lg-funnel__step:nth-child(2) .lg-funnel__bar { background: var(--lg-tone-2); }
.lg-funnel__step:nth-child(3) .lg-funnel__bar { background: var(--lg-tone-3); }
.lg-funnel__step:nth-child(n+4) .lg-funnel__bar { background: var(--lg-tone-4); }
.lg-funnel__val { text-align: right; font-weight: var(--lg-weight-bold); font-variant-numeric: tabular-nums; font-size: var(--lg-text-sm); }
/* La caída entre pasos — el dato que de verdad importa */
.lg-funnel__drop {
  grid-column: 2 / 3; font-size: var(--lg-text-2xs); color: var(--lg-fg-subtle);
  padding: 2px 0 2px var(--lg-sp-3); font-variant-numeric: tabular-nums;
}
.lg-funnel__drop b { color: var(--lg-danger); font-weight: var(--lg-weight-bold); }

/* ---------------------------------------------------------------------------
   28. BARRAS APILADAS — composición de un total
--------------------------------------------------------------------------- */
.lg-stack { display: flex; height: 30px; border-radius: var(--lg-radius-md); overflow: hidden; background: var(--lg-surface-3); }
.lg-stack__seg { height: 100%; width: var(--w, 0%); transition: width 700ms var(--lg-ease); }
.lg-stack__seg:nth-child(1) { background: var(--lg-tone-1); }
.lg-stack__seg:nth-child(2) { background: var(--lg-tone-2); }
.lg-stack__seg:nth-child(3) { background: var(--lg-tone-3); }
.lg-stack__seg:nth-child(4) { background: var(--lg-tone-4); }
.lg-stack--thin { height: 10px; }

/* ---------------------------------------------------------------------------
   29. MAPA DE CALOR — actividad por día y hora
--------------------------------------------------------------------------- */
.lg-heat { display: grid; gap: 3px; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); }
.lg-heat__cell {
  aspect-ratio: 1; border-radius: 3px; min-width: 11px;
  background: var(--lg-accent);
  opacity: calc(.08 + (var(--v, 0) * .92));   /* --v de 0 a 1 */
  transition: transform var(--lg-fast);
}
.lg-heat__cell:hover { transform: scale(1.35); }
.lg-heat__cell[data-v="0"] { background: var(--lg-surface-3); opacity: 1; }
.lg-heat-scale { display: flex; align-items: center; gap: 4px; font-size: var(--lg-text-2xs); color: var(--lg-fg-subtle); }
.lg-heat-scale i { width: 11px; height: 11px; border-radius: 3px; background: var(--lg-accent); }

/* ---------------------------------------------------------------------------
   30. TABLA DE POSICIONES
--------------------------------------------------------------------------- */
.lg-board { display: flex; flex-direction: column; }
.lg-board__row {
  display: grid; grid-template-columns: 34px auto 1fr auto; align-items: center;
  gap: var(--lg-sp-3); padding: var(--lg-sp-3) var(--lg-sp-2);
  border-bottom: 1px solid var(--lg-border); transition: background var(--lg-fast);
}
.lg-board__row:last-child { border-bottom: 0; }
.lg-board__row:hover { background: var(--lg-surface-2); }
.lg-board__rank {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: var(--lg-text-xs); font-weight: var(--lg-weight-black);
  background: var(--lg-surface-3); color: var(--lg-fg-muted); font-variant-numeric: tabular-nums;
}
.lg-board__row--top .lg-board__rank { background: var(--lg-accent); color: var(--lg-on-accent); }
.lg-board__row--me { background: var(--lg-accent-soft); border-radius: var(--lg-radius-md); }
.lg-board__name { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi); }
.lg-board__meta { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }
.lg-board__val { font-weight: var(--lg-weight-black); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   31. LÍNEA DE TIEMPO / ACTIVIDAD
--------------------------------------------------------------------------- */
.lg-feed { display: flex; flex-direction: column; }
.lg-feed__item { display: grid; grid-template-columns: 24px 1fr; gap: var(--lg-sp-3); padding-bottom: var(--lg-sp-5); position: relative; }
.lg-feed__item::before {
  content: ""; position: absolute; left: 11px; top: 20px; bottom: 0;
  width: 2px; background: var(--lg-border);
}
.lg-feed__item:last-child { padding-bottom: 0; }
.lg-feed__item:last-child::before { display: none; }
.lg-feed__dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lg-surface-3); color: var(--lg-fg-muted); font-size: 11px;
  z-index: 1; flex-shrink: 0;
}
.lg-feed__item--accent .lg-feed__dot { background: var(--lg-accent); color: var(--lg-on-accent); }
.lg-feed__body { font-size: var(--lg-text-sm); line-height: var(--lg-leading-snug); padding-top: 2px; }
.lg-feed__time { font-size: var(--lg-text-xs); color: var(--lg-fg-subtle); margin-top: 2px; }

/* ---------------------------------------------------------------------------
   32. KPI CON MINIGRÁFICA
--------------------------------------------------------------------------- */
.lg-stat--spark { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: var(--lg-sp-4); }
.lg-stat--spark .lg-spark { width: 96px; height: 42px; }

/* ---------------------------------------------------------------------------
   33. AVISO FLOTANTE (toast)
--------------------------------------------------------------------------- */
.lg-toasts { position: fixed; bottom: var(--lg-sp-6); right: var(--lg-sp-6); z-index: 200; display: flex; flex-direction: column; gap: var(--lg-sp-3); max-width: 380px; }
.lg-toast {
  display: flex; align-items: flex-start; gap: var(--lg-sp-3);
  background: var(--lg-surface); border: 1px solid var(--lg-border-strong);
  border-left: 3px solid var(--lg-accent); border-radius: var(--lg-radius-md);
  padding: var(--lg-sp-4); box-shadow: var(--lg-shadow-lg);
  font-size: var(--lg-text-sm); animation: lg-toast-in 260ms var(--lg-ease);
}
@keyframes lg-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.lg-toast--success { border-left-color: var(--lg-success); }
.lg-toast--danger  { border-left-color: var(--lg-danger); }
.lg-toast--warning { border-left-color: var(--lg-warning); }
.lg-toast__x { margin-left: auto; background: none; border: 0; color: var(--lg-fg-subtle); cursor: pointer; font-size: 16px; line-height: 1; }

/* ---------------------------------------------------------------------------
   34. VENTANA MODAL
--------------------------------------------------------------------------- */
.lg-modal { position: fixed; inset: 0; z-index: 150; display: none; place-items: center; padding: var(--lg-sp-4); }
.lg-modal.is-open { display: grid; }
.lg-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(3px); }
.lg-modal__panel {
  position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--lg-surface); border: 1px solid var(--lg-border-strong);
  border-radius: var(--lg-radius-lg); padding: var(--lg-sp-6);
  box-shadow: var(--lg-shadow-lg); animation: lg-modal-in 200ms var(--lg-ease);
}
@keyframes lg-modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.lg-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--lg-sp-4); margin-bottom: var(--lg-sp-4); }
.lg-modal__foot { display: flex; gap: var(--lg-sp-3); justify-content: flex-end; margin-top: var(--lg-sp-6); }

/* ---------------------------------------------------------------------------
   35. PAGINACIÓN Y MIGAS
--------------------------------------------------------------------------- */
.lg-pager { display: flex; align-items: center; gap: var(--lg-sp-2); }
.lg-pager button {
  min-width: 34px; height: 34px; padding: 0 var(--lg-sp-2);
  background: none; border: 1px solid var(--lg-border); border-radius: var(--lg-radius-md);
  color: var(--lg-fg-muted); font-family: var(--lg-font); font-size: var(--lg-text-xs);
  font-weight: var(--lg-weight-bold); cursor: pointer; font-variant-numeric: tabular-nums;
  transition: border-color var(--lg-fast), color var(--lg-fast), background var(--lg-fast);
}
.lg-pager button:hover:not(:disabled) { border-color: var(--lg-accent); color: var(--lg-fg); }
.lg-pager button[aria-current="page"] { background: var(--lg-accent); border-color: var(--lg-accent); color: var(--lg-on-accent); }
.lg-pager button:disabled { opacity: .35; cursor: not-allowed; }

.lg-crumbs { display: flex; align-items: center; gap: var(--lg-sp-2); font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }
.lg-crumbs a { color: var(--lg-fg-muted); text-decoration: none; }
.lg-crumbs a:hover { color: var(--lg-accent-ink); }
.lg-crumbs span[aria-current] { color: var(--lg-fg); font-weight: var(--lg-weight-semi); }
.lg-crumbs li + li::before { content: "/"; margin-right: var(--lg-sp-2); color: var(--lg-fg-subtle); }

/* ---------------------------------------------------------------------------
   36. SIDEBAR DE MARCA — la columna verde oscura, en los tres temas
   Como en app.leadgame.co: el panel izquierdo se mantiene oscuro aunque el
   contenido esté en claro. Es el ancla de marca; sin ella, en Light el panel
   se vuelve un dashboard genérico.

   Funciona redefiniendo los tokens DENTRO del sidebar. Como las variables CSS
   heredan, todo lo que va adentro (navegación, badges, cards) se recolorea
   solo — no hay que tocar ni una clase hija.
--------------------------------------------------------------------------- */
.lg-sidebar--brand {
  --lg-bg:            #031314;
  --lg-surface:       #062426;
  --lg-surface-2:     #0A3335;
  --lg-surface-3:     #0A3335;
  --lg-surface-hi:    #093F41;
  --lg-border:        rgba(255, 255, 255, .09);
  --lg-border-strong: rgba(255, 255, 255, .19);
  --lg-fg:            #EAF1F1;
  --lg-fg-muted:      #9FC0C1;
  --lg-fg-subtle:     #7FA6A8;
  --lg-accent-ink:    #DDFF47;
  --lg-accent-soft:   rgba(204, 255, 0, .13);
  --lg-tone-1: #E8FF80; --lg-tone-2: #CCFF00; --lg-tone-3: #9CC400; --lg-tone-4: #6E8C1E;

  background: var(--lg-surface);
  color: var(--lg-fg);
  border-right: 1px solid rgba(255, 255, 255, .07);
}
/* El logo de adentro siempre es el de fondo oscuro, incluso en tema Light */
[data-theme="light"] .lg-sidebar--brand .lg-logo img.lg-logo__on-dark  { display: block; }
[data-theme="light"] .lg-sidebar--brand .lg-logo img.lg-logo__on-light { display: none; }

/* En Light el contenido queda claro y la columna oscura: el contraste entre
   los dos es más fuerte, así que el borde sobra y la sombra sí ayuda. */
[data-theme="light"] .lg-sidebar--brand { border-right: 0; box-shadow: 2px 0 16px rgba(3, 19, 20, .10); }

/* ---------------------------------------------------------------------------
   37. FRANJA DE KPI — métricas compactas en una sola línea
   Cuando hay más de 4 números y no sobra alto de pantalla.
--------------------------------------------------------------------------- */
.lg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--lg-sp-3); }
.lg-kpi {
  display: flex; align-items: center; gap: var(--lg-sp-3);
  background: var(--lg-surface); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-md); padding: var(--lg-sp-3) var(--lg-sp-4);
}
.lg-kpi__icon {
  width: 36px; height: 36px; border-radius: var(--lg-radius-md); flex-shrink: 0;
  display: grid; place-items: center; font-size: 15px;
  background: var(--lg-surface-3); color: var(--lg-accent-ink);
}
.lg-kpi--hot .lg-kpi__icon { background: var(--lg-accent); color: var(--lg-on-accent); }
.lg-kpi__label { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); line-height: 1.3; }
.lg-kpi__value { font-size: var(--lg-text-lg); font-weight: var(--lg-weight-black); letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   38. MOSAICO DE CONTADORES — números grandes con acción
--------------------------------------------------------------------------- */
.lg-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--lg-sp-3); }
.lg-tile {
  background: var(--lg-surface); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-lg); padding: var(--lg-sp-4);
  display: flex; flex-direction: column; gap: var(--lg-sp-3);
  text-decoration: none; color: inherit; position: relative;
  transition: border-color var(--lg-fast), transform var(--lg-fast);
}
a.lg-tile:hover { border-color: var(--lg-accent); transform: translateY(-2px); }
.lg-tile__num {
  width: 58px; height: 58px; border-radius: var(--lg-radius-lg);
  display: grid; place-items: center;
  font-size: var(--lg-text-2xl); font-weight: var(--lg-weight-black);
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  background: var(--lg-tone-2); color: var(--lg-on-accent);
}
.lg-tile:nth-child(2) .lg-tile__num { background: var(--lg-tone-3); }
.lg-tile:nth-child(3) .lg-tile__num { background: var(--lg-tone-4); color: #F2F7EA; }
.lg-tile:nth-child(4) .lg-tile__num { background: var(--lg-surface-3); color: var(--lg-fg); }
.lg-tile__label { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi); }
.lg-tile__meta { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }
.lg-tile__flag {
  position: absolute; top: var(--lg-sp-3); right: var(--lg-sp-3);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--lg-radius-full);
  background: var(--lg-danger); color: #fff; font-size: var(--lg-text-2xs);
  font-weight: var(--lg-weight-black); display: grid; place-items: center;
}
[data-theme="game"] .lg-tile__flag, [data-theme="dark"] .lg-tile__flag { color: #1A0B0B; }

/* ---------------------------------------------------------------------------
   39. FICHA CON ARCO — porcentaje diminuto junto a una etiqueta
--------------------------------------------------------------------------- */
.lg-chip-arc {
  display: inline-flex; align-items: center; gap: var(--lg-sp-3);
  background: var(--lg-surface-2); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-full); padding: var(--lg-sp-2) var(--lg-sp-4) var(--lg-sp-2) var(--lg-sp-2);
}
.lg-chip-arc__ring { width: 34px; height: 34px; flex-shrink: 0; position: relative; }
.lg-chip-arc__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lg-chip-arc__ring circle { fill: none; stroke-width: 4; }
.lg-chip-arc__track { stroke: var(--lg-surface-3); }
.lg-chip-arc__fill { stroke: var(--lg-accent-line); stroke-linecap: round; stroke-dasharray: var(--p, 0) 100; }
.lg-chip-arc__t { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi); line-height: 1.2; }
.lg-chip-arc__s { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); line-height: 1.2; }

/* ---------------------------------------------------------------------------
   40. ESCALA EN BARRAS HORIZONTALES
   Los porcentajes de referencia debajo del ranking. Sin escala, una barra
   larga solo dice "más que las otras"; con escala dice cuánto.
--------------------------------------------------------------------------- */
.lg-hbar--scale { padding-bottom: var(--lg-sp-2); }
.lg-hbar__axis {
  display: grid; grid-template-columns: 110px 1fr auto; gap: var(--lg-sp-3);
  margin-top: var(--lg-sp-2);
}
.lg-hbar__ticks { display: flex; justify-content: space-between; font-size: var(--lg-text-2xs); color: var(--lg-fg-subtle); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   41. ICONOGRAFÍA
   Los emojis se ven distintos en cada sistema operativo (Windows los pinta
   planos, Apple con degradado, Android otra cosa) y no se pueden recolorear.
   En producto van iconos SVG de una sola librería.

   Librería oficial: Lucide (licencia ISC, gratis y comercial).
     <script src="https://unpkg.com/lucide@latest"></script>
     <i data-lucide="chart-column" class="lg-icon"></i>
     <script>lucide.createIcons();</script>

   Todos los iconos heredan el color del texto, así que se adaptan al tema
   sin tocar nada.
--------------------------------------------------------------------------- */
.lg-icon { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; vertical-align: -3px; }
.lg-icon--sm { width: 15px; height: 15px; stroke-width: 2.2; }
.lg-icon--lg { width: 22px; height: 22px; stroke-width: 1.8; }
.lg-icon--xl { width: 30px; height: 30px; stroke-width: 1.6; }
.lg-icon--accent { color: var(--lg-accent-ink); }

/* Icono dentro de una placa — para encabezados de sección y tarjetas */
.lg-icon-box {
  width: 38px; height: 38px; border-radius: var(--lg-radius-md); flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--lg-surface-3); color: var(--lg-accent-ink);
}
.lg-icon-box--solid { background: var(--lg-accent); color: var(--lg-on-accent); }
.lg-icon-box--lg { width: 52px; height: 52px; border-radius: var(--lg-radius-lg); }

/* ---------------------------------------------------------------------------
   42. MENÚ SUPERIOR
--------------------------------------------------------------------------- */
.lg-topnav {
  display: flex; align-items: center; gap: var(--lg-sp-5);
  padding: 0 var(--lg-sp-6); height: var(--lg-topbar-h);
  background: var(--lg-surface); border-bottom: 1px solid var(--lg-border);
  position: sticky; top: 0; z-index: 40;
}
.lg-topnav--brand {
  --lg-surface: #062426; --lg-surface-2: #0A3335; --lg-surface-3: #0A3335;
  --lg-fg: #EAF1F1; --lg-fg-muted: #9FC0C1; --lg-fg-subtle: #7FA6A8;
  --lg-border: rgba(255,255,255,.09); --lg-accent-ink: #DDFF47;
  background: var(--lg-surface); color: var(--lg-fg); border-bottom-color: var(--lg-border);
}
[data-theme="light"] .lg-topnav--brand .lg-logo img.lg-logo__on-dark  { display: block; }
[data-theme="light"] .lg-topnav--brand .lg-logo img.lg-logo__on-light { display: none; }

.lg-topnav__links { display: flex; align-items: center; gap: var(--lg-sp-1); margin-left: var(--lg-sp-4); overflow-x: auto; }
.lg-topnav__link {
  display: inline-flex; align-items: center; gap: var(--lg-sp-2);
  padding: var(--lg-sp-2) var(--lg-sp-4); border-radius: var(--lg-radius-full);
  font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi);
  color: var(--lg-fg-muted); text-decoration: none; white-space: nowrap;
  transition: background var(--lg-fast), color var(--lg-fast);
}
.lg-topnav__link:hover { background: var(--lg-surface-2); color: var(--lg-fg); }
.lg-topnav__link[aria-current] { background: var(--lg-accent); color: var(--lg-on-accent); font-weight: var(--lg-weight-bold); }

/* ---------------------------------------------------------------------------
   43. BLOQUE DE CÓDIGO CON COPIAR
--------------------------------------------------------------------------- */
.lg-code { position: relative; border: 1px solid var(--lg-border); border-radius: var(--lg-radius-md); overflow: hidden; background: var(--lg-surface-2); }
.lg-code__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--lg-sp-3);
  padding: var(--lg-sp-2) var(--lg-sp-2) var(--lg-sp-2) var(--lg-sp-4);
  border-bottom: 1px solid var(--lg-border); background: var(--lg-surface-3);
}
.lg-code__name { font-family: var(--lg-font-mono); font-size: var(--lg-text-2xs); color: var(--lg-fg-muted); letter-spacing: .04em; }
.lg-code__body {
  margin: 0; padding: var(--lg-sp-4); max-height: 220px; overflow: auto;
  font-family: var(--lg-font-mono); font-size: var(--lg-text-xs);
  line-height: 1.65; color: var(--lg-fg); white-space: pre;
}
.lg-copy {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--lg-surface); border: 1px solid var(--lg-border-strong);
  color: var(--lg-fg); font-family: var(--lg-font); font-size: var(--lg-text-2xs);
  font-weight: var(--lg-weight-bold); padding: 6px var(--lg-sp-3);
  border-radius: var(--lg-radius-md); cursor: pointer;
  transition: border-color var(--lg-fast), background var(--lg-fast), color var(--lg-fast);
}
.lg-copy:hover { border-color: var(--lg-accent); color: var(--lg-accent-ink); }
/* Confirmación en el propio botón: el usuario no tiene que buscar un aviso
   en otra parte de la pantalla para saber que funcionó. */
.lg-copy.is-done { background: var(--lg-accent); border-color: var(--lg-accent); color: var(--lg-on-accent); }

/* ---------------------------------------------------------------------------
   44. SUBIDA DE ARCHIVOS
--------------------------------------------------------------------------- */
/* `display: block` es obligatorio: un <label> es inline por defecto y con
   inline el borde punteado y el padding se parten en varias líneas. */
.lg-drop {
  display: block; width: 100%;
  border: 2px dashed var(--lg-border-strong); border-radius: var(--lg-radius-lg);
  padding: var(--lg-sp-8) var(--lg-sp-6); text-align: center;
  background: var(--lg-surface-2); cursor: pointer;
  transition: border-color var(--lg-fast), background var(--lg-fast);
}
.lg-drop:hover, .lg-drop.is-over { border-color: var(--lg-accent); background: var(--lg-accent-soft); }
.lg-drop__icon { color: var(--lg-fg-subtle); margin-bottom: var(--lg-sp-3); }
.lg-drop.is-over .lg-drop__icon, .lg-drop:hover .lg-drop__icon { color: var(--lg-accent-ink); }
.lg-drop__title { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-bold); }
.lg-drop__hint { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); margin-top: var(--lg-sp-1); }
.lg-drop input[type="file"] { display: none; }

.lg-file {
  display: flex; align-items: center; gap: var(--lg-sp-3);
  padding: var(--lg-sp-3) var(--lg-sp-4); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-md); background: var(--lg-surface-2);
}
.lg-file__name { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-semi); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-file__size { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   45. PASOS NUMERADOS
--------------------------------------------------------------------------- */
.lg-steps { display: flex; flex-direction: column; gap: var(--lg-sp-4); }
.lg-step {
  display: grid; grid-template-columns: 32px 1fr; gap: var(--lg-sp-4);
  background: var(--lg-surface); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-lg); padding: var(--lg-sp-5);
}
.lg-step__n {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lg-accent); color: var(--lg-on-accent);
  font-weight: var(--lg-weight-black); font-size: var(--lg-text-sm);
  font-variant-numeric: tabular-nums;
}
.lg-step--done .lg-step__n { background: var(--lg-success); color: var(--lg-fg-inv); }
.lg-step--todo .lg-step__n { background: var(--lg-surface-3); color: var(--lg-fg-muted); }
.lg-step__title { font-size: var(--lg-text-md); font-weight: var(--lg-weight-bold); margin-bottom: var(--lg-sp-3); letter-spacing: -.01em; }

/* ---------------------------------------------------------------------------
   46. TARJETAS DE SELECCIÓN
   "¿Qué quieres hacer?" — opciones grandes, una sola elección.
--------------------------------------------------------------------------- */
.lg-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--lg-sp-4); }
.lg-pick {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--lg-sp-3); padding: var(--lg-sp-6) var(--lg-sp-4);
  background: var(--lg-surface); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-lg); cursor: pointer; text-decoration: none; color: inherit;
  transition: border-color var(--lg-fast), transform var(--lg-fast), background var(--lg-fast);
}
.lg-pick:hover { border-color: var(--lg-accent); transform: translateY(-3px); }
.lg-pick[aria-pressed="true"] { border-color: var(--lg-accent); background: var(--lg-accent-soft); }
.lg-pick__title { font-size: var(--lg-text-md); font-weight: var(--lg-weight-bold); letter-spacing: -.01em; }
.lg-pick__meta { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); }

/* ---------------------------------------------------------------------------
   47. ÁREAS CON SCROLL
   Un contenedor con scroll necesita decir que tiene más contenido. El
   degradado inferior es esa señal — sin él la gente cree que la lista termina.
--------------------------------------------------------------------------- */
.lg-scroll { overflow-y: auto; max-height: var(--h, 320px); position: relative; padding-right: var(--lg-sp-2); }
.lg-scroll-fade { position: relative; }
.lg-scroll-fade::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42px;
  background: linear-gradient(transparent, var(--lg-surface));
  pointer-events: none; border-radius: 0 0 var(--lg-radius-lg) var(--lg-radius-lg);
}

/* Encabezado de tabla que se queda fijo al hacer scroll */
.lg-table--sticky thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--lg-surface); box-shadow: inset 0 -1px 0 var(--lg-border);
}

/* ---------------------------------------------------------------------------
   48. CUADRÍCULA DE ANÁLISIS (DAFO y similares)
--------------------------------------------------------------------------- */
.lg-quad { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--lg-sp-4); }
.lg-quad__col {
  background: var(--lg-surface-2); border: 1px solid var(--lg-border);
  border-top: 3px solid var(--lg-accent); border-radius: var(--lg-radius-md);
  padding: var(--lg-sp-4);
}
.lg-quad__col--good  { border-top-color: var(--lg-success); }
.lg-quad__col--bad   { border-top-color: var(--lg-warning); }
.lg-quad__col--risk  { border-top-color: var(--lg-danger); }
.lg-quad__col--plan  { border-top-color: var(--lg-info); }
.lg-quad__head { display: flex; align-items: center; gap: var(--lg-sp-2); font-size: var(--lg-text-sm); font-weight: var(--lg-weight-bold); margin-bottom: var(--lg-sp-3); }
.lg-quad__col--good .lg-quad__head { color: var(--lg-success); }
.lg-quad__col--bad  .lg-quad__head { color: var(--lg-warning); }
.lg-quad__col--risk .lg-quad__head { color: var(--lg-danger); }
.lg-quad__col--plan .lg-quad__head { color: var(--lg-info); }
.lg-quad__col ul { margin: 0; padding-left: var(--lg-sp-4); font-size: var(--lg-text-sm); line-height: var(--lg-leading-snug); }
.lg-quad__col li { margin-bottom: var(--lg-sp-2); }
.lg-quad__col li::marker { color: var(--lg-fg-subtle); }

/* ---------------------------------------------------------------------------
   49. CARGA POR RESPONSABLE — nombre + cantidad + barra mini
--------------------------------------------------------------------------- */
.lg-loads { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--lg-sp-2); }
.lg-load {
  display: flex; align-items: center; gap: var(--lg-sp-3);
  padding: var(--lg-sp-2) var(--lg-sp-3); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-md); background: var(--lg-surface-2);
}
.lg-load__name { font-size: var(--lg-text-sm); font-weight: var(--lg-weight-bold); }
.lg-load__n { font-size: var(--lg-text-xs); color: var(--lg-fg-muted); font-variant-numeric: tabular-nums; }
.lg-load__bar { flex: 1; height: 5px; background: var(--lg-surface-3); border-radius: var(--lg-radius-full); overflow: hidden; min-width: 34px; }
.lg-load__bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--lg-accent-line); border-radius: var(--lg-radius-full); }


/* ---------------------------------------------------------------------------
   50. SELECT MEJORADO
   Lo genera lgEnhanceSelects(). El <select> original queda oculto pero vivo,
   así que los formularios y la validación del navegador siguen funcionando.
--------------------------------------------------------------------------- */
.lg-dd--select { display: block; width: 100%; }
.lg-dd--select .lg-dd__toggle {
  width: 100%; justify-content: space-between; height: 42px;
  background: var(--lg-surface-2); font-weight: var(--lg-weight-normal);
  border-color: var(--lg-border-strong);
}
.lg-dd--select .lg-dd__panel { width: 100%; min-width: 0; max-height: 260px; }
.lg-dd--select .lg-option { font-size: var(--lg-text-sm); }
.lg-dd--select .lg-option[aria-selected="true"] { background: var(--lg-accent-soft); color: var(--lg-accent-ink); font-weight: var(--lg-weight-semi); }
.lg-dd--select .lg-option[aria-selected="true"]::after { content: "✓"; margin-left: auto; font-weight: var(--lg-weight-bold); }

/* ---------------------------------------------------------------------------
   51. ESTADOS DE BOTÓN — activo y cargando
--------------------------------------------------------------------------- */
.lg-btn[aria-pressed="true"], .lg-btn.is-on {
  background: var(--lg-accent); color: var(--lg-on-accent);
  border-color: var(--lg-accent); font-weight: var(--lg-weight-bold);
}
/* Cargando: el botón se bloquea y lo dice. Un botón que no responde y no
   avisa hace que la gente lo pulse tres veces y dispare la acción tres veces. */
.lg-btn.is-loading { pointer-events: none; opacity: .75; position: relative; }
.lg-btn.is-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: lg-spin 700ms linear infinite; flex-shrink: 0;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .lg-btn.is-loading::before { animation-duration: 2s; }
}

/* ---------------------------------------------------------------------------
   52. BARRA DE FILTROS GLOBAL
   Un solo filtro arriba que gobierna toda la página. Repetir filtros por
   sección hace que nadie sepa cuál manda.
--------------------------------------------------------------------------- */
.lg-filterbar {
  position: sticky; top: 0; z-index: 45;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--lg-sp-3);
  padding: var(--lg-sp-3) var(--lg-sp-4);
  background: var(--lg-surface); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-lg); margin-bottom: var(--lg-sp-4);
  box-shadow: var(--lg-shadow-sm);
}
.lg-filterbar--under-topbar { top: var(--lg-topbar-h); }
.lg-filterbar__chips { flex-basis: 100%; }

/* ---------------------------------------------------------------------------
   53. NÚMEROS VISIBLES EN LAS BARRAS
   El dato no puede vivir solo en el tooltip: al imprimir o en móvil táctil
   no hay hover y el gráfico queda mudo.
--------------------------------------------------------------------------- */
/* Etiqueta pequeña en la punta — el dato secundario */
.lg-bar__cap {
  position: absolute; bottom: calc(var(--h, 30%) + 8px); left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px; font-weight: var(--lg-weight-normal);
  color: var(--lg-fg-subtle); font-variant-numeric: tabular-nums;
  white-space: nowrap; pointer-events: none;
}
/* Número protagonista DENTRO de la barra — no se solapa con nada */
.lg-bar__in {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-size: var(--lg-text-2xs); font-weight: var(--lg-weight-black);
  color: var(--lg-on-accent); font-variant-numeric: tabular-nums;
  pointer-events: none; z-index: 2;
}
.lg-stack__labels { display: flex; justify-content: space-between; margin-top: var(--lg-sp-2); font-size: var(--lg-text-xs); }
.lg-stack__total { font-weight: var(--lg-weight-black); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   54. SEMÁFORO DE KPI
   El número dice solo si está bien o mal, sin que haya que saber el umbral.
--------------------------------------------------------------------------- */
.lg-stat--good .lg-stat__value { color: var(--lg-success); }
.lg-stat--warn .lg-stat__value { color: var(--lg-warning); }
.lg-stat--bad  .lg-stat__value { color: var(--lg-danger); }
.lg-card--good { border-left: 3px solid var(--lg-success); }
.lg-card--warn { border-left: 3px solid var(--lg-warning); }
.lg-card--bad  { border-left: 3px solid var(--lg-danger); }

/* ---------------------------------------------------------------------------
   55. SIN DATO ≠ CERO
   Un cliente con 0 ventas y un cliente cuyos datos no se han cargado no son
   lo mismo, y en un BI confundirlos lleva a decisiones equivocadas.
--------------------------------------------------------------------------- */
.lg-nodata {
  color: var(--lg-fg-subtle); font-style: italic; font-size: .92em;
  font-variant-numeric: normal;
}
.lg-nodata::before { content: "—"; margin-right: 5px; opacity: .6; }
.lg-badge--nodata { background: var(--lg-surface-3); color: var(--lg-fg-subtle); }

/* Marca de tiempo de los datos */
.lg-stamp {
  display: inline-flex; align-items: center; gap: var(--lg-sp-2);
  font-size: var(--lg-text-xs); color: var(--lg-fg-muted);
  background: var(--lg-surface-2); border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-full); padding: 5px var(--lg-sp-3);
}
.lg-stamp--stale { border-color: var(--lg-warning); color: var(--lg-warning); }

/* ---------------------------------------------------------------------------
   56. AVISO COMPACTO Y FILA TOTAL
--------------------------------------------------------------------------- */
.lg-note--sm { padding: var(--lg-sp-2) var(--lg-sp-3); font-size: var(--lg-text-xs); line-height: 1.45; }

.lg-table tfoot td {
  border-top: 2px solid var(--lg-border-strong);
  font-weight: var(--lg-weight-black); padding: var(--lg-sp-3);
  background: var(--lg-surface-2);
}
.lg-table tfoot td.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   57. IMPRESIÓN Y PDF
   Los dashboards se exportan. Sin esto salen con fondo oscuro (gasta tinta,
   se lee mal) y con la navegación ocupando media hoja.
--------------------------------------------------------------------------- */
@media print {
  :root { color-scheme: light; }
  body.lg, .lg-root {
    background: #fff !important; color: #121417 !important;
    --lg-bg: #fff; --lg-surface: #fff; --lg-surface-2: #F4F6F6; --lg-surface-3: #E8EBEB;
    --lg-fg: #121417; --lg-fg-muted: #4A5255; --lg-fg-subtle: #626B6E;
    --lg-border: #D3D8D9; --lg-border-strong: #B0B7B9;
    --lg-accent-ink: #5C7300; --lg-accent-line: #7A9A00;
  }
  .lg-sidebar, .lg-topnav, .lg-topbar, .lg-toasts, .lg-modal,
  .lg-segment, .lg-pager, .lg-btn, .lg-dd__panel { display: none !important; }
  .lg-app { display: block; }
  .lg-filterbar { position: static; }
  .lg-card { break-inside: avoid; box-shadow: none; border-color: #D3D8D9; }
  .lg-scroll { max-height: none !important; overflow: visible !important; }
  .lg-scroll-fade::after { display: none; }
  .lg-glow { background: #fff !important; }
  a[href]::after { content: ""; }
}
