.fd-chat-page{max-width:960px;margin:auto;padding:20px 16px 24px}
.fd-chat-panel{display:flex;flex-direction:column;padding:0!important;overflow:hidden;border-radius:22px;background:#fff;min-height:65dvh}
.fd-chat-header{padding:20px 24px;border-bottom:1px solid var(--line);display:flex;gap:16px;flex-wrap:wrap;align-items:center}
.fd-chat-header>div:first-child{flex:1;min-width:180px}.fd-chat-header h2{font-size:24px;letter-spacing:-.5px;margin:8px 0}.fd-chat-header p{font-size:13px;color:var(--muted);margin:0}
.fd-chat-actions{display:flex;gap:10px;flex-wrap:wrap}.fd-chat-actions button:disabled{cursor:not-allowed;opacity:.5}.fd-chat-hint{flex-basis:100%}
.fd-chat-messages{flex:1;max-height:48dvh;min-height:220px;overflow:auto;padding:24px;display:flex;flex-direction:column;gap:14px;background:#f6fafc;overscroll-behavior:contain}
.fd-chat-messages .s3-message{align-self:flex-start;max-width:85%;margin:0;padding:14px 16px;border:1px solid var(--line);border-radius:16px 16px 16px 4px;background:#fff;overflow-wrap:anywhere}
.fd-chat-messages .mine{align-self:flex-end;background:#e7f5ff;border-radius:16px 16px 4px 16px}.fd-chat-messages .s3-message p{margin:8px 0;white-space:pre-wrap}.fd-chat-messages footer{display:flex;align-items:center;gap:12px;justify-content:space-between}.fd-chat-messages footer button{padding:4px 8px;font-size:11px;min-height:30px}.fd-chat-messages small{color:var(--muted);font-size:11px}
.fd-chat-empty{margin:auto;text-align:center;padding:24px;max-width:360px}.fd-chat-empty p{color:var(--muted);margin-top:12px}
.fd-chat-composer{margin:0!important;padding:16px 24px!important;gap:12px;background:#fff;border-top:1px solid var(--line)}
.fd-chat-quick{display:flex;gap:8px;flex-wrap:wrap}.fd-chat-quick button{font-size:12px;padding:8px 12px}.fd-chat-send{display:flex;align-items:flex-end;gap:12px}.fd-chat-send .field{flex:1;min-width:0;display:grid;gap:6px}.fd-chat-send textarea{width:100%;min-height:64px;max-height:160px;resize:vertical}.fd-chat-send>.button{min-height:48px}.fd-chat-composer #c-chat-state{margin:0;font-size:12px;color:var(--muted)}
@media(max-width:760px){.fd-chat-page{padding:12px 12px 20px}.fd-chat-header{padding:16px}.fd-chat-messages{padding:16px}.fd-chat-composer{padding:16px!important}.fd-chat-header h2{font-size:22px}.fd-chat-send{gap:8px}.fd-chat-send>.button{padding:12px}}

/* Conversation inbox. */
.s3-main>section.s3-card:has(>h2:first-child):has(button[data-c="room"]){padding:clamp(20px,3vw,32px)}
.s3-main>section.s3-card:has(button[data-c="room"])>h2{margin:0 0 8px;font-size:clamp(1.55rem,3vw,2rem)}
.s3-main>section.s3-card:has(button[data-c="room"])>p{display:grid;grid-template-columns:52px minmax(0,1fr) auto;align-items:center;gap:14px;margin:12px 0;padding:14px;background:#f7fbfd;border:1px solid var(--line,#d1e8ef);border-radius:16px;color:var(--ink);text-transform:capitalize}
.s3-main>section.s3-card:has(button[data-c="room"])>p:before{content:'💬';display:grid;place-items:center;width:52px;height:52px;border-radius:15px;background:#e1f5fc;font-size:22px}
.s3-main>section.s3-card:has(button[data-c="room"])>p button{margin:0;min-width:92px;background:#fff;color:var(--primary);border-color:#bcdce8}
.s3-main>section.s3-card:has(button[data-c="room"])>p:hover{border-color:#91cfdf;box-shadow:0 8px 22px #1646600d}
@media(max-width:520px){.s3-main>section.s3-card:has(button[data-c="room"])>p{grid-template-columns:44px minmax(0,1fr);gap:12px}.s3-main>section.s3-card:has(button[data-c="room"])>p:before{width:44px;height:44px}.s3-main>section.s3-card:has(button[data-c="room"])>p button{grid-column:2;width:100%}}

.fd-chat-inbox{display:grid;gap:14px}.fd-chat-inbox>h2{margin:0 0 6px}
.fd-chat-inbox-card{display:grid;grid-template-columns:58px minmax(0,1fr) auto;align-items:center;gap:16px;padding:16px;background:#f7fbfd;border:1px solid var(--line,#d1e8ef);border-radius:18px;transition:border-color .15s,box-shadow .15s}
.fd-chat-inbox-card:hover{border-color:#91cfdf;box-shadow:0 8px 22px #1646600d}.fd-chat-peer-avatar{width:58px;height:58px;border-radius:17px;overflow:hidden;background:#e1f5fc;color:var(--primary);display:grid;place-items:center;flex:none;font-size:1.25rem;font-weight:800}
.fd-chat-peer-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.fd-chat-peer-copy{min-width:0}.fd-chat-peer-copy h3{margin:0 0 4px;font-size:1.05rem}.fd-chat-peer-copy p{margin:0;color:var(--muted);font-size:.86rem}.fd-chat-peer-copy small{display:block;margin-top:6px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:48ch}
.fd-chat-inbox-card>.button{margin:0;min-width:92px;background:#fff;color:var(--primary);border-color:#bcdce8}.fd-chat-header>.fd-chat-peer-avatar:first-child{flex:0 0 58px;min-width:58px}.fd-chat-header>.fd-chat-peer-avatar+div{flex:1;min-width:180px}
@media(max-width:520px){.fd-chat-inbox-card{grid-template-columns:50px minmax(0,1fr);gap:12px}.fd-chat-peer-avatar{width:50px;height:50px}.fd-chat-inbox-card>.button{grid-column:2;width:100%}}

/* Keep the draft and send button above an on-screen keyboard in WebView and mobile browsers. */
.fd-chat-keyboard .fd-chat-page{padding-bottom:calc(24px + var(--fd-chat-keyboard-space,0px))}
.fd-chat-keyboard .fd-chat-messages{max-height:min(35dvh,calc(var(--fd-chat-visual-height,100dvh) * .38));min-height:100px}
.fd-chat-composer{scroll-margin-bottom:20px}

/* The remote participant uses the available screen; the local preview stays in a corner. */
#c-call.fd-video-call{inset:0;right:0;bottom:0;width:100vw!important;height:100dvh;max-height:none;max-width:none;display:flex;flex-direction:column;gap:10px;overflow:hidden;border:0;border-radius:0;padding:calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));z-index:1100}
#c-call.fd-video-call .fd-call-remote{order:-1;display:block;flex:1 1 auto;width:100%;height:100%;min-height:0;max-height:none;margin:0;object-fit:contain;background:#111;border-radius:12px}
#c-call.fd-video-call .fd-call-local{position:absolute;top:calc(28px + env(safe-area-inset-top));right:28px;display:block;width:min(28vw,150px);height:min(37vw,190px);object-fit:cover;border:2px solid white;border-radius:12px;box-shadow:0 3px 18px #0009;z-index:2}
#c-call.fd-video-call h3,#c-call.fd-video-call p{margin:0}#c-call.fd-video-call .button{align-self:center;min-width:150px}
