/* Carnet Local — mise en page. Couleurs : vert sapin, jaune moutarde, encre, papier. */
@font-face { font-family: 'Bricolage'; src: url(fonts/bricolage-grotesque-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url(fonts/bricolage-grotesque-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --vert: #1F5C45; --vert-fonce: #163F30; --vert-clair: #E6EFEA; --vert-pale: #EEF3EF; --vert-gris: #9AAFA5;
  --moutarde: #F2C14E; --moutarde-clair: #FCEFCB; --moutarde-texte: #4A3300;
  --encre: #1C2B24; --texte: #3E4A44; --discret: #5B6660; --ligne: #E3E1DA; --ligne-forte: #D5D2C9;
  --papier: #FBFAF7; --blanc: #FFFFFF; --sable: #F1EFE9; --alerte: #93330F; --alerte-clair: #FDE8E1; --orange-clair: #FDF1E2; --orange-texte: #7A3E0C;
  --rayon: 14px; --titre: 'Bricolage', 'Inter', system-ui, sans-serif; --corps: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #ECEAE3; color: var(--encre); font-family: var(--corps); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--vert); }
a:hover { color: var(--vert-fonce); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--papier); display: flex; flex-direction: column; position: relative; }
.chargement { padding: 40px 16px; text-align: center; color: var(--discret); }

/* ---------- En-tête et navigation ---------- */
.demo-bandeau { background: var(--encre); color: #fff; padding: 8px 12px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.demo-bandeau b { font-weight: 600; margin-right: 2px; }
.demo-bandeau button { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; min-height: 30px; }
.demo-bandeau button.on { background: var(--moutarde); color: var(--encre); border-color: var(--moutarde); font-weight: 600; }
.demo-bandeau .raz { margin-left: auto; text-decoration: underline; border: 0; padding: 4px 2px; }

.ent { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 10px; background: var(--blanc); border-bottom: 1px solid var(--ligne); position: sticky; top: 0; z-index: 5; }
.marque { display: flex; flex-direction: column; gap: 0; border: 0; background: none; padding: 0; text-align: left; }
.marque b { font-family: var(--titre); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; color: var(--vert); line-height: 1.1; }
.marque span { font-size: 11px; color: var(--discret); }
.ent-actions { display: flex; gap: 6px; align-items: center; }
.rond { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--ligne); background: var(--blanc); display: flex; align-items: center; justify-content: center; padding: 0; color: var(--encre); }
.pastille { min-height: 36px; border-radius: 999px; border: 0; background: var(--encre); color: #fff; font-size: 12px; font-weight: 600; padding: 0 12px; }
.pastille.agnes { background: var(--moutarde); color: var(--encre); }

main { flex: 1; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.nav { position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ligne); background: var(--blanc); padding: 4px 6px calc(8px + env(safe-area-inset-bottom)); }
.nav button { border: 0; background: transparent; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--discret); }
.nav button.on { color: var(--vert); }

/* ---------- Textes ---------- */
.titre { font-family: var(--titre); font-size: 24px; font-weight: 700; line-height: 1.15; }
.titre-2 { font-family: var(--titre); font-size: 18px; font-weight: 700; line-height: 1.2; }
.sur-titre { font-size: 13px; font-weight: 600; color: var(--discret); text-transform: uppercase; letter-spacing: .04em; }
.petit { font-size: 12px; color: var(--discret); line-height: 1.45; }
.discret { color: var(--discret); font-size: 13px; }
.entete-vue { display: flex; flex-direction: column; gap: 2px; }

/* ---------- Cartes et blocs ---------- */
.bloc { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bloc.serre { padding: 6px 14px; gap: 0; }
.bloc.vert { border: 1.5px solid var(--vert); }
.bloc.pale { background: var(--vert-pale); border-color: transparent; }
.bloc.jaune { background: var(--moutarde-clair); border-color: #E2B33C; color: var(--moutarde-texte); }
.encart { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.encart.ok { background: var(--vert-clair); color: #17462F; }
.encart.info { background: var(--vert-pale); color: var(--texte); }
.encart.attention { background: var(--orange-clair); color: var(--orange-texte); display: flex; gap: 10px; font-size: 14px; }
.encart.erreur { background: var(--alerte-clair); color: var(--alerte); }
.ligne { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid #EFEDE7; }
.ligne:first-child { border-top: 0; }
.ligne > .plein { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

/* ---------- Boutons ---------- */
.btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--ligne-forte); background: var(--blanc); color: var(--encre); font-size: 15px; font-weight: 600; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; }
.btn.prim { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn.prim:disabled { background: var(--vert-gris); border-color: var(--vert-gris); cursor: default; }
.btn.sec { border: 1.5px solid var(--vert); color: var(--vert); }
.btn.jaune { background: var(--moutarde); border-color: var(--moutarde); color: var(--encre); }
.btn.noir { background: var(--encre); border-color: var(--encre); color: #fff; }
.btn.pointille { border: 1.5px dashed var(--vert); color: var(--vert); }
.btn.lien { border: 0; background: none; color: var(--vert); padding: 0 4px; min-height: 36px; font-size: 14px; }
.btn.lien.rouge { color: var(--alerte); }
.btn.petit-btn { min-height: 38px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn.large { width: 100%; }
.btn.gros { min-height: 64px; justify-content: flex-start; text-align: left; padding: 0 16px; gap: 14px; }
.btn.gros .ico-fond { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--moutarde); color: var(--encre); display: flex; align-items: center; justify-content: center; }
.btn.gros .deux { display: flex; flex-direction: column; gap: 2px; }
.btn.gros .deux small { font-size: 13px; font-weight: 400; color: #D3E3DA; }
.rangee { display: flex; flex-wrap: wrap; gap: 8px; }
.rangee > .btn { flex: 1 1 140px; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { min-height: 38px; border-radius: 999px; padding: 0 14px; font-size: 13px; font-weight: 600; border: 1.5px solid var(--vert); background: var(--blanc); color: var(--vert); }
.puce.on { background: var(--vert); color: #fff; }

/* Interrupteur */
.inter { width: 52px; height: 32px; flex: none; border: 0; border-radius: 16px; padding: 3px; background: #B9B5A9; display: flex; justify-content: flex-start; }
.inter.on { background: var(--vert); justify-content: flex-end; }
.inter span { width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* ---------- Formulaires ---------- */
.champ { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--texte); }
.champ input, .champ select, .champ textarea, .saisie { min-height: 44px; border: 1px solid var(--ligne-forte); border-radius: 10px; padding: 0 12px; font-size: 16px; font-weight: 400; color: var(--encre); background: var(--blanc); width: 100%; }
.champ textarea, textarea.saisie { padding: 10px 12px; resize: vertical; line-height: 1.45; }
.champ .aide { font-size: 12px; font-weight: 400; color: var(--discret); }
.champ input:disabled { background: var(--sable); color: var(--texte); }
.verrou { min-height: 44px; border: 1px solid var(--ligne); border-radius: 10px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--sable); font-size: 15px; font-weight: 400; color: var(--texte); }
.case { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 10px 0; border-top: 1px solid #EFEDE7; cursor: pointer; font-size: 14px; }
.case:first-of-type { border-top: 0; }
.case input { width: 22px; height: 22px; accent-color: var(--vert); flex: none; margin: 0; }
.case .deux { display: flex; flex-direction: column; gap: 1px; }
.case .deux b { font-weight: 600; }
.grille2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sous-bloc { background: var(--papier); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Publications ---------- */
.pub { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--rayon); overflow: hidden; }
.pub-ent { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; }
.pub-ent .plein { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pub-ent .nom { border: 0; background: none; padding: 0; text-align: left; font-size: 15px; font-weight: 600; color: var(--encre); }
.pub-photo { width: 100%; max-height: 360px; object-fit: cover; background: var(--sable); }
.pub-texte { padding: 10px 12px 4px; font-size: 15px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.pub-pied { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px 4px; }
.jaime { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 8px; min-height: 44px; font-size: 13px; color: var(--discret); }
.jaime.on { color: #B4432F; }
.tag { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 4px 9px; background: var(--vert-clair); color: var(--vert); white-space: nowrap; }
.tag.promo { background: var(--moutarde-clair); color: #6B4A00; }
.tag.ferme { background: var(--alerte-clair); color: var(--alerte); }
.tag.plat { background: #F6E1DB; color: #7A2E22; }
.tag.event { background: #ECE4F4; color: #55307A; }
.tag.arrivage { background: #DCE8F4; color: #1F4E79; }

.vignette { width: 40px; height: 40px; flex: none; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.vignette.g { width: 52px; height: 52px; border-radius: 13px; font-size: 16px; }

/* ---------- Page commerce ---------- */
.com-tete { background: var(--blanc); border: 1px solid var(--ligne); border-radius: 16px; overflow: hidden; }
.com-bande { height: 84px; display: flex; align-items: flex-end; padding: 0 14px; }
.com-logo { width: 68px; height: 68px; border-radius: 16px; background: #fff; border: 3px solid #fff; margin-bottom: -26px; font-family: var(--titre); font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.com-logo img { width: 100%; height: 100%; object-fit: cover; }
.com-corps { padding: 34px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.actions-com { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-com .btn { flex: 1 1 150px; min-height: 50px; font-size: 14px; }
.actions-com .btn.mis-en-avant { background: var(--moutarde); border-color: var(--moutarde); }
.horaire { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 3px 0; }
.horaire span:first-child { color: var(--texte); }
.horaire span:last-child { font-weight: 500; text-align: right; }
.horaire-titre { font-size: 13px; font-weight: 600; color: var(--vert); margin-top: 6px; }

/* ---------- Fidélité ---------- */
.tampons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tampon { aspect-ratio: 1; border-radius: 999px; border: 1.5px solid var(--vert); background: #fff; color: #fff; display: flex; align-items: center; justify-content: center; }
.tampon.fait { background: var(--vert); }
.carte-fid { background: var(--blanc); border: 1px solid var(--ligne); border-radius: var(--rayon); overflow: hidden; }
.carte-fid .haut { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #fff; }
.carte-fid .haut .vignette { background: #fff; }
.carte-fid .haut b { flex: 1; font-size: 15px; }
.carte-fid .bas { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.qr-boite { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.qr-boite img { width: 240px; max-width: 80vw; image-rendering: pixelated; border-radius: 8px; }

/* ---------- Statistiques ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats.trois { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--blanc); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.stat.clair { background: var(--papier); border: 0; }
.stat b { font-family: var(--titre); font-size: 24px; font-weight: 700; color: var(--vert); line-height: 1.1; }
.stat span { font-size: 12px; color: var(--discret); }

/* ---------- Onglets internes ---------- */
.onglets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.onglets button { flex: none; min-height: 40px; border-radius: 999px; border: 1px solid var(--ligne-forte); background: var(--blanc); padding: 0 14px; font-size: 14px; font-weight: 600; color: var(--texte); }
.onglets button.on { background: var(--encre); border-color: var(--encre); color: #fff; }
.pro-tete { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; color: #fff; }
.pro-tete .plein { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pro-tete small { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.pro-tete b { font-family: var(--titre); font-size: 20px; }

/* ---------- Dictée ---------- */
.dictee { min-height: 72px; border: 0; border-radius: 14px; background: var(--vert); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; text-align: left; width: 100%; }
.dictee.ecoute { background: var(--encre); }
.dictee .ico-fond { width: 46px; height: 46px; flex: none; border-radius: 23px; background: var(--moutarde); color: var(--encre); display: flex; align-items: center; justify-content: center; }
.dictee.ecoute .ico-fond { background: #E5684F; color: #fff; }
.dictee .deux { display: flex; flex-direction: column; gap: 2px; }
.dictee small { font-size: 13px; color: #D3E3DA; }
.photo-zone { min-height: 92px; border: 1.5px dashed #B9B5A9; border-radius: 12px; background: var(--papier); color: var(--texte); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 500; position: relative; overflow: hidden; cursor: pointer; }
.photo-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.apercu-photo { position: relative; }
.apercu-photo img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; }
.apercu-photo button { position: absolute; top: 8px; right: 8px; }

/* ---------- Feuilles (fenêtres du bas) ---------- */
.voile { position: fixed; inset: 0; background: rgba(20, 28, 24, .5); z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; }
.voile .fond { flex: 1; border: 0; background: transparent; }
.feuille { background: var(--blanc); border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 92vh; overflow-y: auto; max-width: 520px; width: 100%; margin: 0 auto; }
.feuille-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fermer { width: 40px; height: 40px; flex: none; border: 0; border-radius: 20px; background: var(--sable); display: flex; align-items: center; justify-content: center; padding: 0; color: var(--encre); }
.scanner-video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: #000; }

/* ---------- Divers ---------- */
.vide { text-align: center; padding: 24px 12px; color: var(--discret); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.etapes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.etapes li { display: flex; gap: 12px; align-items: center; background: var(--blanc); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.4; }
.etapes .num { width: 28px; height: 28px; flex: none; border-radius: 14px; background: var(--vert); color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.accueil-hero { background: var(--vert); color: #fff; border-radius: 18px; padding: 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.accueil-hero h1 { font-family: var(--titre); font-size: 26px; line-height: 1.15; }
.accueil-hero p { color: #D3E3DA; }
.texte-pre { white-space: pre-line; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); max-width: calc(100% - 32px); width: 480px; background: var(--encre); color: #fff; border-radius: 12px; padding: 12px 14px; font-size: 14px; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.vu { opacity: 1; }
.couleurs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.couleur { width: 40px; height: 40px; border-radius: 20px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--ligne-forte); padding: 0; }
.couleur.on { box-shadow: 0 0 0 3px var(--encre); }
.couleurs input[type=color] { width: 44px; height: 44px; border: 1px solid var(--ligne-forte); border-radius: 10px; padding: 2px; background: #fff; }
.tableau-ligne { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; border-top: 1px solid #EFEDE7; }
.tableau-ligne:first-child { border-top: 0; }
.pied-legal { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.pied-legal a { min-height: 32px; display: inline-flex; align-items: center; }
@media (min-width: 560px) { #app { box-shadow: 0 0 0 1px var(--ligne); } }
