:root {
  --bg: #0f0f12;
  --surface: #1a1a20;
  --surface-2: #24242c;
  --line: #2e2e38;
  --fg: #f4f4f5;
  --soft: #d4d4d8;
  --muted: #a1a1aa;
  --accent: #ff3b4e;
  --accent-ink: #160a0c;
  --accent-soft: #2a1216;
  --ok: #4ade80;
  --ok-soft: #12261a;
  --warn: #ffb23a;
  --warn-soft: #2a2112;
  --info: #3af0ff;
  --display: 'Space Grotesk', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: 30px; line-height: 1.08; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 17px; }
p { margin: 0; }
[hidden] { display: none !important; }

.shell {
  max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 17px; flex: none;
}
.brand b { font-family: var(--display); font-size: 20px; letter-spacing: -0.02em; }
.brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.main { flex: 1; display: flex; flex-direction: column; gap: 20px; padding-block: 8px 24px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.label {
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em;
}
.num { font-variant-numeric: tabular-nums; }
.big { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card.accent { background: var(--accent-soft); border-color: var(--accent); }
.card.ok { background: var(--ok-soft); border-color: var(--ok); }
.card.warn { background: var(--warn-soft); border-color: var(--warn); }

.btn {
  min-height: 50px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: transparent;
  color: var(--fg); font-weight: 600; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none; text-align: center;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px; }
.btn.block { width: 100%; }
.btn.small { min-height: 44px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.btn.link { border: none; min-height: 44px; padding: 0; color: var(--muted); font-weight: 500; }
.btn.danger { border-color: var(--accent); color: var(--accent); }
.btn.demo { border: 1px dashed var(--accent); color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px;
}
textarea.input { padding: 12px 14px; min-height: 110px; resize: vertical; }
.input::placeholder { color: #8d8d96; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 14px; color: var(--soft); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

.choice {
  width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-align: left;
}
.choice[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); padding: 11px 15px; }
.choice small { display: block; color: var(--muted); font-size: 13px; }
.choice strong { font-size: 16px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.stepper { display: flex; align-items: center; justify-content: space-between; padding: 8px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 12px; border: none; background: var(--surface-2); font-size: 24px; cursor: pointer;
}

.footer-bar {
  position: sticky; bottom: 0; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--bg); border-top: 1px solid var(--surface-2); display: flex; align-items: center; gap: 14px;
}

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.red { color: #ff8a95; background: var(--accent-soft); }
.pill.info { color: var(--info); background: #0f2629; }
.pill.grey { color: var(--soft); background: var(--surface-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }

.chat { display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 18px; font-size: 15px; word-wrap: break-word; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.bubble.sys { align-self: center; background: transparent; color: var(--muted); font-size: 13px; text-align: center; max-width: 90%; }
.bubble.blocked { align-self: flex-end; background: var(--warn-soft); border: 1px solid var(--warn); color: #ffd38a; font-size: 13px; }
.composer { display: flex; gap: 8px; }
.composer .input { border-radius: 25px; }
.send {
  width: 50px; height: 50px; border-radius: 50%; border: none; background: var(--accent); flex: none;
  display: grid; place-items: center; cursor: pointer;
}

.radar {
  width: 140px; height: 140px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center;
  margin: 8px auto;
}
.radar span {
  width: 92px; height: 92px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent);
  display: grid; place-items: center; animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(0.9); opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) { .radar span { animation: none; } }

.loyalty { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.loyalty i { height: 10px; border-radius: 5px; background: var(--line); }
.loyalty i.on { background: var(--accent); }

.tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--surface-2); }
.tabs button { min-height: 52px; border: none; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button[aria-current="page"] { color: var(--accent); }

details.faq { border-bottom: 1px solid var(--line); }
details.faq summary { list-style: none; cursor: pointer; padding: 14px 32px 14px 0; font-weight: 600; position: relative; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 22px; color: var(--accent); }
details.faq[open] summary::after { content: "−"; }
details.faq p { padding-bottom: 14px; color: var(--soft); font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.demo-banner {
  background: var(--warn-soft); color: var(--warn); font-size: 12px; font-weight: 600; text-align: center;
  padding: 6px 12px;
}
.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }

/* Barre de navigation fixe en bas (client et membre) */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg); border-top: 1px solid var(--surface-2);
  padding: 6px max(12px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
}
.navbar button {
  min-height: 54px; border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative;
}
.navbar button svg { width: 22px; height: 22px; }
.navbar button[aria-current="page"] { color: var(--accent); }
.navbar .nav-dot { position: absolute; top: 8px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
body.has-nav { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
body.has-nav .footer-bar { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); padding-bottom: 14px; }
.navbar-inner { max-width: 480px; margin: 0 auto; display: contents; }

/* Nouvelle demande : doit sauter aux yeux */
.new-req { border: 2px solid var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255, 59, 78, 0.18); } }
.new-head { display: flex; align-items: center; gap: 10px; }
.new-head h2 { color: var(--fg); }
.count { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { .new-req { animation: none; } }

/* Bouton "On est entrés" : vert, à part du bouton d'envoi */
.btn.go { background: var(--ok); border-color: var(--ok); color: #06210f; font-weight: 700; font-size: 17px; }
.btn.go.armed { background: #ffffff; border-color: #ffffff; color: #06210f; }
body.has-nav .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
