/* === HEADER === */
.header {
  position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--header-border);
  z-index: 1000;
}
.logo { font-family: var(--font-title); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
.logo-accent { color: var(--accent); }
/* Lockup marque PARTAGÉ app + landing/légal/404 : corail + wordmark, UNE seule source (pit of success :
   même taille/espacement partout, impossible de diverger). .brand est un <span> (app) ou un <a>
   (landing/légal/404) -> on reset le style de lien. */
.brand { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; text-decoration: none; color: inherit; }
/* Mark corail : taille + affichage définis ICI (partagé). 06-tanks ne gère plus que le masquage mobile-connecté. */
.logo-coral { display: block; width: 28px; height: 28px; flex: 0 0 auto; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
/* === THEME SWITCH (repris du portfolio : lune -> soleil SVG animé) === */
.switch {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease;
}
.switch:hover { border-color: var(--accent); }
.switch__input { display: none; }
.switch__icon {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  position: relative;
  box-shadow: inset 15px -15px 0 0 var(--text-secondary);
  transform: scale(0.4) rotate(-2deg);
  transition: box-shadow 0.5s ease 0s, transform 0.4s ease 0.1s;
}
/* Coché = light mode : la lune disparaît. */
.switch__input:checked + .switch__icon {
  transform: scale(0) rotate(180deg);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.2s ease;
}
.switch__sun {
  position: absolute;
  inset: 0;
  margin: auto; /* centre le soleil sur la lune */
  width: 18px;
  height: 18px;
  transform: scale(0) rotate(-180deg);
  transition: transform 0.5s ease;
}
.switch__sun circle, .switch__sun line { stroke: var(--accent); fill: none; }
.switch__sun .sun-core { fill: var(--accent); stroke: none; }
.switch__input:checked ~ .switch__sun {
  transform: scale(1) rotate(0deg);
  transition: transform 0.5s ease 0.1s;
}
.switch:has(.switch__input:focus-visible) .switch__icon {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
@media (hover: hover) {
  .switch:hover .switch__input:not(:checked) + .switch__icon {
    box-shadow: inset 15px -15px 0 0 var(--accent);
  }
  .switch:hover .switch__input:checked ~ .switch__sun { filter: brightness(1.3); }
}

/* === LAYOUT === */
/* overflow-x: clip = garde-fou : AUCUN élément (popup, tooltip, contenu large) ne peut faire
   scroller l'app horizontalement (app mobile-first). `clip` n'ouvre PAS de conteneur de scroll
   et se marie à overflow-y: visible (le scroll vertical de page reste natif). Aucun sticky à casser. */
.app-view, .login-view { max-width: 920px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; overflow-x: clip; }
.login-view { display: grid; place-items: center; min-height: calc(100vh - var(--header-height)); }

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--header-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}
.app-view .card + .card { margin-top: 1.5rem; }

/* === PILLS / BOUTONS === */
.pill {
  font-family: var(--font-text); font-weight: 500; font-size: 0.95rem;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: 0.55rem 1.3rem; cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.pill-accent { background: var(--accent); color: var(--on-accent); }
.pill-accent:hover { background: var(--accent-hover); }
.pill-ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }
.pill-ghost:hover { color: var(--accent); border-color: var(--accent); }
.pill-danger { background: var(--bad); color: var(--on-accent); }
.pill-danger:hover { filter: brightness(1.08); }

/* === FORMULAIRES === */
/* Champ de formulaire (libellé au-dessus de son champ). Classe DÉDIÉE, pas `label {}` global :
   un <label> ne doit jamais imposer sa mise en page à un composant (ex. lignes de réglages). */
.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--text-secondary); }
input {
  font-family: var(--font-text); font-size: 1rem;
  color: var(--text-primary); background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem; width: 100%;
  transition: border-color 0.2s ease;
}
/* Date picker natif : on force le color-scheme sur l'input lui-même selon le thème. */
input { color-scheme: dark; }
body.light-theme input { color-scheme: light; }
input:focus { border-color: var(--accent); outline: none; }

.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 1rem; }
.login-card .pill { margin-top: 0.5rem; }
/* Bouton Google (branding : logo G officiel, fond neutre, bordure). */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; padding: 0.65rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-secondary); color: var(--text-primary); cursor: pointer; font-family: var(--font-text); font-weight: 600; font-size: 0.95rem; transition: border-color 0.2s ease; }
.btn-google:hover { border-color: var(--accent); }
.btn-google svg { flex: 0 0 auto; }
/* Séparateur "ou" entre Google et le formulaire email. */
.login-sep { display: flex; align-items: center; gap: 0.75rem; color: var(--text-secondary); font-size: 0.8rem; margin: 0.35rem 0; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--header-border); }
/* Lien discret "mot de passe oublié" sous le formulaire. */
.login-forgot { background: none; border: none; cursor: pointer; color: var(--text-secondary); font-family: var(--font-text); font-size: 0.82rem; text-decoration: underline; padding: 0.2rem 0; align-self: center; }
.login-forgot:hover { color: var(--accent); }
.error { color: var(--bad); font-size: 0.88rem; }

.field-date { max-width: 280px; }
.add-chips {
  display: flex; gap: 0.4rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px;
}
.add-chips .range-btn { flex: 0 0 auto; }
.param-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; }

/* === DATE PICKER CUSTOM (thémé, remplace le popup natif) === */
.dp { position: relative; display: flex; flex-direction: column; gap: 0.35rem; max-width: 280px; }
.dp-lbl { font-size: 0.9rem; color: var(--text-secondary); }
.dp-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; text-align: start;
  font-family: var(--font-text); font-size: 1rem; color: var(--text-primary);
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem; cursor: pointer; transition: border-color 0.2s ease;
}
.dp-trigger:hover { border-color: var(--accent); }
.dp-trigger svg { flex: 0 0 auto; color: var(--text-secondary); }
/* Date picker MODAL centré (M3) : au-dessus du dialog, plus rien à scroller pour Valider.
   (fixed échappe à l'overflow du corps du dialog ; .dlg-panel ouvert n'a pas de transform.) */
.dp-pop {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1250; width: 280px;
  max-height: 92vh; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55); padding: 0.8rem;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.dp-month { font-family: var(--font-title); font-weight: 600; font-size: 0.95rem; text-transform: capitalize; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 0.65rem; color: var(--text-secondary); padding-bottom: 0.2rem; }
.dp-cell { aspect-ratio: 1; }
.dp-day {
  aspect-ratio: 1; width: 100%; border: none; background: transparent; color: var(--text-primary);
  border-radius: var(--radius-xs); cursor: pointer; font-size: 0.85rem; font-family: var(--font-text);
}
.dp-day:hover:not(:disabled) { background: var(--accent-muted); }
.dp-day:disabled { color: var(--text-secondary); opacity: 0.35; cursor: not-allowed; }
/* Aujourd'hui : anneau accent fin (entouré). Sélectionné : fond plein. Quand aujourd'hui EST
   sélectionné, l'anneau passe en clair pour rester visible sur le fond plein. Survol : fond accent léger. */
/* Aujourd'hui = CONTOUR (repère), sélection = FOND PLEIN (choix) : deux états bien distincts. */
.dp-day.dp-today { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700; }
.dp-day.dp-sel { background: var(--accent); color: var(--on-accent); }
.dp-day.dp-sel.dp-today { outline-color: var(--on-accent); }
.dp-time { display: flex; align-items: flex-end; gap: 0.5rem; margin-top: 0.7rem; }
.dp-time label { flex: 1; }
.dp-time input { text-align: center; }
.dp-colon { padding-bottom: 0.6rem; color: var(--text-secondary); }
.dp-foot { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.8rem; }
.dp-btn {
  font-family: var(--font-text); font-size: 0.85rem; border-radius: var(--radius-pill); cursor: pointer;
  padding: 0.4rem 1rem; border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.dp-btn:hover { color: var(--accent); border-color: var(--accent); }
.dp-btn-accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.dp-btn-accent:hover { background: var(--accent-hover); color: var(--on-accent); border-color: var(--accent-hover); }
.form-msg { font-size: 0.9rem; }
/* flash() ne remplace plus className : ok/bad s'appliquent aussi aux messages hors .form-msg (ex. .set-note). */
.form-msg.ok, .set-note.ok { color: var(--ok); }
.form-msg.bad, .set-note.bad { color: var(--bad); }

/* === NAVIGATION (top bar desktop + bottom nav mobile) — Material 3 / Apple HIG === */
/* Actions header (switch + compte) toujours à droite. */
.header-actions { margin-inline-start: auto; }
/* Cachées hors session ; le bon bloc s'affiche selon la largeur (mobile-first). */
.topnav, .botnav, .acct { display: none; }

/* Top nav (desktop) : icône + label, actif = pilule accent (pas d'underline). */
.topnav { gap: 0.25rem; margin-inline-start: 1.25rem; }
.topnav .navlink { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.85rem; border: none; background: none; cursor: pointer; font-family: var(--font-title); font-weight: 500; font-size: 0.9rem; color: var(--text-secondary); border-radius: var(--radius-pill); transition: color 0.2s ease, background-color 0.2s ease; }
.topnav .navlink svg { width: 18px; height: 18px; flex: 0 0 auto; }
.topnav .navlink:hover { color: var(--text-primary); }
.topnav .navlink.is-active { color: var(--accent); background: var(--accent-muted); }

/* Bottom nav (mobile) : barre de navigation persistante, fixée en bas (convention Material 3
   navigation bar / Apple tab bar). Icône (pilule d'état actif) + label empilés.
   safe-area-inset-bottom : ne pas passer sous le home indicator / la barre gestuelle iOS. */
.botnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  height: calc(4.5rem + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-secondary); border-top: 1px solid var(--header-border);
}
.botnav .navlink { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding-top: 0.4rem; border: none; background: none; cursor: pointer; font-family: var(--font-text); color: var(--text-secondary); }
.botnav .navlink .ind { display: flex; align-items: center; justify-content: center; width: 3.5rem; height: 2rem; border-radius: var(--radius-pill); transition: background-color 0.2s ease; }
.botnav .navlink svg { width: 23px; height: 23px; }
.botnav .navlink span:last-child { font-size: 0.68rem; font-weight: 500; }
.botnav .navlink.is-active { color: var(--accent); }
.botnav .navlink.is-active .ind { background: var(--accent-muted); }

/* Compte : avatar + menu déroulant. */
.acct { position: relative; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.avatar:hover { color: var(--accent); border-color: var(--accent); }
.avatar svg { width: 20px; height: 20px; }
.acct[open] .avatar { color: var(--accent); border-color: var(--accent); }
/* Menu compte = DRAWER latéral (panneau fixe à droite + scrim flouté), pas un dropdown.
   Le drawer vit à la RACINE du body (hors header, pour échapper au backdrop-filter du header qui
   le piégeait). Affiché en CSS PUR via :has() sur l'état natif <details open> -> aucun JS requis
   pour l'ouverture (résilient au cache). L'animation rejoue à chaque ouverture. */
.acct-scrim { display: none; position: fixed; inset: 0; z-index: 1090; background: var(--scrim-bg);
  -webkit-backdrop-filter: blur(var(--scrim-blur)); backdrop-filter: blur(var(--scrim-blur)); animation: acctFade 0.22s ease; }
/* Fond ÉLEVÉ (bg-secondary), pas bg-card : sur le thème sombre bg-card (#141414) est
   quasi identique au fond de l'app (#121212), le drawer ne se détachait pas. */
.acct-menu { display: none; position: fixed; top: 0; inset-inline-end: 0; bottom: 0; width: min(320px, 86vw);
  background: var(--bg-secondary); border: none; border-inline-start: 1px solid var(--border); border-radius: 0;
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.55); padding: 0;
  z-index: 1100; overflow: hidden auto; flex-direction: column; animation: acctSlide 0.22s ease; }
body:has(.acct[open]) .acct-scrim { display: block; }
body:has(.acct[open]) .acct-menu { display: flex; }
@keyframes acctSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes acctFade { from { opacity: 0; } to { opacity: 1; } }
/* Hero : dégradé accent + avatar + identité. */
.acct-hero { position: relative; display: flex; align-items: center; gap: 0.8rem; padding: 1.15rem 1rem 0.95rem;
  background: radial-gradient(130% 90% at 100% 0, var(--accent-muted), transparent); }
.acct-hero-ava { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg-card);
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; line-height: 1; flex: 0 0 auto; overflow: hidden; }
.acct-hero-ava img { width: 100%; height: 100%; object-fit: cover; }
.acct-hero-id { min-width: 0; }
.acct-hero-name { font-family: var(--font-title); font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.acct-close { position: absolute; top: 0.55rem; inset-inline-end: 0.55rem; z-index: 2; border: none; background: none; color: var(--text-secondary);
  font-size: 1rem; cursor: pointer; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.acct-close:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-primary); }
.acct-email { color: var(--text-secondary); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12.5rem; }
.acct-email:empty { display: none; }
/* Liste d'items : icône accent + libellé + chevron, filets fins. */
.acct-list { padding: 0.35rem 0.9rem; }
.acct-item { display: flex; align-items: center; gap: 0.85rem; width: 100%; text-align: start; background: none; border: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12); padding: 0.95rem 0.4rem; color: var(--text-primary); cursor: pointer;
  font-family: var(--font-text); font-size: 0.9rem; font-weight: 500; }
.acct-list .acct-item:last-child { border-bottom: none; }
.acct-ic { width: 20px; height: 20px; flex: 0 0 auto; color: var(--accent); }
.acct-item:not(.acct-lang-row):hover { color: var(--accent-hover); }
.acct-arw { margin-inline-start: auto; color: var(--text-secondary); font-size: 0.9rem; flex: 0 0 auto; }
/* Le libellé prend la place dispo et se tronque plutôt que de pousser le drawer (ex. allemand long). */
.acct-item > span:not(.acct-arw) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-item.danger { color: var(--bad); }
.acct-item.danger .acct-ic { color: var(--bad); }
.acct-item.danger:hover { opacity: 0.82; }
/* Entrée « Guides » dépliable (Variante A) : un <details> dont le <summary> est un
   .acct-item natif ; les deux tutoriels (ids conservés pour les handlers app.js) se
   révèlent en sous-items indentés. On masque le marqueur natif du summary. */
.acct-guides > summary { list-style: none; cursor: pointer; }
.acct-guides > summary::-webkit-details-marker { display: none; }
/* Pas de ligne bleue au clic (le <summary> passe en :focus-visible au pointeur, contrairement aux
   <button>) ; on garde un repère de focus clavier doux, cohérent avec les autres lignes du drawer. */
.acct-guides > summary:focus { outline: none; }
.acct-guides > summary:focus-visible { outline: none; background: rgba(var(--accent-rgb), 0.10); border-radius: 8px; }
.acct-guides .acct-arw { transition: transform 0.2s ease; }
.acct-guides[open] .acct-arw { transform: rotate(90deg); }
/* Sous-items en texte simple, alignés sous le libellé du summary (icône 20px + gap). */
/* Ouverture fluide (~0.22s) : la liste est une grille dont la seule rangée passe de 0fr à 1fr ;
   l'enfant .acct-guides-inner (overflow:hidden) clippe le contenu pendant l'animation de hauteur. */
.acct-guides-list { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease;
  padding-inline-start: 2.6rem; }
.acct-guides[open] .acct-guides-list { grid-template-rows: 1fr; }
/* Neutralise le masquage natif du contenu d'un <details> fermé (Chrome/Edge/navigateurs récents) :
   sans ça la rangée n'a pas de frame de départ à 0fr et l'ouverture reste « sèche ». Là où le pseudo
   n'est pas supporté, le <details> masque nativement (dégradation propre : fonctionnel, sans animation). */
.acct-guides::details-content { content-visibility: visible; }
/* Contrepartie du point précédent : le contenu « toujours rendu » resterait focusable et annoncé une
   fois replié. On le sort du tab-order / de l'a11y via visibility:hidden. À la fermeture il reste visible
   le temps du collapse (délai 0.22s) puis se cache ; à l'ouverture il est visible immédiatement. */
.acct-guides-inner { overflow: hidden; min-height: 0;
  visibility: hidden; transition: visibility 0s linear 0.22s; }
.acct-guides[open] .acct-guides-inner { visibility: visible; transition: visibility 0s; }
.acct-guides-item { gap: 0.65rem; }
/* Réduction de mouvement : ouverture/fermeture instantanées (ni hauteur, ni visibilité, ni chevron animés). */
@media (prefers-reduced-motion: reduce) {
  .acct-guides-list { transition: none; }
  .acct-guides-inner { transition: none; }
  .acct-guides .acct-arw { transition: none; }
}
/* Footer (V4) : plan + Déconnexion regroupés en bas, sur fond bg-card avec bordure haute. */
.acct-foot { margin-top: auto; background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 0.85rem 0.95rem calc(0.9rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 0.7rem; }
.acct-foot-div { height: 1px; background: var(--border); }
.acct-foot .acct-item { border-bottom: none; padding: 0.1rem 0; }
/* Masqué visuellement mais lu par les lecteurs d'écran (libellés de champ implicites). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Langue : ligne inline dans la liste, le sélecteur custom poussé à droite (garde le widget existant). */
.acct-lang-row { cursor: default; }
.acct-lang-row .lang-select { margin-inline-start: auto; display: flex; }
.acct-lang-row .lang-trigger { background: none; border: none; color: var(--text-secondary); padding: 0.1rem 0.2rem; font-size: 0.85rem; gap: 0.3rem; }
.login-lang { display: flex; justify-content: center; margin-top: 0.4rem; }
.login-lang { display: flex; justify-content: center; margin-top: 0.4rem; }

/* --- Sélecteur de langue custom (thémé, remplace le <select> natif) --- */
.lang-select { position: relative; display: inline-flex; }
.lang-trigger {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; transition: border-color 0.15s ease, color 0.15s ease;
}
.lang-trigger:hover { border-color: var(--accent); }
.lang-trigger[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.lang-caret { flex: 0 0 auto; transition: transform 0.15s ease; }
.lang-trigger[aria-expanded="true"] .lang-caret { transform: rotate(180deg); }
.lang-flag { font-size: 1.05rem; line-height: 1; flex: 0 0 auto; }
.lang-name { white-space: nowrap; }

.lang-menu {
  position: absolute; z-index: 60; top: calc(100% + 0.35rem); left: 0;
  width: max-content; min-width: 100%; max-width: 90vw; max-height: min(60vh, 20rem); overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.4rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
/* Ouverture vers le haut (menu compte, en bas de page) + alignement à droite/centre. */
.lang-select[data-align="end"] .lang-menu { inset-inline-start: auto; inset-inline-end: 0; }
.lang-select[data-align="center"] .lang-menu { left: 50%; transform: translateX(-50%); }
.lang-opt {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; text-align: start;
  background: transparent; border: none; border-radius: var(--radius-sm); padding: 0.5rem 0.6rem;
  color: var(--text-primary); cursor: pointer; font-family: var(--font-text); font-size: 0.9rem; white-space: nowrap;
}
.lang-opt:hover { background: var(--accent-muted); color: var(--accent); }
.lang-opt.is-sel { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
@media (pointer: coarse) { .lang-opt { padding: 0.65rem 0.6rem; } }
/* Avatar emoji (animal marin) dans le bouton du header. */
.avatar-emoji { font-size: 1.35rem; line-height: 1; }
/* Grille de choix d'avatar : emojis + options (photo Google / défaut). */
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; }
.avatar-opt { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--bg-secondary); border: 2px solid var(--border); border-radius: 50%; cursor: pointer; padding: 0; transition: border-color 0.2s ease; }
.avatar-opt:hover { border-color: var(--accent); }
.avatar-opt.is-on { border-color: var(--accent); background: var(--accent-muted); }
.avatar-opt img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-opt svg { width: 55%; height: 55%; color: var(--text-secondary); }

/* Visibilité selon session + largeur (mobile-first : Compact <600 = bottom nav ; ≥600 = top bar). */
body.authed .acct { display: inline-flex; }
body.authed .botnav { display: flex; }
body.authed .app-view { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); } /* espace pour la bottom nav fixe */
@media (min-width: 600px) {
  body.authed .botnav { display: none; }
  body.authed .topnav { display: flex; }
  body.authed .app-view { padding-bottom: 4rem; }
}
.tab-panel { display: none; }
/* Fondu d'entrée des onglets. IMPORTANT : opacité SEULE, jamais de transform ici. Un transform
   (même dans un keyframe, le temps de l'anim) fait du .tab-panel le bloc conteneur de ses
   descendants position:fixed : l'écran verrouillé premium (.prem-gate-screen, fixed) se retrouvait
   ancré au panneau pendant les 0.3s, puis « sautait » vers le centre du viewport en fin d'anim
   (transform revenu à none). Ne pas réintroduire de transform. */
.tab-panel.is-active { display: block; animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Hub "Bac" (Option 2) : sous-nav segmentée, style repris de .range-btn (pills du Suivi).
   Masquée hors du hub (Budget/Protocoles). Repasse en flex:1 la barre du bas (3 onglets). */
/* Sous-header du hub "Bac" : PAS de gros boutons pleine largeur. Petites pills à largeur de
   contenu, alignées à gauche, exactement comme les boutons de plage du Suivi (.range-btn). */
.hubnav { display: flex; gap: 0.4rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 1.1rem; padding-bottom: 2px; }
.hubnav::-webkit-scrollbar { display: none; }
.hubnav[hidden] { display: none; }
.hublink { flex: 0 0 auto; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); border-radius: var(--radius-pill); padding: 0.3rem 0.85rem; font-family: var(--font-title); font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.hublink:hover { color: var(--text-primary); }
.hublink.is-active { background: var(--accent-muted); color: var(--accent); border-color: var(--accent); }
/* Indice de scroll : dégradé (mask) SEULEMENT du côté encore scrollable. Classes .fade-left/.fade-right
   posées en JS via updateFade() (comme .param-buttons/.add-chips), donc aucun dégradé si tout tient.
   Masque = thème-agnostique (transparent -> opaque), aucun décalage de layout. */
.hubnav.fade-left  { -webkit-mask-image: linear-gradient(to right, transparent, #000 16px); mask-image: linear-gradient(to right, transparent, #000 16px); }
.hubnav.fade-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 16px);  mask-image: linear-gradient(to left, transparent, #000 16px); }
.hubnav.fade-left.fade-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
/* Pendant un tour spotlight, on retire le masque : la cible éclairée (un hublink) ne doit jamais
   apparaître estompée sous le halo. Le spotlight lui-même est un overlay séparé, non masqué.
   Sélecteurs sur .fade-left/.fade-right pour passer devant .hubnav.fade-left.fade-right (spécificité). */
body:has(.tour) .hubnav.fade-left,
body:has(.tour) .hubnav.fade-right { -webkit-mask-image: none; mask-image: none; }

/* Select thémé (ui-select.js) : habille un <select> natif masqué. Trigger + menu comme le
   sélecteur de langue ; menu en position:fixed (posé par JS) pour ne pas être rogné en dialog. */
.sel-native { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; opacity: 0; pointer-events: none; overflow: hidden; }
.sel { position: relative; display: inline-flex; }
.dlg-field > .sel, .bud-scope .sel { width: 100%; }
.sel-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: var(--font-text); font-size: 0.92rem; padding: 0.5rem 0.7rem;
  cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease;
}
.sel-trigger:hover, .sel-trigger[aria-expanded="true"] { border-color: var(--accent); }
.sel-cur { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-caret { flex: 0 0 auto; color: var(--text-secondary); transition: transform 0.15s ease; }
.sel-trigger[aria-expanded="true"] .sel-caret { transform: rotate(180deg); color: var(--accent); }
.sel-menu {
  position: fixed; z-index: 1400; width: max-content; max-width: 90vw; max-height: 50vh; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); padding: 0.3rem; display: flex; flex-direction: column; gap: 1px;
}
.sel-opt {
  text-align: start; background: none; border: none; color: var(--text-primary);
  font-family: var(--font-text); font-size: 0.9rem; padding: 0.5rem 0.65rem; border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap;
}
.sel-opt:hover { background: var(--accent-muted); color: var(--accent); }
.sel-opt.is-sel { color: var(--accent); font-weight: 600; }

/* Ligne de filtre GÉNÉRIQUE (label + barre de boutons) : partagée Atlas + graphe + budget,
   pour que tous les filtres se ressemblent. La barre (range-buttons/ls-chips) prend la place restante. */
.filter-line { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0; }
.filter-label { flex: 0 0 auto; min-width: 4.6rem; font-size: 0.72rem; color: var(--text-secondary); }
.filter-line .range-buttons, .filter-line .ls-chips { flex: 1; min-width: 0; }
@media (max-width: 400px) { .filter-line { flex-direction: column; align-items: stretch; gap: 0.3rem; } .filter-label { min-width: 0; } }

/* === Splash de boot : aquarium paysage qui se remplit. Couvre le boot (z-index au-dessus du header /
   login / app) puis fondu pour révéler l'app prête. Le niveau d'eau est piloté par app.js (loaderProgress),
   calé sur l'avancement du chargement. === */
#boot-loader { position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.4rem;
  background: radial-gradient(120% 90% at 50% 42%, color-mix(in srgb, var(--accent) 9%, var(--bg-primary)), var(--bg-primary));
  transition: opacity 0.4s ease; }
#boot-loader.is-hidden { opacity: 0; pointer-events: none; }
.boot-tank { position: relative; width: min(220px, 68vw); aspect-ratio: 5 / 3; border-radius: 12px; overflow: hidden;
  border: 1.5px solid color-mix(in srgb, var(--accent) 38%, transparent);
  background: color-mix(in srgb, var(--accent) 4%, transparent);
  box-shadow: inset 0 0 30px color-mix(in srgb, var(--accent) 12%, transparent), 0 14px 34px rgba(0, 0, 0, 0.28); }
.boot-tank::after { content: ""; position: absolute; inset: 0; border-radius: 11px; pointer-events: none;
  background: linear-gradient(118deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 30%, rgba(255,255,255,0) 82%, rgba(255,255,255,.05) 100%); }
.boot-water { position: absolute; left: 0; right: 0; bottom: 0; height: 8%;
  background: linear-gradient(180deg, #38bdf8 0%, var(--accent-hover) 55%, var(--accent) 100%);
  transition: height 0.55s cubic-bezier(0.4, 0, 0.2, 1); }
.boot-wave { position: absolute; left: -50%; top: -9px; width: 200%; height: 12px; }
.boot-wave svg { width: 100%; height: 100%; display: block; }
.boot-w1 { animation: boot-wave 2.8s linear infinite; opacity: 0.9; }
.boot-w2 { animation: boot-wave 4.2s linear infinite reverse; opacity: 0.45; top: -6px; }
.boot-bubbles { position: absolute; inset: 0; pointer-events: none; }
.boot-bub { position: absolute; bottom: 6%; width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.6); opacity: 0; animation: boot-bubble 2.8s ease-in infinite; }
.boot-bub:nth-child(1) { left: 20%; animation-delay: 0.3s; width: 4px; height: 4px; }
.boot-bub:nth-child(2) { left: 42%; animation-delay: 1.2s; }
.boot-bub:nth-child(3) { left: 63%; animation-delay: 0.8s; width: 5px; height: 5px; }
.boot-bub:nth-child(4) { left: 78%; animation-delay: 1.9s; width: 4px; height: 4px; }
.boot-bub:nth-child(5) { left: 52%; animation-delay: 2.3s; width: 3px; height: 3px; }
.boot-fish { position: absolute; top: 52%; left: 8%; font-size: clamp(1.1rem, 4.4vw, 1.45rem);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); animation: boot-swim 5s ease-in-out infinite; }
.boot-brand { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.boot-logo { width: clamp(46px, 15vw, 56px); height: auto; filter: drop-shadow(0 3px 8px rgba(41, 73, 228, 0.35)); }
.boot-nm { font-family: var(--font-title); font-weight: 700; font-size: clamp(1rem, 4vw, 1.15rem); letter-spacing: 0.2px; color: var(--text-primary); }
.boot-nm b { color: var(--accent-hover); font-weight: 700; }
@keyframes boot-wave { from { transform: translateX(0); } to { transform: translateX(25%); } }
@keyframes boot-bubble { 0% { transform: translateY(0); opacity: 0; } 18% { opacity: 0.65; } 100% { transform: translateY(-90px); opacity: 0; } }
@keyframes boot-swim { 0% { left: 8%; transform: scaleX(-1); } 45% { left: 74%; transform: scaleX(-1); } 50% { left: 74%; transform: scaleX(1); } 95% { left: 8%; transform: scaleX(1); } 100% { left: 8%; transform: scaleX(-1); } }
@media (prefers-reduced-motion: reduce) {
  .boot-water { transition: none; }
  .boot-w1, .boot-w2, .boot-bub, .boot-fish { animation: none; }
}

/* ============================================================================
   Mode démo (?demo=1) : bandeau bas persistant "tu visites une démo".
   Placé AU-DESSUS de la bottom nav sur mobile, collé en bas sur desktop.
   ============================================================================ */
.demo-bar {
  position: fixed; left: 0; right: 0; z-index: 901;
  bottom: calc(4.5rem + env(safe-area-inset-bottom)); /* mobile : au-dessus de la .botnav */
  display: flex; align-items: center; justify-content: center; gap: 0.7rem; flex-wrap: wrap;
  padding: 0.55rem clamp(0.8rem, 3vw, 1.4rem);
  background: var(--bg-secondary); border-top: 1px solid var(--header-border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
  font-size: 0.82rem; text-align: center;
}
.demo-bar-txt { color: var(--text-secondary); }
.demo-bar-cta {
  flex: 0 0 auto; border: none; cursor: pointer; white-space: nowrap; color: #fff;
  background: var(--logo-grad, var(--accent)); border-radius: var(--radius-pill);
  padding: 0.4rem 0.95rem; font-family: var(--font-title); font-weight: 600; font-size: 0.8rem;
}
.demo-bar-cta:hover { filter: brightness(1.05); }
/* Espace sous le contenu (botnav + bandeau) pour ne rien masquer. */
body.demo .app-view { padding-bottom: calc(9.5rem + env(safe-area-inset-bottom)); }
/* FAB visible mais intercepté (nudge) : remonté au-dessus du bandeau. */
body.demo .fab-wrap { bottom: calc(4.5rem + env(safe-area-inset-bottom) + 4rem); }

@media (min-width: 600px) {
  /* Desktop : pas de bottom nav -> bandeau collé en bas. */
  .demo-bar { bottom: 0; padding-bottom: calc(0.55rem + env(safe-area-inset-bottom)); }
  body.demo .app-view { padding-bottom: 4.5rem; }
  body.demo .fab-wrap { bottom: calc(1.5rem + 3.4rem); }
}

/* Tiroir « Mon compte » en démo : aucun compte -> on masque les actions liées à un compte
   (avatar, déconnexion, plan premium, suppression). !important car .acct-item force display:flex.
   La sortie se fait par « Créer un compte » (.acct-demo-cta, injecté en JS). */
body.demo #avatar-btn,
body.demo #logout-btn,
body.demo #plan-status,
body.demo #delete-account-btn { display: none !important; }
/* « Créer un compte » dans le tiroir démo = même CTA dégradé que le bandeau (--logo-grad),
   centré, taille adaptée au tiroir. Remplace la déconnexion, c'est l'action de sortie principale. */
.acct-foot .acct-demo-cta {
  justify-content: center; margin: 0.55rem 0 0.15rem; padding: 0.7rem 1rem;
  color: #fff; background: var(--logo-grad, var(--accent)); border-radius: var(--radius-pill);
  font-family: var(--font-title); font-weight: 700; font-size: 0.9rem;
}
.acct-foot .acct-demo-cta:hover { color: #fff; filter: brightness(1.05); }
body.demo .acct-foot-div { display: none; } /* démo : séparateur orphelin (plan + déconnexion masqués) */
