/* Tartinou — feuille de style unique.
   Direction : papier, encre, un accent par domaine (budget ocre, cuisine vert).
   Police système (aucune requête externe), chiffres tabulaires, listes groupées à filets fins. */

:root {
  --paper: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #ECEAE4;
  --ink: #17160F;
  --ink-2: #3F3E38;
  --muted: #74726A;
  --line: #E2E0D9;
  --line-2: #CBC8BF;
  --budget: #9A6200;
  --budget-soft: #F3E6C9;
  --cuisine: #33684A;
  --cuisine-soft: #D9E9DD;
  --danger: #B3372A;
  --danger-soft: #F5DCD7;
  --accent: var(--budget);
  --accent-soft: var(--budget-soft);
  --on-ink: #F7F6F2;
  --r: 10px;
  --r-lg: 16px;
  --tabbar-h: 60px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sheet: 0 -8px 40px rgba(23, 22, 15, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211; --surface: #1C1B19; --surface-2: #262523; --ink: #EEECE6; --ink-2: #CFCCC4; --muted: #948F85;
    --line: #2C2B28; --line-2: #3D3B37; --budget: #E0AA3E; --budget-soft: #3A2E12; --cuisine: #7CBA8C; --cuisine-soft: #1E3326;
    --danger: #E5745F; --danger-soft: #45201B; --on-ink: #121211; --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --paper: #121211; --surface: #1C1B19; --surface-2: #262523; --ink: #EEECE6; --ink-2: #CFCCC4; --muted: #948F85;
  --line: #2C2B28; --line-2: #3D3B37; --budget: #E0AA3E; --budget-soft: #3A2E12; --cuisine: #7CBA8C; --cuisine-soft: #1E3326;
  --danger: #E5745F; --danger-soft: #45201B; --on-ink: #121211; --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.5);
}
body[data-accent="budget"] { --accent: var(--budget); --accent-soft: var(--budget-soft); }
body[data-accent="cuisine"] { --accent: var(--cuisine); --accent-soft: var(--cuisine-soft); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
h1, h2, h3, p, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.num, .amount-display, .hero-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.block { display: block; }
.mono-free { font-family: var(--font); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--on-ink); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip-link:focus { top: 8px; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--topbar-h); padding: 0 8px 0 20px;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.topbar-right { display: inline-flex; align-items: center; gap: 2px; }
.topbar-actions { display: inline-flex; align-items: center; gap: 2px; }
.topbar-actions .btn-icon { color: var(--ink-2); }
.topbar-actions .btn-icon[aria-current="page"] { color: var(--accent); }
.topbar-settings { color: var(--ink-2); }
.topbar-settings[aria-current="page"] { color: var(--accent); }
.sync-dot { width: 36px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; border-radius: 8px; }
.sync-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.sync-dot[data-status="synced"]::after { background: var(--cuisine); }
.sync-dot[data-status="syncing"]::after, .sync-dot[data-status="idle"]::after { background: var(--budget); animation: pulse 900ms ease-in-out infinite alternate; }
.sync-dot[data-status="error"]::after, .sync-dot[data-status="auth"]::after { background: var(--danger); }
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(var(--tabs, 5), 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); text-decoration: none; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.01em; min-height: 44px;
}
.tab svg { width: 24px; height: 24px; stroke-width: 1.75; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] svg { stroke-width: 2.25; }
.tab:focus-visible { outline-offset: -4px; }
/* Sur mobile, la marque et l'entrée Réglages vivent ailleurs (barre du haut) ;
   Menus, Courses et Stock sont regroupés sous « Cuisine » (sous-menu en haut de l'écran). */
.tabbar-brand, .tab-settings, .tab-desk { display: none; }
.subnav { display: flex; margin: 12px 16px -6px; background: var(--surface-2); border-radius: var(--r); padding: 3px; gap: 2px; }
.subnav a { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 8px; font-weight: 600; font-size: 0.925rem; color: var(--muted); text-decoration: none; }
.subnav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.subnav a:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ---------- Écrans ---------- */
main { display: block; outline: none; }
.screen { padding: 20px 16px 32px; max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.lead { font-size: 1.3rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.015em; text-wrap: balance; }
.lead.is-over .num { color: var(--danger); }
.h-section { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.h-small { font-size: 0.95rem; font-weight: 700; margin: 14px 0 6px; }
.date-line { font-size: 0.875rem; margin-bottom: -8px; }
.empty { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.empty-line { padding: 4px 0; }
.streak { padding-top: 4px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: var(--r); border: 1px solid transparent;
  font-weight: 600; font-size: 0.95rem; text-decoration: none; text-align: center; line-height: 1.2;
  transition: transform 80ms ease, background-color 120ms ease;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-tall { min-height: 54px; font-size: 1rem; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: 0.875rem; border-radius: 8px; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:active { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-validate { background: var(--cuisine); color: #fff; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 8px; border: 0; background: transparent; color: inherit;
}
.btn-icon:active { background: var(--surface-2); }
.btn-icon svg { width: 22px; height: 22px; }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }
.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; stroke-width: 1.9; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; text-align: left; }
.link:hover { text-decoration-color: currentColor; }
.link.small { font-size: 0.875rem; font-weight: 500; }
a.link { display: inline; min-height: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.row-actions.center { justify-content: center; }
.row-actions > .btn { flex: 1 1 auto; }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 0; min-width: 0; }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.field-date { flex: 0 1 46%; }
label, .label { font-weight: 600; font-size: 0.875rem; color: var(--ink-2); }
.input {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input::placeholder { color: var(--muted); opacity: .8; }
textarea.input { resize: vertical; line-height: 1.4; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-big { font-size: 1.5rem; min-height: 58px; }
.form-error { color: var(--danger); font-weight: 500; font-size: 0.925rem; }
.form-error ul { list-style: disc; padding-left: 20px; margin-top: 4px; }
.summary { padding: 12px 14px; background: var(--surface-2); border-radius: var(--r); font-size: 0.95rem; }

/* ---------- Jauges ---------- */
.hero { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.hero-text { font-size: 1rem; font-weight: 500; color: var(--muted); line-height: 1.3; }
.hero-amount { display: block; font-size: 3.4rem; line-height: 1; letter-spacing: -0.035em; color: var(--ink); font-weight: 700; margin: 6px 0 2px; }
.hero.is-over .hero-amount { color: var(--danger); }
.gauge { width: 100%; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.gauge-large { height: 10px; }
.gauge-small { height: 6px; }
.gauge-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 450ms cubic-bezier(.2,.7,.2,1); }
.gauge.is-over .gauge-fill { background: var(--danger); }
.mini-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.mini-label { font-size: 0.875rem; line-height: 1.35; color: var(--muted); }
.mini-label strong { color: var(--ink); font-size: 1.05rem; }
.mini.is-over .mini-label strong { color: var(--danger); }
@media (max-width: 360px) { .mini-gauges { grid-template-columns: 1fr; } }

/* ---------- Listes groupées (dépenses, courses, stock, réglages) ---------- */
.expense-list, .shop-list, .stock-list, .rows, .ranger-list, .history {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.expense-row { position: relative; overflow: hidden; max-height: 120px; border-bottom: 1px solid var(--line); transition: max-height 300ms ease, opacity 300ms ease; }
.expense-row:last-child, .shop-item:last-child, .stock-item:last-child, .row-item:last-child, .ranger-row:last-child, .history-item:last-child { border-bottom: 0; }
.expense-row::before {
  content: 'Supprimer'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  padding-right: 18px; background: var(--danger); color: #fff; font-weight: 600;
}
.expense-row.is-removing { max-height: 0; opacity: 0; }
.expense-inner { position: relative; display: flex; align-items: center; background: var(--surface); touch-action: pan-y; }
.swipe-ready .expense-inner { box-shadow: inset 4px 0 0 var(--danger); }
.expense-main { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 4px 8px 16px; background: none; border: 0; text-align: left; min-width: 0; color: inherit; }
.expense-main:active { background: var(--surface-2); }
.expense-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.expense-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.expense-cat { font-size: 0.8rem; }
.expense-amount { font-size: 1rem; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chip, var(--muted)); flex: none; }
.expense-delete { color: var(--muted); margin-right: 4px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 4px; }
.day-head .h-section { margin-top: 0; }
.day-total { font-size: 0.925rem; }
.day-head.is-over .day-total { color: var(--danger); }
.over-mark { font-weight: 500; font-size: 0.8rem; }

/* ---------- Filtres et barres ---------- */
.filters { display: flex; gap: 10px; }
.bars { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.bar-head { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 6px; }
.bar-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }

/* ---------- Zones (Menus, Courses, Réglages, Stock) ---------- */
.zone { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.zone-title { font-size: 0.975rem; font-weight: 600; padding: 14px 16px; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
.zone-title::-webkit-details-marker { display: none; }
details > .zone-title::after { content: ''; flex: none; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin: -4px 6px 0 auto; transition: transform 160ms ease; }
details[open] > .zone-title::after { transform: rotate(-135deg); margin-top: 4px; }
details[open] > .zone-title { border-bottom: 1px solid var(--line); }
.zone-open .zone-title { border-bottom: 1px solid var(--line); cursor: default; }
.zone-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.zone-count { font-size: 0.8rem; font-weight: 700; color: var(--on-ink); background: var(--ink); border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0 7px; }
.prompt-fallback { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Menus ---------- */
.week-head { display: flex; flex-direction: column; gap: 6px; }
.week { display: flex; flex-direction: column; gap: 12px; }
.validated-line { padding: 10px 14px; background: var(--accent-soft); border-radius: var(--r); font-size: 0.95rem; }
.day-cards { display: flex; flex-direction: column; gap: 10px; }
.day-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px 0 4px; }
.day-name { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); padding: 10px 16px 6px; }
.meal { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; min-height: 54px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; color: inherit; }
.meal:active { background: var(--surface-2); }
.meal-empty { color: var(--muted); }
.meal-moment { flex: none; width: 40px; font-size: 0.75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.meal-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.meal-name { font-weight: 600; }
.meal-chevron { color: var(--line-2); }
.tips { display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); border-radius: var(--r-lg); padding: 14px 16px; }
.plain-list { display: flex; flex-direction: column; gap: 6px; padding-left: 0; }
.plain-list li { padding-left: 14px; position: relative; }
.plain-list li::before { content: ''; position: absolute; left: 0; top: 0.65em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.steps { list-style: decimal; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }

/* ---------- Courses ---------- */
.shop-head { display: flex; flex-direction: column; gap: 4px; }
.rayon { display: flex; flex-direction: column; gap: 8px; }
.shop-item { padding: 4px 12px 4px 8px; border-bottom: 1px solid var(--line); }
.shop-main { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check { width: 22px; height: 22px; flex: none; accent-color: var(--accent); margin: 0 4px; }
.shop-label { flex: 1; font-weight: 500; position: relative; padding: 8px 0; min-width: 0; }
.shop-name { position: relative; }
.shop-name::after { content: ''; position: absolute; left: 0; right: 0; top: 55%; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 250ms ease; }
.is-checked .shop-name::after { transform: scaleX(1); }
.is-checked .shop-label { color: var(--muted); }
.is-unavailable .shop-name { color: var(--muted); }
.shop-price { font-size: 0.925rem; }
.tag-unavailable, .tag-stock { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; vertical-align: 1px; }
.tag-unavailable { background: var(--danger-soft); color: var(--danger); }
.tag-stock { background: var(--cuisine-soft); color: var(--cuisine); }
.shop-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-left: 40px; margin-top: -8px; min-height: 30px; }
.shop-sub .link { min-height: 32px; }

/* ---------- Réglages ---------- */
.row-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.row-text { flex: 1; min-width: 0; }
.row-item .input { flex: 1; min-height: 40px; }
.color { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px; background: none; flex: none; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; font-weight: 500; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 46px; height: 28px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; transition: background 200ms ease; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform 200ms ease; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch.small { font-size: 0.875rem; }
.segmented { display: flex; background: var(--surface-2); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; font-weight: 600; font-size: 0.925rem; border-radius: 8px; color: var(--muted); transition: background 120ms ease, color 120ms ease; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ---------- Feuilles (dialog) ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh;
  background: var(--paper); color: var(--ink); display: flex; flex-direction: column;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(20, 18, 12, 0.45); }
@media (min-width: 640px) {
  dialog.sheet { width: 560px; height: auto; max-height: 92dvh; margin: auto; border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
}
dialog.sheet-compact { height: fit-content; max-height: 92dvh; top: auto; bottom: 0; border-radius: 20px 20px 0 0; box-shadow: var(--shadow-sheet); }
dialog.sheet-compact::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 8px auto -4px; }
@media (min-width: 640px) { dialog.sheet-compact { top: 0; margin: auto; border-radius: 20px; } dialog.sheet-compact::before { display: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 8px 20px; padding-top: max(12px, env(safe-area-inset-top)); }
.sheet-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.sheet-body { flex: 1; overflow: auto; padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-secondary { flex: 0 1 auto; }

/* Feuille de saisie d'une dépense */
.expense-body { gap: 12px; }
.amount-display { display: block; font-size: 3rem; line-height: 1.1; text-align: right; padding: 8px 0; letter-spacing: -0.03em; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; font-size: 0.925rem; color: var(--ink); }
.chip[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); font-weight: 600; }
.chip[aria-checked="true"] .chip-dot { box-shadow: 0 0 0 2px var(--on-ink); }
.chip-count { font-size: 0.8rem; color: var(--muted); }
.chip[aria-checked="true"] .chip-count { color: inherit; opacity: .8; }
.chip-sm { min-height: 34px; padding: 4px 12px; font-size: 0.85rem; }
.chips-sm { gap: 6px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-scroll .chip { flex: none; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.key { min-height: 58px; font-size: 1.6rem; font-weight: 500; font-variant-numeric: tabular-nums; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.key:active { background: var(--surface-2); }
.key-del { color: var(--muted); }

/* ---------- Stock ---------- */
.stock-head { display: flex; flex-direction: column; gap: 4px; }
.stock-filters { display: flex; gap: 10px; align-items: flex-end; }
.stock-filters .field { flex: 1; }
.stock-filters select { flex: 0 0 auto; width: auto; }
.stock-groups { display: flex; flex-direction: column; gap: 18px; }
.stock-group { display: flex; flex-direction: column; gap: 8px; }
.stock-group.is-urgent .h-section { color: var(--danger); }
.stock-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; border-bottom: 1px solid var(--line); }
.stock-item.dlc-perime { box-shadow: inset 3px 0 0 var(--danger); }
.stock-item.dlc-urgent { box-shadow: inset 3px 0 0 var(--budget); }
.stock-item.dlc-ddm { box-shadow: inset 3px 0 0 var(--line-2); }
.stock-main { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 56px; background: none; border: 0; text-align: left; padding: 4px; min-width: 0; border-radius: 8px; color: inherit; }
.stock-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.stock-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.stock-text { flex: 1; display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.stock-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; }
.dlc-badge { align-self: flex-start; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); letter-spacing: 0.01em; }
.dlc-badge.dlc-ok { background: var(--cuisine-soft); color: var(--cuisine); }
.dlc-badge.dlc-urgent { background: var(--budget-soft); color: var(--budget); }
.dlc-badge.dlc-perime { background: var(--danger-soft); color: var(--danger); }
.dlc-badge.dlc-ddm { background: var(--surface-2); color: var(--ink-2); border: 1px dashed var(--line-2); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); overflow: hidden; flex: none; }
.stepper-btn { width: 42px; height: 42px; border: 0; background: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.stepper-btn:active { background: var(--surface-2); }
.stepper-btn:disabled { opacity: .3; cursor: not-allowed; }
.stepper-value { min-width: 40px; text-align: center; font-size: 1rem; padding: 0 4px; }
.stepper-sm .stepper-btn { width: 36px; height: 38px; }
.stepper-sm .stepper-value { min-width: 34px; font-size: 0.925rem; }
.qty-row { display: flex; gap: 10px; align-items: center; }
.qty-row select { flex: 1; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border-radius: var(--r); background: var(--surface-2); }
.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat.is-bad .stat-value { color: var(--danger); }
.journal-jete .row-text { color: var(--danger); }
.journal-value { color: var(--danger); }
.stock-alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--danger-soft); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.stock-alert .icon:first-child { color: var(--danger); }
.stock-alert .icon:last-child { color: var(--muted); }
.stock-alert > span:not(.icon) { flex: 1; }
.stock-alert.is-soft { background: var(--budget-soft); }
.stock-alert-btn { width: 100%; border: 0; text-align: left; font: inherit; cursor: pointer; }
.tag-rappel { background: var(--danger); color: #fff; }
.recall-box { border-left: 3px solid var(--danger); background: var(--danger-soft); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.recall-title { display: flex; align-items: center; gap: 8px; }
.recall-title .icon { color: var(--danger); width: 18px; height: 18px; flex: 0 0 auto; }
.recall-steps { padding-left: 18px; list-style: disc; }
.recall-box p { margin: 0; }
.open-prices { display: flex; flex-direction: column; gap: 8px; }
.open-prices-head .link { display: inline-flex; align-items: center; gap: 4px; }
.open-prices-head .link .icon { width: 14px; height: 14px; }
.chip-price { gap: 4px; }
.stock-alert.is-soft .icon:first-child { color: var(--budget); }

/* Fiche produit */
.product-head { display: flex; gap: 12px; align-items: flex-start; }
.product-thumb { width: 72px; height: 72px; border-radius: 12px; background: var(--surface-2); flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; margin-top: 24px; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-fields { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.lookup-line { padding: 8px 12px; border-radius: var(--r); background: var(--surface-2); }
.off-suggest { list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: 0 6px 20px rgba(0,0,0,.08); max-height: 300px; overflow-y: auto; }
.off-suggest-head { padding: 4px 8px 2px; }
.off-suggest-loading { display: flex; align-items: center; gap: 8px; padding: 8px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--ink-2); border-radius: 50%; animation: spin 700ms linear infinite; vertical-align: -2px; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-card .btn-block { max-width: none; }
.off-suggest-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 8px; background: none; color: inherit; text-align: left; font: inherit; }
.off-suggest-item:hover, .off-suggest-item:focus-visible { background: var(--surface-2); }
.off-suggest-item img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; background: var(--surface-2); }
.off-suggest-item > svg { width: 22px; height: 22px; margin: 0 7px; color: var(--muted); flex: 0 0 auto; }
.off-suggest-text { flex: 1; min-width: 0; }
.off-suggest-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores { display: flex; flex-wrap: wrap; gap: 8px; }
.score { display: inline-flex; gap: 4px; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 0.8rem; font-weight: 500; }
.score-a { background: #1E8F4E; color: #fff; } .score-b { background: #7BC043; color: #17160F; } .score-c { background: #F5C33B; color: #17160F; } .score-d { background: #EF8200; color: #fff; } .score-e { background: #E63E11; color: #fff; }
.nova-1 { background: #1E8F4E; color: #fff; } .nova-2 { background: #F5C33B; color: #17160F; } .nova-3 { background: #EF8200; color: #fff; } .nova-4 { background: #E63E11; color: #fff; }
.nutri-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: 0.9rem; }
.nutri-grid dt { color: var(--muted); }
.nutri-grid dd { margin: 0; text-align: right; }
.seg-sm { flex: 0 0 auto; min-width: 124px; }
.seg-sm .seg span { min-height: 40px; font-size: 0.875rem; }

/* Scanner */
.scan-body { gap: 12px; }
.scan-view { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 58dvh; background: #000; border-radius: var(--r-lg); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 12%; right: 12%; top: 32%; bottom: 32%; border: 2px solid #fff; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.4); pointer-events: none; }
.scan-frame::after { content: ''; position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; background: var(--budget); opacity: .9; animation: scanline 1.6s ease-in-out infinite alternate; }
@keyframes scanline { from { transform: translateY(-36px); } to { transform: translateY(36px); } }
.scan-status { min-height: 24px; text-align: center; font-weight: 500; font-size: 0.95rem; }
.scan-nocam { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; color: #fff; text-align: center; }
.scan-nocam .icon { width: 40px; height: 40px; }
.scan-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Ranger les courses */
.ranger-row { padding: 6px 12px 12px 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.ranger-row.is-off { opacity: .45; }
.ranger-fields { padding-left: 40px; }
.ranger-fields .input { min-height: 42px; }
.ranger-fields .input-type { flex: 0 0 82px; }

/* ---------- Premier lancement et connexion ---------- */
.screen-onboarding { min-height: calc(100dvh - var(--topbar-h)); justify-content: center; gap: 28px; padding-top: 32px; }
.onboarding-head { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.brand-big { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.brand-big::after { content: '.'; color: var(--accent); }
.onboarding-body > div { display: flex; flex-direction: column; gap: 14px; }
/* Connexion et inscription : une carte, mots de passe visibles à la demande. */
.screen-auth { gap: 22px; padding-top: 24px; }
.screen-auth .onboarding-head .muted { max-width: 30ch; margin: 0 auto; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px 18px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.auth-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 2px; }
.auth-card .h-section { margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 2px; }
.auth-switch .link { font-weight: 600; }
.auth-foot { text-align: center; }
.field-hint { display: block; margin-top: 4px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; width: 100%; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.pw-toggle[aria-pressed="true"] { color: var(--ink); }
.pw-strength { display: flex; gap: 4px; margin-top: 8px; }
.pw-strength span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background 150ms ease; }
.pw-strength[data-score="1"] span:nth-child(1) { background: var(--warning, #c98a1c); }
.pw-strength[data-score="2"] span:nth-child(-n+2) { background: var(--cuisine); }
.pw-strength[data-score="3"] span { background: var(--cuisine); }
.input.is-mismatch { border-color: var(--danger); }
.input-code { font-variant-numeric: tabular-nums; letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: var(--r); font-weight: 500; font-size: 0.95rem; max-width: 480px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: toast-in 180ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Survol (souris et trackpad seulement) ---------- */
@media (hover: hover) {
  .btn-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--paper)); }
  .btn-secondary:hover, .btn-icon:hover, .key:hover, .stepper-btn:hover { background: var(--surface-2); }
  .btn-validate:hover { background: color-mix(in srgb, var(--cuisine) 88%, black); }
  .btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, black); }
  .chip:not([aria-checked="true"]):hover { border-color: var(--ink-2); }
  .expense-main:hover, .stock-main:hover, .meal:hover, .zone-title:hover { background: var(--surface-2); }
  .tab:hover { color: var(--ink); }
  .link:hover { text-decoration-color: currentColor; }
  .input:hover { border-color: var(--ink-2); }
}

/* ---------- Écran large : barre latérale, contenu plus large ---------- */
@media (min-width: 900px) {
  :root { --sidebar-w: 236px; }
  body { padding-bottom: 0; padding-left: var(--sidebar-w); }
  .tabbar {
    top: 0; right: auto; width: var(--sidebar-w); height: 100dvh; padding: 20px 12px;
    display: flex; flex-direction: column; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabbar-brand {
    display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
    color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.03em;
  }
  .tabbar-brand img { width: 36px; height: 36px; border-radius: 9px; }
  .tabbar-brand .brand-word { width: auto; height: 26px; border-radius: 0; margin-top: 2px; }
  /* Le mot-symbole est marine sur fond clair ; en sombre on inverse la luminosité en gardant la teinte du point doré. */
  :root[data-theme="dark"] .tabbar-brand .brand-word { filter: invert(1) hue-rotate(180deg) brightness(1.15); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabbar-brand .brand-word { filter: invert(1) hue-rotate(180deg) brightness(1.15); } }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 12px; min-height: 44px; border-radius: var(--r); font-size: 0.95rem; font-weight: 500; color: var(--ink-2); }
  .tab svg { width: 20px; height: 20px; }
  .tab[aria-current="page"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
  .tab[aria-current="page"] svg { color: var(--accent); stroke-width: 2; }
  .tab-settings { display: flex; margin-top: auto; }
  .tab-desk:not([hidden]) { display: flex; }
  .tab-mobile, .subnav { display: none; }
  .topbar { padding: 0 32px; min-height: 64px; background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topbar-title { font-size: 1.6rem; }
  .topbar-settings { display: none; }
  .topbar-actions .btn-icon { display: inline-flex; }
  .screen { max-width: 820px; padding: 28px 32px 56px; gap: 24px; }
  .screen-onboarding { max-width: 520px; }
  .auth-card { padding: 28px 28px 24px; }
  .hero-amount { font-size: 4rem; }
  .row-actions > .btn { flex: 0 1 auto; min-width: 200px; }
  .btn-block.btn-tall { max-width: 420px; }
  .mini-gauges { grid-template-columns: 1fr 1fr; }
  .filters, .stock-filters { max-width: 560px; }
  .chips-scroll { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; }
  #toast-root { left: calc(var(--sidebar-w) + 24px); right: 24px; bottom: 24px; }
  dialog.sheet { width: 600px; }
  .numpad { max-width: 360px; margin-left: auto; margin-right: auto; width: 100%; }
  .amount-display { text-align: center; }
}
@media (min-width: 1180px) {
  .screen { max-width: 960px; }
  .stock-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
  .stock-group.is-urgent, .stock-group.is-ddm { grid-column: 1 / -1; }
  .day-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .screen-today { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 40px; align-content: start; }
  .screen-today > .date-line { grid-column: 1; }
  .screen-today > .hero, .screen-today > .mini-gauges, .screen-today > .empty { grid-column: 1; }
  .screen-today > .stock-alert, .screen-today > .btn, .screen-today > .h-section, .screen-today > .expense-list, .screen-today > .empty-line, .screen-today > .streak { grid-column: 2; }
  .screen-today > .btn { grid-row: 1 / span 2; align-self: start; margin-top: 30px; max-width: none; }
  .screen-today > .stock-alert { grid-row: 3; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Connexion, compte, objectifs, suggestions ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.login-logo { margin: 0 auto 6px; border-radius: 18px; }
.code-invit { letter-spacing: 0.08em; font-size: 1.05rem; }
.suggestions { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--accent-soft); border-radius: var(--r-lg); }
.row-cat .input-objectif { flex: 0 0 96px; text-align: right; }
.bar-head .obj { font-size: 0.8rem; color: var(--muted); }
.bar-row.is-alerte .bar-head .num { color: var(--budget); }
.bar-row.is-depasse .bar-head .num { color: var(--danger); }
.bar-goal { position: relative; }
.bar-goal::after { content: ''; position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); left: var(--goal, 100%); opacity: .5; }
.tag-allergene { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.expense-auteur { color: var(--muted); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.price-insight { padding: 6px 10px; border-radius: 8px; background: var(--accent-soft); }
.allergen-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag-allergene .icon { width: 14px; height: 14px; }
.inv-progress { display: flex; align-items: center; gap: 12px; }
.inv-progress .gauge { flex: 1; }
.inv-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 20px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.inv-thumb { width: 120px; height: 120px; border-radius: 16px; object-fit: cover; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; }
.inv-name { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.inv-qty { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 6px; }
.inv-foot .btn-primary { flex: 2; }
.qr-preview svg { width: 120px; height: 120px; }

.link-plain { background: none; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.recipe-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recipe-head .h-small { margin: 0; }

.source-link { display: inline-flex; align-items: center; gap: 6px; color: var(--cuisine); font-weight: 600; text-decoration: none; padding: 6px 0; }
.source-link:hover { text-decoration: underline; }

/* ---------- Mur du foyer et activité ---------- */
.zone-tools { display: inline-flex; gap: 12px; margin-left: auto; }
.zone-tools .link { min-height: 0; }
.wall-list { display: flex; flex-direction: column; gap: 8px; }
.wall-msg { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.wall-msg.is-pinned { background: var(--accent-soft); }
.wall-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wall-author { font-weight: 700; font-size: 0.9rem; }
.wall-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.wall-actions { display: flex; gap: 14px; }
.wall-actions .link { min-height: 32px; }
.wall-composer { display: flex; gap: 8px; }
.wall-composer .input { flex: 1; }
.wall-composer .btn { flex: none; padding: 10px 14px; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .icon { color: var(--muted); margin-top: 2px; }
.feed-item.is-bad .icon { color: var(--danger); }
.feed-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.feed-time { flex: none; }
@media (min-width: 1180px) { .screen-today > .wall { grid-column: 2; } }

.score-mini { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em; }

.module-group { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; border-top: 1px solid var(--line); }
.module-group .label { margin: 6px 0 2px; }

/* ---------- Flux du foyer ---------- */
.tab { position: relative; }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); font-weight: 700; font-size: 0.8rem; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.avatar-sm { width: 22px; height: 22px; font-size: 0.65rem; }
.composer .zone-body { gap: 10px; }
.composer-row { display: flex; gap: 10px; align-items: flex-start; }
.composer-row .input { flex: 1; }
.composer-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.feed-list { display: flex; flex-direction: column; gap: 10px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.post.is-pinned { border-color: var(--accent); }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-meta { flex: 1; min-width: 0; }
.post-tools { display: flex; gap: 2px; }
.btn-icon-sm { width: 34px; height: 34px; color: var(--muted); }
.btn-icon-sm[aria-pressed="true"] { color: var(--accent); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--accent); font-weight: 600; }
.post-attach summary { cursor: pointer; font-weight: 600; }
.post-pre { white-space: pre-wrap; font: inherit; font-size: 0.9rem; background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; margin: 8px 0 0; overflow-wrap: anywhere; }
.post-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; }
.reaction { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; background: transparent; font-size: 1rem; color: var(--ink); }
.reaction.has-count { background: var(--surface-2); }
.reaction.is-active { border-color: var(--accent); background: var(--accent-soft); }
.reaction .num { font-size: 0.8rem; }
.comment-box { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.comments { display: flex; flex-direction: column; gap: 8px; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment .avatar { width: 26px; height: 26px; font-size: 0.65rem; }
.comment-body { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 12px; padding: 6px 10px; }
.comment-body .post-text { font-size: 0.95rem; }
.recipe-card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.recipe-card-main { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 0; text-align: left; color: inherit; }
.recipe-card-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.recipe-card .row-actions { padding: 8px 10px; }
.product-card .recipe-card-main { cursor: default; }
.product-card-img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface); flex: 0 0 auto; }
.sheet-head-tools { display: flex; gap: 2px; margin-left: auto; }
.feed-tools { display: flex; justify-content: flex-end; margin-top: -8px; }
.member-row { padding-left: 4px; }
.avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.avatar-wrap.is-online::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--cuisine); border: 2px solid var(--surface); }
.members-list section { margin-top: 12px; }
.publish-preview { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r); }
.publish-preview svg { width: 20px; height: 20px; flex: 0 0 auto; }
.feed-act { display: flex; align-items: center; gap: 10px; padding: 6px 14px; color: var(--muted); font-size: 0.9rem; }
.feed-act .icon { width: 16px; height: 16px; }
.feed-act.is-bad .icon { color: var(--danger); }
.feed-act .feed-text { flex: 1; }
.feed-act strong { color: var(--ink); font-weight: 600; }
.wall-head .avatar { margin-right: 2px; }
@media (min-width: 900px) { .screen-foyer { max-width: 720px; } }

.meal-link { display: inline-flex; margin-left: 6px; color: var(--cuisine); vertical-align: middle; }
.meal-link .icon { width: 14px; height: 14px; }

.avatar-img { object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.profile-row { display: flex; gap: 14px; align-items: center; }
.profile-row > div { display: flex; flex-direction: column; gap: 8px; }

.feed-body { display: flex; flex-direction: column; gap: 16px; }
