.chat-shell{--chat-blue:#145d97;--chat-ink:#183345;--chat-border:#d6e3eb;--chat-pale:#f3f8fb;display:flex;flex-direction:column;min-height:360px;height:min(730px,calc(100dvh - 118px));color:var(--chat-ink);background:#fff;border:1px solid var(--chat-border);border-radius:15px;overflow:hidden}
#chat[hidden],#chatFloat[hidden],#chatLauncher[hidden],#chatBadge[hidden],.chat-shell [hidden]{display:none!important}
#chat{margin:auto;width:min(1360px,100%);padding:8px 0}
.chat-top,.chat-room-head,.chat-call-top{display:flex;align-items:center;justify-content:space-between;gap:10px;background:#fff;border-bottom:1px solid #d6e3eb;padding:10px 14px;min-width:0}
.chat-top strong,.chat-room-head strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-top-actions,.chat-room-tools,.chat-compose-actions,.chat-message-actions,.chat-call-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.chat-columns{display:grid;grid-template-columns:minmax(190px,26%) minmax(0,1fr);flex:1;min-height:0}
.chat-side{display:flex;flex-direction:column;min-height:0;padding:10px 9px;background:#f6f9fc;border-right:1px solid #d6e3eb;gap:8px}
.chat-side input,.chat-history-tools input,.chat-compose textarea,.chat-dialog input:not([type=checkbox]),.chat-dialog select{width:100%;min-width:0;box-sizing:border-box}
.chat-list,.chat-history{overflow-y:auto;overscroll-behavior:contain;min-height:0}
.chat-room{display:flex;align-items:center;gap:8px;border:0;width:100%;background:transparent;text-align:left;min-width:0;color:#183345}
.chat-room:hover,.chat-room.selected{background:#e4f0f9}.chat-room-text{min-width:0;display:grid;gap:2px;flex:1}.chat-room-text strong,.chat-room-text small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-avatar{display:grid;place-items:center;width:31px;height:31px;flex:none;border-radius:50%;color:#fff;background:#276797;font-weight:700}
.chat-room-badge,#chatBadge{display:grid;place-items:center;border-radius:15px;background:#bb2f4b;color:#fff;font-weight:700;min-width:20px;height:20px;padding:0 4px;font-size:.76rem}
.chat-body{display:flex;flex-direction:column;min-height:0;min-width:0}.chat-empty{display:grid;justify-items:center;align-content:center;gap:14px;height:100%;padding:16px;text-align:center}
.chat-history-tools{display:flex;gap:7px;align-items:center;padding:7px 10px;background:#f5f9fc;border-bottom:1px solid #d6e3eb}.chat-history-tools input{flex:1}
.chat-history{display:flex;flex-direction:column;align-items:flex-start;flex:1;gap:10px;padding:12px;background:#fafcfe}
.chat-bubble{display:grid;gap:6px;max-width:min(88%,690px);min-width:0;padding:9px 12px;border:1px solid #dae5ed;border-radius:12px;background:#fff}
.chat-bubble.mine{align-self:flex-end;background:#e6f2fd;border-color:#c8def0}
.chat-message-meta,.chat-seen,.chat-hint,.chat-notice,.chat-bubble small{font-size:.82rem;color:#426078}
.chat-message-text,.chat-attachment,.chat-bubble blockquote{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal}
.chat-bubble blockquote{margin:0;border-left:3px solid #8fb6d2;padding:4px 7px;background:#edf3f8;font-size:.87rem}
.chat-attachment{display:grid;gap:2px;background:#f3f8fb;border:1px solid #d6e3eb;border-radius:7px;padding:6px 8px}
.chat-bubble audio,.chat-bubble video,.chat-bubble img{max-width:min(100%,420px);border-radius:6px}
.chat-compose{padding:8px 10px;background:#fff;border-top:1px solid #d6e3eb}.chat-compose textarea{display:block;max-height:16vh;resize:vertical;margin-bottom:5px}
.chat-compose-actions .primary{margin-left:auto}.chat-notice{margin:3px 0;min-height:1.2em}
.chat-queue,.chat-reply{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
.chat-attachment-pending,.chat-reply span{display:inline-flex;align-items:center;gap:4px;background:#eef5fa;border-radius:5px;padding:3px 6px;overflow-wrap:anywhere;font-size:.85rem}
.chat-subtle,.chat-icon-button,.chat-back,.chat-more{padding:5px 8px;background:#f1f7fb;color:#184b70;border:1px solid #cbdde9;white-space:nowrap}
.chat-message-actions .chat-subtle{font-size:.79rem;padding:2px 5px}.chat-poll{width:100%;text-align:left}.chat-back{display:none}
.chat-dialog,.chat-menu,.chat-picker-results{display:grid;gap:8px}.chat-picker-results{max-height:205px;overflow:auto}.chat-menu{max-height:62dvh;overflow:auto}
.chat-call-log,.chat-admin-room{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:7px;border-bottom:1px solid #d6e3eb}
.chat-admin-room p{width:100%;overflow-wrap:anywhere}.chat-emoji{display:grid;grid-template-columns:repeat(auto-fit,minmax(46px,1fr));gap:6px}.chat-emoji button{font-size:1.5rem}
#chatLauncher{position:fixed;bottom:max(15px,env(safe-area-inset-bottom));right:max(16px,env(safe-area-inset-right));display:grid;place-items:center;width:56px;height:56px;padding:0;z-index:1120;border:0;border-radius:50%;background:#145d97;color:#fff;box-shadow:0 5px 16px #143a5e45}
#chatLauncher svg{width:28px;height:28px}#chatBadge{position:absolute;top:-2px;right:-3px}
#chatFloat{position:fixed;bottom:max(14px,env(safe-area-inset-bottom));right:max(14px,env(safe-area-inset-right));width:min(600px,calc(100% - 28px));z-index:1120;box-shadow:0 10px 32px #18334536;border-radius:15px}
.chat-compact{height:min(540px,calc(100dvh - 32px));min-height:300px}.chat-compact .chat-columns{grid-template-columns:minmax(140px,32%) minmax(0,1fr)}
.chat-invite,.chat-call-card{position:fixed;top:max(12px,env(safe-area-inset-top));right:max(14px,env(safe-area-inset-right));z-index:1130;width:min(740px,calc(100% - 28px));background:#fff;border:1px solid #cbdde9;border-radius:13px;box-shadow:0 10px 32px #18334555;overflow:hidden}
.chat-invite{width:min(370px,calc(100% - 28px));padding:13px;color:#183345}
.chat-call-stage{position:relative;min-height:110px;background:#10243a;color:#fff}.chat-call-videos{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(190px,100%),1fr));gap:4px;padding:4px}
.chat-peer{position:relative;min-height:100px}.chat-peer video{width:100%;max-height:45dvh;display:block}.chat-peer span{position:absolute;bottom:4px;left:6px;background:#132940de;border-radius:6px;padding:3px 5px}
.chat-local-video{position:absolute;right:7px;bottom:7px;width:min(24%,142px);max-height:100%;border-radius:6px;object-fit:cover;background:#23394b}
.chat-call-actions,.chat-call-note{padding:6px 10px;margin:0}.chat-danger{background:#9e2d47;color:#fff;border-color:#9e2d47}
.chat-auto-beauty[aria-pressed=true]{background:#e8e1fb;color:#452581;border-color:#886ac3;font-weight:700}
.chat-call-card.mini{width:min(295px,calc(100% - 28px))}.chat-call-card.mini .chat-call-stage{display:none}.chat-call-card.mini .chat-call-actions button:not(.chat-danger){display:none}
@media(max-width:680px){#chat{padding:0}.chat-shell{height:calc(100dvh - 65px);min-height:250px;border-radius:9px}.chat-columns{display:flex;flex-direction:column}.chat-side,.chat-body{flex:1;border-right:0}.chat-shell:not(.chat-room-open) .chat-body{display:none}.chat-room-open .chat-side{display:none}.chat-back{display:inline-block}.chat-bubble{max-width:94%}.chat-top,.chat-room-head{padding:8px}.chat-call-actions{gap:5px}.chat-call-actions button{padding:5px 7px}}

.chat-peer-sound{position:absolute;top:7px;left:7px}.chat-peer-sound[hidden],.chat-local-video[hidden]{display:none!important}

body.application-active .chat-call-card,body.application-active .chat-invite{top:max(calc(var(--workspace-bar-height,70px) + 8px),env(safe-area-inset-top))}
.home-card[data-app=chat]{--app-color:#145d97;--app-bg:#e6f3fc}

.chat-icon-button svg{display:block;width:20px;height:20px}.chat-room-tools .chat-icon-button{min-width:39px}.chat-message-actions .chat-subtle{min-height:30px}.chat-attachment a{color:#165482;font-weight:650;text-decoration-color:#6a96b4;text-underline-offset:3px}
@media(max-width:680px){.chat-shell{height:calc(100dvh - var(--workspace-bar-height,84px) - 16px)}.chat-message-actions .chat-inline-action{display:none}.chat-message-actions .chat-subtle{min-height:36px;min-width:37px}}

.chat-highlight{outline:2px solid #276797;outline-offset:2px}

.chat-peer-focus{grid-column:1/-1}.chat-speaking{outline:2px solid #52d79e;outline-offset:-2px}

.chat-meeting-tools,.chat-caption-list{padding:7px 10px;background:#f3f8fb;color:#183345}
.chat-meeting-tools{display:flex;align-items:center;flex-wrap:wrap;gap:6px}
.chat-meeting-tools[hidden],.chat-caption-list[hidden]{display:none}
.chat-caption-list p,.chat-transcript p{margin:3px 0}
.chat-caption-list,.chat-transcript{max-height:140px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}

.chat-new-room{white-space:nowrap}
.chat-person-picker{display:grid;gap:8px;min-width:0}
.chat-person-picker input[type=search]{width:100%;min-width:0;font-size:16px}
.chat-person-picker .chat-picker-results{max-height:none;overflow:visible;gap:4px}
.chat-picker-hint{color:#456178;font-size:14px;margin:0}
.chat-picker-hint:empty{display:none}
.chat-picker-label{font-size:13px;color:#3d586e;margin:8px 0 2px}
.chat-picker-person{display:grid;grid-template-columns:34px minmax(0,1fr) 18px;align-items:center;gap:10px;
 width:100%;min-height:48px;text-align:left;padding:6px 10px;border:1px solid #cbdde9;border-radius:10px;
 background:#fff;color:#153c59}
.chat-picker-person .chat-avatar{width:32px;height:32px}
.chat-picker-name{overflow-wrap:anywhere}
.chat-picker-person[aria-pressed=true]{background:#e5f2fc;border-color:#5291bd}
.chat-picker-check{color:#145d97;font-weight:700}
.chat-picked{display:flex;flex-wrap:wrap;gap:6px;max-height:96px;overflow:auto;padding:2px}
.chat-picked[hidden],#modal:has(.chat-person-picker) #modalActions button[hidden]{display:none}
.chat-picker-chip{font-size:13px;min-height:40px;padding:6px 10px;background:#eaf4fc;color:#174b70}
.chat-person-link,.chat-message-author{background:transparent;border:0;color:#125781;text-align:left;padding:4px 6px;text-decoration:underline}
.chat-message-author{font-size:inherit;font-weight:650}
#modal:has(.chat-person-picker) #modalActions:not(:has(button:not([hidden]))){display:none}
#modal:has(.chat-person-picker){width:min(480px,calc(100% - 24px));box-sizing:border-box}
@media(max-width:680px){
 #modal:has(.chat-person-picker)[open]{position:fixed;inset:auto 0 var(--chat-picker-inset,0px);margin:0;
  width:100%;max-width:none;max-height:min(calc(100dvh - 10px),calc(var(--chat-picker-visible,100dvh) - 10px));
  border-radius:18px 18px 0 0;padding:12px max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left))}
 .chat-picker-content > input,.chat-picker-content > select{font-size:16px}
 #modal:has(.chat-person-picker) .dialog-title{padding-bottom:6px;margin-bottom:8px}
 #modal:has(.chat-person-picker) #closeModal,#modal:has(.chat-person-picker) #modalActions button,
 .chat-new-room,.chat-picker-chip,.chat-person-link,.chat-message-author{min-height:44px}
 #modal:has(.chat-person-picker) #modalContent{padding:0 0 10px}
 #modal:has(.chat-person-picker) #modalActions{padding:8px 0 max(8px,env(safe-area-inset-bottom));flex-wrap:nowrap}
 #modal:has(.chat-person-picker) #modalActions button{flex:1 1 auto}
 .chat-top{align-items:flex-start;gap:8px;flex-wrap:wrap}
 .chat-top-actions{gap:6px}
}

.chat-themed .chat-history,.chat-theme-preview{background:linear-gradient(150deg,color-mix(in srgb,var(--chat-theme-start) 48%,white),color-mix(in srgb,var(--chat-theme-end) 48%,white))}
.chat-themed .chat-bubble.mine,.chat-theme-preview .mine{background:color-mix(in srgb,var(--chat-theme-accent) 15%,white);border-color:color-mix(in srgb,var(--chat-theme-accent) 30%,white)}
.chat-themed .chat-room-head{border-bottom-color:color-mix(in srgb,var(--chat-theme-accent) 38%,white)}
.chat-quick-emoji{font-size:18px;min-width:42px}
.chat-theme-preview{display:grid;gap:8px;padding:12px;border:1px solid #d6e3eb;border-radius:12px;color:#182b40}
.chat-theme-preview span{width:fit-content;padding:7px 10px;border-radius:12px;background:#fff;border:1px solid #d6e3eb}
.chat-theme-preview .mine{justify-self:end}
.chat-theme-options,.chat-theme-colors{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.chat-theme-choice{min-height:44px;border-top:5px solid var(--chat-theme-accent);background:linear-gradient(145deg,var(--chat-theme-start),var(--chat-theme-end));color:#182b40;white-space:normal}
.chat-theme-colors input[type=color]{display:block;min-height:44px;padding:4px}
@media(max-width:680px){
 #modal:has(.chat-theme-dialog)[open]{position:fixed;inset:auto 0 var(--chat-picker-inset,0px);margin:0;box-sizing:border-box;width:100%;max-width:none;max-height:min(calc(100dvh - 10px),calc(var(--chat-picker-visible,100dvh) - 10px));border-radius:18px 18px 0 0}
 #modal:has(.chat-theme-dialog) #modalActions{padding-bottom:max(8px,env(safe-area-inset-bottom))}
 #modal:has(.chat-theme-dialog) button,.chat-quick-emoji{min-height:44px}
 .chat-theme-dialog input,.chat-theme-dialog select{font-size:16px}
}

.chat-effect-dialog{display:grid;gap:16px}
#modal:has(.chat-effect-dialog){width:min(640px,96vw);border-radius:14px}
#modal:has(.chat-effect-dialog) #modalContent{max-height:min(70dvh,670px)}
.chat-effect-preview-wrap{position:sticky;top:0;z-index:1;display:grid;gap:5px;padding:4px 0 9px;background:var(--surface,#fff)}
.chat-effect-preview-wrap .chat-hint{margin:0}
.chat-effect-preview{display:block;width:100%;height:clamp(116px,25vh,200px);object-fit:contain;border-radius:12px;background:#122438}
.chat-effect-sample{position:relative}
.chat-video-open{position:absolute;top:5px;right:5px;z-index:1;display:grid;place-items:center;width:44px;min-height:44px;padding:0;border:1px solid #ffffff6b;border-radius:10px;background:#11263be8;color:#fff;font-size:22px;line-height:1;touch-action:manipulation}
.chat-video-open:hover,.chat-video-open:focus-visible{background:#1e5a87;color:#fff}
.chat-local-video+.chat-video-open{top:auto;right:7px;bottom:7px;border:0;background:linear-gradient(135deg,transparent 20%,#122438e8 76%);place-items:end;padding:0 5px 4px 0}
.chat-local-video[hidden]+.chat-video-open,.chat-peer video[hidden]~.chat-video-open{display:none}
.chat-relay-media{position:relative}
.chat-video-view[open]{position:fixed;inset:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;width:100%;height:100%;max-width:none;max-height:none;margin:0;border:0;border-radius:0;background:#08131f;color:#fff;box-sizing:border-box;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.chat-video-view::backdrop{background:#08131f;backdrop-filter:none}
.chat-video-toolbar,.chat-video-zoom-controls{display:flex;align-items:center;gap:8px;padding:8px 12px}
.chat-video-toolbar{justify-content:space-between}
.chat-video-zoom-controls{justify-content:center;flex-wrap:wrap}
.chat-video-toolbar button,.chat-video-zoom-controls button{min-width:44px;min-height:44px;border-radius:10px}
.chat-video-viewport{position:relative;min-height:0;overflow:hidden;touch-action:none;background:#050a0f}
.chat-video-large{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}
.chat-video-small{position:absolute;right:10px;bottom:10px;width:min(26%,160px);height:auto;max-height:27%;border:1px solid #ffffff89;border-radius:12px;background:#152739;object-fit:contain;touch-action:none;cursor:grab;user-select:none;-webkit-touch-callout:none}
.chat-video-small.dragging{cursor:grabbing}
.chat-effect-compare{position:absolute;right:6px;bottom:6px;min-height:44px}
.chat-effect-source{position:fixed;left:0;bottom:0;width:2px;height:2px;opacity:.01;pointer-events:none;z-index:-1}
.chat-beauty-status{display:block;margin:0 0 7px;color:var(--muted,#526477)}
.chat-beauty-status[hidden]{display:none}
.chat-effect-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin-top:3px}
.chat-effect-tabs button{min-height:44px;border-radius:10px;padding-inline:2px;font-size:12px}
.chat-effect-tabs button[aria-pressed=true]{background:#1766a1;color:#fff;border-color:#1766a1;font-weight:700}
.chat-effect-dialog h3{font-size:14px;margin:0 0 7px}
.chat-effect-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.chat-effect-choice{min-height:44px;padding:7px 4px;white-space:normal;overflow-wrap:anywhere}
.chat-effect-color{display:flex;align-items:center;justify-content:center;gap:5px}
.chat-effect-swatch{width:13px;height:13px;flex:0 0 13px;border-radius:50%;background:var(--chat-swatch);box-shadow:inset 0 0 0 1px #0002}
.chat-effect-choice.chat-effect-background{color:#fff;text-shadow:0 1px 2px #172b3e}
.chat-effect-choice[aria-pressed=true]{outline:2px solid #1766b5;outline-offset:1px;font-weight:750}
.chat-effect-strength{display:grid;grid-template-columns:auto minmax(0,1fr) 42px;gap:8px;align-items:center;margin-top:8px;font-size:13px}
.chat-effect-strength input{width:100%;min-height:44px;margin:0}
.chat-effect-strength output{text-align:right;font-variant-numeric:tabular-nums}
@media(max-width:480px){.chat-effect-choice{font-size:13px}.chat-effect-preview{height:clamp(108px,21vh,160px)}#modal:has(.chat-effect-dialog) #modalActions button{min-height:44px}#modal:has(.chat-effect-dialog) #modalContent{max-height:65dvh}}

.chat-media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:8px}
.chat-media-card{display:grid;gap:6px;align-content:start;min-width:0;padding:5px;border:1px solid #d6e3eb;border-radius:10px;text-decoration:none;background:#f5f9fe;color:#183b58}
.chat-media-card img,.chat-media-card>span[aria-hidden]{display:grid;place-items:center;aspect-ratio:1;width:100%;object-fit:cover;border-radius:6px;background:#e1ebf5}
.chat-media-card>span:not([aria-hidden]){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}

.chat-audio-controls{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0}
.chat-audio-controls audio{max-width:100%;min-width:0;flex:1 1 210px}
.chat-audio-controls select{min-height:44px;flex:0 0 auto;font-size:16px}

.chat-album-item{display:grid;align-content:start;gap:5px;min-width:0}
.chat-album-item button{min-height:44px;white-space:normal;font-size:12px}
.chat-album-row{min-height:44px;text-align:left}
.chat-album-pick{min-width:0;width:100%;text-align:left}
.chat-album-pick[aria-pressed=true]{outline:2px solid #196ab8;background:#e5f2ff}

.chat-design-form{min-width:0;border:1px solid #cbddec;padding:8px;border-radius:10px;background:#eef6ff}
.chat-design-form summary{cursor:pointer;font-weight:700;min-height:38px;display:list-item;padding-top:6px}
.chat-design-form input{width:100%;margin:5px 0;box-sizing:border-box}
[data-chat-scene=ocean],[data-chat-scene=sunset]{--chat-scene-art:repeating-radial-gradient(ellipse at 80% 115%,transparent 0 22px,#ffffff6d 24px 26px,transparent 29px 49px)}
[data-chat-scene=stars]{--chat-scene-art:radial-gradient(circle at 16px 18px,#ffffffb0 1px,transparent 2px)}
[data-chat-scene=mountains],[data-chat-scene=forest]{--chat-scene-art:repeating-linear-gradient(151deg,#ffffff4b 0 20px,transparent 22px 49px)}
.chat-themed[data-chat-scene] .chat-history,.chat-theme-preview[data-chat-scene]{background-image:var(--chat-scene-art,linear-gradient(transparent,transparent)),linear-gradient(150deg,color-mix(in srgb,var(--chat-theme-start) 65%,white),color-mix(in srgb,var(--chat-theme-end) 65%,white))}
[data-chat-scene=stars] .chat-history,.chat-theme-preview[data-chat-scene=stars]{background-size:47px 38px,100% 100%}

.chat-peer video[hidden]{display:none!important}
.chat-call-card>button.primary{min-height:44px;margin:4px 10px}
.chat-call-card>button[hidden]{display:none!important}
