/* Messages et conversation du golfeur : style clair (fond blanc cassé, cartes blanches, vrai vert), mêmes mesures que la maquette de 430 px */
:root[data-screen="messages"] body,:root[data-screen="chat"] body{background:var(--pal-fond)}
:root[data-screen="messages"] .main,:root[data-screen="chat"] .main{padding:0!important;max-width:none!important;background:var(--pal-fond)}
:root[data-screen="messages"] .topbar,:root[data-screen="chat"] .topbar{display:none!important}

.mx,.cv{--gold:#c9a227;--tx:#15201a;--tx2:#5f6b64;--tx3:#3f4a44;--ln:#e7eae5;
  color:var(--tx);font-family:var(--tb-font)}
.mx a,.cv a{color:inherit;text-decoration:none}
.mx button,.cv button{font:inherit;color:inherit;background:none;border:0;cursor:pointer;padding:0}
.mx .av,.cv .av{width:100%;height:100%;border-radius:50%;margin:0;font-size:13px;font-weight:700;display:grid;place-items:center;background:var(--tb);color:#fff}
.mx .av svg,.cv .av svg{width:100%;height:100%}

/* ---------- liste ---------- */
.mx{max-width:560px;min-height:100vh;margin:0 auto;padding:calc(env(safe-area-inset-top,0px) + 56px) 19px 110px;display:flex;flex-direction:column;gap:12px;background:var(--pal-fond)}
.mx-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:43px}
.mx-head h1{margin:0;font:700 21px/25px var(--tb-font);letter-spacing:-.012em;color:var(--tx)}
.mx-hb{display:flex;align-items:center;gap:8px}
.mx-rb{width:36px;height:36px;border-radius:50%;background:#fff!important;box-shadow:0 1px 4px rgba(20,40,30,.08);display:grid!important;place-items:center;color:var(--tb)!important}
.mx-addf{height:36px;padding:0 14px 0 11px!important;border-radius:18px;background:var(--tb)!important;color:#fff!important;display:flex!important;align-items:center;gap:6px;font-size:12.5px!important;font-weight:600!important;white-space:nowrap}
.mx-find{display:flex;align-items:center;gap:10px;height:40px;padding:0 13px;border-radius:20px;background:#fff;box-shadow:inset 0 0 0 1px var(--ln);color:var(--tx2)}
.mx-find input{flex:1;min-width:0;border:0;background:none;color:var(--tx);font:400 16px var(--tb-font);outline:0;padding:0}
.mx-find input::placeholder{color:#8a948e}
.mx-chips{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none}
.mx-chips::-webkit-scrollbar{display:none}
.mx-chip{flex:none;display:inline-flex!important;align-items:center;gap:6px;height:30px;padding:0 14px!important;border-radius:15px;white-space:nowrap;font-size:12.5px!important;font-weight:500!important;color:var(--tx)!important;background:#fff!important;box-shadow:inset 0 0 0 1px var(--ln)}
.mx-chip i{min-width:17px;height:17px;padding:0 4px;border-radius:9px;display:grid;place-items:center;font:700 10px/1 var(--tb-font);font-style:normal;background:var(--gold);color:#0a3d22}
.mx-chip.on{background:var(--tb)!important;color:#fff!important;box-shadow:none;font-weight:600!important}

.mx-list{display:grid;gap:8px}
.mx-row{box-sizing:border-box;margin:0;font:inherit;color:inherit;display:flex;align-items:center;gap:12px;min-height:66px;padding:12px 14px 12px 12px!important;border-radius:12px;background:#fff!important;box-shadow:inset 0 0 0 1px var(--ln);text-align:left;width:100%}
.mx-row[hidden]{display:none}
.mx-row:active{transform:scale(.985)}
.mx-av{position:relative;flex:none;width:42px;height:42px;border-radius:50%}
.mx-av .av{overflow:hidden}
.mx-on{position:absolute;right:-1px;bottom:-1px;width:11px;height:11px;border-radius:50%;background:var(--tb);box-shadow:0 0 0 2px #fff}
.mx-ic{flex:none;width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:var(--tb);color:#fff}
.mx-ic svg{width:21px;height:21px}
.mx-ic.flag{grid-template-rows:auto auto;align-content:center;gap:1px}
.mx-ic.flag svg{width:19px;height:19px}
.mx-ic.flag small{font:700 6px/1 var(--tb-font);letter-spacing:.04em}
.mx-tx{flex:1;min-width:0;display:grid;gap:3px}
.mx-tx b{display:flex;align-items:center;gap:6px;font-weight:600;font-size:14px;color:var(--tx);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mx-tx small{font-size:12.5px;color:var(--tx2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mx-row.unread .mx-tx small{color:var(--tx);font-weight:500}
.mx-dot{display:none}
.mx-meta{flex:none;align-self:stretch;display:flex;flex-direction:column;align-items:flex-end;justify-content:space-between;padding:2px 0;min-width:34px}
.mx-meta time{font-size:11px;color:#66716b}
.mx-n{min-width:18px;height:18px;padding:0 5px;border-radius:9px;display:grid;place-items:center;background:var(--tb);color:#fff;font:700 10px/1 var(--tb-font);font-style:normal}
.mx-tick{display:block;color:#9aa49e}
.mx-tick svg{display:block;width:18px;height:10px}
.mx-tick.seen{color:var(--tb)}
.mx-link .mx-go{flex:none;color:var(--tx3);transform:rotate(180deg);display:grid}
.mx-link .mx-ic{background:#eef2ee;color:var(--tb)}
.mx-req{display:grid;grid-template-columns:auto 1fr auto;gap:12px;padding:12px 14px 12px 12px;border-radius:12px;background:#fff;box-shadow:inset 0 0 0 1px var(--ln)}
.mx-req time{font-size:11px;color:#66716b}
.mx-req small{white-space:normal!important}
.mx-btns{display:flex;gap:8px;margin-top:8px}
.mx-btns button{height:32px;padding:0 16px!important;border-radius:16px;font-weight:600!important;font-size:12.5px!important}
.mx-no{background:#eceeec!important;color:var(--tx3)!important}
.mx-yes{background:var(--tb)!important;color:#fff!important}
.mx-h2{margin:8px 2px 0;font:500 15px var(--tb-font);color:var(--tx)}
.mx-add{display:flex!important;align-items:center;justify-content:center;gap:9px;height:46px;margin-top:4px;border-radius:23px;font-weight:600!important;color:#fff!important;background:var(--tb)!important}
.mx-empty{display:grid;gap:5px;padding:22px 16px;text-align:center;border-radius:12px;background:#fff;box-shadow:inset 0 0 0 1px var(--ln)}
.mx-empty b{color:var(--tx);font-size:14.5px}
.mx-empty span{color:var(--tx2);font-size:13px}

/* ---------- conversation ---------- */
:root[data-screen="chat"] .cv{position:fixed;left:0;right:0;top:var(--vv-top,0px);height:var(--vv-h,100dvh);z-index:40;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;
  max-width:none;margin:0;background:var(--pal-fond);overflow:hidden}
.cv>*{width:100%;max-width:640px;margin:0 auto}
.cv-bg{display:none}
.cv>:not(.cv-bg){position:relative}
.cv-h{display:flex;align-items:center;gap:12px;padding:calc(env(safe-area-inset-top,0px) + 12px) 19px 12px;background:#fff;box-shadow:0 1px 0 #eceeeb;max-width:none!important}
.cv-back,.cv-more{flex:none;display:grid!important;place-items:center;width:36px;height:36px;border-radius:50%;background:#f1f3f0!important;color:var(--tb)!important}
.cv-back svg{width:18px;height:18px}
.cv-more svg{width:20px;height:20px;transform:rotate(90deg)}
.cv-who{flex:1;min-width:0;display:grid;gap:1px}
.cv-who b{font-size:15px;font-weight:600;color:var(--tx);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cv-who small{font-size:12px;color:var(--tx2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cv-l{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:2px 19px 12px}
.cv-day{display:flex;justify-content:center;margin:14px 0 10px}
.cv-day span{height:22px;padding:0 11px;border-radius:11px;background:#eceeec;font-size:11px;line-height:22px;color:var(--tx2)}
.cv-sys{text-align:center;color:var(--tx2);font-size:12px;margin:10px 0}
.cv-m{display:flex;align-items:flex-end;gap:8px;margin:0 0 8px;max-width:100%}
.cv-m.me{justify-content:flex-end}
.cv-av{flex:none;width:30px;height:30px;border-radius:50%}
.cv-av .av{overflow:hidden;font-size:11px}
.cv-b{position:relative;max-width:min(75%, 420px);padding:9px 12px 6px;border-radius:16px 16px 16px 5px;background:#fff;box-shadow:0 1px 2px rgba(20,40,30,.06);cursor:pointer}
.cv-m.me .cv-b{border-radius:16px 16px 5px 16px;background:var(--tb);box-shadow:none}
.cv-n{display:block;margin-bottom:2px;font-size:11.5px;font-weight:600;color:var(--tb)}
.cv-b p{margin:0;font-size:15px;line-height:1.4;color:var(--tx);white-space:pre-wrap;overflow-wrap:anywhere}
.cv-m.me .cv-b p{color:#fff}
.cv-t{display:flex;align-items:center;justify-content:flex-end;gap:5px;margin-top:3px;font-size:10.5px;color:#8a948e}
.cv-m.me .cv-t{color:rgba(255,255,255,.7)}
.cv-m.me .mx-tick,.cv-m.me .mx-tick.seen{color:#fff}
.cv-x{display:none;margin-top:6px;padding:4px 11px!important;border-radius:12px;background:rgba(0,0,0,.08)!important;font-size:12px!important;font-weight:600!important;color:#c8372d!important}
.cv-m.me .cv-x{background:rgba(255,255,255,.2)!important;color:#fff!important}
.cv-b.sel .cv-x{display:inline-block}
.cv-emo{display:flex;gap:4px;justify-content:center;padding:6px 10px 0;background:#fff;max-width:none!important}
.cv-emo[hidden]{display:none}
.cv-emo button{width:40px;height:40px;border-radius:50%;font-size:21px!important;background:#f1f3f0!important}
.cv-f{display:flex;align-items:flex-end;gap:9px;padding:12px 19px calc(12px + env(safe-area-inset-bottom,0px));background:#fff;box-shadow:0 -1px 0 #eceeeb;max-width:none!important}
:root.kb .cv-f{padding:8px 12px;box-shadow:none}
:root.kb[data-screen="chat"] .cv-card{display:none}
.cv-plus{flex:none;display:grid!important;place-items:center;width:42px;height:42px;border-radius:50%;background:#f1f3f0!important;color:var(--tb)!important}
.cv-in{flex:1;min-width:0;display:flex;align-items:flex-end;min-height:42px;padding:0 6px 0 15px;border-radius:21px;background:#f1f3f0}
.cv-in textarea{flex:1;min-width:0;resize:none;border:0;outline:0;background:none;color:var(--tx);font:400 16px/22px var(--tb-font);padding:10px 0;max-height:112px}
.cv-in textarea::placeholder{color:#8a948e}
.cv-smile{flex:none;display:grid!important;place-items:center;width:34px;height:42px;color:var(--tx2)!important}
.cv-send{flex:none;display:grid!important;place-items:center;width:42px;height:42px;border-radius:50%;background:var(--tb)!important;color:#fff!important}
.cv-send:disabled{opacity:.45}
.cv-send:active,.cv-plus:active{transform:scale(.95)}
.cv-acts{display:grid;gap:8px}
.cv-acts a{display:flex;align-items:center;gap:12px;padding:14px 16px;border-radius:14px;background:var(--soft,#f1f5f2);font-weight:600}

:root[data-screen="chat"] .bottombar,:root[data-screen="chat"] .bottombar.is-player{display:none!important}

/* fiche de l'ami (ou du groupe) en haut : carte vert foncé, photo du golf, avatar, actions */
.cv-h{grid-row:1;z-index:3}
/* la carte est posée sur le haut de la conversation : elle glisse sous l'en-tête au fil du défilement */
.cv-card{grid-row:2;grid-column:1;align-self:start;z-index:2;padding:12px 19px 8px;background:linear-gradient(#F7F7F7,rgba(247,247,247,.92) 85%,rgba(247,247,247,0));will-change:transform}
.cv-l{grid-row:2;grid-column:1}
.cv-emo{grid-row:3}
.cv-f{grid-row:4}
.cv-cardin{border-radius:13px;background:var(--tb-d);color:#fff;overflow:hidden}
.cv-ban{position:relative;display:flex;align-items:flex-end;gap:12px;min-height:96px;padding:12px 14px 4px;overflow:hidden}
.cv-ban-bg{position:absolute;left:0;right:0;top:0;height:78px}
.cv-ban-bg>*{width:100%!important;height:100%!important;object-fit:cover;display:block}
.cv-ban-bg::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(10,79,43,0),var(--tb-d))}
.cv-ban>:not(.cv-ban-bg){position:relative}
.cv-big{flex:none;width:52px;height:52px;border-radius:50%;box-shadow:0 0 0 3px var(--tb-d);display:block;background:var(--tb)}
.cv-big .av{overflow:hidden;font-size:17px}
.cv-big .mx-ic{width:100%;height:100%;border-radius:50%;background:var(--tb)}
.cv-id{min-width:0;display:grid;gap:2px;padding-bottom:4px}
.cv-id b{font-size:15px;font-weight:600;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cv-st{display:flex;align-items:center;gap:6px;font-size:11.5px;color:rgba(255,255,255,.8)}
.cv-st::before{content:"";width:8px;height:8px;border-radius:50%;background:rgba(255,255,255,.45)}
.cv-st.on::before{background:#3fd27a}
.cv-lv{display:flex;align-items:center;gap:7px;font-size:11.5px;color:rgba(255,255,255,.8)}
.cv-lv i{width:3px;height:3px;border-radius:50%;background:currentColor;opacity:.8}
.cv-lv em{font-style:normal;color:var(--gold);font-weight:600}
.cv-acts4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:10px 14px 14px}
.cv-a{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:4px;height:52px;padding:0 2px!important;border-radius:10px;background:rgba(255,255,255,.1)!important;color:#fff!important;text-align:center}
.cv-a:first-child{background:var(--gold)!important;color:#0a3d22!important}
.cv-a svg{width:19px;height:19px}
.cv-a span{font-size:11px;font-weight:600;line-height:1.1}
.cv-a:active{transform:scale(.96)}
.cv-priv{display:flex;align-items:center;justify-content:center;gap:6px;margin:12px 0 0;font-size:11.5px;color:#8a948e}
.cv-priv svg{color:var(--tb)}
:root.kb .cv-card{display:none}
@media(max-height:640px){.cv-ban-bg{display:none}.cv-ban{min-height:0;padding-top:10px}}

/* classement du groupe, dans la carte du haut */
.cv-rk{padding:2px 14px 4px}
.cv-rk-h{display:flex;align-items:center;justify-content:space-between;margin:4px 0 6px}
.cv-rk-h b{font-size:13.5px;font-weight:600}
.cv-rk-h button{display:flex!important;align-items:center;gap:4px;font-size:11px!important;color:rgba(255,255,255,.8)!important}
.cv-rk-r{display:flex;align-items:center;gap:10px;height:30px;margin:0 -8px;padding:0 8px;border-radius:8px;font-size:12.5px}
.cv-rk-r.me{background:rgba(255,255,255,.12);font-weight:600}
.cv-rk-p{flex:none;width:22px;height:22px;border-radius:50%;display:grid;place-items:center;font-size:11px;font-weight:700;background:rgba(255,255,255,.2)}
.cv-rk-p.p1{background:var(--gold);color:#0a3d22}
.cv-rk-a{flex:none;width:24px;height:24px;border-radius:50%;overflow:hidden}
.cv-rk-n{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cv-rk-s{font-size:10.5px;color:rgba(255,255,255,.7)}
.cv-rk-pts{width:48px;text-align:right;font-weight:700}
.cv-rk-e{font-size:12px;color:rgba(255,255,255,.75);padding:2px 0 6px}

/* fond d'écran choisi : la photo derrière les bulles, voilée de blanc pour rester lisible */
.cv-bg.photo{display:block;position:absolute!important;inset:0;max-width:none!important;pointer-events:none}
.cv-bg.photo img{width:100%;height:100%;object-fit:cover;display:block}
.cv-bg.photo::after{content:"";position:absolute;inset:0;background:rgba(246,247,245,.55)}
.cv-acts>button,.cv-wall{display:flex;align-items:center;gap:12px;padding:14px 16px;border-radius:14px;background:var(--soft,#f1f5f2);font-weight:600;text-align:left;cursor:pointer;width:100%}
.cv-wall span{display:grid;gap:2px}
.cv-wall small{font-weight:500;font-size:12.5px;color:var(--muted)}

/* feuille du classement complet */
.rk-list{display:grid;gap:8px}
.rk-row{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 14px;border-radius:12px;background:#fff;box-shadow:inset 0 0 0 1px #e7eae5}
.rk-row.me{box-shadow:inset 0 0 0 1.5px var(--tb)}
.rk-row>b:first-child{width:20px;color:var(--tb);font-size:14px}
.rk-av{flex:none;width:36px;height:36px;border-radius:50%;overflow:hidden}
.rk-tx{flex:1;min-width:0;display:grid;gap:2px}
.rk-tx b{font-size:14px;font-weight:600}
.rk-tx small{font-size:12px;color:#5f6b64}
.rk-pts{font-weight:700;font-size:14px}
.rk-note{margin:10px 2px 0;font-size:12px;line-height:1.45;color:#5f6b64}

/* ---------- liste des conversations façon messagerie : sans cadre, grand avatar, nom puis « message · 4 h » ---------- */
.mx-list{gap:0;margin:0 -19px}
.mx-row{min-height:0;padding:9px 19px!important;gap:14px;border-radius:0;background:transparent!important;box-shadow:none}
.mx-row:active{transform:none;background:rgba(13,107,58,.05)!important}
.mx-row .mx-av,.mx-row .mx-ic{width:56px;height:56px;border-radius:50%}
.mx-row .mx-ic svg{width:26px;height:26px}
.mx-row .mx-av .av,.mx-row .mx-av svg{width:56px!important;height:56px!important}
.mx-tx{gap:2px}
.mx-tx b{font-size:15px;font-weight:500}
.mx-tx small{font-size:14px;color:var(--tx2)}
.mx-row.unread .mx-tx b{font-weight:700}
.mx-row.unread .mx-tx small{color:var(--tx);font-weight:600}
.mx-new{flex:none;width:9px;height:9px;border-radius:50%;background:var(--tb)}
.mx-req{padding:10px 19px;border-radius:0;background:transparent;box-shadow:none}
.mx-list>.mx-h2,.mx-list>.mx-add{margin-left:19px;margin-right:19px}
.mx-empty{margin:0 19px}
