:root {
  --bg: #faf6f1;
  --paper: #ffffff;
  --ink: #2b211b;
  --muted: #8a7b70;
  --line: #eadfd4;
  --accent: #7a3e1d;
  --accent-soft: #f3e3d6;
  --diner: #d98e04;
  --souper: #3d5a80;
  --invites: #9b2c5a;
  --radius: 14px;
  font-size: 17px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; }
h1 { font-size: 1.7rem; margin: .4rem 0 .6rem; }
main { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* En-tête */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--accent); color: #fff;
  padding: .6rem 1rem calc(.6rem) ;
  padding-top: max(.6rem, env(safe-area-inset-top));
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem;
}
.brand { color: #fff; text-decoration: none; font-family: Georgia, serif; font-size: 1.2rem; font-weight: bold; }
.top nav { display: flex; flex-wrap: wrap; gap: .2rem; margin-left: auto; }
.top nav a { color: #f6e6da; text-decoration: none; padding: .3rem .55rem; border-radius: 999px; font-size: .92rem; white-space: nowrap; }
.top nav a.active, .top nav a:hover { background: rgba(255,255,255,.18); color: #fff; }
@media (max-width: 520px) { .top nav { margin-left: 0; width: 100%; } }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem 1rem 2rem; }
.foot a { color: var(--muted); }

/* Filtres */
.filters { display: grid; gap: .6rem; margin-bottom: .4rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=search], input:not([type]), input[type=password], input[type=text], select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; }
.row select { flex: 1 1 140px; min-width: 0; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; margin: .4rem 0; }
.chip {
  padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  text-decoration: none; color: var(--ink); white-space: nowrap; font-size: .92rem;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.count { color: var(--muted); font-size: .88rem; margin: .4rem 0; }

/* Cartes */
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; gap: .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; text-decoration: none; color: inherit; height: 100%;
}
.card:active { transform: scale(.99); }
.card img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.card-body { min-width: 0; }
.card h2 { font-size: 1.08rem; margin: .2rem 0; }
.card-top { display: flex; align-items: center; gap: .5rem; }
.meta { margin: 0; font-size: .88rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.badge { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .5rem; border-radius: 6px; color: #fff; }
.badge-diner { background: var(--diner); }
.badge-souper { background: var(--souper); }
.badge-invites { background: var(--invites); }
.badge-none { background: var(--line); color: var(--muted); }
.stars { color: #e0a100; letter-spacing: 1px; font-size: .9rem; }
.stars .off { color: var(--line); }

/* Recette */
.recipe .hero { width: 100%; max-height: 340px; object-fit: cover; border-radius: var(--radius); margin-bottom: .6rem; }
.recipe section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1.1rem 1rem; margin: 1rem 0; }
.recipe section h2 { font-size: 1.2rem; margin: .7rem 0 .4rem; }
.recipe section h3 { font-size: 1rem; margin: .9rem 0 .2rem; color: var(--accent); }
.recipe ul, .recipe ol { margin: .2rem 0; padding-left: 1.3rem; }
.recipe ul li { margin: .25rem 0; }
.recipe ol li { margin: .55rem 0; }
.recipe .notes { background: #fffbea; border-color: #f1e3a6; }
.back { text-decoration: none; font-size: .92rem; }
.rating { display: flex; gap: .1rem; margin: .5rem 0; }
.rating button { background: none; border: 0; font-size: 1.7rem; color: var(--line); cursor: pointer; padding: 0 .1rem; line-height: 1; }
.rating button.on { color: #e0a100; }
.cooked { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.inline { display: inline-flex; gap: .4rem; }

/* Boutons */
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: .65rem 1.2rem; text-decoration: none; cursor: pointer; font-weight: 600;
}
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
.btn-small { padding: .4rem .8rem; font-size: .9rem; }
.btn-danger { background: none; color: #b42318; border: 1px solid #f0c6c1; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* Formulaires */
.edit { display: grid; gap: .9rem; }
.edit label { display: grid; gap: .3rem; font-weight: 600; font-size: .95rem; }
.edit small { font-weight: 400; color: var(--muted); }
.edit textarea { resize: vertical; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.grid2 { display: grid; grid-template-columns: 3fr 1fr; gap: .6rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 label:first-child { grid-column: 1 / -1; } }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.radios legend { font-weight: 600; font-size: .95rem; margin-bottom: .3rem; }
.edit .radios label, .edit label.check { display: flex; align-items: center; gap: .4rem; font-weight: 400; }
.radios label { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; }
.photo-current { display: flex; align-items: center; gap: 1rem; }
.photo-current img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; }
.danger { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }

.alert { background: #fdecea; color: #8a1c13; border-radius: 10px; padding: .7rem 1rem; margin: .6rem 0; }
.alert-ok { background: #e7f5ea; color: #1d5e2c; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

/* Import */
.preview { list-style: none; padding: 0; display: grid; gap: .4rem; }
.preview li { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid #3a9b5a; border-radius: 8px; padding: .5rem .8rem; }
.preview li.warn { border-left-color: #e0a100; }
.preview li.bad { border-left-color: #b42318; }
.err { color: #b42318; font-size: .88rem; }
.warn-msg { color: #8a6200; font-size: .88rem; }
.help { margin-top: 2rem; color: var(--muted); }
.help summary { cursor: pointer; }

/* Connexion */
.login { max-width: 340px; margin: 12vh auto 0; display: grid; gap: .9rem; text-align: center; }
.login label { display: grid; gap: .3rem; text-align: left; font-weight: 600; }

/* Comptes */
.who { color: #f6e6da; font-size: .85rem; }
.badge-dessert { background: #8e5bb5; }
.badge-admin { background: var(--accent); }
.sign { font-style: italic; color: var(--accent); font-family: Georgia, serif; }
.signature { margin: -.3rem 0 .6rem; }
.page-title { font-size: 1.4rem; }
.accounts { list-style: none; padding: 0; display: grid; gap: .5rem; }
.accounts li { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; }
.acc-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.accounts details { margin-top: .4rem; }
.accounts summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.inline-form { display: flex; gap: .4rem; margin: .5rem 0; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; width: auto; }
.login small { font-weight: 400; color: var(--muted); }
