/* Meddelanden (chatt.js). Bubblorna används också av mc-klubbarnas chatt. */
.msgbtn{position:relative;flex:none;display:flex;align-items:center;justify-content:center;width:42px;height:42px;margin-right:-14px;border-radius:50%;color:var(--ink)}
.msgbtn:hover,.msgbtn.on{background:var(--mist)}
.msgbtn svg{width:22px;height:22px}
.msgbtn .badge{position:absolute;top:3px;right:1px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--badge);color:#fff;font-size:10px;line-height:17px;text-align:center;font-weight:700}

/* Inkorgen */
.ch-inbox{max-width:760px}
.ch-inbox .intro{color:var(--muted);margin:4px 0 18px}
.ch-rows{border:1px solid var(--line);border-radius:16px;overflow:hidden}
.ch-row{display:flex;align-items:center;gap:14px;padding:12px 14px;border-top:1px solid var(--line);color:var(--ink);text-decoration:none;background:#fff}
.ch-row:first-child{border-top:0}
.ch-row:hover{background:#F8F7F5}
.ch-row.new{background:#FAF8F6}
.ch-th{flex:none;width:52px;height:52px;border-radius:12px;overflow:hidden;background:var(--mist);display:flex;align-items:center;justify-content:center}
.ch-th img{width:100%;height:100%;object-fit:cover;display:block}
.ch-th i svg{width:22px;height:22px;color:var(--act)}
.ch-rb{flex:1;min-width:0;display:flex;flex-direction:column}
.ch-rt{display:flex;justify-content:space-between;gap:10px}
.ch-rt b{font-weight:600}
.ch-rt time{font-size:12px;color:var(--muted);flex:none}
.ch-about{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-last{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-row.new .ch-last{font-weight:600}
.ch-row .badge{flex:none;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--badge);color:#fff;font-size:11px;line-height:20px;text-align:center;font-weight:700}
.ch-kolink{display:flex;align-items:center;gap:12px;padding:14px 16px;border:1px solid var(--line);border-radius:16px;color:var(--ink);text-decoration:none}
.ch-kolink:hover{background:#F8F7F5}
.ch-kolink>span:first-child{flex:1;display:flex;flex-direction:column}
.ch-kolink small{color:var(--muted);font-size:13px}
.ch-kolink .badge{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--badge);color:#fff;font-size:11px;line-height:20px;text-align:center;font-weight:700}
.ch-kolink>svg{width:18px;height:18px;color:var(--muted)}

/* En konversation */
.ch-page{max-width:760px;display:flex;flex-direction:column;height:calc(100dvh - var(--top) - 40px);padding-top:12px;padding-bottom:16px}
.ch-head{display:flex;align-items:center;gap:12px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.ch-head .back{margin:0;font-size:22px;text-decoration:none;width:36px}
.ch-ctx{flex:1;min-width:0;display:flex;align-items:center;gap:12px;color:var(--ink);text-decoration:none}
.ch-ctx .ch-th{width:46px;height:46px}
.ch-ctx>span:last-child{min-width:0;display:flex;flex-direction:column}
.ch-ctx b{font-weight:600}
.ch-ctx small{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-rep{font-size:13px;color:var(--muted)}
.ch-list{flex:1;overflow-y:auto;padding:14px 2px;display:flex;flex-direction:column;gap:2px;overscroll-behavior:contain}
.ch-day{align-self:center;font-size:12px;color:var(--muted);margin:10px 0 6px}
.ch-sys{align-self:center;max-width:85%;text-align:center;font-size:13px;color:#2E3238;background:#FBE9DE;border-radius:12px;padding:8px 12px;margin:8px 0}
.ch-empty{margin:auto;max-width:22em;text-align:center;color:var(--muted);font-size:15px}
.ch-m{display:flex;flex-direction:column;align-items:flex-start;max-width:78%;margin-top:8px}
.ch-m.cont{margin-top:2px}
.ch-m.me{align-self:flex-end;align-items:flex-end}
.ch-by{font-size:12px;font-weight:600;color:var(--muted);margin:0 0 2px 12px}
.ch-b{padding:9px 14px;border-radius:18px;background:#F0EEEB;color:var(--ink);font-size:15px;line-height:1.45;white-space:pre-wrap;word-break:break-word}
.ch-m.me .ch-b{background:var(--act);color:#fff}
.ch-m.me .ch-b a{color:#fff}
.ch-m time{font-size:11px;color:var(--muted);margin:2px 8px 0}
.ch-m.cont time{display:none}
.ch-safe{display:flex;align-items:flex-start;gap:8px;font-size:12px;color:var(--muted);margin:6px 0 8px}
.ch-safe svg{flex:none;width:14px;height:14px;margin-top:1px;color:var(--act)}
.ch-form{display:flex;align-items:flex-end;gap:8px}
.ch-form textarea{flex:1;min-width:0;resize:none;border:1px solid var(--line);border-radius:22px;padding:11px 16px;font:inherit;font-size:16px;line-height:1.35;max-height:140px;outline:none;background:#fff}
.ch-form textarea:focus{border-color:var(--act)}
.ch-send{flex:none;width:46px;height:46px;min-height:46px;padding:0;border-radius:50%;display:flex;align-items:center;justify-content:center}
.ch-send svg{width:20px;height:20px}

@media (max-width:860px){
  .msgbtn{margin:0 -6px 0 auto}
  .msgbtn+.acct{margin-left:0}
  .ch-page{height:calc(100dvh - var(--top) - var(--tab) - env(safe-area-inset-bottom));padding-bottom:10px}
  .ch-page~.foot{display:none}
  .ch-m{max-width:86%}
}
