/* =================================================================
 * datalab-shell.css
 * Layout canónico de DataLab — Unitrópico (F3)
 *
 * Esqueleto visual que envuelve a cada vista interna:
 *   - <header.dl-shell-header>  (header del landing, sticky)
 *   - <aside.dl-shell-sidebar>  (módulos según rol, drawer móvil)
 *   - <main.dl-shell-main>      (contenido de la vista)
 *   - <footer.dl-shell-footer>  (institucional)
 *
 * Tokens en datalab-tokens.css. Aquí solo layout y componentes
 * específicos del chrome del shell.
 * ================================================================= */

@import url('./datalab-tokens.css');
@import url('./datalab-utilities.css');

/* Reset minimal */
.dl-shell-body {
  margin: 0;
  font-family: var(--dl-font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--dl-text);
  background:
    radial-gradient(70% 55% at 50% 0%, rgba(0, 89, 78, 0.10) 0%, rgba(0, 89, 78, 0) 65%),
    radial-gradient(40% 35% at 92% 6%, rgba(181, 161, 96, 0.10) 0%, rgba(181, 161, 96, 0) 70%),
    linear-gradient(180deg, var(--dl-green-tintl) 0%, #ffffff 320px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ─── Grid layout (desktop) ──────────────────────────── */
/* El footer queda solo en la columna del main; el aside ocupa toda
 * la columna izquierda y nunca tapa ni se solapa con el footer. */
.dl-shell-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header  header"
    "sidebar main"
    "sidebar footer";
  min-height: 100vh;
}

.dl-shell-header  { grid-area: header;  }
.dl-shell-sidebar { grid-area: sidebar; }
.dl-shell-main    { grid-area: main;    }
.dl-shell-footer  { grid-area: footer;  }

/* ─── Header sticky (idéntico al landing) ────────────── */
/* z-index 80 → por encima del sidebar (70) para que el aside no
 * sobresalga visualmente sobre el header al hacer scroll. El flyout
 * sigue por encima (var(--dl-z-tooltip) = 1090). */
.dl-shell-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--dl-line);
  box-shadow: 0 1px 3px rgba(0, 38, 31, 0.04);
}

.dl-shell-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 40px);
  min-height: 64px;
}

.dl-shell-header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* ─── Variante module: header glass verde #00b9a3 ───────
 * Se aplica con la clase .is-module en /datalab/<modulo>.
 * Usa el verde brillante institucional con backdrop-filter para
 * mantener el efecto glass sobre el contenido scrolleado. */
.dl-shell-header.is-module {
  background:
    radial-gradient(120% 80% at 0% 0%,   rgba(0, 185, 163, 0.22) 0%, rgba(0, 185, 163, 0) 60%),
    radial-gradient(120% 80% at 100% 0%, rgba(181, 161, 96, 0.18) 0%, rgba(181, 161, 96, 0) 60%),
    linear-gradient(135deg, #007a6b 0%, #00a691 45%, #00b9a3 100%);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 22px rgba(0, 89, 78, 0.22);
}

/* Texto + marca contrastando sobre verde */
.dl-shell-header.is-module .dl-shell-brand,
.dl-shell-header.is-module .dl-shell-brand-name { color: #ffffff; }
.dl-shell-header.is-module .dl-shell-brand-tag  { color: rgba(255, 255, 255, 0.78); }
.dl-shell-header.is-module .dl-shell-brand-icon {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 3px 10px rgba(0, 38, 31, 0.18);
}

/* Burger (mobile) sobre verde */
.dl-shell-header.is-module .dl-shell-burger {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
}
.dl-shell-header.is-module .dl-shell-burger:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Chrome (bell/apps/user) sobre verde — los triggers heredan color blanco
 * y los popovers se mantienen blancos por su propio CSS. */
.dl-shell-header.is-module .dl-shell-actions .dl-bell-trigger,
.dl-shell-header.is-module .dl-shell-actions .dl-apps-trigger,
.dl-shell-header.is-module .dl-shell-actions .dl-user-trigger {
  color: #ffffff;
}
.dl-shell-header.is-module .dl-shell-actions .dl-bell-trigger:hover,
.dl-shell-header.is-module .dl-shell-actions .dl-apps-trigger:hover,
.dl-shell-header.is-module .dl-shell-actions .dl-user-trigger:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ─── Search bar centrada del header ─────────────────────
 * Default: 70% transparente, ancho compacto.
 * Hover: opaco (100% bg) y aumenta de ancho.
 * Focus / focus-within: mantiene el ancho expandido y el bg opaco. */
.dl-shell-search {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.dl-shell-search-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: clamp(220px, 32vw, 360px);
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid rgba(0, 89, 78, 0.18);
  box-shadow: 0 1px 2px rgba(0, 38, 31, 0.04);
  padding: 0 14px 0 38px;
  cursor: text;
  transition:
    width var(--dl-transition),
    background var(--dl-transition-fast),
    border-color var(--dl-transition-fast),
    box-shadow var(--dl-transition-fast);
}

.dl-shell-search-field:hover,
.dl-shell-search-field:focus-within {
  width: clamp(320px, 46vw, 560px);
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 89, 78, 0.34);
  box-shadow: 0 8px 22px rgba(0, 38, 31, 0.10);
}

.dl-shell-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.92rem;
  color: var(--dl-green-dark);
  pointer-events: none;
  transition: color var(--dl-transition-fast);
}

.dl-shell-search-input {
  flex: 1 1 auto;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--dl-ink);
  font-family: inherit;
  font-size: 0.93rem;
  min-width: 0;
}
.dl-shell-search-input::placeholder {
  color: rgba(0, 38, 31, 0.55);
}
/* Quita la "X" nativa de inputs search */
.dl-shell-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.dl-shell-search-kbd {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 8px;
  border-radius: 6px;
  background: rgba(0, 89, 78, 0.08);
  color: var(--dl-green-dark);
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity var(--dl-transition-fast);
}
.dl-shell-search-field:hover .dl-shell-search-kbd,
.dl-shell-search-field:focus-within .dl-shell-search-kbd { opacity: 1; }

/* ── Search bar dentro de la variante module (verde) ── */
.dl-shell-header.is-module .dl-shell-search-field {
  background: rgba(255, 255, 255, 0.30);
  border-color: rgba(255, 255, 255, 0.40);
}
.dl-shell-header.is-module .dl-shell-search-field:hover,
.dl-shell-header.is-module .dl-shell-search-field:focus-within {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 22px rgba(0, 38, 31, 0.18);
}
.dl-shell-header.is-module .dl-shell-search-icon { color: #ffffff; }
.dl-shell-header.is-module .dl-shell-search-field:hover .dl-shell-search-icon,
.dl-shell-header.is-module .dl-shell-search-field:focus-within .dl-shell-search-icon {
  color: var(--dl-green-dark);
}
.dl-shell-header.is-module .dl-shell-search-input {
  color: #ffffff;
}
.dl-shell-header.is-module .dl-shell-search-input::placeholder {
  color: rgba(255, 255, 255, 0.78);
}
.dl-shell-header.is-module .dl-shell-search-field:hover .dl-shell-search-input,
.dl-shell-header.is-module .dl-shell-search-field:focus-within .dl-shell-search-input {
  color: var(--dl-ink);
}
.dl-shell-header.is-module .dl-shell-search-field:hover .dl-shell-search-input::placeholder,
.dl-shell-header.is-module .dl-shell-search-field:focus-within .dl-shell-search-input::placeholder {
  color: rgba(0, 38, 31, 0.55);
}

/* Mobile: la barra queda debajo de la fila principal */
@media (max-width: 768px) {
  .dl-shell-header-inner { flex-wrap: wrap; row-gap: 8px; }
  .dl-shell-search { order: 3; flex-basis: 100%; }
  .dl-shell-search-field { width: 100%; }
  .dl-shell-search-field:hover,
  .dl-shell-search-field:focus-within { width: 100%; }
}

/* Brand: logo + texto. Reutiliza .dl-brand del landing pero contenido aquí. */
.dl-shell-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--dl-ink);
}

.dl-shell-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.dl-shell-brand-icon img { width: 22px; height: 22px; }

.dl-shell-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.dl-shell-brand-name {
  font-family: var(--dl-font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--dl-ink);
}
.dl-shell-brand-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dl-muted);
}

/* Slot derecho del header: bell + apps + user.
 * El shell.js inyecta exactamente los mismos elementos que landing.html.
 * Los estilos dl-bell-* / dl-apps-* / dl-user-* viven en
 * datalab-landing.css y se cargan via @import abajo. */
.dl-shell-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Mobile burger para abrir el sidebar */
.dl-shell-burger {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: rgba(0, 89, 78, 0.06);
  border: 1px solid rgba(0, 89, 78, 0.14);
  color: var(--dl-green-dark);
  cursor: pointer;
  margin-right: 8px;
  align-items: center;
  justify-content: center;
}
.dl-shell-burger svg { width: 20px; height: 20px; }
.dl-shell-burger:hover {
  background: rgba(0, 89, 78, 0.12);
  border-color: var(--dl-green);
}

/* ─── Sidebar ─────────────────────────────────────────── */
.dl-shell-sidebar {
  display: flex;
  flex-direction: column;
  /* Background sólido y delimitado: el aside debe leerse como una pieza
   * independiente sea expandido o colapsado. El gradient anterior se
   * desvanecía a blanco puro en la parte inferior, lo que en colapsado
   * dejaba la mitad de abajo "transparente" contra el body. */
  background:
    radial-gradient(60% 30% at 100% 0%, rgba(181, 161, 96, 0.10) 0%, rgba(181, 161, 96, 0) 60%),
    linear-gradient(180deg, var(--dl-green-tint) 0%, var(--dl-green-tintl) 100%);
  border-right: 1px solid var(--dl-line-strong);
  box-shadow: 1px 0 0 rgba(0, 89, 78, 0.04), 4px 0 18px -8px rgba(0, 38, 31, 0.10);
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  /* z-index alto: position:sticky crea su propio stacking context. Sin esto,
   * el flyout (descendiente) no puede subir por encima del <main> que está al
   * mismo nivel del sidebar en el grid del body. Debajo de modal (1055). */
  z-index: var(--dl-z-fixed);
  transition: width var(--dl-transition);
}

/* Toggle flotante: pill blanco en el borde derecho, centrado vertical,
 * mitad afuera del aside (efecto "tab" entre sidebar y main). */
.dl-shell-sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -14px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--dl-white);
  border: 1px solid var(--dl-line-strong);
  border-radius: 999px;
  color: var(--dl-green-dark);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 38, 31, 0.10);
  z-index: 5;
  transition: background var(--dl-transition-fast), transform var(--dl-transition-fast),
              border-color var(--dl-transition-fast), box-shadow var(--dl-transition-fast),
              right var(--dl-transition);
}
.dl-shell-sidebar-toggle:hover {
  background: var(--dl-green);
  border-color: var(--dl-green);
  color: var(--dl-white);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 89, 78, 0.30);
}
.dl-shell-sidebar-toggle i {
  font-size: 0.72rem;
  transition: transform var(--dl-transition);
}
.dl-shell-collapsed .dl-shell-sidebar-toggle i { transform: rotate(180deg); }

.dl-shell-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  /* Scroll invisible — funcional pero sin barra visual */
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / Edge legacy */
}
.dl-shell-sidebar-body::-webkit-scrollbar { display: none; } /* Chrome, Safari, Opera */

.dl-shell-sidebar-group + .dl-shell-sidebar-group {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--dl-line);
}

.dl-shell-sidebar-label {
  font-family: var(--dl-font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dl-muted);
  padding: 6px 14px 6px;
  transition: opacity var(--dl-transition-fast);
}

.dl-shell-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  font-family: var(--dl-font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--dl-ink);
  text-decoration: none;
  transition: background var(--dl-transition-fast), color var(--dl-transition-fast), transform var(--dl-transition-fast);
  position: relative;
  margin: 1px 0;
}

/* Icono en cuadrado neutral por defecto.
 * Pro: el color reservado para hover (sutil verde) e ítem activo (verde sólido).
 * El atributo data-tone se conserva por si en F4/F6 se reactiva un acento contextual. */
.dl-shell-sidebar-link-ico {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(15, 31, 28, 0.045);
  color: var(--dl-gray-700);
  font-size: 0.88rem;
  transition: background var(--dl-transition-fast), color var(--dl-transition-fast),
              transform var(--dl-transition-fast);
}

.dl-shell-sidebar-link-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-shell-sidebar-link-ext {
  font-size: 0.6rem;
  opacity: 0.5;
  margin-left: 4px;
}

/* ─── Padre con flyout ───────────────────────────────── */
.dl-shell-sidebar-parent {
  position: relative;
}

.dl-shell-sidebar-link.is-parent {
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.dl-shell-sidebar-link-chev {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--dl-muted);
  transition: transform var(--dl-transition-fast), color var(--dl-transition-fast);
}

.dl-shell-sidebar-link.is-parent:hover .dl-shell-sidebar-link-chev,
.dl-shell-sidebar-parent.is-active .dl-shell-sidebar-link-chev,
.dl-shell-sidebar-parent.is-open .dl-shell-sidebar-link-chev {
  color: var(--dl-green);
  transform: translateX(2px);
}

/* Padre se marca activo si alguno de sus hijos coincide con la ruta */
.dl-shell-sidebar-parent.is-active > .dl-shell-sidebar-link.is-parent {
  background: linear-gradient(90deg, rgba(0, 89, 78, 0.12), rgba(0, 89, 78, 0.04));
  color: var(--dl-green-dark);
  font-weight: 700;
}
.dl-shell-sidebar-parent.is-active > .dl-shell-sidebar-link.is-parent::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--dl-green);
  border-radius: 0 4px 4px 0;
}
.dl-shell-sidebar-parent.is-active > .dl-shell-sidebar-link.is-parent .dl-shell-sidebar-link-ico {
  background: var(--dl-green);
  color: #fff;
}

/* ─── Flyout panel ───────────────────────────────────── */
/* position: fixed → escapa el overflow de .dl-shell-sidebar-body.
 * top/left se calculan en JS via getBoundingClientRect. */
.dl-shell-flyout {
  position: fixed;
  min-width: 240px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: var(--dl-white);
  border: 1px solid var(--dl-line);
  border-radius: 14px;
  box-shadow: 0 24px 60px -10px rgba(0, 38, 31, 0.22);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-6px) scale(.98);
  transition: opacity .15s var(--dl-ease), transform .15s var(--dl-ease), visibility 0s linear .15s;
  z-index: var(--dl-z-tooltip);
  scrollbar-width: none;
}
.dl-shell-flyout::-webkit-scrollbar { display: none; }

/* Pequeño "puente" invisible para que el cursor pueda pasar entre el padre y
 * el flyout sin que se cierre por salir del hover. */
.dl-shell-flyout::before {
  content: "";
  position: absolute;
  top: 0;
  left: -14px;
  width: 14px;
  height: 100%;
}

.dl-shell-sidebar-parent:hover .dl-shell-flyout,
.dl-shell-sidebar-parent.is-open .dl-shell-flyout {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
  transition: opacity .18s var(--dl-ease), transform .18s var(--dl-ease);
}

.dl-shell-flyout-head {
  font-family: var(--dl-font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dl-muted);
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--dl-line);
  margin-bottom: 6px;
}

.dl-shell-flyout-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dl-shell-flyout-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: var(--dl-font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--dl-ink);
  text-decoration: none;
  transition: background var(--dl-transition-fast), color var(--dl-transition-fast), transform var(--dl-transition-fast);
}

.dl-shell-flyout-link-ico {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(15, 31, 28, 0.045);
  color: var(--dl-gray-700);
  font-size: 0.82rem;
  flex-shrink: 0;
  transition: background var(--dl-transition-fast), color var(--dl-transition-fast);
}

.dl-shell-flyout-link-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-shell-flyout-link:hover {
  background: rgba(0, 89, 78, 0.06);
  color: var(--dl-green-dark);
  transform: translateX(2px);
}
.dl-shell-flyout-link:hover .dl-shell-flyout-link-ico {
  background: rgba(0, 89, 78, 0.10);
  color: var(--dl-green);
}

.dl-shell-flyout-link.is-active {
  background: linear-gradient(90deg, rgba(0, 89, 78, 0.12), rgba(0, 89, 78, 0.04));
  color: var(--dl-green-dark);
  font-weight: 700;
}
.dl-shell-flyout-link.is-active .dl-shell-flyout-link-ico {
  background: var(--dl-green);
  color: #fff;
}

.dl-shell-sidebar-link:hover {
  background: rgba(0, 89, 78, 0.06);
  color: var(--dl-green-dark);
  transform: translateX(2px);
}
.dl-shell-sidebar-link:hover .dl-shell-sidebar-link-ico {
  background: rgba(0, 89, 78, 0.10);
  color: var(--dl-green);
}

/* Item activo: barra vertical + fondo suave */
.dl-shell-sidebar-link.is-active {
  background: linear-gradient(90deg, rgba(0, 89, 78, 0.12), rgba(0, 89, 78, 0.04));
  color: var(--dl-green-dark);
  font-weight: 700;
  transform: none;
}
.dl-shell-sidebar-link.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--dl-green);
  border-radius: 0 4px 4px 0;
}
.dl-shell-sidebar-link.is-active .dl-shell-sidebar-link-ico {
  background: var(--dl-green);
  color: #fff;
}

/* Footer del sidebar */
.dl-shell-sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--dl-line);
  background: rgba(0, 89, 78, 0.02);
  font-family: var(--dl-font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--dl-muted);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.dl-shell-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  animation: dlPulseStatus 2s ease infinite;
  flex-shrink: 0;
}

@keyframes dlPulseStatus {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.06); }
}

.dl-shell-sidebar-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ─── Sidebar colapsado (desktop ≥ 901px) ─────────────── */
@media (min-width: 901px) {
  .dl-shell-collapsed { grid-template-columns: 72px 1fr; }

  .dl-shell-collapsed .dl-shell-sidebar-label,
  .dl-shell-collapsed .dl-shell-sidebar-link-label,
  .dl-shell-collapsed .dl-shell-sidebar-link-ext,
  .dl-shell-collapsed .dl-shell-sidebar-foot-text {
    opacity: 0;
    width: 0;
    visibility: hidden;
    overflow: hidden;
    pointer-events: none;
  }
  .dl-shell-collapsed .dl-shell-sidebar-link {
    justify-content: center;
    padding: 9px 8px;
    margin: 2px 6px;
    border-radius: 12px;
  }
  /* Pill detrás del icono activo en colapsado, para que se distinga claro */
  .dl-shell-collapsed .dl-shell-sidebar-link.is-active {
    background: rgba(0, 89, 78, 0.10);
  }
  .dl-shell-collapsed .dl-shell-sidebar-link.is-active::before {
    /* En colapsado quitamos la barra lateral izquierda — el pill ya marca el activo */
    display: none;
  }
  .dl-shell-collapsed .dl-shell-sidebar-link:hover {
    background: rgba(0, 89, 78, 0.06);
    transform: none;
  }
  .dl-shell-collapsed .dl-shell-sidebar-link-ico {
    margin: 0;
  }
  .dl-shell-collapsed .dl-shell-sidebar-foot {
    justify-content: center;
    padding: 12px 0;
    border-top: 1px solid var(--dl-line);
  }
  .dl-shell-collapsed .dl-shell-sidebar-group + .dl-shell-sidebar-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--dl-line);
  }

  /* En colapsado el chevron no tiene sentido — desaparece. El flyout sigue funcionando. */
  .dl-shell-collapsed .dl-shell-sidebar-link-chev {
    display: none;
  }

  /* El flyout siempre se ancla al borde derecho del sidebar, sea ancho o colapsado. */
  .dl-shell-collapsed .dl-shell-flyout {
    left: calc(100% + 8px);
  }
}

/* ─── Mobile: el flyout se convierte en lista inline (acordeón) ──── */
@media (max-width: 900px) {
  .dl-shell-flyout {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 4px 0 6px 28px;
    opacity: 1;
    visibility: hidden;
    pointer-events: none;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--dl-transition), visibility 0s linear var(--dl-transition);
  }
  .dl-shell-flyout::before { display: none; }
  .dl-shell-flyout-head { display: none; }

  .dl-shell-sidebar-parent.is-open .dl-shell-flyout {
    visibility: visible;
    pointer-events: auto;
    max-height: 600px;
    transition: max-height var(--dl-transition), visibility 0s linear 0s;
  }

  /* En mobile no abrimos por hover — solo click */
  .dl-shell-sidebar-parent:hover .dl-shell-flyout {
    opacity: 1;
    visibility: hidden;
    pointer-events: none;
    transform: none;
  }
  .dl-shell-sidebar-parent.is-open:hover .dl-shell-flyout,
  .dl-shell-sidebar-parent.is-open .dl-shell-flyout {
    visibility: visible;
    pointer-events: auto;
  }

  /* Chevron rota cuando el padre está abierto en mobile */
  .dl-shell-sidebar-parent.is-open .dl-shell-sidebar-link-chev {
    transform: rotate(90deg);
  }
}

/* ─── Main ───────────────────────────────────────────── */
.dl-shell-main {
  padding: clamp(20px, 4vw, 40px);
  min-width: 0;
}

/* ─── Footer institucional ──────────────────────────── */
.dl-shell-footer {
  position: relative;
  padding: clamp(40px, 5vw, 64px) clamp(20px, 4vw, 56px) 0;
  background:
    radial-gradient(80% 60% at 0% 0%, rgba(0, 168, 138, 0.10) 0%, transparent 60%),
    radial-gradient(60% 50% at 100% 100%, rgba(181, 161, 96, 0.10) 0%, transparent 65%),
    linear-gradient(180deg, var(--dl-green-deep) 0%, #001712 100%);
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--dl-font-body);
  font-size: 0.92rem;
  overflow: hidden;
}

.dl-shell-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(181, 161, 96, 0.5) 50%, transparent 100%);
}

.dl-shell-footer a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: color var(--dl-transition-fast);
}
.dl-shell-footer a:hover { color: var(--dl-gold-soft); }

.dl-shell-footer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
}

/* Columna brand (izquierda) */
.dl-shell-footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dl-shell-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.dl-shell-footer-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffffff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.dl-shell-footer-brand-icon img { width: 26px; height: 26px; }

.dl-shell-footer-brand-name {
  font-family: var(--dl-font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1;
}

.dl-shell-footer-brand-tag {
  font-family: var(--dl-font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dl-gold-soft);
  margin-top: 4px;
}

.dl-shell-footer-tagline {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.55;
  max-width: 320px;
}

.dl-shell-footer-univ {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 320px;
}

.dl-shell-footer-univ img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.dl-shell-footer-univ-name {
  display: block;
  font-family: var(--dl-font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.3;
}

.dl-shell-footer-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.22);
  font-family: var(--dl-font-display);
  font-weight: 600;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.04em;
  width: max-content;
}

/* Columnas de links */
.dl-shell-footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dl-shell-footer-heading {
  font-family: var(--dl-font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dl-gold-soft);
  margin: 0 0 6px;
}

.dl-shell-footer-col a {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--dl-transition-fast), transform var(--dl-transition-fast);
}

.dl-shell-footer-col a:hover {
  color: #ffffff;
  transform: translateX(2px);
}

.dl-shell-footer-col a i {
  font-size: 0.62rem;
  opacity: 0.6;
}

/* Bottom row */
.dl-shell-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.dl-shell-footer-copy {
  color: rgba(255, 255, 255, 0.58);
}

.dl-shell-footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--dl-font-display);
  font-weight: 600;
  font-size: 0.82rem;
}

.dl-shell-footer-meta a {
  color: rgba(255, 255, 255, 0.85);
}

.dl-shell-footer-dot {
  color: rgba(255, 255, 255, 0.3);
}

/* Responsive del footer */
@media (max-width: 1100px) {
  .dl-shell-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .dl-shell-footer-brand-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .dl-shell-footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* ─── Mobile (≤ 900px) ───────────────────────────────── */
@media (max-width: 900px) {
  .dl-shell-body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "footer";
  }
  .dl-shell-sidebar {
    position: fixed;
    inset: 64px auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--dl-transition);
    z-index: var(--dl-z-overlay);
    box-shadow: var(--dl-shadow-lg);
  }
  /* En mobile el colapso no aplica (drawer reemplaza la lógica); ocultamos el toggle. */
  .dl-shell-sidebar-toggle { display: none; }
  .dl-shell-sidebar.is-open { transform: translateX(0); }
  .dl-shell-burger { display: inline-flex; }

  .dl-shell-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 38, 31, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dl-transition);
    z-index: calc(var(--dl-z-overlay) - 1);
  }
  .dl-shell-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }
}
