/* Navegación compartida de módulos. No se carga en el Portal. */
body.cv-module-shell {
  --cv-side-width: 208px;
  --cv-header-height: 76px;
  --cv-side-blue: #303f98;
  padding-left: var(--cv-side-width);
}
body.cv-module-shell.cv-side-collapsed { --cv-side-width: 60px; }
.cv-module-shell > .topbar {
  z-index: 47;
  margin-left: calc(-1 * var(--cv-side-width));
  flex-wrap: nowrap;
  gap: 16px;
  min-height: 76px;
}
.cv-module-shell > .topbar > .brand { margin-right: auto; min-width: 0; }
.cv-module-shell > .topbar > .userbox { justify-content: flex-end; }
.cv-menu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 40px; width: 40px; height: 40px; padding: 0;
  color: var(--brand); background: #f0f3fa; border: 1px solid #e0e5f0;
  border-radius: 10px; cursor: pointer;
}
.cv-menu-toggle:hover { background: #e5eafb; }
.cv-menu-toggle svg, .cv-side-icon { width: 22px; height: 22px; flex-shrink: 0; }
.cv-sidebar {
  position: fixed; z-index: 46; left: 0; top: var(--cv-header-height); bottom: 0;
  width: var(--cv-side-width); background: var(--cv-side-blue); color: white;
  display: flex; flex-direction: column; padding: 14px 8px 10px;
  box-shadow: 2px 0 10px #15264a0b;
}
.cv-side-caption {
  color: #c2ccf1; text-transform: uppercase; letter-spacing: .12em;
  font-size: 10px; font-weight: 700; padding: 0 10px 10px; white-space: nowrap;
}
.cv-sidebar .cv-side-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; scrollbar-color: #8292d1 transparent; }
.cv-sidebar .cv-side-nav a, .cv-sidebar .cv-side-home {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 9px 10px; border-radius: 8px;
  color: #e5eafb; text-decoration: none; font-size: 14px; line-height: 1.35;
  font-weight: 500; flex-shrink: 0;
}
.cv-sidebar .cv-side-nav a:hover, .cv-sidebar .cv-side-home:hover { background: #ffffff14; color: white; }
.cv-sidebar .cv-side-nav a.on { background: #ffffff20; color: white; font-weight: 650; }
.cv-sidebar .cv-side-nav a.on::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: #b9ceff; }
.cv-side-label { flex: 1; min-width: 0; }
.cv-sidebar .badge { margin: 0 0 0 auto; font-size: 11px; min-width: 21px; text-align: center; padding: 2px 5px; flex-shrink: 0; }
.cv-side-bottom { border-top: 1px solid #ffffff20; margin-top: 10px; padding-top: 8px; }
.cv-side-collapsed .cv-side-label, .cv-side-collapsed .cv-side-caption { display: none; }
.cv-side-collapsed .cv-sidebar { padding-left: 8px; padding-right: 8px; }
.cv-side-collapsed .cv-sidebar .cv-side-nav a, .cv-side-collapsed .cv-sidebar .cv-side-home { justify-content: center; padding: 9px 0; }
.cv-side-collapsed .cv-sidebar .badge { position: absolute; right: 0; top: 0; font-size: 10px; min-width: 17px; padding: 1px 4px; }
.cv-side-overlay { display: none; }
.cv-module-shell .vipsito:not([style*="left"]) { left: calc(var(--cv-side-width) + 14px); }
.cv-module-shell .cv-menu-toggle:focus-visible, .cv-sidebar a:focus-visible { outline: 3px solid #93c5fd; outline-offset: -3px; }
.cv-side-tooltip { position: fixed; z-index: 100; color: white; background: #1f2937; padding: 7px 11px; border-radius: 6px; font-size: 13px; pointer-events: none; box-shadow: 0 3px 12px #0002; }
.cv-side-tooltip[hidden] { display: none; }
@media (min-width: 901px) {
  .cv-module-shell > .container { width: 100%; }
}
@media (max-width: 1150px) {
  .cv-module-shell > .topbar { gap: 10px; padding: 10px 14px; }
  .cv-module-shell .topbar .brand img { max-width: 115px; height: 34px; }
  .cv-module-shell .topbar .brand strong { font-size: .92rem; }
  .cv-module-shell .topbar .userbox { gap: 8px; }
}
@media (max-width: 900px) {
  body.cv-module-shell, body.cv-module-shell.cv-side-collapsed { padding-left: 0; --cv-side-width: 224px; }
  .cv-module-shell > .topbar { margin-left: 0; flex-wrap: wrap; min-height: 66px; }
  .cv-module-shell .cv-sidebar { visibility: hidden; transform: translateX(-100%); }
  .cv-module-shell.cv-side-mobile-open .cv-sidebar { visibility: visible; transform: translateX(0); }
  .cv-module-shell.cv-side-mobile-open { overflow: hidden; }
  .cv-module-shell.cv-side-mobile-open > .topbar { z-index: 72; }
  .cv-module-shell.cv-side-mobile-open .cv-sidebar { z-index: 71; }
  .cv-module-shell .vipsito:not([style*="left"]) { left: 14px; }
  .cv-module-shell.cv-side-mobile-open .cv-side-overlay {
    display: block; position: fixed; inset: var(--cv-header-height) 0 0; z-index: 70;
    background: #111b3d66; border: 0; padding: 0; cursor: pointer;
  }
  .cv-side-collapsed .cv-side-label { display: block; }
  .cv-side-collapsed .cv-side-caption { display: block; }
  .cv-side-collapsed .cv-sidebar { padding-left: 8px; padding-right: 8px; }
  .cv-side-collapsed .cv-sidebar .cv-side-nav a, .cv-side-collapsed .cv-sidebar .cv-side-home { justify-content: flex-start; padding: 9px 10px; }
  .cv-side-collapsed .cv-sidebar .badge { position: static; margin-left: auto; font-size: 11px; }
  .cv-module-shell .topbar .brand small { display: none; }
  .cv-module-shell .topbar .brand span { display: flex; }
  .cv-module-shell .topbar .brand .brand-volver { display: none; }
}
@media (max-width: 560px) {
  .cv-module-shell .topbar .brand img { max-width: 88px; height: 30px; }
  .cv-module-shell .topbar .brand strong { font-size: .82rem; }
  .cv-module-shell .topbar .userbox { width: 100%; gap: 9px; font-size: .82rem; }
  .cv-module-shell .topbar .userbox > a { margin-right: auto; }
  .cv-module-shell .topbar .userbox small { display: none; }
}
@media print {
  body.cv-module-shell, body.cv-module-shell.cv-side-collapsed { padding-left: 0; }
  .cv-sidebar, .cv-side-overlay, .cv-menu-toggle, .cv-side-tooltip { display: none !important; }
}
/* Cabecera móvil: identidad arriba a la derecha y accesos debajo, sin repartirlos por toda la fila. */
@media (max-width: 900px) {
  .cv-module-shell > .topbar {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: start; gap: 8px; padding: 10px;
  }
  .cv-module-shell > .topbar > .brand { align-self: center; width: 100%; }
  .cv-module-shell > .topbar > .userbox {
    display: grid; grid-template-columns: 44px 44px 54px;
    grid-template-rows: minmax(44px, auto) 44px; gap: 4px;
    width: auto; margin: 0; align-items: center; justify-items: end; font-size: .82rem;
  }
  .cv-module-shell .topbar .userbox > .chip { display: none; }
  .cv-module-shell .topbar .userbox > a,
  .cv-module-shell .topbar .userbox > span:not(.chip) {
    grid-column: 1 / 3; grid-row: 1; margin: 0; min-width: 0;
    max-width: 100%; text-align: right; white-space: normal; overflow-wrap: anywhere; line-height: 1.3;
  }
  .cv-module-shell .topbar .userbox small { display: none; }
  .cv-module-shell .topbar .userbox > form { grid-column: 3; grid-row: 1; margin: 0; }
  .cv-module-shell .topbar .userbox > form .btn { min-height: 44px; padding: 7px; }
  .cv-module-shell .topbar .userbox > #sug-btn { grid-column: 1; grid-row: 2; }
  .cv-module-shell .topbar .userbox > .vipsito-pestana { grid-column: 2; grid-row: 2; }
  .cv-module-shell .topbar .userbox > #notif { grid-column: 3; grid-row: 2; margin: 0; }
  .cv-module-shell .topbar #sug-btn, .cv-module-shell .topbar #notif-btn { width: 44px; height: 44px; }
  .cv-module-shell .topbar .notif-panel { position: fixed; top: var(--cv-header-height); left: 10px; right: 10px; width: auto; max-width: none; }
}
@media (max-width: 560px) {
  .cv-module-shell > .topbar > .cv-menu-toggle { grid-column: 1; grid-row: 1; }
  .cv-module-shell > .topbar > .userbox { grid-column: 3; grid-row: 1 / 3; }
  .cv-module-shell > .topbar > .brand,
  .cv-module-shell .topbar .brand .brand-contenido { display: contents; }
  .cv-module-shell .topbar .brand .brand-contenido > span { display: block; grid-column: 1 / 3; grid-row: 2; align-self: center; }
  .cv-module-shell .topbar .brand strong { white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  .cv-module-shell .topbar .brand img { grid-column: 2; grid-row: 1; align-self: center; max-width: 100%; width: 88px; height: auto; object-fit: contain; }
  .cv-module-shell .brand-portal:hover .brand-contenido,
  .cv-module-shell .brand-portal:focus-visible .brand-contenido { opacity: 1; }
}
