:root {
  --fond: #f4f5f7;
  --carte: #ffffff;
  --texte: #1d2330;
  --doux: #667085;
  --bord: #e4e7ec;
  --accent: #2f6fed;
  --ok: #157f3c;
  --attente: #b26b00;
  --alerte: #c0262d;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #12151c;
    --carte: #1b2029;
    --texte: #e6e9ef;
    --doux: #9aa3b2;
    --bord: #2b3240;
    --accent: #6c9bff;
    --ok: #4cc27a;
    --attente: #e0a040;
    --alerte: #f0686e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.45;
}
.bandeau {
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-size: .85rem;
  padding: .35rem 1rem;
}
.entete {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}
.date { margin: 0; color: var(--doux); text-transform: capitalize; }
h1 { margin: .2rem 0; font-size: 2rem; }
.sous-titre { margin: 0; color: var(--doux); }
.filtres { display: flex; flex-wrap: wrap; gap: .5rem; }
.filtres a {
  color: var(--texte);
  text-decoration: none;
  border: 1px solid var(--bord);
  background: var(--carte);
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .9rem;
}
.filtres a:hover { border-color: var(--accent); color: var(--accent); }
.grille {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
}
.carte.large { grid-column: 1 / -1; }
h2 { margin: 0 0 .8rem; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.pastille {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: .75rem; padding: .05rem .5rem;
}
.kpis {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.kpis li { border: 1px solid var(--bord); border-radius: 10px; padding: .75rem 1rem; }
.nombre { display: block; font-size: 1.8rem; font-weight: 700; }
.libelle { color: var(--doux); font-size: .9rem; }
.resume { margin: 1rem 0 0; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
  padding: .6rem 0; border-top: 1px solid var(--bord);
}
.liste li:first-child { border-top: 0; }
.liste p { margin: 0; color: var(--doux); font-size: .9rem; }
.source { font-size: .7rem; font-weight: 600; border-radius: 6px; padding: .15rem .4rem; color: #fff; }
.gmail { background: #c5221f; }
.outlook { background: #0f6cbd; }
button {
  font: inherit; font-size: .8rem; cursor: pointer;
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  border-radius: 8px; padding: .3rem .6rem;
}
button:hover { background: var(--accent); color: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--doux); font-weight: 500; }
th, td { padding: .45rem .25rem; border-bottom: 1px solid var(--bord); }
.etat { font-size: .8rem; font-weight: 600; }
.etat.ok { color: var(--ok); }
.etat.attente { color: var(--attente); }
.etat.alerte { color: var(--alerte); }
.note { margin: .8rem 0 0; color: var(--doux); font-size: .9rem; }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: flex; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--bord); }
.agenda li:first-child { border-top: 0; }
.agenda time { font-variant-numeric: tabular-nums; color: var(--doux); min-width: 3.2rem; }
.agenda .libre span { color: var(--ok); font-weight: 600; }
.taches { list-style: none; margin: 0; padding: 0; }
.taches li { padding: .4rem 0; }
.taches input:checked + * , .taches label:has(input:checked) { color: var(--doux); text-decoration: line-through; }
.pied { text-align: center; color: var(--doux); font-size: .8rem; padding: 1rem 0 2rem; }

/* Connexion */
.entete-droite {
  display: flex; flex-direction: column; align-items: flex-end;
  justify-content: space-between; gap: 1rem; align-self: stretch;
}
.compte { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.compte-nom { color: var(--doux); }
.se-deconnecter {
  color: var(--texte); text-decoration: none; font-weight: 600;
  border: 1px solid var(--bord); border-radius: 999px; padding: .3rem .8rem; background: var(--carte);
}
.se-deconnecter:hover { border-color: var(--alerte); color: var(--alerte); }
@media (max-width: 640px) {
  .entete-droite { align-items: flex-start; width: 100%; }
  .compte { order: -1; align-self: flex-end; }
}
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.connexion { width: 100%; max-width: 380px; }
.connexion form { display: flex; flex-direction: column; gap: .5rem; }
.connexion h1 { margin: 0; }
.connexion .sous-titre { margin-bottom: .75rem; }
.connexion label { font-size: .9rem; font-weight: 600; margin-top: .25rem; }
.connexion input {
  font: inherit; color: var(--texte); background: var(--fond);
  border: 1px solid var(--bord); border-radius: 8px; padding: .6rem .75rem;
}
.connexion input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.connexion button {
  margin-top: .75rem; font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 8px; padding: .65rem; cursor: pointer;
}
.erreur { margin: 0; color: var(--alerte); font-weight: 600; }

/* E-mails à traiter */
.flash { max-width: 1200px; margin: 1rem auto 0; padding: .6rem 1rem; border-radius: 10px; font-weight: 600; }
.flash-ok { background: color-mix(in srgb, var(--ok) 14%, var(--carte)); color: var(--ok); }
.flash-erreur { background: color-mix(in srgb, var(--alerte) 14%, var(--carte)); color: var(--alerte); }
.petite { font-size: .85rem; font-weight: 500; }
.bouton-principal { background: var(--accent); color: #fff; font-weight: 600; }
.bouton-principal:hover { filter: brightness(1.1); }
button.lien { border: 0; padding: 0; color: var(--doux); text-decoration: underline; background: none; }
button.lien:hover { color: var(--alerte); background: none; }
.mails-outils { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.mails-outils .note { margin: 0; }
.mails li { grid-template-columns: auto 1fr; align-items: start; }
.mail p { margin: .15rem 0; }
.mail-date { float: right; color: var(--doux); font-size: .8rem; }
.mail-sujet { color: var(--texte) !important; font-weight: 500; }
.mail details { margin-top: .4rem; }
.mail summary { cursor: pointer; color: var(--accent); font-size: .9rem; font-weight: 600; }
.mail-reponse { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.mail-reponse textarea {
  font: inherit; font-size: .92rem; color: var(--texte); background: var(--fond);
  border: 1px solid var(--bord); border-radius: 8px; padding: .6rem .75rem; resize: vertical; width: 100%;
}
.mail-boutons { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.mail-boutons a { font-size: .85rem; color: var(--doux); margin-left: auto; }
.mails-deconnexion { margin-top: .75rem; text-align: right; font-size: .8rem; }
