/* ── LAYOUT COMPARTIDO: sidebar + topbar ─────────────────────────────────────
   Usado por las vistas de panel con sidebar (dueno, encargado, empleado,
   admin, vendedor, demo, demo-guiada). Depende de las variables CSS
   (--navy, --electric, --sidebar-w, etc.) que cada vista sigue definiendo
   en su propio :root — este archivo solo define la estructura/tamaños,
   no colores base, para no forzar la paleta de ninguna vista.

   Distintas vistas nacieron con nombres de clase ligeramente distintos para
   el mismo concepto (ej. .panel vs .page, .sidebar-overlay vs
   .sidebar-backdrop) — en vez de renombrar todo el HTML/JS de 7 vistas
   (riesgo alto, cero beneficio real), este archivo agrupa ambos nombres en
   el mismo selector para que las reglas apliquen sin tocar markup ni JS.
*/

/* ── SIDEBAR ──
   Nota: el POSICIONAMIENTO del sidebar en desktop (fixed+margin-left vs.
   grid-template-columns vs. flex-row) difiere entre vistas por motivos
   estructurales reales, no por descuido — empleado.html usa CSS grid para
   poder animar el colapso del sidebar con una transición de columna, y
   forzar aquí `position:fixed` se lo rompería. Por eso ancho/colores/bordes
   sí se comparten, pero `position`/`margin-left` del layout de escritorio
   se queda en el <style> propio de cada vista. En móvil sí es igual en
   todas (ver media query abajo) porque ahí todas usan el mismo patrón
   off-canvas con translateX. */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--navy); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh;
}
/* El CONTENIDO del logo (imagen+marca en dueño, ícono+texto, etc.) sigue
   siendo cosa de cada vista, pero la ALTURA de la caja sí se comparte para
   que el borde inferior quede a la misma altura que el borde del topbar —
   una sola línea continua cruzando sidebar+main. */
.logo, .sidebar-logo, .sidebar-brand, .sb-logo {
  height: 65px; flex-shrink: 0; box-sizing: border-box; padding-top: 0; padding-bottom: 0;
  display: flex; align-items: center;
}

.sidebar nav, .sidebar-nav { flex: 1; padding: 8px 10px; overflow-y: auto; scrollbar-width: none; }
.sidebar nav::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nav-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 9px; font-weight: 600; color: var(--muted); letter-spacing: .8px;
  text-transform: uppercase; padding: 0 8px; margin-bottom: 4px; cursor: pointer; user-select: none;
}
.nav-label .ti-chevron-down { font-size: 12px; transition: transform .15s; }
.nav-section.collapsed .nav-label .ti-chevron-down { transform: rotate(-90deg); }
.nav-section.collapsed .nav-item { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 400; transition: all .12s;
  border: 1px solid transparent; margin-bottom: 1px; text-decoration: none; user-select: none;
}
.nav-item:hover { background: var(--navy-3); color: var(--snow-dim); }
.nav-item.active { background: var(--electric-glow); border-color: rgba(30,111,217,.3); color: var(--snow); font-weight: 500; }
.nav-item.active i, .nav-item.active .ti { color: var(--electric); }
.nav-item i, .nav-item .ti { font-size: 16px; width: 16px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--electric); color: #fff; font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 999px; }

/* .sidebar-footer no fuerza display/layout interno a propósito — algunas
   vistas arreglan el footer en fila (avatar+nombre+botones, dueño/encargado)
   y otras en columna (empleado apila botones completos) por diseño. */
.sidebar-footer { border-top: 1px solid var(--border); }
.avatar, .user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--electric); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 500; color: var(--snow); }
.user-role { font-size: 10px; color: var(--muted); }

/* ── MAIN / TOPBAR / CONTENT ──
   margin-left (para dejar espacio al sidebar fixed) queda en el <style>
   propio de cada vista por la misma razón de arriba — ver nota en .sidebar. */
.main { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar, .page-header, .main-header {
  height: 65px; box-sizing: border-box;
  padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--navy);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.page-title { font-size: 16px; font-weight: 600; color: var(--snow); }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.content, .main-content { flex: 1; overflow-y: auto; padding: 22px 24px; scrollbar-width: none; }
.content::-webkit-scrollbar, .main-content::-webkit-scrollbar { display: none; }
.panel, .page { display: none; }
.panel.active, .page.active { display: block; }

/* ── HAMBURGER + OVERLAY MÓVIL ── */
.hamburger {
  display: none; width: 36px; height: 36px; border-radius: 7px; background: var(--navy-3);
  border: 1px solid var(--border-light); color: var(--snow); cursor: pointer;
  align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.sidebar-overlay, .sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99;
}
.sidebar-overlay.open, .sidebar-backdrop.open { display: block; }

/* ── RESPONSIVE: sidebar colapsa a icon-only en tablet ── */
@media (min-width: 769px) and (max-width: 1023px) {
  :root { --sidebar-w: 64px; }
  .brand-name, .brand-sub, .nav-label, .nav-item span:not(.nav-badge), .user-name, .user-role { display: none; }
  .logo, .sidebar-logo, .sidebar-brand, .sb-logo { padding: 14px; justify-content: center; }
  .logo > div, .sidebar-logo > div, .sidebar-brand > div { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item i, .nav-item .ti { width: auto; font-size: 18px; }
  .nav-badge { display: none; }
  .sidebar-footer { justify-content: center; padding: 10px; }
  .avatar { margin: 0; }
}

/* ── RESPONSIVE: sidebar off-canvas en móvil ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  body { overflow: auto; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; height: 100%;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; height: auto; min-height: 100vh; overflow: visible; }
  .hamburger { display: inline-flex; }
  .topbar, .page-header, .main-header { height: 56px; padding: 0 14px; position: sticky; top: 0; z-index: 50; }
  .logo, .sidebar-logo, .sidebar-brand, .sb-logo { height: 56px; }
  .content, .main-content { padding: 14px 12px; overflow-y: visible; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 7px 10px; }
}
