/* ============================================
   📐 LAYOUT - Sidebar, Header, Main, Footer
   ============================================ */
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--fuente-principal);
  background: var(--fondo-principal);
  color: var(--texto-principal);
  -webkit-font-smoothing: antialiased;
}
.oculto { display: none !important; }
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--header-altura);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--superficie);
  z-index: 20;
  border-bottom: 1px solid var(--borde);
}
.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 6px 8px;
  border-radius: var(--radio-borde-xs);
  cursor: pointer;
  color: var(--texto-principal);
}
.brand-btn:hover { background: var(--fondo-suave); }
.dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 4px;
}
.dots span {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--texto-principal);
  opacity: .85;
}
.logo {
  width: 38px; height: 38px;
  border-radius: var(--radio-borde-xs);
  background: linear-gradient(135deg, var(--color-marca), var(--color-marca-2));
  display: grid; place-items: center;
  color: #fff; font-weight: 900; font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong { color: var(--color-marca); font-size: 16px; }
.brand-text span {
  font-size: 10px; color: var(--texto-secundario);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.user-btn {
  padding: 8px 12px;
  border-radius: var(--radio-borde-xs);
  border: 1px solid var(--borde);
  background: var(--fondo-suave);
  font-weight: 700; color: var(--texto-principal);
  cursor: pointer; font-size: 14px;
}
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.sidebar {
  width: var(--sidebar-ancho);
  flex-shrink: 0;
  border-right: 1px solid var(--borde);
  background: var(--superficie);
  overflow-y: auto;
  transition: var(--transicion-media);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 14px 16px 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--texto-secundario);
  font-weight: 800;
}
.sidebar-group {
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--color-marca);
  font-weight: 700;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  gap: 12px;
}
.sidebar-title-wrap { min-width: 0; flex: 1; }
.sidebar-overall {
  width: 44px; height: 44px;
  flex-shrink: 0;
}
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--fondo-principal);
  padding: 24px clamp(16px, 2.5vw, 32px);
}
.app-footer {
  height: var(--footer-altura);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--superficie);
  color: var(--texto-secundario);
  font-size: 13px; font-weight: 600;
  border-top: 1px solid var(--borde);
}
@media (max-width: 960px) {
  :root { --sidebar-ancho: 280px; }
  .sidebar {
    position: fixed;
    top: var(--header-altura); left: 0; bottom: var(--footer-altura);
    z-index: 30;
    box-shadow: var(--sombra);
    transform: translateX(-100%);
  }
  .sidebar.abierto { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: var(--header-altura) 0 var(--footer-altura) 0;
    background: rgba(0,0,0,.5);
    z-index: 25;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }
  .main { padding: 16px; }
}
