/* ---------- Polices embarquées (fonctionnent hors ligne) ---------- */
@font-face { font-family: "Lato"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/lato-400.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-style: normal; font-weight: 700 900; font-display: swap; src: url("../fonts/lato-700.woff2") format("woff2"); }
/* Calistoga (SIL OFL) : titres et sujets, pour une voix chaleureuse et éditoriale plutôt que « messagerie » */
@font-face { font-family: "Calistoga"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/calistoga-400.woff2") format("woff2"); }
:root {
  --ink: #3E5C47;          /* sauge profond : boutons, titres, portefeuille */
  --sage: #87A68A;         /* sauge signature */
  --sage-soft: #CFDDCC;
  --mango: #E0A43A;        /* miel : accent chaleureux */
  --forest: #4E7A5A;
  --danger: #C8423F;
  --bg: #EEF2EC;
  --surface: #FFFFFF;
  --surface-2: #E3EAE0;
  --text: #1D2A21;
  --muted: #4A584E;
  --line: #D3DDD0;
  --primary: var(--ink);
  --on-primary: #FFFFFF;
  --bubble-me: #4E6E58;
  --bubble-me-text: #FFFFFF;
  --bubble: #FFFFFF;
  --radius-l: 22px;
  --radius-m: 14px;
  --radius-s: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.23, 1, .32, 1);      /* entrées, retour au toucher */
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);   /* feuilles façon iOS */
  /* Échelle typographique (min. 13 px) */
  --fs-xs: .8125rem; --fs-sm: .9375rem; --fs-md: 1.0625rem; --fs-lg: 1.25rem; --fs-xl: 1.5rem; --fs-2xl: 1.875rem;
  /* Grille de 4 px */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --tap: 44px;
  --font-display: "Calistoga", Georgia, "Noto Serif", serif;
  --font: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tab-h: 64px;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111814; --surface: #19231C; --surface-2: #233027; --text: #E6EEE7; --muted: #B3C0B6; --line: #2C3A30; --sage-soft: #2E4234;
    --primary: #9DBF9F; --on-primary: #0F1A12; --bubble-me: #3E5C47; --bubble: #1F2B23; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111814; --surface: #19231C; --surface-2: #233027; --text: #E6EEE7; --muted: #B3C0B6; --line: #2C3A30; --sage-soft: #2E4234;
  --primary: #9DBF9F; --on-primary: #0F1A12; --bubble-me: #3E5C47; --bubble: #1F2B23; color-scheme: dark;
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, [role="button"], label.item, .switch { touch-action: manipulation; }
button, .btn, .chip, .pill, .tabbar a, .icon-btn, .help-btn, .quick-card, .balance-row, .list > a.item { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
img, svg { max-width: 100%; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 900; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-lg); font-weight: 900; }
h3 { font-size: var(--fs-md); font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Coquille ---------- */
#app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; background: var(--bg); position: relative; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px 10px; background: var(--bg); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title h1 { font-size: var(--fs-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--surface); display: grid; place-items: center; position: relative; flex: none; color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--mango); border: 2px solid var(--surface); }
.help-btn { display: inline-flex; align-items: center; gap: 6px; height: var(--tap); padding: 0 var(--sp-4) 0 var(--sp-3); border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--primary); font-weight: 700; font-size: var(--fs-sm); flex: none; }
.help-btn svg { flex: none; }
main.view { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: var(--sp-1) 20px calc(var(--tab-h) + var(--sp-5)); }
main.view.no-tabs { padding-bottom: 24px; }
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tab-h); text-decoration: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--primary); }
.tabbar a { transition: color .15s ease; }
.tabbar a svg { transition: transform .12s var(--ease-out); }
.tabbar a:active svg { transform: scale(.9); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--sage); }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--mango); color: #2A1D00; font-size: var(--fs-xs); font-weight: 900; display: grid; place-items: center; }

/* ---------- Composants ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 999px; border: 0; font-weight: 750; font-size: 1rem; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-accent { background: var(--mango); color: #2A1D00; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: var(--fs-sm); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0 2px; min-height: var(--tap); color: var(--primary); font-weight: 700; }
.stack > * + * { margin-top: 12px; }
.stack-l > * + * { margin-top: 22px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--surface); border-radius: 16px; padding: var(--sp-4); }
.list { background: var(--surface); border-radius: 16px; overflow: hidden; }
.list > .item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); min-height: 64px; border: 0; background: none; width: 100%; text-align: left; text-decoration: none; color: inherit; }
.list > .item + .item { border-top: 1px solid var(--line); }
.item .ttl { font-weight: 700; }
.list > .item .row.between { align-items: flex-start; gap: 8px; }
.item .sub { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--muted); flex: none; }
.section-h { display: flex; align-items: center; justify-content: space-between; margin: var(--sp-5) 2px var(--sp-3); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; min-height: var(--tap); padding: 0 var(--sp-4); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.tags { align-items: center; }
.tag.premium { background: #F8E7C4; color: #6B4A00; }
.tag.ok { background: var(--sage-soft); color: #2C4A34; }
.tag.warn { background: #F8E7C4; color: #6B4A00; }
.tag.bad { background: #FBDCDD; color: #8E1B1F; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; flex: none; color: #fff; font-weight: 800; }
.avatar.lg { width: 84px; height: 84px; font-size: 2.6rem; }
.avatar.sm { width: 34px; height: 34px; font-size: 1.05rem; }
.stars { color: var(--mango); letter-spacing: 1px; }

/* Bandeau thématique : l'élément signature */
.band { height: 10px; border-radius: 999px; background: repeating-linear-gradient(135deg, var(--c) 0 10px, color-mix(in srgb, var(--c) 55%, #fff) 10px 16px, var(--c) 16px 26px, color-mix(in srgb, var(--c) 30%, #000) 26px 30px); }
.theme-dot { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 1.4rem; flex: none; background: color-mix(in srgb, var(--c) 16%, var(--surface)); }

/* Formulaires */
.field { display: block; }
.field > span { display: block; font-weight: 700; font-size: var(--fs-sm); margin-bottom: 6px; }
.input, textarea.input, select.input { width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--radius-m); border: 1.5px solid var(--line); background: var(--surface); outline: none; }
.input:focus { border-color: var(--primary); }
textarea.input { min-height: 120px; resize: vertical; }
.error { color: var(--danger); font-weight: 700; font-size: var(--fs-sm); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .95rem; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--ink); flex: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.seg button { border: 0; background: none; border-radius: 999px; min-height: var(--tap); font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,28,20,.14); }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background-color .2s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease-out); }
.switch:checked { background: var(--forest); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Onboarding ---------- */
.onb { min-height: 100%; display: flex; flex-direction: column; padding: 28px 22px 26px; }
.onb .art { flex: 1; display: grid; place-items: center; }
.onb .bubbles { position: relative; width: 250px; height: 220px; }
.onb .bub { position: absolute; padding: 12px 16px; border-radius: 22px; font-weight: 700; max-width: 180px; }
.onb .bub.a { top: 10px; left: 0; background: var(--surface); border-bottom-left-radius: 6px; }
.onb .bub.b { top: 82px; right: 0; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.onb .bub.c { bottom: 6px; left: 30px; background: var(--mango); color: #2A1D00; border-bottom-left-radius: 6px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width .25s; }
.dots i.on { width: 24px; background: var(--primary); }
.brand { font-size: 2.3rem; font-weight: 900; letter-spacing: -0.03em; }
.brand b { color: var(--mango); }
.ver { display: inline-block; vertical-align: super; margin-left: 6px; font-size: var(--fs-xs); font-weight: 800; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: #fff; }
.brandbar { display: flex; align-items: center; gap: 2px; padding: 8px 16px 0; }
.brand-sm { font-weight: 900; font-size: 1rem; letter-spacing: -0.02em; color: var(--primary); }
.brand-sm b { color: var(--mango); }
.brandbar .ver { font-size: var(--fs-xs); padding: 1px 7px; vertical-align: baseline; }
.credit { text-align: center; color: var(--muted); font-size: var(--fs-xs); line-height: 1.6; padding: 26px 0 6px; }
.credit b { color: var(--primary); letter-spacing: .06em; }
.onb .credit { padding-top: 14px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head { padding: 10px 16px 8px; background: var(--bg); }
.chat-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--bubble); padding: 9px 13px; border-radius: 18px; border-bottom-left-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
.bubble .who { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.bubble .meta { font-size: var(--fs-xs); opacity: .8; margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.msg-more { border: 0; background: none; color: var(--muted); min-width: var(--tap); min-height: var(--tap); border-radius: 12px; font-size: 1.2rem; line-height: 1; flex: none; }
.msg { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 130px; padding: 11px 14px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--bg); outline: none; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }
.composer .eph { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: -0.02em; }
.composer .eph.on { border-color: var(--mango); color: #6B4A00; background: #F8E7C4; }
.notice { background: var(--surface-2); border-radius: var(--radius-m); padding: var(--sp-3); font-size: var(--fs-sm); color: var(--muted); }
.notice strong { color: var(--text); }
.locked { text-align: center; padding: 40px 16px; }

/* ---------- Feuilles, dialogues, toasts ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 10, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s var(--ease-out); }
.scrim.closing { pointer-events: none; animation: fadeOut .16s ease-in forwards; }
.scrim.closing .sheet { animation: sheetOut .16s ease-in forwards; }
.sheet { width: 100%; max-width: 560px; max-height: 88%; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; animation: sheetIn .32s var(--ease-drawer); }
.sheet .grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650; z-index: 60; max-width: calc(100% - 32px); animation: rise .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(40%); opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.toast { animation-name: toastIn; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }
.toast { animation-duration: .24s; animation-timing-function: var(--ease-out); }
.toast.closing { animation: toastOut .15s ease-in forwards; }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 6px) scale(.98); } }
.help-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--radius-m); background: var(--surface-2); text-decoration: none; color: var(--text); }
.help-line b { font-size: 1.3rem; color: var(--danger); }

/* Portefeuille */
.wallet-card { background: linear-gradient(135deg, #3E5C47, #5E806A 60%, #87A68A);  color: #fff; border-radius: var(--radius-l); padding: 20px; position: relative; overflow: hidden; }
.wallet-card .amount { font-size: 2.2rem; font-weight: 900; letter-spacing: -0.02em; margin: 4px 0 14px; }
.wallet-card .band { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0; --c: var(--mango); height: 8px; }
.option { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-m); border: 1.5px solid var(--line); background: var(--surface); width: 100%; text-align: left; }
.option[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--mango); animation: spin 0.9s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.legal h2 { margin-top: 20px; } .legal p, .legal li { color: var(--muted); margin-top: 8px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 2.4rem; margin-bottom: 8px; }
.thread-msg { padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface); }
.thread-msg.adv { background: color-mix(in srgb, var(--forest) 12%, var(--surface)); }
.star-input { display: flex; gap: 6px; justify-content: center; }
.star-input button { border: 0; background: none; font-size: 2rem; color: var(--line); padding: 0 2px; min-width: var(--tap); min-height: var(--tap); transition: color .15s ease, transform .12s var(--ease-out); }
.star-input button:active { transform: scale(.9); }
.star-input button.on { color: var(--mango); }
/* ---------- Affichage dynamique ---------- */
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(135,166,138,.7); } 70% { box-shadow: 0 0 0 8px rgba(135,166,138,0); } 100% { box-shadow: 0 0 0 0 rgba(135,166,138,0); } }
.enter { animation: viewIn .18s var(--ease-out) both; }
.msg.pop { animation: popIn .24s var(--ease-out) both; }
/* Retour au toucher : tout ce qui se presse réagit dès l'appui */
.btn, .chip, .option, .icon-btn, .list > .item, .help-btn, .pill, .seg button, .composer .send, .composer .eph, .msg-more, .balance-row, .activity .act, .notice-link, .swatches .avatar
  { transition: transform .14s var(--ease-out), background-color .2s ease, border-color .2s ease, color .2s ease; }
.btn:active, .chip:active, .option:active, .icon-btn:active, .list > a.item:active, .list > button.item:active, .help-btn:active, .pill:active,
.seg button:active, .composer .send:active, .composer .eph:active, .msg-more:active, .balance-row:active, .activity .act:active, .notice-link:active, .swatches .avatar:active
  { transform: scale(.97); }
.btn[disabled]:active, .composer .send[disabled]:active { transform: none; }
.list > a.item:active, .list > button.item:active { background-color: var(--surface-2); }
.typing { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); padding: 2px 6px; animation: popIn .2s var(--ease) both; }
.typing .dots { display: inline-flex; gap: 3px; background: var(--bubble); padding: 9px 12px; border-radius: 16px; }
.typing .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); animation: blink 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; } .typing .dots i:nth-child(3) { animation-delay: .3s; }
.live { display: inline-flex; align-items: center; gap: 5px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sage); animation: pulse 2s infinite; }
.activity { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 0 6px; scrollbar-width: none; }
.activity::-webkit-scrollbar { display: none; }
.activity .act { flex: none; width: 230px; scroll-snap-align: start; background: var(--surface); border-radius: var(--radius-m); padding: 12px 14px; text-decoration: none; color: inherit; border-left: 4px solid var(--c); }
.activity .act p { font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
.dm-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--sage-soft); border-radius: var(--radius-m); padding: 10px 14px; text-decoration: none; color: var(--text); font-weight: 700; font-size: .9rem; }
.slots { display: inline-flex; gap: 4px; }
.slots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.slots i.used { background: var(--ink); }
.hero-greet { background: linear-gradient(120deg, var(--sage-soft), transparent 70%); border-radius: var(--radius-l); padding: 14px 16px; margin-top: 4px; }
.count-up { display: inline-block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-property: color, background-color, border-color, opacity !important; }
  .enter, .msg.pop, .typing, .scrim, .sheet, .toast { animation-name: fade !important; }
  .scrim.closing, .scrim.closing .sheet, .toast.closing { animation-name: fadeOut !important; }
  .live::before, .typing .dots i { animation: none !important; }
}
@media (min-width: 600px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* ---------- Composants de la refonte UX ---------- */
.band.thin { height: 6px; }
.chat-head { padding: var(--sp-2) var(--sp-4) var(--sp-2); background: var(--bg); }
.pills { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--sp-3); border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); font-weight: 700; text-decoration: none; }
.pill svg { flex: none; opacity: .8; }
.pill.dm-chip { background: var(--sage-soft); }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mango); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mango) 25%, transparent); }
.hero { padding: var(--sp-5); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.quick-card { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-4); border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; min-height: 120px; transition: transform .15s var(--ease); }
.quick-card svg { width: 28px; height: 28px; color: var(--primary); margin-bottom: var(--sp-2); }
.quick-card:active { transform: scale(.97); }
.disclosure { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--primary); font-weight: 700; min-height: var(--tap); padding: 0; font-size: var(--fs-sm); }
.alt-link { text-align: center; color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.info-line { display: flex; gap: var(--sp-3); align-items: flex-start; }
.info-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.info-line p { margin-top: 2px; font-size: var(--fs-sm); }
.danger-link { color: var(--danger); width: 100%; }
.notice-link { display: flex; gap: var(--sp-3); align-items: flex-start; margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: 16px; background: #F8E7C4; color: #3D2A00; text-decoration: none; font-size: var(--fs-sm); }
.balance-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-3); padding: var(--sp-4); border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; }
.balance-row > span:first-child { display: flex; flex-direction: column; }
.balance-row b { font-size: var(--fs-xl); font-weight: 900; }
.gain { color: var(--forest); font-weight: 700; }
.sub.wrap { white-space: normal; }
.item .tags { margin-top: 6px; }
.btn svg { width: 22px; height: 22px; flex: none; }
.chat .help-btn { width: var(--tap); padding: 0; justify-content: center; }
.chat .help-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.swatches { display: grid; grid-template-columns: repeat(4, 36px); gap: 10px; justify-content: center; }
.swatches .avatar.sm { width: 36px; height: 36px; }

/* ---------- Mode sombre : pastilles et encarts (« Répondu » était à 1,1:1) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.ok { background: #2E4234; color: #BFD9C1; }
  :root:not([data-theme="light"]) .tag.premium, :root:not([data-theme="light"]) .tag.warn { background: #3D3218; color: #F2CF86; }
  :root:not([data-theme="light"]) .tag.bad { background: #43201F; color: #F4B4B2; }
  :root:not([data-theme="light"]) .notice-link { background: #3D3218; color: #F6E3B8; }
  :root:not([data-theme="light"]) .composer .eph.on { background: #3D3218; color: #F2CF86; border-color: #8A6A2A; }
}
:root[data-theme="dark"] .tag.ok { background: #2E4234; color: #BFD9C1; }
:root[data-theme="dark"] .tag.premium, :root[data-theme="dark"] .tag.warn { background: #3D3218; color: #F2CF86; }
:root[data-theme="dark"] .tag.bad { background: #43201F; color: #F4B4B2; }
:root[data-theme="dark"] .notice-link { background: #3D3218; color: #F6E3B8; }
:root[data-theme="dark"] .composer .eph.on { background: #3D3218; color: #F2CF86; border-color: #8A6A2A; }
/* Icônes d'état (remplacent les emoji ✅ ⚠️ 🔒) */
.state-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: var(--sage-soft); color: var(--primary); }
.state-ico svg { width: 32px; height: 32px; }
.state-ico.warn { background: color-mix(in srgb, var(--mango) 22%, var(--surface)); color: #8A5A00; }
:root[data-theme="dark"] .state-ico.warn { color: #F2CF86; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .state-ico.warn { color: #F2CF86; } }
/* Vérification anti-robots (Cloudflare Turnstile) pendant l'inscription et la connexion */
.captcha-box { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70;
  width: min(340px, calc(100% - 32px)); background: var(--surface); color: var(--text); border-radius: 16px; padding: var(--sp-3) var(--sp-4);
  box-shadow: 0 8px 30px rgba(10, 18, 13, .18); text-align: center; animation: fade .2s var(--ease-out); }
.captcha-box p { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--sp-2); }
.captcha-box > div:empty { display: none; }

/* ======================================================================
   Refonte « cercle de parole » : des groupes d'entraide, pas une messagerie.
   Titres en Calistoga, prises de parole en cartes, sujet de la semaine,
   réactions de soutien, identité par thème (--c = couleur du thème).
   ====================================================================== */
h1, h2, .brand, .brand-sm { font-family: var(--font-display); font-weight: 400; letter-spacing: 0; }
.brand { letter-spacing: -0.01em; }

/* Onboarding : des cartes posées, plus des bulles de discussion */
.onb .bub, .onb .bub.a, .onb .bub.b, .onb .bub.c { border-radius: 18px; box-shadow: 0 8px 20px rgba(16, 28, 20, .10); }
.onb .bub.a { transform: rotate(-3deg); } .onb .bub.b { transform: rotate(2.5deg); } .onb .bub.c { transform: rotate(-1.5deg); }

/* ---------- Groupe : en-tête du cercle ---------- */
.circle .chat-scroll { display: block; padding: var(--sp-1) var(--sp-4) var(--sp-5); }
.cover { position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-4) 20px; border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 24%, var(--surface)), color-mix(in srgb, var(--c) 8%, var(--surface))); }
.cover::after, .circle-card::before { content: ""; position: absolute; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(135deg, var(--c) 0 10px, color-mix(in srgb, var(--c) 55%, #fff) 10px 16px, var(--c) 16px 26px, color-mix(in srgb, var(--c) 30%, #000) 26px 30px); }
.cover::after { bottom: 0; }
.cover-ico { width: 52px; height: 52px; border-radius: 16px; background: var(--surface); display: grid; place-items: center; font-size: 1.6rem; flex: none; box-shadow: 0 1px 3px rgba(16, 28, 20, .10); }
.cover-theme { display: block; font-size: var(--fs-xs); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 65%, var(--text)); }
.cover-about { display: block; font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.topic-card { margin-top: var(--sp-3); padding: var(--sp-4) 18px var(--sp-2); border-radius: 20px; background: var(--surface); box-shadow: inset 4px 0 0 var(--c); }
.topic-k { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.topic-k svg { width: 18px; height: 18px; color: var(--c); flex: none; }
.topic { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.3; margin: 6px 0 2px; }
.topic-card .link-btn, .topic-card > .muted { display: inline-flex; align-items: center; gap: 6px; }
.topic-card > .muted { min-height: var(--tap); }
.topic-card .link-btn svg { width: 18px; height: 18px; }
.circle-head .pills { margin-top: var(--sp-3); }
.posts-h { font-size: var(--fs-lg); margin: var(--sp-5) 2px var(--sp-3); }

/* ---------- Groupe : prises de parole en cartes ---------- */
.circle .posts { display: flex; flex-direction: column; gap: var(--sp-3); }
.circle .msg, .circle .msg.me { display: block; max-width: none; align-self: stretch; flex-direction: initial; }
.post { background: var(--surface); border-radius: 18px; padding: var(--sp-3) 14px var(--sp-2); box-shadow: 0 1px 0 var(--line); }
.post.me { background: color-mix(in srgb, var(--c) 7%, var(--surface)); box-shadow: inset 3px 0 0 var(--c), 0 1px 0 var(--line); }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head .who { display: block; font-weight: 900; font-size: var(--fs-sm); color: var(--text); margin: 0; }
.post-head .meta { display: flex; gap: 8px; align-items: center; font-size: var(--fs-xs); color: var(--muted); margin: 0; opacity: 1; }
.post-head .msg-more { margin-right: -8px; }
.circle .bubble, .circle .msg.me .bubble { background: none; color: var(--text); padding: var(--sp-2) 0 6px; border-radius: 0; line-height: 1.55; }
/* Réactions de soutien : trois gestes, à la place des réponses courtes en rafale */
.reacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.react { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px; padding: 4px 2px; border: 0; border-radius: 12px;
  background: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; line-height: 1.2; transition: transform .14s var(--ease-out), background-color .2s ease, color .2s ease; }
.react .ri { display: inline-flex; align-items: center; gap: 4px; }
.react svg { width: 20px; height: 20px; flex: none; }
.react b { font-weight: 900; }
.react:active { transform: scale(.95); }
.react.on { color: color-mix(in srgb, var(--c) 72%, var(--text)); background: color-mix(in srgb, var(--c) 13%, var(--surface)); }
.react.on[data-kind="merci"] svg { fill: currentColor; }
.react-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.react-sum > span { display: inline-flex; align-items: center; gap: 3px; }
.react-sum svg { width: 16px; height: 16px; color: var(--c); }
.circle .typing { margin-bottom: var(--sp-1); }
/* Zone « Prendre la parole » */
.composer.speak { border-top: 0; box-shadow: 0 -8px 24px rgba(16, 28, 20, .07); }
.composer.speak textarea { border-radius: 16px; background: var(--surface-2); border-color: transparent; }
.composer.speak textarea:focus { border-color: var(--c); background: var(--surface); }
.composer.speak .send { border-radius: 14px; }

/* ---------- Liste des groupes : un cercle = une carte ---------- */
.circles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.circle-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px; min-height: 176px; padding: 18px 14px 14px; border-radius: 18px;
  background: var(--surface); color: var(--text); text-decoration: none; transition: transform .14s var(--ease-out); }
.circle-card::before { top: 0; }
.circle-card:active { transform: scale(.97); }
.cc-top { display: flex; align-items: center; gap: 8px; }
.cc-top .theme-dot { width: 36px; height: 36px; border-radius: 12px; font-size: 1.1rem; }
.cc-theme { font-size: var(--fs-xs); font-weight: 900; line-height: 1.25; color: color-mix(in srgb, var(--c) 65%, var(--text)); }
.cc-name { font-family: var(--font-display); font-size: 1.125rem; line-height: 1.2; }
.cc-topic { font-size: var(--fs-xs); line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cc-topic svg { width: 14px; height: 14px; vertical-align: -2px; }
.cc-foot { margin-top: auto; padding-top: 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.cc-foot span { display: block; font-weight: 400; }
.explore-item { box-shadow: inset 4px 0 0 var(--c); }

/* ---------- Accueil : sujets de la semaine à la une ---------- */
.topic-tiles { display: flex; gap: var(--sp-3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -20px; padding: 2px 20px 6px; scroll-padding-left: 20px; }
.topic-tiles::-webkit-scrollbar { display: none; }
.topic-tile { flex: none; width: 78%; max-width: 300px; min-height: 172px; scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); border-radius: 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 22%, var(--surface)), var(--surface) 72%); color: var(--text); text-decoration: none; transition: transform .14s var(--ease-out); }
.topic-tile:active { transform: scale(.98); }
.tt-k { font-size: var(--fs-xs); font-weight: 900; color: color-mix(in srgb, var(--c) 65%, var(--text)); }
.tt-q { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.3; }
.tt-cta { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: var(--fs-sm); color: var(--primary); }
.tt-cta svg { width: 16px; height: 16px; }

/* Écrans très étroits : icône et nombre seulement (l'intitulé reste dans aria-label) */
@media (max-width: 359px) { .react .rl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .react svg { width: 22px; height: 22px; } }
@media (prefers-reduced-motion: reduce) { .react, .circle-card, .topic-tile { transition-property: color, background-color !important; } }
