/* Fournée — feuille de style unique, sans dépendance externe */
:root {
  --fond: #f7f3ec;
  --papier: #fffdf9;
  --encre: #2b2118;
  --encre-douce: #6f6153;
  --trait: #e6ddd0;
  --trait-fort: #d4c6b3;
  --croute: #9a5a2c;
  --croute-fonce: #7a4521;
  --croute-pale: #f4e6d6;
  --vert: #3f7a4a;
  --vert-pale: #e3f0e4;
  --rouge: #b03a2e;
  --rouge-pale: #f8e1de;
  --ambre: #b7791f;
  --ambre-pale: #fbefd5;
  --bleu-pale: #e6eef5;
  --rayon: 8px;
  --ombre: 0 1px 2px rgba(43, 33, 24, .06), 0 2px 8px rgba(43, 33, 24, .04);
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --chiffres: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--police); color: var(--encre); background: var(--fond); line-height: 1.45; }
a { color: var(--croute-fonce); }
a:hover { color: var(--croute); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
small, .discret { color: var(--encre-douce); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ------------------------------------------------ mise en page */
.cadre { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.barre { background: #2f241b; color: #eadfce; padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marque { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.2rem; color: #fff; text-decoration: none; padding: .2rem .5rem 1rem; }
.marque svg { flex: none; }
.marque small { display: block; font-weight: 400; font-size: .75rem; color: #b9a891; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.choix-boutique { margin: -.4rem .5rem .8rem; }
.choix-boutique select { width: 100%; padding: .4rem .5rem; border-radius: 6px; border: 1px solid #5a4a3a; background: #3b2e23; color: #f4e6d6; font-size: .85rem; }
.choix-boutique select:focus { outline: 2px solid var(--croute); }
.interrupteur { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 600; }
.interrupteur input { width: auto; }
.nav-titre { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #a08e78; margin: 1rem .55rem .3rem; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: .42rem .6rem; border-radius: 6px; color: #eadfce; text-decoration: none; font-size: .93rem; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.actif { background: var(--croute); color: #fff; }
.pastille-nouveau { background: var(--ambre) !important; font-weight: 600; }
.pastille { background: var(--rouge); color: #fff; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 10px; }
.contenu { padding: 1.6rem 2rem 3rem; max-width: 1280px; width: 100%; }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.entete .sous-titre { color: var(--encre-douce); margin-top: -.3rem; }
.actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.menu-mobile { display: none; }

/* ------------------------------------------------ blocs */
.carte { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.carte > h2:first-child, .carte > h3:first-child { margin-top: 0; }
.carte-titre { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.carte-titre h2 { margin: 0; }
.grille { display: grid; gap: 1.1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-fiche { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grille > .carte { margin-bottom: 0; }
.kpi { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: .9rem 1rem; box-shadow: var(--ombre); }
.kpi .val { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .lib { color: var(--encre-douce); font-size: .85rem; }
.kpi.alerte .val { color: var(--rouge); }
.kpi.ok .val { color: var(--vert); }

/* ------------------------------------------------ tableaux */
.tableau-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .45rem .55rem; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-douce); font-weight: 600; background: #faf6f0; position: sticky; top: 0; }
th.num { text-align: right; }
tbody tr:hover { background: #fbf7f1; }
tr.groupe td { background: var(--croute-pale); font-weight: 700; color: var(--croute-fonce); font-size: .85rem; }
tr.total td { font-weight: 700; border-top: 2px solid var(--trait-fort); background: #faf6f0; }
td.centre, th.centre { text-align: center; }
td.nom-composant { min-width: 170px; }
.compact td, .compact th { padding: .3rem .45rem; }

/* ------------------------------------------------ formulaires */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; color: var(--encre); }
.aide { font-size: .8rem; color: var(--encre-douce); font-weight: 400; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: .48rem .6rem; border: 1px solid var(--trait-fort); border-radius: 6px; background: #fff; font: inherit; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(154, 90, 44, .35); border-color: var(--croute); }
textarea { min-height: 7rem; resize: vertical; }
.champ { margin-bottom: .85rem; }
/* Mot de passe : bouton « œil » pour voir ce qu'on tape */
.mdp-zone { position: relative; display: block; }
.mdp-zone input { padding-right: 2.6rem; }
.mdp-oeil { position: absolute; top: 0; right: 0; height: 100%; width: 2.5rem; display: flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--encre-douce); cursor: pointer; border-radius: 0 6px 6px 0; }
.mdp-oeil:hover { color: var(--croute-fonce); }
.mdp-oeil:focus-visible { outline: 2px solid rgba(154, 90, 44, .35); }
.ligne-champs { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.case { display: flex; align-items: center; gap: .45rem; font-weight: 400; cursor: pointer; }
.case input { width: auto; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .25rem .8rem; }
.inline-form { display: inline; }
.form-ligne { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.form-ligne .champ { margin-bottom: 0; }
input.court { width: 6.5rem; }
input.tres-court { width: 4.8rem; }
.filtres { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filtres input, .filtres select { width: auto; min-width: 160px; }

/* ------------------------------------------------ boutons */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .48rem .9rem; border-radius: 6px; border: 1px solid var(--trait-fort); background: #fff; color: var(--encre); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f6efe6; color: var(--encre); }
.btn-primaire { background: var(--croute); border-color: var(--croute); color: #fff; }
.btn-primaire:hover { background: var(--croute-fonce); color: #fff; }
.btn-danger { color: var(--rouge); border-color: #e3b8b2; }
.btn-danger:hover { background: var(--rouge-pale); color: var(--rouge); }
.btn-petit { padding: .22rem .5rem; font-size: .8rem; }
.btn-lien { background: none; border: none; color: var(--croute-fonce); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }

/* ------------------------------------------------ badges & messages */
.badge { display: inline-block; padding: .08rem .5rem; border-radius: 10px; font-size: .76rem; font-weight: 600; background: #efe7dc; color: var(--encre-douce); white-space: nowrap; }
.badge-ok { background: var(--vert-pale); color: var(--vert); }
.badge-ko { background: var(--rouge-pale); color: var(--rouge); }
.badge-avert { background: var(--ambre-pale); color: var(--ambre); }
.badge-prep { background: var(--bleu-pale); color: #36597a; }
.allergene { display: inline-block; padding: .1rem .5rem; margin: .1rem; border-radius: 5px; background: var(--ambre-pale); color: #7d4f0c; font-size: .8rem; font-weight: 600; }
.allergene.trace { background: #f1ede7; color: var(--encre-douce); font-weight: 400; }
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.flash-succes { background: var(--vert-pale); border-color: #b9d8bd; color: #285a31; }
.flash-erreur { background: var(--rouge-pale); border-color: #eab9b2; color: #84251c; }
.flash-info { background: var(--bleu-pale); border-color: #c3d4e3; color: #2f4d68; }
.bandeau { padding: .6rem 1rem; border-radius: 6px; margin-bottom: 1rem; background: var(--croute-pale); border: 1px solid #e6cdb0; font-size: .92rem; }
.bandeau a { font-weight: 600; margin-left: .4rem; }
.bandeau-alerte { background: var(--rouge-pale); border-color: #eab9b2; color: #84251c; }
.bandeau-assistance { background: #2f4d68; border-color: #2f4d68; color: #fff; }
.bandeau-assistance a { color: #fff; }
.vide { text-align: center; padding: 2rem 1rem; color: var(--encre-douce); }
.encadre { background: #faf6f0; border: 1px dashed var(--trait-fort); border-radius: 6px; padding: .7rem .9rem; font-size: .9rem; }
.appel-import { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--ambre-pale); border: 2px solid var(--ambre); border-radius: var(--rayon); padding: .9rem 1.1rem;
  margin-bottom: 1.1rem; color: #6d4610; }
.appel-import strong { font-size: 1.05rem; color: var(--encre); }
.appel-import .btn { flex-shrink: 0; }
.encadre-avert { background: var(--ambre-pale); border: 1px solid #ecd39d; border-radius: 6px; padding: .6rem .9rem; font-size: .88rem; color: #6d4610; margin-bottom: .8rem; }
.barre-part { height: 6px; background: #efe7dc; border-radius: 3px; overflow: hidden; min-width: 60px; }
.barre-part span { display: block; height: 100%; background: var(--croute); }
.positif { color: var(--vert); }
.negatif { color: var(--rouge); }
.onglets { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--trait); }
.onglets a { padding: .5rem .9rem; text-decoration: none; color: var(--encre-douce); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .92rem; }
.onglets a.actif { color: var(--croute-fonce); border-color: var(--croute); }
dl.infos { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
dl.infos dt { color: var(--encre-douce); font-size: .88rem; }
dl.infos dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ planning */
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.jour { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); min-height: 180px; display: flex; flex-direction: column; }
.jour.aujourdhui { border-color: var(--croute); box-shadow: 0 0 0 1px var(--croute); }
.jour-tete { padding: .5rem .6rem; border-bottom: 1px solid var(--trait); display: flex; justify-content: space-between; font-weight: 700; font-size: .88rem; }
.jour-corps { padding: .45rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.plan-carte { display: block; background: var(--croute-pale); border-radius: 6px; padding: .4rem .5rem; text-decoration: none; color: var(--encre); font-size: .82rem; }
.plan-carte:hover { background: #ecd8c2; color: var(--encre); }
.plan-carte strong { display: block; font-size: .85rem; }
.jour form { padding: .45rem; border-top: 1px dashed var(--trait); }

/* ------------------------------------------------ authentification */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 20% 10%, #f3e3cf, var(--fond) 55%); }
.auth .carte { width: 100%; max-width: 410px; padding: 1.8rem; }
.auth .marque { color: var(--encre); justify-content: center; padding-bottom: 1.2rem; }

/* ------------------------------------------------ étiquettes */
.planche { display: flex; flex-wrap: wrap; gap: 4mm; }
.etiquette { background: #fff; border: 1px solid #222; color: #000; padding: 3mm 3.5mm; font-family: Arial, Helvetica, sans-serif; font-size: 7.5pt; line-height: 1.25; break-inside: avoid; page-break-inside: avoid; }
.etiquette.petit { width: 70mm; }
.etiquette.moyen { width: 90mm; }
.etiquette.grand { width: 105mm; font-size: 8.5pt; }
.etiquette .denomination { font-size: 1.55em; font-weight: 700; margin-bottom: 1mm; }
.etiquette .ingr { margin-bottom: 1.2mm; }
.etiquette b.al { font-weight: 800; }
.etiquette table { border-collapse: collapse; margin: 1mm 0; width: 100%; }
.etiquette table td, .etiquette table th { border: .5px solid #000; padding: .3mm 1mm; font-size: .92em; background: none; color: #000; text-transform: none; letter-spacing: 0; position: static; }
.etiquette table th { font-weight: 700; }
.etiquette .pied { display: flex; justify-content: space-between; gap: 2mm; margin-top: 1mm; font-size: .95em; }
.etiquette .poids { font-size: 1.3em; font-weight: 700; }
.etiquette .dates { border: 1px solid #000; padding: .5mm 1.2mm; }

/* ------------------------------------------------ impression */
.feuille { background: #fff; padding: 1.5rem; }
.feuille h1 { font-size: 1.4rem; }
.seulement-impression { display: none; }
@media print {
  @page { margin: 11mm; }
  html { font-size: 11pt; }
  body { background: #fff; }
  .barre, .entete .actions, .pas-impression, .flash, .menu-mobile { display: none !important; }
  .cadre { display: block; }
  .contenu { padding: 0; max-width: none; }
  .carte { box-shadow: none; border: none; padding: 0; margin-bottom: .8rem; }
  .seulement-impression { display: block; }
  th { background: none !important; position: static; }
  tr.groupe td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  .planche { gap: 3mm; }
  .grille.g-fiche { display: block; }
}

/* ------------------------------------------------ petits écrans */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-fiche { grid-template-columns: 1fr; }
  .semaine { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .cadre { grid-template-columns: 1fr; }
  .barre { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .barre.ouverte { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .menu-mobile { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: #2f241b; color: #fff; position: sticky; top: 0; z-index: 10; }
  .menu-mobile button { background: none; border: 1px solid #6d5a46; color: #fff; border-radius: 6px; padding: .3rem .6rem; font: inherit; }
  .contenu { padding: 1rem; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .semaine { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
}

/* Page Nouveautés */
.nouveautes h3 { margin: 1.3rem 0 .4rem; color: var(--croute-fonce); }
.nouveautes ul { margin: 0; padding-left: 1.2rem; }
.nouveautes li { margin-bottom: .45rem; }
.nouveautes code { background: #f1ebe3; padding: .05rem .35rem; border-radius: 4px; font-size: .9em; }
.commandes-carte { background: var(--bleu-pale); }
.commandes-carte:hover { background: #d6e2ee; }

/* ------------------------------------------------ remarques des clients */
.bouton-remarque { display: flex; align-items: center; gap: .5rem; width: 100%; margin: .9rem 0 .4rem;
  padding: .55rem .8rem; border: 1px solid rgba(255, 255, 255, .25); border-radius: 6px; background: rgba(255, 255, 255, .06);
  color: inherit; font: inherit; font-size: .92rem; cursor: pointer; text-align: left; }
.bouton-remarque:hover { background: rgba(255, 255, 255, .14); }
.dialogue { border: 0; border-radius: var(--rayon); padding: 1.3rem 1.4rem; width: min(520px, calc(100vw - 32px));
  background: var(--papier); color: var(--encre); box-shadow: 0 10px 40px rgba(43, 33, 24, .25); }
.dialogue::backdrop { background: rgba(43, 33, 24, .45); }
.dialogue h2 { margin-top: 0; }
.dialogue textarea { min-height: 8rem; }
.remarque-texte { white-space: pre-wrap; margin: .3rem 0 .6rem; }

/* ------------------------------------------------ listes avec recherche (recherche.js) */
.recherche { position: relative; }
.recherche input { width: 100%; padding-right: 2rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6153' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat right .6rem center; }
.recherche-select { display: none !important; }
.recherche-liste { position: fixed; z-index: 60; max-height: 18rem; overflow-y: auto;
  margin: 0; padding: .25rem 0; list-style: none; background: #fff; border: 1px solid var(--trait-fort); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(43, 33, 24, .14); min-width: 16rem; }
.recherche-liste li { padding: .4rem .7rem; cursor: pointer; display: flex; justify-content: space-between; gap: .8rem; }
.recherche-liste li small { color: var(--encre-douce); white-space: nowrap; }
.recherche-liste li.actif, .recherche-liste li[data-i]:hover { background: var(--croute-pale); }
.recherche-liste .recherche-groupe { cursor: default; font-size: .74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--encre-douce); padding-top: .55rem; }
.recherche-liste .recherche-vide { cursor: default; color: var(--encre-douce); }
td > .recherche { min-width: 14rem; }
/* ------------------------------------------------ choix du secteur (inscription) */
.choix-secteur { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.secteur-carte { display: block; position: relative; border: 2px solid var(--trait-fort); border-radius: var(--rayon);
  padding: .8rem .7rem; cursor: pointer; text-align: center; background: #fff; }
.secteur-carte input { position: absolute; opacity: 0; }
.secteur-carte:hover { border-color: var(--croute-pale); }
.secteur-carte:has(input:checked) { border-color: var(--croute); background: var(--croute-pale); }
.secteur-carte:has(input:focus-visible) { outline: 2px solid rgba(154, 90, 44, .35); }
.secteur-icone { display: block; font-size: 1.7rem; line-height: 1; margin-bottom: .3rem; }
.secteur-nom { display: block; font-weight: 700; }
.secteur-desc { display: block; font-size: .78rem; color: var(--encre-douce); margin-top: .2rem; }
@media (max-width: 420px) { .choix-secteur { grid-template-columns: 1fr; } }
