/* The family portal. Phone first; wider screens just get more margin. */

:root {
  --fond: #f6f4ef;
  --carte: #ffffff;
  --texte: #1f2421;
  --doux: #5d6661;
  --ligne: #e2ded5;
  --accent: #2f6f5e;
  --accent-texte: #ffffff;
  --danger: #a8322d;
  --reserve: #2f6f5e;
  --prefere: #b07d12;
  --considerer: #5d6661;
  --ecarte: #9aa19d;
  --rayon: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #171a18;
    --carte: #212522;
    --texte: #ecefec;
    --doux: #a5ada8;
    --ligne: #343a36;
    --accent: #5fb39b;
    --accent-texte: #0f1311;
    --danger: #e0706a;
    --reserve: #5fb39b;
    --prefere: #e0b34f;
    --considerer: #a5ada8;
    --ecarte: #6c746f;
  }
}

* { box-sizing: border-box; }

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

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

a { color: var(--accent); }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0.2rem 0 0.4rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0; }

.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
  background: var(--accent);
  color: var(--accent-texte);
}
.barre a { color: var(--accent-texte); text-decoration: none; }
.marque { font-weight: 700; font-size: 1.15rem; }
.menu { display: flex; align-items: center; gap: 1rem; }

.compte { position: relative; }
.compte summary { cursor: pointer; list-style: none; }
.compte summary::-webkit-details-marker { display: none; }
.compte summary::after { content: " ▾"; }
.compte-menu {
  position: absolute;
  right: 0;
  top: 2rem;
  z-index: 10;
  min-width: 15rem;
  padding: 0.5rem;
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  box-shadow: 0 8px 24px rgb(0 0 0 / 15%);
}
.compte-menu a, .compte-menu .lien {
  display: block;
  width: 100%;
  padding: 0.5rem;
  color: var(--texte);
  text-align: left;
}

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(3rem + env(safe-area-inset-bottom));
}

.entete {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
}
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.fil { margin: 0; font-size: 0.9rem; color: var(--doux); }
.sous { margin: 0.1rem 0 0.4rem; color: var(--doux); }
.acces { font-size: 0.9rem; color: var(--doux); }
.vide { color: var(--doux); font-style: italic; }
.aide { color: var(--doux); font-size: 0.9rem; }

.carte {
  display: block;
  margin: 0.75rem 0;
  padding: 1rem;
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  color: inherit;
}
.etroite { max-width: 26rem; margin: 2rem auto; }
.voyage-carte { text-decoration: none; }
.voyage-carte h2 { color: var(--accent); margin: 0; }
.texte p { margin: 0.4rem 0; }

.onglets {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  margin: 1rem -1rem;
  padding: 0.5rem 1rem;
  background: var(--fond);
  border-bottom: 1px solid var(--ligne);
}
.onglets a {
  flex: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.onglets a:hover, .onglets a:focus { background: var(--ligne); }

.section { scroll-margin-top: 4rem; margin-top: 1.5rem; }

.item-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.item p { margin: 0.25rem 0; }
.item-pied { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem !important; font-size: 0.95rem; }
.statut-ecarte { opacity: 0.6; }

.pastille {
  flex: none;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--carte);
  background: var(--considerer);
}
.pastille.reserve { background: var(--reserve); }
.pastille.prefere { background: var(--prefere); }
.pastille.ecarte { background: var(--ecarte); }

.historique { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.historique li { padding: 0.4rem 0; border-bottom: 1px solid var(--ligne); }
.quand { color: var(--doux); margin-right: 0.4rem; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { padding: 0.75rem 1rem; border-radius: var(--rayon); background: var(--carte); border-left: 4px solid var(--accent); }
.message.error { border-left-color: var(--danger); }
.erreur, .errorlist { color: var(--danger); }
.errorlist { list-style: none; padding: 0; margin: 0.2rem 0; font-size: 0.9rem; }

/* Forms: Django renders each field as a <div> with its label, input, help and errors. */
.formulaire > div { margin-bottom: 0.9rem; }
.formulaire label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.formulaire .helptext, .formulaire [id$="_helptext"] { display: block; color: var(--doux); font-size: 0.85rem; margin-top: 0.2rem; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--ligne);
  border-radius: 8px;
}
input[type="checkbox"] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1rem; }
.bouton {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-texte);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}
.bouton.secondaire { color: var(--accent); background: transparent; border: 1px solid var(--accent); }
.bouton.petit { padding: 0.35rem 0.9rem; font-size: 0.95rem; }
.bouton.danger { background: var(--danger); }
.lien { padding: 0; font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; }

.partage { width: 100%; border-collapse: collapse; }
.partage th, .partage td { padding: 0.5rem 0.25rem; text-align: left; border-bottom: 1px solid var(--ligne); }
.partage select { min-width: 10rem; }

/* Checkboxes: box and label on one line. */
.cases > div { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 0.6rem; }
.cases > div.boutons { flex-direction: row; }
.cases label { font-weight: normal; margin: 0; }
