/* Espace de gestion SAFAND — charte jus : vert, orange, blanc */
:root{--green:#1C3F06;--leaf:#3E7B1F;--mint:#EAF2E3;--orange:#F29B09;--ink:#1B1D19;--muted:#6B6F66;--bg:#F4F7F1;--line:#E3EADC;--white:#fff}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--ink);background:var(--bg);font-size:15px;line-height:1.45;font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased}
a{color:inherit}
.app{display:flex;min-height:100vh}
.side{width:224px;background:var(--green);color:#CFE0C4;padding:22px 14px;display:flex;flex-direction:column;flex:none;position:sticky;top:0;height:100vh}
.side .logo{display:flex;align-items:center;gap:10px;padding:0 8px 22px;color:#fff;font-weight:700;font-size:17px;letter-spacing:.1em;text-decoration:none}
.side .logo span{width:38px;height:38px;border-radius:50%;background:#fff;display:grid;place-items:center}.side .logo img{height:28px}
.side nav a{display:flex;justify-content:space-between;align-items:center;padding:11px 12px;border-radius:10px;font-weight:500;margin-bottom:3px;text-decoration:none}
.side nav a:hover{background:rgba(255,255,255,.08)}
.side nav a.on{background:rgba(255,255,255,.14);color:#fff;font-weight:600}
.side nav a em{font-style:normal;background:var(--orange);color:#2b1c00;border-radius:999px;font-size:11.5px;font-weight:700;padding:1px 8px}
.side .who{margin-top:auto;border-top:1px solid rgba(255,255,255,.16);padding:14px 8px 0;font-size:12.5px}.side .who b{display:block;color:#fff;font-size:13.5px}
.side .who a{color:#CFE0C4}
.side .credit{display:flex;align-items:center;gap:6px;font-size:10.5px;opacity:.5;margin-top:12px;text-decoration:none}.side .credit img{height:11px}
.main{flex:1;padding:26px 28px 40px;min-width:0;display:flex;flex-direction:column;gap:16px}
.top{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
.top h1{font-size:25px;font-weight:700;letter-spacing:-.01em}.top p{color:var(--muted);font-size:13.5px;margin-top:2px}
.btn,.pill{display:inline-flex;align-items:center;gap:6px;background:#fff;border:1px solid var(--line);border-radius:999px;padding:9px 16px;font-size:13.5px;font-weight:600;text-decoration:none;cursor:pointer;font-family:inherit;color:var(--ink)}
.btn.g{background:var(--green);color:#fff;border-color:var(--green)}.btn.o{background:var(--orange);border-color:var(--orange);color:#2b1c00}
.btn.danger{color:#9A4A00}.btn.full{width:100%;justify-content:center;border-radius:10px;padding:11px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.kpi,.box{background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px 16px}
.kpi span{font-size:12.5px;color:var(--muted)}.kpi b{display:block;font-size:26px;font-weight:700;letter-spacing:-.02em;margin-top:2px}.kpi small{display:block;font-size:12px;color:var(--muted)}
.box h2{font-size:15px;font-weight:700;margin-bottom:2px}.box .sub{font-size:12.5px;color:var(--muted);margin-bottom:10px}
.grid2{display:grid;grid-template-columns:1.2fr 1fr;gap:12px}.grid3{display:grid;grid-template-columns:1fr 1.1fr 1fr;gap:12px}
.split{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:12px;align-items:start}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th{text-align:left;font-size:11.5px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;padding:8px 10px;border-bottom:1px solid var(--line)}
td{padding:10px;border-bottom:1px solid #EEF2EA;vertical-align:middle}
tr.lien{cursor:pointer}tr.lien:hover td{background:#F6FAF2}
td small{display:block;color:var(--muted);font-size:12px}
.box.flush{padding:4px 6px}
.st{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:3px 10px;border-radius:999px;white-space:nowrap}
.st::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.st.prep{background:#FFF1D6;color:#8A5200}.st.liv{background:#E1EEFB;color:#1B5A9A}.st.ok{background:#E3F2DB;color:#2C6A12}.st.ann{background:#EEECE8;color:#5E5B55}
.st.conf{background:#F29B09;color:#2b1c00}.st.gold{background:#FFF1D0;color:#7A5200}
.tabs{display:flex;gap:8px;flex-wrap:wrap}.tab{padding:8px 14px;border-radius:999px;background:#fff;border:1px solid var(--line);font-size:13px;font-weight:600;text-decoration:none}
.tab.on{background:var(--green);color:#fff;border-color:var(--green)}.tab em{font-style:normal;opacity:.7;margin-left:4px}
.flash{padding:12px 16px;border-radius:12px;font-weight:500}.flash.ok{background:var(--mint);color:var(--green)}.flash.err{background:#FFE9C7;color:#7A3D00}
.dl{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;font-size:13.5px}.dl span{color:var(--muted)}
.dots{display:inline-flex;gap:3px;vertical-align:middle}.dots i{width:9px;height:9px;border-radius:50%;background:#E6E3DA}.dots i.on{background:var(--orange)}
.bar{height:10px;background:#EFEDE6;border-radius:5px;overflow:hidden}.bar i{display:block;height:100%;background:var(--leaf);border-radius:5px}
.fbar{display:grid;grid-template-columns:90px 1fr 80px;gap:10px;align-items:center;margin-top:12px}
.fbar b{display:block}.fbar span{font-size:11.5px;color:var(--muted)}.fbar .r{text-align:right}
.chart{display:flex;align-items:flex-end;gap:10px;height:140px;border-bottom:1px solid #cfccc2;padding:0 6px;margin-top:10px}
.chart div{flex:1;background:var(--leaf);border-radius:4px 4px 0 0;min-height:2px;position:relative}
.chart div b{position:absolute;top:-18px;left:0;right:0;text-align:center;font-size:12px}
.xl{display:flex;gap:10px;padding:4px 6px;font-size:12px;color:var(--muted)}.xl span{flex:1;text-align:center}
.mat td,.mat th{text-align:center}.mat td:first-child,.mat th:first-child{text-align:left}
.mat td span{display:inline-block;min-width:40px;padding:3px 0;border-radius:6px;font-weight:600}
.mat tr.grp td{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding-top:12px}
.todo{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #EEF2EA;font-size:13.5px;text-decoration:none}
.todo:last-child{border:0}.todo small{display:block;color:var(--muted);font-size:12px}
.note{font-size:12.5px;color:var(--muted);background:#F6F5F0;border-radius:10px;padding:9px 11px;margin-top:10px}
form.inline{display:inline}
label{display:block;font-size:12.5px;font-weight:600;color:#3d4138;margin:10px 0 4px}
input[type=text],input[type=tel],input[type=email],input[type=password],input[type=number],input[type=time],select,textarea{width:100%;font:inherit;font-size:14px;border:1px solid var(--line);border-radius:10px;padding:9px 11px;background:#FBFCFA}
input.court{width:110px;text-align:right}
textarea{min-height:90px;resize:vertical}
.check{display:flex;gap:8px;align-items:center;font-weight:500}
.actions{display:grid;gap:8px;margin-top:14px}
.gifts{display:inline-flex;gap:3px;align-items:center}.gifts i{width:9px;height:9px;border-radius:50%;background:var(--orange)}
.vide{color:var(--muted);text-align:center;padding:28px}
.login{min-height:100vh;display:grid;place-items:center;background:var(--green);padding:20px}
.login .box{width:100%;max-width:380px;padding:28px}
.login .marque{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:.1em;color:var(--green);margin-bottom:18px}
.login .marque img{height:40px}
details summary{cursor:pointer;font-weight:600}
/* Téléphone */
@media (max-width:820px){
  .app{flex-direction:column}
  .side{width:auto;height:auto;position:static;padding:12px 14px;flex-direction:row;flex-wrap:wrap;align-items:center;gap:6px}
  .side .logo{padding:0 8px 0 0}.side nav{display:flex;gap:4px;overflow-x:auto;width:100%;order:3}
  .side nav a{white-space:nowrap;padding:8px 10px;margin:0}.side .who{margin:0 0 0 auto;border:0;padding:0;text-align:right}.side .credit{display:none}
  .main{padding:16px 14px 30px}
  .kpis{grid-template-columns:1fr 1fr}.grid2,.grid3,.split{grid-template-columns:1fr}
  table.resp thead{display:none}table.resp tr{display:block;border-bottom:1px solid var(--line);padding:8px 4px}table.resp td{display:flex;justify-content:space-between;gap:10px;border:0;padding:4px 6px}
  table.resp td::before{content:attr(data-l);font-size:12px;color:var(--muted)}
}
.side{position:relative;height:auto;min-height:100vh}.side>div.who{position:sticky;bottom:16px}@media (max-width:820px){.side{min-height:0}}

.recherche{display:flex;gap:8px;flex-wrap:wrap}.recherche input{width:220px}
@media (max-width:820px){.recherche{width:100%}.recherche input{flex:1 1 100%;width:100%;min-width:0}.recherche .btn{flex:1;justify-content:center}
  table.resp td small{display:inline;margin-left:6px}table.resp td{align-items:baseline}}

/* Utilisateurs et habilitations */
.habs{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-top:14px}
.habs fieldset{border:1px solid var(--line);border-radius:12px;padding:6px 12px 10px;margin:0;min-width:0}
.habs legend{font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--leaf);padding:0 4px}
label.hab{display:flex;gap:9px;align-items:flex-start;font-weight:400;margin:8px 0 0;cursor:pointer}
label.hab input{margin-top:3px;accent-color:var(--green);flex:none}label.hab b{display:block;font-weight:600;font-size:13px}label.hab small{display:block;color:var(--muted);font-size:11.5px;line-height:1.35}
tr.off td{opacity:.55}
.box.mdp{border-color:var(--orange);background:#FFF8EA}.box.mdp .code{font:700 26px/1.2 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.04em;color:var(--green);margin:6px 0 8px;user-select:all}
.mat .oui{color:var(--green);font-weight:700}
ul.liste{margin:0;padding-left:18px;font-size:13.5px;line-height:1.7}
@media (max-width:1100px){.habs{grid-template-columns:1fr 1fr}}
@media (max-width:820px){.habs{grid-template-columns:1fr}}
.postes{display:flex;flex-wrap:wrap;gap:8px}
label.poste{margin:0;cursor:pointer}label.poste input{position:absolute;opacity:0;pointer-events:none}
label.poste span{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border:1px solid var(--line);border-radius:999px;background:#fff;font-size:13px;font-weight:600}
label.poste span::before{content:"";width:14px;height:14px;border-radius:4px;border:1.5px solid #9AA394;flex:none}
label.poste input:checked+span{background:var(--green);border-color:var(--green);color:#fff}
label.poste input:checked+span::before{background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5' fill='none' stroke='%231C3F06' stroke-width='2'/%3E%3C/svg%3E") center/10px no-repeat;border-color:#fff}
label.poste input:focus-visible+span{outline:2px solid var(--orange);outline-offset:2px}

/* Ventes */
.periode{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:flex-end}
.periode .dates{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.periode .dates label{margin:0;display:flex;gap:6px;align-items:center;font-weight:500}
.periode .dates input{width:auto;padding:7px 9px}
.exports{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;margin-top:-4px}
.chart.empile .col{flex:1;display:flex;flex-direction:column-reverse;height:100%;background:none;min-height:0;border-radius:0}
.chart.empile .col i{display:block;width:100%}.chart.empile .col i.std{background:var(--leaf);border-radius:0}.chart.empile .col i.dist{background:var(--orange);border-radius:4px 4px 0 0}

.chart.empile{height:180px}.chart.serre{gap:3px}.xl.serre{gap:3px;font-size:10px}
.legende{display:flex;gap:16px;font-size:12.5px;color:var(--muted);margin-top:8px}.legende i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:6px;vertical-align:-1px}
.legende i.std{background:var(--leaf)}.legende i.dist{background:var(--orange)}
table.chiffres td:not(:first-child),table.chiffres th:not(:first-child){text-align:right}table.chiffres tfoot td{font-weight:700;border-bottom:0}
table.chiffres tr.calme td{color:#A5A99F}
.defile{max-height:420px;overflow:auto;padding:0 10px 10px}
.son-side{background:rgba(255,255,255,.08);border:0;color:#CFE0C4;border-radius:10px;padding:9px 10px;font-weight:500;font-size:12.5px;font-family:inherit;text-align:left;cursor:pointer;margin:8px 0 10px}.son-side.coupe{opacity:.6}
.toasts{position:fixed;right:16px;bottom:16px;display:flex;flex-direction:column;gap:8px;z-index:70;max-width:min(380px,calc(100vw - 32px))}
.toast{background:var(--green);color:#fff;border-radius:12px;padding:12px 14px;box-shadow:0 8px 24px rgba(0,0,0,.18);font-weight:500;transition:opacity .4s,transform .4s;text-decoration:none;display:flex;flex-direction:column;gap:2px}
.toast.err{background:#7A3D00}.toast.alarme{background:var(--orange);color:#2b1c00}.toast.alarme span{font-size:13px}.toast.part{opacity:0;transform:translateY(8px)}
.son-bloque{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:80;background:var(--orange);color:#2b1c00;border:0;border-radius:999px;padding:14px 22px;font:700 16px Inter,system-ui,sans-serif;box-shadow:0 8px 24px rgba(0,0,0,.2);cursor:pointer}
table.chiffres td:first-child{white-space:nowrap}
.qr-box{display:grid;grid-template-columns:104px minmax(220px,1fr);gap:8px 18px;align-items:center}
.qr-box img{border-radius:10px;border:1px solid var(--line)}
.qr-actions{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap}
/* Réglages verrouillés */
form.verrouille input:disabled,form.verrouille select:disabled,form.verrouille textarea:disabled{background:#F3F4F0;color:var(--ink);opacity:1;border-color:#E6E8E1;cursor:default}
.cadenas{font-size:11.5px;font-weight:600;color:var(--muted);background:#F1F2EC;border-radius:999px;padding:2px 9px;margin-left:10px;vertical-align:2px}
.cadenas.ouvert{background:#FFF1D6;color:#7A5200}
form[data-verrou] .actions{display:flex;gap:8px;flex-wrap:wrap}
.modale-reglages{position:fixed;inset:0;background:rgba(20,30,15,.45);display:grid;place-items:center;z-index:90;padding:16px}
.mr-boite{background:#fff;border-radius:16px;padding:22px;width:100%;max-width:520px;max-height:85vh;overflow:auto;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.mr-boite h3{font-size:19px;margin-bottom:8px}.mr-boite p{font-size:14px;color:var(--muted)}
.mr-liste{margin:10px 0 4px 18px;font-size:14.5px;line-height:1.7}.mr-liste s{color:#9A9E95}.mr-liste strong{color:var(--green)}
.mr-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
table.journal td:first-child{white-space:nowrap;color:var(--muted)}
.tete-verrou{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:2px}
.tete-verrou .btn-modifier{padding:8px 14px}
form[data-verrou]:not(.verrouille) .actions{position:sticky;bottom:0;background:#fff;padding:10px 0 2px;margin-top:10px;border-top:1px solid var(--line);z-index:5}
form[data-verrou]:not(.verrouille){border-color:var(--orange);box-shadow:0 0 0 3px rgba(242,155,9,.15)}
/* Paniers : composition */
.paniers-compo{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,420px),1fr));gap:12px;margin-top:14px}
.panier-compo{border:1px solid var(--line);border-radius:12px;padding:12px}.panier-compo.hors-vente{opacity:.65}
.pc-tete{display:flex;gap:10px;align-items:center;margin-bottom:6px}.pc-nom{font-weight:700!important}.pc-prix{white-space:nowrap;color:var(--leaf);font-weight:700;font-size:14px}
table.pc-lignes td{padding:4px 3px;border:0}table.pc-lignes th{padding:4px 3px}table.pc-lignes input.court{width:56px;text-align:center}table.pc-lignes select{min-width:120px;padding:8px}
.pc-apercu{font-size:12.5px;color:var(--muted);margin-top:6px}
.pc-nouveau{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:14px}.pc-nouveau input[type=text]:not(.court){flex:1;min-width:200px}
/* Fil d'Ariane et bouton Accueil (petite maison) */
.fil{display:flex;align-items:center;gap:8px;font-size:13.5px;color:var(--muted);margin-bottom:-6px;min-width:0}
.fil .maison{display:inline-flex;align-items:center;gap:6px;background:#fff;border:1px solid var(--line);border-radius:999px;padding:6px 12px 6px 10px;color:var(--green);font-weight:600;text-decoration:none}
.fil .maison:hover{background:var(--mint)}.fil-sep{opacity:.6}.fil-ici{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* Responsive : les grilles ne débordent jamais de l'écran ; les grands tableaux défilent dans leur cadre */
.grid2>*,.grid3>*,.split>*,.kpis>*{min-width:0}
.box.flush{overflow-x:auto}
@media (max-width:820px){
  .grid2,.grid3,.split{grid-template-columns:minmax(0,1fr)}
  .qr-box{grid-template-columns:72px minmax(0,1fr)}.qr-box img{width:72px;height:72px}
  .periode{justify-content:flex-start}.exports{justify-content:flex-start}
  .exports .btn,.qr-actions .btn{flex:1 1 auto;justify-content:center}
  .fil{margin-bottom:-4px}
  table.chiffres{font-size:12.5px}table.chiffres td,table.chiffres th{padding:7px 5px}
  .main{gap:12px}
}
.box:not([data-verrou]){overflow-x:auto}
.xl span{min-width:0;overflow:hidden;white-space:nowrap}
@media (max-width:820px){input.court{width:84px}.xl.serre span:nth-child(odd){visibility:hidden}}
/* Détail de commande : ce que la préparation met dans le panier (ligne pleine largeur) */
tr.compo-ligne td{padding-top:0;border-top:0}
.compo-cmd{background:#F4F8EE;border:1px solid #DCE8CC;border-radius:10px;padding:8px 12px;font-size:13px}
.compo-cmd ul{margin:4px 0 0;padding-left:18px}.compo-cmd li{margin:2px 0}.compo-cmd li.manque{color:#9A4A00;font-weight:600}
.canal-site{display:inline-block;margin-left:4px;padding:1px 7px;border-radius:999px;background:#E6F0FA;color:#14507A;font-size:11px;font-weight:700;vertical-align:1px}
.tp-lignes{width:100%;table-layout:fixed}.tp-lignes input{width:100%}.tp-lignes input.court{width:100%;max-width:140px}
.tp-lignes td input.court{width:100%!important;max-width:none!important}
/* Réglages : sommaire, grands groupes et couleur par groupe pour se repérer */
.reg-nav{position:sticky;top:0;z-index:5;display:flex;flex-wrap:wrap;gap:8px;padding:10px 0 12px;margin:-4px 0 6px;background:var(--bg,#F3F4EF)}
.reg-nav a{padding:7px 13px;border-radius:999px;border:1px solid var(--line);background:#fff;font-size:13px;font-weight:600;color:var(--ink,#1B1D19);text-decoration:none;display:inline-flex;align-items:center;gap:7px}
.reg-nav a::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--c)}
.reg-nav a:hover{border-color:var(--c)}
.reg-aide{margin:0 0 6px;color:var(--muted);font-size:13.5px}
.g1{--c:#2F6B12}.g2{--c:#D98A00}.g3{--c:#14507A}.g0{--c:#7A7F73}
.reg-groupe{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px;margin:30px 0 12px;font-size:19px;scroll-margin-top:64px}
.reg-groupe span{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--c);color:#fff;font-size:14px;align-self:center}
.reg-groupe small{flex-basis:100%;padding-left:40px;color:var(--muted);font-size:13px;font-weight:500}
.box.reg-g1,.box.reg-g2,.box.reg-g3,.box.reg-g0{border-top:4px solid var(--c);scroll-margin-top:64px}
.reg-g1{--c:#2F6B12}.reg-g2{--c:#D98A00}.reg-g3{--c:#14507A}.reg-g0{--c:#B9BDB2}
.reg-g1>h2,.reg-g2>h2,.reg-g3>h2{font-size:17px}
/* Paniers : la colonne « Élément » prend la place */
.pc-lignes{width:100%;table-layout:fixed}.pc-lignes th:nth-child(1),.pc-lignes td:nth-child(1){width:52px}.pc-lignes th:nth-child(2),.pc-lignes td:nth-child(2){width:38%}
.pc-lignes select,.pc-lignes input{width:100%;min-width:0}
@media (max-width:720px){.reg-nav{overflow-x:auto;flex-wrap:nowrap;margin-left:-4px;margin-right:-4px;padding-left:4px}.reg-nav a{flex:none}}
.avis-liste td{font-size:13.5px;vertical-align:top}@media (min-width:821px){.avis-liste td:nth-child(8){min-width:200px}}@media (max-width:820px){.avis-liste td{text-align:right}}
select.paiement-requis{border:2px solid var(--orange);border-radius:8px;padding:7px 8px;font:inherit;font-size:14px;background:#fff;min-height:40px}
select.paiement-requis:valid{border-color:var(--leaf)}
.toast.alarme.arrivee{background:#1B5A9A;color:#fff}
