/* ============================================================================
   Líder Seguros Admin — Design Tokens + Componentes base
   Estrategia: MOBILE-FIRST. Base diseñada para 360–480px.
   Breakpoints (min-width): sm 480 · md 768 · lg 1024 · xl 1280
   Hit targets táctiles: mínimo 44×44px en todos los controles interactivos.
   ============================================================================ */

:root {
  /* Paleta — Marca */
  --ls-navy-900:    #0A1F44;
  --ls-navy-800:    #13294B;
  --ls-navy-700:    #1E3A6F;
  --ls-navy-600:    #2A4D8F;

  --ls-orange-500:  #F26B1F;
  --ls-orange-400:  #FF8748;
  --ls-orange-300:  #FFA677;
  --ls-orange-100:  #FFE6D5;

  /* Neutros */
  --ls-white:       #FFFFFF;
  --ls-gray-50:     #F7F8FA;
  --ls-gray-100:    #EEF1F5;
  --ls-gray-200:    #E2E6ED;
  --ls-gray-300:    #CBD2DB;
  --ls-gray-400:    #9AA3B2;
  --ls-gray-500:    #6B7280;
  --ls-gray-600:    #4B5563;
  --ls-gray-700:    #374151;
  --ls-gray-900:    #0F172A;

  /* Estado */
  --ls-success:     #22C55E;  --ls-success-bg:  #DCFCE7;
  --ls-warning:     #F59E0B;  --ls-warning-bg:  #FEF3C7;
  --ls-danger:      #EF4444;  --ls-danger-bg:   #FEE2E2;
  --ls-info:        #3B82F6;  --ls-info-bg:     #DBEAFE;

  --ls-font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ls-font-display: 'Fraunces', 'Georgia', 'Times New Roman', serif;
  --ls-font-brand: 'Barlow Condensed', 'Oswald', 'Impact', sans-serif;
  --ls-whatsapp:    #25D366;

  --ls-radius-sm:   6px;
  --ls-radius-md:   12px;
  --ls-radius-lg:   16px;
  --ls-radius-xl:   24px;
  --ls-radius-full: 9999px;

  --ls-shadow-sm:   0 1px 2px rgba(15,23,42,.04);
  --ls-shadow-md:   0 4px 12px rgba(15,23,42,.06);
  --ls-shadow-lg:   0 12px 32px rgba(15,23,42,.10);

  --ls-transition:  150ms cubic-bezier(.4,0,.2,1);

  --ls-sidebar-w:        240px;
  --ls-header-h:         56px;        /* móvil */
  --ls-bottomnav-h:      64px;        /* móvil */
  --ls-touch-min:        44px;
  --ls-safe-bottom:      env(safe-area-inset-bottom, 0px);
  --ls-safe-top:         env(safe-area-inset-top, 0px);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* El atributo HTML hidden debe ganar siempre, aún si una clase setea display */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ls-font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ls-gray-700);
  background: var(--ls-gray-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;  /* Cinturón de seguridad: ningún hijo puede generar scroll horizontal */
}
img, svg { max-width: 100%; display: block; }

/* Tipografía — escalada para móvil, sube en pantallas grandes
   Fraunces variable serif para titulares y cifras: aporta peso editorial-financiero.
   Inter para UI/cuerpo. */
.ls-display { font-family: var(--ls-font-display); font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; color: var(--ls-gray-900); }
.ls-h1      { font-family: var(--ls-font-display); font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.02em; color: var(--ls-gray-900); }
.ls-h2      { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--ls-gray-900); }
.ls-h3      { font-size: 16px; line-height: 22px; font-weight: 600; color: var(--ls-gray-900); }
.ls-body    { font-size: 15px; line-height: 22px; font-weight: 400; }
.ls-small   { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ls-gray-500); }
@media (min-width: 768px) {
  .ls-display { font-size: 34px; line-height: 42px; }
  .ls-h1      { font-size: 28px; line-height: 36px; }
  .ls-h2      { font-size: 20px; line-height: 28px; }
}

/* ============================================================================
   ICON SYSTEM — SVG sprite (Lucide-style, stroke 1.75, currentColor)
   Uso: <svg class="ls-ic"><use href="#i-name"/></svg>
   Variantes: --filled (WhatsApp y otros glifos de marca), --lg, --sm
   ============================================================================ */
.ls-ic {
  width: 20px; height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: middle;
}
.ls-ic--filled { fill: currentColor; stroke: none; }
.ls-ic--lg { width: 22px; height: 22px; }
.ls-ic--sm { width: 16px; height: 16px; }
.ls-ic--brand-whatsapp { color: var(--ls-whatsapp); }

/* Cards */
.ls-card {
  background: var(--ls-white);
  border-radius: var(--ls-radius-lg);
  box-shadow: var(--ls-shadow-sm);
  padding: 16px;
}
@media (min-width: 768px) {
  .ls-card { padding: 24px; }
}
.ls-card--lg { padding: 20px; }
@media (min-width: 768px) { .ls-card--lg { padding: 32px; border-radius: var(--ls-radius-xl); box-shadow: var(--ls-shadow-md); } }

/* Botones — táctiles mínimo 44px */
.ls-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  min-height: var(--ls-touch-min);
  border-radius: var(--ls-radius-md);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--ls-transition);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ls-btn:active { transform: scale(.98); }
.ls-btn:disabled, .ls-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.ls-btn--primary   { background: var(--ls-orange-500); color: var(--ls-white); box-shadow: var(--ls-shadow-sm); }
.ls-btn--primary:hover { background: var(--ls-orange-400); }
.ls-btn--secondary { background: var(--ls-white); color: var(--ls-gray-700); border-color: var(--ls-gray-300); }
.ls-btn--secondary:hover { background: var(--ls-gray-50); }
.ls-btn--ghost     { background: transparent; color: var(--ls-gray-700); padding: 10px; min-width: var(--ls-touch-min); }
.ls-btn--ghost:hover { background: var(--ls-gray-100); }
.ls-btn--block     { width: 100%; }
.ls-btn--sm        { padding: 8px 12px; min-height: 36px; font-size: 13px; }

/* Inputs */
.ls-input {
  width: 100%;
  padding: 12px 14px;
  min-height: var(--ls-touch-min);
  border: 1px solid var(--ls-gray-300);
  border-radius: var(--ls-radius-md);
  font-family: inherit;
  font-size: 16px; /* 16px evita zoom automático en iOS Safari */
  background: var(--ls-white);
  transition: var(--ls-transition);
}
.ls-input:focus { outline: none; border-color: var(--ls-orange-500); box-shadow: 0 0 0 3px var(--ls-orange-100); }
.ls-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--ls-gray-700); }

/* Badges */
.ls-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--ls-radius-full); font-size: 12px; font-weight: 500; }
.ls-badge--success { background: var(--ls-success-bg); color: #166534; }
.ls-badge--warning { background: var(--ls-warning-bg); color: #92400E; }
.ls-badge--danger  { background: var(--ls-danger-bg);  color: #991B1B; }
.ls-badge--info    { background: var(--ls-info-bg);    color: #1E40AF; }
.ls-badge--orange  { background: var(--ls-orange-100); color: #9A3412; }
.ls-badge--neutral { background: var(--ls-gray-100);   color: var(--ls-gray-700); }

/* ============================================================================
   LAYOUT MOBILE-FIRST
   - Base: header arriba + content + bottom-nav abajo (sin sidebar).
   - md+: aparece el sidebar lateral, oculta bottom-nav.
   ============================================================================ */
.ls-app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.ls-main { flex: 1; display: flex; flex-direction: column; }
.ls-content {
  padding: 16px;
  padding-bottom: calc(var(--ls-bottomnav-h) + var(--ls-safe-bottom) + 16px);
  flex: 1;
}
@media (min-width: 1024px) {
  .ls-app { flex-direction: row; }
  .ls-content { padding: 32px; padding-bottom: 32px; }
}

/* Header móvil — compacto, sticky */
.ls-header {
  position: sticky;
  top: 0; z-index: 30;
  min-height: var(--ls-header-h);
  padding: 8px 12px;
  padding-top: calc(8px + var(--ls-safe-top));
  background: var(--ls-white);
  border-bottom: 1px solid var(--ls-gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.ls-header > * { flex-shrink: 0; }
.ls-header > [style*="flex:1"] { min-width: 0; }
@media (min-width: 1024px) {
  .ls-header { min-height: 64px; padding: 0 32px; position: static; flex-wrap: nowrap; }
}
.ls-header__title {
  font-family: var(--ls-font-display);
  font-weight: 600; color: var(--ls-gray-900);
  font-size: 16px; line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ls-header__sub {
  font-size: 10px; color: var(--ls-gray-500);
  line-height: 1; margin-bottom: 3px;
  text-transform: uppercase; letter-spacing: .08em; font-weight: 600;
}
.ls-header__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ls-orange-500);
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.ls-header__user-text { display: none; }
@media (min-width: 768px) { .ls-header__user-text { display: block; } }

/* Toggle de moneda Bs / EUR / USD — compacto en header.
   En móvil ≤380px se oculta para evitar que aplaste el saludo; el usuario
   puede cambiar moneda desde menú/configuración. Reaparece en pantallas más amplias. */
.ls-currency-toggle {
  display: none;
  background: var(--ls-gray-100);
  border-radius: var(--ls-radius-full);
  padding: 3px;
  gap: 2px;
}
@media (min-width: 380px) { .ls-currency-toggle { display: inline-flex; } }
.ls-currency-toggle button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: var(--ls-radius-full);
  font-weight: 600; font-size: 12px;
  color: var(--ls-gray-600);
  cursor: pointer;
  transition: var(--ls-transition);
  font-family: inherit;
}
.ls-currency-toggle button[aria-pressed="true"] {
  background: var(--ls-white);
  color: var(--ls-navy-900);
  box-shadow: var(--ls-shadow-sm);
}

/* Sidebar — desktop only, drawer en móvil
   Layout flex column: brand (fijo) + nav (scrolleable) + footer (fijo).
   Solo el menu scrollea para que el footer de marca siempre se vea. */
.ls-sidebar {
  background: var(--ls-navy-900);
  color: var(--ls-white);
  width: var(--ls-sidebar-w);
  padding: 24px 12px;
  /* móvil: drawer fuera de pantalla */
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform var(--ls-transition);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ls-sidebar > nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.ls-sidebar__brand,
.ls-sidebar__footer-brand { flex-shrink: 0; }
.ls-sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) {
  .ls-sidebar { position: static; transform: none; min-height: 100vh; }
}
.ls-sidebar__brand {
  padding: 18px 12px;
  border-bottom: 1px solid var(--ls-navy-700);
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ls-white);
}
.ls-sidebar__logo {
  display: block;
  width: 200px;
  max-width: 90%;
  height: auto;
  image-rendering: -webkit-optimize-contrast;
}
/* Mobile: variante horizontal del logo (servida via <picture> + srcset).
   El aspect ratio cambia de ~1.4:1 (stacked) a ~4.6:1 (horizontal).
   Ajustamos width al canvas mobile y dejamos que height: auto preserve aspecto. */
@media (max-width: 1023.98px) {
  .ls-sidebar__brand { padding: 14px 12px; }
  .ls-sidebar__logo { width: 200px; }
}


.ls-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: var(--ls-touch-min);
  border-radius: var(--ls-radius-md);
  color: rgba(255,255,255,.78);
  text-decoration: none; font-size: 15px; font-weight: 500;
  transition: var(--ls-transition);
  position: relative; margin-bottom: 2px;
}
.ls-nav-item:hover { background: var(--ls-navy-800); color: var(--ls-white); }
.ls-nav-item--active {
  background: var(--ls-orange-500);
  color: var(--ls-white);
  box-shadow: 0 6px 16px -8px rgba(242, 107, 31, 0.55);
}
.ls-nav-item--active:hover { background: var(--ls-orange-500); }
.ls-nav-item--active::before {
  content: ''; position: absolute; left: -12px; top: 50%;
  width: 4px; height: 22px; margin-top: -11px;
  background: var(--ls-orange-300);
  border-radius: 0 4px 4px 0;
  opacity: .9;
}
@media (max-width: 1023.98px) { .ls-nav-item--active::before { display: none; } }
.ls-nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ls-gray-400); padding: 16px 14px 8px; font-weight: 600; }

/* Backdrop del drawer */
.ls-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10,31,68,.55);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ls-transition);
}
.ls-backdrop.is-open { opacity: 1; pointer-events: auto; }
@media (min-width: 1024px) { .ls-backdrop { display: none; } }

/* Bottom nav — móvil only. position:fixed con !important para que ningún
   contenedor flex/grid lo desplace en breakpoints intermedios. */
.ls-bottomnav {
  position: fixed !important;
  left: 0; right: 0; bottom: 0;
  top: auto;
  z-index: 40;
  height: calc(var(--ls-bottomnav-h) + var(--ls-safe-bottom));
  padding-bottom: var(--ls-safe-bottom);
  background: var(--ls-white);
  border-top: 1px solid var(--ls-gray-100);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
@media (min-width: 1024px) {
  .ls-bottomnav { display: none !important; }
}
.ls-bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--ls-gray-500);
  text-decoration: none; font-size: 11px; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.ls-bottomnav a[aria-current="page"] { color: var(--ls-orange-500); }
.ls-bottomnav a .ls-ic { width: 22px; height: 22px; margin-bottom: 2px; }

/* ============================================================================
   KPI CARDS — "Refined Ledger"
   Cada métrica es una entrada contable con identidad sutil:
     · hairline rule de 2px en el tope (color por categoría semántica)
     · cifra Fraunces grande con tracking refinado y opsz alto
     · símbolo de moneda offset (financial typography clásica)
     · delta como pill semántica, no texto plano
   ============================================================================ */

.ls-card--kpi {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--ls-gray-100);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: transform 200ms cubic-bezier(.2,.8,.2,1),
              box-shadow 200ms cubic-bezier(.2,.8,.2,1),
              border-color 200ms;
  --kpi-accent: var(--ls-gray-300);
}
.ls-card--kpi::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--kpi-accent);
  transition: height 200ms;
}
.ls-card--kpi:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.10), 0 1px 0 rgba(15, 23, 42, 0.02);
  border-color: var(--ls-gray-200);
}
.ls-card--kpi:hover::before { height: 3px; }

.ls-card--kpi[data-accent="income"]      { --kpi-accent: var(--ls-orange-500); }
.ls-card--kpi[data-accent="operational"] { --kpi-accent: var(--ls-navy-700); }
.ls-card--kpi[data-accent="alert"]       { --kpi-accent: var(--ls-warning); }

.ls-kpi { display: flex; flex-direction: column; gap: 10px; }

.ls-kpi__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ls-gray-500);
  font-weight: 700;
  font-feature-settings: 'ss01' 1;
}

.ls-kpi__value {
  font-family: var(--ls-font-display);
  font-size: 38px; line-height: 1;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ls-gray-900);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  font-variation-settings: 'opsz' 96;
  display: flex; align-items: baseline; gap: 6px;
  margin-top: 2px;
}
@media (min-width: 768px) { .ls-kpi__value { font-size: 44px; } }
@media (min-width: 1024px) { .ls-kpi__value { font-size: 42px; } }

.ls-kpi__curr {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--ls-gray-500);
  letter-spacing: 0;
  align-self: flex-start;
  margin-top: 0.35em;
}
.ls-kpi__amount {
  font-variant-numeric: tabular-nums;
}

/* Delta como pill semántica */
.ls-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  border-radius: var(--ls-radius-full);
  font-family: var(--ls-font-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  background: var(--ls-gray-100);
  color: var(--ls-gray-700);
  width: fit-content;
}
.ls-pill__caret {
  font-size: 9px;
  line-height: 1;
  display: inline-block;
}
.ls-pill--up   { background: var(--ls-success-bg); color: #166534; }
.ls-pill--down { background: var(--ls-danger-bg);  color: #991B1B; }
.ls-pill--warn { background: var(--ls-warning-bg); color: #92400E; }

/* Caption secundaria del KPI (cuando no hay delta) */
.ls-kpi__caption {
  font-size: 12px;
  color: var(--ls-gray-500);
  line-height: 1.4;
  font-weight: 500;
}
.ls-kpi__caption strong { color: var(--ls-gray-700); font-weight: 600; }

/* Gauge */
.ls-gauge { width: 160px; height: 160px; position: relative; display: inline-grid; place-items: center; }
.ls-gauge__center { position: absolute; text-align: center; }
.ls-gauge__value { font-family: var(--ls-font-display); font-size: 46px; font-weight: 600; letter-spacing: -0.03em; color: var(--ls-gray-900); line-height: 1; }
.ls-gauge__label { font-size: 11px; color: var(--ls-gray-500); margin-top: 4px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* ============================================================================
   TABLAS — patrón responsive
   Móvil: cada <tr> se convierte en una "card" apilada (data-label).
   md+: tabla densa tradicional.
   ============================================================================ */
.ls-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--ls-white);
  border-radius: var(--ls-radius-lg);
  overflow: hidden;
}
.ls-table thead { display: none; }
.ls-table tbody tr {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ls-gray-100);
}
.ls-table tbody tr:last-child { border-bottom: 0; }
.ls-table td {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  border: 0;
  font-size: 14px;
  /* Cuando el valor es un string largo sin espacios (filename CSV, n_poliza,
     serial, etc.) permitimos que se quiebre para no romper el layout. */
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
/* La etiqueta no se quiebra y se mantiene a la izquierda */
.ls-table td::before {
  white-space: nowrap;
  flex-shrink: 0;
}
/* Permitir que el segundo bloque (valor) consuma el ancho restante */
.ls-table td > * { min-width: 0; max-width: 100%; }
.ls-table td::before {
  content: attr(data-label);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ls-gray-500);
  font-weight: 600;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .ls-table thead { display: table-header-group; background: var(--ls-gray-50); }
  .ls-table tbody tr { display: table-row; padding: 0; }
  .ls-table th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ls-gray-600); border-bottom: 1px solid var(--ls-gray-100); }
  .ls-table td { display: table-cell; padding: 14px 16px; border-bottom: 1px solid var(--ls-gray-100); }
  .ls-table td::before { display: none; }
  .ls-table tbody tr:hover { background: var(--ls-gray-50); }
  .ls-table tbody tr:last-child td { border-bottom: none; }
}

/* Grid — mobile-first, escala a más columnas en lg */
.ls-grid { display: grid; gap: 12px; }
@media (min-width: 768px) { .ls-grid { gap: 24px; } }
.ls-grid--2 { grid-template-columns: 1fr; }
.ls-grid--3 { grid-template-columns: 1fr; }
.ls-grid--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) {
  .ls-grid--2 { grid-template-columns: repeat(2, 1fr); }
  .ls-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .ls-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .ls-grid--3 { grid-template-columns: repeat(3, 1fr); }
  .ls-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* Stack util (vertical en mobile, horizontal en md+) */
.ls-stack-md { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 768px) { .ls-stack-md { flex-direction: row; align-items: center; justify-content: space-between; } }

/* Visibility helpers — !important porque a veces ls-btn las pisa */
.ls-mobile-only  { display: inline-flex !important; }
.ls-desktop-only { display: none !important; }
@media (min-width: 1024px) {
  .ls-mobile-only  { display: none !important; }
  .ls-desktop-only { display: inline-flex !important; }
}

/* ============================================================================
   MODAL — mobile-first overlay con backdrop + panel.
   - Móvil: bottom-sheet con borde superior redondeado.
   - md+: card centrada con max-width.
   ============================================================================ */
.ls-modal { position: fixed; inset: 0; z-index: 70; display: none; }
.ls-modal[aria-hidden="false"] { display: block; }
.ls-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 31, 68, .55);
  backdrop-filter: blur(2px);
}
.ls-modal__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--ls-white);
  border-radius: var(--ls-radius-xl) var(--ls-radius-xl) 0 0;
  max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  box-shadow: var(--ls-shadow-lg);
  animation: ls-modal-up 200ms cubic-bezier(.2,.8,.2,1);
}
@keyframes ls-modal-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (min-width: 768px) {
  .ls-modal__panel {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw);
    border-radius: var(--ls-radius-xl);
    max-height: 85vh;
    animation: ls-modal-pop 180ms cubic-bezier(.2,.8,.2,1);
  }
  @keyframes ls-modal-pop {
    from { transform: translate(-50%, -50%) scale(.96); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  }
}
.ls-modal__head {
  padding: 18px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ls-gray-100);
}
.ls-modal__head h2 { margin: 0; }
.ls-modal__body {
  padding: 18px 20px; overflow-y: auto; flex: 1;
}
.ls-modal__foot {
  padding: 14px 20px;
  padding-bottom: calc(14px + var(--ls-safe-bottom));
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--ls-gray-100);
  flex-wrap: wrap;
}
.ls-modal__foot .ls-btn { flex: 1; }
@media (min-width: 768px) { .ls-modal__foot .ls-btn { flex: 0 0 auto; } }

/* ============================================================================
   Carga de producción — bloques internos del modal
   ============================================================================ */
.ls-upload-dropzone {
  display: block;                    /* <label> es inline por defecto — forzar block */
  border: 2px dashed var(--ls-gray-300);
  border-radius: var(--ls-radius-lg);
  padding: 28px 16px;
  text-align: center;
  background: var(--ls-gray-50);
  cursor: pointer;
  transition: var(--ls-transition);
}
.ls-upload-dropzone:hover { border-color: var(--ls-orange-500); background: var(--ls-orange-100); }
.ls-upload-dropzone strong { display: block; color: var(--ls-gray-900); font-size: 15px; margin-bottom: 4px; }
.ls-upload-dropzone input[type="file"] { display: none; }

.ls-summary-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 16px 0;
}
@media (min-width: 480px) { .ls-summary-grid { grid-template-columns: repeat(3, 1fr); } }
.ls-summary-cell {
  background: var(--ls-gray-50);
  border-radius: var(--ls-radius-md);
  padding: 10px 12px;
}
.ls-summary-cell .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ls-gray-500); font-weight: 600;
}
.ls-summary-cell .value {
  font-family: var(--ls-font-display);
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--ls-gray-900);
  font-feature-settings: 'tnum' 1;
}
.ls-summary-cell.is-err .value { color: var(--ls-danger); }
.ls-summary-cell.is-ok  .value { color: var(--ls-success); }

.ls-alerts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ls-alert {
  background: var(--ls-warning-bg);
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: var(--ls-radius-md);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}
.ls-alert--danger { background: var(--ls-danger-bg); color: #991B1B; border-color: #FECACA; }
.ls-alert--ok     { background: var(--ls-success-bg); color: #166534; border-color: #BBF7D0; }

.ls-vendedores-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ls-vendedores-list li {
  background: var(--ls-gray-100);
  color: var(--ls-gray-700);
  border-radius: var(--ls-radius-full);
  padding: 4px 10px;
  font-size: 12px;
}
.ls-vendedores-list li strong { color: var(--ls-gray-900); margin-left: 4px; }

.ls-errors-list {
  margin: 8px 0 0; padding: 0; list-style: none;
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--ls-gray-200);
  border-radius: var(--ls-radius-md);
  background: var(--ls-white);
}
.ls-errors-list li {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ls-gray-100);
  font-size: 12px;
  display: flex; gap: 12px;
}
.ls-errors-list li:last-child { border-bottom: 0; }
.ls-errors-list li .col {
  flex-shrink: 0; min-width: 80px;
  color: var(--ls-gray-500);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   SEARCH INPUT — spinner inline + botón X de limpieza
   Estructura: <div class="ls-search-wrap"> con un input search + el JS de
   autosubmit inyecta automaticamente spinner y boton X.
   ============================================================================ */
.ls-search-wrap { position: relative; display: block; }
.ls-search-wrap input[type="search"] {
  /* Reservamos espacio a la derecha para spinner + X */
  padding-right: 64px;
}
/* Si el wrap también tiene un SVG de búsqueda a la izquierda (lupa) */
.ls-search-wrap > svg.ls-ic:first-child {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ls-gray-400);
  pointer-events: none;
}
.ls-search-spinner {
  position: absolute;
  right: 40px;
  top: 50%;
  width: 14px; height: 14px;
  margin-top: -7px;
  border: 2px solid var(--ls-gray-200);
  border-top-color: var(--ls-orange-500);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms;
}
.ls-search-wrap.is-busy .ls-search-spinner {
  opacity: 1;
  animation: ls-spin 700ms linear infinite;
}
@keyframes ls-spin { to { transform: rotate(360deg); } }
.ls-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 22px; height: 22px;
  margin-top: -11px;
  border: 0; padding: 0;
  background: var(--ls-gray-100);
  border-radius: 50%;
  color: var(--ls-gray-600);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms, background 120ms, color 120ms;
  display: inline-flex; align-items: center; justify-content: center;
}
.ls-search-wrap.has-value .ls-search-clear {
  opacity: 1;
  pointer-events: auto;
}
.ls-search-clear:hover {
  background: var(--ls-gray-300);
  color: var(--ls-gray-900);
}
.ls-search-clear svg { width: 12px; height: 12px; }

/* ============================================================================
   SIDEBAR FOOTER BRAND — bloque al pie del sidebar (desktop)
   Patrón geométrico CSS puro (líneas diagonales art-déco) + frase de marca.
   En móvil/drawer queda al final del scroll natural del aside.
   ============================================================================ */
.ls-sidebar { display: flex; flex-direction: column; }
.ls-sidebar > nav { flex: 1; }
.ls-sidebar__footer-brand {
  margin: 20px -12px -24px;
  padding: 0;
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--ls-navy-700);
  background:
    linear-gradient(180deg, rgba(10,31,68,0) 0%, rgba(5,14,34,0.55) 60%, rgba(5,14,34,0.92) 100%),
    url('/assets/sidebar-skyline.png') center bottom / cover no-repeat,
    var(--ls-navy-900);
  min-height: 140px;
  display: flex;
  align-items: flex-end;
}
.ls-sidebar__footer-brand-text {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 14px 16px calc(14px + var(--ls-safe-bottom));
  font-family: var(--ls-font-sans);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ls-white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(180deg, transparent 0%, rgba(5,14,34,0.7) 60%, rgba(5,14,34,0.95) 100%);
}

/* ============================================================================
   KPI CARD — variante con ÍCONO EN CÍRCULO (estilo admin moderno)
   Mantenemos el Refined Ledger (Fraunces tabular) pero agregamos al lado
   izquierdo un círculo de color con un ícono de Lucide.
   Markup:
     <div class="ls-card ls-card--kpi ls-card--kpi-icon" data-accent="income">
       <div class="ls-kpi-icon" data-tone="blue"><svg ...></svg></div>
       <div class="ls-kpi"> ... </div>
     </div>
   ============================================================================ */
.ls-card--kpi-icon {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px;
  text-align: left;
}
@media (min-width: 768px) { .ls-card--kpi-icon { padding: 16px; gap: 14px; } }
@media (min-width: 1280px) { .ls-card--kpi-icon { padding: 18px; gap: 14px; } }
.ls-card--kpi-icon .ls-kpi {
  flex: 1; min-width: 0; gap: 4px;
  align-items: flex-start;
  text-align: left;
}
.ls-card--kpi-icon .ls-kpi__label {
  letter-spacing: .06em;
  font-size: 10px;
  line-height: 1.25;
  text-wrap: balance;
  margin: 0;
}
.ls-card--kpi-icon .ls-kpi__value {
  font-size: 26px; margin-top: 2px; line-height: 1;
}
@media (min-width: 768px)  { .ls-card--kpi-icon .ls-kpi__value { font-size: 30px; } }
@media (min-width: 1024px) { .ls-card--kpi-icon .ls-kpi__value { font-size: 28px; } }
@media (min-width: 1280px) { .ls-card--kpi-icon .ls-kpi__value { font-size: 32px; } }

.ls-kpi-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: var(--ls-radius-md);
  display: grid; place-items: center;
  color: var(--ls-white);
  background: var(--ls-info);
  box-shadow: 0 3px 8px -3px currentColor;
}
.ls-kpi-icon .ls-ic { width: 18px; height: 18px; stroke-width: 2; }
@media (min-width: 1280px) {
  .ls-kpi-icon { width: 40px; height: 40px; }
  .ls-kpi-icon .ls-ic { width: 20px; height: 20px; }
}
.ls-kpi-icon[data-tone="blue"]    { background: var(--ls-info);       color: #fff; }
.ls-kpi-icon[data-tone="green"]   { background: var(--ls-success);    color: #fff; }
.ls-kpi-icon[data-tone="orange"]  { background: var(--ls-orange-500); color: #fff; }
.ls-kpi-icon[data-tone="navy"]    { background: var(--ls-navy-700);   color: #fff; }
.ls-kpi-icon[data-tone="amber"]   { background: var(--ls-warning);    color: #fff; }
.ls-kpi-icon[data-tone="danger"]  { background: var(--ls-danger);     color: #fff; }

/* ============================================================================
   DONUT CHART — SVG puro (sin dependencias). Anillo + leyenda al costado.
   Usa stroke-dasharray para los segmentos. Render server-side desde PHP.
   ============================================================================ */
.ls-donut-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
  justify-items: center;
}
@media (min-width: 480px) {
  .ls-donut-card {
    grid-template-columns: auto 1fr;
    gap: 20px;
    justify-items: start;
  }
}
.ls-donut {
  position: relative;
  width: 160px; height: 160px;
  flex-shrink: 0;
  max-width: 100%;
  justify-self: center;
}
.ls-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ls-donut__center {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
}
.ls-donut__total {
  font-family: var(--ls-font-display);
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--ls-gray-900); line-height: 1;
  font-feature-settings: 'tnum' 1;
}
.ls-donut__total-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ls-gray-500); font-weight: 700; margin-top: 4px;
}
.ls-donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ls-donut-legend li {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center;
  font-size: 13px;
}
.ls-donut-legend .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c, var(--ls-gray-400));
}
.ls-donut-legend .label { color: var(--ls-gray-700); font-weight: 500; }
.ls-donut-legend .num {
  font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--ls-gray-900);
}

/* Focus visible accesible */
:focus-visible {
  outline: 2px solid var(--ls-orange-500);
  outline-offset: 2px;
  border-radius: var(--ls-radius-sm);
}

/* ============================================================================
   PRINT STYLESHEET — toda la app imprime limpia con Ctrl+P
   Reglas: ocultar navegación, ampliar contenido, contraste BN, page breaks.
   ============================================================================ */
@media print {
  @page { margin: 1.5cm; size: A4 portrait; }

  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
  }

  /* Ocultar todo lo no-imprimible */
  .ls-sidebar, .ls-backdrop, .ls-bottomnav, .ls-header,
  .ls-modal, #btn-menu, .ls-currency-toggle,
  .no-print, [data-no-print] {
    display: none !important;
  }

  /* Contenido a ancho completo */
  .ls-app, .ls-main { display: block !important; }
  .ls-content {
    padding: 0 !important;
    padding-bottom: 0 !important;
    max-width: none;
  }

  /* Cards limpias para papel: sin sombra, borde sutil, evitar split */
  .ls-card, .ls-card--kpi {
    box-shadow: none !important;
    border: 1px solid #d0d0d0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 12px !important;
  }
  .ls-card--kpi::before { display: none; }  /* sin línea de color en BN */

  /* Tablas pre-impresión: bordes sutiles, fuente más chica */
  .ls-table {
    box-shadow: none !important;
    border: 1px solid #ccc;
    font-size: 10pt;
  }
  .ls-table thead { display: table-header-group !important; background: #f5f5f5 !important; }
  .ls-table thead th {
    color: black !important;
    border-bottom: 1px solid #999 !important;
    padding: 8px !important;
  }
  .ls-table tbody tr {
    display: table-row !important;
    page-break-inside: avoid;
    padding: 0 !important;
    border-bottom: 1px solid #eee !important;
  }
  .ls-table td {
    display: table-cell !important;
    padding: 6px 8px !important;
    border-bottom: 1px solid #eee !important;
    color: black !important;
  }
  .ls-table td::before { display: none !important; }

  /* Tipografía: el serif aporta peso editorial impreso */
  .ls-h1 { font-size: 18pt; margin-bottom: 4pt; }
  .ls-h2 { font-size: 14pt; }
  .ls-h3 { font-size: 12pt; }
  .ls-display { font-size: 22pt; }
  .ls-kpi__value { font-size: 18pt; }

  /* Links sin subrayado para no ensuciar */
  a { color: black !important; text-decoration: none !important; }
  a[href]::after { content: ""; }  /* desactiva los URLs entre paréntesis típicos */

  /* Alertas en BN */
  .ls-alert { border: 1px solid #999 !important; background: white !important; color: black !important; }
  .ls-badge { border: 1px solid #999; color: black !important; background: white !important; }

  /* Header impreso del informe (si la página lo define) */
  .print-header { display: block !important; margin-bottom: 16pt; padding-bottom: 8pt; border-bottom: 2pt solid black; }
  .print-footer { margin-top: 16pt; padding-top: 8pt; border-top: 1pt solid #999; font-size: 9pt; color: #555 !important; }
}

/* Helper: contenido visible solo al imprimir */
.print-only { display: none; }
@media print { .print-only { display: block; } }
