/* TwinAgri — interface de terrain : lisible en plein soleil, gros boutons, vert profond + jaune Twin. */
:root {
  --foret: #0F3B2C; --vert: #1F7A4D; --vert-clair: #E3F1E8; --pousse: #8BC34A;
  --jaune: #FACC08; --bleu: #0142A7; --sable: #F5F1E6; --carte: #FFFFFF;
  --texte: #17221D; --texte-2: #5D6B63; --ligne: #E2DDCF; --rouge: #C62828; --ambre: #B26A00;
  --rayon: 18px; --ombre: 0 1px 2px rgba(15, 59, 44, .06), 0 6px 18px rgba(15, 59, 44, .07);
  --bas: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--sable); color: var(--texte); font-size: 16px; line-height: 1.45; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--vert); }
[hidden] { display: none !important; }

/* Barre du haut */
.barre { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--foret); color: #fff; }
.barre h1 { flex: 1; font-size: 19px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: rgba(255,255,255,.08); color: #fff; font-size: 22px; text-decoration: none; position: relative; cursor: pointer; }
.synchro span { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--jaune); color: var(--foret); font-size: 12px; font-weight: 800; display: grid; place-items: center; }

main { max-width: 720px; margin: 0 auto; padding: 14px 14px calc(100px + var(--bas)); }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); margin: 22px 0 10px; }
.sous { color: var(--texte-2); font-size: 14px; }
.vide { color: var(--texte-2); text-align: center; padding: 28px 12px; list-style: none; }
.carte { background: var(--carte); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); margin-bottom: 12px; }

/* Boutons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; padding: 14px 18px; border: 0; border-radius: 16px; font-weight: 750; font-size: 16px; text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s; margin-top: 10px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn.principal { background: var(--vert); color: #fff; box-shadow: 0 6px 14px rgba(31, 122, 77, .28); }
.btn.secondaire { background: var(--carte); color: var(--foret); border: 1.5px solid var(--ligne); }
.btn.fin { background: var(--jaune); color: var(--foret); }
.btn.petit { width: auto; min-height: 38px; padding: 8px 14px; margin: 0; font-size: 14px; background: var(--vert-clair); color: var(--foret); }
.fab { position: fixed; right: 18px; bottom: calc(86px + var(--bas)); z-index: 25; width: 62px; height: 62px; border-radius: 22px; border: 0; background: var(--jaune); color: var(--foret); font-size: 30px; font-weight: 800; box-shadow: 0 10px 24px rgba(15, 59, 44, .3); cursor: pointer; }

/* Onglets du bas */
.onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--carte); border-top: 1px solid var(--ligne); padding: 6px 4px calc(6px + var(--bas)); }
.onglets a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; font-weight: 650; color: var(--texte-2); text-decoration: none; border-radius: 12px; }
.onglets a span { font-size: 21px; line-height: 1.1; filter: grayscale(.6); }
.onglets a.actif { color: var(--foret); background: var(--vert-clair); }
.onglets a.actif span { filter: none; }

/* Connexion */
.connexion { text-align: center; padding-top: 24px; }
.connexion .logo { width: 84px; height: 84px; border-radius: 24px; box-shadow: var(--ombre); }
.connexion h1 { font-size: 34px; letter-spacing: -.03em; margin-top: 12px; color: var(--foret); }
.connexion h1 span { color: var(--vert); }
.connexion form { text-align: left; margin-top: 22px; }
.connexion label, .champ label, .champ .label { display: block; font-size: 14px; font-weight: 650; color: var(--texte-2); margin: 12px 0 6px; }
input, select, textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--ligne); border-radius: 14px; background: #FCFBF7; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--vert); box-shadow: 0 0 0 3px rgba(31,122,77,.15); }
.pied { color: var(--texte-2); font-size: 13px; margin-top: 26px; }

/* Accueil */
.bandeau-accueil { background: radial-gradient(120% 140% at 100% 0%, #2E8B57 0%, var(--foret) 60%); color: #fff; border-radius: 24px; padding: 18px; margin: 0 -2px 12px; box-shadow: var(--ombre); position: relative; overflow: hidden; }
.bandeau-accueil::after { content: ""; position: absolute; inset: auto -30px -50px auto; width: 180px; height: 180px; border-radius: 50%; background: repeating-linear-gradient(115deg, rgba(139,195,74,.18) 0 6px, transparent 6px 14px); }
.bonjour { font-size: 17px; font-weight: 650; opacity: .92; }
.chiffres { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin-top: 14px; position: relative; z-index: 1; }
.chiffre { display: flex; flex-direction: column; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 12px; color: inherit; text-decoration: none; }
.chiffre.grand { grid-row: span 2; justify-content: center; background: var(--jaune); color: var(--foret); border: 0; }
.chiffre b { font-size: 26px; line-height: 1.05; letter-spacing: -.02em; }
.chiffre.grand b { font-size: 44px; }
.chiffre span { font-size: 13px; opacity: .85; }
.chiffre small { font-size: 12px; font-weight: 650; margin-top: 4px; }
.chiffres.petits { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
.chiffres.petits .chiffre { background: var(--carte); border-color: var(--ligne); box-shadow: var(--ombre); color: var(--texte); }
.chiffres.petits .chiffre b { color: var(--foret); }
.etat-synchro { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; background: var(--carte); border-radius: 16px; padding: 12px 14px; text-decoration: none; color: var(--texte); box-shadow: var(--ombre); font-weight: 650; }
.etat-synchro small { grid-column: 2; color: var(--texte-2); font-weight: 400; font-size: 13px; }
.etat-synchro .point { grid-row: span 2; width: 12px; height: 12px; border-radius: 50%; background: var(--vert); box-shadow: 0 0 0 4px var(--vert-clair); }
.etat-synchro.attente .point { background: var(--jaune); box-shadow: 0 0 0 4px #FFF5C2; }
.raccourcis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.raccourci { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 14px 8px; background: var(--carte); border-radius: 18px; box-shadow: var(--ombre); color: var(--texte); text-decoration: none; font-size: 13px; font-weight: 650; }
.raccourci span { font-size: 28px; }

/* Listes */
.liste { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.liste a { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--carte); border-radius: 16px; padding: 14px; text-decoration: none; color: var(--texte); box-shadow: var(--ombre); font-weight: 600; }
.liste a small { color: var(--texte-2); font-weight: 400; white-space: nowrap; }
.liste .producteur { justify-content: flex-start; }
.producteur .infos { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.producteur .infos b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.producteur .infos small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compte { font-size: 14px; color: var(--texte-2); }
.nuage { color: var(--ambre); font-weight: 800; }
.avatar { flex: none; width: 46px; height: 46px; border-radius: 15px; object-fit: cover; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--vert); }
.avatar.f { background: #8E44AD; }
.recherche input { border-radius: 16px; background: var(--carte); box-shadow: var(--ombre); border-color: transparent; }

/* Fiches */
.fiche-tete { display: flex; gap: 14px; align-items: center; margin: 4px 0 12px; }
.fiche-tete .avatar { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
.fiche-tete h1 { font-size: 23px; letter-spacing: -.02em; line-height: 1.15; }
.pastilles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.pastilles span { background: var(--carte); border: 1px solid var(--ligne); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.pastilles .alerte-pastille { background: #FDECEA; border-color: #F5C2BC; color: var(--rouge); }
.titre-section { display: flex; align-items: center; justify-content: space-between; }
.mini-carte { height: 190px; border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); margin-bottom: 12px; background: var(--vert-clair); }

/* Formulaires */
.formulaire .carte { padding-top: 6px; }
.champ { margin-bottom: 4px; }
.saisie { display: flex; align-items: center; }
.saisie .suffixe { margin-left: -64px; width: 60px; text-align: right; padding-right: 12px; color: var(--texte-2); font-size: 14px; pointer-events: none; }
.saisie input { padding-right: 70px; }
.aide { color: var(--texte-2); font-size: 13px; }
.requis { color: var(--rouge); }
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--sable); padding: 5px; border-radius: 14px; }
.segments button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; color: var(--texte-2); cursor: pointer; }
.segments button.actif { background: var(--carte); color: var(--foret); box-shadow: var(--ombre); }
.coche { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--ligne); font-size: 15px; cursor: pointer; }
.coche:last-child { border-bottom: 0; }
.coche input { width: 24px; min-height: 24px; height: 24px; accent-color: var(--vert); flex: none; }
.photo-prod { display: grid; place-items: center; width: 112px; height: 112px; margin: 6px auto 14px; border-radius: 32px; background: var(--carte); border: 2px dashed var(--ligne); overflow: hidden; cursor: pointer; text-align: center; color: var(--texte-2); font-weight: 650; }
.photo-prod img { width: 100%; height: 100%; object-fit: cover; }
.localite { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; }
.selecteur { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 62px; padding: 10px 12px; border: 1.5px solid var(--ligne); border-radius: 14px; background: #FCFBF7; cursor: pointer; }
.selecteur small { color: var(--texte-2); font-size: 12px; font-weight: 650; }
.selecteur b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gps { display: flex; flex-direction: column; gap: 6px; }
.gps p { font-family: ui-monospace, Consolas, monospace; font-size: 14px; margin-top: 6px; }
.alerte { background: #FDECEA; color: var(--rouge); border-radius: 12px; padding: 12px; font-size: 14px; margin-top: 10px; }
.info { background: var(--vert-clair); color: var(--foret); border-radius: 12px; padding: 12px; font-size: 14px; margin-top: 10px; }
.bilan { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.bilan li { display: flex; justify-content: space-between; background: var(--sable); border-radius: 12px; padding: 10px 12px; }

/* Feuille de choix */
.feuille-fond { position: fixed; inset: 0; z-index: 60; background: rgba(15, 59, 44, .45); display: flex; align-items: flex-end; }
.feuille { width: 100%; max-width: 720px; margin: 0 auto; height: 82vh; background: var(--carte); border-radius: 24px 24px 0 0; display: flex; flex-direction: column; animation: monte .2s ease-out; }
@keyframes monte { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.feuille header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--vert); color: #fff; border-radius: 24px 24px 0 0; }
.feuille input { margin: 12px; width: auto; }
.choix { list-style: none; overflow-y: auto; flex: 1; padding: 0 8px calc(12px + var(--bas)); }
.choix button { width: 100%; text-align: left; padding: 14px 10px; border: 0; border-bottom: 1px solid var(--ligne); background: none; font-size: 16px; cursor: pointer; }

/* Activités */
.activites-grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.activites-grille a { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px 6px; background: var(--carte); border-radius: 16px; box-shadow: var(--ombre); text-decoration: none; color: var(--texte); font-size: 12.5px; font-weight: 650; }
.activites-grille a span { font-size: 26px; }
.activite-tete { display: flex; align-items: center; gap: 12px; margin: 6px 0 12px; }
.activite-tete span { font-size: 40px; }
.frise { list-style: none; position: relative; padding-left: 4px; }
.frise li { display: flex; gap: 12px; padding: 10px 0; }
.frise li:not(.vide)::before { content: ""; position: absolute; left: 23px; top: 0; bottom: 0; width: 2px; background: var(--ligne); z-index: 0; }
.frise .puce { position: relative; z-index: 1; flex: none; width: 40px; height: 40px; border-radius: 13px; background: var(--carte); box-shadow: var(--ombre); display: grid; place-items: center; font-size: 20px; }
.frise small { display: block; color: var(--texte-2); }
.frise p { font-size: 14px; }

/* Cartes */
.grande-carte { height: calc(100vh - 210px); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre); background: var(--vert-clair); }
.legende { display: flex; gap: 14px; justify-content: center; margin-top: 10px; font-size: 14px; font-weight: 600; }
.legende i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.point-jaune { border-radius: 50%; background: var(--jaune); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ligne); }
.carre-vert { background: rgba(31,122,77,.4); border: 2px solid var(--vert); }

/* Mesure en marchant */
.mesure { position: relative; margin: -14px -14px 0; }
.carte-mesure { height: calc(100vh - 64px); background: #DDE7DF; }
.mesure-haut { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 500; display: flex; gap: 10px; }
.surface-live { background: var(--foret); color: #fff; border-radius: 18px; padding: 10px 16px; box-shadow: var(--ombre); display: flex; align-items: baseline; gap: 6px; }
.surface-live b { font-size: 34px; letter-spacing: -.02em; }
.infos-live { flex: 1; background: rgba(255,255,255,.95); border-radius: 18px; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; font-size: 13px; font-weight: 650; box-shadow: var(--ombre); }
.infos-live .bon { color: var(--vert); } .infos-live .faible { color: var(--ambre); }
.consigne { position: absolute; left: 12px; right: 12px; bottom: calc(150px + var(--bas)); z-index: 500; background: rgba(255,255,255,.95); border-radius: 14px; padding: 10px 12px; font-size: 14px; box-shadow: var(--ombre); }
.mesure-bas { position: absolute; left: 12px; right: 12px; bottom: calc(14px + var(--bas)); z-index: 500; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mesure-bas .btn { margin: 0; }
.mesure-bas #m-demarrer { grid-column: span 2; }

/* Messages */
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--bas)); transform: translateX(-50%); z-index: 90; background: var(--foret); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 650; box-shadow: var(--ombre); transition: opacity .4s; max-width: 90vw; }
.toast.erreur { background: var(--rouge); }
.toast.part { opacity: 0; }

@media (min-width: 720px) { .chiffres { grid-template-columns: 1.3fr 1fr 1fr 1fr; } .chiffre.grand { grid-row: auto; } }
