:root {
  --fond: #f6f5f3;
  --carte: #ffffff;
  --texte: #23201d;
  --doux: #6b655e;
  --trait: #e2ded8;
  --vin: #7a1f2b;
  --vin-clair: #f4e9ea;
  --vert: #2f6b3a;
  --vert-clair: #e6f1e7;
  --orange: #94570d;
  --orange-clair: #fbf0df;
  --bleu: #24527a;
  --bleu-clair: #e6eef6;
  --rouge: #a3261d;
  --rayon: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--vin); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 650; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.bandeau-demo { background: #3a3530; color: #f3efe9; text-align: center; font-size: .78rem; padding: 3px 8px; letter-spacing: .02em; }
.entete { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; background: var(--carte); border-bottom: 1px solid var(--trait); padding: .55rem 16px; position: sticky; top: 0; z-index: 5; }
.marque { font-weight: 700; color: var(--vin); text-decoration: none; font-size: 1.05rem; margin-right: auto; }
.menu { display: flex; flex-wrap: wrap; gap: .15rem; }
.menu a { text-decoration: none; color: var(--texte); padding: .35rem .6rem; border-radius: 6px; font-size: .95rem; }
.menu a:hover { background: var(--fond); }
.menu a.actif { background: var(--vin-clair); color: var(--vin); font-weight: 600; }
.menu a.sortir { color: var(--doux); }
.menu-bouton { display: none; }
.page { padding: 1.2rem 16px 2rem; width: 100%; }
.pied { padding: 1rem 16px 2rem; color: var(--doux); font-size: .88rem; }
.pied a { color: var(--doux); }
.flash { background: var(--vert-clair); color: var(--vert); padding: .6rem .9rem; border-radius: var(--rayon); }
.erreur { background: #fbe7e5; color: var(--rouge); padding: .6rem .9rem; border-radius: var(--rayon); }
.note { color: var(--doux); font-size: .9rem; }
.vide { color: var(--doux); font-style: italic; }

/* Accueil */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 1rem; }
.tuile { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem 1.1rem; display: flex; flex-direction: column; }
.tuile h2 { margin: 0 0 .2rem; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.tuile .compte { font-size: 1.6rem; font-weight: 700; color: var(--vin); }
.tuile ul { list-style: none; margin: .4rem 0 .6rem; padding: 0; }
.tuile li { padding: .38rem 0; border-top: 1px solid var(--trait); display: flex; justify-content: space-between; gap: .75rem; }
.tuile li span:last-child { text-align: right; white-space: nowrap; color: var(--doux); }
.tuile .suite { margin-top: auto; }

/* Tableaux */
.table-wrap { width: 100%; overflow-x: auto; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: .5rem .65rem; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: top; }
th { background: #faf9f7; font-weight: 600; white-space: nowrap; font-size: .85rem; color: var(--doux); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fcfbfa; }
tfoot td { font-weight: 650; background: #faf9f7; }
.nowrap { white-space: nowrap; }

/* Statuts */
.statut { display: inline-block; padding: .08rem .5rem; border-radius: 99px; font-size: .82rem; white-space: nowrap; background: var(--fond); }
.s-a_commander { background: var(--orange-clair); color: var(--orange); }
.s-commandee { background: var(--bleu-clair); color: var(--bleu); }
.s-enlevee { background: var(--vin-clair); color: var(--vin); }
.s-facturee { background: var(--vert-clair); color: var(--vert); }
.s-annulee { color: var(--doux); text-decoration: line-through; }
.s-avoir { background: #eee; color: #444; }
.s-retard { background: #fbe7e5; color: var(--rouge); }

/* Formulaires */
form.ligne { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin: 0 0 1rem; }
label { display: block; font-size: .88rem; color: var(--doux); margin-bottom: .2rem; }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid #cfc9c1; border-radius: 6px; background: #fff; color: var(--texte); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--vin); outline-offset: 0; border-color: var(--vin); }
textarea { width: 100%; min-height: 4.5rem; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .8rem 1rem; margin-bottom: 1rem; }
.champs input, .champs select { width: 100%; }
.case { display: flex; gap: .5rem; align-items: center; color: var(--texte); font-size: .95rem; }
.case input { width: auto; }
button, .bouton { font: inherit; display: inline-block; padding: .5rem .95rem; border-radius: 6px; border: 1px solid var(--vin); background: var(--vin); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.3; }
button.second, .bouton.second { background: #fff; color: var(--vin); }
button.discret, .bouton.discret { background: transparent; border-color: transparent; color: var(--doux); text-decoration: underline; padding-left: .3rem; padding-right: .3rem; }
button.danger { background: #fff; color: var(--rouge); border-color: var(--rouge); }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1rem 0; }
.actions form { margin: 0; }
.bloc { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.deux { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; }
.filtres { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.filtres a { text-decoration: none; padding: .3rem .7rem; border-radius: 99px; border: 1px solid var(--trait); background: var(--carte); color: var(--texte); font-size: .9rem; }
.filtres a.actif { background: var(--vin); border-color: var(--vin); color: #fff; }
.chiffres { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: .2rem 0 1rem; }
.chiffres div { min-width: 8rem; }
.chiffres strong { display: block; font-size: 1.25rem; }
.chiffres span { color: var(--doux); font-size: .88rem; }

/* Saisie de commande */
#lignes td { vertical-align: middle; }
#lignes input[type=number] { width: 6.5rem; }
#lignes select { width: 100%; min-width: 16rem; }
.total-commande { font-size: 1.1rem; font-weight: 650; }

/* Connexion */
.connexion { max-width: 380px; margin: 8vh auto; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.5rem; }
.connexion h1 { color: var(--vin); }
.connexion input { width: 100%; font-size: 1.1rem; letter-spacing: .05em; }
.connexion button { width: 100%; margin-top: .8rem; }

@media (max-width: 760px) {
  .menu-bouton { display: inline-block; background: #fff; color: var(--texte); border-color: var(--trait); padding: .35rem .7rem; }
  .menu { display: none; width: 100%; flex-direction: column; padding-top: .3rem; }
  .menu.ouvert { display: flex; }
  .menu a { padding: .6rem .5rem; border-top: 1px solid var(--trait); border-radius: 0; }
  h1 { font-size: 1.3rem; }
  #lignes thead { display: none; }
  #lignes tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; padding: .6rem .7rem; border-bottom: 1px solid var(--trait); }
  #lignes td { display: block; border: 0; padding: 0; }
  #lignes td:first-child { grid-column: 1 / -1; }
  #lignes select { min-width: 0; }
  #lignes input[type=number], #lignes .pu { width: 100%; }
  #lignes .montant { align-self: center; text-align: left; }
  #lignes td:last-child { text-align: right; }
  table.empile thead { display: none; }
  table.empile, table.empile tbody, table.empile tfoot, table.empile tr, table.empile td { display: block; width: 100%; }
  table.empile tr { padding: .45rem .7rem; border-bottom: 1px solid var(--trait); }
  table.empile tr:last-child { border-bottom: 0; }
  table.empile td { border: 0; padding: .12rem 0; text-align: left; white-space: normal; }
  table.empile td[data-titre] { display: flex; justify-content: space-between; gap: 1rem; }
  table.empile td[data-titre]::before { content: attr(data-titre); color: var(--doux); font-size: .85rem; flex: 0 0 auto; }
  table.empile td[data-titre] > * { text-align: right; }
  table.empile td.num { text-align: right; }
  table.empile td:empty { display: none; }
  .page { padding-top: 1rem; }
}
@media print {
  .entete, .pied, .bandeau-demo, .actions, form { display: none !important; }
  body { background: #fff; }
  .table-wrap { border: 0; }
}
