/* Mobile-first : dock translucide en bas < 900px, barre latérale blur au-delà. */
#app { min-height: 100dvh; }

#vue {
  padding: 1.25rem 1rem;
  /* Zones sûres : en app installée (black-translucent + viewport-fit=cover),
     sans elles le h1 passe sous l'heure, et le contenu sous l'encoche en paysage. */
  padding-top: calc(1.25rem + env(safe-area-inset-top));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  max-width: 980px;
  margin: 0 auto;
  outline: none;
}

#nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--nav-fond);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--bordure);
  padding-bottom: env(safe-area-inset-bottom);
}

#nav .nav-titre { display: none; }

#nav nav {
  display: flex;
  justify-content: space-around;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

#nav nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0.55rem 0.35rem 0.45rem;
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--encre-2);
  text-decoration: none;
  flex: 1;
  text-align: center;
  transition: color 0.2s;
}

#nav nav a .ico { font-size: 1.25rem; line-height: 1; opacity: 0.75; transition: opacity 0.2s; }
#nav nav a.actif { color: var(--accent); }
#nav nav a.actif .ico { opacity: 1; }
#nav nav a:hover { text-decoration: none; }

/* Les entrées secondaires disparaissent sur mobile pour garder 6 onglets lisibles ;
   EDP et Réglages restent accessibles depuis le dashboard et la fiche. */
@media (max-width: 899px) {
  #nav nav a[data-route="edps"], #nav nav a[data-route="reglages"] { display: none; }
}

@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 240px 1fr; }
  /* Écran de connexion : la nav est cachée, on rend toute la largeur à la vue. */
  #app:has(#nav[hidden]) { display: block; }
  #vue { padding: 3rem 3rem 4rem; }
  #nav {
    position: sticky;
    top: 0;
    height: 100dvh;
    border-top: none;
    border-right: 0.5px solid var(--bordure);
    padding: 1.75rem 0.9rem;
  }
  #nav .nav-titre {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 0 0.75rem 1.5rem;
    font-size: 1.05rem;
  }
  #nav nav { flex-direction: column; gap: 3px; }
  #nav nav a {
    flex-direction: row;
    gap: 0.65rem;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    text-align: left;
    align-items: center;
    flex: none;
    color: var(--encre);
    transition: background 0.2s, color 0.2s;
  }
  #nav nav a .ico { font-size: 1.05rem; }
  #nav nav a:hover { background: rgba(0, 0, 0, 0.05); }
  #nav nav a.actif { background: rgba(0, 0, 0, 0.07); color: var(--encre); font-weight: 650; }
  #nav nav a.actif .ico { opacity: 1; }
  @media (prefers-color-scheme: dark) {
    #nav nav a:hover { background: rgba(255, 255, 255, 0.08); }
    #nav nav a.actif { background: rgba(255, 255, 255, 0.12); }
  }
}

/* Grand écran PC : entre 900 et 1279px, barre latérale + padding laissaient
   une colonne étroite ; au-delà, la vue respire. */
@media (min-width: 1280px) {
  #vue { max-width: 1120px; padding-left: 4rem; padding-right: 4rem; }
}

/* Accessibilité mouvement : les transitions ne s'imposent pas. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
