:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --ink: #2f2a26;
  --muted: #7b716a;
  --line: #ece4da;
  --accent: #c8775a;       /* terracotta doux */
  --accent-ink: #ffffff;
  --accent-soft: #f6e4dc;
  --sage: #7f9b84;
  --sage-soft: #e5ede6;
  --offered: #a59d96;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 6px 18px rgba(60, 40, 20, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* En-tête */
.hero { background: linear-gradient(180deg, #f4e9df 0%, var(--bg) 100%); padding: 48px 0 28px; text-align: center; }
.hero-sub { margin: 0; color: var(--accent); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.9rem, 5vw, 2.8rem); margin: .2em 0 .35em; line-height: 1.15; }
.hero-intro { max-width: 640px; margin: 0 auto 16px; color: var(--muted); }
.hero-count { margin: 0 0 14px; }
.hero-count strong { color: var(--accent); font-size: 1.15em; }
.stores { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; font-size: .9rem; color: var(--muted); }
.stores a { color: var(--ink); }
.stores .ref { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .8rem; }

/* Barre de filtres */
.toolbar { position: relative; z-index: 5; background: rgba(251, 247, 242, .94); backdrop-filter: blur(6px);
  padding: 12px 0; margin-bottom: 8px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
@media (min-width: 760px) { .toolbar { position: sticky; top: 0; } }
@media (max-width: 559px) {
  .hero { padding: 32px 0 20px; }
  .controls select { flex: 1 1 45%; font-size: .85rem; }
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px;
  padding: 6px 14px; font: inherit; font-size: .9rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .6; margin-left: 4px; font-size: .85em; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.controls select { font: inherit; font-size: .9rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); max-width: 100%; }
.toggle { font-size: .9rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* Grille de produits */
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; padding: 8px 0 32px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 880px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1140px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.section-title { grid-column: 1 / -1; font-family: var(--serif); font-size: 1.3rem; margin: 18px 0 0; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.card .pic { aspect-ratio: 1 / 1; background: #fff; display: grid; place-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.card .pic img { width: 100%; height: 100%; object-fit: contain; }
.card .pic .noimg { font-size: 2.6rem; opacity: .35; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .75rem; }
.badge { border-radius: 999px; padding: 2px 9px; font-weight: 600; letter-spacing: .01em; }
.badge.store { background: #f1ece6; color: var(--muted); }
.badge.essential { background: var(--accent-soft); color: #9a4f34; }
.badge.offered { background: var(--sage-soft); color: #4c6a52; }
.badge.partial { background: #fff3d6; color: #8a6514; }
.card h3 { font-size: 1rem; line-height: 1.35; margin: 2px 0 0; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.brand { color: var(--muted); font-size: .85rem; margin: 0; }
.note { font-size: .85rem; color: var(--muted); font-style: italic; margin: 0; }
.price { font-weight: 700; font-size: 1.1rem; margin-top: auto; padding-top: 6px; }
.qty { font-size: .85rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.actions .btn.ghost { flex: 1 1 auto; }
.btn { white-space: nowrap; font: inherit; font-size: .92rem; font-weight: 600; border-radius: 12px; padding: 10px 14px; cursor: pointer; border: 1px solid transparent; text-decoration: none; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); flex: 1; }
.btn.primary:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #f6f1eb; }
.btn.small { padding: 7px 10px; font-size: .85rem; }
.mine { font-size: .85rem; color: #4c6a52; background: var(--sage-soft); border-radius: 10px; padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mine button { background: none; border: 0; color: #4c6a52; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.held { font-size: .85rem; color: #85600e; background: #fff4dc; border-radius: 10px; padding: 9px 11px; margin-top: 8px; font-weight: 600; }
.held span { font-weight: 400; }
.myhold { font-size: .8rem; color: #3e6e9e; background: #eef4fa; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.myhold button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: #3e6e9e; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.card.is-held .pic img { opacity: .6; }
.card.is-offered .pic img { filter: grayscale(1); opacity: .45; }
.card.is-offered h3, .card.is-offered .price { color: var(--offered); }
.card.is-offered .price { text-decoration: line-through; font-weight: 600; }
.ribbon { position: absolute; top: 12px; left: 12px; background: var(--sage); color: #fff; font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 999px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.foot { text-align: center; color: var(--muted); padding: 24px 16px 48px; }
.foot p { margin: 0 0 10px; }
.admin-link { font-size: .8rem; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.admin-link:hover { color: var(--ink); border-color: var(--muted); }

/* Fenêtre « Je l'offre » */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(47, 42, 38, .45); }
dialog form { padding: 24px; position: relative; display: block; }
dialog .close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.dlg-kicker { margin: 0; color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; }
dialog h2 { font-family: var(--serif); font-size: 1.3rem; margin: 4px 28px 10px 0; line-height: 1.25; }
.dlg-tip { background: #f8f3ee; border-radius: 12px; padding: 10px 12px; font-size: .9rem; color: #5b524b; margin: 0 0 14px; }
dialog label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 12px; }
dialog .opt { font-weight: 400; color: var(--muted); }
dialog input, dialog textarea { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; }
dialog input:focus, dialog textarea:focus, .controls select:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dlg-actions { display: flex; gap: 10px; margin-top: 6px; }
.dlg-actions .btn.ghost { flex: none; }
.dlg-error { color: #a33; font-size: .9rem; }
[hidden] { display: none !important; }

/* Cagnotte */
.pot { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin: 4px 0 18px; border: 1px solid #f1dcd1; }
.pot-icon { font-size: 2rem; grid-row: span 2; align-self: start; }
.pot h2 { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 4px; }
.pot p { margin: 0 0 4px; color: #5b524b; font-size: .92rem; }
.pot-amount strong { color: var(--accent); }
.pot-how { font-size: .82rem !important; color: var(--muted) !important; }
.pot-btn { grid-column: 2; justify-self: start; flex: none; }
@media (min-width: 760px) {
  .pot { grid-template-columns: auto 1fr auto; }
  .pot-icon { grid-row: auto; align-self: center; }
  .pot-btn { grid-column: auto; justify-self: end; }
}
.potlink { font-size: .8rem; color: var(--accent); text-decoration: none; margin-top: 2px; }
.potlink:hover { text-decoration: underline; }
