/* Estructura de la aplicación: barra lateral, cabecera, contenido y navegación móvil. */
.app { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* ---- Barra lateral ---- */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  background: var(--navy); color: #d3e2ec; display: flex; flex-direction: column; padding: 18px 14px 14px;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: #fff; }
.sidebar__brand img { width: 46px; height: auto; flex: none; }
.sidebar__brand strong { display: block; font-size: 1rem; line-height: 1.15; letter-spacing: -.01em; }
.sidebar__brand span { display: block; font-size: .78rem; color: #8fb2c7; margin-top: 2px; }
.nav { display: grid; gap: 2px; margin-top: 6px; }
.nav__label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #7fa1b6; margin: 20px 12px 6px; }
.nav__item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 9px;
  color: #d3e2ec; font-weight: 600; text-decoration: none; border: 0; background: none; width: 100%; text-align: left;
}
.nav__item:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav__item[aria-current="page"] { background: rgba(94, 179, 228, .18); color: #fff; box-shadow: inset 3px 0 0 var(--brand-light); }
.nav__item .icon { width: 20px; height: 20px; flex: none; color: var(--brand-light); }
.nav__badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: #f3b13c; color: #2b1a00; font-size: .78rem; font-weight: 800; display: grid; place-items: center; }
.sidebar__foot { margin-top: auto; padding-top: 18px; display: grid; gap: 10px; }
.sidebar__proto { font-size: .78rem; line-height: 1.4; color: #8fb2c7; padding: 10px 12px; border: 1px dashed rgba(143, 178, 199, .45); border-radius: 9px; }
.sidebar__proto strong { color: #fff; }

/* ---- Cabecera ---- */
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 28px;
}
.topbar__menu { display: none; }
.topbar__title { display: none; font-weight: 700; }
.topbar__spacer { flex: 1; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 40px; min-width: 320px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--muted); text-align: left;
}
.search-trigger:hover { border-color: var(--brand); background: #fff; }
.search-trigger kbd { margin-left: auto; font: 600 .75rem var(--font); padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: var(--ink-2); }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; }
.user-btn:hover { background: var(--surface-2); border-color: var(--line); }
.user-btn__text { display: grid; line-height: 1.2; }
.user-btn__text strong { font-size: .88rem; }
.user-btn__text span { font-size: .78rem; color: var(--muted); }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 28px 56px; flex: 1; }

/* ---- Navegación inferior (móvil) ---- */
.bottomnav { display: none; }

@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 120; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .app.is-nav-open .sidebar { transform: none; }
  .app.is-nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(11, 34, 52, .5); z-index: 110; }
  .topbar { padding: 0 14px; }
  .topbar__menu { display: grid; }
  .search-trigger { min-width: 0; width: 44px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .user-btn__text { display: none; }
  .content { padding: 20px 16px calc(var(--bottomnav-h) + 36px); }
}
@media (max-width: 760px) {
  .topbar__title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
  .bottomnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--navy); border-top: 1px solid rgba(255, 255, 255, .12);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #b8cedc;
    font-size: .74rem; font-weight: 600; text-decoration: none; min-height: 48px;
  }
  .bottomnav a .icon { width: 22px; height: 22px; }
  .bottomnav a[aria-current="page"] { color: #fff; }
  .bottomnav a[aria-current="page"] .icon { color: var(--brand-light); }
  .bottomnav a.is-scan .icon-wrap { width: 50px; height: 50px; margin-top: -22px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; border: 4px solid var(--bg); box-shadow: 0 6px 16px rgba(11, 34, 52, .35); }
  .bottomnav a.is-scan .icon { color: #fff; width: 26px; height: 26px; }
  .bottomnav .badge-dot { position: absolute; margin: -22px 0 0 18px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f3b13c; color: #2b1a00; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
  .bottomnav a { position: relative; }
}
