:root {
  --red: #b8434b;
  --red-dark: #8f2f37;
  --green: #2f7a55;
  --bg: #faf6f1;
  --card: #ffffff;
  --text: #2b2522;
  --muted: #7a6f68;
  --line: #ece3da;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1a19; --card: #2a2625; --text: #f1ebe6; --muted: #b3a79f; --line: #3b3533; --red: #d9636b; --green: #5cb88a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--red); color: #fff;
}
.topbar h1 { flex: 1; margin: 0; font-size: 1.15rem; text-align: center; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.topbar .icon-btn[hidden] { display: block; visibility: hidden; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h2 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 24px 4px 8px; }
.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  color: inherit; text-decoration: none;
}
.intro { text-align: center; }
.big-emoji { font-size: 3rem; margin: 0; }
.person { display: flex; flex-direction: column; gap: 2px; }
.person.mine { border-left: 5px solid var(--red); }
.person-name { font-weight: 600; font-size: 1.1rem; }
.person-meta { color: var(--muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hint { color: var(--muted); font-size: .92rem; margin: 4px 4px 14px; }
.empty { text-align: center; color: var(--muted); margin-top: 30px; }
.items { list-style: none; padding: 0; margin: 14px 0 0; }
.item.taken { opacity: .65; }
.item-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item-title { font-size: 1.05rem; }
.price { color: var(--muted); white-space: nowrap; }
.note { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.link { display: inline-block; margin-top: 4px; color: var(--red); overflow-wrap: anywhere; }
.badge {
  display: inline-block; margin: 6px 0 0; padding: 2px 8px; border-radius: 99px;
  background: var(--line); color: var(--muted); font-size: .8rem;
}
.badge.mine { margin: 0; background: var(--green); color: #fff; }
.status { margin: 8px 0 0; font-weight: 600; font-size: .92rem; }
.status.mine { color: var(--green); }
.status.taken { color: var(--muted); }
.status.warn { color: var(--red); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.small { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger { color: var(--red); }
.btn.block { display: flex; width: 100%; margin: 10px 0; }
.btn:disabled { opacity: .5; }
form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; color: var(--muted); }
input, textarea {
  font: inherit; font-size: 17px; /* 16px+ : evite le zoom automatique sur iPhone */
  padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; }
.form-error { color: var(--red); margin: 0; font-weight: 600; }
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #2b2522; color: #fff; padding: 10px 18px; border-radius: 99px; font-size: .95rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); max-width: 90vw; text-align: center;
}
#toast.error { background: var(--red-dark); }
[hidden] { display: none; }
