/* Ghost OS UI v4.3 refinement layer.
   Responsive behaviour follows the actual remaining workspace width, not just device orientation. */

/* Keep the production taskbar focused. Debug remains available inside Control Plane. */
#controlNav [data-control-tab="debug"]{display:none!important}
.memory-manager-btn #memoryManagerCount{display:none!important}

/* Workspace-width responsive buckets are set by ghost-ui-v4-refine.js. */
body[data-ghost-main-width="compact"] .ghost-search-launcher,
body[data-ghost-main-width="compact"] .model-pill,
body[data-ghost-main-width="compact"] .a5-runtime-pill{display:none!important}
body[data-ghost-main-width="compact"] .topbar{padding-left:12px!important;padding-right:12px!important;gap:8px!important}
body[data-ghost-main-width="compact"] .top-title{min-width:0!important;gap:7px!important}
body[data-ghost-main-width="compact"] .top-actions{gap:6px!important;min-width:0!important}
body[data-ghost-main-width="compact"] .memory-pill{font-size:.61rem!important;padding:4px 7px!important}
body[data-ghost-main-width="compact"] .account-pill{padding-left:10px!important;padding-right:10px!important;white-space:nowrap!important}
body[data-ghost-main-width="compact"] .deploy-note{padding:7px 10px!important;font-size:.64rem!important}
body[data-ghost-main-width="compact"] .messages{padding-left:12px!important;padding-right:12px!important}
body[data-ghost-main-width="compact"] .empty{padding-left:14px!important;padding-right:14px!important}
body[data-ghost-main-width="compact"] .empty-inner{width:100%!important;max-width:100%!important}
body[data-ghost-main-width="compact"] .empty h1{font-size:clamp(2.45rem,11vw,4.1rem)!important}
body[data-ghost-main-width="compact"] .empty p{max-width:100%!important;font-size:.86rem!important}
body[data-ghost-main-width="compact"] .suggestions{grid-template-columns:1fr!important;max-width:520px;margin-left:auto;margin-right:auto}
body[data-ghost-main-width="compact"] .suggestion{min-width:0!important}

body[data-ghost-main-width="medium"] .ghost-search-launcher{min-width:0!important;margin-left:10px!important;margin-right:10px!important}
body[data-ghost-main-width="medium"] .ghost-search-launcher kbd{display:none!important}
body[data-ghost-main-width="medium"] .topbar{padding-left:14px!important;padding-right:14px!important}

/* Low-height landscape should not hide half the welcome UI behind the composer. */
@media(max-height:720px){
  .empty{padding-top:14px!important;padding-bottom:14px!important}
  .empty .ghost-mark{width:40px!important;height:40px!important;margin-bottom:10px!important}
  .empty h1{font-size:clamp(2.25rem,6vw,4rem)!important;margin-bottom:8px!important}
  .empty p{font-size:.82rem!important;line-height:1.48!important}
  .suggestions{margin-top:15px!important;gap:8px!important}
  .suggestion{padding:10px 12px!important;border-radius:12px!important;font-size:.82rem!important}
  .composer-wrap{padding-top:8px!important}
  body:not(.ghost-taskbar-collapsed) .sidebar-footer{padding-top:8px!important;gap:3px!important;font-size:.66rem!important}
  body:not(.ghost-taskbar-collapsed) .sidebar-footer #memoryEngine{display:none!important}
}

/* Memory Viewer toolbar: one toolbar, not a commemorative row for every button. */
.memory-manager-tools{grid-template-columns:minmax(220px,1fr) minmax(110px,auto) auto auto auto auto!important}
.memory-manager-tools #memoryEvalBtn{width:auto!important;min-width:max-content!important}
body[data-ghost-main-width="medium"] .memory-manager-tools,
body[data-ghost-main-width="compact"] .memory-manager-tools{grid-template-columns:minmax(0,1fr) auto auto!important}
body[data-ghost-main-width="medium"] .memory-manager-tools #memorySearch,
body[data-ghost-main-width="compact"] .memory-manager-tools #memorySearch{grid-column:1/-1!important}
body[data-ghost-main-width="medium"] .memory-manager-tools #memoryStatus,
body[data-ghost-main-width="compact"] .memory-manager-tools #memoryStatus{grid-column:1/2!important;min-width:0!important}
body[data-ghost-main-width="medium"] .memory-manager-tools .memory-qa-toggle,
body[data-ghost-main-width="compact"] .memory-manager-tools .memory-qa-toggle{grid-column:2/3!important;justify-self:end!important;white-space:nowrap!important}
body[data-ghost-main-width="medium"] .memory-manager-tools #memoryRefresh,
body[data-ghost-main-width="compact"] .memory-manager-tools #memoryRefresh{grid-column:3/4!important}
body[data-ghost-main-width="medium"] .memory-manager-tools #memoryDuplicatesBtn,
body[data-ghost-main-width="compact"] .memory-manager-tools #memoryDuplicatesBtn{grid-column:1/2!important;width:100%!important;min-width:0!important}
body[data-ghost-main-width="medium"] .memory-manager-tools #memoryEvalBtn,
body[data-ghost-main-width="compact"] .memory-manager-tools #memoryEvalBtn{grid-column:2/4!important;width:100%!important;min-width:0!important}

/* Memory browser master/detail surface. */
.ghost-memory-browser{display:grid;grid-template-columns:minmax(0,1fr) minmax(290px,350px);gap:12px;min-height:0;padding:0 18px 18px}
.ghost-memory-browser #memoryList{padding:0!important;min-width:0!important}
.ghost-memory-inspector{position:sticky;top:0;align-self:start;max-height:calc(100dvh - 190px);overflow:auto;border:1px solid rgba(var(--accent-rgb),.14);border-radius:16px;background:radial-gradient(circle at 100% 0,rgba(var(--cortex-rgb),.10),transparent 34%),linear-gradient(155deg,rgba(9,27,43,.94),rgba(4,14,24,.97));box-shadow:inset 0 1px 0 rgba(255,255,255,.025),0 18px 45px rgba(0,0,0,.16);padding:14px}
.ghost-memory-inspector-empty,.ghost-memory-inspector-loading{min-height:210px;display:grid;align-content:center;gap:8px;color:#6f879d}
.ghost-memory-inspector-empty>span{font-size:.56rem;font-weight:800;letter-spacing:.14em;color:#67cfe8}.ghost-memory-inspector-empty>strong{font-size:1rem;color:#dcebf5}.ghost-memory-inspector-empty p{margin:0;line-height:1.55;font-size:.72rem}
.ghost-memory-inspector-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding-bottom:11px;border-bottom:1px solid rgba(var(--accent-rgb),.09)}
.ghost-memory-inspector-head>div{min-width:0;display:grid;gap:3px}.ghost-memory-inspector-head span{font-size:.54rem;font-weight:800;letter-spacing:.14em;color:#62d7f3}.ghost-memory-inspector-head strong{overflow:hidden;text-overflow:ellipsis;color:#e9f7ff;font:700 .82rem ui-monospace,SFMono-Regular,Menlo,monospace}
.ghost-memory-inspector-head button{width:30px;height:30px;border:1px solid rgba(var(--accent-rgb),.12);border-radius:9px;background:rgba(10,29,45,.7);color:#8ba3b8;cursor:pointer}
.ghost-memory-statement{padding:15px 0 12px;color:#eef8ff;font-size:.92rem;line-height:1.5}
.ghost-memory-inspector-badges{display:flex;gap:6px;flex-wrap:wrap;padding-bottom:12px}.ghost-memory-inspector-badges span{border:1px solid rgba(var(--accent-rgb),.13);border-radius:999px;padding:3px 7px;background:rgba(var(--accent-rgb),.045);color:#91b2c8;font-size:.59rem}
.ghost-memory-properties{display:grid;margin:0;border-top:1px solid rgba(var(--accent-rgb),.07)}.ghost-memory-properties>div{display:grid;grid-template-columns:84px minmax(0,1fr);gap:10px;padding:8px 0;border-bottom:1px solid rgba(var(--accent-rgb),.06)}.ghost-memory-properties dt{color:#607b93;font-size:.62rem}.ghost-memory-properties dd{margin:0;min-width:0;overflow-wrap:anywhere;color:#b7cad8;font-size:.65rem}
.ghost-memory-inspector-actions{display:flex;gap:7px;padding:12px 0}.ghost-memory-inspector-actions button{border:1px solid rgba(var(--accent-rgb),.14);border-radius:9px;background:rgba(11,32,49,.78);color:#bad2df;padding:7px 10px;cursor:pointer;font-size:.68rem}.ghost-memory-inspector-actions button:hover{border-color:rgba(var(--accent-rgb),.28);color:#fff}
.ghost-memory-inspector-history{border-top:1px solid rgba(var(--accent-rgb),.08);padding-top:11px}.ghost-memory-history-title{font-size:.61rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:#6e879c;margin-bottom:7px}.ghost-memory-event{display:grid;gap:3px;padding:8px 0;border-bottom:1px solid rgba(var(--accent-rgb),.055)}.ghost-memory-event strong{font-size:.65rem;color:#b9cedc;font-weight:600}.ghost-memory-event small{font-size:.57rem;color:#5f778d}.ghost-memory-event.empty{color:#6c8499;font-size:.65rem}
.memory-card{cursor:pointer!important;transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease!important}.memory-card.ghost-selected{border-color:rgba(var(--accent-rgb),.32)!important;box-shadow:inset 3px 0 0 #48dcff,0 0 30px rgba(var(--accent-rgb),.06)!important;transform:translateX(1px)}
body[data-ghost-main-width="compact"] .ghost-memory-browser{grid-template-columns:1fr;padding-left:12px;padding-right:12px}
body[data-ghost-main-width="compact"] .ghost-memory-inspector{order:-1;position:relative;max-height:none}
body[data-ghost-main-width="compact"] .ghost-memory-browser:not(.ghost-has-selection) .ghost-memory-inspector{display:none!important}
body[data-ghost-main-width="compact"] .ghost-memory-browser.ghost-has-selection .ghost-memory-inspector{display:block!important;scroll-margin-top:10px}
body[data-ghost-main-width="medium"] .ghost-memory-browser{grid-template-columns:minmax(0,1fr) minmax(250px,310px);gap:10px}

/* Control Plane model roles become role modules instead of a long spreadsheet impersonation. */
#ghostControlPlane .role-list{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(220px,1fr))!important;gap:8px!important;padding-top:8px!important}
#ghostControlPlane .role-row{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:8px!important;align-content:space-between!important;min-height:82px!important;padding:11px 12px!important;border:1px solid rgba(var(--accent-rgb),.09)!important;border-radius:12px!important;background:linear-gradient(145deg,rgba(8,25,39,.76),rgba(4,14,24,.84))!important}
#ghostControlPlane .role-row:first-child{border-top:1px solid rgba(var(--accent-rgb),.09)!important}
#ghostControlPlane .role-row>div{display:grid;gap:2px!important}#ghostControlPlane .role-row span{font:650 .63rem ui-monospace,SFMono-Regular,Menlo,monospace!important;color:#7da2bb!important}#ghostControlPlane .role-row small{font-size:.56rem!important;color:#4fc7a9!important;text-transform:uppercase!important;letter-spacing:.08em!important}#ghostControlPlane .role-row strong{text-align:left!important;font-size:.73rem!important;color:#e1edf5!important;white-space:normal!important}
#ghostControlPlane .control-tabs [data-tab="memory"]{position:relative}
#ghostControlPlane .control-tabs [data-tab="memory"].active{color:#d9ceff!important;border-color:rgba(var(--cortex-rgb),.25)!important;background:rgba(var(--cortex-rgb),.07)!important}
body[data-ghost-main-width="compact"] #ghostControlPlane .cp-form-grid-2{grid-template-columns:1fr!important}
body[data-ghost-main-width="compact"] #ghostControlPlane .role-list{grid-template-columns:1fr!important}

/* Nexus: ordinary operations first, rarely-used key rotation behind a disclosure. */
.ghost-secondary-security{border-color:rgba(var(--cortex-rgb),.10)!important;background:linear-gradient(150deg,rgba(11,21,38,.72),rgba(5,14,25,.82))!important}
.ghost-secondary-security.ghost-collapsed>:not(.maintenance-card-title){display:none!important}
.ghost-secondary-security.ghost-collapsed{padding-bottom:12px!important}
.ghost-security-toggle{margin-left:auto;border:1px solid rgba(var(--cortex-rgb),.15);border-radius:9px;background:rgba(var(--cortex-rgb),.055);color:#a99ae2;padding:7px 9px;cursor:pointer;font-size:.64rem;white-space:nowrap}.ghost-security-toggle:hover{border-color:rgba(var(--cortex-rgb),.3);color:#ddd4ff}
.ghost-nexus-overview{padding:12px 14px!important;border-color:rgba(var(--accent-rgb),.12)!important;background:radial-gradient(circle at 94% -25%,rgba(var(--accent-rgb),.08),transparent 35%),linear-gradient(150deg,rgba(7,24,38,.86),rgba(4,14,24,.92))!important}
.ghost-nexus-overview-head{display:flex;align-items:end;justify-content:space-between;gap:12px;margin-bottom:10px}.ghost-nexus-overview-head>div{display:grid;gap:2px}.ghost-nexus-overview-head span{color:#58d8f4;font-size:.54rem;font-weight:800;letter-spacing:.14em}.ghost-nexus-overview-head strong{color:#e5f3fa;font-size:.9rem}.ghost-nexus-overview-head small{color:#59738b;font-size:.58rem}
.ghost-nexus-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.ghost-nexus-metric{display:grid;gap:3px;padding:9px 10px;border:1px solid rgba(var(--accent-rgb),.075);border-radius:10px;background:rgba(3,13,22,.62)}.ghost-nexus-metric span{font-size:.57rem;color:#607d94}.ghost-nexus-metric strong{font-size:.92rem;color:#dcebf4}.ghost-nexus-metric.good strong{color:#65deb8}
body[data-ghost-main-width="compact"] .ghost-nexus-metrics{grid-template-columns:1fr 1fr}

/* Sentinel gets a real operational summary instead of making the health card do all the emotional labour. */
.ghost-sentinel-overview{padding:13px 14px!important;border-color:rgba(109,168,205,.13)!important;background:radial-gradient(circle at 92% -28%,rgba(76,151,194,.09),transparent 36%),linear-gradient(150deg,rgba(7,20,32,.92),rgba(3,12,21,.97))!important}
.ghost-sentinel-overview-head{display:flex;align-items:end;justify-content:space-between;gap:12px;margin-bottom:10px}.ghost-sentinel-overview-head>div{display:grid;gap:2px}.ghost-sentinel-overview-head span{color:#70a6c5;font-size:.54rem;font-weight:800;letter-spacing:.16em}.ghost-sentinel-overview-head strong{font-size:1rem;color:#e5f2f9;text-transform:uppercase;letter-spacing:.06em}.ghost-sentinel-overview-head small{max-width:55%;text-align:right;color:#587189;font-size:.58rem;line-height:1.4}
.ghost-sentinel-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.ghost-sentinel-metric{display:grid;gap:3px;padding:9px 10px;border:1px solid rgba(116,158,188,.09);border-radius:10px;background:rgba(2,11,19,.62)}.ghost-sentinel-metric span{font-size:.56rem;color:#5d778d}.ghost-sentinel-metric strong{font-size:.82rem;color:#c8d8e3}.ghost-sentinel-metric.good strong{color:#68dfb8}.ghost-sentinel-metric.warn strong{color:#efc679}.ghost-sentinel-metric.guarded strong{color:#8eb5cc}
body[data-ghost-main-width="compact"] .ghost-sentinel-overview-head{align-items:start;flex-direction:column}.ghost-sentinel-overview-head small{max-width:100%;text-align:left}
body[data-ghost-main-width="compact"] .ghost-sentinel-metrics{grid-template-columns:1fr 1fr}

/* Factory reset danger is staged: safe, review, then armed. Red is earned rather than sprayed everywhere. */
.ghost-danger-state{display:inline-flex;align-items:center;min-height:24px;padding:3px 8px;border-radius:999px;border:1px solid rgba(118,157,183,.16);background:rgba(50,83,104,.10);color:#89a7bb;font-size:.56rem;font-weight:850;letter-spacing:.1em;white-space:nowrap}
.ghost-danger-state.review{border-color:rgba(255,184,74,.28);background:rgba(255,184,74,.07);color:#e8c178}.ghost-danger-state.armed{border-color:rgba(255,68,95,.48);background:rgba(255,68,95,.12);color:#ff97a8;box-shadow:0 0 20px rgba(255,68,95,.08)}.ghost-danger-state.complete{border-color:rgba(53,230,162,.25);background:rgba(53,230,162,.07);color:#75ddb8}
#ghostMaintenance[data-ops-domain="sentinel"] .maintenance-danger-zone.ghost-review{border-color:rgba(255,184,74,.26)!important;background:linear-gradient(145deg,rgba(69,48,14,.20),rgba(29,21,10,.32))!important;box-shadow:none!important}
#ghostMaintenance[data-ops-domain="sentinel"] .maintenance-danger-zone.ghost-review .maintenance-danger{border-color:rgba(255,184,74,.20)!important;background:rgba(71,51,18,.26)!important;color:#a99167!important;box-shadow:none!important}
#ghostMaintenance[data-ops-domain="sentinel"] .maintenance-danger-zone.ghost-armed{border-color:rgba(var(--danger-rgb),.44)!important;background:radial-gradient(circle at 90% 0,rgba(var(--danger-rgb),.13),transparent 36%),linear-gradient(145deg,rgba(65,13,26,.42),rgba(27,8,15,.52))!important;box-shadow:0 0 32px rgba(var(--danger-rgb),.06)!important}
#ghostMaintenance[data-ops-domain="sentinel"] .maintenance-danger-zone.ghost-armed .maintenance-danger{background:linear-gradient(135deg,#ff536b,#ff344f)!important;border-color:rgba(255,96,117,.72)!important;color:#fff!important;box-shadow:0 8px 26px rgba(255,68,95,.16)!important}

/* MCP belongs to Ghost V4 rather than looking like a green plugin that wandered in from 2024. */
#ghostMcpAccountCard{border-color:rgba(var(--accent-rgb),.15)!important;background:radial-gradient(circle at 100% 0,rgba(var(--cortex-rgb),.08),transparent 34%),linear-gradient(150deg,rgba(7,25,39,.84),rgba(4,14,24,.91))!important}
#ghostMcpAccountCard .mcp-btn{border-color:rgba(var(--accent-rgb),.14)!important;background:rgba(10,30,46,.8)!important;color:#c9deea!important}
#ghostMcpAccountCard .mcp-btn.primary{background:linear-gradient(135deg,#3dd7f5,#4be1ff)!important;border-color:rgba(61,217,245,.55)!important;color:#031019!important;font-weight:750!important}
#ghostMcpAccountCard .mcp-btn.danger{background:rgba(255,68,95,.10)!important;border-color:rgba(255,68,95,.28)!important;color:#ff9bad!important}
#ghostMcpAccountCard .mcp-form input,#ghostMcpAccountCard .mcp-form select{background:#030d17!important;border-color:rgba(var(--accent-rgb),.13)!important}
#ghostMcpAccountCard #mcpAdminScope{accent-color:#39d9ff}
#ghostMcpAccountCard .mcp-endpoint{background:rgba(2,11,20,.72)!important;border:1px solid rgba(var(--accent-rgb),.06)!important;color:#a9c5d5!important}
#ghostMcpAccountCard .mcp-token-row{background:rgba(2,12,21,.44)!important;border-color:rgba(var(--accent-rgb),.08)!important}

/* The account panel can actually use the screen it is floating in. */
@media(min-width:900px){.account-card{width:min(650px,calc(100vw - 48px))!important}}

@media(max-width:520px){
  .ghost-memory-browser{padding-left:8px!important;padding-right:8px!important}
  .ghost-memory-properties>div{grid-template-columns:72px minmax(0,1fr)}
  .ghost-nexus-metrics,.ghost-sentinel-metrics{grid-template-columns:1fr 1fr}
}
