/* Nans Invernizzi — Gestion. Pensé d'abord pour le téléphone, en plein air :
   gros textes, gros boutons (48 px mini), contrastes forts, une colonne. */

:root {
	--vert: #2f5d3a;
	--vert-f: #224629;
	--vert-c: #e6efe2;
	--mousse: #8aa67b;
	--fond: #f4f1ea;
	--carte: #ffffff;
	--encre: #1f2a1f;
	--gris: #5f6b5c;
	--trait: #ddd8cb;
	--ok: #2e7d32;
	--ok-c: #e3f2e4;
	--warn: #b26a00;
	--warn-c: #fff3dc;
	--err: #b3261e;
	--err-c: #fde8e6;
	--bleu: #1f5f99;
	--bleu-c: #e3eef8;
	--violet: #6a3d9a;
	--violet-c: #efe7f7;
	--r: 14px;
	--tab-h: 66px;
	--safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--fond);
	color: var(--encre);
	font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}
a { color: var(--vert); }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; font-weight: 700; }
h2 small { font-weight: 500; color: var(--gris); font-size: .85rem; margin-left: .3em; }
p { margin: .4em 0; }
[hidden] { display: none !important; }
.gi { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em; }

/* ---------- Coquille ---------- */
.g-top {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; justify-content: space-between;
	padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
	background: var(--vert); color: #fff;
}
.g-top__brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.02rem; min-width: 0; }
.g-top__brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-top__brand img { background: #fff; border-radius: 8px; padding: 2px; }
.g-top__gear { color: #fff; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.g-top__gear .gi { width: 26px; height: 26px; }
.g-top__gear[aria-current] { background: rgba(255,255,255,.18); }

.g-content { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + var(--safe-b) + 28px); }

.g-tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
	display: grid; grid-template-columns: repeat(4, 1fr);
	height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
	background: #fff; border-top: 1px solid var(--trait);
	box-shadow: 0 -4px 18px rgba(0,0,0,.06);
}
.g-tabbar a {
	position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
	color: var(--gris); text-decoration: none; font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.1; padding: 0 2px;
}
.g-tabbar .gi { width: 27px; height: 27px; }
.g-tabbar a[aria-current] { color: var(--vert); }
.g-tabbar a[aria-current]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--vert); }
.g-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--err); color: #fff; font-size: .7rem; font-weight: 700; }
.g-tabbar .g-count { position: absolute; top: 6px; left: calc(50% + 6px); }

/* ---------- Messages ---------- */
.g-flash { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.g-flash:not(:empty) { padding-top: 12px; }
.g-msg { padding: 12px 14px; border-radius: 10px; background: var(--vert-c); color: var(--vert-f); font-weight: 600; margin: 0 0 8px; }
.g-msg--ok { background: var(--ok-c); color: var(--ok); }
.g-msg--err { background: var(--err-c); color: var(--err); }
.g-msg--warn { background: var(--warn-c); color: var(--warn); }
.g-red { color: var(--err); font-weight: 600; }

/* ---------- Titres d'écran ---------- */
.g-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.g-head > div { min-width: 0; }
.g-back { display: inline-block; color: var(--gris); text-decoration: none; font-size: .95rem; padding: 4px 0 6px; }
.g-sub { color: var(--gris); margin: .3em 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.g-hint { color: var(--gris); font-size: .9rem; }
.g-empty { color: var(--gris); text-align: center; padding: 18px 8px; background: rgba(255,255,255,.5); border-radius: var(--r); border: 1px dashed var(--trait); }
.g-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; padding: 10px 0; }
.g-note { background: var(--warn-c); border-radius: 10px; padding: 10px 12px; }
.g-pre { white-space: normal; }
.g-label { font-weight: 700; margin: 0 0 8px; }
.g-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }

/* ---------- Boutons ---------- */
.g-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 10px 16px;
	border: 1.5px solid var(--trait); border-radius: 12px; background: #fff; color: var(--encre);
	font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; text-align: center; line-height: 1.15;
	-webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.g-btn:active { transform: translateY(1px); }
.g-btn--primary { background: var(--vert); border-color: var(--vert); color: #fff; }
.g-btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.g-btn--danger { color: var(--err); border-color: #f0c9c5; }
.g-btn--sm { min-height: 42px; padding: 8px 12px; font-size: .92rem; }
.g-btn--block { display: flex; width: 100%; }
.g-btn--big { min-height: 58px; font-size: 1.08rem; border-radius: 14px; }
.g-btn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.g-btn-grid--2 { grid-template-columns: 1fr 1fr; }
.g-btn-grid form { display: contents; }
.g-btn-grid form .g-btn { width: 100%; }
.g-icon-btn { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--gris); cursor: pointer; }
.g-round { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--vert-c); color: var(--vert); }
form { margin: 0; }

/* ---------- Accueil ---------- */
.g-hello { margin: 2px 0 14px; }
.g-hello p { color: var(--gris); margin: 2px 0 0; }
.g-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.g-quick__btn {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	min-height: 92px; padding: 10px 6px; border-radius: var(--r); background: var(--vert); color: #fff;
	text-decoration: none; font-weight: 650; font-size: .88rem; text-align: center; line-height: 1.15;
}
.g-quick__btn .gi { width: 30px; height: 30px; }
.g-section { margin: 0 0 22px; }
.g-section > h2 { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.g-section--alert > h2 { color: var(--warn); }
.g-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--r); background: #fff; border: 1px solid var(--trait); text-decoration: none; color: var(--encre); }
.g-tile strong { font-size: 1.35rem; font-weight: 800; }
.g-tile span { color: var(--gris); font-size: .88rem; line-height: 1.25; }
.g-tile--warn { border-color: #f1d29a; background: var(--warn-c); }
.g-tile--warn strong { color: var(--warn); }

/* ---------- Carte d'intervention ---------- */
.g-int { background: #fff; border: 1px solid var(--trait); border-left: 6px solid var(--vert); border-radius: var(--r); margin-bottom: 10px; overflow: hidden; }
.g-int__main { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; color: inherit; text-decoration: none; }
.g-int__quand { font-size: .85rem; font-weight: 700; color: var(--vert); text-transform: uppercase; letter-spacing: .03em; }
.g-int__qui { font-size: 1.1rem; }
.g-int__quoi { color: var(--encre); }
.g-int__ou { color: var(--gris); font-size: .92rem; }
.g-int__st { margin-top: 4px; }
.g-int__btns { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 12px; }
.g-int__btns > * { flex: 1 1 auto; }
.g-int__btns form .g-btn { width: 100%; }
.g-int--fait { border-left-color: var(--ok); }
.g-int--fait .g-int__quand { color: var(--ok); }
.g-int--annule { border-left-color: var(--trait); opacity: .6; }
.g-int--a_planifier { border-left-color: var(--warn); }
.g-int--visite { border-left-color: var(--bleu); }
.g-int--abattage { border-left-color: #8d5a2b; }
.g-int--tonte, .g-int--entretien, .g-int--taille, .g-int--debroussaillage { border-left-color: var(--mousse); }

/* ---------- Planning ---------- */
.g-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r); background: var(--warn-c); color: var(--warn); font-weight: 600; text-decoration: none; }
.g-banner span { flex: 1; }
.g-week { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.g-week__nav { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 50%; background: #fff; border: 1px solid var(--trait); color: var(--vert); }
.g-week__nav .gi { width: 26px; height: 26px; }
.g-week__label { flex: 1; text-align: center; display: flex; flex-direction: column; line-height: 1.25; }
.g-week__label span { color: var(--gris); font-size: .9rem; }
.g-week__label a { font-size: .85rem; font-weight: 600; }
.g-day { margin-bottom: 14px; }
.g-day__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 6px; border-bottom: 2px solid var(--trait); margin-bottom: 8px; }
.g-day__head h2 em { font-style: normal; font-size: .75rem; font-weight: 700; color: #fff; background: var(--vert); padding: 2px 8px; border-radius: 10px; margin-left: 6px; vertical-align: 2px; }
.g-day.is-today .g-day__head { border-bottom-color: var(--vert); }
.g-day.is-past { opacity: .7; }
.g-day__add { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--vert); background: var(--vert-c); }
.g-day__free { color: var(--gris); font-size: .92rem; margin: 0 0 4px; padding-left: 4px; }
.g-plan-item { margin-bottom: 18px; }
.g-plan-item__age { color: var(--gris); font-size: .85rem; margin: -4px 0 6px 4px; }

/* ---------- Formulaires ---------- */
.g-form { display: block; }
.g-card { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.g-card > h2 { margin-bottom: 10px; }
.g-card--accent { border: 2px solid var(--vert); background: #fbfdf9; }
.g-card--soft { background: var(--vert-c); border-color: transparent; }
.g-field { display: flex; flex-direction: column; gap: 6px; font-weight: 650; margin-bottom: 14px; font-size: .95rem; }
.g-field:last-child { margin-bottom: 0; }
input, select, textarea {
	font: inherit; font-size: 17px; /* ≥ 16 px : pas de zoom automatique sur iPhone */
	width: 100%; min-height: 50px; padding: 11px 13px;
	border: 1.5px solid var(--trait); border-radius: 11px; background: #fff; color: var(--encre);
}
textarea { min-height: 0; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--vert); box-shadow: 0 0 0 3px rgba(47,93,58,.18); }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; min-height: 0; padding: 0; accent-color: var(--vert); flex: none; }
.g-check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; cursor: pointer; }
.g-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-row .g-field { margin-bottom: 14px; }
.g-row--cp { grid-template-columns: 110px 1fr; }
.g-row--3 { grid-template-columns: 1fr 1fr 1fr; }
.g-bar { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); display: grid; gap: 10px; padding: 14px 0 10px; z-index: 5; background: linear-gradient(to bottom, rgba(244,241,234,0), var(--fond) 14px); }
.g-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }

/* Puces de choix (radios en gros boutons) */
.g-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.g-chips--2, .g-chips--3 { display: grid; grid-template-columns: 1fr 1fr; }
.g-chips--3 { grid-template-columns: 1fr 1fr 1fr; }
.g-chip { position: relative; cursor: pointer; }
.g-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.g-chip span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 14px; border: 1.5px solid var(--trait); border-radius: 24px; background: #fff; font-weight: 600; font-size: .95rem; text-align: center; line-height: 1.15; }
.g-chip input:checked + span { background: var(--vert); border-color: var(--vert); color: #fff; }
.g-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(47,93,58,.3); }

/* ---------- Listes ---------- */
.g-search { position: relative; margin-bottom: 12px; }
.g-search .gi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gris); }
.g-search input { padding-left: 44px; border-radius: 26px; min-height: 52px; }
.g-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--trait); border-radius: var(--r); overflow: hidden; }
.g-list:empty { display: none; }
.g-list li { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 0; border-bottom: 1px solid var(--trait); }
.g-list li:last-child { border-bottom: 0; }
.g-list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 13px 14px; color: inherit; text-decoration: none; }
.g-list__main span { color: var(--gris); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-list__amount { font-weight: 750; white-space: nowrap; }
.g-row-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; margin-bottom: 8px; background: #fff; border: 1px solid var(--trait); border-radius: 12px; color: inherit; text-decoration: none; }
.g-row-link span:first-child { display: flex; flex-direction: column; min-width: 0; }
.g-row-link small { color: var(--gris); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-form--inline { display: grid; gap: 8px; margin-bottom: 10px; }
.g-histo { list-style: none; margin: 0; padding: 0; }
.g-histo li { padding: 9px 0 9px 14px; border-left: 3px solid var(--trait); margin-left: 4px; font-size: .95rem; }
.g-histo time { display: block; font-size: .78rem; color: var(--gris); font-weight: 600; }
.g-histo--planning { border-left-color: var(--mousse) !important; }
.g-histo--doc { border-left-color: var(--bleu) !important; }

/* Onglets */
.g-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #e7e3d8; border-radius: 14px; margin-bottom: 10px; }
.g-seg a { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border-radius: 11px; text-decoration: none; color: var(--gris); font-weight: 700; }
.g-seg a[aria-current] { background: #fff; color: var(--vert); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.g-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.g-tabs a { flex: none; padding: 8px 14px; min-height: 40px; display: flex; align-items: center; border-radius: 20px; background: #fff; border: 1px solid var(--trait); color: var(--gris); text-decoration: none; font-weight: 600; font-size: .9rem; }
.g-tabs a[aria-current] { background: var(--vert-c); border-color: var(--mousse); color: var(--vert-f); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; line-height: 1.3; }
.badge--grey { background: #ecebe6; color: #5d5d55; }
.badge--blue { background: var(--bleu-c); color: var(--bleu); }
.badge--green { background: var(--ok-c); color: var(--ok); }
.badge--red { background: var(--err-c); color: var(--err); }
.badge--amber { background: var(--warn-c); color: var(--warn); }
.badge--violet { background: var(--violet-c); color: var(--violet); }

/* ---------- Éditeur de lignes ---------- */
.g-catalog { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.g-chip-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 42px; padding: 6px 12px; border: 1.5px dashed var(--mousse); border-radius: 21px; background: var(--vert-c); color: var(--vert-f); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.g-line { border: 1px solid var(--trait); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: #fcfbf8; }
.g-line__top { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.g-line__des { font-weight: 650; }
.g-line textarea { margin-bottom: 8px; font-size: 16px; }
.g-line__nums { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
.g-line__nums:has(select) { grid-template-columns: 1fr 1fr 1.3fr 1fr; }
.g-line__nums label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 650; color: var(--gris); }
.g-line__nums input, .g-line__nums select { padding: 10px 8px; }
.g-line__tot { text-align: right; margin: 8px 2px 0; color: var(--gris); }
.g-line__tot strong { color: var(--encre); font-size: 1.05rem; }
.g-totals { margin-top: 14px; border-top: 2px solid var(--trait); padding-top: 10px; }
.g-totals > div { display: flex; justify-content: space-between; padding: 4px 2px; }
.g-totals__ttc { font-size: 1.2rem; font-weight: 800; color: var(--vert); }

/* ---------- Aperçu document ---------- */
.g-preview { margin-top: 18px; }
.g-preview .doc { font-size: 12px; }

/* ---------- Connexion ---------- */
.g-login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: linear-gradient(180deg, var(--vert) 0 34%, var(--fond) 34%); }
.g-login__box { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 28px 22px 22px; box-shadow: 0 16px 40px rgba(0,0,0,.12); text-align: center; }
.g-login__box img { margin: 0 auto 8px; display: block; }
.g-login__box .g-field { text-align: left; }
.g-login__sub { color: var(--gris); margin: 4px 0 18px; }
.g-login__lost { display: inline-block; margin-top: 14px; color: var(--gris); font-size: .9rem; }
.g-login .g-check { justify-content: flex-start; margin-bottom: 10px; }

/* ---------- Page client (document reçu) ---------- */
.g-public { padding: 0 0 40px; }
.g-public__bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; background: var(--vert); color: #fff; }
.g-public__accept, .g-public__doc { max-width: 820px; margin: 16px auto; padding: 0 16px; }
.g-accept { display: grid; gap: 12px; background: #fff; border: 2px solid var(--vert); border-radius: var(--r); padding: 16px; }

/* ---------- Météo ---------- */
.g-meteo { margin: -4px 14px 10px; font-size: .9rem; color: var(--gris); }
.g-meteo--bad { color: var(--warn); font-weight: 600; }
.g-meteo-alert { display: flex; flex-direction: column; gap: 2px; margin: -2px 12px 12px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; line-height: 1.3; }
.g-meteo-alert strong { font-size: 1rem; }
.g-meteo-alert--stop { background: var(--err-c); color: var(--err); border: 1.5px solid #f0b7b1; }
.g-meteo-alert--attention { background: var(--warn-c); color: var(--warn); border: 1.5px solid #f1d29a; }
.g-meteo-alert__ligne { color: var(--encre); font-size: .9rem; margin-top: 2px; }
.g-card .g-meteo-alert { margin: 0 0 4px; }
.g-card .g-meteo { margin: 0 0 6px; font-size: 1rem; color: var(--encre); }
.g-day__head h2 { flex: 1; }
.g-day__meteo { display: flex; flex-direction: column; align-items: flex-end; margin-right: 10px; font-weight: 700; font-size: 1rem; line-height: 1.1; white-space: nowrap; }
.g-day__meteo small { font-weight: 600; font-size: .72rem; color: var(--gris); }
.g-day__meteo--stop small { color: var(--err); }
.g-day__meteo--attention small { color: var(--warn); }
.g-section--meteo > h2 { color: var(--err); }
.g-int__jour { margin: 8px 0 4px 2px; font-weight: 700; font-size: .9rem; color: var(--gris); }
.g-credit { color: var(--gris); font-size: .75rem; text-align: center; margin: 10px 0 0; }
.g-card .g-credit { text-align: left; }

/* ---------- Écrans larges (ordinateur, tablette) ---------- */
@media (min-width: 760px) {
	.g-tabbar { left: 50%; right: auto; width: 720px; transform: translateX(-50%); border: 1px solid var(--trait); border-bottom: 0; border-radius: 16px 16px 0 0; }
	.g-tiles { grid-template-columns: repeat(4, 1fr); }
	.g-preview .doc { font-size: 13px; padding: 36px 40px; }
}
@media (max-width: 360px) {
	body { font-size: 16px; }
	.g-quick__btn { font-size: .8rem; min-height: 84px; }
	.g-line__nums { grid-template-columns: 1fr 1fr; }
}
