/* Chat-only viewport. The DOM is authoritative even when a route changes body classes. */
html:has(body #app:not([hidden]) > #pageRoot > .chat-page),
body:has(#app:not([hidden]) > #pageRoot > .chat-page){
 height:100%!important;min-height:0!important;overflow:hidden!important;overscroll-behavior:none!important;
}
body #app:not([hidden]):has(> #pageRoot > .chat-page){
 position:fixed!important;inset:0!important;display:flex!important;flex-direction:column!important;
 box-sizing:border-box!important;width:100%!important;max-width:none!important;
 height:100dvh!important;max-height:100dvh!important;min-height:0!important;
 margin:0!important;padding:0!important;overflow:hidden!important;transform:none!important;
}
body #app:has(> #pageRoot > .chat-page) > #appHeader{
 position:relative!important;inset:auto!important;flex:0 0 auto!important;
 margin-top:0!important;transform:none!important;
}
body #app:has(> #pageRoot > .chat-page) > #siteFooter{display:none!important}
body #app:has(> #pageRoot > .chat-page) > #pageRoot{
 display:flex!important;flex-direction:column!important;flex:1 1 0%!important;
 position:relative!important;inset:auto!important;box-sizing:border-box!important;
 width:100%!important;min-width:0!important;height:auto!important;min-height:0!important;max-height:none!important;
 margin:0 auto!important;padding:clamp(10px,1.3vw,20px) clamp(12px,2.2vw,32px)!important;
 overflow:hidden!important;transform:none!important;
}
body #app > #pageRoot > .chat-page{
 display:grid!important;grid-template-columns:minmax(0,1fr)!important;
 grid-template-rows:auto auto minmax(0,1fr) auto!important;
 align-content:stretch!important;align-items:stretch!important;flex:1 1 0%!important;
 position:relative!important;inset:auto!important;box-sizing:border-box!important;
 width:100%!important;height:100%!important;min-height:0!important;max-height:100%!important;min-width:0!important;
 margin:0 auto!important;padding:clamp(12px,1.5vw,24px)!important;gap:12px!important;
 overflow:hidden!important;background:var(--warm-panel);border:1px solid var(--warm-edge);border-radius:16px;
}
body #app > #pageRoot > .chat-page > :is(.chat-pinned,#chatFilterSummary,#chatLog,.chat-composer-wrap){
 position:relative!important;inset:auto!important;float:none!important;box-sizing:border-box!important;
 width:100%!important;min-width:0!important;min-height:0!important;margin:0!important;transform:none!important;
}
body #app > #pageRoot > .chat-page > .chat-pinned{grid-row:1!important;z-index:2;background:var(--warm-panel);padding:0!important}
body #app > #pageRoot > .chat-page .chat-topbar{box-sizing:border-box;padding:0 2px 10px!important;margin:0!important}
body #app > #pageRoot > .chat-page .chat-source-switch{box-sizing:border-box;padding:0!important;margin:0!important;gap:8px}
body #app > #pageRoot > .chat-page .chat-source-switch button{min-width:0;padding:9px 12px!important}
body #app > #pageRoot > .chat-page > #chatFilterSummary{
 grid-row:2!important;height:auto!important;max-height:min(24dvh,160px)!important;
 padding:12px 16px!important;overflow:auto!important;border:1px solid var(--warm-edge);
 border-radius:12px;background:var(--warm-card);z-index:2;
}
body #app > #pageRoot > .chat-page .chat-filter-summary-head{margin:0 0 6px!important;gap:8px;flex-wrap:wrap}
body #app > #pageRoot > .chat-page .chat-filter-summary:not(.has-filters) .chat-filter-summary-head{margin-bottom:0!important}
body #app > #pageRoot > .chat-page .chat-filter-chips{gap:7px!important;margin:0!important;padding:0!important}
body #app > #pageRoot > .chat-page .chat-filter-chip{padding:5px 10px!important;max-width:100%;box-sizing:border-box}
body #app > #pageRoot > .chat-page > #chatLog{
 grid-row:3!important;display:flex!important;flex-direction:column!important;align-items:stretch;
 justify-content:flex-start!important;height:100%!important;max-height:100%!important;
 overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;
 padding:8px 10px 16px!important;gap:16px!important;scrollbar-width:thin;scroll-behavior:auto!important;
 contain:layout paint;isolation:isolate;
}
body #app > #pageRoot > .chat-page > #chatLog > .chat-message{
 flex:0 0 auto!important;min-width:0!important;position:relative!important;inset:auto!important;
}
body #app > #pageRoot > .chat-page > #chatLog > [hidden]{display:none!important}
body #app > #pageRoot > .chat-page .chat-bubble{padding:14px 18px!important;overflow-wrap:anywhere}
body #app > #pageRoot > .chat-page .chat-action-line{gap:8px!important;flex-wrap:wrap}
body #app > #pageRoot > .chat-page .chat-actions{gap:8px!important;margin-top:10px!important}
body #app > #pageRoot > .chat-page .chat-action{max-width:100%;white-space:normal;overflow-wrap:anywhere;padding:10px 15px!important}
body #app > #pageRoot > .chat-page > .chat-composer-wrap{
 grid-row:4!important;height:auto!important;max-height:none!important;padding:4px 0 0!important;
 background:var(--warm-panel)!important;z-index:2;
}
body #app > #pageRoot > .chat-page .chat-composer{box-sizing:border-box;width:100%;padding:7px!important;gap:8px!important}
body #app > #pageRoot > .chat-page #chatInput{min-width:0;padding:10px 14px!important}
body #app > #pageRoot > .chat-page #chatLog [data-chat-callback].is-stale{opacity:.55;cursor:default}
@media(max-width:899px){
 body #app:not([hidden]):has(> #pageRoot > .chat-page){padding-bottom:var(--mobile-bottom-nav-height,calc(70px + env(safe-area-inset-bottom,0px)))!important}
 body #app:has(> #pageRoot > .chat-page) > #pageRoot{padding:6px 8px!important}
 body #app > #pageRoot > .chat-page{padding:10px!important;gap:8px!important;border-radius:12px}
 body #app > #pageRoot > .chat-page > #chatFilterSummary{padding:9px 10px!important;max-height:min(22dvh,120px)!important}
 body #app > #pageRoot > .chat-page > #chatLog{padding:6px 3px 12px!important;gap:12px!important}
 body #app > #pageRoot > .chat-page .chat-bubble{padding:11px 13px!important}
 body #app > #pageRoot > .chat-page .chat-action{padding:8px 10px!important;min-height:40px}
 body #app > #pageRoot > .chat-page .chat-source-switch button{padding:8px 6px!important}
 body #app > #pageRoot > .chat-page .chat-composer{padding:5px!important}
 body.chat-keyboard-open #app:not([hidden]):has(> #pageRoot > .chat-page){
  inset:var(--chat-viewport-top,0px) 0 auto!important;height:var(--chat-visible-height,100dvh)!important;
  max-height:var(--chat-visible-height,100dvh)!important;padding-bottom:0!important;
 }
 body.chat-keyboard-open #app:has(> #pageRoot > .chat-page) > #appHeader{display:none!important}
 body.chat-keyboard-open #app > #pageRoot > .chat-page{gap:6px!important;padding:7px!important}
 body.chat-keyboard-open #app > #pageRoot > .chat-page > #chatFilterSummary{max-height:min(18dvh,70px)!important}
 body.chat-keyboard-open #app > #pageRoot > .chat-page .chat-topbar{padding-bottom:4px!important}
}
/* Comparison retains its header placement and existing dialog/count semantics. */
#scmpBar .scmp-label{display:none}
@media(min-width:1024px){
 html[data-shik-theme] body #appHeader .head-tools #scmpBar{width:auto!important}
 html[data-shik-theme] body #appHeader .head-tools #scmpBar>button{
  display:flex!important;width:auto!important;min-width:0;gap:7px;padding:0 10px!important;
  border:1px solid var(--warm-edge)!important;border-radius:7px;background:var(--warm-card)!important;
  color:var(--warm-text)!important;white-space:nowrap;font-size:13px;font-weight:650;
 }
 html[data-shik-theme] body #appHeader .head-tools #scmpBar .scmp-label{display:inline}
 html[data-shik-theme] body #appHeader .head-tools #scmpBar #scmpCount{
  position:static;min-width:21px;height:21px;padding:0 5px;font-size:11px;flex:none;
 }
}
html[data-shik-theme] body #appHeader .head-tools #scmpBar>button:focus-visible{
 outline:2px solid var(--warm-accent-border);outline-offset:2px;
}
