/* Mon Artensia — téléphone d'abord.
 *
 * Trois règles qui ne se négocient pas, parce qu'elles viennent de ce
 * qu'on a déjà raté sur l'intranet :
 *   · JAMAIS de défilement horizontal. Une seule carte trop large et la
 *     page entière glisse sous le doigt ;
 *   · 44 px de haut minimum pour tout ce qui se touche ;
 *   · 16 px de gouttière, partout, y compris sous l'encoche.
 *
 * Aucune police externe : tout ce qui se charge vient de chez nous, et
 * ici rien ne se charge du tout — la pile système suffit et s'affiche
 * sans attendre.
 */

:root {
  --rouge: #C4203A;
  --rouge-sombre: #9c1a2e;
  --fond: #f6f4f1;
  --carte: #ffffff;
  --texte: #22201f;
  --texte-doux: #5d5854;
  --trait: #e3ded8;
  --dore: #b8860b;
  --vert: #1f8a4c;
  --orange: #b26a00;
  --gouttiere: 16px;
  --rayon: 12px;
  --touche: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  /* La page ne glisse JAMAIS latéralement. */
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Place pour la barre du bas + la zone sûre des téléphones à encoche. */
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* `hidden` doit gagner contre `display:flex` des écrans. */
[hidden] { display: none !important; }

#app {
  max-width: 34rem;
  margin: 0 auto;
  padding: var(--gouttiere);
}

.ecran { display: flex; flex-direction: column; gap: var(--gouttiere); }

/* ── En-tête ─────────────────────────────────────────────────────── */
.entete { padding: 8px 0 0; }
.marque {
  color: var(--rouge);
  font-size: 1.6rem;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.bonjour { font-size: 1.45rem; margin: 0; }
.accroche { color: var(--texte-doux); margin: 0; }

/* ── Cartes ──────────────────────────────────────────────────────── */
.carte {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: var(--gouttiere);
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Une carte ne dépasse jamais, même avec un mot très long dedans. */
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* ── Champs ──────────────────────────────────────────────────────── */
.champ { display: flex; flex-direction: column; gap: 6px; }
.etiquette { font-weight: 600; font-size: 0.95rem; }

input[type="tel"], input[type="text"] {
  min-height: var(--touche);
  padding: 10px 12px;
  font-size: 1.05rem;         /* 16 px minimum : en dessous, iOS zoome */
  border: 1px solid var(--trait);
  border-radius: 8px;
  background: #fff;
  color: var(--texte);
  width: 100%;
}
input:focus-visible {
  outline: 3px solid rgba(196, 32, 58, 0.35);
  outline-offset: 1px;
  border-color: var(--rouge);
}

#champ-code {
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  text-align: center;
}

.groupe { border: 0; padding: 0; margin: 0; display: flex;
          flex-direction: column; gap: 8px; }
.groupe legend { padding: 0; margin-bottom: 4px; }

.choix {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: var(--touche);
  padding: 8px 0;
  cursor: pointer;
}
.choix input { width: 22px; height: 22px; margin-top: 2px; flex: none;
               accent-color: var(--rouge); }
.consentement { font-size: 0.95rem; }
.consentement a { color: var(--rouge); }

/* ── Boutons ─────────────────────────────────────────────────────── */
.bouton {
  min-height: var(--touche);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 1.02rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
}
.bouton.principal { background: var(--rouge); color: #fff; }
.bouton.principal:active { background: var(--rouge-sombre); }
.bouton.principal[disabled] { opacity: 0.55; cursor: progress; }
.bouton.discret {
  background: transparent;
  color: var(--texte-doux);
  border-color: var(--trait);
}

/* ── Messages ────────────────────────────────────────────────────── */
.aide { color: var(--texte-doux); font-size: 0.95rem; margin: 0; }
.erreur {
  color: #8a1020;
  background: #fdeaed;
  border: 1px solid #f3c2ca;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  font-size: 0.95rem;
}

.bandeau-equipe {
  background: #fff4e0;
  border: 1px solid #f0d7a8;
  color: var(--orange);
  border-radius: var(--rayon);
  padding: 10px 12px;
  margin: 0;
  font-size: 0.93rem;
}

/* ── Barre du bas ────────────────────────────────────────────────── */
.barre-bas {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--carte);
  border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.onglet {
  flex: 1;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: var(--texte-doux);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.onglet.actif { color: var(--rouge); box-shadow: inset 0 2px 0 var(--rouge); }

/* Le thème sombre du téléphone ne doit pas rendre le texte illisible :
   on garde un fond clair, choisi, plutôt qu'un fond hérité. */
@media (prefers-color-scheme: dark) {
  :root { --fond: #f6f4f1; --carte: #ffffff; --texte: #22201f; }
}

/* ── Cartes de contrat ───────────────────────────────────────────── */
.liste-contrats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gouttiere);
}
.contrat {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: var(--gouttiere);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.contrat-titre {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 1.1rem;
}
.contrat-produit { font-weight: 600; }
.contrat-prime { color: var(--vert); font-weight: 600; white-space: nowrap; }
.contrat-ligne { margin: 2px 0; font-size: 0.95rem; color: var(--texte-doux); }
/* Une valeur absente se dit, elle ne s'invente pas. */
.contrat-ligne.absent { font-style: italic; opacity: .8; }
