/* ============================================================
   Calculateur de calories — feuille de style
   Mobile-first, thème clair/sombre automatique.
   ============================================================ */

:root {
  --bg: #f5f7f6;
  --bg-panel: #ffffff;
  --bg-soft: #eef2f0;
  --bg-hover: #e6ece9;
  --text: #16211c;
  --text-muted: #5c6b64;
  --border: #dde5e1;
  --accent: #16815a;
  --accent-strong: #0f6244;
  --accent-soft: #e3f3ec;
  --prot: #3b7dd8;
  --carb: #e0a12a;
  --fat: #d6604a;
  --danger: #c0392b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 33, 27, .06), 0 8px 24px rgba(16, 33, 27, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --bg-panel: #171e1a;
    --bg-soft: #1e2723;
    --bg-hover: #263029;
    --text: #e8efeb;
    --text-muted: #9aa8a1;
    --border: #2b3833;
    --accent: #35b184;
    --accent-strong: #4ecb9c;
    --accent-soft: #17332a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

/* Une règle de classe portant `display` l'emporte sur le `display:none` que le
   navigateur applique à [hidden] : sans ceci, le dialogue resterait affiché. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  /* Marges de sécurité pour les écrans à encoche, en orientation portrait
     comme paysage (viewport-fit=cover est déclaré dans index.html). */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* iOS Safari zoome automatiquement sur tout champ dont le texte fait moins de
   16 px. Cette taille plancher est donc une contrainte fonctionnelle, pas
   esthétique : la réduire réintroduirait le zoom intempestif à la saisie. */
input, select, textarea, button { font-family: inherit; }
input, select, textarea { font-size: 1rem; }

/* Supprime le délai de 300 ms et le zoom au double-tap sur les commandes. */
button, .result, .portion-btn, .step-btn, label { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; }

h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }

a { color: var(--accent-strong); }

/* Gouttières qui s'élargissent avec l'écran, sans média query. */
.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 24px);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------ En-tête */

.app-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { font-size: 1.5rem; line-height: 1; flex: none; }
.brand-sub {
  margin: 2px 0 0;
  font-size: .74rem;
  color: var(--text-muted);
}

.header-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  white-space: nowrap;
  flex: none;
}
.header-total-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.header-total-value { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

/* Sur les petits écrans, le sous-titre et le libellé du total sont du confort :
   on les sacrifie pour garder titre et total sur une seule ligne. */
@media (max-width: 480px) {
  h1 { font-size: 1rem; }
  .brand-sub { display: none; }
  .brand-mark { font-size: 1.3rem; }
  .header-total { padding: 4px 10px; }
  .header-total-label { font-size: .6rem; }
  .header-total-value { font-size: .95rem; }
}

/* ------------------------------------------------------------ Layout */

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 2.5vw, 20px);
  padding-top: 16px;
  padding-bottom: 24px;
  align-items: start;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(14px, 3vw, 20px);
}
.panel > h2 { margin-bottom: 12px; }

/* --- Tablette portrait (≥ 600 px) : une colonne, mais on retrouve le tableau
       complet et les listes sur deux colonnes. -------------------------- */
@media (min-width: 600px) {
  h1 { font-size: 1.25rem; }
  .results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Tablette paysage et ordinateur (≥ 900 px) : deux colonnes. -------- */
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .results { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
}

/* La colonne de recherche ne suit le défilement que si elle a la place de
   tenir à l'écran, sinon elle emprisonnerait ses propres résultats. */
@media (min-width: 900px) and (min-height: 640px) {
  .search-panel { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
}

@media (min-width: 1280px) {
  .layout { gap: 24px; padding-top: 22px; }
}

/* ------------------------------------------------------------ Recherche */

.search-box { position: relative; display: flex; }

.search-input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
}
.search-input:focus-visible,
.select:focus-visible,
.weight-input:focus-visible,
.meal-name:focus-visible,
input[type="number"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search-input::-webkit-search-cancel-button { display: none; }

.icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 10px;
}

.source-toggle { border: 0; margin: 0; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.chk small { color: var(--text-muted); }

.select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  max-width: 100%;
  flex: 1 1 180px;
  min-width: 0;
}

.status {
  margin: 10px 0 0;
  font-size: .82rem;
  color: var(--text-muted);
  min-height: 1.2em;
}
.status.error { color: var(--danger); }

/* ------------------------------------------------------------ Résultats */

.results { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.results:empty { margin: 0; }

.result {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}
.result:hover { background: var(--bg-hover); }
.result:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.result-name { font-weight: 600; font-size: .92rem; }
.result-kcal {
  grid-row: span 2;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
  white-space: nowrap;
  font-size: .95rem;
}
.result-kcal small { display: block; font-weight: 400; font-size: .66rem; color: var(--text-muted); }
.result-meta {
  font-size: .74rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-block;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  white-space: nowrap;
}
.badge-ciqual { color: var(--accent-strong); border-color: var(--accent); }
.badge-off { color: var(--prot); border-color: var(--prot); }
.badge-est { color: var(--carb); border-color: var(--carb); }

.results-compact .result { padding: 8px 10px; }

.favorites { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }

/* ------------------------------------------------------------ Repas */

.meal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.meal-name {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  flex: 0 1 200px;
  min-width: 0;
}

.empty {
  margin: 0;
  padding: 18px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .86rem;
  text-align: center;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.meal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.meal-table th,
.meal-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.meal-table th {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.meal-table .num { text-align: right; }
.meal-table td.num { font-variant-numeric: tabular-nums; }
.meal-table tr:last-child td { border-bottom: 0; }

.cell-name { font-weight: 600; }
.cell-sub { display: block; font-weight: 400; font-size: .72rem; color: var(--text-muted); }

.weight-cell {
  width: 82px;
  text-align: right;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.weight-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.weight-cell.invalid { border-color: var(--danger); }

.cell-kcal { font-weight: 700; color: var(--accent-strong); }
/* En mode tableau l'unité est portée par l'en-tête de colonne ; elle ne
   réapparaît qu'en mode cartes, où cet en-tête n'existe plus. */
.cell-unit { display: none; }

.row-remove {
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1;
}
.row-remove:hover { background: var(--bg-hover); color: var(--danger); }
.row-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- Mobile : le tableau devient une pile de cartes ---------------------
   Un tableau à 7 colonnes ne tient pas sous 600 px. Plutôt que de le faire
   défiler horizontalement ou de masquer les macros, chaque ligne devient une
   carte dont les cellules affichent leur intitulé (data-label) : aucune
   information n'est perdue et rien ne déborde. -------------------------- */
@media (max-width: 599px) {
  .meal-table, .meal-table tbody, .meal-table tr, .meal-table td { display: block; }
  .meal-table thead { display: none; }

  .meal-table tr {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  .meal-table tr:last-child { margin-bottom: 0; }

  .meal-table td {
    border-bottom: 0;
    padding: 3px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    text-align: right;
  }

  /* `margin-right: auto` sur l'intitulé plutôt que `space-between` sur la
     cellule : sinon la valeur et son unité sont renvoyées chacune à un bord. */
  .meal-table td[data-label]::before {
    content: attr(data-label);
    font-size: .78rem;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
    margin-right: auto;
    padding-right: 12px;
  }

  /* Le nom occupe toute la largeur de la carte, en tête. */
  .meal-table td:first-child {
    display: block;
    text-align: left;
    padding-right: 40px;
    margin-bottom: 6px;
  }

  .meal-table .cell-unit { display: inline; color: var(--text-muted); font-size: .82rem; }
  .meal-table .cell-kcal .cell-value { font-size: 1.1rem; }

  /* Le bouton de suppression se cale dans le coin de la carte. */
  .meal-table .cell-actions { position: absolute; top: 6px; right: 6px; padding: 0; }
}

/* ------------------------------------------------------------ Totaux */

.totals {
  margin-top: 14px;
  padding: 14px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.total-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.total-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.total-kcal {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.total-kcal .unit { font-size: .95rem; font-weight: 600; }

.total-macros {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 0;
  font-size: .82rem;
}
.total-macros div { display: flex; gap: 5px; }
.total-macros dt { color: var(--text-muted); }
.total-macros dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.macro-bar {
  display: flex;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--border);
}
.macro-bar .seg { display: block; height: 100%; transition: width .2s ease; }
.seg-prot { background: var(--prot); }
.seg-carb { background: var(--carb); }
.seg-fat { background: var(--fat); }

.note { margin: 8px 0 0; font-size: .76rem; color: var(--text-muted); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1 1 auto; }

/* Sous 420 px, trois boutons côte à côte deviennent illisibles : l'action
   principale prend toute la largeur, les deux autres se partagent la suivante. */
@media (max-width: 420px) {
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions .btn-primary { grid-column: 1 / -1; }
}

.btn {
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { background: var(--bg-hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------ Journée */

.day { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.goal { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); }
.goal input {
  width: 84px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text);
  text-align: right;
}

.day-total { margin: 10px 0 0; font-size: .9rem; }
.day-total output { font-weight: 700; font-size: 1.15rem; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.day-remaining { color: var(--text-muted); font-size: .82rem; }
.day-remaining.over { color: var(--fat); font-weight: 600; }

.goal-bar {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.goal-fill { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.goal-fill.over { background: var(--fat); }

.history { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.history li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .84rem;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.history .h-name { font-weight: 600; }
.history .h-time { color: var(--text-muted); font-size: .74rem; }
.history .h-kcal { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-strong); white-space: nowrap; }
.history .h-btn {
  background: none; border: 0; cursor: pointer;
  color: var(--text-muted); padding: 4px 6px; border-radius: 6px; font-size: .9rem; line-height: 1;
}
.history .h-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ------------------------------------------------------------ Dialogue d'ajout */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 14, .5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
}
@media (min-width: 640px) {
  .dialog-backdrop { align-items: center; padding: 20px; }
}

.dialog {
  position: relative;
  background: var(--bg-panel);
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius) var(--radius) 0 0;
  /* Pas de padding bas : c'est la barre d'actions collante qui le porte. */
  padding: 20px 18px 0;
  box-shadow: var(--shadow);
  /* dvh suit la barre d'adresse mobile, contrairement à vh. */
  max-height: 90dvh;
  overflow-y: auto;
}
@media (min-width: 640px) {
  .dialog { border-radius: var(--radius); max-height: 88dvh; }
}

.dialog-close { top: 14px; right: 10px; transform: none; }
.dialog-title { font-size: 1.05rem; padding-right: 32px; }
.dialog-meta { margin: 4px 0 0; font-size: .78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.per100 {
  margin: 14px 0;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}
.per100 strong { color: var(--accent-strong); }
.muted { color: var(--text-muted); font-size: .78rem; }

.weight-label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; }

.weight-row { display: flex; gap: 8px; align-items: stretch; }

.step-btn {
  font: inherit;
  font-size: 1.2rem;
  width: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
}
.step-btn:hover { background: var(--bg-hover); }
.step-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.weight-input {
  flex: 1;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.weight-input.invalid { border-color: var(--danger); }

.portions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.portion-btn {
  font: inherit;
  font-size: .76rem;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: pointer;
}
.portion-btn:hover { background: var(--bg-hover); color: var(--text); }
.portion-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.preview {
  margin-top: 14px;
  padding: 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  text-align: center;
}
.preview-kcal {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.preview-kcal .unit { font-size: .9rem; }
.preview-macros {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Barre d'actions collante : en paysage sur téléphone, le dialogue défile et
   « Ajouter au repas » se retrouverait sous la ligne de flottaison. */
.dialog-actions {
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg-panel);
  padding: 12px 0 calc(18px + env(safe-area-inset-bottom));
  margin-top: 2px;
}
.dialog-actions .btn-primary { flex: 1; }
.btn-fav-on { color: var(--carb); border-color: var(--carb); }

/* ------------------------------------------------------------ Écrans tactiles

   WCAG 2.5.5 : viser 44 px de cible. Déclenché par un pointeur grossier (doigt)
   OU par un écran étroit — se fier au seul `pointer: coarse` laisserait des
   cibles minuscules sur les appareils qui déclarent mal leur pointeur. */

@media (pointer: coarse), (max-width: 599px) {
  .row-remove, .h-btn, .icon-btn { min-width: 44px; min-height: 44px; }
  .step-btn { min-height: 48px; }
  .btn { padding: 12px 16px; min-height: 44px; }
  .portion-btn { padding: 9px 14px; min-height: 40px; }
  .chk { padding: 4px 0; min-height: 32px; }
  .chk input { width: 20px; height: 20px; }
  .result { padding: 12px; }
}

/* Téléphone en paysage : très peu de hauteur, on récupère de la place. */
@media (max-height: 480px) and (orientation: landscape) {
  .app-header { position: static; }
  .dialog-backdrop { align-items: stretch; }
  .dialog { max-height: 100dvh; border-radius: 0; }
}

/* ------------------------------------------------------------ Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-panel);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: .86rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 80;
  max-width: calc(100vw - 32px);
  text-align: center;
}

/* ------------------------------------------------------------ Pied de page */

.app-footer {
  padding-bottom: 28px;
  font-size: .76rem;
  color: var(--text-muted);
}
.app-footer p { margin: 0; }

/* ------------------------------------------------------------ Impression */

@media print {
  .app-header, .search-panel, .actions, .day, .app-footer,
  .dialog-backdrop, .toast, .row-remove, .cell-actions,
  .meal-head .meal-name { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  .layout { display: block; padding: 0; }
  .totals { background: none; border: 1px solid #999; }
  .weight-cell { border: 0; background: none; padding: 0; width: auto; }

  /* Une fenêtre étroite déclencherait la mise en cartes : on rétablit le
     tableau, seule forme lisible sur une feuille A4. */
  .meal-table { display: table; }
  .meal-table thead { display: table-header-group; }
  .meal-table tbody { display: table-row-group; }
  .meal-table tr { display: table-row; border: 0; padding: 0; margin: 0; }
  .meal-table td, .meal-table .opt { display: table-cell; text-align: left; padding: 6px 4px; }
  .meal-table .num { text-align: right; }
  .meal-table td[data-label]::before { content: none; }
  .meal-table td:first-child { padding-right: 4px; margin-bottom: 0; }
  .cell-unit { display: none !important; }
}
