/* Santé · charte « craie, sapin, balise ».
   Bricolage Grotesque pour les mots, DM Mono pour les chiffres et les capitales.
   Le jaune balise ne sert que de fond (badges, bouton principal, mot surligné), jamais de couleur de texte.
   Une seule « trace » (pointillés qui relient les repas) par écran. */
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/static/fonts/BricolageGrotesque-400-800-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/static/fonts/BricolageGrotesque-400-800-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/DMMono-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/DMMono-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/DMMono-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/DMMono-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root, [data-theme="jour"] {
  --craie: #f3eee4;
  --craie2: #e6ddcc;
  --ink: #17201b;
  --muted: #59625b;
  --sapin: #1e4d3a;
  --sapin-ink: #1e4d3a;
  --on-sapin: #f3eee4;
  --balise: #ffc21a;
  --on-balise: #17201b;
  --brique: #c44a26;
  --line: rgba(23, 32, 27, .14);
  --soft: rgba(23, 32, 27, .06);
  --on-sapin-line: rgba(243, 238, 228, .3);
  --on-sapin-dots: rgba(243, 238, 228, .45);
  --sans: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="jour"]) {
    --craie: #121a15; --craie2: #1d2820; --ink: #f3eee4; --muted: #a9b2ab;
    --sapin: #2f6b52; --sapin-ink: #8cc7a8; --brique: #ef7a55;
    --line: rgba(243, 238, 228, .12); --soft: rgba(243, 238, 228, .05);
    color-scheme: dark;
  }
}
[data-theme="nuit"] {
  --craie: #121a15; --craie2: #1d2820; --ink: #f3eee4; --muted: #a9b2ab;
  --sapin: #2f6b52; --sapin-ink: #8cc7a8; --brique: #ef7a55;
  --line: rgba(243, 238, 228, .12); --soft: rgba(243, 238, 228, .05);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; background: var(--craie); color: var(--ink); font: 17px/1.45 var(--sans); }
a { color: inherit; }
a:hover { opacity: .8; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--balise); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Typographie --------------------------------------------------------- */
.mono { font-family: var(--mono); }
.caps { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.muted { color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hero { margin: 0; font-size: 96px; line-height: .92; font-weight: 800; letter-spacing: -.03em; color: var(--sapin-ink); text-wrap: balance; }
.h2 { margin: 0; font-size: 56px; line-height: .95; font-weight: 800; letter-spacing: -.015em; color: var(--sapin-ink); }
.h3 { margin: 0; font-size: 28px; line-height: 1.05; font-weight: 700; }
.mark { background: var(--balise); color: var(--on-balise); padding: 0 12px; border-radius: 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.lead { margin: 0; max-width: 620px; font-size: 19px; color: var(--muted); }
.err { color: var(--brique); margin: 0; }
.ok { color: var(--sapin-ink); margin: 0; }

/* --- Mise en page --------------------------------------------------------- */
.shell { max-width: 1280px; margin: 0 auto; padding-inline: 32px; }
.page { padding-block: 48px 96px; display: flex; flex-direction: column; gap: 48px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.between.end { align-items: flex-end; }
.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.s7 { grid-column: span 7; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; } .s12 { grid-column: span 12; }
.cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cells3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cells-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; }
.scroll { overflow-x: auto; }

/* --- En-tête --------------------------------------------------------------- */
.top { border-bottom: 1px solid var(--line); }
.top .shell { padding-block: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.avatar { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; box-shadow: 0 0 0 2px var(--craie), 0 0 0 4px var(--balise); flex-shrink: 0; }
.avatar.lg { width: 72px; height: 72px; }
.brand-name { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--sapin-ink); }
.brand-sub { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tab { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: 16px; }
.tab::after { content: attr(data-label); font-weight: 700; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; }
.tab[aria-current="page"] { background: var(--sapin); color: var(--on-sapin); font-weight: 700; }
.tools { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.linkbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; cursor: pointer; text-transform: uppercase; }
.theme-btn .sun { display: none; }
.theme-btn[data-mode="nuit"] .sun { display: block; }
.theme-btn[data-mode="nuit"] .moon { display: none; }

/* --- Badges ---------------------------------------------------------------- */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.badge.full { background: var(--balise); color: var(--on-balise); border-color: var(--balise); }
.badge.sm { padding: 6px 10px; font-size: 12px; }
.badge.warn { border-color: var(--brique); color: var(--brique); }

/* --- Cartes ---------------------------------------------------------------- */
.card { background: var(--craie2); border-radius: 14px; padding: 32px; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.card.outline { background: transparent; border: 1px solid var(--line); padding: 24px; gap: 18px; }
.card.signature { background: var(--sapin); color: var(--on-sapin); justify-content: space-between; }
.card.signature .soft { opacity: .85; }
.card.tight { padding: 22px 24px; gap: 16px; }

/* --- Boutons --------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 500 16px var(--sans); text-decoration: none; cursor: pointer; }
.btn.primary { min-height: 52px; padding: 0 22px; border: 0; background: var(--balise); color: var(--on-balise); font-weight: 700; font-size: 17px; }
.btn.sapin { min-height: 52px; padding: 0 22px; border: 0; background: var(--sapin); color: var(--on-sapin); font-weight: 700; align-self: flex-start; }
.btn.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.btn.danger { color: var(--brique); border-color: var(--brique); }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 48px; height: 48px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; text-decoration: none; }
.icon-btn.sm { width: 44px; height: 44px; }
.icon-btn.fill { border: 0; background: var(--sapin); color: var(--on-sapin); }
svg { flex-shrink: 0; }

/* --- Formulaires ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.input, .field input, .field select { font: 17px var(--sans); color: var(--ink); background: var(--craie); border: 1px solid var(--line); border-radius: 12px; min-height: 48px; padding: 0 14px; text-transform: none; letter-spacing: 0; min-width: 0; }
.field select { padding-right: 8px; }
.search-pill { min-height: 52px; border-radius: 999px; padding: 0 22px; width: 100%; }
.orig { font-size: 11px; color: var(--muted); }

/* --- Gros chiffres ---------------------------------------------------------- */
.big { font-size: 128px; line-height: .85; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.big.mono { font-family: var(--mono); font-weight: 500; }
.big.md { font-size: 112px; }
.unit { font-family: var(--mono); font-size: 20px; letter-spacing: .1em; color: var(--muted); }
.card.signature .unit { color: var(--on-sapin); opacity: .85; font-family: var(--sans); font-size: 18px; letter-spacing: 0; }
.cell { padding-top: 12px; display: flex; flex-direction: column; gap: 4px; border-top: 2px solid var(--line); }
.cell .n { font-family: var(--mono); font-size: 32px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.cell .n small { font-size: 16px; color: var(--muted); }
.cell .l { font-size: 15px; color: var(--muted); }
.cell.p { border-top-color: var(--sapin-ink); } .cell.g { border-top-color: var(--balise); } .cell.f { border-top-color: var(--ink); } .cell.fib { border-top-style: dotted; border-top-color: var(--muted); }
.card.signature .cell { border-top: 1px solid var(--on-sapin-line); }
.card.signature .cell .n { font-size: 30px; }
.card.signature .cell .l { color: var(--on-sapin); opacity: .85; font-size: 14px; }

/* Répartition de l'énergie des macros (largeurs par classe : la CSP interdit les styles en ligne) */
.split { display: flex; height: 40px; border-radius: 8px; overflow: hidden; gap: 3px; }
.split span { display: flex; align-items: center; padding: 0 12px; font-family: var(--mono); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; min-width: 0; }
.split .p { background: var(--sapin); color: var(--on-sapin); }
.split .g { background: var(--balise); color: var(--on-balise); }
.split .f { background: var(--ink); color: var(--craie); }
.split.empty { background: var(--soft); }

/* Jauge du score de sommeil */
.gauge { display: flex; gap: 4px; align-items: center; }
.gauge .done { height: 4px; border-radius: 999px; background: var(--balise); }
.gauge .dot { width: 12px; height: 12px; border-radius: 999px; background: var(--balise); }
.gauge .rest { height: 0; border-top: 3px dotted var(--on-sapin-dots); }

/* --- La trace : la journée en route ------------------------------------------ */
.trace { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.trace > li { display: grid; grid-template-columns: 88px 28px minmax(0, 1fr); column-gap: 16px; }
.trace .time { padding-top: 22px; text-align: right; font-family: var(--mono); font-size: 22px; font-weight: 500; line-height: 1; }
.trace .rail { display: flex; flex-direction: column; align-items: center; }
.trace .rail .before { height: 22px; width: 0; border-left: 2px dotted var(--sapin-ink); }
.trace > li:first-child .rail .before { border-left-color: transparent; }
.trace .rail .ring { width: 14px; height: 14px; border-radius: 999px; border: 2px solid var(--sapin-ink); background: var(--craie); flex-shrink: 0; }
.trace .rail .after { flex: 1; width: 0; border-left: 2px dotted var(--sapin-ink); }
.trace > li:last-child .rail .ring { width: 18px; height: 18px; border: 0; background: var(--balise); }
.trace > li:last-child .rail .after { display: none; }
.meal { margin-bottom: 20px; }
.meal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.meal-head > div:first-child { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meal-head > .row { flex-wrap: nowrap; }
.macros { font-family: var(--mono); font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.kcal { font-family: var(--mono); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kcal small { font-size: 13px; color: var(--muted); letter-spacing: .1em; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.items li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.items li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.items .g { font-family: var(--mono); font-size: 14px; color: var(--muted); white-space: nowrap; }
.summary-line { display: none; font-size: 13px; color: var(--muted); }
.note { font-size: 15px; color: var(--muted); margin: 0; }

.linkcard { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 24px 28px; border-radius: 14px; border: 1px solid var(--line); text-decoration: none; }
.linkcard .t { font-size: 24px; font-weight: 700; }
.linkcard > span:first-child { display: flex; flex-direction: column; gap: 6px; }

/* Activités Garmin */
.acts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.acts li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.acts a { font-weight: 700; text-decoration: none; }
.acts .d { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.neg { color: var(--brique); }

/* --- Saisie d'un repas ------------------------------------------------------- */
.composer { border: 2px solid var(--sapin-ink); }
.results { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--craie); max-height: 20rem; overflow: auto; }
.results:empty { display: none; }
.results li button { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 14px; cursor: pointer; border-top: 1px solid var(--line); }
.results li:first-child button { border-top: 0; }
.results li button:hover, .results li button:focus-visible { background: var(--soft); }
.results small { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.picked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.picked li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.picked li .name { overflow-wrap: anywhere; }
.picked .qty { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.picked input { width: 5.5rem; text-align: right; font: 500 17px var(--mono); color: var(--ink); background: var(--craie); border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 10px; }
.live { font-family: var(--mono); font-size: 14px; letter-spacing: .06em; color: var(--muted); margin: 0; }

/* --- Tableaux ---------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl.wide { min-width: 420px; }
.tbl thead th { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 500; text-align: right; padding: 0 0 10px 12px; text-transform: uppercase; white-space: nowrap; }
.tbl thead th:first-child { text-align: left; padding-left: 0; }
.tbl tbody tr { border-top: 1px solid var(--line); }
.tbl td, .tbl tbody th { padding: 12px 0 12px 12px; text-align: right; font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tbody th, .tbl td.name { text-align: left; padding-left: 0; font-family: var(--sans); font-weight: 500; font-size: 16px; white-space: normal; }
.tbl td.name a { text-decoration: none; font-weight: 700; }
.tbl .dim { color: var(--muted); }
.tbl .sub { display: block; font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 400; }
.tbl tr.today td, .tbl tr.today th { background: var(--soft); }
.seg { display: inline-flex; gap: 4px; }

/* Collecte : 5 nuits à remplir */
.collect { display: flex; align-items: center; }
.collect .pt { width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--sapin-ink); flex-shrink: 0; }
.collect .pt.on { background: var(--sapin-ink); }
.collect .ln { flex: 1; border-top: 3px dotted var(--sapin-ink); opacity: .5; }
.collect .goal { width: 34px; height: 34px; border-radius: 999px; background: var(--balise); color: var(--on-balise); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 500; flex-shrink: 0; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 24rem; display: flex; flex-direction: column; gap: 20px; align-items: stretch; }
.login .who { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.login .hero { font-size: 56px; }

/* Barre du bas (mobile) */
.bottom { display: none; }

/* --- Largeurs ---------------------------------------------------------------- */
@media (max-width: 960px) {
  .s7, .s5, .s6 { grid-column: span 12; }
  .cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { font-size: 56px; }
  .big, .big.md { font-size: 88px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .shell { padding-inline: 20px; }
  .page { padding-block: 16px 220px; gap: 28px; }
  .top .shell { padding-block: 16px 12px; }
  .top .tabs .tab, .brand-sub { display: none; }
  .tools { margin-left: 0; }
  .avatar { width: 36px; height: 36px; }
  .brand-name { font-size: 22px; }
  .hero { font-size: 44px; }
  .h2 { font-size: 36px; }
  .big, .big.md { font-size: 56px; }
  .unit { font-size: 13px; }
  .card { padding: 18px; gap: 16px; }
  .card.outline { padding: 18px; }
  .split { height: 28px; gap: 2px; border-radius: 6px; }
  .split span { padding: 0 8px; font-size: 11px; }
  .split .pct { display: none; }
  .cells { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .cell { border-top: 0; padding-top: 0; }
  .cell .n { font-size: 18px; }
  .cell .n small { display: none; }
  .cell .l { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
  .card.signature .cell .n { font-size: 20px; }
  .daynav .today-btn { display: none; }
  /* Repas compacts : heure, trace, nom, aliments résumés sur une ligne, kcal */
  .trace > li { grid-template-columns: 48px 16px minmax(0, 1fr); column-gap: 10px; }
  .trace .time { padding-top: 14px; font-size: 13px; }
  .trace .rail .before { height: 14px; }
  .trace .rail .ring { width: 12px; height: 12px; }
  .trace > li:last-child .rail .ring { width: 14px; height: 14px; }
  .meal { margin-bottom: 10px; }
  .card.tight { padding: 12px 14px; gap: 8px; border-radius: 12px; }
  .meal .h3 { font-size: 17px; }
  .meal .macros, .meal .items, .meal .note { display: none; }
  .meal .summary-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .meal .kcal { font-size: 15px; }
  .meal .kcal small { display: none; }
  .meal-head { align-items: center; flex-wrap: nowrap; }
  .meal-head > div:first-child { min-width: 0; }
  .meal .icon-btn { width: 44px; height: 44px; }
  .bottom { display: flex; flex-direction: column; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--craie); }
  .bottom .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .bottom .tab { padding: 0 4px; font-size: 14px; }
  .bottom .btn.primary { width: 100%; }
  .page-cta { display: none; }
  .picked li { grid-template-columns: minmax(0, 1fr) auto; }
  .picked li .del { grid-column: 2; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .tab, .icon-btn { transition: opacity .15s, background-color .15s; } }
.fg-0 { flex-grow: 0; flex-basis: 0; }
.fg-1 { flex-grow: 1; flex-basis: 0; }
.fg-2 { flex-grow: 2; flex-basis: 0; }
.fg-3 { flex-grow: 3; flex-basis: 0; }
.fg-4 { flex-grow: 4; flex-basis: 0; }
.fg-5 { flex-grow: 5; flex-basis: 0; }
.fg-6 { flex-grow: 6; flex-basis: 0; }
.fg-7 { flex-grow: 7; flex-basis: 0; }
.fg-8 { flex-grow: 8; flex-basis: 0; }
.fg-9 { flex-grow: 9; flex-basis: 0; }
.fg-10 { flex-grow: 10; flex-basis: 0; }
.fg-11 { flex-grow: 11; flex-basis: 0; }
.fg-12 { flex-grow: 12; flex-basis: 0; }
.fg-13 { flex-grow: 13; flex-basis: 0; }
.fg-14 { flex-grow: 14; flex-basis: 0; }
.fg-15 { flex-grow: 15; flex-basis: 0; }
.fg-16 { flex-grow: 16; flex-basis: 0; }
.fg-17 { flex-grow: 17; flex-basis: 0; }
.fg-18 { flex-grow: 18; flex-basis: 0; }
.fg-19 { flex-grow: 19; flex-basis: 0; }
.fg-20 { flex-grow: 20; flex-basis: 0; }
.fg-21 { flex-grow: 21; flex-basis: 0; }
.fg-22 { flex-grow: 22; flex-basis: 0; }
.fg-23 { flex-grow: 23; flex-basis: 0; }
.fg-24 { flex-grow: 24; flex-basis: 0; }
.fg-25 { flex-grow: 25; flex-basis: 0; }
.fg-26 { flex-grow: 26; flex-basis: 0; }
.fg-27 { flex-grow: 27; flex-basis: 0; }
.fg-28 { flex-grow: 28; flex-basis: 0; }
.fg-29 { flex-grow: 29; flex-basis: 0; }
.fg-30 { flex-grow: 30; flex-basis: 0; }
.fg-31 { flex-grow: 31; flex-basis: 0; }
.fg-32 { flex-grow: 32; flex-basis: 0; }
.fg-33 { flex-grow: 33; flex-basis: 0; }
.fg-34 { flex-grow: 34; flex-basis: 0; }
.fg-35 { flex-grow: 35; flex-basis: 0; }
.fg-36 { flex-grow: 36; flex-basis: 0; }
.fg-37 { flex-grow: 37; flex-basis: 0; }
.fg-38 { flex-grow: 38; flex-basis: 0; }
.fg-39 { flex-grow: 39; flex-basis: 0; }
.fg-40 { flex-grow: 40; flex-basis: 0; }
.fg-41 { flex-grow: 41; flex-basis: 0; }
.fg-42 { flex-grow: 42; flex-basis: 0; }
.fg-43 { flex-grow: 43; flex-basis: 0; }
.fg-44 { flex-grow: 44; flex-basis: 0; }
.fg-45 { flex-grow: 45; flex-basis: 0; }
.fg-46 { flex-grow: 46; flex-basis: 0; }
.fg-47 { flex-grow: 47; flex-basis: 0; }
.fg-48 { flex-grow: 48; flex-basis: 0; }
.fg-49 { flex-grow: 49; flex-basis: 0; }
.fg-50 { flex-grow: 50; flex-basis: 0; }
.fg-51 { flex-grow: 51; flex-basis: 0; }
.fg-52 { flex-grow: 52; flex-basis: 0; }
.fg-53 { flex-grow: 53; flex-basis: 0; }
.fg-54 { flex-grow: 54; flex-basis: 0; }
.fg-55 { flex-grow: 55; flex-basis: 0; }
.fg-56 { flex-grow: 56; flex-basis: 0; }
.fg-57 { flex-grow: 57; flex-basis: 0; }
.fg-58 { flex-grow: 58; flex-basis: 0; }
.fg-59 { flex-grow: 59; flex-basis: 0; }
.fg-60 { flex-grow: 60; flex-basis: 0; }
.fg-61 { flex-grow: 61; flex-basis: 0; }
.fg-62 { flex-grow: 62; flex-basis: 0; }
.fg-63 { flex-grow: 63; flex-basis: 0; }
.fg-64 { flex-grow: 64; flex-basis: 0; }
.fg-65 { flex-grow: 65; flex-basis: 0; }
.fg-66 { flex-grow: 66; flex-basis: 0; }
.fg-67 { flex-grow: 67; flex-basis: 0; }
.fg-68 { flex-grow: 68; flex-basis: 0; }
.fg-69 { flex-grow: 69; flex-basis: 0; }
.fg-70 { flex-grow: 70; flex-basis: 0; }
.fg-71 { flex-grow: 71; flex-basis: 0; }
.fg-72 { flex-grow: 72; flex-basis: 0; }
.fg-73 { flex-grow: 73; flex-basis: 0; }
.fg-74 { flex-grow: 74; flex-basis: 0; }
.fg-75 { flex-grow: 75; flex-basis: 0; }
.fg-76 { flex-grow: 76; flex-basis: 0; }
.fg-77 { flex-grow: 77; flex-basis: 0; }
.fg-78 { flex-grow: 78; flex-basis: 0; }
.fg-79 { flex-grow: 79; flex-basis: 0; }
.fg-80 { flex-grow: 80; flex-basis: 0; }
.fg-81 { flex-grow: 81; flex-basis: 0; }
.fg-82 { flex-grow: 82; flex-basis: 0; }
.fg-83 { flex-grow: 83; flex-basis: 0; }
.fg-84 { flex-grow: 84; flex-basis: 0; }
.fg-85 { flex-grow: 85; flex-basis: 0; }
.fg-86 { flex-grow: 86; flex-basis: 0; }
.fg-87 { flex-grow: 87; flex-basis: 0; }
.fg-88 { flex-grow: 88; flex-basis: 0; }
.fg-89 { flex-grow: 89; flex-basis: 0; }
.fg-90 { flex-grow: 90; flex-basis: 0; }
.fg-91 { flex-grow: 91; flex-basis: 0; }
.fg-92 { flex-grow: 92; flex-basis: 0; }
.fg-93 { flex-grow: 93; flex-basis: 0; }
.fg-94 { flex-grow: 94; flex-basis: 0; }
.fg-95 { flex-grow: 95; flex-basis: 0; }
.fg-96 { flex-grow: 96; flex-basis: 0; }
.fg-97 { flex-grow: 97; flex-basis: 0; }
.fg-98 { flex-grow: 98; flex-basis: 0; }
.fg-99 { flex-grow: 99; flex-basis: 0; }
.fg-100 { flex-grow: 100; flex-basis: 0; }
@media (max-width: 640px) { .hero-month { display: none; } }
.tbl td.txt { text-align: left; font-family: var(--sans); white-space: normal; }
/* Tableau d'aliments en cartes sur téléphone : nom en pleine largeur, valeurs étiquetées dessous */
@media (max-width: 640px) {
  .tbl.stackable thead { display: none; }
  .tbl.stackable tbody tr { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px 8px; padding: 14px 0; }
  .tbl.stackable td { padding: 0; text-align: left; display: flex; flex-direction: column; font-size: 15px; }
  .tbl.stackable td.name { grid-column: 1 / -1; padding-bottom: 6px; }
  .tbl.stackable td[data-label]::before { content: attr(data-label); font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
}
.tbl thead th.txt { text-align: left; }

/* --- En-tête de page commun : rangée fixe (badges à gauche, actions à droite), puis le titre --- */
.pagehead { display: flex; flex-direction: column; gap: 20px; }
.pagehead-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.pagehead-top .badges { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.pagehead-top .badges::-webkit-scrollbar { display: none; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-actions .placeholder { visibility: hidden; }
.pagehead .hero { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .pagehead { gap: 14px; }
  .pagehead-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-actions { min-height: 48px; overflow-x: auto; }
}
.page-actions .btn, .page-actions .btn.primary { min-height: 48px; height: 48px; }
.pagehead-top { height: 48px; }
@media (max-width: 640px) { .pagehead-top { height: auto; } .pagehead-top .badges { min-height: 34px; } .page-actions { height: 48px; } }
@media (max-width: 640px) {
  /* Deux lignes de badges au plus, hauteur fixe : le titre reste au même endroit d'une page à l'autre */
  .pagehead-top .badges { flex-wrap: wrap; overflow: hidden; height: 66px; align-content: flex-start; gap: 6px; }
  .pagehead-top .badge { padding: 6px 9px; font-size: 11px; gap: 6px; }
}
