@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/*
  ╔══════════════════════════════════════════════════════════════╗
  ║       MODUS LOGIX — SISTEMA DE DISEÑO UNIFICADO v1.0        ║
  ║       Distribuidoras · Mayoristas · Logística SV             ║
  ║       Paleta: Azul #1B4E8B + Naranja #D95B0A                ║
  ╚══════════════════════════════════════════════════════════════╝
*/

/* ══════════════════════════════════════
   VARIABLES GLOBALES LOGIX
══════════════════════════════════════ */
:root {
  /* Paleta principal LOGIX */
  --l-blue:        #1B4E8B;
  --l-blue-mid:    #2563AA;
  --l-blue-light:  #EBF2FB;
  --l-blue-soft:   #D6E6F6;
  --l-blue-mid2:   #6B9FD4;

  --l-orange:      #D95B0A;
  --l-orange-mid:  #E8730C;
  --l-orange-soft: #FEF0E6;
  --l-orange-dim:  #FAD0A8;

  /* Superficies */
  --l-bg:          #F5F7FB;
  --l-surface:     #FFFFFF;
  --l-surface2:    #F0F4FA;

  /* Bordes */
  --l-border:      #CBD5E8;
  --l-border-mid:  #A8B9D4;
  --l-border-str:  #7B96C0;

  /* Texto */
  --l-text:        #0F2240;
  --l-muted:       #4A6080;
  --l-subtle:      #7B96B8;
  --l-disabled:    #B0BECC;

  /* Semáforos */
  --l-green:       #15803D;
  --l-green-soft:  #DCFCE7;
  --l-red:         #C0190F;
  --l-red-soft:    #FEE2E2;
  --l-amber:       #92400E;
  --l-amber-soft:  #FEF9C3;
  --l-amber-mid:   #FAD49B;
  --l-purple:      #5B21B6;
  --l-purple-soft: #EDE9FE;

  /* Tipografía */
  --font-body:     'DM Sans', system-ui, sans-serif;
  --font-display:  'DM Serif Display', Georgia, serif;
  --font-mono:     'IBM Plex Mono', 'Courier New', monospace;

  /* Radios */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  18px;
  --r-xl:  24px;

  /* Sombras */
  --shadow-xs:    0 1px 3px rgba(27,78,139,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:    0 2px 8px rgba(27,78,139,.10), 0 1px 3px rgba(0,0,0,.05);
  --shadow-md:    0 6px 20px rgba(27,78,139,.12), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:    0 12px 40px rgba(27,78,139,.15), 0 4px 12px rgba(0,0,0,.08);
  --shadow-modal: 0 24px 64px rgba(15,34,64,.18), 0 6px 20px rgba(0,0,0,.10);

  /* Sidebar */
  --sb-w: 236px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--l-text);
  background: var(--l-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0; padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.25;
  color: var(--l-text);
  margin: 0;
}

a { color: var(--l-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ══════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--l-surface2); }
::-webkit-scrollbar-thumb { background: var(--l-border-mid); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--l-blue-mid2); }

/* ══════════════════════════════════════
   BOTONES
══════════════════════════════════════ */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .18s ease;
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
  min-height: 38px;
}
.btn:focus-visible { outline: 3px solid var(--l-blue-mid2); outline-offset: 2px; }

.btn-primary {
  background: var(--l-blue);
  color: #fff;
  border-color: var(--l-blue);
  box-shadow: 0 2px 8px rgba(27,78,139,.25);
}
.btn-primary:hover {
  background: var(--l-blue-mid);
  border-color: var(--l-blue-mid);
  box-shadow: 0 4px 14px rgba(27,78,139,.30);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-orange {
  background: var(--l-orange);
  color: #fff;
  border-color: var(--l-orange);
  box-shadow: 0 2px 8px rgba(217,91,10,.25);
}
.btn-orange:hover {
  background: var(--l-orange-mid);
  box-shadow: 0 4px 14px rgba(217,91,10,.30);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--l-surface);
  color: var(--l-blue);
  border-color: var(--l-border-str);
}
.btn-secondary:hover {
  background: var(--l-blue-light);
  border-color: var(--l-blue);
}

.btn-ghost {
  background: var(--l-surface);
  color: var(--l-text);
  border-color: var(--l-border);
}
.btn-ghost:hover {
  background: var(--l-surface2);
  border-color: var(--l-border-mid);
}

.btn-danger {
  background: var(--l-red-soft);
  color: var(--l-red);
  border-color: #FECACA;
}
.btn-danger:hover { background: #FECACA; }

.btn-success {
  background: var(--l-green-soft);
  color: var(--l-green);
  border-color: #A7F3D0;
}
.btn-success:hover { background: #A7F3D0; }

.btn-warn {
  background: var(--l-amber-soft);
  color: var(--l-amber);
  border-color: var(--l-amber-mid);
}
.btn-warn:hover { background: var(--l-amber-mid); }

.btn-purple {
  background: var(--l-purple-soft);
  color: var(--l-purple);
  border-color: #DDD6FE;
}
.btn-purple:hover { background: #DDD6FE; }

.btn-sm  { padding: 6px 12px; font-size: 12px; min-height: 30px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; min-height: 46px; }
.btn-icon { padding: 8px; min-height: 36px; min-width: 36px; border-radius: var(--r-xs); }

.btn:disabled, button.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sb-w);
  height: 100vh;
  background: var(--l-surface);
  border-right: 2px solid var(--l-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  transition: transform .25s ease, width .25s ease;
  box-shadow: 2px 0 16px rgba(27,78,139,.07);
}

#main {
  margin-left: var(--sb-w);
  min-height: 100vh;
  transition: margin-left .25s ease;
}

/* Sidebar logo area */
.sb-logo-area {
  padding: 16px 14px 13px;
  border-bottom: 2px solid var(--l-border);
  flex-shrink: 0;
}

/* Biz card en sidebar */
.sb-biz {
  margin: 8px 10px 4px;
  background: var(--l-surface2);
  border: 1.5px solid var(--l-border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all .15s;
}
.sb-biz:hover { background: var(--l-blue-light); border-color: var(--l-blue-soft); }
.sb-biz .sb-name { font-weight: 800; font-size: 13px; color: var(--l-text); line-height: 1.1; }
.sb-biz .sb-tag  { font-size: 8.5px; font-weight: 700; color: var(--l-blue); letter-spacing: .12em; text-transform: uppercase; margin-top: 1px; opacity: .8; }

/* Sidebar footer */
.sb-foot {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 2px solid var(--l-border);
  font-size: 11px;
  color: var(--l-subtle);
}

/* ══════════════════════════════════════
   NAV ITEMS
══════════════════════════════════════ */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 2px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--l-muted);
  transition: all .15s ease;
  text-decoration: none;
  border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover {
  background: var(--l-blue-light);
  color: var(--l-blue);
  border-color: var(--l-blue-soft);
}
.nav-item.active {
  background: var(--l-blue-light);
  color: var(--l-blue);
  font-weight: 700;
  border-color: var(--l-blue-soft);
  box-shadow: inset 3px 0 0 var(--l-blue);
}
.nav-item i { width: 18px; text-align: center; flex-shrink: 0; }

.nav-section {
  padding: 10px 16px 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--l-subtle);
  text-transform: uppercase;
}

.nav-badge {
  background: var(--l-orange);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
  line-height: 1.4;
}

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--l-surface);
  border-bottom: 2px solid var(--l-border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(27,78,139,.06);
}

/* ══════════════════════════════════════
   PÁGINAS
══════════════════════════════════════ */
.page {
  display: none;
  padding: 24px;
  animation: lFadeUp .2s ease;
}
.page.active { display: block; }

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

/* ══════════════════════════════════════
   CARDS / TARJETAS
══════════════════════════════════════ */
.card, .stat-card, .tbl-wrap, .section-card {
  background: var(--l-surface);
  border: 1.5px solid var(--l-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.card { padding: 20px; }

.stat-card {
  padding: 20px;
  border-left: 4px solid var(--l-blue-soft);
  transition: box-shadow .2s, border-color .2s;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-left-color: var(--l-blue);
}
.stat-card.orange { border-left-color: var(--l-orange-dim); }
.stat-card.orange:hover { border-left-color: var(--l-orange); }

.section-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 20px;
}
.section-card-hdr {
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--l-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--l-surface2);
  gap: 10px;
}
.section-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--l-text);
}
.section-card-body { padding: 18px; }

/* ══════════════════════════════════════
   STATS GRID
══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stats-grid.g5 { grid-template-columns: repeat(5, 1fr); }

/* ══════════════════════════════════════
   ICON BOXES (stat card icons)
══════════════════════════════════════ */
.icon-box {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.icon-blue   { background: var(--l-blue-light);  color: var(--l-blue); }
.icon-orange { background: var(--l-orange-soft);  color: var(--l-orange); }
.icon-green  { background: var(--l-green-soft);   color: var(--l-green); }
.icon-red    { background: var(--l-red-soft);     color: var(--l-red); }
.icon-amber  { background: var(--l-amber-soft);   color: var(--l-amber); }
.icon-purple { background: var(--l-purple-soft);  color: var(--l-purple); }

/* ══════════════════════════════════════
   TABLAS
══════════════════════════════════════ */
.tbl-wrap { overflow: hidden; }

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--l-muted);
  text-transform: uppercase;
  background: var(--l-surface2);
  border-bottom: 2px solid var(--l-border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--l-border);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--l-blue-light); }

tbody td {
  padding: 11px 14px;
  font-size: 13px;
  vertical-align: middle;
  color: var(--l-text);
}

.tbl-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ══════════════════════════════════════
   FORMULARIOS
══════════════════════════════════════ */
.fi,
input[type="text"].fi,
input[type="email"].fi,
input[type="number"].fi,
input[type="password"].fi,
input[type="tel"].fi,
input[type="date"].fi,
input[type="month"].fi,
input[type="search"].fi,
input[type="time"].fi,
select.fi,
textarea.fi {
  width: 100%;
  padding: 10px 14px;
  background: var(--l-surface);
  border: 1.5px solid var(--l-border);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--l-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.fi:focus,
input:focus.fi,
select:focus.fi,
textarea:focus.fi {
  border-color: var(--l-blue);
  box-shadow: 0 0 0 3px rgba(27,78,139,.12);
}
.fi::placeholder { color: var(--l-subtle); }

.fl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--l-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.fg { margin-bottom: 14px; }

textarea.fi { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ══════════════════════════════════════
   MODALES Y OVERLAYS
══════════════════════════════════════ */
.overlay, .modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 34, 64, .55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.overlay.open, .modal-overlay.open { display: flex; }

.modal,
.overlay > div:not([class*="overlay"]):not([id="toast"]),
.modal-overlay > div {
  background: var(--l-surface);
  border-radius: var(--r-xl);
  padding: 28px 28px 24px;
  width: 100%;
  position: relative;
  animation: lModalIn .22s cubic-bezier(.34,1.4,.64,1);
  box-shadow: var(--shadow-modal);
  border: 1.5px solid var(--l-border);
  border-top: 4px solid var(--l-blue);
  max-height: 92vh;
  overflow-y: auto;
}

@keyframes lModalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--l-text);
  margin-bottom: 20px;
  padding-right: 32px;
  line-height: 1.3;
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 30px; height: 30px;
  border-radius: var(--r-xs);
  background: var(--l-surface2);
  border: 1.5px solid var(--l-border);
  color: var(--l-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  line-height: 1;
}
.modal-close:hover {
  background: var(--l-red-soft);
  border-color: #FECACA;
  color: var(--l-red);
}

/* ══════════════════════════════════════
   TABS / PESTAÑAS
══════════════════════════════════════ */
.tab-bar, .tab-row {
  display: flex;
  gap: 3px;
  background: var(--l-surface2);
  border: 1.5px solid var(--l-border);
  border-radius: var(--r-md);
  padding: 4px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 18px;
}
.tab {
  padding: 7px 16px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--l-muted);
  transition: all .15s;
  white-space: nowrap;
  border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { background: var(--l-blue-light); color: var(--l-blue); }
.tab.active {
  background: var(--l-surface);
  color: var(--l-blue);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(27,78,139,.12);
  border-color: var(--l-border);
}

/* ══════════════════════════════════════
   BADGES / ETIQUETAS
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.b-green   { background: var(--l-green-soft);  color: var(--l-green);  border-color: #A7F3D0; }
.b-red     { background: var(--l-red-soft);    color: var(--l-red);    border-color: #FECACA; }
.b-amber   { background: var(--l-amber-soft);  color: var(--l-amber);  border-color: var(--l-amber-mid); }
.b-blue    { background: var(--l-blue-light);  color: var(--l-blue);   border-color: var(--l-blue-soft); }
.b-orange  { background: var(--l-orange-soft); color: var(--l-orange); border-color: var(--l-orange-dim); }
.b-purple  { background: var(--l-purple-soft); color: var(--l-purple); border-color: #DDD6FE; }
.b-gray    { background: var(--l-surface2);    color: var(--l-subtle); border-color: var(--l-border); }

/* Dot */
.b-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* Plan badges */
.plan-demo       { background: #F3F4F6; color: #6B7280; border: 1px solid #D1D5DB; }
.plan-starter    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.plan-pro        { background: #FDF4FF; color: #7E22CE; border: 1px solid #E9D5FF; }
.plan-enterprise { background: var(--l-orange-soft); color: var(--l-orange); border: 1px solid var(--l-orange-dim); }

/* Días vencimiento */
.dias-ok    { background: var(--l-green-soft);  color: var(--l-green);  border-radius: 20px; padding: 3px 10px; font-size: 10.5px; font-weight: 700; border: 1px solid #A7F3D0; }
.dias-warn  { background: var(--l-amber-soft);  color: var(--l-amber);  border-radius: 20px; padding: 3px 10px; font-size: 10.5px; font-weight: 700; border: 1px solid var(--l-amber-mid); }
.dias-crit  { background: var(--l-red-soft);    color: var(--l-red);    border-radius: 20px; padding: 3px 10px; font-size: 10.5px; font-weight: 700; border: 1px solid #FECACA; animation: blink-red 1.2s infinite; }
.dias-venc  { background: var(--l-surface2);    color: var(--l-subtle); border-radius: 20px; padding: 3px 10px; font-size: 10.5px; font-weight: 700; border: 1px solid var(--l-border); }

@keyframes blink-red { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Estado pedido */
.est-pendiente  { background: var(--l-amber-soft);   color: var(--l-amber);   border-color: var(--l-amber-mid); }
.est-enproceso  { background: var(--l-blue-light);   color: var(--l-blue);    border-color: var(--l-blue-soft); }
.est-despachado { background: var(--l-orange-soft);  color: var(--l-orange);  border-color: var(--l-orange-dim); }
.est-entregado  { background: var(--l-green-soft);   color: var(--l-green);   border-color: #A7F3D0; }
.est-devuelto   { background: var(--l-red-soft);     color: var(--l-red);     border-color: #FECACA; }
.est-preventa   { background: var(--l-purple-soft);  color: var(--l-purple);  border-color: #DDD6FE; }

/* ══════════════════════════════════════
   INFO BOXES
══════════════════════════════════════ */
.info-box {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
  border: 1.5px solid transparent;
  margin-bottom: 14px;
}
.info-blue   { background: var(--l-blue-light);  border-color: var(--l-blue-soft);  color: var(--l-blue); }
.info-orange { background: var(--l-orange-soft); border-color: var(--l-orange-dim); color: var(--l-orange); }
.info-red    { background: var(--l-red-soft);    border-color: #FECACA;             color: var(--l-red); }
.info-green  { background: var(--l-green-soft);  border-color: #A7F3D0;             color: var(--l-green); }
.info-amber  { background: var(--l-amber-soft);  border-color: var(--l-amber-mid);  color: var(--l-amber); }

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 22px; right: 22px;
  background: var(--l-surface);
  border: 2px solid var(--l-border);
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.ok   { border-color: #A7F3D0; color: var(--l-green); }
#toast.err  { border-color: #FECACA; color: var(--l-red); }

/* ══════════════════════════════════════
   GRIDS
══════════════════════════════════════ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ══════════════════════════════════════
   PROGRESS BARS
══════════════════════════════════════ */
.prog-bar {
  height: 6px;
  background: var(--l-surface2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--l-border);
}
.prog-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--l-blue);
  transition: width .4s ease;
}

/* ══════════════════════════════════════
   LIVE DOT
══════════════════════════════════════ */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--l-green);
  margin-right: 5px;
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ══════════════════════════════════════
   DIVIDER
══════════════════════════════════════ */
.divider { border: none; border-top: 1.5px solid var(--l-border); margin: 16px 0; }

/* ══════════════════════════════════════
   SECTION HEADER
══════════════════════════════════════ */
.section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ══════════════════════════════════════
   TOPBAR SEARCH
══════════════════════════════════════ */
.tb-search {
  padding: 7px 10px 7px 32px;
  font-size: 12.5px;
  border: 1.5px solid var(--l-border);
  border-radius: var(--r-sm);
  background: var(--l-surface2);
  color: var(--l-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 180px;
}
.tb-search:focus {
  border-color: var(--l-blue);
  box-shadow: 0 0 0 3px rgba(27,78,139,.10);
  background: var(--l-surface);
}

/* ══════════════════════════════════════
   IMPORT / DROP ZONE
══════════════════════════════════════ */
.import-zone {
  border: 2px dashed var(--l-border-mid);
  border-radius: var(--r-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  background: var(--l-surface2);
}
.import-zone:hover { border-color: var(--l-blue); background: var(--l-blue-light); }
.import-zone input { display: none; }

/* ══════════════════════════════════════
   MODULE PILLS (master)
══════════════════════════════════════ */
.mod-pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; }
.mp-on  { background: var(--l-blue-light);  color: var(--l-blue);   border: 1.5px solid var(--l-blue-soft); }
.mp-off { background: var(--l-surface2);    color: var(--l-subtle); border: 1.5px solid var(--l-border); text-decoration: line-through; }

/* ══════════════════════════════════════
   BOTTOM NAV (MÓVIL)
══════════════════════════════════════ */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--l-surface);
  border-top: 2px solid var(--l-border);
  height: 60px;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  padding: 0 4px;
  box-shadow: 0 -4px 16px rgba(27,78,139,.10);
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
  color: var(--l-subtle);
  border-radius: var(--r-xs);
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.bn-item.active { color: var(--l-blue); }
.bn-item i { font-size: 18px; }

/* ══════════════════════════════════════
   MOB OVERLAY & HAMBURGER
══════════════════════════════════════ */
#mob-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,34,64,.45);
  z-index: 299;
  backdrop-filter: blur(2px);
}
#mob-overlay.open { display: block; }

#mob-sb-btn {
  display: none;
  background: none;
  border: 1.5px solid var(--l-border);
  cursor: pointer;
  font-size: 17px;
  color: var(--l-muted);
  padding: 6px 8px;
  border-radius: var(--r-xs);
  margin-right: 6px;
  transition: all .15s;
  min-width: 36px; min-height: 36px;
  align-items: center; justify-content: center;
}
#mob-sb-btn:hover { background: var(--l-blue-light); border-color: var(--l-blue-soft); color: var(--l-blue); }

/* ══════════════════════════════════════
   LOGIX LOGO BADGE (sidebar top)
══════════════════════════════════════ */
.logix-logo-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--l-blue), var(--l-orange));
  color: white;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  padding: 2px 10px;
  border-radius: 4px;
  margin-top: 2px;
  text-transform: uppercase;
}

/* ══════════════════════════════════════
   CALENDARIO
══════════════════════════════════════ */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-hdr  { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--l-subtle); text-align: center; padding: 6px 0; }
.cal-cell {
  aspect-ratio: 1;
  border-radius: var(--r-xs);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: background .1s; position: relative;
}
.cal-cell:hover { background: var(--l-blue-light); }
.cal-cell.today { background: var(--l-blue-light); color: var(--l-blue); font-weight: 700; border: 2px solid var(--l-blue-soft); }
.cal-cell.has-ev::after {
  content: ''; position: absolute; bottom: 3px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--l-orange);
}

/* ══════════════════════════════════════
   RESPONSIVE — TABLET
══════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid.g5 { grid-template-columns: repeat(3, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════
   RESPONSIVE — MÓVIL
══════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sb-w: 0px; }

  #sidebar {
    transform: translateX(-236px);
    width: 236px;
    z-index: 300;
    box-shadow: 4px 0 24px rgba(15,34,64,.18);
  }
  #sidebar.mob-open { transform: translateX(0); }

  #main { margin-left: 0 !important; }
  #bottom-nav { display: flex; }
  #mob-sb-btn { display: flex; }

  .topbar { padding: 10px 14px; }

  .page {
    padding: 14px !important;
    padding-bottom: 74px !important;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stats-grid.g5 { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }

  .tb-search { display: none; }
  .mob-hide { display: none !important; }

  .overlay, .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal,
  .overlay > div:not([class*="overlay"]):not([id="toast"]),
  .modal-overlay > div {
    border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    top: auto !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    overflow-y: auto;
    border-top: 4px solid var(--l-blue) !important;
    border-left: none !important; border-right: none !important; border-bottom: none !important;
  }

  .btn { min-height: 42px; font-size: 13px; }
  .btn-sm { min-height: 34px; }
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; gap: 2px; }
  .tbl-wrap { border-radius: var(--r-sm); }

  #toast { bottom: 70px; right: 12px; left: 12px; max-width: unset; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .page { padding: 10px !important; padding-bottom: 74px !important; }
  .modal-title { font-size: 15px; }
}

/* ══════════════════════════════════════
   PRINT
══════════════════════════════════════ */
@media print {
  #sidebar, #bottom-nav, .topbar, #mob-sb-btn { display: none !important; }
  #main { margin-left: 0 !important; }
  .page { padding: 12px !important; }
  .overlay, .modal-overlay { display: none !important; }
}
