/* ESTRUCTURA DASHBOARD RESPONSIVE */
#pantallaApp { display: none; height: 100vh; height: 100dvh; width: 100vw; }
.sidebar { width: 260px; background: var(--bg-panel); display: flex; flex-direction: column; border-right: 1px solid var(--border-color); z-index: 100; transition: width 0.3s ease; }
.sidebar-header { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); height: 75px; flex-shrink: 0; overflow: hidden; white-space: nowrap;}
#menuLateral { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 15px 10px; }
#menuLateral::-webkit-scrollbar { width: 4px; }
#menuLateral::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

/* ITEMS DEL MENÚ ACORDEÓN */
.menu-group { margin-bottom: 4px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-radius: 10px; cursor: pointer; color: var(--text-muted); font-weight: 600; user-select: none; transition: 0.2s; white-space: nowrap; }
.menu-item:hover, .menu-item.active { background: var(--bg-hover); color: var(--text-main); }
.menu-item.active i.icon-main { color: var(--accent); }
.menu-item i.icon-main { width: 24px; text-align: center; font-size: 1.1rem; flex-shrink: 0; }
.menu-item i.chevron { font-size: 0.7rem; transition: transform 0.3s; }
.menu-group.open .chevron { transform: rotate(180deg); color: var(--accent); }

/* SUBMÓDULOS */
.submenu { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; background: var(--bg-card); border-radius: 8px; margin: 0 5px; }
.menu-group.open .submenu { max-height: 500px; padding: 5px 0; border: 1px solid var(--border-color); margin-top: 2px;}
.submenu-item { padding: 10px 15px 10px 20px; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 10px; transition: 0.2s;}
.submenu-item:hover, .submenu-item.sub-active { color: var(--accent); font-weight: bold; background: rgba(0,0,0,0.1); }
.submenu-item i { font-size: 0.6rem; opacity: 0.6; }
.submenu-item.sub-active i { opacity: 1; }

/* FOOTER SIDEBAR */
.sidebar-footer { padding: 15px; border-top: 1px solid var(--border-color); flex-shrink: 0; overflow: hidden; white-space: nowrap; }
.theme-switch-wrapper { display: flex; align-items: center; justify-content: space-between; padding: 10px; margin-bottom: 10px; border-radius: 10px; }
.theme-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0;}
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 22px; border: 1px solid var(--border-color);}
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: var(--text-muted); transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); border-color: var(--accent);}
input:checked + .slider:before { transform: translateX(18px); background-color: white;}
.user-profile { display: flex; align-items: center; gap: 12px; margin-top: 5px; padding: 0 5px;}

/* AREA PRINCIPAL */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-base); }
.top-header { height: 75px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); background: var(--bg-panel); flex-shrink: 0; }
.header-left { display: flex; align-items: center; gap: 20px; }
.btn-toggle-menu { display: none; background: transparent; border: none; color: var(--text-main); font-size: 1.2rem; cursor: pointer; transition: 0.2s; padding: 5px; }
.btn-toggle-menu:hover { color: var(--accent); }
.breadcrumbs { font-size: 1rem; font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.breadcrumbs .padre { color: var(--text-muted); font-size: 0.9rem; }
.main-area { flex: 1; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; height: 100%; }

/* MODO MINI */
.sidebar.mini { width: 75px; }
.sidebar.mini .empresa-nombre, .sidebar.mini .menu-texto, .sidebar.mini .chevron, .sidebar.mini .user-info, .sidebar.mini .theme-switch-wrapper span { display: none; }
.sidebar.mini .sidebar-header { justify-content: center; padding: 20px 0; }
.sidebar.mini .menu-item { justify-content: center; padding: 12px 0; }
.sidebar.mini .menu-item i.icon-main { margin: 0; font-size: 1.3rem; }
.sidebar.mini .user-profile { justify-content: center; padding: 0; }
.sidebar.mini .theme-switch-wrapper { justify-content: center; }
.sidebar-header { cursor: pointer; transition: background 0.2s; }
.sidebar-header:hover { background: var(--bg-hover); }

/* MÓVIL */
@media (max-width: 768px) {
  .btn-toggle-menu { display: block; }
  .sidebar { position: fixed; left: -260px; height: 100vh; width: 260px; box-shadow: 5px 0 15px rgba(0,0,0,0.5); }
  .sidebar.mobile-open { left: 0; }
  .top-header { padding: 0 15px; }
  .main-area { padding: 15px; }
  #mobileOverlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 90; }
  #mobileOverlay.active { display: block; }
}