/* P08 composer focus R2: presentation only; preserve existing send/mode/draft contracts.
 * R35 mobile keyboard override: when keyboard open, constrain app height via CSS custom
 * property to keep composer above keyboard. Specificity needed to override min-height:520px. */
@media(max-width:780px){
 #app.app.r35-keyboard-open{position:fixed!important;inset:auto 0 auto 0!important;top:var(--r35-mobile-viewport-top,0px)!important;height:var(--r35-mobile-viewport-height,100dvh)!important;min-height:0!important;max-height:var(--r35-mobile-viewport-height,100dvh)!important;width:100%!important;overflow:hidden!important;z-index:55}
 #app.r35-keyboard-open .workspace{grid-template-rows:minmax(38px,46px) auto minmax(0,1fr);min-height:0}
 #app.r35-keyboard-open .notice-bar{max-height:32px;overflow:auto;padding:4px 12px;font-size:10px}
 #app.r35-keyboard-open #chat-panel,#app.r35-keyboard-open #chat-main,#app.r35-keyboard-open .chat-flow{min-height:0}
 #app.r35-keyboard-open #chat-panel>.composer-region{flex:none;padding:0 8px 4px}
 #app.r35-keyboard-open #chat-form{padding:5px 8px;gap:3px;max-height:calc(var(--r35-mobile-viewport-height,100dvh) - 85px)}
 #app.r35-keyboard-open #attachment-slot-r7{max-height:min(60px,15vh);overflow-y:auto;overscroll-behavior:contain}
 #app.r35-keyboard-open #composer-mode-panel{max-height:var(--composer-tools-max-height,40vh)}
 #app.r35-keyboard-open #chat-input{max-height:min(100px,calc(var(--r35-mobile-viewport-height,100dvh)*.23));min-height:32px}
 #app.r35-keyboard-open .sidebar{max-height:100%;height:100%}
}
#chat-form{
  position:relative;display:flex;flex-direction:column;gap:6px;
  padding:10px 12px;border:1px solid #41413e;border-radius:18px;
  background:#171918;box-shadow:none;min-width:0;
}
#chat-form:focus-within{border-color:#77715f!important}
#chat-input{
  flex:0 0 auto;box-sizing:border-box;min-height:32px;height:32px;
  max-height:min(200px,26dvh);padding:4px 2px;font-size:16px;line-height:24px;
  overflow-x:hidden;overflow-y:hidden;resize:none;
}
#chat-form>.composer-toolbar{margin:0;gap:10px;min-height:44px;align-items:center}
#chat-form>.composer-toolbar>#send-button{
  width:44px;height:44px;min-width:44px;min-height:44px;max-height:44px;
  padding:0;align-self:center;border-radius:14px;font-size:24px;line-height:1;
}
#composer-tools-toggle{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-height:44px;padding:6px 10px;background:transparent;border:0;border-radius:10px;
  color:#c4c4bd;font-size:13px;line-height:1.2;cursor:pointer;
}
#composer-tools-toggle>span:first-child{font-size:24px;line-height:1}
#composer-tools-toggle:hover,#composer-tools-toggle[aria-expanded="true"]{background:#282b27;color:#eee9dc}
#composer-tools-panel{
  position:absolute;bottom:calc(100% + 8px);left:0;width:min(360px,100%);
  max-height:var(--composer-tools-max-height,55dvh);overflow:auto;overscroll-behavior:contain;
  padding:14px;background:#1b1d1a;border:1px solid #4c4b43;border-radius:16px;
  box-shadow:0 12px 36px #0008;z-index:40;text-align:left;
}
#composer-tools-panel[hidden]{display:none!important}
.composer-tools-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.composer-tools-heading h2{margin:0;font-size:15px;font-weight:650;color:#eee9dd}
#composer-tools-close{width:40px;height:40px;flex:0 0 40px}
#composer-tools-panel>.composer-options{display:flex;flex-direction:column;align-items:stretch;gap:9px;min-width:0}
#composer-tools-panel .core-managed-routing-r3,#composer-tools-panel .core-customer-local-r3{
  display:block;max-width:100%;width:auto;min-height:0;padding:6px 2px;
  border:0;background:transparent;white-space:normal;font-size:12px;line-height:1.5;
}
#composer-tools-panel #attachment-info{
  width:auto;min-height:42px;height:auto;padding:9px 12px;border-radius:10px;
  text-align:left;justify-content:flex-start;font-size:13px;
}
#composer-tools-panel #mode-picker{width:100%;max-width:none;min-height:42px;justify-content:flex-start}
#composer-tools-panel #mode-picker>span:last-child{margin-left:auto}
#composer-tools-panel #composer-mode-panel{
  position:static;width:100%;max-height:none;margin-top:8px;padding:12px;
  border-color:#4c4b43;border-radius:12px;box-shadow:none;overflow:visible;
}
#composer-tools-panel .composer-helper,#composer-tools-panel .disclaimer{
  margin:12px 0 0;padding:0;color:#aaa99e;text-align:left;font-size:11px;line-height:1.65;
}
.composer-region>.r6-draft-state:empty{display:none}
#app .topbar-left{flex:1 1 0;min-width:0;gap:8px}
#app .breadcrumb{flex:1 1 auto;max-width:none;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#app .topbar-right{flex:0 0 auto;min-width:0}
@media(max-width:780px){
  #app .topbar{padding-inline:12px;gap:8px}
  #app .topbar-left{gap:6px}
  #app .connection-badge{max-width:142px;padding:6px 8px;font-size:10px;gap:5px;line-height:1.35}
  #app #connection-text{min-width:0;white-space:normal;overflow-wrap:anywhere}
  #chat-panel>.composer-region{padding:0 12px max(10px,env(safe-area-inset-bottom))}
  #chat-form{padding:10px 12px}
}
@media(max-width:350px){
  #app .topbar{padding-inline:10px;gap:6px}
  #app .connection-badge{max-width:118px;font-size:9px;padding:5px 7px}
  #chat-panel>.composer-region{padding-inline:10px}
}
@media(max-height:520px) and (max-width:780px){
  #chat-form{padding:8px 10px;gap:4px}
  #chat-input{max-height:23dvh}
  #chat-panel>.composer-region{padding-bottom:max(6px,env(safe-area-inset-bottom))}
}
