:root{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;color:#203933;background:#f2f5f4;font-size:16px;--brand:#12665d;--line:#e0e9e5;--muted:#70827c;--pale:#e6f2ed}*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button{cursor:pointer;border:0;border-radius:10px;padding:11px 17px;background:var(--brand);color:white;font-weight:600;transition:background .15s}button:hover{filter:brightness(.96)}button:disabled{opacity:.5;cursor:wait}button.ghost{background:#edf3f0;color:#35564b}button.danger{background:#fff0ee;color:#ae3d31}button.icon{padding:10px;min-width:42px;background:transparent;color:var(--muted)}button.small{padding:8px 12px;font-size:.875rem}a{color:var(--brand)}input,textarea,select{border:1px solid #d5e1db;border-radius:9px;background:white;color:inherit;padding:12px;outline:none;width:100%}input:focus,textarea:focus,select:focus{border-color:var(--brand);box-shadow:0 0 0 3px #12665d15}textarea{resize:none;line-height:1.5}button:focus-visible,a:focus-visible{outline:3px solid #38ad99;outline-offset:3px}h1,h2,h3,p{margin-top:0}h1{font-size:1.75rem;letter-spacing:-.04em}h2{font-size:1.3rem}h3{font-size:1rem}.muted{color:var(--muted);font-size:.875rem;line-height:1.6}.brand{display:flex;align-items:center;gap:10px;font-weight:750;letter-spacing:.08em}.brand img{width:36px;height:36px}.loading,.empty{padding:40px;text-align:center;color:var(--muted);line-height:1.9}.avatar{width:44px;height:44px;flex-shrink:0;display:grid;place-items:center;border-radius:14px;background:var(--pale);color:var(--brand);font-weight:700}.login{min-height:100dvh;display:grid;grid-template-columns:1fr 1fr;background:white}.login-art{background:#104e48;padding:9vw 7vw;color:white;display:flex;flex-direction:column;justify-content:center}.login-art .brand{margin-bottom:70px}.login-art h1{font-size:3.2rem;line-height:1.35;letter-spacing:0}.login-art p{color:#b2d1c6;line-height:1.8}.login-art .lines{margin-top:50px;display:flex;gap:12px}.lines span{height:5px;width:48px;border-radius:4px;background:#38776c}.lines span:first-child{background:#d6ef9d}.login-form{align-self:center;max-width:440px;width:100%;padding:40px;margin:auto}.login-form h2{font-size:1.8rem;margin-bottom:10px}.field{display:grid;gap:8px;margin:18px 0}.field label{font-size:.875rem;font-weight:600}.login-form button{width:100%;margin-top:8px}.error{color:#ae3d31;font-size:.875rem;line-height:1.6;min-height:22px}.shell{display:grid;grid-template-columns:220px minmax(0,1fr);height:100dvh}.sidebar{display:flex;flex-direction:column;background:#fbfdfc;border-right:1px solid var(--line);padding:30px 18px}.sidebar .brand{padding:0 10px;margin-bottom:44px}.nav{display:grid;gap:8px}.nav button{text-align:left;color:#64796e;background:transparent;padding:14px}.nav button.active{color:#155c4e;background:#e5efe8}.nav button span{margin-right:12px}.profile{margin-top:auto;border-top:1px solid var(--line);padding:22px 8px 0;display:grid;gap:12px}.profile-head{display:flex;align-items:center;gap:10px}.profile .avatar{width:36px;height:36px}.workspace{min-width:0;display:flex;flex-direction:column;overflow:hidden}.topbar{display:flex;align-items:center;justify-content:space-between;padding:24px 30px;border-bottom:1px solid var(--line);background:white;gap:15px}.topbar h1{margin:0;font-size:1.45rem}.topbar p{margin:5px 0 0}.tag{font-size:.8rem;background:#edf5e4;color:#517238;padding:6px 10px;border-radius:6px;white-space:nowrap}.agent-picker{max-width:200px;padding:8px}.page{padding:30px;overflow:auto;flex:1}.page-intro{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:25px}.page-intro p{margin:7px 0 0}.page-intro h2{margin:0}.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:18px}.card{background:white;border:1px solid var(--line);border-radius:14px;padding:22px}.card h3{margin:0 0 5px}.card-head{display:flex;gap:12px;align-items:center}.card-foot{display:flex;justify-content:space-between;align-items:center;margin-top:24px;gap:12px}.stat{font-size:1.4rem;margin:20px 0 4px}.links-list{display:grid;gap:12px}.link-row{background:white;border:1px solid var(--line);padding:18px 20px;border-radius:12px;display:flex;align-items:center;justify-content:space-between;gap:20px}.link-info{min-width:0;flex:1}.link-info h3{margin-bottom:8px}.link-url{font-size:.875rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}.row-actions{display:flex;gap:8px;flex-shrink:0}.chat-layout{flex:1;min-height:0;display:grid;grid-template-columns:320px minmax(0,1fr)}.conversation-list{background:#fbfdfc;border-right:1px solid var(--line);overflow:auto}.list-head{padding:20px}.list-head input{background:#f1f5f3;font-size:.875rem;border:0}.list-label{display:flex;justify-content:space-between;padding:0 20px 12px;font-size:.875rem;color:var(--muted)}.conversation{width:100%;border-radius:0;padding:19px 20px;display:flex;align-items:center;text-align:left;background:transparent;color:inherit;gap:12px;font-weight:400;border-left:3px solid transparent}.conversation.selected{background:#eaf2ed;border-left-color:var(--brand)}.conversation .preview{overflow:hidden;flex:1;min-width:0}.conversation strong{font-size:.9rem}.conversation p{margin:7px 0 0;font-size:.875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--muted)}.conversation time{font-size:.75rem;color:var(--muted);align-self:flex-start}.badge{background:#d66a51;color:white;min-width:20px;height:20px;display:grid;place-items:center;border-radius:20px;font-size:.75rem;margin-top:7px}.chat{min-width:0;min-height:0;display:flex;flex-direction:column;background:#f3f6f4}.chat-header{padding:20px 25px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px;background:#fff}.chat-header h2{font-size:1rem;margin:0 0 5px}.chat-header .meta{flex:1;min-width:0}.chat-header p{margin:0;font-size:.8rem;color:var(--muted)}.messages{flex:1;min-height:0;overflow:auto;padding:25px;scroll-behavior:auto;overflow-anchor:none}.message{display:flex;gap:9px;margin:0 0 20px;align-items:flex-start}.message.mine{flex-direction:row-reverse}.message .avatar{width:32px;height:32px;border-radius:10px;font-size:.8rem;background:white}.message.mine .avatar{background:#d6e7dc}.bubble-wrap{max-width:min(75%,560px)}.bubble{background:white;border:1px solid #e4ebe7;border-radius:0 13px 13px 13px;padding:12px 15px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}.mine .bubble{background:#dcecdf;border:1px solid #d1e4d6;border-radius:13px 0 13px 13px}.bubble img,.bubble video{display:block;max-width:100%;max-height:330px;border-radius:8px}.bubble:has(img),.bubble:has(video){padding:5px}.message time{font-size:.75rem;color:#8a9990;display:block;margin-top:6px}.mine time{text-align:right}.chat-note{text-align:center;font-size:.8rem;color:#8a9990;margin:0 0 28px;line-height:1.7}.composer{background:white;border-top:1px solid var(--line);padding:12px 22px 18px}.composer-tools{display:flex;align-items:center;gap:5px;margin-bottom:4px}.composer-tools .muted{font-size:.75rem}.compose-row{display:flex;align-items:flex-end;gap:12px}.compose-row textarea{border:0;box-shadow:none;background:transparent;padding:8px 0;min-height:52px;max-height:160px}.compose-row button{flex-shrink:0}.connection{font-size:.8rem;color:var(--muted)}.connection::before{content:"";display:inline-block;background:#8b9d91;width:6px;height:6px;border-radius:50%;margin-right:6px}.connection.online::before{background:#359474}.guest-body{min-height:100dvh;display:flex;align-items:center;justify-content:center;background:#e5ece7;padding:24px}.guest-frame{height:min(880px,calc(100dvh - 48px));width:100%;max-width:640px;border:1px solid #d9e4de;border-radius:20px;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 16px 70px #2347370c}.guest-frame .chat{flex:1}.guest-frame .chat-header{padding:19px 23px}.guest-frame .chat-header .avatar{background:#12665d;color:white}.guest-frame .composer{padding-bottom:max(16px,env(safe-area-inset-bottom))}.guest-frame .brand-footer{text-align:center;padding:10px;font-size:.75rem;color:#899b90;background:white}.mobile-back{display:none}dialog{border:1px solid var(--line);border-radius:18px;padding:28px;width:min(460px,calc(100vw - 32px));color:inherit;box-shadow:0 25px 100px #092d3d30}dialog::backdrop{background:#153e3455;backdrop-filter:blur(3px)}.dialog-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:25px}#toast{position:fixed;bottom:30px;left:50%;transform:translateX(-50%);max-width:calc(100vw - 32px);padding:13px 20px;border-radius:10px;background:#183c33;color:white;box-shadow:0 5px 30px #183c3330;font-size:.875rem;z-index:10;display:none}#toast.show{display:block}.backdrop-empty{height:100%;display:grid;place-content:center;text-align:center;color:var(--muted);padding:35px}.backdrop-empty .empty-symbol{font-size:3rem;color:#aac5b5;margin-bottom:12px}.backdrop-empty h2{color:#527060}.wide-note{padding:16px 20px;background:#e9f1ec;color:#5e7768;font-size:.875rem;border-radius:10px;line-height:1.8;margin-bottom:22px}.disabled-card{opacity:.65}.older{display:block;margin:0 auto 20px;background:transparent;color:var(--muted);font-size:.8rem}.blocked-tag{color:#b34739}.toolbar{display:flex;gap:10px}.hide{display:none!important}
@media(max-width:1100px){.shell{grid-template-columns:180px 1fr}.chat-layout{grid-template-columns:280px 1fr}.topbar{padding:20px}.sidebar{padding:25px 10px}.page{padding:22px}.row-actions{flex-wrap:wrap;justify-content:flex-end}.chat-header{padding:17px}.messages{padding:18px}}
@media(max-width:760px){.login{display:block;background:#f2f6f3}.login-art{padding:38px 28px 30px}.login-art .brand{margin-bottom:30px}.login-art h1{font-size:2rem}.login-art p,.login-art .lines{display:none}.login-form{padding:35px 28px}.shell{display:flex;flex-direction:column;height:100dvh}.sidebar{padding:12px 16px;border-right:0;border-bottom:1px solid var(--line);flex-direction:row;align-items:center;justify-content:space-between}.sidebar .brand{margin:0;padding:0;font-size:.875rem}.sidebar .brand img{width:30px;height:30px}.nav{display:flex;gap:3px}.nav button{font-size:.8rem;padding:10px 9px}.nav button span{display:none}.profile{margin:0;padding:0;border:0}.profile-head{display:none}.profile button{padding:9px;font-size:.8rem}.workspace{flex:1;min-height:0}.topbar{padding:17px 18px}.topbar h1{font-size:1.2rem}.topbar p{display:none}.topbar .tag{display:none}.agent-picker{max-width:160px;font-size:.875rem}.chat-layout{display:block;position:relative}.conversation-list{height:100%;border:0}.chat-layout .chat{display:none;position:absolute;inset:0}.chat-layout.open .chat{display:flex}.chat-layout.open .conversation-list{display:none}.mobile-back{display:block}.chat-header{padding:12px;gap:8px}.chat-header .avatar{width:38px;height:38px}.chat-header button.small{font-size:.75rem;padding:9px}.messages{padding:18px 13px}.bubble-wrap{max-width:80%}.composer{padding:8px 14px max(14px,env(safe-area-inset-bottom))}.compose-row{gap:8px}.page{padding:20px 16px}.page-intro{align-items:flex-start}.page-intro h2{font-size:1.1rem}.page-intro p{font-size:.8rem}.page-intro button{font-size:.875rem;white-space:nowrap}.cards{grid-template-columns:1fr}.link-row{padding:16px;flex-wrap:wrap;gap:14px}.link-info{flex-basis:100%}.row-actions{justify-content:flex-start}.guest-body{padding:0;background:white}.guest-frame{height:100dvh;border:0;border-radius:0;max-width:100%}.guest-frame .chat-header{padding:15px 18px}.guest-frame .brand-footer{padding:7px}.guest-frame .messages{padding:22px 14px}.guest-frame .chat{height:100%;min-height:0}.wide-note{padding:13px 15px;font-size:.8rem}.toolbar{gap:6px}}

#view{flex:1;min-height:0}.sidebar .brand{white-space:nowrap}@media(max-width:420px){.sidebar .brand span{display:none}.sidebar{padding:10px}.nav button{padding:10px 7px}.sidebar .brand{padding-right:3px}}

.welcome-bubble{white-space:pre-wrap;overflow-wrap:anywhere;background:white;padding:14px;border-radius:12px;margin:12px 0;line-height:1.7}.welcome-bubble img{display:block;max-width:100%;max-height:480px;border-radius:8px}#welcome-items{max-width:560px}.message-select{width:22px;height:22px;flex-shrink:0}.chat-header{flex-wrap:wrap}#delete-tools{background:#fff4ed;padding:10px;display:flex;gap:10px;align-items:center;flex-wrap:wrap}.chat-header .meta p{overflow-wrap:anywhere}@media(max-width:760px){.chat-actions{width:100%;justify-content:flex-end}.sidebar{flex-wrap:wrap}.nav{overflow-x:auto}.profile{display:flex;gap:5px}.nav button{white-space:nowrap}.welcome-bubble img{max-height:380px}}
.phone-copy{display:inline;padding:0;border:0;background:none;color:inherit;font:inherit;text-decoration:underline;text-underline-offset:3px;cursor:pointer;user-select:all}.receipt{margin-left:7px;color:#8996a3}.receipt.is-read{color:#16836f}.visitor-tag{display:inline-block;font-size:10px;color:#167360;background:#e7f5ef;padding:2px 5px;border-radius:4px;font-weight:500}.chat-header .meta p{white-space:normal;line-height:1.6;font-size:11px}.chat-header .meta{min-width:0}.chat-header{flex-wrap:wrap}

.download-qr{display:inline-flex;align-items:center;justify-content:center;border-radius:10px;padding:8px 12px;background:#edf3f0;color:#35564b;font-size:.875rem;font-weight:600;text-decoration:none;white-space:nowrap}.qr-preview{display:block;width:280px;max-width:100%;height:auto;margin:16px auto}.row-actions{flex-wrap:wrap}.bubble img,.bubble video{width:280px;height:auto;aspect-ratio:4/3;object-fit:contain;background:#f2f5f4}.bubble video{aspect-ratio:16/9}.welcome-bubble img{width:100%;height:auto;aspect-ratio:4/3;object-fit:contain}.chat{position:relative}#new-message-notice{position:absolute;right:16px;bottom:150px;z-index:2;border:1px solid #d0e2d8;box-shadow:0 3px 14px #183c331a;padding:9px 13px;font-size:.8rem}.phone-copy{white-space:nowrap}
/* Compact chat-first layout */
:root{--brand:#07a957;--line:#dedede;--muted:#888;--pale:#e4f3e9;color:#202020;background:#ededed}.chat,.messages{background:#ededed}.chat-header{background:#f7f7f7;border-color:#dedede;padding:12px 16px;min-height:64px}.chat-header h2{font-size:17px;font-weight:600}.chat-header>.avatar{display:none}.message .avatar{border-radius:5px;background:#d9e8ef;color:#526b76;width:38px;height:38px}.message.mine .avatar{background:#dcebd4}.message{gap:10px;margin-bottom:18px}.bubble,.mine .bubble{border-radius:5px;border:0;padding:10px 12px;background:#fff;position:relative;color:#161616}.mine .bubble{background:#95ec69}.bubble-wrap{max-width:min(78%,540px)}.bubble:before{content:'';position:absolute;top:14px;left:-6px;border-right:6px solid #fff;border-top:6px solid transparent;border-bottom:6px solid transparent}.mine .bubble:before{left:auto;right:-6px;border-right:0;border-left:6px solid #95ec69}.bubble:has(img),.bubble:has(video){padding:0;background:transparent}.bubble:has(img):before,.bubble:has(video):before{display:none}.message time{font-size:10px}.composer{background:#f7f7f7;padding:8px 12px max(10px,env(safe-area-inset-bottom));border-top:1px solid #ddd}.compose-row textarea{background:#fff;border-radius:5px;padding:9px 10px;min-height:42px;height:44px}.compose-row button{border-radius:5px;padding:10px 15px}.composer-tools{margin:0;height:28px}.composer-tools .icon{padding:0;min-width:28px;font-size:25px}.guest-body{background:#ededed}.guest-frame{border-radius:8px;max-width:760px;box-shadow:none}.brand-footer{display:none}.guest-status{display:grid;gap:4px;text-align:right;font-size:11px;color:#999}#agent-status.is-online{color:#07a957}.guest-status .connection{font-size:10px}.guest-frame .chat-header{padding:12px 16px}.guest-frame .chat-header [data-sound]{font-size:10px;padding:7px}.chat-note{font-size:11px;margin-bottom:20px}.chat-actions{position:absolute;z-index:5;top:62px;right:10px;width:230px!important;display:grid;background:#fff;border:1px solid #ddd;border-radius:10px;padding:10px;box-shadow:0 8px 30px #0002}.chat-actions button{text-align:left}.chat-header .meta p{font-size:10px}.availability-label{font-size:12px;color:#666}.availability-label select{padding:7px;margin-top:5px}.chat-focused .sidebar,.chat-focused .topbar{display:none}.chat-focused .shell{display:block;height:100dvh}.chat-focused .shell>.workspace{height:100%}.chat-focused .chat-layout{display:block}.chat-focused .conversation-list{display:none}.chat-focused #chat-pane{position:relative;display:flex;height:100%;inset:auto}.chat-focused .mobile-back{display:block}.chat-focused .chat-header .meta p{max-height:32px;overflow:hidden}.chat-focused .chat-header{flex-wrap:nowrap}.chat-focused #view{height:100%}.chat-focused .chat-layout{height:100%}.conversation{border-bottom:1px solid #eee}.conversation.selected{background:#dedede}.badge{background:#fa5151}.guest-frame .chat{height:100%}#new-message-notice{bottom:112px;background:#fff;color:#07a957}.receipt.is-read{color:#07a957}.phone-copy{white-space:normal}.chat-focused .chat-header #chat-more{font-size:24px;color:#222}.guest-frame .chat-header .meta p{font-size:10px}
@media(max-width:760px){.guest-frame{height:100dvh;border-radius:0;max-width:none}.chat-focused .chat-layout .chat{position:relative}.guest-frame .messages,.messages{padding:18px 12px}.guest-frame .composer{padding-bottom:max(10px,env(safe-area-inset-bottom))}.chat-focused .chat-header .meta p{display:none}.chat-focused .chat-header{min-height:56px}.guest-frame .chat-header{gap:6px}.guest-frame .chat-header .meta{min-width:90px}.guest-frame .chat-header h2{font-size:16px}.chat-actions{top:56px}.profile{flex-wrap:wrap}.availability-label{display:flex;gap:7px;align-items:center}.availability-label select{width:auto;margin:0}.guest-frame [data-sound]{max-width:62px}.bubble-wrap{max-width:78%}}

.chat-actions{justify-content:stretch!important;align-items:stretch!important}.chat-actions button{width:100%}.visitor-info{font-size:11px!important;color:#777;padding:5px;line-height:1.6;margin:0 0 6px!important}
/* Conversation home and settings */
.shell{display:block}.sidebar{display:none}.topbar{height:72px;padding:12px 24px;background:#ededed;border-bottom:1px solid #ddd}.topbar h1{font-size:20px}.topbar #page-subtitle{font-size:12px;margin-top:3px}.shell>.workspace{height:100dvh}.chat-layout{display:block}.chat-layout:not(.open) #chat-pane{display:none}.chat-layout .conversation-list{width:100%;height:100%;border:0;background:#fff}.chat-layout.open .conversation-list{display:none}.chat-layout.open #chat-pane{height:100%;display:flex}.list-head{background:#ededed;padding:10px 16px}.list-head input{background:#fff;border:0;text-align:center;border-radius:7px}.list-label{background:#fff;padding:12px 20px;color:#888}.conversation{padding:16px 20px;border-radius:0;border-bottom:1px solid #eee;gap:14px;min-height:84px}.conversation .preview strong{font-size:16px;font-weight:500}.conversation .preview p{font-size:14px;color:#999;margin-top:7px}.conversation .avatar{width:52px;height:52px;flex-shrink:0;border-radius:8px}.avatar img{width:100%;height:100%;object-fit:cover;display:block;border-radius:inherit}.conversation time{color:#aaa;font-size:12px}.conversation .visitor-tag{font-size:10px;background:transparent;color:#aaa}.conversation.selected{background:#eee}.settings-open .sidebar{display:flex;position:fixed;right:0;left:auto;top:0;bottom:0;width:min(360px,90vw);z-index:101;background:#f7f7f7;padding:22px;overflow:auto;box-shadow:-8px 0 32px #0002;flex-direction:column}.settings-shade{position:fixed;inset:0;background:#0005;border:0;border-radius:0;z-index:100;width:100%;height:100%}.settings-heading{display:flex;align-items:center;justify-content:space-between}.settings-heading h2{font-size:22px}.sidebar .brand{margin:16px 0}.sidebar .nav{display:flex;flex-direction:column;gap:6px;margin:16px 0}.sidebar .nav button{width:100%;text-align:left;padding:14px}.sidebar .profile{margin-top:auto;display:flex;flex-direction:column;gap:10px}.sidebar .agent-picker{width:100%;margin-top:12px}.sidebar .profile-head{padding:12px 0}.sidebar .availability-label{display:flex;justify-content:space-between;align-items:center}.chat-focused .chat-layout{height:100dvh}.chat-focused .topbar{display:none}.chat-header>.avatar{display:flex}.message .avatar{overflow:hidden}.composer-tools{min-width:0}#upload-hint{white-space:normal;font-size:12px}.compose-row{min-width:0}.compose-row textarea{min-width:0}.settings-shade.hide{display:none}
@media(min-width:761px){.conversation-list{max-width:960px;margin:auto}.chat-layout.open #chat-pane{max-width:1000px;margin:auto}.shell>.workspace{background:#f5f5f5}.topbar{padding-left:max(24px,calc((100vw - 920px)/2));padding-right:max(24px,calc((100vw - 920px)/2))}}
@media(max-width:760px){.topbar{height:62px;padding:10px 16px}.topbar h1{font-size:19px}.topbar #page-subtitle{display:none}.conversation{padding:14px 16px}.settings-open .sidebar .nav{flex-wrap:nowrap}.settings-open .sidebar .profile{display:flex}.settings-open .sidebar .brand{display:flex}.settings-open .sidebar{border:0}.chat-header>.avatar{width:34px;height:34px}.chat-header .meta{min-width:0}}

html,body{touch-action:pan-x pan-y}input,textarea,select{font-size:16px}.visitor-presence{display:inline-block;font-size:11px;font-weight:400;color:#999;white-space:nowrap}.visitor-presence:before{content:"";display:inline-block;width:6px;height:6px;background:currentColor;border-radius:50%;margin-right:4px;vertical-align:middle}.visitor-presence.is-online{color:#07a957}.chat-header h2 .visitor-presence{margin-left:5px}

/* Images use their own proportions, like an image message in a chat app. */
.message .bubble-wrap:has(.chat-image){width:fit-content;min-width:0}
.message .bubble:has(.chat-image){width:fit-content;max-width:100%;padding:0;background:transparent}
.chat-image-link{display:block;width:fit-content;max-width:100%;line-height:0}
.bubble img.chat-image{display:block;width:auto;height:auto;max-width:min(280px,100%);max-height:330px;aspect-ratio:unset;object-fit:contain;background:transparent;border-radius:5px}
.welcome-bubble:has(img){display:table;max-width:100%;padding:0;background:transparent}
.welcome-bubble img{display:block;width:auto;height:auto;max-width:100%;max-height:480px;aspect-ratio:auto;background:transparent}

/* A fixed outer viewport; only the message list and explicit panels scroll. */
html,body{height:100%;overflow:hidden;overscroll-behavior:none}
#app{position:fixed;left:0;right:0;top:0;height:var(--chat-viewport-height,100dvh);overflow:hidden}
.shell,.shell>.workspace,.chat-focused .shell,.chat-focused .shell>.workspace,.chat-focused .chat-layout{height:100%;min-height:0}
.chat-layout,.chat-focused #view,.chat-focused #chat-pane,.guest-frame .chat{min-height:0;overflow:hidden}
.chat-header,.composer,.topbar,#delete-tools{flex-shrink:0;overscroll-behavior:none}
.chat-header,.topbar,.composer-tools{touch-action:manipulation}
.messages{overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
.conversation-list,.sidebar,.page,textarea,dialog{overscroll-behavior-y:contain}
.guest-body{height:100%;min-height:0;overflow:auto}
.guest-frame{height:min(880px,100%);min-height:0;flex-shrink:0}
.login{height:100%;min-height:0;overflow-y:auto}
@media(max-width:760px){.guest-body{overflow:hidden}.guest-frame{height:100%;max-height:100%}.guest-frame .chat{height:100%}}

.chat-layout .conversation-list{display:flex;flex-direction:column;overflow:hidden;min-height:0}
.chat-layout.open .conversation-list{display:none}
.conversation-list .list-head,.conversation-list .list-label{flex-shrink:0;touch-action:manipulation}
#conversation-items{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
.list-refresh-status{flex-shrink:0;text-align:center;font-size:12px;color:var(--muted);padding:9px;background:#f5f5f5}
.list-refresh-status[hidden]{display:none}

html.native-keyboard #app{height:100%;top:0}
.keyword-rule{display:grid;gap:8px;border:1px solid var(--border,#ddd);border-radius:10px;padding:12px;margin-bottom:12px}
.keyword-rule label{display:grid;gap:6px}
.keyword-rule textarea{width:100%;box-sizing:border-box}

/* Browser fixed elements use the layout viewport; compensate only its visual viewport pan. */
html:not(.native-keyboard) #app{transform:translate3d(0,var(--chat-viewport-top,0px),0);will-change:transform}
html.native-keyboard #app{transform:none}

#image-viewer{position:fixed;inset:0;margin:0;width:100%;height:100%;max-width:100%;max-height:100%;padding:0;border:0;border-radius:0;background:#000;overflow:hidden;color:white}#image-viewer::backdrop{background:#000}#image-viewer .image-viewer-close{position:absolute;right:12px;top:max(12px,env(safe-area-inset-top));z-index:2;font-size:32px;background:#3339;color:#fff;padding:6px 14px}.image-viewer-stage{width:100%;height:100%;display:grid;place-items:center;overflow:auto;touch-action:pan-x pan-y}.image-viewer-stage img{max-width:100%;max-height:100%;object-fit:contain;cursor:zoom-in}.image-viewer-stage img.zoomed{max-width:none;max-height:none;width:auto;height:auto;cursor:zoom-out}.image-viewer-error{position:absolute;bottom:30px;width:100%;text-align:center}

.image-viewer-download{position:absolute;top:16px;left:16px;z-index:3;background:#fff;color:#203933}
.chat-layout{position:relative}.chat-layout.open.swiping-back .conversation-list{display:flex;position:absolute;inset:0;z-index:0}.chat-layout.swiping-back #chat-pane{position:relative;z-index:1;box-shadow:-8px 0 24px #0002;will-change:transform}

.shortcut-trigger{padding:10px 14px;margin-bottom:6px;border-radius:12px;background:#d9f1d0;white-space:pre-wrap}.pending-send{opacity:.7}.pending-send time{display:block;text-align:right}
/* Keep the conversation header and list in their final geometry beneath the chat overlay. */
.shell>.workspace{position:relative}
.chat-focused .topbar{display:flex}
.chat-focused #view{height:auto;flex:1;min-height:0}
.chat-layout,.chat-focused .chat-layout{position:static;height:100%;min-height:0}
.chat-layout.open .conversation-list,.chat-layout.open.swiping-back .conversation-list{display:flex;position:relative;inset:auto;z-index:auto;height:100%}
.chat-layout.open #chat-pane,.chat-focused .chat-layout .chat,.chat-layout.swiping-back #chat-pane{position:absolute;inset:0;z-index:2;height:100%;width:100%;max-width:none;margin:0;background:#ededed}

.chat-initializing .messages{visibility:hidden}
