:root {
  --fond: #f6f5f2;
  --surface: #ffffff;
  --texte: #1c1b19;
  --discret: #67635b;
  --bord: #e3e0d8;
  --accent: #1f4f46;
  --sur-accent: #ffffff;
  --ok: #1a6b45;
  --ok-fond: #e1f2e8;
  --erreur: #9a4017;
  --erreur-fond: #fbe9dd;
  --silence: #a8231c;
  --silence-fond: #fbe3e1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #141412;
    --surface: #1d1c1a;
    --texte: #eceae4;
    --discret: #a39f96;
    --bord: #2f2d29;
    --accent: #8fc9bb;
    --sur-accent: #10201c;
    --ok: #86d6aa;
    --ok-fond: #193125;
    --erreur: #f2aa80;
    --erreur-fond: #3a2519;
    --silence: #f4948b;
    --silence-fond: #3b1e1c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 12px; }
code { font-size: 0.9em; }

.entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}
.marque { color: var(--texte); font-weight: 700; letter-spacing: 0.02em; text-decoration: none; }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: 20px;
}

.connexion { max-width: 380px; margin: 8vh auto 0; }
form label { display: block; margin-top: 14px; font-size: 0.9rem; }
[hidden] { display: none !important; }

input, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: 8px;
}
button { font: inherit; cursor: pointer; }
.principal {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--sur-accent);
  font-weight: 600;
}
.lien { background: none; border: 0; padding: 4px; color: var(--discret); }
.lien:hover { color: var(--texte); }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bouton {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--sur-accent);
  font-weight: 600;
  text-decoration: none;
}
.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.alerte { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--silence-fond); color: var(--silence); }
.discret { color: var(--discret); font-size: 0.9rem; }

.titre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 6px; }
.pastille { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; }
.pastille.ok { background: var(--ok-fond); color: var(--ok); }
.pastille.erreur { background: var(--erreur-fond); color: var(--erreur); }
.pastille.silence { background: var(--silence-fond); color: var(--silence); }
.pastille.ia { background: var(--surface); color: var(--discret); border: 1px solid var(--bord); }

.aide { margin: 16px 0 0; }
.invitation { max-width: 440px; }
.invitation h2 { margin: 24px 0 0; }
.invitation h2 + p { margin-top: 6px; }
.repli { margin-top: 12px; }
.repli summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.qr { width: 196px; margin: 12px auto; padding: 10px; border-radius: 8px; background: #ffffff; }
.qr svg { display: block; width: 100%; height: auto; }
.cle { font-size: 0.85rem; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.acces { margin-bottom: 16px; }
.ligne { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-top: 12px; }
.ligne label { flex: 1 1 200px; margin-top: 0; }
.ligne .bouton { border: 0; }
.lien-invitation { font-size: 0.85rem; }

.assistant { display: grid; gap: 16px; margin-top: 16px; }
.micro-zone { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.micro-zone p { margin: 0; }
.micro {
  width: 132px;
  height: 132px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--sur-accent);
  font-size: 1.1rem;
  font-weight: 700;
}
.micro:disabled { opacity: 0.6; cursor: progress; }
.micro.en-ligne { background: var(--silence); animation: pulsation 1.6s ease-in-out infinite; }
@keyframes pulsation {
  0%, 100% { box-shadow: 0 0 0 0 var(--silence-fond); }
  50% { box-shadow: 0 0 0 14px var(--silence-fond); }
}
@media (prefers-reduced-motion: reduce) {
  .micro.en-ligne { animation: none; }
}
.journal { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; padding: 4px 0; }
.journal[hidden] { display: none; }
.message { max-width: 85%; padding: 8px 12px; border-radius: 10px; background: var(--fond); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.moi { align-self: flex-end; background: var(--ok-fond); }
.message.outil { align-self: center; padding: 2px 8px; background: none; color: var(--discret); font-size: 0.85rem; }
.message.outil .auteur { display: none; }
.auteur { display: block; color: var(--discret); font-size: 0.75rem; font-weight: 600; }
.depot {
  display: block;
  padding: 14px;
  border: 1px dashed var(--bord);
  border-radius: 10px;
  color: var(--discret);
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
}
.depot:hover, .depot.survol { border-color: var(--accent); color: var(--texte); }
.depot.charge { border-style: solid; border-color: var(--ok); color: var(--ok); }
.ecrire { display: flex; gap: 8px; align-items: flex-end; }
.ecrire textarea { flex: 1; min-height: 46px; margin: 0; resize: vertical; }
.ecrire .principal { width: auto; margin: 0; padding: 12px 18px; }

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.chiffre strong { display: block; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chiffre span { color: var(--discret); font-size: 0.9rem; }

.colonnes { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) {
  .colonnes { grid-template-columns: minmax(240px, 1fr) 2fr; }
}

.repartition { list-style: none; margin: 0; padding: 0; }
.repartition li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.repartition li:last-child { border-bottom: 0; }
.repartition strong { font-variant-numeric: tabular-nums; }

.tableau { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; }
td { overflow-wrap: anywhere; }
td:first-child, th { white-space: nowrap; }
th { color: var(--discret); font-weight: 500; }
.nombre { text-align: right; font-variant-numeric: tabular-nums; }
