:root {
  --glp-primary: #0055a5;
  --glp-primary-dk: #003d7a;
  --glp-accent: #00a1e4;
  --glp-sidebar-bg: #0b2545;
  --glp-sidebar-txt: #e8f1fa;
  --glp-sidebar-act: #0066cc;
  --glp-sidebar-w: 270px;
  --glp-topbar-h: 54px;
  --glp-statusbar-h: 40px;
}

body {
  background-color: #f4f6f9;
  color: #1e293b;
  font-size: 0.92rem;
}

/* Login */
.glp-login-body {
  background: linear-gradient(135deg, #0b2545 0%, #0055a5 100%);
}
.glp-login-badge {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--glp-primary);
  color: #fff;
  display: grid;
  place-items: center;
}

/* Override Bootstrap primary con la paleta activa de empresa / perfil */
.btn-primary {
  background-color: var(--glp-primary);
  border-color: var(--glp-primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--glp-primary-dk);
  border-color: var(--glp-primary-dk);
}
.text-brand {
  color: var(--glp-primary);
}

/* Topbar */
.glp-topbar {
  height: var(--glp-topbar-h);
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
}
.glp-brand-logo {
  max-height: 34px;
  max-width: 110px;
  object-fit: contain;
}

/* Layout principal */
.glp-wrapper {
  display: flex;
  padding-top: var(--glp-topbar-h);
  padding-bottom: var(--glp-statusbar-h);
  min-height: 100vh;
}

/* Barra Lateral Izquierda colapsable */
.glp-sidebar {
  width: var(--glp-sidebar-w);
  background: var(--glp-sidebar-bg);
  color: var(--glp-sidebar-txt);
  position: fixed;
  top: var(--glp-topbar-h);
  bottom: var(--glp-statusbar-h);
  left: 0;
  z-index: 1020;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease, width 0.2s ease;
}

.glp-sidebar-search {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.glp-sidebar-search input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 0.84rem;
}
.glp-sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.glp-sidebar-search input:focus {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  box-shadow: none;
  border-color: var(--glp-accent);
}

.glp-sidebar-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.5rem 1.25rem;
}

/* Árbol nativo <details> / <summary> sin encabezados dentro de summary */
.glp-tree-cat {
  margin-bottom: 0.25rem;
}
.glp-tree-cat > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.48rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--glp-sidebar-txt);
  user-select: none;
}
.glp-tree-cat > summary::-webkit-details-marker {
  display: none;
}
.glp-tree-cat > summary::before {
  content: "▸";
  display: inline-block;
  width: 0.9rem;
  text-align: center;
  opacity: 0.75;
  flex-shrink: 0;
}
.glp-tree-cat[open] > summary::before {
  transform: rotate(90deg);
}
@media (prefers-reduced-motion: no-preference) {
  .glp-tree-cat > summary::before {
    transition: transform 0.18s ease;
  }
  .glp-tree-cat::details-content {
    interpolate-size: allow-keywords;
    overflow: clip;
    contain: layout;
    transition: block-size 0.22s ease, content-visibility 0.22s ease;
    transition-behavior: allow-discrete;
  }
  .glp-tree-cat:not([open])::details-content {
    block-size: 0;
  }
}
.glp-tree-cat > summary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.glp-tree-items {
  list-style: none;
  margin: 0.15rem 0 0.35rem 0;
  padding: 0 0 0 1.25rem;
}
.glp-tree-items a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.36rem 0.6rem;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.82rem;
}
.glp-tree-items a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.glp-tree-items a.active {
  background: var(--glp-sidebar-act);
  color: #ffffff;
  font-weight: 600;
}

/* Contenido principal */
.glp-main {
  flex: 1;
  margin-left: var(--glp-sidebar-w);
  padding: 1.25rem 1.5rem;
  min-width: 0;
  transition: margin-left 0.2s ease;
}

/* Estado oculto / colapsado de la barra lateral */
body.sidebar-collapsed .glp-sidebar {
  transform: translateX(-100%);
}
body.sidebar-collapsed .glp-main {
  margin-left: 0;
}

@media (max-width: 991.98px) {
  .glp-main {
    margin-left: 0;
  }
  body:not(.sidebar-mobile-open) .glp-sidebar {
    transform: translateX(-100%);
  }
  body.sidebar-mobile-open .glp-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  }
}

/* Barra de estado inferior SGI */
.glp-statusbar {
  height: var(--glp-statusbar-h);
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  font-size: 0.78rem;
}
.glp-session-btn {
  min-width: 170px;
}

/* Modal nativo <dialog> de expiración de sesión */
dialog.glp-dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
dialog.glp-dialog[open] {
  display: block;
}
dialog.glp-dialog:modal {
  overscroll-behavior: contain;
}
dialog.glp-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  overflow: hidden;
  overscroll-behavior: contain;
}
.glp-dialog-header {
  background: var(--glp-primary);
  color: #fff;
  padding: 0.9rem 1.25rem;
}
.glp-dialog-body {
  padding: 1.25rem;
}
.glp-dialog-footer {
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
}
