/* laterale.css — LA BARRE LATÉRALE (composants/laterale.js), un ton sous le
   papier, un filet à droite. Ouverte sur ordinateur (224 px), repliée en
   colonne d'icônes au choix et d'office sur tablette (68 px), un MENU PLEIN ÉCRAN sur
   téléphone, la barre entière (pas de barre en bas). L'endroit où l'on est en bleu doux, comme partout. Les espaces se
   déplient sur leurs rubriques, les sections se replient : la même tête que
   les sections de l'inspecteur (un chevron, le titre en petit gras gris, un
   filet dessus). */

.laterale {
  flex: none; width: var(--laterale-large);
  position: sticky; top: 0; height: 100dvh; z-index: 20;
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 10px; overflow: hidden;
  background: var(--laterale); border-right: 1px solid var(--trait);
}
.lat-voile { display: none; }

.lat-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 2px 0 6px; margin-bottom: 6px; }
.lat-tete .rond { width: 36px; height: 36px; }
.lat-tete .rond:hover { background: var(--creux-2); }
.lat-tete-boutons { display: flex; align-items: center; gap: 2px; }

/* un élément : une icône, son libellé, un détail à droite */
.lat-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px;
  border: none; border-radius: 10px; background: none; text-align: left; text-decoration: none;
  font: 600 14px/1.2 var(--police); color: var(--encre-2);
}
.lat-item:hover { background: var(--creux-2); color: var(--encre); }
.lat-item[aria-current='page'] { background: var(--accent-doux); color: var(--accent-texte); }
.lat-item > svg.ico { flex: none; }
.lat-lib { flex: 1 1 auto; min-width: 0; }
.lat-meta { flex: none; margin-left: auto; font-size: 12px; font-weight: 600; color: var(--encre-3); white-space: nowrap; }
.lat-item[aria-current='page'] .lat-meta { color: inherit; }
.lat-meta.accent { font-size: 11px; font-weight: 800; color: var(--accent-texte); background: var(--accent-doux); border-radius: 999px; padding: 1px 7px; }

/* le milieu défile : les espaces, puis les sections */
.lat-defile { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 10px -10px 0; padding: 0 10px; scrollbar-width: thin; }

/* les espaces : de simples onglets (leurs rubriques sont dans la tête de page) */
.lat-espaces { display: flex; flex-direction: column; gap: 2px; }

/* les sections, repliables comme celles de l'inspecteur : épinglés, récents */
.lat-sections { display: flex; flex-direction: column; margin-top: 12px; }
.lat-section { display: flex; flex-direction: column; border-top: 1px solid var(--trait); padding: 4px 0 6px; }
.lat-section-tete {
  display: flex; align-items: center; gap: 6px; width: 100%; height: 30px; padding: 0 10px;
  border: none; border-radius: 8px; background: none; text-align: left; font: 800 12px var(--police); color: var(--encre-3);
}
.lat-section-tete:hover { background: var(--creux-2); color: var(--encre-2); }
.lat-section-tete > svg { flex: none; transition: transform 150ms; }
.lat-section[data-plie] .lat-section-tete > svg { transform: rotate(-90deg); }
.lat-section-compte { margin-left: auto; font-weight: 700; }
.lat-section-corps { display: flex; flex-direction: column; gap: 1px; }
.lat-petit { min-height: 32px; font-size: 13.5px; font-weight: 500; }
.lat-petit > svg.ico { color: var(--encre-3); }

/* en bas, le compte : le prénom et l'état de la synchro */
.lat-pied { flex: none; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--trait); }
.lat-compte { min-height: 52px; }
.lat-compte > svg.ico:last-child { color: var(--encre-3); }
.lat-avatar {
  position: relative; flex: none; width: 32px; height: 32px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-doux); color: var(--accent-texte);
  font-family: var(--police-titre); font-weight: 700; font-size: 16px;
}
.lat-avatar::after {
  content: ''; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 999px;
  background: var(--encre-3); box-shadow: 0 0 0 2px var(--laterale);
}
.lat-avatar[data-mode='ok']::after { background: var(--ok); }
.lat-avatar[data-mode='en-cours']::after { background: var(--accent); }
.lat-avatar[data-mode='hors-ligne']::after { background: var(--avert); }
.lat-avatar[data-mode='erreur']::after { background: var(--danger); }
.lat-compte-texte { display: flex; flex-direction: column; gap: 1px; }
.lat-compte-texte > span { color: var(--encre); font-weight: 700; }
.lat-compte-texte > small { font-size: 12px; font-weight: 500; color: var(--encre-3); }
.lat-compte[aria-current='page'] .lat-compte-texte > span { color: inherit; }

/* ————— repliée : une colonne d'icônes ————— */
#app[data-barre='repliee'] .laterale { width: var(--laterale-repliee); }
#app[data-barre='repliee'] :is(.lat-lib, .lat-meta, .lat-sections, .lat-marque, .lat-compte > svg.ico:last-child) { display: none; }
#app[data-barre='repliee'] .lat-tete { justify-content: center; height: auto; padding: 0; }
/* repliée, la loupe passe sous la marque */
#app[data-barre='repliee'] .lat-tete-boutons { flex-direction: column-reverse; }
/* repliée, le bouton porte la marque ; au survol (ou au clavier), l'icône qui déplie */
#app[data-barre='repliee'] .lat-replier > svg.ico { display: none; }
#app[data-barre='repliee'] .lat-replier:is(:hover, :focus-visible) > .marque-tuile { display: none; }
#app[data-barre='repliee'] .lat-replier:is(:hover, :focus-visible) > svg.ico { display: block; }
#app[data-barre='repliee'] .lat-item, #app[data-barre='repliee'] .lat-espace > .lat-item { justify-content: center; padding: 0; }
#app[data-barre='repliee'] .lat-item[data-ouvert] { background: var(--accent-doux); color: var(--accent-texte); }
#app[data-barre='repliee'] .lat-pied { margin-top: auto; }

/* ————— téléphone : un menu plein écran, qui glisse de la gauche ————— */
/* pas de bande de page coupée sur le côté : le menu prend tout l'écran (la
   croix le referme) et Safari teinte sa barre du bas à sa couleur */
@media (max-width: 599px) {
  .laterale {
    position: fixed; inset: 0; height: auto; z-index: 50;
    width: 100%; padding: calc(14px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
    border-right: none;
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--glisse), visibility 0s linear 300ms;
  }
  #app[data-tiroir='ouvert'] .laterale { transform: none; visibility: visible; transition: transform var(--glisse); }
  .lat-tete { margin-bottom: 8px; padding-left: 6px; }
  .lat-tete .rond { width: 44px; height: 44px; }
  .marque-nom { font-size: 22px; }
  .lat-item { min-height: 44px; gap: 12px; padding: 0 12px; border-radius: 12px; font-size: 15px; }
  .lat-petit, .lat-rub { min-height: 44px; font-size: 14.5px; }
  .lat-rub { padding-left: 42px; }
  .lat-espace > .lat-item { padding-right: 52px; }
  .lat-deplier { top: 4px; right: 4px; width: 36px; height: 36px; }
  .lat-section-tete { height: 36px; padding: 0 12px; font-size: 12.5px; }
  .lat-defile { margin-left: -16px; margin-right: -16px; padding: 0 16px; overscroll-behavior: contain; }
  .lat-compte { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) { .laterale { transition: none !important; } }

/* l'impression ne garde que la page */
@media print { .laterale, .lat-voile { display: none !important; } }
