/* Wiadomości trener ↔ klient (dymki jak w prototypie) */
.chatthread{max-height:58vh; overflow-y:auto; overscroll-behavior:contain; padding:4px 2px 8px; margin-bottom:12px;}
/* Rozmowa mieści się nad dolnym paskiem: wysokość wg ekranu telefonu (nagłówek + pole pisania + pasek ok. 470 px) */
@supports (height:100dvh){ .chatthread{max-height:clamp(220px, calc(100dvh - 470px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)), 58vh);} }
/* scrollIntoView zostawia miejsce na pływający dolny pasek */
.chatform, .chatcount, .chatthread{scroll-margin-bottom:calc(112px + env(safe-area-inset-bottom,0px));}
/* Rozmowa klienta i trenera (chat.js): bez własnego okna przewijania, przewija się cała strona.
   Wcześniej okno o wysokości „ekran − 470 px” na iPhonie miało ok. 290 px i ucinało dymki u góry i nad polem pisania. */
.chatthread.chatflow{max-height:none; overflow:visible; overscroll-behavior:auto; padding-bottom:4px;}
.chatmsg{display:flex; flex-direction:column; margin-bottom:8px;}
.chatmsg.me{align-items:flex-end;}
.chatmsg.them{align-items:flex-start;}
.chatbubble{max-width:78%; padding:9px 12px; border-radius:12px; font-size:12.5px; line-height:1.45; white-space:pre-wrap; word-break:break-word;}
.chatmsg.me .chatbubble{background:linear-gradient(135deg,var(--violet-500),var(--magenta-500)); color:#fff; border-bottom-right-radius:4px;}
.chatmsg.them .chatbubble{background:var(--navy-800); color:var(--ink-100); border-bottom-left-radius:4px;}
.chattime{font-size:9.5px; opacity:.7; margin-top:3px;}
.chatwho{font-size:10px; font-weight:700; opacity:.85; margin-bottom:2px;}
.chatread{font-size:10px; color:var(--ink-600); margin-top:3px;}
.chatform{display:flex; gap:8px; align-items:flex-end;}
.chatform textarea{flex:1; min-width:0; resize:none; min-height:42px; max-height:140px;}
.chatform .btn{flex:none;}
.chatcount{font-size:10.5px; color:var(--ink-600); text-align:right; margin-top:4px; min-height:12px;}
.chatback{cursor:pointer; margin-bottom:10px;}
.chatconv{cursor:pointer; align-items:center;}
.chatprev{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.chatprev.unread{color:var(--ink-100); font-weight:600;}
.chatside{display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex:none; margin-left:8px;}
.chatside .d{font-size:10px; color:var(--ink-600); white-space:nowrap;}
.chatbadge{display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--magenta-500); color:#fff; font-size:10.5px; font-weight:800;}
.chatform textarea{background:var(--navy-800); border:1px solid rgba(255,255,255,.1); color:var(--ink-100); border-radius:9px; padding:10px 11px; font-size:13px; font-family:inherit;}

/* Admin › Wiadomości: ukrywanie rozmów (✕ albo przesunięcie w bok), historia zostaje */
.chatswipe{position:relative; overflow:hidden; touch-action:pan-y; border-radius:var(--r-md, 14px);}
.chatswipe > .chatconv{transition:transform .18s ease, opacity .18s ease; will-change:transform;}
.chathide{flex:none; width:36px; height:36px; margin-left:6px; border-radius:50%; border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06); color:var(--ink-300, #c9cbe0); font-size:15px; line-height:1; cursor:pointer;}
.chathide:hover, .chathide:focus-visible{background:rgba(255,77,141,.18); color:#fff; border-color:rgba(255,77,141,.5);}
.chatunhide{flex:none; margin-left:8px; padding:6px 10px; font-size:11px;}
.chatunread{display:inline-block; min-width:18px; padding:1px 6px; border-radius:9px; background:#ff9f1a; color:#171933; font-weight:700; text-align:center;}
.chathint{margin:8px 2px 0; font-size:11px;}
