/*
 * _commun/commun.css : charte visuelle commune au hub et à tous les outils.
 * Compatibilité : on ajoute des classes, on ne renomme ni ne supprime celles qui existent.
 *
 * Couleurs : blanc de chaux, vert volet, ocre, encre ; tomette pour les erreurs.
 * Police : Bricolage Grotesque (variable, embarquée, licence OFL).
 */

@font-face {
  font-family: "Bricolage";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url(polices/bricolage-grotesque-latin-standard-normal.woff2) format("woff2-variations"),
       url(polices/bricolage-grotesque-latin-standard-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  src: url(polices/bricolage-grotesque-latin-ext-standard-normal.woff2) format("woff2-variations"),
       url(polices/bricolage-grotesque-latin-ext-standard-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --chaux: #f2f4f0;        /* fond de page */
  --chaux-2: #e6eae4;      /* fond secondaire, champs */
  --carte: #fbfcfa;        /* surfaces posées sur la page */
  --encre: #1e2d2a;        /* texte */
  --encre-2: #52615d;      /* texte secondaire */
  --trait: #cfd7d2;        /* séparateurs */
  --volet: #2e6a5c;        /* actions, en-tête */
  --volet-fonce: #234f45;
  --volet-clair: #dbe8e3;
  --entete: #2e6a5c;       /* bande d'en-tête */
  --sur-volet: #f4f8f6;    /* texte posé sur le vert */
  --ocre: #d49a2e;         /* avertissements */
  --ocre-clair: #f6e7c8;
  --tomette: #b0473a;      /* erreurs */
  --tomette-clair: #f3dcd8;
  --lavande: #6f6aa8;
  --bleu: #3a6b98;
  --olive: #6d7d34;

  --police: "Bricolage", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-petit: 0.8125rem;    /* 13 px */
  --t-corps: 1rem;         /* 16 px */
  --t-titre-3: 1.1875rem;  /* 19 px */
  --t-titre-2: 1.5rem;     /* 24 px */
  --t-titre-1: 2.25rem;    /* 36 px */

  --r-petit: 6px;
  --r-moyen: 12px;
  --r-grand: 20px;
  --marge: 16px;
  --largeur: 760px;
  --ombre-feuille: 0 -8px 32px rgba(20, 35, 31, 0.18);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --chaux: #13211e;
    --chaux-2: #1c2d29;
    --carte: #182825;
    --encre: #e6eeea;
    --encre-2: #9fb2ac;
    --trait: #2c403b;
    --volet: #3f8a78;
    --volet-fonce: #2a6457;
    --volet-clair: #203a34;
    --entete: #22524a;
    --sur-volet: #f4f8f6;
    --ocre: #e2ae4a;
    --ocre-clair: #3a3020;
    --tomette: #d46a5c;
    --tomette-clair: #3b2421;
    --ombre-feuille: 0 -8px 32px rgba(0, 0, 0, 0.5);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--chaux);
  color: var(--encre);
  font-family: var(--police);
  font-size: var(--t-corps);
  line-height: 1.5;
  font-variation-settings: "opsz" 14;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
  font-weight: 700;
  font-variation-settings: "opsz" 48;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--t-titre-1); }
h2 { font-size: var(--t-titre-2); }
h3 { font-size: var(--t-titre-3); }
p { margin: 0 0 0.75em; }

a { color: var(--volet); }
a:hover { color: var(--volet-fonce); }

:focus-visible {
  outline: 3px solid var(--ocre);
  outline-offset: 2px;
  border-radius: var(--r-petit);
}

.muet { color: var(--encre-2); }
.petit { font-size: var(--t-petit); }
.cache { display: none !important; }
.pour-lecteur {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Page et en-tête ---------- */

.page {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0 var(--marge) 48px;
}

/* En-tête : bande vert volet rayée comme des lames de persienne. */
.barre {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--marge) 10px;
  background-color: var(--entete);
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.07) 0,
    rgba(255, 255, 255, 0.07) 2px,
    transparent 2px,
    transparent 9px);
  color: var(--sur-volet);
}
.barre h1 {
  flex: 1;
  min-width: 0;
  font-size: var(--t-titre-3);
  font-stretch: 85%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.barre a, .barre button { color: var(--sur-volet); }

.retour {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 0 10px 0 4px;
  border-radius: var(--r-moyen);
  text-decoration: none;
  font-weight: 600;
}
.retour::before {
  content: "";
  width: 10px; height: 10px;
  border-left: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg);
  margin: 0 4px 0 8px;
}
.retour:hover { background: rgba(255, 255, 255, 0.12); color: var(--sur-volet); }

/* ---------- Puce de profil ---------- */

.puce-profil {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  max-width: 50%;
  padding: 4px 12px 4px 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.puce-profil .avatar { width: 30px; height: 30px; font-size: 16px; }
.puce-profil span:last-child { overflow: hidden; text-overflow: ellipsis; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--volet-clair);
  color: var(--encre);
  font-size: 22px;
  line-height: 1;
  overflow: hidden;
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Feuille « Personnaliser » : avatar, couleur du hub, ordre des outils */
.perso-bloc { margin: 0 0 22px; }
.perso-bloc h3 { margin: 0 0 10px; font-size: var(--t-titre-3); }
.perso-avatar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.perso-actions { display: flex; flex-direction: column; gap: 8px; }
.perso-libre { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: var(--t-petit); color: var(--encre-2); }
.perso-libre input { width: 56px; height: 36px; padding: 0; border: 0; border-radius: var(--r-petit); background: none; cursor: pointer; }

/* ---------- Boutons ---------- */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-moyen);
  background: var(--volet);
  color: var(--sur-volet);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.bouton:hover { background: var(--volet-fonce); color: var(--sur-volet); }
.bouton:disabled { opacity: 0.5; cursor: default; }
.bouton.secondaire {
  background: transparent;
  color: var(--volet);
  box-shadow: inset 0 0 0 1.5px var(--volet);
}
.bouton.secondaire:hover { background: var(--volet-clair); }
.bouton.discret { background: transparent; color: var(--encre-2); padding: 0 10px; }
.bouton.discret:hover { background: var(--chaux-2); color: var(--encre); }
.bouton.danger { background: var(--tomette); }
.bouton.pleine-largeur { width: 100%; }

.icone-bouton {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-moyen);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.icone-bouton:hover { background: rgba(127, 127, 127, 0.15); }
.icone-bouton svg { width: 22px; height: 22px; }

/* ---------- Formulaires ---------- */

.champ { display: grid; gap: 6px; margin-bottom: 14px; }
.champ > span { font-weight: 600; font-size: var(--t-petit); color: var(--encre-2); }
.champ input, .champ select, .champ textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--trait);
  border-radius: var(--r-moyen);
  background: var(--carte);
  color: var(--encre);
  font: inherit;
  font-size: 16px; /* évite le zoom automatique sur iPhone */
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
  outline: none;
  border-color: var(--volet);
  box-shadow: 0 0 0 3px var(--volet-clair);
}

/* ---------- Listes ---------- */

.liste {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--r-grand);
  background: var(--carte);
  box-shadow: 0 0 0 1px var(--trait);
  overflow: hidden;
}
.liste > li + li { border-top: 1px solid var(--trait); }

.ligne {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px var(--marge);
  color: inherit;
  text-decoration: none;
}
a.ligne:hover, button.ligne:hover { background: var(--chaux-2); color: inherit; }
button.ligne {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ligne .corps { flex: 1; min-width: 0; }
.ligne .corps strong { display: block; font-size: var(--t-titre-3); font-weight: 650; line-height: 1.25; }
.ligne .corps small { display: block; color: var(--encre-2); font-size: var(--t-petit); line-height: 1.35; }

/* Tuile carrée façon carreau de ciment, porte l'icône d'un outil. */
.tuile {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: var(--r-moyen);
  background: var(--volet);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18), inset 0 0 0 6px rgba(0, 0, 0, 0.06);
}
.tuile img { width: 34px; height: 34px; object-fit: contain; }

/* ---------- Bandeaux d'information ---------- */

.bandeau {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: var(--r-moyen);
  background: var(--volet-clair);
  color: var(--encre);
  font-size: 0.9375rem;
}
.bandeau.attention { background: var(--ocre-clair); }
.bandeau.erreur { background: var(--tomette-clair); }
.bandeau p:last-child { margin-bottom: 0; }

/* ---------- Jauge ---------- */

.jauge {
  height: 8px;
  border-radius: 99px;
  background: var(--chaux-2);
  overflow: hidden;
}
.jauge > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--volet);
}
.jauge.attention > i { background: var(--ocre); }
.jauge.alerte > i { background: var(--tomette); }

/* ---------- Pastille d'état ---------- */

.pastille {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--volet);
  vertical-align: 1px;
}
.pastille.attention { background: var(--ocre); }
.pastille.alerte { background: var(--tomette); }
.pastille.inconnu { background: var(--trait); }

/* ---------- Feuille (fenêtre qui monte du bas) ---------- */

dialog.feuille {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 8px var(--marge) calc(20px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: var(--r-grand) var(--r-grand) 0 0;
  background: var(--carte);
  color: var(--encre);
  box-shadow: var(--ombre-feuille);
  overflow: auto;
}
dialog.feuille::backdrop { background: rgba(14, 26, 23, 0.45); }
dialog.feuille[open] { animation: feuille-monte 0.22s ease-out; }
dialog.feuille .poignee {
  width: 40px; height: 5px; margin: 0 auto 10px;
  border-radius: 99px; background: var(--trait);
}
dialog.feuille header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 12px;
}
@media (min-width: 640px) {
  dialog.feuille { margin: auto; border-radius: var(--r-grand); }
}
@keyframes feuille-monte {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- Message éphémère ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--r-moyen);
  background: var(--encre);
  color: var(--chaux);
  font-weight: 600;
  transform: translateX(-50%);
  animation: feuille-monte 0.2s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Ajouts 2.2.0 : comptes, connexion, administration ---------- */

/* Choix d'une couleur (pastilles rondes) */
.couleurs { display: flex; flex-wrap: wrap; gap: 10px; border: 0; margin: 0 0 14px; padding: 0; }
.couleurs legend { font-weight: 600; font-size: var(--t-petit); color: var(--encre-2); margin-bottom: 6px; padding: 0; }
.couleurs label { position: relative; }
.couleurs input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.couleurs span { display: block; width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); cursor: pointer; }
.couleurs input:checked + span { box-shadow: 0 0 0 3px var(--carte), 0 0 0 5px var(--volet); }
.couleurs input:focus-visible + span { outline: 3px solid var(--ocre); outline-offset: 4px; }

.deux { display: grid; grid-template-columns: 1fr 96px; gap: 12px; }

/* Liste de vérifications */
.verifs { margin: 0; padding: 0; list-style: none; }
.verifs li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--trait); }
.verifs li:first-child { border-top: 0; }
.verifs .pastille { margin-top: 7px; flex: none; }
.verifs small { display: block; color: var(--encre-2); }

/* Étiquette courte (rôle, état) */
.etiquette {
  display: inline-block; padding: 1px 8px; border-radius: 99px;
  background: var(--chaux-2); color: var(--encre-2);
  font-size: var(--t-petit); font-weight: 650; line-height: 1.6; vertical-align: 2px;
}
.etiquette.volet { background: var(--volet-clair); color: var(--volet-fonce); }
.etiquette.ocre { background: var(--ocre-clair); color: var(--encre); }

/* Cases à cocher en liste (droits par outil) */
.cases { margin: 0; padding: 0; list-style: none; border-radius: var(--r-moyen); box-shadow: 0 0 0 1px var(--trait); overflow: hidden; }
.cases li + li { border-top: 1px solid var(--trait); }
.cases label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; cursor: pointer; background: var(--carte); }
.cases input { width: 22px; height: 22px; accent-color: var(--volet); flex: none; }
.cases .tuile { width: 34px; height: 34px; font-size: 18px; border-radius: var(--r-petit); box-shadow: none; }
.cases .tuile img { width: 22px; height: 22px; }

/* Choix du compte sur l'écran de connexion */
.portes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.porte {
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%;
  padding: 16px 8px 14px; border: 0; border-radius: var(--r-grand);
  background: var(--carte); box-shadow: 0 0 0 1px var(--trait);
  color: var(--encre); font: inherit; font-weight: 650; cursor: pointer;
}
.porte:hover { box-shadow: 0 0 0 2px var(--volet); }
.porte .avatar { width: 64px; height: 64px; font-size: 32px; }
.porte span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.porte.invite .avatar { background: var(--chaux-2); }

.message-erreur { min-height: 1.4em; margin: 0 0 10px; color: var(--tomette); font-weight: 600; font-size: .9375rem; }

/* ---------- Notifications (notifications.js, feuille du menu du compte) ---------- */
.notif-etat { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-moyen); background: var(--volet-clair); }
.notif-etat.attention { background: var(--ocre-clair); }
.notif-etat.erreur { background: var(--tomette-clair); }
.notif-etat p { margin: 0; }
.notif-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.notif-liste { list-style: none; margin: 0; padding: 0; }
.notif-liste li { border-top: 1px solid var(--trait); }
.notif-liste li:first-child { border-top: 0; }
.notif-ligne { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.notif-ligne .texte { flex: 1; min-width: 0; }
.notif-ligne strong { display: block; }
.notif-ligne small { display: block; color: var(--encre-2); font-size: var(--t-petit); }
.notif-ligne input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; margin: 0;
  width: 46px; height: 28px; border-radius: 14px; background: var(--trait); cursor: pointer; transition: background 0.15s;
}
.notif-ligne input[type=checkbox]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.notif-ligne input[type=checkbox]:checked { background: var(--volet); }
.notif-ligne input[type=checkbox]:checked::after { transform: translateX(18px); }
.notif-ligne input[type=checkbox]:focus-visible { outline: 2px solid var(--volet); outline-offset: 2px; }
