/* Aasperu · Barra lateral institucional única v34 · 2026-10-22
   Mismo CSS en Administrativo, CRM y Financiero (incluido Compras).
   Sin cambios en reglas de negocio, navegación, permisos ni pie institucional. */
@media screen {
  :root {--aas-menu-v33-width:220px;--aas-menu-v33-oro:#d6b06b;--aas-menu-v33-borde:rgba(255,255,255,.22)}
  /* Igualar el ancho útil de los tres sistemas sin tocar las páginas internas. */
  html body.app .aas-layout:not(.aas-collapsed){grid-template-columns:var(--aas-menu-v33-width) minmax(0,1fr)!important}
  html body.crm-shell{padding-left:var(--aas-menu-v33-width)!important}
  html body.aasperu-finance:not(.compras){padding-left:var(--aas-menu-v33-width)!important}
  html body.compras-with-sidebar>main{margin-left:var(--aas-menu-v33-width)!important;width:calc(100% - var(--aas-menu-v33-width))!important}

  /* La capa visual es compartida; cada sistema conserva el contenedor nativo. */
  :is(html body.app aside.sidebar.aas-sidebar,
      html body.crm-shell aside#crm-sidebar.crm-sidebar,
      html body.aasperu-finance:not(.compras)>header.finance-header,
      html body.compras-with-sidebar aside.compras-sidebar){
    box-sizing:border-box!important;width:var(--aas-menu-v33-width)!important;max-width:var(--aas-menu-v33-width)!important;
    min-width:var(--aas-menu-v33-width)!important;height:100vh!important;height:100dvh!important;
    padding:14px 11px 13px!important;margin:0!important;
    background:linear-gradient(160deg,#90001f,#790018 46%,#530011 100%)!important;
    color:#fff!important;border:0!important;border-right:1px solid rgba(208,166,84,.45)!important;
    border-radius:0!important;box-shadow:2px 0 8px rgba(55,0,20,.12)!important;
    font-family:Roboto,Arial,sans-serif!important;
    display:flex!important;flex-direction:column!important;align-items:stretch!important;justify-content:flex-start!important;
    gap:0!important;overflow-y:auto!important;overflow-x:hidden!important;
    scrollbar-color:#b46b77 transparent;
  }
  /* LOGO: una sola imagen dorada, dimensiones proporcionadas, sin filtros ni deformaciones. */
  :is(html body.app .aas-sidebar .brand.aas-brand-institucional,
      html body.crm-shell #crm-sidebar .sidebar-brand,
      html body.aasperu-finance:not(.compras) .finance-identity,
      html body.compras-with-sidebar .compras-sidebar-brand){
    box-sizing:border-box!important;width:100%!important;display:block!important;text-align:center!important;
    padding:0 4px 14px!important;margin:0!important;background:transparent!important;
    border:0!important;border-bottom:1px solid var(--aas-menu-v33-borde)!important;
    border-radius:0!important;box-shadow:none!important;flex:none!important;
  }
  /* En Administrativo se conserva el SVG original en el código, pero el logo se presenta
     mediante la misma imagen que las otras dos barras (sin cambiar el HTML existente). */
  html body.app .aas-sidebar .brand.aas-brand-institucional>svg.aas-brand-logo{display:none!important}
  html body.app .aas-sidebar .brand.aas-brand-institucional::before{
    content:''!important;display:block!important;width:185px!important;max-width:100%!important;
    height:63px!important;margin:0 auto 10px!important;
    background:url('aasperu-menu-logo-v33.png') center / contain no-repeat!important;
  }
  :is(html body.crm-shell #crm-sidebar .sidebar-brand>img,
      html body.aasperu-finance:not(.compras) .finance-identity>img,
      html body.compras-with-sidebar .compras-sidebar-brand>img){
    display:block!important;box-sizing:border-box!important;width:185px!important;max-width:100%!important;
    height:auto!important;max-height:none!important;aspect-ratio:640/218!important;
    object-fit:contain!important;filter:none!important;margin:0 auto 10px!important;
    padding:0!important;transform:none!important;
  }
  :is(html body.app .aas-brand-institucional>strong,
      html body.crm-shell #crm-sidebar .sidebar-brand>strong,
      html body.aasperu-finance:not(.compras) .finance-identity .finance-legal-name,
      html body.compras-with-sidebar .compras-sidebar-brand>strong){
    display:block!important;color:#fff!important;
    font:700 10px/1.5 Roboto,Arial,sans-serif!important;letter-spacing:0!important;
    padding:0!important;margin:0!important;text-transform:none!important;
  }
  :is(html body.app .aas-brand-institucional>span,
      html body.crm-shell #crm-sidebar .sidebar-brand>small,
      html body.aasperu-finance:not(.compras) .finance-identity small,
      html body.compras-with-sidebar .compras-sidebar-brand>small){
    display:block!important;color:#ead7d9!important;font:400 9px/1.5 Roboto,Arial,sans-serif!important;
    letter-spacing:0!important;margin:2px 0 0!important;padding:0!important;
  }
  html body.aasperu-finance:not(.compras) .finance-identity>div{
    display:block!important;border:0!important;padding:0!important;margin:0!important;
  }
  html body.aasperu-finance:not(.compras) .finance-identity .finance-system-title{display:none!important}

  /* PERFIL DEL USUARIO: una jerarquía de datos idéntica. */
  :is(html body.app .aas-sidebar .aas-user,
      html body.crm-shell #crm-sidebar .operator,
      html body.aasperu-finance:not(.compras) .aas-sidebar-profile-v33,
      html body.compras-with-sidebar .compras-sidebar-profile){
    display:block!important;box-sizing:border-box!important;width:100%!important;
    padding:12px 7px 13px!important;margin:0!important;color:#fff!important;
    border:0!important;border-bottom:1px solid var(--aas-menu-v33-borde)!important;
    background:transparent!important;text-align:left!important;flex:none!important;
    line-height:1.5!important;
  }
  :is(html body.app .aas-sidebar .aas-user>strong,
      html body.crm-shell #crm-sidebar .operator,
      html body.aasperu-finance:not(.compras) .aas-sidebar-profile-v33>strong,
      html body.compras-with-sidebar .compras-sidebar-profile>strong){
    color:#fff!important;font:600 11px/1.5 Roboto,Arial,sans-serif!important;
    text-transform:none!important;letter-spacing:0!important;
  }
  :is(html body.app .aas-sidebar .aas-user>span,
      html body.crm-shell #crm-sidebar .operator>small,
      html body.aasperu-finance:not(.compras) .aas-sidebar-profile-v33>small,
      html body.compras-with-sidebar .compras-sidebar-profile>small){
    display:block!important;color:#f5d7dc!important;
    font:400 10px/1.5 Roboto,Arial,sans-serif!important;
    margin:2px 0 0!important;padding:0!important;letter-spacing:0!important;
  }

  /* NAVEGACIÓN: mismos márgenes, tamaños, íconos y estados. */
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]{
    display:flex!important;flex-direction:column!important;align-items:stretch!important;
    flex:1 1 auto!important;justify-content:flex-start!important;
    width:100%!important;min-width:0!important;gap:3px!important;
    margin:0!important;padding:11px 0 0!important;text-align:left!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]::before{
    content:'NAVEGACIÓN'!important;display:block!important;
    color:#e4b7c2!important;background:none!important;
    font:500 9px/1.5 Roboto,Arial,sans-serif!important;letter-spacing:1px!important;
    margin:0 0 5px!important;padding:3px 8px!important;
    width:auto!important;height:auto!important;position:static!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details{
    display:block!important;box-sizing:border-box!important;width:100%!important;
    min-width:0!important;padding:0!important;margin:0!important;
    border:0!important;background:transparent!important;box-shadow:none!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>a,
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details>summary{
    box-sizing:border-box!important;display:flex!important;align-items:center!important;
    justify-content:flex-start!important;flex-wrap:nowrap!important;
    gap:10px!important;width:100%!important;min-height:35px!important;
    padding:8px 10px!important;margin:0!important;
    background:transparent!important;color:#fff!important;
    border:1px solid transparent!important;border-radius:5px!important;
    box-shadow:none!important;text-align:left!important;text-decoration:none!important;
    font:600 11px/1.35 Roboto,Arial,sans-serif!important;white-space:normal!important;
    cursor:pointer!important;list-style:none!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details>summary::-webkit-details-marker{display:none!important}
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details>summary::after{
    content:'›'!important;display:block!important;position:static!important;margin-left:auto!important;
    background:none!important;width:auto!important;height:auto!important;
    font:700 16px/1 Arial,sans-serif!important;color:#f1c6d0!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details[open]>summary::after{content:'⌄'!important}
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details[open]>summary,
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>a[aria-current="page"],
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>a:hover{
    background:rgba(255,255,255,.16)!important;color:#fff!important;
    border-color:rgba(255,255,255,.07)!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details>a{
    box-sizing:border-box!important;display:flex!important;align-items:center!important;
    justify-content:flex-start!important;width:calc(100% - 23px)!important;
    min-height:28px!important;gap:8px!important;
    margin:1px 0 1px 23px!important;padding:6px 6px 6px 9px!important;
    background:transparent!important;color:#fff!important;text-decoration:none!important;text-align:left!important;
    border:0!important;border-left:1px solid rgba(237,198,207,.45)!important;
    border-radius:0 5px 5px 0!important;
    font:500 10.5px/1.4 Roboto,Arial,sans-serif!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details:not([open])>a{display:none!important}
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details>a:hover,
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"]>details>a[aria-current="page"]{
    background:rgba(255,255,255,.15)!important;color:#fff!important;
  }
  /* Iconos originales de los cinco grupos (el único origen es NavegacionPlataforma.php). */
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"] svg.aas-menu-icono{
    display:block!important;position:static!important;visibility:visible!important;opacity:1!important;
    box-sizing:content-box!important;flex:0 0 15px!important;width:15px!important;height:15px!important;
    min-width:15px!important;max-width:15px!important;min-height:15px!important;max-height:15px!important;
    color:#fff!important;stroke:currentColor!important;fill:none!important;
    margin:0!important;padding:0!important;vertical-align:middle!important;transform:none!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"] details>a svg.aas-menu-icono{
    flex-basis:13px!important;width:13px!important;min-width:13px!important;max-width:13px!important;
    height:13px!important;min-height:13px!important;max-height:13px!important;
  }
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav[aria-label="Navegación principal"] svg.aas-menu-icono *{
    stroke:currentColor!important;fill:none!important;
  }
  /* Desactivar adornos CSS de versiones antiguas; el SVG compartido ya dibuja el icono. */
  html body.app .aas-sidebar nav[aria-label="Navegación principal"]>a::before,
  html body.app .aas-sidebar nav[aria-label="Navegación principal"]>details>summary::before,
  html body.crm-shell #crm-sidebar nav[aria-label="Navegación principal"]>a::before,
  html body.crm-shell #crm-sidebar nav[aria-label="Navegación principal"]>details>summary::before{
    content:none!important;display:none!important;background:none!important;
  }
  /* Botón de salir: el POST y su CSRF quedan nativos de cada sistema. */
  :is(html body.app .aas-sidebar form.aas-logout,
      html body.crm-shell #crm-sidebar .sidebar-logout,
      html body.aasperu-finance:not(.compras) .finance-header nav>form,
      html body.compras-with-sidebar .compras-sidebar .compras-sidebar-return){
    box-sizing:border-box!important;width:100%!important;margin-top:auto!important;
    padding-top:14px!important;flex:none!important;
  }
  html body.aasperu-finance:not(.compras) .finance-header nav>form.inline{
    margin-top:auto!important;padding-top:14px!important;width:100%!important;
  }
  :is(html body.app .aas-sidebar form.aas-logout button,
      html body.crm-shell #crm-sidebar .sidebar-logout button,
      html body.aasperu-finance:not(.compras) .finance-header nav>form button,
      html body.compras-with-sidebar .compras-sidebar .compras-sidebar-return){
    display:block!important;box-sizing:border-box!important;width:100%!important;min-height:32px!important;
    margin:0!important;padding:8px 10px!important;
    color:#fff!important;background:rgba(255,255,255,.12)!important;
    border:1px solid rgba(255,255,255,.26)!important;border-radius:5px!important;
    box-shadow:none!important;font:600 11px/1.35 Roboto,Arial,sans-serif!important;
    text-align:center!important;text-decoration:none!important;cursor:pointer!important;
  }
  :is(html body.app .aas-sidebar form.aas-logout button,
      html body.crm-shell #crm-sidebar .sidebar-logout button,
      html body.aasperu-finance:not(.compras) .finance-header nav>form button,
      html body.compras-with-sidebar .compras-sidebar .compras-sidebar-return):hover{
    background:rgba(255,255,255,.22)!important;
  }
  /* Compras: el acceso inferior sigue siendo su regreso original; no se finge un cierre de sesión. */
  html body.compras-with-sidebar .compras-sidebar .compras-sidebar-return{margin-top:auto!important}
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav a:focus-visible,
  :is(html body.app .aas-sidebar,
      html body.crm-shell #crm-sidebar,
      html body.aasperu-finance:not(.compras) .finance-header,
      html body.compras-with-sidebar .compras-sidebar) nav summary:focus-visible{
    outline:2px solid var(--aas-menu-v33-oro)!important;outline-offset:2px!important;
  }
  html body.aasperu-finance.plataforma-menu-collapsed:not(.compras){padding-left:0!important}
}
@media screen and (max-width:800px){
  html body.app .aas-layout:not(.aas-collapsed){grid-template-columns:minmax(0,1fr)!important}
  html body.app aside.sidebar.aas-sidebar{display:none!important}
  html body.app .aas-layout.aas-mobile-open aside.sidebar.aas-sidebar{
    display:flex!important;height:auto!important;min-height:0!important;max-height:72vh!important;
    width:100%!important;max-width:none!important;min-width:0!important;position:static!important;
  }
  html body.crm-shell,html body.aasperu-finance:not(.compras){padding-left:0!important}
  html body.crm-shell>aside#crm-sidebar.crm-sidebar{
    transform:translateX(-100%)!important;
  }
  html body.crm-shell.menu-open>aside#crm-sidebar.crm-sidebar{transform:translateX(0)!important}
  html body.aasperu-finance:not(.compras)>header.finance-header{
    display:none!important;top:53px!important;bottom:0!important;height:auto!important;
    width:min(260px,85vw)!important;max-width:85vw!important;min-width:0!important;
  }
  html body.aasperu-finance.plataforma-menu-open:not(.compras)>header.finance-header{display:flex!important}
  html body.compras-with-sidebar>main{margin-left:0!important;width:100%!important}
  html body.compras-with-sidebar aside.compras-sidebar{
    position:relative!important;width:100%!important;max-width:none!important;min-width:0!important;
    height:auto!important;max-height:none!important;
  }
  html body.compras.compras-menu-collapsed .compras-sidebar{display:none!important}
}
@media print{
  html body.app aside.sidebar.aas-sidebar,
  html body.crm-shell aside#crm-sidebar.crm-sidebar,
  html body.aasperu-finance:not(.compras)>header.finance-header,
  html body.compras-with-sidebar aside.compras-sidebar{display:none!important}
  html body.crm-shell,html body.aasperu-finance:not(.compras){padding-left:0!important}
  html body.compras-with-sidebar>main{margin-left:0!important;width:100%!important}
}

/* v34: logotipo SVG vectorial nativo de la plantilla aprobada; sin dependencias de recursos img. */
@media screen{
  html body.crm-shell #crm-sidebar .sidebar-brand>svg.aas-brand-logo,
  html body.aasperu-finance:not(.compras) .finance-identity>svg.aas-brand-logo,
  html body.compras-with-sidebar .compras-sidebar-brand>svg.aas-brand-logo{
    display:block!important;visibility:visible!important;opacity:1!important;
    box-sizing:border-box!important;position:static!important;
    width:185px!important;height:63px!important;min-width:0!important;max-width:100%!important;
    margin:0 auto 10px!important;padding:0!important;transform:none!important;
    filter:none!important;object-fit:contain!important;flex:none!important;
  }
  html body.crm-shell #crm-sidebar .sidebar-brand>svg.aas-brand-logo path,
  html body.aasperu-finance:not(.compras) .finance-identity>svg.aas-brand-logo path,
  html body.compras-with-sidebar .compras-sidebar-brand>svg.aas-brand-logo path{
    fill:#d6b06b!important;
  }
  html body.aasperu-finance:not(.compras)>header.finance-header .finance-identity .finance-system-title{
    display:none!important;
  }
  html body.aasperu-finance:not(.compras)>header.finance-header .aas-sidebar-profile-v33,
  html body.compras-with-sidebar .compras-sidebar-profile{
    box-sizing:border-box!important;display:block!important;flex:0 0 auto!important;
    text-align:left!important;padding:12px 7px 13px!important;margin:0!important;
    border-bottom:1px solid rgba(255,255,255,.22)!important;
    width:100%!important;background:transparent!important;
  }
  html body.aasperu-finance:not(.compras)>header.finance-header .aas-sidebar-profile-v33>strong,
  html body.compras-with-sidebar .compras-sidebar-profile>strong{
    display:block!important;font:600 11px/1.5 Roboto,Arial,sans-serif!important;
    color:#fff!important;letter-spacing:0!important;text-transform:none!important;
    margin:0!important;padding:0!important;max-width:100%!important;
  }
  html body.aasperu-finance:not(.compras)>header.finance-header .aas-sidebar-profile-v33>small,
  html body.compras-with-sidebar .compras-sidebar-profile>small{
    display:block!important;font:400 10px/1.5 Roboto,Arial,sans-serif!important;
    color:#f5d7dc!important;letter-spacing:0!important;margin:2px 0 0!important;
  }
}
