/* One chat surface moves between Home and the auxiliary drawer. */
#ghostChatSurface{display:contents}
#ghostChatSurface[hidden],#ghostActiveChatDrawer[hidden],#ghostActiveChatBackdrop[hidden],#ghostActiveChatBtn[hidden]{display:none!important}
.main.ghost-context-host #ghostChatSurface>.messages{grid-column:1;grid-row:3}
.main.ghost-context-host #ghostChatSurface>.composer-wrap{grid-column:1;grid-row:4}
.sidebar{z-index:1180!important}
.ghost-messages-center{left:var(--ghost-taskbar-width)!important}
:root{--ghost-active-chat-width:420px}
#ghostActiveChatDrawer{position:fixed;z-index:1300;right:0;top:0;bottom:0;width:min(var(--ghost-active-chat-width),calc(100vw - var(--ghost-taskbar-width)));display:grid;grid-template-rows:auto minmax(0,1fr);background:#080d14;border-left:1px solid rgba(var(--accent-rgb),.2);box-shadow:-18px 0 65px rgba(0,0,0,.45);overflow:hidden}
.ghost-active-chat-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid rgba(var(--accent-rgb),.12)}
.ghost-active-chat-head strong{font-size:.85rem}
.ghost-active-chat-head>div{display:flex;gap:6px}
.ghost-active-chat-head button{min-width:44px;min-height:44px;border:1px solid rgba(var(--accent-rgb),.2);border-radius:10px;background:#0c1721;color:var(--text);cursor:pointer;font-size:1.1rem}
#ghostActiveChatHost{min-height:0;min-width:0;overflow:hidden}
#ghostActiveChatHost>#ghostChatSurface{display:grid;height:100%;min-height:0;grid-template-rows:minmax(0,1fr) auto}
#ghostActiveChatDrawer .messages{padding:18px 14px;grid-column:auto;grid-row:auto;mask-image:none;min-height:0}
#ghostActiveChatDrawer .composer-wrap{padding:10px 12px max(12px,env(safe-area-inset-bottom));grid-column:auto;grid-row:auto}
#ghostActiveChatDrawer .empty{padding:20px 10px}
#ghostActiveChatDrawer .suggestions{grid-template-columns:1fr}
#ghostActiveChatDrawer .message{grid-template-columns:28px minmax(0,1fr);gap:8px}
#ghostActiveChatDrawer .message-body{min-width:0;overflow-wrap:anywhere}
#ghostActiveChatDrawer .avatar{width:28px;height:28px}
#ghostActiveChatBackdrop{position:fixed;z-index:1250;inset:0 0 0 var(--ghost-taskbar-width);border:0;background:rgba(1,5,10,.45)}
.ghost-active-chat-nav{font-size:.78rem!important;min-height:44px}
body.ghost-taskbar-collapsed .ghost-active-chat-nav{font-size:0!important}
body.ghost-taskbar-collapsed .ghost-active-chat-nav::before{content:"↗";font-size:1.1rem;color:var(--accent)}
body.ghost-active-chat-open .ghost-active-chat-nav{border-color:rgba(var(--accent-rgb),.4)!important}
@media(min-width:1101px){
  body.ghost-active-chat-open #ghostMemoryAtlas,
  body.ghost-active-chat-open #ghostControlPlane,
  body.ghost-active-chat-open #ghostMemoryLabV2,
  body.ghost-active-chat-open .memory-manager-shell,
  body.ghost-active-chat-open #ghostMaintenance,
  body.ghost-active-chat-open #ghostWork,
  body.ghost-active-chat-open #ghostMessagesCenter{right:var(--ghost-active-chat-width)!important;width:auto!important}
}
@media(max-height:500px){#ghostActiveChatDrawer .ghost-active-chat-head{padding:3px 10px}#ghostActiveChatDrawer .composer-wrap{padding:6px 10px}#ghostActiveChatDrawer .composer textarea{max-height:90px}}
@media(prefers-reduced-motion:reduce){#ghostActiveChatDrawer .messages{scroll-behavior:auto}}
/* Conversation selection and account default share the existing composer. */
.ghost-chat-model-controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px;min-width:0;font-size:.75rem}
.ghost-chat-model-controls label{display:flex;align-items:center;gap:8px;flex:1 1 250px;min-width:0;color:var(--muted)}
.ghost-chat-model-controls select,.ghost-chat-model-controls input,.ghost-chat-model-controls button{min-height:38px;min-width:0;border:1px solid rgba(var(--accent-rgb),.18);border-radius:8px;background:#0c1721;color:var(--text);padding:7px 9px;font:inherit}
.ghost-chat-model-controls select{flex:1;width:0;text-overflow:ellipsis}
.ghost-chat-model-controls input{width:130px;flex:0 1 130px}
.ghost-chat-model-controls button{cursor:pointer}
.ghost-chat-model-controls :disabled{opacity:.5;cursor:default}
.ghost-chat-model-note{flex-basis:100%;margin:0;color:var(--muted);font-size:.7rem;line-height:1.45;overflow-wrap:anywhere}
@media(max-width:760px){.ghost-chat-model-controls{gap:6px}.ghost-chat-model-controls label{flex-basis:100%}.ghost-chat-model-controls button{min-height:44px}.ghost-chat-model-controls input{flex:1}}
@media(max-height:500px){.ghost-chat-model-controls{gap:4px;margin-bottom:5px}.ghost-chat-model-controls input{display:none}.ghost-chat-model-note{max-height:2.9em;overflow:auto}}
/* Keep Home reachable when the primary navigation scrolls in short landscapes. */
.sidebar .control-nav #ghostHomeBtn{position:sticky!important;top:0;z-index:3;flex-shrink:0;background:#08121e!important}
.sidebar .control-nav>.control-nav-btn{flex-shrink:0}

/* Primary pages leave the persistent taskbar available at every viewport. */
#ghostMemoryLabV2,.memory-manager-shell{left:var(--ghost-taskbar-width,72px)!important;right:0!important;width:auto!important;pointer-events:none!important}
#ghostMemoryLabV2 .memlab-backdrop,.memory-manager-shell .memory-manager-backdrop{display:none!important}
#ghostMemoryLabV2 .memlab-panel,.memory-manager-shell .memory-manager-panel{position:fixed!important;left:var(--ghost-taskbar-width,72px)!important;right:0!important;top:0!important;bottom:0!important;width:auto!important;max-width:none!important;height:auto!important;pointer-events:auto!important;border-radius:0!important}
.memlab-head,.memory-manager-head{gap:12px!important;padding:16px 20px!important;border-bottom:1px solid rgba(var(--accent-rgb),.14)!important;background:rgba(7,15,25,.96)!important}
.memlab-head-actions{flex-wrap:wrap;justify-content:flex-end}
.memlab-title,.memory-manager-head>div{min-width:0}
.memlab-title strong,.memory-manager-head h2{font-size:1.05rem!important;letter-spacing:.01em!important}
.memlab-title small,.memory-manager-head small{line-height:1.5;color:var(--muted)!important}
@media(min-width:1101px){body.ghost-active-chat-open #ghostMemoryLabV2 .memlab-panel,body.ghost-active-chat-open .memory-manager-shell .memory-manager-panel{right:var(--ghost-active-chat-width)!important}}
@media(max-width:760px){.memlab-head,.memory-manager-head{padding:12px!important;align-items:flex-start!important}.memlab-head{flex-wrap:wrap}.memlab-head-actions{width:100%;justify-content:flex-start}.memlab-head button,.memory-manager-head button{min-width:44px;min-height:44px}}
.chat-startup-status:not([hidden]){display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;padding:8px 4px;color:var(--text);font-size:.8rem}
.chat-startup-status button{min-height:44px;padding:8px 14px;border:1px solid var(--border,rgba(139,162,188,.3));border-radius:10px;background:var(--panel,#121b26);color:inherit;cursor:pointer}
