/* Ménage Mail — apparence. Couleurs en jetons, thème sombre automatique. */

:root {
  --fond: #f5f6f2;
  --carte: #ffffff;
  --texte: #1c2420;
  --doux: #5a655e;
  --ligne: #dde2da;
  --accent: #1f6f50;
  --accent-texte: #ffffff;
  --accent-doux: #e2f0e8;
  --alerte: #9a3324;
  --alerte-doux: #fbe9e5;
  --ombre: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 14px rgb(0 0 0 / 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #111513;
    --carte: #1a201d;
    --texte: #edf2ee;
    --doux: #a3aea7;
    --ligne: #2b3430;
    --accent: #62c597;
    --accent-texte: #0c1a13;
    --accent-doux: #1c3127;
    --alerte: #f2a493;
    --alerte-doux: #3a211c;
    --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.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 0.3rem; }
p { margin: 0.4rem 0 0.8rem; }
a { color: var(--accent); }

.doux { color: var(--doux); }
.petit { font-size: 0.9rem; }
.grand { font-size: 1.35rem; font-weight: 650; margin: 0.2rem 0; }

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

button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.principal {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-texte);
  font-weight: 650;
  font-size: 1.05rem;
}
.secondaire {
  min-height: 46px;
  padding: 0.5rem 1rem;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}
.lien {
  min-height: 40px;
  padding: 0.3rem 0.2rem;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.retour {
  min-height: 44px;
  margin: 0.2rem 0 0;
  padding: 0.3rem 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Mise en page ---------- */

.centre { display: grid; place-items: center; min-height: 60vh; padding: 1rem; text-align: center; }
.attente { color: var(--doux); font-size: 1.1rem; }

.bandeau {
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--accent-doux);
  font-size: 0.95rem;
  text-align: center;
}

.haut {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 0.9rem 1rem 0.3rem;
}
.marque { font-weight: 750; font-size: 1.15rem; }
.compte { color: var(--doux); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.onglets {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.4rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  background: var(--fond);
  border-bottom: 1px solid var(--ligne);
}
.onglets button {
  flex: 1;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--doux);
  font-weight: 600;
}
.onglets button[aria-current="page"] { background: var(--accent-doux); color: var(--texte); }

.contenu { max-width: 760px; margin: 0 auto; padding: 0.6rem 1rem 2rem; }

/* ---------- Connexion ---------- */

.connexion { max-width: 520px; margin: 0 auto; padding: 3rem 1rem 2rem; }
.connexion h1 { font-size: 2rem; }
.connexion .intro { font-size: 1.2rem; }
.connexion .principal { margin: 1.4rem 0 0.8rem; }
.connexion .note { text-align: center; color: var(--doux); font-size: 0.95rem; }
.points { padding-left: 1.2rem; }
.points li { margin: 0.4rem 0; }
.alerte {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--alerte-doux);
  color: var(--alerte);
  font-weight: 600;
}

/* ---------- Ménage : cartes ---------- */

.resume { margin: 0.6rem 0 1rem; }

.cartes { display: grid; gap: 0.8rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cartes { grid-template-columns: 1fr 1fr; } }

.carte {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--ligne);
  border-radius: 16px;
  background: var(--carte);
  box-shadow: var(--ombre);
}
.carte p { color: var(--doux); margin: 0 0 0.8rem; flex: 1; }
.carte.vide { opacity: 0.65; box-shadow: none; }
.carte-bas { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.nombre { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Listes d'expéditeurs ---------- */

.outils { display: flex; gap: 1rem; margin: 0.2rem 0 0.4rem; }

.expediteurs { list-style: none; margin: 0 0 1rem; padding: 0; border: 1px solid var(--ligne); border-radius: 16px; background: var(--carte); overflow: hidden; }
.expediteurs li { padding: 0.6rem 0.9rem 0.4rem; border-top: 1px solid var(--ligne); }
.expediteurs li:first-child { border-top: 0; }
.expediteurs label { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 0.8rem; cursor: pointer; }
.expediteurs input[type="checkbox"] { width: 24px; height: 24px; margin: 0.15rem 0 0; accent-color: var(--accent); }
.qui { display: flex; flex-direction: column; min-width: 0; }
.nom { font-weight: 650; overflow-wrap: anywhere; }
.adresse, .sujet { color: var(--doux); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combien { font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 0.1rem; }
.expediteurs li .lien { margin-left: calc(24px + 0.8rem); font-size: 0.9rem; }
.expediteurs li.decoche .qui, .expediteurs li.decoche .combien { opacity: 0.55; }
.expediteurs li.impossible { opacity: 0.7; }
.expediteurs li.impossible label { cursor: default; }
.resultat { font-size: 0.9rem; font-weight: 650; }
.resultat.ok { color: var(--accent); }
.resultat.ko { color: var(--alerte); }

.impossibles { margin: 0 0 1rem; }
.impossibles summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; }

.option { display: flex; align-items: center; gap: 0.7rem; min-height: 48px; margin: 0 0 0.6rem; cursor: pointer; }
.option input { width: 24px; height: 24px; accent-color: var(--accent); }

.barre-action {
  position: sticky;
  bottom: 0;
  margin: 0 -1rem;
  padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--fond) 25%);
}

/* ---------- Explication ---------- */

.etapes { padding-left: 1.4rem; font-size: 1.1rem; }
.etapes li { margin: 0.8rem 0; padding-left: 0.3rem; }

/* ---------- Réglages ---------- */

.bloc { margin: 1.2rem 0 1.8rem; }
.bloc > .secondaire { width: 100%; margin: 0 0 0.6rem; }
.ajout { display: flex; gap: 0.6rem; margin: 0.6rem 0; }
.ajout input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0.5rem 0.8rem;
  border: 2px solid var(--ligne);
  border-radius: 12px;
  background: var(--carte);
  color: var(--texte);
  font: inherit;
}
.pastilles { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0.6rem 0; padding: 0; }
.pastilles li { display: flex; align-items: center; gap: 0.3rem; padding: 0 0.3rem 0 0.8rem; border: 1px solid var(--ligne); border-radius: 999px; background: var(--carte); }
.pastilles .lien { font-size: 0.85rem; min-height: 36px; }
.historique { list-style: none; margin: 0; padding: 0; }
.historique li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--ligne); }

/* ---------- Fenêtres et bulle ---------- */

.voile {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(0 0 0 / 0.45);
}
.fenetre {
  width: min(460px, 100%);
  padding: 1.3rem;
  border-radius: 18px;
  background: var(--carte);
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.25);
}
.fenetre progress { width: 100%; height: 14px; accent-color: var(--accent); }
.boutons { display: flex; gap: 0.6rem; margin-top: 1rem; }
.boutons > * { flex: 1; }
.boutons .principal { width: auto; min-height: 48px; font-size: 1rem; }

#bulle {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(520px, calc(100% - 2rem));
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  background: var(--texte);
  color: var(--fond);
  font-weight: 600;
  transform: translate(-50%, 150%);
  transition: transform 0.25s ease;
}
#bulle.visible { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { #bulle { transition: none; } }
