/* ── Estructura de la app ──────────────────────────────────
   Móvil: barra superior + barra inferior.
   Escritorio (≥ 900px): barra lateral fija + contenido. */

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-top: max(var(--space-3), env(safe-area-inset-top));
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: var(--shadow);
}
.topbar__brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1; }
.topbar__logo { width: 36px; height: 36px; border-radius: 9px; flex: none; box-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.topbar__title { font-family: var(--font-display); font-weight: 800; letter-spacing: .14em; font-size: .95rem; text-transform: uppercase; }
.topbar__sub { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-2); }

.main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-4);
  padding-bottom: calc(var(--nav-h) + var(--space-5) + env(safe-area-inset-bottom));
}

/* Navegación */
.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .06);
}
.nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); text-decoration: none; font-size: .72rem; font-weight: 600;
  border: 0; background: none; position: relative;
  transition: color var(--dur) var(--ease);
}
.nav__item svg { width: 22px; height: 22px; }
.nav__item[aria-current="page"] { color: var(--accent-text); }
.nav__item[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px;
  background: var(--accent-text); border-radius: 0 0 3px 3px;
}

@media (min-width: 900px) {
  .app { flex-direction: row; flex-wrap: wrap; }
  .topbar { width: 100%; }
  .nav {
    top: 0; right: auto; bottom: 0; width: var(--sidebar-w); height: auto;
    flex-direction: column; justify-content: flex-start; gap: var(--space-1);
    padding: 76px var(--space-3) var(--space-4);
    border-top: 0; border-right: 1px solid var(--border); box-shadow: none;
  }
  .nav__item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: var(--space-3);
    padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-size: .95rem;
  }
  .nav__item:hover { background: var(--surface-2); }
  .nav__item[aria-current="page"] { background: var(--accent-soft); }
  .nav__item[aria-current="page"]::before { display: none; }
  .main { margin-left: var(--sidebar-w); max-width: none; width: calc(100% - var(--sidebar-w)); padding: var(--space-5) var(--space-6); padding-bottom: var(--space-6); }
  .main > * { max-width: 1040px; margin-left: auto; margin-right: auto; }
}

/* Páginas de acceso (login / configuración inicial) */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-4); background: var(--bg); }
.auth__card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--space-5); display: grid; gap: var(--space-4); }
.auth__logo { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto; box-shadow: var(--shadow); }
.auth__title { text-align: center; font-size: 1.4rem; letter-spacing: .12em; text-transform: uppercase; }
.auth__sub { text-align: center; color: var(--text-muted); font-size: .9rem; }
