/* Layout general tipo Fiori shell - CORREGIDO PARA SCROLL */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b2834;
  background-color: #f4f7fb;
  height: 100vh; /* CRÍTICO: Debe ocupar 100% del viewport */
  overflow: hidden; /* CRÍTICO: Previene que el BODY haga scroll */
}

.shell {
  height: 100%; /* CRÍTICO: Ocupa el 100% del body */
  display: flex;
  flex-direction: column;
}

/* Barra superior */
.shell-header {
  height: 48px;
  background: #0a6ed1;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 14px;
}

.shell-header-left {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-weight: 600;
}

.app-subtitle {
  font-size: 12px;
  opacity: 0.9;
}

/* Contenido principal */
.shell-main {
  flex: 1; /* CRÍTICO: Ocupa todo el espacio vertical restante */
  display: flex;
  min-height: 0;
  overflow: hidden; /* CRÍTICO: Contenedor principal que previene el scroll de la página */
}

/* Sidebar */
.shell-sidebar {
  width: 260px;
  background: #f7f9fb;
  border-right: 1px solid #d5dadd;
  padding: 12px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto; /* Permite scroll solo en la barra si hay muchos items */
  flex-shrink: 0; /* Asegura que la barra no se encoja */
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 8px;
  border-bottom: 1px solid #e0e4ea;
  margin-bottom: 4px;
}

.logo-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0a6ed1;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.logo-text {
  font-weight: 600;
  font-size: 14px;
}

/* Grupos del menú (dropdown simple con <details>) */
.nav-group {
  border-radius: 4px;
  padding: 4px;
}

.nav-group summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b6279;
  margin-bottom: 4px;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

/* Botones de navegación */
.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-home {
  margin-bottom: 4px;
}

.nav-item-title {
  font-size: 13px;
  font-weight: 600;
}

.nav-item-sub {
  font-size: 11px;
  color: #6a7885;
}

.nav-item:hover {
  background: #e9f3ff;
}

.nav-item.is-active {
  background: #d1e8ff;
  outline: 1px solid #0a6ed1;
}

/* Zona central */
.shell-content {
  flex: 1; /* CRÍTICO: Ocupa el resto del espacio */
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto; /* CRÍTICO: Solo el contenido debe desplazarse */
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-shrink: 0; /* No se encoge al hacer scroll */
}

.content-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

/* Botón "Volver" */
.back-button {
  border: 1px solid #0a6ed1;
  background: #fff;
  color: #0a6ed1;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.back-button:hover {
  background: #e9f3ff;
}

/* Panel de bienvenida */
.welcome-panel {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 16px 20px 20px;
  flex-shrink: 0; /* Asegura que la tarjeta inicial no se colapse */
}

.welcome-lead {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 14px;
  color: #43576a;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.welcome-card {
  border-radius: 6px;
  border: 1px solid #e0e4ea;
  padding: 12px 14px;
  background: #fafbfc;
}

.welcome-card h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.welcome-card h3 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #6a7885;
}

.welcome-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

/* Pie de página */
.shell-footer {
  height: 32px;
  padding: 0 16px;
  font-size: 11px;
  color: #6a7885;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #d5dadd;
  background: #f7f9fb;
  flex-shrink: 0; /* CRÍTICO: Fija el footer */
}

/* Utilidades y Overrides */
.hidden { display: none !important; }

/* Overrides para Header dinámico */
.shell-header-right { display: flex; align-items: center; font-size: 0.95rem; color: rgba(255, 255, 255, 0.9); }
.user-name-display { font-weight: 600; color: white; text-transform: capitalize; }
.logout-text-btn { background: none; border: none; color: #ffcccb; cursor: pointer; font-size: 0.95rem; font-family: inherit; text-decoration: underline; padding: 0; margin-left: 5px; }
.logout-text-btn:hover { color: white; }