/* The conversation owns the available viewport; only its messages scroll. */
.family-chat-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 16px}.family-chat-heading h1{font-size:32px;margin:0}.family-chat-heading button{font-size:14px;min-height:44px}
.community-chat{height:var(--family-chat-height,calc(100dvh - 230px));min-height:220px;max-height:none;grid-template-columns:minmax(220px,30%) minmax(0,1fr)}
.community-chat-list{min-height:0;overflow-y:auto;padding:12px}.family-chat-rows{min-width:0}.family-chat-rows>.community-thread-row{display:flex;gap:10px;align-items:center;width:100%;min-height:80px;padding:12px 8px;background:transparent;border:0;border-bottom:1px solid var(--family-line);text-align:left;border-radius:8px}.family-chat-rows>.community-thread-row[aria-pressed=true]{background:#e8ebdc}.family-chat-rows>.community-thread-row[hidden]{display:none!important}.family-chat-rows .community-thread-row>span:nth-child(2){min-width:0;flex:1}.family-chat-rows b{font-size:var(--appearance-text,16px);font-weight:600;display:block}.family-chat-rows small{font-size:var(--appearance-label,12px);color:var(--family-muted);display:block}.family-chat-rows .avatar{flex:0 0 40px;width:40px;height:40px}.family-chat-chevron{font-size:24px;color:var(--family-muted)}.community-thread-preview{font-size:var(--appearance-secondary,14px);line-height:1.4;margin:5px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}.community-chat-list>.community-ai-thread{margin:16px 0 0;min-height:48px;width:100%;font-size:12px}
.community-conversation{height:100%;min-height:0;overflow:hidden;display:flex;flex-direction:column}.community-conversation-head{display:flex;align-items:center;gap:8px;flex:0 0 auto;padding:10px 14px;background:var(--mobile-card,var(--family-paper))}.community-conversation-head>div{min-width:0;flex:1}.community-conversation-head h2{font-size:22px;line-height:1.15;margin:0;overflow-wrap:anywhere}.community-conversation-head details{font-size:11px;color:var(--family-muted);margin:3px 0 0}.community-conversation-head details summary{min-height:24px;cursor:pointer}.community-conversation-head details small{line-height:1.6}.family-chat-refresh{width:44px;height:44px;min-width:44px;flex:0 0 44px;padding:4px;border:0;background:transparent;color:var(--family-olive);font-size:25px;border-radius:50%}
.community-messages{flex:1 1 auto;height:auto;min-height:0;max-height:none;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;padding:14px 12px;gap:8px;background:#f3f2e8;scrollbar-width:thin}.family-chat-date{align-self:center;color:#77765f;background:#e9e9dc;font-size:10px;padding:5px 10px;border-radius:12px;margin:4px 0 7px}.family-chat-message-row{display:flex;gap:7px;align-items:flex-end;width:100%;flex:0 0 auto;min-width:0}.family-chat-message-row>.avatar{width:28px;height:28px;flex:0 0 28px;font-size:14px}.family-chat-message-row.mine{justify-content:flex-end}.family-chat-message-row>.community-message{max-width:82%;margin:0;padding:8px 11px;border-radius:12px 12px 12px 3px;background:#fffdf5;color:var(--family-ink);box-shadow:0 1px 2px #35422908}.family-chat-message-row>.community-message.mine{margin:0;border-radius:12px 12px 3px 12px;background:#e3e9d4}.family-chat-message-row .community-message p{font-size:var(--appearance-text,16px);line-height:1.5;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.family-chat-message-row .community-message b{display:block;margin-bottom:3px;font-size:11px;color:#6f7854}.family-chat-message-row .community-message small{display:block;text-align:right;font-size:9px;color:#70735f;margin-top:3px}.family-message-status{font-size:10px}
#community-chat-form{flex:0 0 auto;position:static;display:flex;align-items:flex-end;padding:10px 12px 6px;margin:0;gap:8px;background:var(--mobile-card,var(--family-paper));border-top:1px solid var(--family-line)}#community-chat-form textarea{flex:1;min-width:0;width:0;min-height:46px;max-height:152px;resize:none;overflow-y:auto;margin:0;border:1px solid var(--family-line);border-radius:16px;padding:11px 12px;line-height:1.4;font-size:var(--appearance-text,16px);background:var(--mobile-card,#fffdf6);box-sizing:border-box}#community-chat-form button{font-size:var(--appearance-secondary,14px);border-radius:14px;min-width:84px;width:auto;height:46px;min-height:46px;padding:9px 11px;flex:0 0 auto}#community-chat-form button:disabled{opacity:.55}.family-chat-footer{flex:0 0 auto;display:flex;align-items:center;background:var(--mobile-card,var(--family-paper));padding:0 12px 3px;min-height:22px}.family-chat-connection{font-size:max(11px,var(--appearance-label,11px));line-height:1.35;color:var(--family-muted)}
.family-chat-picker{display:grid;gap:0;max-height:52dvh;overflow-y:auto;margin:16px 0}.family-chat-picker>button{display:flex;align-items:center;gap:12px;min-height:76px;background:transparent;border:0;border-bottom:1px solid var(--family-line);text-align:left;padding:12px 2px;width:100%}.family-chat-picker>button>span:nth-child(2){flex:1;min-width:0}.family-chat-picker b{display:block;font-size:15px}.family-chat-picker small{display:block;font-size:12px;color:var(--family-muted);margin-top:4px}
.family-chat-fab{display:none}.family-chat-fab>svg{width:26px;height:26px;display:block}
@media(max-width:760px){
  [data-family-view=chat] main{padding:16px 12px 0}[data-family-view=chat] .demo-footer{display:none}.family-chat-heading{margin:0 4px 16px}.family-chat-heading h1{font-size:29px}.family-chat-heading button{padding:8px 13px}.community-chat{display:block;border:0;background:transparent;min-height:0;border-radius:0;overflow:hidden}.community-chat-list{height:100%;display:block;overflow-y:auto;background:transparent;border:0;padding:0 4px}.community-chat-list .mobile-chat-search{margin:0 0 4px}.family-chat-rows>.community-thread-row{min-height:88px;padding:13px 0;border-radius:0}.family-chat-rows>.community-thread-row[aria-pressed=true]{background:transparent}.family-chat-rows .community-thread-row>.avatar{width:44px;height:44px;flex-basis:44px}.family-chat-rows b{font-size:var(--appearance-text,16px)}.community-thread-preview{font-size:var(--appearance-secondary,14px)}.community-conversation{display:none;height:100%;min-height:0;border:1px solid var(--family-line);border-radius:13px}.community-chat.conversation-open .community-chat-list{display:none}.community-chat.conversation-open .community-conversation{display:flex}.mobile-chat-back{display:grid;place-items:center;width:44px;height:44px;min-width:44px;padding:0;border:0;border-radius:50%;background:transparent;font-size:25px;color:var(--family-olive)}.community-conversation-head{padding:7px 8px 7px 2px;min-height:62px;box-sizing:border-box}.community-conversation-head h2{font-size:21px}.community-conversation-head details{font-size:10px}.community-conversation-head details summary{min-height:22px}@media(max-width:760px){.community-conversation-head{padding:5px 8px 5px 2px;min-height:54px}.community-chat .community-conversation-head h2{font-size:19px;margin:0}.community-chat .community-conversation-head details summary{min-height:18px}}.community-messages{height:auto;min-height:0;max-height:none;padding:10px 9px;gap:7px}.family-chat-message-row>.community-message{max-width:84%}.family-chat-message-row .community-message p{font-size:var(--appearance-text,16px)}.family-chat-footer{padding-inline:10px;min-height:22px}.family-chat-connection{font-size:max(11px,var(--appearance-label,11px))}#community-chat-form{padding:8px 9px 4px;gap:6px}#community-chat-form button{min-width:78px;font-size:var(--appearance-secondary,14px)}#community-chat-form textarea{min-height:46px}.mobile-keyboard-open .community-conversation{min-height:0}.mobile-keyboard-open .community-messages{min-height:0}.mobile-keyboard-open[data-family-view=chat]{padding-bottom:0}body[data-family-view=chat]:has(.conversation-open) .family-chat-heading{display:none}body[data-family-view=chat]:has(.conversation-open) main{padding-top:8px}.family-chat-heading>button{display:none}.family-chat-fab{display:grid;place-items:center;position:fixed;right:14px;bottom:calc(92px + env(safe-area-inset-bottom));width:56px;height:56px;min-width:56px;min-height:56px;border-radius:50%;border:0;background:var(--mobile-accent,#68754b);color:#fffdf4;padding:0;box-shadow:0 4px 14px #59613d38;z-index:14}.mobile-keyboard-open .family-chat-fab{display:none}body[data-family-view=chat] .family-bottom-add{display:none}.community-chat-list{padding-bottom:88px}#community-chat-form textarea{border-radius:23px;padding:12px 16px}#community-chat-form button{min-width:46px;width:46px;min-height:46px;height:46px;border-radius:50%;padding:0;display:grid;place-items:center;font-size:20px}
}
body[data-family-theme] .community-messages{min-height:0}
@media(prefers-reduced-motion:reduce){.community-messages{scroll-behavior:auto}}

/* Непрочитанные: счётчик на значке «Чаты» и отметки у бесед. */
.family-bottom-nav [data-bottom-view="chat"]{position:relative}
.family-chat-badge{position:absolute;top:4px;left:calc(50% + 4px);min-width:19px;height:19px;border-radius:10px;background:var(--family-terra,#a35f43);color:#fffdf7;font:600 11px/19px Arial,sans-serif;text-align:center;padding:0 5px;box-sizing:border-box;pointer-events:none;box-shadow:0 1px 4px #0003}
.family-chat-badge[hidden]{display:none}
.family-thread-dot{min-width:20px;height:20px;border-radius:10px;background:var(--family-terra,#a35f43);color:#fffdf7;font:600 11px/20px Arial,sans-serif;text-align:center;padding:0 6px;box-sizing:border-box;flex-shrink:0;align-self:center}

/* Реакции и голосовые сообщения в чате. */
.family-voice{display:block;width:min(240px,100%);margin:3px 0 1px}
.family-react-row{display:flex;flex-wrap:wrap;gap:4px;align-items:center;margin-top:5px}
.family-react-chip{border:1px solid #ddd4bb;background:#fffef9;border-radius:13px;min-height:28px;padding:2px 9px;font-size:13px;line-height:1.2;color:#6b6449;cursor:pointer}
.family-react-chip[aria-pressed=true]{background:#dde5c8;border-color:#a9b585}
.family-react-add{border:0;background:transparent;min-width:32px;min-height:28px;border-radius:13px;font-size:15px;color:#9a8e70;padding:1px 6px;cursor:pointer}
.family-react-picker{display:inline-flex;gap:1px;background:#fffdf5;border:1px solid var(--family-line);border-radius:17px;padding:2px 5px;box-shadow:0 3px 10px #3a2f1c14}
.family-react-picker button{border:0;background:transparent;font-size:19px;min-width:38px;min-height:38px;border-radius:10px;cursor:pointer;padding:0}
.family-react-picker button:active,.family-react-picker button:hover{background:#ede8d3}
.family-voice-btn{min-width:46px!important;width:46px;min-height:46px;height:46px;border-radius:50%!important;padding:0!important;display:grid;place-items:center;border:0;background:#e8e4d2;color:#6d6549;flex:0 0 auto;cursor:pointer}
.family-voice-btn>svg{width:21px;height:21px;display:block}
.family-voice-btn.recording{background:#b44b3a;color:#fff8ee;animation:family-voice-pulse 1.4s ease-in-out infinite}
@keyframes family-voice-pulse{50%{opacity:.6}}
.family-voice-live{padding:7px 14px;background:#f8e9e2;color:#a03f2d;font-size:13px;font-variant-numeric:tabular-nums;border-top:1px solid var(--family-line)}
.family-voice-preview{display:flex;gap:8px;align-items:center;padding:8px 10px;background:#fffdf5;border-top:1px solid var(--family-line)}
.family-voice-preview audio{flex:1;min-width:0;height:42px;display:block}
.family-voice-preview .primary{min-height:42px;font-size:14px;padding:8px 14px}
.family-voice-preview .secondary{min-width:42px;min-height:42px;padding:6px 10px}
