/* Bord : outil interne, composé comme un tableau de bord.
   Palette neutre (gris froids), la couleur ne sert qu'aux états et aux données. */

:root {
  --fond: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --trait: #dde1e6;
  --texte: #14171a;
  --texte-2: #48505a;
  --texte-3: #646c76;
  --primaire: #1b1f24;
  --sur-primaire: #ffffff;
  --rouge: #c0262d;
  --rouge-fond: #fcebec;
  --orange: #9a5200;
  --orange-fond: #fdf1df;
  --vert: #1d7a44;
  --vert-fond: #e5f4ea;
  --bleu: #1f5cb8;
  --bleu-fond: #e7effb;
  --donnee: #2e68d4;
  --ombre: 0 1px 2px rgba(20, 23, 26, .06);
  --rayon: 16px;
  --haut: env(safe-area-inset-top, 0px);
  --bas: env(safe-area-inset-bottom, 0px);
  --onglets: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0d0f12;
    --surface: #171a1e;
    --surface-2: #1f2328;
    --trait: #2b3036;
    --texte: #eceff2;
    --texte-2: #b6bdc5;
    --texte-3: #929aa3;
    --primaire: #eceff2;
    --sur-primaire: #111316;
    --rouge: #ff8080;
    --rouge-fond: #3a1a1c;
    --orange: #f2a84e;
    --orange-fond: #382913;
    --vert: #63d08f;
    --vert-fond: #14301f;
    --bleu: #82b2ff;
    --bleu-fond: #17263d;
    --donnee: #7eaaff;
    --ombre: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0d0f12; --surface: #171a1e; --surface-2: #1f2328; --trait: #2b3036;
  --texte: #eceff2; --texte-2: #b6bdc5; --texte-3: #929aa3;
  --primaire: #eceff2; --sur-primaire: #111316;
  --rouge: #ff8080; --rouge-fond: #3a1a1c; --orange: #f2a84e; --orange-fond: #382913;
  --vert: #63d08f; --vert-fond: #14301f; --bleu: #82b2ff; --bleu-fond: #17263d;
  --donnee: #7eaaff; --ombre: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ic { width: 22px; height: 22px; flex: none; fill: currentColor; }
.ic.petit { width: 18px; height: 18px; }

/* ------------------------------------------------------------ mise en page */

#vue {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--haut) + 12px) 16px calc(var(--onglets) + var(--bas) + 28px);
  min-height: 100vh;
}
.entete { padding: 8px 4px 16px; }
.entete .surtitre { color: var(--texte-3); font-size: 16px; font-weight: 600; }
.entete .surtitre::first-letter { text-transform: uppercase; }
.entete h1 { margin: 2px 0 0; font-size: 30px; line-height: 1.15; font-weight: 750; }
.entete .mot { margin: 10px 0 0; color: var(--texte-2); font-size: 17px; }
.entete-ligne { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

h2 {
  font-size: 20px; font-weight: 700; margin: 28px 4px 10px;
  display: flex; align-items: baseline; gap: 8px;
}
h2 .compte { color: var(--texte-3); font-weight: 600; font-size: 17px; }

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  overflow: hidden;
}
.carte + .carte { margin-top: 12px; }
.carte.pad { padding: 16px; }
.vide { color: var(--texte-3); padding: 16px; font-size: 16px; }

/* ------------------------------------------------------------ fraîcheur, statut */

.statut {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--texte-3); font-size: 16px; padding: 0 4px;
}
.statut .actualiser {
  margin-left: auto; border: 0; background: var(--surface-2); color: var(--texte-2);
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
}
.statut .actualiser:hover { color: var(--texte); }
.statut .actualiser.tourne .ic { opacity: .4; }
.pastille {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 15px; font-weight: 600;
  background: var(--surface-2); color: var(--texte-2); white-space: nowrap;
}
.pastille .ic { width: 16px; height: 16px; }
.p-rouge { background: var(--rouge-fond); color: var(--rouge); }
.p-orange { background: var(--orange-fond); color: var(--orange); }
.p-vert { background: var(--vert-fond); color: var(--vert); }
.p-bleu { background: var(--bleu-fond); color: var(--bleu); }

.avertissement {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 12px; padding: 14px 16px; border-radius: var(--rayon);
  background: var(--orange-fond); color: var(--orange); font-size: 16px; font-weight: 600;
}
.avertissement.rouge { background: var(--rouge-fond); color: var(--rouge); }
.avertissement p { margin: 0; }
.avertissement .ic { margin-top: 1px; }

/* ------------------------------------------------------------ lignes et éléments */

.ligne {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
}
.ligne + .ligne { border-top: 1px solid var(--trait); }
.ligne .corps { flex: 1; min-width: 0; }
.ligne .titre { font-weight: 600; overflow-wrap: anywhere; }
.ligne .detail { color: var(--texte-2); font-size: 16px; margin-top: 2px; overflow-wrap: anywhere; }
.ligne.fait .titre { color: var(--texte-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.ligne.fait .detail { color: var(--texte-3); }
.meta {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px;
  color: var(--texte-3); font-size: 16px;
}
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta .ic { width: 16px; height: 16px; }
.meta .retard { color: var(--rouge); font-weight: 600; }
.note-affichee {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); color: var(--texte-2); font-size: 16px; white-space: pre-wrap;
}
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.bouton-discret {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--trait); background: transparent; color: var(--texte-2);
  padding: 7px 12px; border-radius: 10px; font-size: 16px; font-weight: 600; min-height: 40px;
}
.bouton-discret:hover { color: var(--texte); background: var(--surface-2); }
.bouton-discret .ic { width: 17px; height: 17px; }

.case {
  flex: none; width: 30px; height: 30px; margin-top: -2px;
  border-radius: 50%; border: 2px solid var(--texte-3); background: transparent;
  display: grid; place-items: center; color: transparent; padding: 0;
}
.case .ic { width: 16px; height: 16px; }
.case[aria-checked="true"] { background: var(--vert); border-color: var(--vert); color: var(--surface); }
.case:hover { border-color: var(--texte-2); }
.case[aria-checked="true"]:hover { border-color: var(--vert); }

.heure { flex: none; width: 64px; font-weight: 700; font-variant-numeric: tabular-nums; }
.heure small { display: block; color: var(--texte-3); font-weight: 500; font-size: 16px; }

/* ------------------------------------------------------------ boutons */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 13px 18px; min-height: 50px;
  background: var(--primaire); color: var(--sur-primaire); font-weight: 650; font-size: 17px;
}
.bouton:hover { opacity: .9; }
.bouton.large { width: 100%; }
.bouton.second { background: var(--surface-2); color: var(--texte); }
.bouton:disabled { opacity: .5; }

/* ------------------------------------------------------------ réunion du jour */

.reunion-carte .haut { padding: 16px 16px 4px; }
.reunion-carte .quand { color: var(--texte-3); font-size: 16px; font-weight: 600; }
.reunion-carte h3 { margin: 4px 0 0; font-size: 22px; line-height: 1.2; }
.reunion-carte .objectif { color: var(--texte-2); margin: 8px 0 0; font-size: 16px; }
.reunion-carte .bas { padding: 14px 16px 16px; }
.progres { display: flex; align-items: center; gap: 12px; margin: 12px 0 14px; color: var(--texte-2); font-size: 16px; font-weight: 600; }
.jauge { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.jauge i { display: block; height: 100%; border-radius: 99px; background: var(--vert); transition: width .25s ease; }

/* ------------------------------------------------------------ chiffres */

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tuile { padding: 14px 16px; }
.tuile .lib { color: var(--texte-2); font-size: 16px; font-weight: 600; }
.tuile .val { font-size: 23px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.tuile .sous { color: var(--texte-3); font-size: 16px; margin-top: 2px; }
.courbe { display: block; width: 100%; height: 56px; margin-top: 10px; touch-action: pan-y; overflow: visible; }
.courbe .ligne-donnee { fill: none; stroke: var(--donnee); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.courbe .aire { fill: var(--donnee); opacity: .10; }
.courbe .point { fill: none; stroke: var(--donnee); stroke-width: 9; stroke-linecap: round; }
.courbe .repere { stroke: var(--texte-3); stroke-width: 1; stroke-dasharray: 2 3; }

/* ------------------------------------------------------------ groupes repliables */

.groupe-tete {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; text-align: left; padding: 0; margin: 28px 0 10px;
}
.groupe-tete h2 { margin: 0 4px; flex: 1; }
.groupe-tete .ic { color: var(--texte-3); }
.h2-rouge { color: var(--rouge); }

/* ------------------------------------------------------------ dossiers */

.dossier .tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dossier .client { color: var(--texte-3); font-size: 16px; }
.dossier dl { margin: 10px 0 0; display: grid; gap: 8px; }
.dossier dt { color: var(--texte-3); font-size: 16px; font-weight: 600; }
.dossier dd { margin: 0; font-size: 16px; color: var(--texte-2); }
.dossier .pastilles { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------------------------------------ séance */

#seance {
  position: fixed; inset: 0; z-index: 30; background: var(--fond);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.seance-tete {
  position: sticky; top: 0; z-index: 2; background: var(--fond);
  padding: calc(var(--haut) + 8px) 16px 12px; border-bottom: 1px solid var(--trait);
}
.seance-tete .rang { display: flex; align-items: center; gap: 8px; max-width: 680px; margin: 0 auto; }
.seance-tete .titre { flex: 1; min-width: 0; font-weight: 700; font-size: 18px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icone-bouton {
  border: 0; background: var(--surface-2); color: var(--texte);
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
}
.icone-bouton:hover { background: var(--trait); }
.seance-tete .progres { max-width: 680px; margin: 10px auto 0; }
.seance-corps { max-width: 680px; margin: 0 auto; padding: 8px 16px calc(var(--bas) + 40px); }
.seance-corps .objectif { color: var(--texte-2); margin: 12px 4px 0; }
.section-tete {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 0; margin: 26px 0 10px; text-align: left;
}
.section-tete h2 { margin: 0 4px; flex: 1; }
.section-tete .ic { color: var(--texte-3); }
.section-tete .pastille { flex: none; }
.seance .ligne { padding: 16px; }
.seance .ligne .titre { font-size: 18px; }

/* ------------------------------------------------------------ onglets */

#onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(var(--bas) + 6px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--trait);
}
#onglets button {
  border: 0; background: transparent; color: var(--texte-3);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font-size: 14px; font-weight: 600; min-height: 52px;
}
#onglets button:hover { color: var(--texte-2); }
#onglets button[aria-current="page"] { color: var(--texte); }
#onglets .ic { width: 24px; height: 24px; margin: 5px 0; }
#onglets .onglet-noter { color: var(--texte); }
#onglets .rond {
  width: 46px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primaire); color: var(--sur-primaire);
}
#onglets .rond .ic { width: 20px; height: 20px; margin: 0; }
#onglets .onglet-noter .compte-badge { display: none; }

/* ------------------------------------------------------------ feuille du bas */

#voile {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 10, 12, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
#feuille {
  width: 100%; max-width: 680px; max-height: calc(100vh - var(--haut) - 24px); overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(var(--bas) + 20px);
  animation: monte .2s ease-out;
}
@keyframes monte { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.feuille-tete { display: flex; align-items: center; gap: 12px; padding: 6px 0 12px; }
.feuille-tete h2 { margin: 0; flex: 1; }
.feuille-sujet { color: var(--texte-2); font-size: 16px; margin: -4px 0 14px; }
.choix { display: grid; gap: 10px; }
.choix .bouton { justify-content: flex-start; }
.champ {
  width: 100%; border: 1px solid var(--trait); background: var(--surface-2);
  border-radius: 14px; padding: 14px; font-size: 17px; min-height: 52px;
}
.champ:focus { outline: 2px solid var(--texte-2); outline-offset: 1px; }
textarea.champ { min-height: 140px; resize: vertical; line-height: 1.45; }
.rangee { display: flex; gap: 10px; margin-top: 12px; }
.rangee > * { flex: 1; }
.etiquette { display: block; color: var(--texte-2); font-size: 16px; font-weight: 600; margin: 16px 0 8px; }

/* ------------------------------------------------------------ connexion */

.connexion { min-height: calc(100vh - var(--haut) - 40px); display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; }
.connexion .logo { width: 64px; height: 64px; border-radius: 16px; display: block; }
.connexion h1 { font-size: 32px; margin: 18px 0 4px; }
.connexion p { color: var(--texte-2); margin: 0 0 22px; }
.erreur { color: var(--rouge); font-weight: 600; font-size: 16px; margin-top: 12px; min-height: 24px; }

/* ------------------------------------------------------------ toast */

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  top: calc(var(--haut) + 12px);
  background: var(--primaire); color: var(--sur-primaire);
  padding: 12px 18px; border-radius: 14px; font-size: 16px; font-weight: 600;
  max-width: calc(100vw - 32px);
}

@media (min-width: 700px) {
  .grille { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  #feuille { animation: none; }
  .jauge i { transition: none; }
}
