:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Colores Principales (Paleta Institucional Moderna EMS) */
  --color-primary: #831843; /* Vino institucional / DGETI / SEMS */
  --color-primary-hover: #9d174d;
  --color-primary-light: #fce7f3;
  --color-secondary: #0f172a; /* Slate 900 */
  --color-accent: #d97706; /* Ámbar / Dorado oficial */
  --color-accent-light: #fef3c7;

  /* Semáforo de estados */
  --color-success: #059669;
  --color-success-light: #d1fae5;
  --color-warning: #d97706;
  --color-warning-light: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-light: #fee2e2;
  --color-info: #0284c7;
  --color-info-light: #e0f2fe;

  /* Superficies y Fondos Modo Claro */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #831843;

  /* Textos */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverted: #ffffff;

  /* Sombras y Radios */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.12), 0 8px 10px -6px rgb(0 0 0 / 0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-size-base: 16px;
  --color-primary-dark: #4c0519;
  --sidebar-width: 270px;
  --sidebar-width-collapsed: 72px;
  --topbar-height: 70px;
}

html {
  font-size: var(--font-size-base, 16px);
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-card: #131b2e;
  --bg-card-subtle: #1c2744;
  --border-color: #243254;
  --border-focus: #be185d;

  --color-primary: #be185d;
  --color-primary-hover: #9d174d;
  --color-primary-light: #371424;
  --color-primary-dark: #500724;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --color-success-light: #064e3b;
  --color-warning-light: #451a03;
  --color-danger-light: #450a0a;
  --color-info-light: #082f49;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6);
}

/* TEMA PASTEL 1: Menta Serenidad (Verde Menta Pastel)
   Psicología: Disminución de fatiga visual, calma cardiaca, lectura sostenida sin tensión ocular. */
[data-theme="pastel-menta"] {
  --bg-app: #f1faf4;
  --bg-card: #ffffff;
  --bg-card-subtle: #e6f6ec;
  --border-color: #bbf0cb;
  --border-focus: #059669;

  --color-primary: #059669;
  --color-primary-hover: #047857;
  --color-primary-light: #d1fae5;
  --color-primary-dark: #064e3b;
  --color-secondary: #064e3b;
  --color-accent: #0d9488;
  --color-accent-light: #ccfbf1;

  --text-primary: #064e3b;
  --text-secondary: #047857;
  --text-muted: #529472;

  --shadow-sm: 0 1px 3px 0 rgb(6 78 59 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(6 78 59 / 0.07);
}

/* TEMA PASTEL 2: Lavanda Cognitiva (Lila / Violeta Pastel)
   Psicología: Estimulación del pensamiento reflexivo, reducción de ansiedad y serenidad evaluativa. */
[data-theme="pastel-lavanda"] {
  --bg-app: #f7f4fc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f0eaf8;
  --border-color: #e5daf7;
  --border-focus: #7c3aed;

  --color-primary: #7c3aed;
  --color-primary-hover: #6d28d9;
  --color-primary-light: #ede9fe;
  --color-primary-dark: #4c1d95;
  --color-secondary: #3b0764;
  --color-accent: #a855f7;
  --color-accent-light: #f3e8ff;

  --text-primary: #2e1065;
  --text-secondary: #581c87;
  --text-muted: #7c3aed;

  --shadow-sm: 0 1px 3px 0 rgb(124 58 237 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(124 58 237 / 0.07);
}

/* TEMA PASTEL 3: Brisa Celeste (Azul Cielo Pastel)
   Psicología: Claridad mental, orden analítico, control métrico y templanza cognitiva. */
[data-theme="pastel-azul"] {
  --bg-app: #f0f7fd;
  --bg-card: #ffffff;
  --bg-card-subtle: #e1f0fa;
  --border-color: #cce3f5;
  --border-focus: #0284c7;

  --color-primary: #0284c7;
  --color-primary-hover: #0369a1;
  --color-primary-light: #e0f2fe;
  --color-primary-dark: #075985;
  --color-secondary: #0c4a6e;
  --color-accent: #0ea5e9;
  --color-accent-light: #f0f9ff;

  --text-primary: #082f49;
  --text-secondary: #0369a1;
  --text-muted: #5193b2;

  --shadow-sm: 0 1px 3px 0 rgb(2 132 199 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(2 132 199 / 0.07);
}

/* TEMA PASTEL 4: Durazno Bienestar (Melocotón / Ámbar Pastel)
   Psicología: Calidez emocional sin sobreestimulación, confort amigable y reducción de frialdad visual. */
[data-theme="pastel-melocoton"] {
  --bg-app: #fff8f1;
  --bg-card: #ffffff;
  --bg-card-subtle: #feefdf;
  --border-color: #fde1c2;
  --border-focus: #c2410c;

  --color-primary: #c2410c;
  --color-primary-hover: #9a3412;
  --color-primary-light: #ffedd5;
  --color-primary-dark: #7c2d12;
  --color-secondary: #431407;
  --color-accent: #d97706;
  --color-accent-light: #fef3c7;

  --text-primary: #431407;
  --text-secondary: #7c2d12;
  --text-muted: #a15516;

  --shadow-sm: 0 1px 3px 0 rgb(194 65 12 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(194 65 12 / 0.07);
}

/* TEMA PASTEL 5: Salvia Zen (Verde Eucalipto / Salvia Pastel)
   Psicología: Neutralidad orgánica, descanso del cortisol, equilibrio minimalista y armonía visual. */
[data-theme="pastel-salvia"] {
  --bg-app: #f3f7f4;
  --bg-card: #ffffff;
  --bg-card-subtle: #e5ede8;
  --border-color: #cbd8cf;
  --border-focus: #2d5a52;

  --color-primary: #2d5a52;
  --color-primary-hover: #22443d;
  --color-primary-light: #d8e8e1;
  --color-primary-dark: #19312c;
  --color-secondary: #19312c;
  --color-accent: #457b70;
  --color-accent-light: #eaf3ef;

  --text-primary: #19312c;
  --text-secondary: #2d5a52;
  --text-muted: #5e7e76;

  --shadow-sm: 0 1px 3px 0 rgb(45 90 82 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(45 90 82 / 0.07);
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Layout Principal */
.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-app);
}

/* Sidebar Lateral */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  transition: padding 0.25s ease;
  position: relative;
}

.btn-collapse-sidebar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-collapse-sidebar:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  overflow: hidden;
  white-space: nowrap;
}

.brand-badge .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), #4c0519);
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgb(131 24 67 / 0.3);
  flex-shrink: 0;
}

.brand-badge .sub-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--color-accent-light);
  color: var(--color-accent);
  text-transform: uppercase;
  margin-left: 0.25rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: padding 0.25s ease;
}

.sidebar-top-section {
  margin-bottom: 0.5rem;
}

.nav-item-featured {
  background: linear-gradient(135deg, rgba(131, 24, 67, 0.08), rgba(217, 119, 6, 0.08));
  border: 1.5px solid rgba(131, 24, 67, 0.2);
  border-radius: 12px;
  font-weight: 800;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-item-featured:hover {
  background: linear-gradient(135deg, rgba(131, 24, 67, 0.15), rgba(217, 119, 6, 0.15));
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.nav-item-featured.active {
  background: linear-gradient(135deg, var(--color-primary), #9f1239) !important;
  color: #ffffff !important;
  border-color: #881337 !important;
  box-shadow: 0 4px 14px rgba(131, 24, 67, 0.35);
}

.nav-item-featured .featured-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(131, 24, 67, 0.12);
  color: var(--color-primary);
}

.nav-item-featured.active .featured-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Barra de Herramientas de Categorías */
.sidebar-category-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.4rem 0.45rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border-color);
}

.category-toolbar-title {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-toggle-all-categories {
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.btn-toggle-all-categories:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--color-primary);
}

/* Grupos y Acordeón de Categorías */
.nav-category-group {
  margin-bottom: 0.65rem;
  transition: all 0.2s ease;
}

.nav-category-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-left: 4px solid #4f46e5;
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.nav-category-header:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

/* Colores de Borde Izquierdo según Categoría */
.nav-category-header.header-gestion {
  border-left-color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.2);
}
.nav-category-header.header-evaluacion {
  border-left-color: #059669;
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.2);
}
.nav-category-header.header-evaluacion:hover {
  background: rgba(5, 150, 105, 0.14);
}
.nav-category-header.header-planeacion {
  border-left-color: #d97706;
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.2);
}
.nav-category-header.header-planeacion:hover {
  background: rgba(217, 119, 6, 0.14);
}
.nav-category-header.header-institucional {
  border-left-color: #64748b;
  background: rgba(100, 116, 139, 0.08);
  border-color: rgba(100, 116, 139, 0.2);
}
.nav-category-header.header-institucional:hover {
  background: rgba(100, 116, 139, 0.14);
}
.nav-category-header.header-admin {
  border-left-color: #831843;
  background: rgba(131, 24, 67, 0.08);
  border-color: rgba(131, 24, 67, 0.2);
}
.nav-category-header.header-admin:hover {
  background: rgba(131, 24, 67, 0.14);
}

.nav-category-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-category-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.nav-category-title {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.nav-category-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-category-count {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

.nav-category-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

/* Transición Acordeón al Colapsar */
.nav-category-group.collapsed .nav-category-chevron {
  transform: rotate(-90deg);
}

.nav-category-items {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding-left: 0.2rem;
  max-height: 900px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-top 0.2s ease;
}

.nav-category-group.collapsed .nav-category-items {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

/* Estilos de Ítems tipo Tarjeta / Botón Redondeado */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
  text-decoration: none;
}

.nav-item-card {
  border-radius: 12px;
  padding: 0.52rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 700;
  border-width: 1.5px;
  border-style: solid;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item-card .icon {
  font-size: 1.15rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.nav-item-card:hover .icon {
  transform: scale(1.12);
}

/* Temas de Color Pastel para las Tarjetas del Menú */
/* 1. Amber (Escuela & Roles / Evidencias) */
.nav-item-amber {
  background: #fffbeb;
  border-color: #fed7aa;
  color: #9a3412;
}
.nav-item-amber:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
  transform: translateX(3px);
}
.nav-item-amber.active {
  background: linear-gradient(135deg, #d97706, #ea580c) !important;
  border-color: #c2410c !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
  font-weight: 800;
}

/* 2. Peach (Padres & Tutores / Muro Agenda) */
.nav-item-peach {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.nav-item-peach:hover {
  background: #ffedd5;
  border-color: #fb923c;
  color: #7c2d12;
  transform: translateX(3px);
}
.nav-item-peach.active {
  background: linear-gradient(135deg, #ea580c, #f97316) !important;
  border-color: #ea580c !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
  font-weight: 800;
}

/* 3. Mint (Alumnos 360° / Pase de Lista / Ayuda) */
.nav-item-mint {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.nav-item-mint:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #14532d;
  transform: translateX(3px);
}
.nav-item-mint.active {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  font-weight: 800;
}

/* 4. Blue (Aula & Croquis / Calificaciones / Configuración) */
.nav-item-blue {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}
.nav-item-blue:hover {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0c4a6e;
  transform: translateX(3px);
}
.nav-item-blue.active {
  background: linear-gradient(135deg, #0284c7, #0ea5e9) !important;
  border-color: #0369a1 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
  font-weight: 800;
}

/* 4.5. Slate (Mobiliario & Inventario / Catálogos) */
.nav-item-slate {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}
.nav-item-slate:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateX(3px);
}
.nav-item-slate.active {
  background: linear-gradient(135deg, #475569, #64748b) !important;
  border-color: #334155 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.35);
  font-weight: 800;
}

/* 5. Lavender (Citatorios / Horario Semanal) */
.nav-item-lavender {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.nav-item-lavender:hover {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #4c1d95;
  transform: translateX(3px);
}
.nav-item-lavender.active {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
  border-color: #6d28d9 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
  font-weight: 800;
}

/* 6. Rose (Centro de Reportes SEP / Calendario) */
.nav-item-rose {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #be185d;
}
.nav-item-rose:hover {
  background: #fce7f3;
  border-color: #f472b6;
  color: #831843;
  transform: translateX(3px);
}
.nav-item-rose.active {
  background: linear-gradient(135deg, #db2777, #ec4899) !important;
  border-color: #be185d !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
  font-weight: 800;
}

/* Ajustes para Tema Oscuro */
[data-theme="dark"] .nav-item-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}
[data-theme="dark"] .nav-item-card:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateX(3px);
}
[data-theme="dark"] .nav-category-header {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .nav-category-count {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.nav-item:hover {
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
}

.nav-item.active:not(.nav-item-card):not(.nav-item-featured) {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(131, 24, 67, 0.15);
  font-weight: 700;
}

.nav-item .icon {
  font-size: 1.2rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.nav-item:hover .icon {
  transform: scale(1.1);
}

.nav-item .badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--color-danger);
  color: white;
  font-weight: 800;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
  transition: padding 0.25s ease;
}

.user-card-mini {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-card-subtle);
  transition: all 0.2s ease;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ========================================================= */
/* ESTADO COLAPSADO: SIMBOLOGÍA ICONOGRÁFICA Y TOOLTIPS      */
/* ========================================================= */
.app-sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.app-sidebar.collapsed .sidebar-header {
  padding: 0 0.5rem;
  justify-content: center;
}

.app-sidebar.collapsed .brand-badge .brand-text,
.app-sidebar.collapsed .brand-badge .sub-tag {
  display: none !important;
}

.app-sidebar.collapsed .btn-collapse-sidebar {
  position: absolute;
  right: -13px;
  top: calc(50% - 14px);
  background: var(--bg-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  z-index: 60;
  border: 1px solid var(--border-color);
}

.app-sidebar.collapsed .btn-collapse-sidebar .collapse-icon {
  display: inline-block;
  transform: rotate(180deg);
}

.app-sidebar.collapsed .sidebar-nav {
  padding: 1rem 0.5rem;
  align-items: center;
}

.app-sidebar.collapsed .sidebar-top-section {
  width: 100%;
  display: flex;
  justify-content: center;
}

.app-sidebar.collapsed .sidebar-category-toolbar {
  display: none !important;
}

.app-sidebar.collapsed .nav-category-group {
  margin-bottom: 0.5rem;
  width: 100%;
}

.app-sidebar.collapsed .nav-category-header {
  padding: 0.35rem 0;
  justify-content: center;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  margin-bottom: 0.35rem;
}

.app-sidebar.collapsed .nav-category-header .nav-category-title,
.app-sidebar.collapsed .nav-category-header .nav-category-meta {
  display: none !important;
}

.app-sidebar.collapsed .nav-category-header .nav-category-icon {
  font-size: 1.15rem;
  display: block;
}

.app-sidebar.collapsed .nav-category-items {
  max-height: none !important;
  opacity: 1 !important;
  margin-top: 0 !important;
  padding-left: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  pointer-events: auto !important;
}

.app-sidebar.collapsed .nav-item-card {
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  justify-content: center !important;
  border-radius: var(--radius-md) !important;
  margin: 0.15rem auto !important;
}

.app-sidebar.collapsed .nav-item-featured {
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  justify-content: center !important;
  border-radius: var(--radius-md) !important;
}

.app-sidebar.collapsed .featured-badge {
  display: none !important;
}

.app-sidebar.collapsed .nav-section-title {
  font-size: 0;
  height: 1px;
  margin: 0.6rem 0.25rem;
  padding: 0;
  background-color: var(--border-color);
  width: calc(100% - 0.5rem);
}

.app-sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.6rem 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  gap: 0;
}

.app-sidebar.collapsed .nav-item span:not(.icon) {
  display: none !important;
}

.app-sidebar.collapsed .nav-item .icon {
  font-size: 1.35rem;
  width: 26px;
  height: 26px;
  margin: 0;
}

/* Tooltips Flotantes para Simbología Iconográfica */
.app-sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}

.app-sidebar.collapsed .nav-item::before {
  content: '';
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent #0f172a transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 9999;
}

.app-sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.app-sidebar.collapsed .nav-item:hover::before {
  opacity: 1;
}

/* Footer Colapsado */
.app-sidebar.collapsed .sidebar-footer {
  padding: 0.75rem 0.35rem;
}

.app-sidebar.collapsed .sidebar-footer-links {
  flex-direction: column;
  gap: 0.45rem;
}

.app-sidebar.collapsed .sidebar-footer-links .footer-link-text,
.app-sidebar.collapsed .sidebar-footer-links .footer-separator {
  display: none !important;
}

.app-sidebar.collapsed .user-card-mini {
  flex-direction: column;
  padding: 0.4rem 0;
  background: transparent;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.app-sidebar.collapsed .user-card-mini .user-info {
  display: none !important;
}

.app-sidebar.collapsed .user-avatar {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
}

/* Área de Contenido Principal y Sincronización */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-collapsed .app-main,
.app-sidebar.collapsed ~ .app-main,
.app-main.sidebar-collapsed {
  margin-left: var(--sidebar-width-collapsed) !important;
}

/* Topbar Superior */
.app-topbar {
  height: var(--topbar-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: none;
  border: 1px solid transparent;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-sidebar-toggle:hover {
  background: var(--bg-card-subtle);
  color: var(--color-primary);
  border-color: var(--border-color);
}

.context-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.context-selector select {
  background: transparent;
  border: none;
  outline: none;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}

.topbar-center {
  flex: 1;
  max-width: 520px;
}

.search-bar-global {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-bar-global:hover {
  border-color: var(--color-primary);
}

.search-bar-global .kbd-shortcut {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
  border-color: var(--color-primary);
}

/* Contenido Principal de Vistas */
.app-content {
  flex: 1;
  padding: 1.75rem 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .app-main,
  .app-layout.sidebar-collapsed .app-main,
  .app-sidebar.collapsed ~ .app-main,
  .app-main.sidebar-collapsed {
    margin-left: 0 !important;
  }
  .btn-sidebar-toggle {
    display: flex;
  }
  .app-content {
    padding: 1.25rem 1rem;
  }
}

/* Scrollbar Custom */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
