/* =====================================================================
   Navigation commune (nav.js) — uniquement des jetons de tokens.css
   ordinateur / tablette paysage : menu latéral clair
   téléphone / tablette portrait (≤ 900 px) : barre d'onglets en bas + bouton « + »
   ===================================================================== */
body.has-nav .s-top,
body.has-nav .topbar { display: none !important; }

/* ---------- menu latéral ---------- */
#nv-side {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: var(--z-nav);
  background: var(--surface-2); color: var(--text-2); border-right: var(--border-w) solid var(--border);
  display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-3);
}
.nv-brand { display: block; padding: var(--space-1) var(--space-2) var(--space-4); }
.nv-brand img { height: 36px; width: auto; content: var(--logo-light); }
.nv-cta {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--h-lg); margin-bottom: var(--space-4); padding: 0 var(--space-4);
  background: var(--accent); color: var(--accent-fg); text-decoration: none;
  font: var(--fw-semibold) var(--fs-md) / 1 var(--font-sans); border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs); transition: background var(--dur-fast) var(--ease-out);
}
.nv-cta:hover { background: var(--accent-hover); }
.nv-cta:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nv-cta svg { width: 18px; height: 18px; stroke-width: 2.2; }

.nv-list { display: flex; flex-direction: column; gap: var(--space-0-5); }
.nv-item {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; height: var(--h-md); padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-md); background: none; cursor: pointer; text-align: left; text-decoration: none;
  color: var(--text-2); font: var(--fw-medium) var(--fs-md) / 1 var(--font-sans);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nv-item svg { width: 18px; height: 18px; flex: none; color: var(--text-muted); }
.nv-item:hover { background: var(--surface-3); color: var(--text); }
.nv-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nv-item.on { background: var(--surface); color: var(--text); font-weight: var(--fw-semibold); box-shadow: var(--shadow-xs), inset 0 0 0 var(--border-w) var(--border); }
.nv-item.on svg { color: var(--accent); }
.nv-spacer { flex: 1; }
.nv-sec .nv-item { color: var(--text-muted); font-size: var(--fs-sm); height: var(--h-sm); }

.nv-account {
  display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3);
  padding: var(--space-3) var(--space-2) 0; border-top: var(--border-w) solid var(--border);
}
.nv-av {
  width: var(--h-sm); height: var(--h-sm); flex: none; display: grid; place-items: center; border-radius: var(--radius-full);
  background: var(--surface-3); color: var(--text); font: var(--fw-semibold) var(--fs-sm) / 1 var(--font-sans);
}
.nv-acc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-0-5); }
.nv-acc-txt strong, .nv-acc-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-acc-txt strong { color: var(--text); font: var(--fw-semibold) var(--fs-sm) / var(--lh-snug) var(--font-sans); }
.nv-acc-txt span { color: var(--text-muted); font-size: var(--fs-xs); }
.nv-out { border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: var(--space-1-5); border-radius: var(--radius-md); display: grid; place-items: center; }
.nv-out:hover { color: var(--text); background: var(--surface-3); }
.nv-out svg { width: 18px; height: 18px; }

/* le contenu se décale à droite du menu */
body.has-nav { padding-left: var(--sidebar-w); }
body.has-nav #tp-assist { margin-left: 0; }

/* ---------- feuille « Plus » (téléphone) ---------- */
#nv-bottom { display: none; }
#nv-sheet { position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--overlay); display: flex; align-items: flex-end; }
#nv-sheet[hidden] { display: none; }
.nv-sheet-card {
  width: 100%; background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3) calc(var(--space-4) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--space-0-5); animation: nvUp var(--dur) var(--ease-out) both;
}
.nv-sheet-card::before { content: ''; align-self: center; width: 36px; height: 4px; border-radius: var(--radius-full); background: var(--border-strong); margin: var(--space-1) 0 var(--space-3); }
.nv-sheet-card .nv-item { height: var(--h-lg); font-size: var(--fs-lg); }
@keyframes nvUp { from { transform: translateY(24px); opacity: 0; } }

/* ---------- téléphone / tablette portrait : barre en bas ---------- */
@media (max-width: 900px) {
  #nv-side { display: none; }
  body.has-nav { padding-left: 0; padding-bottom: calc(var(--bottombar-h) + var(--space-3) + env(safe-area-inset-bottom)); }
  #nv-bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-bottombar);
    align-items: center; justify-content: space-around;
    min-height: var(--bottombar-h); padding: var(--space-1) var(--space-1) calc(var(--space-1) + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-top: var(--border-w) solid var(--border);
  }
  .nv-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--space-0-5); min-height: 44px; justify-content: center;
    border: 0; background: none; cursor: pointer; text-decoration: none; padding: var(--space-1) 0;
    color: var(--text-muted); font: var(--fw-medium) 11px / 1 var(--font-sans); /* 11 px : libellé d'onglet iOS, hors échelle volontairement */
  }
  .nv-tab svg { width: 22px; height: 22px; }
  .nv-tab.on { color: var(--accent-text); }
  .nv-fab {
    flex: none; width: var(--fab); height: var(--fab); margin-top: calc(var(--fab) / -2.4); border-radius: var(--radius-full);
    display: grid; place-items: center; background: var(--accent); color: var(--accent-fg);
    box-shadow: var(--shadow-md), 0 0 0 4px var(--bg);
  }
  .nv-fab:active { transform: scale(0.96); }
  .nv-fab svg { width: 26px; height: 26px; stroke-width: 2.4; }
  #toast { bottom: calc(var(--bottombar-h) + var(--space-6) + env(safe-area-inset-bottom)); }
}

@media print {
  #nv-side, #nv-bottom, #nv-sheet { display: none !important; }
  body.has-nav { padding: 0 !important; }
}
@media (prefers-reduced-motion: reduce) { .nv-sheet-card { animation: none; } }

.s-quit .ic { display: inline !important; margin-right: var(--space-1); }
.pg-title { font: var(--fw-semibold) var(--fs-title) / var(--lh-tight) var(--font-sans); letter-spacing: var(--tracking-tight); margin: var(--space-1) 0 var(--space-4); }

/* familles du menu + pastille du nombre d'actions */
.nv-groupe { display: block; margin: var(--space-4) 0 var(--space-1); padding: 0 var(--space-3); color: var(--text-faint); font: var(--fw-semibold) 11px / 1.2 var(--font-sans); text-transform: uppercase; letter-spacing: 0.06em; }
.nv-nb { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--radius-full); background: var(--accent); color: var(--white, #fff); font: var(--fw-semibold) 11px / 1 var(--font-sans); }
.nv-tab { position: relative; }
.nv-tab .nv-nb { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
.nv-sep { display: block; height: var(--space-3); }
