/* WQ1: scoped to chat; existing Memory, diary, settings and device pages retained. */
body:has(#appView[data-active-panel="chat"]:not([hidden]))>.topbar{display:none}
body:has(#appView[data-active-panel="chat"]:not([hidden])){overflow:hidden}
body:has(#appView[data-active-panel="chat"]:not([hidden]))>.shell{max-width:1800px;width:100%;height:100dvh;margin:0 auto;padding:0 0 76px}
#appView[data-active-panel="chat"]{height:100%;padding:0;min-height:0;background:#faf8f6}
#appView[data-active-panel="chat"]:before,#appView[data-active-panel="chat"]:after{display:none}
#webChatPanel.active{height:100%;animation:none}
#webChatPanel{--wc-line:#e8e2e7;--wc-ink:#302d38;--wc-muted:#77717e;--wc-accent:#892d42;color:var(--wc-ink)}
#webChatPanel *{box-sizing:border-box}
#webChatPanel button{font:inherit;letter-spacing:normal;cursor:pointer}
#webChatPanel button:disabled{opacity:.5;cursor:default}
#webChatPanel button:focus-visible{outline:3px solid #b8a2ca;outline-offset:3px}
#webChatPanel [hidden]{display:none!important}
.wc-shell{height:100%;display:grid;grid-template-columns:235px minmax(320px,1fr) 285px;background:#faf8f6}
.wc-sidebar{background:#f6f2f0;padding:27px 19px 18px;border-right:1px solid var(--wc-line);display:flex;flex-direction:column;min-height:0;gap:20px}
.wc-brand{display:flex;gap:11px;text-align:left;align-items:center;border:0;background:none;padding:0 9px;color:var(--wc-ink)}
.wc-brand>img{width:42px;height:42px;border-radius:13px;object-fit:cover;flex-shrink:0}.wc-brand span{font-size:14px;letter-spacing:0}.wc-brand strong{display:block}.wc-brand small{display:block;color:var(--wc-muted);font-size:10px;letter-spacing:1px;margin-top:5px}
.wc-role-picker{padding:10px;border:1px solid var(--wc-line);border-radius:13px;background:#fffdfa;display:flex;gap:10px;align-items:center;text-align:left}.wc-role-picker img,.wc-avatar{width:40px;height:40px;border-radius:50%;object-fit:cover;background:#e8e2ec}.wc-role-picker strong{font-size:13px}.wc-role-picker small{display:block;font-size:10px;color:var(--wc-muted);margin-top:5px}
#webChatPanel .wc-primary{background:var(--wc-accent);border:0;border-radius:11px;color:white;padding:11px 16px;font-size:13px;box-shadow:none}
.wc-history-head{display:flex;justify-content:space-between;align-items:center;font-size:11px;color:var(--wc-muted);padding:0 7px}.wc-history-head button{border:0;background:none;font-size:18px}
.wc-history{flex:1;min-height:0;overflow:auto}.wc-history button{border:0;border-radius:11px;background:none;text-align:left;font-size:12px;width:100%;padding:12px;line-height:1.7;margin-bottom:5px;overflow-wrap:anywhere}.wc-history button.active{background:#ebe4e9}.wc-history small{display:block;color:var(--wc-muted);font-size:10px;margin-top:4px}.wc-history p{font-size:11px;color:var(--wc-muted);padding:6px;line-height:1.8}
.wc-side-note{font-size:10px;color:var(--wc-muted);line-height:1.8;margin:0}.wc-space-link{border:0;border-top:1px solid var(--wc-line);padding:15px 0 0;background:none;text-align:left;font-size:12px;color:var(--wc-ink)}
.wc-main{min-width:0;min-height:0;display:flex;flex-direction:column;background:linear-gradient(150deg,#fffdfa,#f8f5fc)}
.wc-head{height:82px;flex-shrink:0;display:flex;align-items:center;gap:12px;padding:17px 27px;border-bottom:1px solid var(--wc-line)}.wc-head h2{font-size:17px;margin:0;font-weight:600}.wc-head p{font-size:10px;color:var(--wc-muted);margin:5px 0 0}.wc-head>.wc-quiet{margin-left:auto}
#webChatPanel .wc-quiet{border:1px solid var(--wc-line);background:#fffc;color:var(--wc-ink);border-radius:9px;padding:8px 10px;font-size:11px;white-space:nowrap;box-shadow:none}
#webChatPanel .wc-icon{border:0;background:none;font-size:20px;padding:7px;color:var(--wc-ink);border-radius:9px}.wc-close,.wc-mobile{display:none}
.wc-messages{flex:1;overflow:auto;min-height:0;overscroll-behavior:contain;padding:30px clamp(20px,4vw,65px) 20px;scroll-behavior:auto}
.wc-message{max-width:92%;display:flex;gap:9px;margin-bottom:24px}.wc-message>img{height:30px;width:30px;object-fit:cover;border-radius:50%;margin-top:20px;background:#e9e1ec}.wc-message-copy{min-width:0}.wc-author{font-size:10px;color:var(--wc-muted);margin-bottom:6px}.wc-bubble{font-size:14px;line-height:1.85;white-space:pre-wrap;overflow-wrap:anywhere;padding:13px 17px;background:#fffdfc;border:1px solid #e9e2ec;border-radius:3px 17px 17px 17px}.wc-message.user{margin-left:auto;justify-content:flex-end}.wc-message.user .wc-author{text-align:right}.wc-message.user .wc-bubble{background:#eeebf5;border-color:transparent;border-radius:17px 3px 17px 17px}.wc-message[data-failed=true] .wc-bubble{border:1px solid #b35b69}.wc-message-status{font-size:10px;color:var(--wc-muted);padding-top:6px}.wc-message button.rw-remember{font-size:10px;color:var(--wc-muted);padding:5px 0;border:0;background:none;box-shadow:none}
.wc-empty{max-width:410px;text-align:center;margin:70px auto 30px}.wc-empty h3{font:25px serif;margin-bottom:18px}.wc-empty p{font-size:12px;line-height:1.9;color:var(--wc-muted)}.wc-empty button{font-size:11px;border:1px solid var(--wc-line);border-radius:18px;padding:9px 13px;background:#fff9;margin-top:13px}
.wc-input-area{padding:7px clamp(20px,4vw,65px) max(15px,env(safe-area-inset-bottom));flex-shrink:0}.wc-status{font-size:11px;color:var(--wc-muted);line-height:1.6;margin:0 0 8px;overflow-wrap:anywhere}.wc-status[data-error=true]{color:#9b384b}.wc-mode-line{display:flex;align-items:center;gap:12px;font-size:10px;color:var(--wc-muted);margin-bottom:9px}.wc-mode-line strong{font-size:11px;color:var(--wc-accent);background:#eee8ef;padding:6px 12px;border-radius:7px;font-weight:500}.wc-mode-line button{margin-left:auto;font-size:10px;background:none;border:0;color:var(--wc-muted)}
.wc-composer{border:1px solid #dcd3e2;background:#fffdfa;border-radius:16px;padding:13px 13px 10px;box-shadow:0 8px 30px #30203f05}
#webChatPanel .wc-composer textarea{border:0!important;background:none!important;box-shadow:none!important;resize:none;width:100%;min-height:48px;max-height:125px;padding:0 3px;border-radius:0;color:var(--wc-ink);font-size:14px;line-height:1.7}
/* One focus treatment on the composer, never a second rectangle inside it. */
#webChatPanel .wc-composer textarea:focus-visible{outline:none}
.wc-composer:has(textarea:focus-visible){border-color:#a69b9f;box-shadow:0 0 0 1px #a69b9f}
.wc-compose-tools{display:flex;align-items:center;gap:8px;margin-top:9px}.wc-compose-tools>span{margin-left:auto;color:var(--wc-muted);font-size:10px}.wc-compose-tools .wc-primary{margin-left:auto}.wc-caption{font-size:10px;text-align:center;color:var(--wc-muted);line-height:1.7;margin:9px 0 0}
.wc-details{padding:27px 22px;background:#fcfaf9;border-left:1px solid var(--wc-line);overflow:auto;min-height:0}.wc-profile{text-align:center;padding:9px 0 20px}.wc-profile img{width:83px;height:83px;object-fit:cover;border-radius:50%;border:5px solid #f0eaf0;background:#e9e1ec}.wc-profile h3{font-size:18px;font-weight:500;margin:14px 0 10px}.wc-profile p{font-size:11px;line-height:1.9;color:var(--wc-muted);overflow-wrap:anywhere}.wc-tabs{display:flex;gap:20px;border-bottom:1px solid var(--wc-line);margin:0 0 23px}.wc-tabs button{padding:10px 0;border:0;border-bottom:2px solid transparent;background:none;font-size:12px;color:var(--wc-muted)}.wc-tabs button[aria-selected=true]{color:var(--wc-accent);border-bottom-color:var(--wc-accent)}
.wc-details h4{font-size:12px;margin:20px 0 13px}.wc-details [role=tabpanel]>p{font-size:11px;line-height:1.9;color:var(--wc-muted)}#webChatPanel .wc-link{display:block;width:100%;text-align:left;background:none;border:1px solid var(--wc-line);border-radius:10px;padding:12px;margin:15px 0;font-size:11px;color:var(--wc-ink)}.wc-detail-note{font-size:10px;color:var(--wc-muted);line-height:1.9;margin-top:28px}.wc-backdrop{position:absolute;inset:0;background:#32273c55;z-index:8}.wc-shell.details-hidden{grid-template-columns:235px minmax(320px,1fr)}.wc-shell.details-hidden .wc-details{display:none}
@media(min-width:761px) and (max-width:1199px){.wc-shell,.wc-shell.details-hidden{grid-template-columns:220px minmax(320px,1fr)}.wc-details{display:none}.wc-shell.details-open .wc-details{display:block;position:absolute;inset:0 0 0 auto;width:285px;z-index:9;box-shadow:-15px 0 40px #30203f14}.wc-details .wc-close{display:block;margin-left:auto}}
@media(max-width:760px){body:has(#appView[data-active-panel="chat"]:not([hidden]))>.shell{padding-bottom:78px}.wc-shell,.wc-shell.details-hidden{display:flex}.wc-sidebar,.wc-details{display:none}.wc-main{width:100%}.wc-head{height:73px;padding:12px 13px;gap:8px}.wc-head h2{font-size:15px}.wc-avatar{width:35px;height:35px}.wc-mobile{display:block}.wc-messages{padding:23px 15px 12px}.wc-message{max-width:96%;gap:7px;margin-bottom:21px}.wc-message>img{height:26px;width:26px}.wc-bubble{font-size:14px;padding:12px 14px}.wc-input-area{padding:7px 13px 12px}.wc-composer{padding:12px 10px 10px}.wc-compose-tools>span{display:none}#webChatPanel .wc-composer textarea{font-size:16px}.wc-caption{font-size:9px}.wc-shell.nav-open .wc-sidebar,.wc-shell.details-open .wc-details{display:flex;flex-direction:column;position:absolute;top:0;bottom:0;z-index:9;width:min(315px,88vw);box-shadow:0 10px 40px #30203f30}.wc-shell.nav-open .wc-sidebar{left:0}.wc-shell.details-open .wc-details{right:0}.wc-close{display:block;align-self:flex-end}.wc-profile{padding-top:0}.wc-empty{margin-top:35px}}
#webChatPanel .wc-mode-choices{display:flex;gap:2px;padding:3px;background:#eee8ef;border-radius:9px}
#webChatPanel .wc-mode-choices button{margin:0;padding:5px 9px;border-radius:6px;font-size:11px;color:#75667e}
#webChatPanel .wc-mode-choices button[aria-pressed=true]{color:var(--wc-accent);background:#fff}
.wc-voice{display:flex;align-items:center;gap:10px;background:#f1eaf2;border:1px solid #e6dce9;border-radius:12px;padding:10px 12px;margin-top:9px;max-width:420px;flex-wrap:wrap}
#webChatPanel .wc-audio-play{background:var(--wc-accent);color:white;border:0;border-radius:8px;padding:7px 11px;font-size:11px;white-space:nowrap}
.wc-audio-status{font-size:10px;line-height:1.6;color:#796680;flex:1;min-width:100px}
#webChatPanel .wc-audio-regenerate,#webChatPanel .wc-transcript{background:none;border:0;color:var(--wc-accent);font-size:10px;padding:6px 0}
#webChatPanel .wc-transcript{display:block;margin-top:4px}
@media(max-width:760px){#webChatPanel .wc-mode-choices button{font-size:10px;padding:5px 7px}.wc-mode-line{gap:6px}.wc-compose-tools{flex-wrap:wrap;gap:5px}.wc-voice{gap:8px;min-width:180px}}
/* The sidebar must remain scrollable on short windows and with long history.
   Keep bottom navigation reachable instead of shrinking the footer offscreen. */
.wc-sidebar{overflow-y:auto;overscroll-behavior:contain}
.wc-sidebar>:not(.wc-history){flex-shrink:0}
.wc-history{flex:1 0 100px}
