/* ═══════════════════════════════════════════════════════════════
   lk-mobile.css — LUZOcrm V2 Mobile & Responsive
   T2d tokenization · 2026-04-19
   Breakpoints: mobile <=768px | tablet 769-1024px
═══════════════════════════════════════════════════════════════ */

/* ── Bottom nav: oculto en desktop por defecto ─────────────── */
.bn-bar { display: none; }

@media (min-width: 769px) {
  .bn-bar { display: none !important; }
  .lz-hamburger { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE  <=768px
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Shell layout ─────────────────────────────────────────── */
  .ul0-rail, .ul1-panel { display: none !important; }

  #lz-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 44px 1fr 56px;
  }

  /* ── Top bar slim ─────────────────────────────────────────── */
  .tx-top {
    height: 44px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .top-hello  { display: none; }
  .top-clock  { display: none; }
  .top-center { flex: none; }

  /* ── Content ──────────────────────────────────────────────── */
  .tx-main { grid-column: 1; }

  .tx-content {
    height: calc(
      100dvh
      - 44px
      - 56px
      - env(safe-area-inset-top, 0px)
      - env(safe-area-inset-bottom, 0px)
    );
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* ── Footer: ocultar ─────────────────────────────────────── */
  .tx-footer { display: none; }

  /* ── Blades: pantalla completa ───────────────────────────── */
  .ld-blade  { width: 100vw !important; border-radius: 0 !important; }
  .ld-dimmer { display: none !important; }

  /* ── Modals: slide-up desde abajo ────────────────────────── */
  .lk-modal {
    border-radius: 16px 16px 0 0 !important;
    height: auto !important;
    max-height: 92dvh;
    width: 100% !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    transform: none !important;
  }

  /* ── Toast: top center en mobile ─────────────────────────── */
  #lz-toast {
    bottom: auto;
    top: calc(52px + env(safe-area-inset-top, 0px));
    right: 50%;
    transform: translateX(50%);
    min-width: 280px;
    max-width: calc(100vw - 32px);
  }

  /* ── Touch targets minimo 44x44px (WCAG 2.5.5) ──────────── */
  button,
  a,
  [data-nav-id],
  [data-action],
  [data-bn-group],
  [data-bn-tab],
  select {
    min-height: 44px;
    min-width:  44px;
  }

  /* ── Inputs 16px: evita zoom automatico en iOS ───────────── */
  input, textarea, select { font-size: 16px !important; }

  /* ── Module layout helpers ───────────────────────────────── */
  .mod-split { flex-direction: column; }
  .mod-left {
    width: 100%; border-right: none;
    border-bottom: .5px solid var(--border-soft);
    max-height: 40vh; overflow-y: auto;
  }
  .mod-right { width: 100%; flex: 1; }

  /* ── Bottom nav visible ──────────────────────────────────── */
  .bn-bar {
    display: flex !important;
    align-items: center;
    height: 56px;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: transparent;
    border-top: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 200;
    gap: 8px;
    contain: layout;
    -webkit-tap-highlight-color: transparent;
  }
}


/* ═══════════════════════════════════════════════════════════════
   HAMBURGER — botón en topbar (solo mobile)
═══════════════════════════════════════════════════════════════ */

.lz-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none; background: transparent;
  color: var(--tx-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
  margin-right: 4px;
}
.lz-hamburger:hover,
.lz-hamburger:focus-visible { background: var(--bg-body, #f1f5f9); color: var(--tx-base); }
.lz-hamburger svg { display: block; }

@media (max-width: 768px) {
  .lz-hamburger { display: flex; }
}


/* ═══════════════════════════════════════════════════════════════
   PILL BAR — modo expandido
═══════════════════════════════════════════════════════════════ */

.bn-pill-mode {
  background: transparent !important;
  border-top: none !important;
}

/* Pill contenedor — material semitranslúcido */
.bn-pill {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.82);
  border: .5px solid rgba(255,255,255,.92);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  /* Sombra sutil */
  box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 0 0 .5px rgba(0,0,0,.06);
  transition: opacity .22s cubic-bezier(.22,1,.36,1);
}

.bn-pill--dim { opacity: .38; pointer-events: none; }

/* Tab individual */
.bn-tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: none; cursor: pointer;
  color: var(--tx-muted, #64748b);
  font-family: inherit; font-size: 10px; font-weight: 500;
  letter-spacing: .01em; padding: 6px 3px;
  border-radius: 16px;
  position: relative;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
  min-width: unset;
}
.bn-tab:active { transform: scale(.93); }
.bn-tab.bn-active {
  background: rgba(109,40,217,.1);
  color: var(--c-brand, #6d28d9);
}

.bn-icon     { display: flex; align-items: center; justify-content: center; }
.bn-icon svg { display: block; }
.bn-label    { font-size: 9.5px; line-height: 1; white-space: nowrap; }

/* Badge (reutilizado de sistema anterior) */
.bn-badge {
  display: none;
  position: absolute; top: -2px; right: -4px;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 7px;
  background: var(--tx-red, #ef4444); color: #fff;
  font-size: 8px; font-weight: 700;
  line-height: 14px; text-align: center;
}


/* ═══════════════════════════════════════════════════════════════
   FAB — botón de acciones rápidas
═══════════════════════════════════════════════════════════════ */

.bn-fab {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 14px;
  border: none; cursor: pointer;
  background: var(--c-brand, #6d28d9);
  color: #fff;
  box-shadow: 0 3px 10px rgba(109,40,217,.35);
  transition: transform .18s cubic-bezier(.22,1,.36,1),
              box-shadow .18s, background .18s;
  -webkit-tap-highlight-color: transparent;
  min-height: unset; min-width: unset;
}
.bn-fab:active { transform: scale(.88); }
.bn-fab--open  {
  background: var(--tx-muted, #64748b);
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.bn-fab-icon { display: flex; align-items: center; justify-content: center; }

/* Acciones FAB — aparecen encima, fixed */
.bn-fab-action {
  position: fixed;
  right: 14px;
  display: flex; align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.96);
  border: .5px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 9px 14px 9px 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 250;
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity .18s cubic-bezier(.22,1,.36,1) var(--delay, 0ms),
              transform .18s cubic-bezier(.22,1,.36,1) var(--delay, 0ms);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: inherit;
  min-height: unset; min-width: unset;
}
.bn-fab-action.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.bn-fab-action:active { transform: scale(.95); }
.bn-fab-action-ic  {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(109,40,217,.1);
  color: var(--c-brand, #6d28d9);
  flex-shrink: 0;
}
.bn-fab-action-lbl {
  font-size: 13px; font-weight: 500;
  color: var(--tx-base, #0f172a);
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════
   MINI PILL — modo contextual
═══════════════════════════════════════════════════════════════ */

.bn-mini-mode {
  background: transparent !important;
  border-top: none !important;
  justify-content: center !important;
}

.bn-mini-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.82);
  border: .5px solid rgba(255,255,255,.92);
  border-radius: 26px;
  padding: 5px 7px;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 0 0 .5px rgba(0,0,0,.06);
  max-width: 320px; width: 100%;
}

.bn-mini-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none; cursor: pointer;
  background: rgba(0,0,0,.06);
  color: var(--tx-muted, #64748b);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
  min-height: unset; min-width: unset;
}
.bn-mini-btn:active { background: rgba(0,0,0,.1); transform: scale(.88); }

.bn-mini-center {
  flex: 1; display: flex; align-items: center; gap: 7px;
  min-width: 0; padding: 0 2px;
}
.bn-mini-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--c-brand, #6d28d9); flex-shrink: 0;
}
.bn-mini-text  { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bn-mini-module {
  font-size: 11px; font-weight: 500;
  color: var(--tx-base, #0f172a);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bn-mini-user  {
  font-size: 9px; font-weight: 400;
  color: var(--tx-muted, #64748b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}


/* ═══════════════════════════════════════════════════════════════
   MENU HAMBURGUESA — full screen
═══════════════════════════════════════════════════════════════ */

.lz-menu-overlay {
  position: fixed; inset: 0;
  z-index: 500;
  opacity: 0;
  transition: opacity .28s cubic-bezier(.22,1,.36,1);
  overscroll-behavior: contain;
}
.lz-menu-overlay.is-open { opacity: 1; }

.lz-menu-inner {
  position: absolute; inset: 0;
  background: var(--bg-surface, #f8fafc);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(.98);
  transition: transform .32s cubic-bezier(.22,1,.36,1);
}
.lz-menu-overlay.is-open .lz-menu-inner {
  transform: translateY(0) scale(1);
}

/* Header del menu */
.lz-menu-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 0;
  flex-shrink: 0;
}
.lz-menu-hdr-logo { display: flex; align-items: center; gap: 6px; }
.lz-menu-hdr-mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--c-brand, #6d28d9);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.lz-menu-hdr-text {
  font-size: 13px; font-weight: 500; letter-spacing: -.02em;
  color: var(--tx-base, #0f172a);
}
.lz-menu-hdr-text em { font-style: normal; font-weight: 400; opacity: .4; }

.lz-menu-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; cursor: pointer;
  background: rgba(0,0,0,.07);
  color: var(--tx-base, #0f172a);
  display: flex; align-items: center; justify-content: center;
  transition: background .14s, transform .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: unset; min-width: unset;
}
.lz-menu-close:hover { transform: rotate(90deg); background: rgba(0,0,0,.12); }

/* User card */
.lz-menu-user-card {
  margin: 12px 12px 0;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: center; gap: 11px;
  background: rgba(109,40,217,.07);
  flex-shrink: 0;
  animation: _lzmenu-in .26s cubic-bezier(.22,1,.36,1) 60ms both;
}

.lz-menu-av {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.lz-menu-av-init {
  background: linear-gradient(135deg,#6d28d9,#9B3DE8);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: #fff;
}
.lz-menu-user-name {
  font-size: 13px; font-weight: 600; color: var(--tx-base, #0f172a);
}
.lz-menu-user-sub {
  font-size: 11px; margin-top: 2px;
  color: var(--c-brand, #6d28d9);
}

/* Scroll area */
.lz-menu-scroll {
  flex: 1; overflow-y: auto;
  padding: 8px 0 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Category labels */
.lz-menu-cat {
  font-size: 9px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tx-faint, #94a3b8);
  padding: 10px 14px 4px;
}

/* Group */
.lz-menu-grp {
  margin: 0 10px;
  border-radius: 13px;
  overflow: hidden;
  background: var(--bg-card, #fff);
  border: .5px solid var(--border, #e2e8f0);
}

/* Row */
.lz-menu-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
}
.lz-menu-row + .lz-menu-row { border-top: .5px solid var(--border, #e2e8f0); }
.lz-menu-row:active { background: rgba(109,40,217,.04); }
.lz-menu-row--prox { opacity: .5; cursor: default; }

/* Icon en row */
.lz-menu-ic {
  width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
}

.lz-menu-label {
  flex: 1; font-size: 13px; font-weight: 500;
  color: var(--tx-base, #0f172a);
}
.lz-menu-chev { color: var(--border, #e2e8f0); display: flex; }
.lz-menu-prox {
  font-size: 9px; font-weight: 500;
  background: rgba(109,40,217,.1); color: var(--c-brand, #6d28d9);
  padding: 2px 7px; border-radius: 20px;
}

/* Logout */
.lz-menu-logout {
  margin: 8px 10px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  border-radius: 13px;
  padding-top: 10px; padding-left: 14px; padding-right: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: .5px solid rgba(239,68,68,.15);
  background: rgba(239,68,68,.06);
  color: #ef4444;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s;
  -webkit-tap-highlight-color: transparent;
  min-height: unset; min-width: unset;
}
.lz-menu-logout:active { background: rgba(239,68,68,.1); }

/* Stagger animation para grupos del menú */
@keyframes _lzmenu-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lz-menu-user-card { animation: _lzmenu-in .24s cubic-bezier(.22,1,.36,1) 60ms both; }

.lz-menu-scroll > .lz-menu-cat:nth-child(1)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1)  80ms both; }
.lz-menu-scroll > .lz-menu-grp:nth-child(2)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 100ms both; }
.lz-menu-scroll > .lz-menu-cat:nth-child(3)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 130ms both; }
.lz-menu-scroll > .lz-menu-grp:nth-child(4)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 150ms both; }
.lz-menu-scroll > .lz-menu-cat:nth-child(5)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 180ms both; }
.lz-menu-scroll > .lz-menu-grp:nth-child(6)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 200ms both; }
.lz-menu-scroll > .lz-menu-cat:nth-child(7)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 230ms both; }
.lz-menu-scroll > .lz-menu-grp:nth-child(8)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 250ms both; }
.lz-menu-scroll > .lz-menu-cat:nth-child(9)  { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 280ms both; }
.lz-menu-scroll > .lz-menu-grp:nth-child(10) { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 300ms both; }
.lz-menu-scroll > .lz-menu-cat:nth-child(11) { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 330ms both; }
.lz-menu-scroll > .lz-menu-grp:nth-child(12) { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 350ms both; }
.lz-menu-logout { animation: _lzmenu-in .22s cubic-bezier(.22,1,.36,1) 430ms both; }


/* ═══════════════════════════════════════════════════════════════
   TABLET  769-1024px
═══════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1024px) {
  .ul1-panel { width: 200px; }
  .tx-content { height: calc(100dvh - var(--top-h, 52px) - var(--footer-h, 32px)); }
  .ld-blade { width: min(480px, 90vw) !important; }
}


/* ═══════════════════════════════════════════════════════════════
   ACCESIBILIDAD — reduced motion
═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .ld-blade, .lk-modal, .bn-tab, .bn-mini-pill,
  .bn-pill, .bn-fab, .bn-fab-action,
  .lz-menu-overlay, .lz-menu-inner,
  .lz-menu-user-card, .lz-menu-scroll > *,
  .lz-menu-logout, #lz-toast, .tx-content {
    transition: none !important;
    animation: none !important;
  }
}

/* Blade dimmer: scoped al board */
#ldDimmer { position: absolute !important; background: rgba(0,0,0,.22) !important; }
