/* Saisie de chantier sur téléphone. Les couleurs, polices et boutons viennent de app.css ; ici, seulement la mise en page :
   une colonne, de gros boutons utilisables avec des doigts sales ou des gants fins, un contraste fort pour le plein soleil. */

body.terrain {
  --cible: 48px;
  display: block; height: auto; min-height: 100%;
  background: var(--fond);
  font-size: 16px;
  /* Place pour la barre d'envoi fixée en bas, et pour la zone de geste des téléphones sans bouton. */
  padding-bottom: calc(var(--cible) + 2 * var(--espace-3) + env(safe-area-inset-bottom, 0px));
}

/* 16 px au minimum dans les champs : en dessous, l'iPhone agrandit la page à chaque saisie. */
.terrain select, .terrain input[type="text"], .terrain textarea { min-height: var(--cible); padding: 10px 12px; font-size: 16px; }
.terrain textarea { min-height: 96px; font-family: var(--police-texte); }
.terrain button, .terrain .bouton { font-size: 15px; }
.terrain .champ > span, .terrain legend { font-size: 14px; font-weight: 500; color: var(--encre-douce); }

/* ---------- En-tête ---------- */
.t-tete {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: var(--espace-3);
  padding: var(--espace-3) var(--espace-4); padding-top: calc(var(--espace-3) + env(safe-area-inset-top, 0px));
  background: var(--encre); color: #fff;
}
.t-tete .marque-signe { width: 28px; height: 28px; }
.t-titre { flex: 1; min-width: 0; }
.t-titre h1 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.2; }
.t-titre p { margin: 0; font-size: 13px; color: #c9d1da; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-discret { min-height: 40px; border-color: #5d6b7b; background: transparent; color: #fff; font-weight: 500; }
.t-discret:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }
.t-tete :focus-visible { outline-color: #fff; }

/* ---------- Cartes ---------- */
.t-corps { max-width: 620px; margin: 0 auto; padding: var(--espace-3); display: flex; flex-direction: column; gap: var(--espace-3); }
.t-carte {
  display: flex; flex-direction: column; gap: var(--espace-3);
  padding: var(--espace-4); border: 1px solid var(--trait); border-radius: var(--rayon-grand); background: var(--surface);
}
.t-carte h2 { display: flex; align-items: center; gap: var(--espace-2); margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.t-num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--encre); color: #fff; font: 500 13px var(--police-chiffres);
}
.t-duo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--espace-3); }

.t-choix { margin: 0; padding: 0; border: 0; min-width: 0; }
.t-choix legend { padding: 0; margin-bottom: var(--espace-2); }
.t-segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--espace-2); }
.t-puces { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--espace-2); }
.t-segments button, .t-puces button { min-height: var(--cible); padding: 6px 8px; white-space: normal; line-height: 1.2; font-weight: 500; }
.t-segments button[aria-pressed="true"], .t-puces button[aria-pressed="true"] {
  background: var(--encre); border-color: var(--encre); color: #fff; font-weight: 600;
}

/* ---------- Listes de ce qui est saisi ---------- */
.t-liste { margin: 0; padding: 0; list-style: none; }
.t-liste:empty { display: none; }
.t-liste li {
  display: flex; align-items: center; gap: var(--espace-3); min-height: 44px; padding: var(--espace-2) 0;
  border-bottom: 1px solid var(--trait);
}
.t-liste li:first-child { border-top: 1px solid var(--trait); }
.t-liste li > span:last-of-type { flex: 1; min-width: 0; }
.t-cote { flex: none; min-width: 96px; font: 500 15px var(--police-chiffres); color: var(--encre); }
.t-liste .retirer { flex: none; min-height: 44px; width: 44px; font-size: 22px; }
.t-atteint { margin: 0; padding: var(--espace-2) var(--espace-3); border-left: 3px solid var(--bleu); border-radius: 0 var(--rayon) var(--rayon) 0; background: var(--bleu-fond); font-size: 14px; }

/* ---------- Ajouts ---------- */
.t-ajout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--espace-3); align-items: end; }
.t-ajout.trois { grid-template-columns: repeat(3, 1fr); }
.t-ajout button, .t-volet > button { min-height: var(--cible); }
.terrain .lien { align-self: flex-start; min-height: 44px; font-size: 15px; }

.t-volet { border-top: 1px solid var(--trait); }
.t-volet > summary {
  display: flex; align-items: center; min-height: var(--cible); list-style: none; cursor: pointer; font-weight: 600; font-size: 16px;
}
.t-volet > summary::-webkit-details-marker { display: none; }
.t-volet > summary::after {
  content: ""; width: 9px; height: 9px; margin-left: auto; margin-right: var(--espace-1);
  border-right: 2px solid var(--encre-douce); border-bottom: 2px solid var(--encre-douce);
  transform: rotate(45deg); transition: transform var(--normale) var(--sortie);
}
.t-volet[open] > summary::after { transform: rotate(-135deg); }
.t-volet[open] { display: flex; flex-direction: column; gap: var(--espace-3); padding-bottom: var(--espace-3); }

/* ---------- Envoi ---------- */
.t-destinataire { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.t-apercu { border: 1px solid var(--trait); background: #fff; }
.t-apercu svg { display: block; width: 100%; height: auto; }

.t-barre {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: auto 1fr; gap: var(--espace-2);
  padding: var(--espace-3) var(--espace-4); padding-bottom: calc(var(--espace-3) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--trait-fort); background: var(--surface);
}
.t-barre button { min-height: var(--cible); font-size: 16px; }

/* Les messages s'affichent au-dessus de la barre d'envoi. */
.terrain .messages { bottom: calc(var(--cible) + 2 * var(--espace-3) + var(--espace-2) + env(safe-area-inset-bottom, 0px)); }
.terrain .message { font-size: 15px; }
.terrain { scroll-padding-top: 72px; scroll-padding-bottom: 150px; }

@media (max-width: 340px) {
  .t-ajout.trois { grid-template-columns: 1fr 1fr; }
  .t-ajout.trois > :last-child { grid-column: 1 / -1; }
  .t-duo { grid-template-columns: 1fr; }
}
