/* =========================================================================
   Qartly — espace restaurateur
   Sobre, aere, pense pour le pouce. Polices systeme uniquement :
   aucune requete reseau pour afficher du texte.
   ========================================================================= */

:root {
  /* neutres legerement chauds : moins clinique qu'un gris pur */
  --encre:      #17181a;
  --encre-doux: #5d6168;
  --encre-pale: #8f949c;
  --fond:       #f6f7f6;
  --surface:    #ffffff;
  --surface-2:  #f1f3f1;
  --trait:      #e7e9e7;
  --trait-fort: #d3d7d4;

  --vert:       #2d6a4f;
  --vert-fonce: #22543d;
  --vert-pale:  #eaf3ee;
  --or:         #a9791c;
  --or-pale:    #fcf4e4;
  --rouge:      #a3342a;
  --rouge-pale: #fcedeb;

  --r: 12px;
  --r-sm: 9px;
  --r-pill: 999px;

  /* ombres basses et diffuses : elles suggerent l'elevation sans salir */
  --ombre-1: 0 1px 2px rgba(23, 24, 26, .05);
  --ombre-2: 0 1px 3px rgba(23, 24, 26, .06), 0 6px 16px -6px rgba(23, 24, 26, .10);
  --ombre-3: 0 14px 36px -10px rgba(23, 24, 26, .22), 0 2px 8px rgba(23, 24, 26, .06);

  --t: .16s cubic-bezier(.4, 0, .2, 1);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --barre-h: 60px;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
/* « clip » coupe le debordement sans faire du body un conteneur de
   defilement : l'en-tete collant reste colle et la page defile normalement */
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* rien ne doit sortir de son cadre, mais sans couper les mots lettre par lettre.
   « break-word » ne coupe un mot que s'il deborde vraiment, alors que
   « anywhere » laissait le navigateur ecraser une colonne de tableau a une
   lettre de large (le « O-u-v-r-i-r » vertical). */
h1, h2, h3, p, td, th, label, strong, summary, li, a, .mono, code { overflow-wrap: break-word; }
img, svg, video { max-width: 100%; height: auto; }

a { color: var(--vert); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .45em; font-weight: 620; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 1em; max-width: 70ch; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--encre-doux); }
.small { font-size: .87rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; }
.stack > * + * { margin-top: 12px; }

/* -------------------------------------------------------------------------
   En-tete
   ------------------------------------------------------------------------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--trait);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  padding-inline: max(18px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 24px; min-height: 58px;
}
.brand { font-weight: 650; color: var(--encre); font-size: 1.02rem; letter-spacing: -.02em; flex: none; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--vert); }

.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--encre-doux); font-size: .92rem; font-weight: 500;
  padding: 7px 12px; border-radius: var(--r-pill);
  transition: background var(--t), color var(--t);
}
.topbar nav a:hover { background: var(--surface-2); color: var(--encre); text-decoration: none; }
.topbar nav a.on { background: var(--vert-pale); color: var(--vert-fonce); font-weight: 560; }
.topbar .who { font-size: .84rem; color: var(--encre-pale); white-space: nowrap; }
.topbar .who.email { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.topbar .compte-court { display: none; }
.form-deconnexion { display: inline; margin: 0; }
/* bouton qui a l'apparence d'un lien (la deconnexion doit etre un POST) */
.lien-bouton {
  background: none; border: 0; padding: 0; min-height: 0; box-shadow: none;
  font: inherit; color: inherit; cursor: pointer; text-decoration: none;
}
.lien-bouton:hover { background: none; color: var(--encre); text-decoration: underline; }

/* ecran intermediaire (petit portable, tablette) : on retire l'email
   avant que la navigation ne soit a l'etroit */
@media (max-width: 1000px) {
  .topbar .who.email { display: none; }
  .topbar .compte-court { display: inline; }
  .topbar-inner { gap: 14px; }
}

main { max-width: 1080px; margin: 0 auto; padding: 26px 18px 72px; }
.narrow { max-width: 520px; }

/* -------------------------------------------------------------------------
   Blocs
   ------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: var(--r); box-shadow: var(--ombre-1);
  padding: 20px; margin-bottom: 16px;
}
.card > :last-child { margin-bottom: 0; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.card-head > * { min-width: 0; }
.card-head h1, .card-head h2 { margin: 0; }

.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.stat {
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: var(--r); padding: 16px 18px; box-shadow: var(--ombre-1);
}
.stat .val { display: block; font-size: 1.7rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.stat .lab { color: var(--encre-doux); font-size: .84rem; }
.stat .pill { white-space: normal; }

/* bouton sur deux elements (montant + reference) : ils passent l'un sous
   l'autre proprement au lieu de couper la reference en son milieu */
.btn-double { flex-wrap: wrap; column-gap: 10px; row-gap: 2px; }
.btn-double .mono { white-space: nowrap; opacity: .85; font-weight: 500; }

/* -------------------------------------------------------------------------
   Etats et messages
   ------------------------------------------------------------------------- */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: .76rem; font-weight: 560; line-height: 1.5; white-space: nowrap;
}
.pill-ok { background: var(--vert-pale); color: var(--vert-fonce); }
.pill-warn { background: var(--or-pale); color: var(--or); }
.pill-danger { background: var(--rouge-pale); color: var(--rouge); }
.pill-neutral { background: var(--surface-2); color: var(--encre-doux); }

.notice {
  border: 1px solid var(--trait); border-left: 3px solid var(--vert);
  background: var(--vert-pale); color: var(--vert-fonce);
  padding: 14px 16px; margin-bottom: 18px; border-radius: var(--r-sm);
}
.notice.warn { border-left-color: var(--or); background: var(--or-pale); color: #6f4d0c; }
.notice.danger { border-left-color: var(--rouge); background: var(--rouge-pale); color: #7d2419; }
.notice p:last-child { margin-bottom: 0; }
.notice .btn { margin-top: 10px; }

/* Message de confirmation : bandeau flottant qui disparait tout seul.
   Pure animation CSS : il s'efface meme si le JavaScript ne charge pas.
   Il flotte au-dessus de la page, donc sa disparition ne fait pas sauter
   le contenu. Un toucher le ferme immediatement (app.js). */
.flash {
  position: fixed; z-index: 70;
  top: calc(12px + env(safe-area-inset-top)); left: 50%;
  width: max-content; max-width: min(520px, calc(100vw - 24px));
  transform: translateX(-50%);
  padding: 12px 18px; border-radius: var(--r-sm);
  font-size: .91rem; font-weight: 520; line-height: 1.4;
  background: var(--vert-fonce); color: #fff; box-shadow: var(--ombre-3);
  cursor: pointer;
  animation: flash-entree .22s ease-out, flash-sortie .4s ease-in 2.2s forwards;
}
/* une erreur reste plus longtemps : il faut le temps de la lire */
.flash.err { background: var(--rouge); animation: flash-entree .22s ease-out, flash-sortie .4s ease-in 6s forwards; }
.flash.ferme { animation: flash-sortie .2s ease-in forwards; }
@keyframes flash-entree { from { opacity: 0; transform: translate(-50%, -10px); } }
@keyframes flash-sortie {
  to { opacity: 0; transform: translate(-50%, -10px); visibility: hidden; }
}

/* -------------------------------------------------------------------------
   Formulaires
   ------------------------------------------------------------------------- */
label { display: block; font-size: .85rem; font-weight: 520; color: var(--encre-doux); margin-bottom: 5px; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem;
  color: var(--encre); background: var(--surface);
  border: 1px solid var(--trait-fort); border-radius: var(--r-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--vert);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, .14);
}
input::placeholder, textarea::placeholder { color: var(--encre-pale); }

.field { margin-bottom: 15px; }
.field .hint { font-size: .8rem; color: var(--encre-pale); margin-top: 5px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; min-width: 0; }

/* Champ + bouton sur une ligne (changer de formule, valider un recu...).
   Le bouton garde sa taille, le champ prend le reste ; quand la place
   manque, le bouton passe dessous au lieu de sortir du cadre. */
.form-ligne { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 0; }
.form-ligne > .field, .form-ligne > input, .form-ligne > select { flex: 1 1 220px; min-width: 0; margin-bottom: 0; }
.form-ligne > button, .form-ligne > .btn { flex: none; }

/* bouton d'envoi d'un formulaire : jamais colle au champ du dessus */
form > button[type=submit]:not(:first-child),
form > .actions:not(:first-child) { margin-top: 4px; }

.case { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--encre); }
.case input { width: auto; flex: none; accent-color: var(--vert); transform: scale(1.15); }

/* -------------------------------------------------------------------------
   Boutons
   ------------------------------------------------------------------------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: .92rem; font-weight: 550;
  padding: 10px 17px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--vert); background: var(--vert); color: #fff;
  text-align: center; text-decoration: none;
  transition: background var(--t), border-color var(--t), transform var(--t);
}
button:hover, .btn:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); text-decoration: none; }
button:active, .btn:active { transform: scale(.985); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost { background: var(--surface); color: var(--encre); border-color: var(--trait-fort); box-shadow: var(--ombre-1); }
.btn-ghost:hover { background: var(--surface-2); color: var(--encre); border-color: var(--trait-fort); }

.btn-danger { background: var(--surface); color: var(--rouge); border-color: #e3bab4; box-shadow: var(--ombre-1); }
.btn-danger:hover { background: var(--rouge-pale); color: var(--rouge); border-color: #e3bab4; }

.btn-sm { padding: 7px 13px; font-size: .85rem; }
.btn-block { display: flex; width: 100%; }

.btn-chip {
  background: var(--surface-2); color: var(--encre-doux); border-color: transparent;
  border-radius: var(--r-pill); padding: 7px 14px; font-size: .85rem; box-shadow: none;
}
.btn-chip:hover { background: var(--trait); color: var(--encre); border-color: transparent; }
/* choix courant dans une serie de pastilles (periode affichee, filtre actif) */
.btn-chip.on { background: var(--vert-pale); color: var(--vert-fonce); font-weight: 600; }
.btn-chip.on:hover { background: var(--vert-pale); color: var(--vert-fonce); }

/* c'est le gap qui espace les boutons, jamais des marges au coup par coup */
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions > form { margin: 0; }

.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.suggestions button {
  background: var(--surface-2); color: var(--encre-doux); border-color: transparent;
  border-radius: var(--r-pill); padding: 6px 13px; font-size: .84rem; font-weight: 480;
}
.suggestions button:hover { background: var(--vert-pale); color: var(--vert-fonce); border-color: transparent; }

/* -------------------------------------------------------------------------
   Tableaux
   ------------------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
th { font-weight: 560; color: var(--encre-doux); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.mono, td .mono { white-space: nowrap; }
td .btn, td button { white-space: nowrap; }
td.cellule-action { text-align: right; width: 1%; }
td.cellule-action form { margin: 0; }

/* tableau cle / valeur (dates d'abonnement, coordonnees bancaires) */
.table-kv th { width: 42%; }

/* bloc encadre dans une carte (un recu a valider, par exemple) */
.encadre { border: 1px solid var(--trait); border-radius: var(--r-sm); padding: 14px; margin-bottom: 12px; }
.encadre:last-child { margin-bottom: 0; }

.apercu-logo { height: 64px; width: auto; border-radius: var(--r-sm); display: block; }
.apercu-couverture { width: 100%; max-height: 160px; object-fit: cover; border-radius: var(--r-sm); display: block; }
.apercu-image { margin: 0 0 10px; }

/* -------------------------------------------------------------------------
   Carte : sections et plats
   ------------------------------------------------------------------------- */
.section-card {
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: var(--r); box-shadow: var(--ombre-1);
  margin-bottom: 14px; overflow: hidden;
  scroll-margin-top: 76px;   /* l'ancre ne passe pas sous l'en-tete collant */
}
.section-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--trait);
}
.section-head > * { min-width: 0; }
.section-head h2 { margin: 0; flex: 1; }
.section-head form { margin: 0; }

.dish-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; border-bottom: 1px solid var(--fond);
  scroll-margin-top: 76px; transition: background var(--t);
}
.dish-row:last-of-type { border-bottom: none; }
.dish-row:hover { background: var(--fond); }
.dish-row > * { min-width: 0; }
.dish-row img, .dish-row .ph { width: 54px; height: 54px; border-radius: var(--r-sm); flex: none; object-fit: cover; }
.dish-row .ph { background: var(--surface-2); border: 1px dashed var(--trait-fort); }
.dish-row .meta { flex: 1 1 auto; }
.dish-row .meta strong { font-weight: 580; }
.dish-row .meta p {
  font-size: .86rem; color: var(--encre-doux); margin: 2px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dish-row .prix {
  flex: none; margin-inline-start: auto; text-align: end;
  font-variant-numeric: tabular-nums; font-weight: 620; white-space: nowrap;
}
.dish-row.off { opacity: .55; }
.dish-row.off img { filter: grayscale(1); }

.pied-section { padding: 13px 18px; border-top: 1px solid var(--trait); background: var(--fond); }


/* ---- Actions d'une ligne de plat (classes utilisees par les gabarits) ---- */
.dish-actions {
  display: flex; align-items: center; gap: 10px;
  margin-inline-start: auto; flex: none;
}
.dish-actions > form { margin: 0; }
.dish-actions .prix {
  font-variant-numeric: tabular-nums; font-weight: 620; white-space: nowrap;
}

/* interrupteur disponible / epuise : discret quand tout va bien,
   visible quand le plat est retire de la carte */
.status-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); color: var(--encre-doux);
  border: 1px solid var(--trait-fort); box-shadow: var(--ombre-1);
  padding: 7px 13px; font-size: .84rem; font-weight: 520;
  border-radius: var(--r-pill); white-space: nowrap;
}
.status-toggle:hover { background: var(--surface-2); color: var(--encre); border-color: var(--trait-fort); }
.status-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--vert); box-shadow: 0 0 0 3px var(--vert-pale);
}
.status-toggle.is-off { color: var(--rouge); border-color: #e3bab4; background: var(--rouge-pale); }
.status-toggle.is-off .dot { background: var(--rouge); box-shadow: 0 0 0 3px rgba(163, 52, 42, .14); }

.section-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 13px 18px;
  border-top: 1px solid var(--trait); background: var(--fond); }
.cta-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cta-group > form { margin: 0; }

/* -------------------------------------------------------------------------
   Fenetres modales
   Centrees a l'ecran sur toutes les tailles. Positionnement en pourcentage
   et transitions simples : compatible avec tous les navigateurs mobiles.
   ------------------------------------------------------------------------- */
.modal-fond {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17, 19, 18, .45);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}
body.modal-ouverte .modal-fond { opacity: 1; visibility: visible; }
body.modal-ouverte { overflow: hidden; }

.modal {
  position: fixed; z-index: 60;
  top: 50%; left: 50%;
  transform: translate(-50%, -46%) scale(.98);
  width: min(500px, calc(100vw - 28px));
  max-height: min(86vh, 700px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: var(--r); box-shadow: var(--ombre-3);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t), transform var(--t), visibility var(--t);
}
.modal.is-open { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--trait); flex: none;
}
.modal-head h3 { margin: 0; font-size: 1rem; }
.modal-close {
  border: none; background: var(--surface-2); color: var(--encre-doux);
  width: 34px; height: 34px; min-height: 34px; border-radius: 50%;
  font-size: 1.15rem; line-height: 1; padding: 0; flex: none; box-shadow: none;
}
.modal-close:hover { background: var(--trait); color: var(--encre); }
.modal > form, .modal > .modal-corps { padding: 18px; overflow-y: auto; }
.modal > form + form { padding-top: 0; }

/* tiroir discret pour la traduction arabe dans les formulaires */
details.langue-ar > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px;
  font-size: .84rem; font-weight: 500; color: var(--encre-doux);
  padding: 7px 13px; border-radius: var(--r-pill); background: var(--surface-2);
}
details.langue-ar > summary::-webkit-details-marker { display: none; }
details.langue-ar[open] > summary { margin-bottom: 12px; }
details.langue-ar [dir=rtl] { text-align: right; }

/* -------------------------------------------------------------------------
   QR
   ------------------------------------------------------------------------- */
.qr-preview { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.qr-preview > * { min-width: 0; }
.qr-preview img {
  width: 180px; height: 180px; flex: none; background: #fff;
  border: 1px solid var(--trait); border-radius: var(--r-sm); padding: 10px;
}

/* -------------------------------------------------------------------------
   Barre de navigation basse (telephone)
   ------------------------------------------------------------------------- */
.barre-mobile { display: none; }

@media (max-width: 760px) {
  body { font-size: 16px; padding-bottom: calc(var(--barre-h) + env(safe-area-inset-bottom)); }
  main { padding: 16px 13px 24px; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.02rem; }
  .card { padding: 15px; }

  .topbar-inner { min-height: 52px; gap: 10px; }
  .topbar nav { display: none; }
  .topbar .who.email { display: none; }
  .topbar .compte-court { display: inline; }
  /* la deconnexion ne doit pas concurrencer la marque : petite puce discrete */
  .topbar .who {
    margin-inline-start: auto; font-size: .78rem;
    background: var(--surface-2); color: var(--encre-doux);
    padding: 6px 12px; border-radius: var(--r-pill);
  }

  .barre-mobile {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--trait);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -1px 3px rgba(23, 24, 26, .05);
  }
  .barre-mobile a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: var(--barre-h); padding: 6px 2px;
    font-size: .66rem; font-weight: 520; color: var(--encre-pale); text-align: center;
  }
  .barre-mobile a:hover { text-decoration: none; }
  .barre-mobile a.on { color: var(--vert); }
  .barre-mobile svg { width: 21px; height: 21px; }

  /* cibles tactiles confortables sur les champs et les boutons principaux */
  .btn-block, .card > form button[type=submit],
  select, input[type=text], input[type=email], input[type=tel],
  input[type=password], input[type=number] { min-height: 46px; }
  input, select, textarea { font-size: 16px; }   /* sinon iOS zoome au focus */

  /* champ fichier natif : rendu propre plutot que le bouton gris du systeme */
  input[type=file] { padding: 9px 11px; font-size: .88rem; }
  input[type=file]::file-selector-button {
    font: inherit; font-size: .84rem; font-weight: 550;
    margin-inline-end: 10px; padding: 8px 13px;
    border: 1px solid var(--trait-fort); border-radius: var(--r-pill);
    background: var(--surface-2); color: var(--encre);
  }

  .row { flex-direction: column; gap: 12px; }
  .row > * { flex: 1 1 auto; }
  .row > .field { margin-bottom: 0; }
  /* les champs d'une rangee perdent leur marge : c'est la rangee qui la porte,
     sinon le bouton qui suit se colle au dernier champ */
  form .row:not(:last-child) { margin-bottom: 15px; }
  .stack > .row { margin-bottom: 0; }

  .form-ligne { flex-direction: column; align-items: stretch; }
  .form-ligne > .field, .form-ligne > input, .form-ligne > select { flex: none; width: 100%; }
  .form-ligne > button, .form-ligne > .btn { width: 100%; min-height: 46px; }

  /* ---- Une ligne de plat tient en deux lignes compactes ----
     photo + texte, puis prix et actions. Avant, les deux boutons
     s'empilaient en pleine largeur et un plat occupait 400 px. */
  .dish-row {
    display: grid; align-items: center;
    grid-template-columns: 46px minmax(0, 1fr);
    grid-template-areas: "img meta" "act act";
    gap: 9px 12px; padding: 12px 13px;
  }
  .dish-row img, .dish-row .ph { grid-area: img; width: 46px; height: 46px; }
  .dish-row .meta { grid-area: meta; }
  .dish-row .meta strong { font-size: .97rem; }
  .dish-row .meta p { -webkit-line-clamp: 1; font-size: .83rem; }
  .dish-row .prix {
    grid-area: act; margin: 0; text-align: start;
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
    font-size: 1rem;
  }
  .dish-row .prix form { margin: 0; }
  .dish-row .prix form:first-of-type { margin-inline-start: auto; }
  /* boutons d'action compacts : lisibles, mais ils ne mangent plus la ligne */
  .dish-row .prix button, .dish-row .prix .btn {
    min-height: 36px; padding: 7px 12px; font-size: .8rem; white-space: nowrap;
  }


  /* les actions passent sur leur propre ligne, compactes */
  .dish-actions {
    grid-area: act; margin-inline-start: 0; width: 100%;
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  }
  .dish-actions .prix { font-size: 1rem; margin-inline-end: auto; }
  .dish-actions .status-toggle,
  .dish-actions .btn-ghost { min-height: 36px; padding: 7px 11px; font-size: .79rem; }
  .section-actions { padding: 11px 13px; gap: 8px; }
  .section-actions .btn-chip { flex: 1 1 auto; min-height: 42px; }
  .cta-group { width: 100%; }
  .cta-group > * { flex: 1 1 100%; }
  .section-head { padding: 13px; row-gap: 8px; }
  .section-head h2 { flex: 1 1 100%; }
  .pied-section { padding: 11px 13px; }
  .pied-section .btn-chip { min-height: 40px; }

  .card-head { gap: 10px; }
  .card-head .btn { padding: 9px 14px; font-size: .86rem; }

  th, td { padding: 10px 8px; font-size: .87rem; }

  /* ---- Tableaux de liste : une carte par ligne sur telephone ----
     Chaque cellule affiche son intitule (data-label) a gauche et sa valeur
     a droite : plus aucune colonne ecrasee ni texte coupe. */
  .tableau-cartes thead { display: none; }
  .tableau-cartes, .tableau-cartes tbody, .tableau-cartes tr, .tableau-cartes td { display: block; width: 100%; }
  .tableau-cartes tr {
    border: 1px solid var(--trait); border-radius: var(--r-sm);
    padding: 2px 13px; margin-bottom: 10px; background: var(--surface);
  }
  .tableau-cartes tr:last-child { margin-bottom: 0; }
  .tableau-cartes td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-bottom: 1px solid var(--fond); text-align: right;
    white-space: normal;
  }
  .tableau-cartes tr td:last-child { border-bottom: none; }
  .tableau-cartes td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-size: .74rem; font-weight: 560; color: var(--encre-doux);
    text-transform: uppercase; letter-spacing: .04em;
  }
  .tableau-cartes td:not([data-label])::before { display: none; }
  .tableau-cartes td.masque-mobile { display: none; }
  .tableau-cartes td.cellule-action { width: 100%; justify-content: flex-end; padding-top: 10px; }
  .tableau-cartes td.cellule-action form, .tableau-cartes td.cellule-action .btn,
  .tableau-cartes td.cellule-action button { flex: 1 1 auto; width: 100%; min-height: 42px; }
  .tableau-cartes td.vide { display: block; text-align: left; }
  .tableau-cartes td.mono { white-space: normal; overflow-wrap: anywhere; }

  /* tableau cle / valeur : sur telephone la colonne de gauche prend moins de
     place et une reference longue passe a la ligne plutot que de deborder */
  .table-kv th { width: 38%; white-space: normal; }
  .table-kv td.mono, .table-kv td .mono { white-space: normal; overflow-wrap: anywhere; }
  .stat { padding: 14px 15px; }
  .stat .val { font-size: 1.4rem; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .modal { width: calc(100vw - 24px); max-height: 88vh; }
  .modal > form, .modal > .modal-corps { padding: 16px; }
  .modal button[type=submit] { width: 100%; min-height: 46px; }
  .modal-close { min-height: 38px; width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, .modal, .modal-fond {
    transition-duration: .001ms !important; animation-duration: .001ms !important;
  }
}


/* ---- Mise a jour partielle (app.js) ---- */
/* bouton d'un formulaire en cours d'envoi (photo en cours de televersement...) */
button.en-cours { opacity: .65; cursor: progress; position: relative; }
button.en-cours::after {
  content: ""; display: inline-block; width: .9em; height: .9em; margin-left: .5em;
  vertical-align: -.1em; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: tourne .7s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* element qui vient d'etre ajoute ou modifie : bref surlignage */
.vient-de-changer { animation: surligne 1.8s ease-out; }
@keyframes surligne {
  0%, 35% { background-color: var(--vert-pale); box-shadow: 0 0 0 3px var(--vert-pale); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 transparent; }
}

.ajout-section-bas { margin: 4px 0 20px; justify-content: center; }
