/* Comptinelle : palette "fin d'apres-midi au parc" (docs/naming-et-marque.md).
   Regles : fond creme partout, pastels en surfaces/pastilles jamais en texte,
   CTA terracotta texte blanc, AUCUN rouge (pire alerte = ambre), corps 17 px mini,
   cibles 56 px primaires / 48 px mini, un seul bouton primaire par ecran,
   ecrans sobres (Mon mois, contrat) sans pastilles decoratives. */

@font-face { font-family: 'Baloo 2'; src: url('fonts/baloo2-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/nunito-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/nunito-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/nunito-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --creme: #FDF6EC;
  --surface: #FFFCF7;
  --cacao: #4A3B32;
  --taupe: #8A7A6E;
  --terracotta: #C75B39;
  --terracotta-fonce: #A94A2D;
  --mimosa: #F6D48E;    /* repas */
  --lavande: #AEB8DC;   /* sieste */
  --rose: #F0BFC5;      /* activites */
  --sauge: #A8C3A0;     /* sorties */
  --sauge-fonce: #5F8A5C; /* validation */
  --ambre: #D9932F;     /* pire alerte */
  --ambre-fond: #FBF0DC;
  --bord: #EFE3D3;
  --rayon: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 17px; }
body {
  margin: 0; background: var(--creme); color: var(--cacao);
  font-family: 'Nunito', system-ui, sans-serif; line-height: 1.45;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif; font-weight: 600; color: var(--cacao); }
h1 { font-size: 1.55rem; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.25rem; margin: 0.8em 0 0.4em; }
h3 { font-size: 1.05rem; margin: 0.6em 0 0.3em; }
p { margin: 0.4em 0; }
small, .discret { color: var(--taupe); font-size: 0.88rem; }

#view { max-width: 560px; margin: 0 auto; padding: 14px 16px 24px; }

/* ---------- barre d'onglets ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--bord);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; min-height: 56px; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--taupe); font-family: inherit; font-size: 0.78rem; font-weight: 600;
  border-radius: 14px; padding: 4px 2px;
}
.tab-icone { font-size: 1.35rem; }
.tab.actif { color: var(--terracotta); background: #FAEDE4; }

/* ---------- boutons ---------- */
.btn {
  display: block; width: 100%; min-height: 56px; padding: 14px 18px;
  border: 0; border-radius: var(--rayon); cursor: pointer;
  font-family: inherit; font-size: 1.05rem; font-weight: 700; margin: 10px 0;
}
.btn-primaire { background: var(--terracotta); color: #fff; }
.btn-primaire:active { background: var(--terracotta-fonce); }
.btn-secondaire { background: var(--surface); color: var(--cacao); border: 1.5px solid var(--bord); }
.btn-discret { background: none; color: var(--taupe); text-decoration: underline; min-height: 48px; font-weight: 600; }
.btn-petit { display: inline-block; width: auto; min-height: 48px; padding: 10px 16px; font-size: 0.95rem; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-sauge { background: var(--sauge-fonce); color: #fff; }

/* ---------- cartes ---------- */
.carte {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 14px 16px; margin: 10px 0;
}
.carte-ambre { background: var(--ambre-fond); border-color: var(--ambre); }
.carte-creme { background: var(--creme); border-color: var(--bord); } /* bloc regularisation : NEUTRE */
.carte-enfant { display: flex; align-items: center; gap: 12px; }
.carte-enfant .infos { flex: 1; min-width: 0; }
.carte-enfant .nom { font-family: 'Baloo 2', sans-serif; font-size: 1.15rem; font-weight: 600; }
.carte-enfant .etat { color: var(--taupe); font-size: 0.92rem; }
.pastille {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  background: var(--creme); border: 1px solid var(--bord);
}
.pastille-present { background: #EAF2E7; border-color: var(--sauge); }
.pastille-parti { background: var(--creme); }
.pastille-absent { background: var(--ambre-fond); border-color: var(--ambre); }
.badge-allergie { display: inline-block; background: var(--ambre-fond); color: var(--cacao); border: 1px solid var(--ambre); border-radius: 10px; padding: 1px 8px; font-size: 0.8rem; margin-left: 6px; }

/* ---------- chips (repas 3, humeurs 4 : jamais d'echelle etoiles) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  min-height: 48px; padding: 10px 14px; border-radius: 24px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--bord);
  font-family: inherit; font-size: 0.98rem; font-weight: 600; color: var(--cacao);
}
.chip.actif { border-color: var(--terracotta); background: #FAEDE4; }
.chip-mimosa.actif { background: var(--mimosa); border-color: var(--mimosa); }
.chip-lavande.actif { background: var(--lavande); border-color: var(--lavande); }
.chip-rose.actif { background: var(--rose); border-color: var(--rose); }
.chip-sauge.actif { background: var(--sauge); border-color: var(--sauge); }

/* ---------- formulaires ---------- */
label.champ { display: block; margin: 14px 0 4px; font-weight: 700; font-size: 0.95rem; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=time],
input[type=number], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; font-family: inherit; font-size: 1.05rem;
  border: 1.5px solid var(--bord); border-radius: 14px; background: var(--surface); color: var(--cacao);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--terracotta); outline-offset: 1px; }
.ligne-2col { display: flex; gap: 10px; }
.ligne-2col > * { flex: 1; }

/* ---------- stepper (semaines, sieste -15/+15) ---------- */
.stepper { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.stepper button {
  width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid var(--bord);
  background: var(--surface); font-size: 1.5rem; font-weight: 700; color: var(--terracotta); cursor: pointer;
}
.stepper .valeur { flex: 1; text-align: center; font-size: 1.3rem; font-weight: 700; }

/* ---------- lignes de calcul (Mon mois : SOBRE, formules repliees) ---------- */
.ligne-calcul { border-bottom: 1px solid var(--bord); padding: 10px 2px; }
.ligne-calcul .entete { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; }
.ligne-calcul .montant { font-weight: 700; white-space: nowrap; }
.ligne-calcul .detail { color: var(--taupe); font-size: 0.88rem; padding: 6px 2px 2px; }
.ligne-calcul .chevron { color: var(--taupe); font-size: 0.8rem; }
.total-ligne { display: flex; justify-content: space-between; padding: 12px 2px; font-weight: 700; font-size: 1.1rem; }
.bloc-pajemploi { border: 2px solid var(--cacao); border-radius: var(--rayon); padding: 14px 16px; margin: 12px 0; background: var(--surface); }
.bloc-pajemploi .champ-copie { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--bord); }
.bloc-pajemploi .champ-copie:last-child { border-bottom: 0; }
.bloc-pajemploi .valeur { font-weight: 700; font-size: 1.15rem; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: calc(88px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; justify-content: center; z-index: 60; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  background: var(--cacao); color: #fff; border-radius: 16px; padding: 12px 18px;
  max-width: 92%; font-size: 0.98rem; box-shadow: 0 6px 24px rgba(74, 59, 50, 0.25);
}
.toast-annuler { background: none; border: 0; color: var(--mimosa); font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; min-height: 44px; }

/* ---------- feuille basse ---------- */
.sheet-fond { position: fixed; inset: 0; background: rgba(74, 59, 50, 0.35); z-index: 70; display: flex; align-items: flex-end; }
.sheet {
  background: var(--surface); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px;
  margin: 0 auto; padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet h3 { margin: 0 0 12px; text-align: center; }
.sheet-btn {
  display: block; width: 100%; min-height: 56px; margin: 8px 0; padding: 14px;
  border: 1.5px solid var(--bord); border-radius: var(--rayon); background: var(--creme);
  font-family: inherit; font-size: 1.05rem; font-weight: 700; color: var(--cacao); cursor: pointer;
}
.sheet-primaire { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.sheet-fermer { background: none; border: 0; color: var(--taupe); font-weight: 600; min-height: 48px; }

/* ---------- divers ---------- */
.entete-page { display: flex; justify-content: space-between; align-items: center; }
.roue { background: none; border: 0; font-size: 1.5rem; cursor: pointer; min-width: 48px; min-height: 48px; }
.etat-vide { text-align: center; padding: 34px 16px; color: var(--taupe); }
.etat-vide .grand { font-size: 3rem; }
.progression { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.progression .point { width: 12px; height: 12px; border-radius: 50%; background: var(--bord); }
.progression .point.actif { background: var(--terracotta); }
.filtre-resultats { position: sticky; top: 0; background: var(--creme); padding: 6px 0; z-index: 10; }
.encadre-securite { background: var(--ambre-fond); border-left: 4px solid var(--ambre); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 0.95rem; }
.segment-nav { display: flex; gap: 6px; margin: 10px 0; }
.segment-nav button {
  flex: 1; min-height: 48px; border: 1.5px solid var(--bord); background: var(--surface);
  border-radius: 14px; font-family: inherit; font-weight: 700; font-size: 0.95rem; color: var(--taupe); cursor: pointer;
}
.segment-nav button.actif { border-color: var(--terracotta); color: var(--terracotta); background: #FAEDE4; }
.liste-simple { list-style: none; padding: 0; margin: 8px 0; }
.liste-simple li { padding: 10px 4px; border-bottom: 1px solid var(--bord); display: flex; justify-content: space-between; align-items: center; gap: 8px; }

@media (prefers-reduced-motion: no-preference) {
  .carte, .sheet { animation: apparait 0.18s ease-out; }
  @keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
