/* Ghost UI v4.10 context rail: visible working state without turning the chat into an admin dashboard. */
:root{
  --ghost-context-open:336px;
  --ghost-context-peek:48px;
  --ghost-context-column:0px;
}
body[data-ghost-context-state="peek"]{--ghost-context-column:var(--ghost-context-peek)}
body[data-ghost-context-state="open"]{--ghost-context-column:var(--ghost-context-open)}

.main.ghost-context-host{
  grid-template-columns:minmax(0,1fr) var(--ghost-context-column)!important;
  transition:grid-template-columns .2s cubic-bezier(.2,.8,.2,1);
}
.main.ghost-context-host>.topbar{grid-column:1;grid-row:1}
.main.ghost-context-host>.deploy-note{grid-column:1;grid-row:2}
.main.ghost-context-host>.messages{grid-column:1;grid-row:3}
.main.ghost-context-host>.composer-wrap{grid-column:1;grid-row:4}

.ghost-context-toggle{
  flex:0 0 auto;width:36px;height:36px;display:grid;place-items:center;padding:0;
  border:1px solid rgba(var(--accent-rgb),.11);border-radius:11px;
  background:linear-gradient(145deg,rgba(8,25,40,.76),rgba(5,14,25,.82));color:#6c889e;
  cursor:pointer;transition:.16s ease;box-shadow:inset 0 1px 0 rgba(255,255,255,.02)
}
.ghost-context-toggle svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round}
.ghost-context-toggle:hover,.ghost-context-toggle.active{color:#78e4ff;border-color:rgba(var(--accent-rgb),.27);background:linear-gradient(145deg,rgba(9,34,51,.9),rgba(6,18,31,.94));box-shadow:0 0 22px rgba(var(--accent-rgb),.055)}
.ghost-context-toggle.active{color:#b9f5ff;border-color:rgba(var(--accent-rgb),.34)}

.ghost-context-backdrop{display:none}
.ghost-context-rail{
  position:relative;z-index:16;grid-column:2;grid-row:1/5;min-width:0;min-height:0;overflow:hidden;
  border-left:1px solid rgba(var(--accent-rgb),.10);
  background:radial-gradient(circle at 20% -4%,rgba(var(--cortex-rgb),.10),transparent 28%),linear-gradient(180deg,rgba(6,18,30,.965),rgba(3,10,18,.985));
  box-shadow:-18px 0 52px rgba(0,0,0,.18),inset 1px 0 0 rgba(255,255,255,.012);
  transition:opacity .16s ease,transform .2s cubic-bezier(.2,.8,.2,1)
}
body[data-ghost-context-state="hidden"] .ghost-context-rail{display:none}

.ghost-context-peek{height:100%;display:flex;flex-direction:column;align-items:center;padding:13px 5px 12px;gap:13px;background:linear-gradient(180deg,rgba(8,23,36,.86),rgba(3,11,20,.96))}
.ghost-context-peek-main{width:36px;height:36px;display:grid;place-items:center;padding:0;border:1px solid rgba(var(--accent-rgb),.13);border-radius:11px;background:rgba(8,28,43,.72);color:#72dff7;cursor:pointer}
.ghost-context-peek-main:hover{border-color:rgba(var(--accent-rgb),.32);color:#eafaff;background:rgba(11,37,56,.88)}
.ghost-context-peek-main svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round}
.ghost-context-peek-status{display:flex;flex:1;min-height:0;flex-direction:column;align-items:center;gap:10px;padding-top:2px}
.ghost-context-peek-dot{width:7px;height:7px;border-radius:50%;background:#536579;box-shadow:0 0 0 3px rgba(83,101,121,.08)}
.ghost-context-peek-dot.good{background:#35e6a2;box-shadow:0 0 12px rgba(53,230,162,.35)}
.ghost-context-peek-dot.live{background:#9c6cff;box-shadow:0 0 14px rgba(156,108,255,.42);animation:ghost-context-pulse 1.25s ease-in-out infinite}
.ghost-context-peek-dot.warn{background:#ffb84a}.ghost-context-peek-dot.bad{background:#ff445f;box-shadow:0 0 12px rgba(255,68,95,.3)}
.ghost-context-peek-mark,.ghost-context-peek-count{width:25px;height:25px;display:grid;place-items:center;border:1px solid rgba(var(--accent-rgb),.11);border-radius:9px;background:rgba(5,21,34,.72);font:800 .58rem/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:#7797ac}
.ghost-context-peek-mark{color:#9a8cff;border-color:rgba(var(--cortex-rgb),.18)}
.ghost-context-peek-count{color:#6adff6}

.ghost-context-panel{height:100%;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr)}
body[data-ghost-context-state="peek"] .ghost-context-panel{display:none}
body[data-ghost-context-state="open"] .ghost-context-peek{display:none}

.ghost-context-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:14px 13px 12px;border-bottom:1px solid rgba(var(--accent-rgb),.085);background:linear-gradient(180deg,rgba(8,25,40,.66),rgba(5,17,29,.38))}
.ghost-context-head>div:first-child{min-width:0;display:grid;gap:2px}
.ghost-context-head span{font-size:.52rem;font-weight:850;letter-spacing:.16em;color:#5edcf7}
.ghost-context-head strong{font-size:.9rem;color:#eaf7ff}
.ghost-context-head small{font-size:.56rem;color:#597388;line-height:1.35}
.ghost-context-head-actions{display:flex;gap:5px;flex:0 0 auto}
.ghost-context-head-actions button{width:29px;height:29px;display:grid;place-items:center;border:1px solid rgba(var(--accent-rgb),.10);border-radius:9px;background:rgba(8,27,42,.72);color:#7f99ad;cursor:pointer;font-size:.85rem}
.ghost-context-head-actions button:hover{border-color:rgba(var(--accent-rgb),.28);color:#effbff;background:rgba(12,38,57,.9)}

.ghost-context-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:10px 10px 16px;scrollbar-gutter:stable}
.ghost-context-section{margin-bottom:9px;padding:10px;border:1px solid rgba(var(--accent-rgb),.075);border-radius:13px;background:linear-gradient(150deg,rgba(8,25,40,.67),rgba(3,13,22,.76));box-shadow:inset 0 1px 0 rgba(255,255,255,.016)}
.ghost-context-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.ghost-context-section-head>span{font-size:.51rem;font-weight:850;letter-spacing:.13em;color:#607f95}
.ghost-context-section-head>small{font:700 .53rem/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:#60788c}
.ghost-context-section-head>button{border:0;background:transparent;color:#68d9f2;cursor:pointer;padding:2px 0;font-size:.56rem}
.ghost-context-section-head>button:disabled{opacity:.35;cursor:default}

.ghost-context-conversation{display:block;margin-bottom:7px;color:#e6f3fb;font-size:.76rem;line-height:1.38;overflow-wrap:anywhere}
.ghost-context-chips{display:flex;flex-wrap:wrap;gap:5px}
.ghost-context-chip{display:inline-flex;align-items:center;min-height:20px;padding:3px 6px;border:1px solid rgba(var(--accent-rgb),.09);border-radius:999px;background:rgba(3,13,22,.58);color:#6f8799;font:700 .49rem/1 ui-monospace,SFMono-Regular,Menlo,monospace;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ghost-context-chip.project{border-color:rgba(var(--cortex-rgb),.20);background:rgba(var(--cortex-rgb),.07);color:#ad9cff}
.ghost-context-chip.person{border-color:rgba(var(--accent-rgb),.20);background:rgba(var(--accent-rgb),.06);color:#78dbef}
.ghost-context-chip.live{border-color:rgba(var(--cortex-rgb),.24);color:#c0afff;background:rgba(var(--cortex-rgb),.08)}
.ghost-context-chip.good{border-color:rgba(53,230,162,.22);color:#75dfba;background:rgba(53,230,162,.065)}
.ghost-context-chip.warn{border-color:rgba(255,184,74,.24);color:#ecc47c;background:rgba(255,184,74,.06)}
.ghost-context-request{margin-top:9px;padding:8px 9px;border-left:2px solid rgba(var(--accent-rgb),.32);border-radius:0 9px 9px 0;background:rgba(4,16,27,.55)}
.ghost-context-request>span{font-size:.47rem;font-weight:850;letter-spacing:.12em;color:#56768c}
.ghost-context-request p{margin:4px 0 0;color:#b5c8d5;font-size:.61rem;line-height:1.5;overflow-wrap:anywhere}

.ghost-context-pin-list,.ghost-context-memory-list{display:grid;gap:6px}
.ghost-context-pin{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:start;padding:8px 8px 8px 9px;border:1px solid rgba(var(--cortex-rgb),.10);border-radius:10px;background:linear-gradient(145deg,rgba(var(--cortex-rgb),.055),rgba(4,14,25,.58))}
.ghost-context-pin>div{min-width:0}.ghost-context-pin span{display:block;margin-bottom:3px;color:#7d72ad;font-size:.48rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.ghost-context-pin p{margin:0;color:#c1d2df;font-size:.59rem;line-height:1.45;overflow-wrap:anywhere}
.ghost-context-pin>button{width:23px;height:23px;border:0;border-radius:7px;background:transparent;color:#657c91;cursor:pointer}.ghost-context-pin>button:hover{background:rgba(255,68,95,.08);color:#ff93a6}
.ghost-context-pin-form{display:grid;grid-template-columns:minmax(0,1fr) 31px;gap:6px;margin-top:7px}
.ghost-context-pin-form input{min-width:0;height:32px;border:1px solid rgba(var(--accent-rgb),.09);border-radius:9px;background:rgba(2,11,19,.68);color:#d8e9f2;padding:0 8px;font-size:.58rem;outline:none}
.ghost-context-pin-form input::placeholder{color:#50677b}.ghost-context-pin-form input:focus{border-color:rgba(var(--accent-rgb),.3);box-shadow:0 0 0 2px rgba(var(--accent-rgb),.045)}
.ghost-context-pin-form button{height:32px;border:1px solid rgba(var(--accent-rgb),.15);border-radius:9px;background:rgba(var(--accent-rgb),.07);color:#72dff6;cursor:pointer;font-size:.85rem}
.ghost-context-hint{margin-top:7px;color:#4e677b;font-size:.50rem;line-height:1.45}

.ghost-context-memory{padding:8px 9px;border:1px solid rgba(var(--accent-rgb),.065);border-radius:10px;background:rgba(3,13,22,.55)}
.ghost-context-memory.sensitive{border-color:rgba(255,184,74,.14);background:rgba(49,35,13,.10)}
.ghost-context-memory-top{display:flex;align-items:center;justify-content:space-between;gap:7px}.ghost-context-memory-top code{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#8eb6ca;font:700 .52rem/1.2 ui-monospace,SFMono-Regular,Menlo,monospace}
.ghost-context-memory p{margin:6px 0;color:#a9bdcb;font-size:.58rem;line-height:1.46;overflow-wrap:anywhere}
.ghost-context-memory-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-top:5px;border-top:1px solid rgba(var(--accent-rgb),.045);color:#4f687c;font-size:.47rem}.ghost-context-memory-meta span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ghost-context-memory-meta span:last-child{text-align:right}
.ghost-context-memory-actions{display:flex;justify-content:flex-end;gap:7px;margin-top:6px}.ghost-context-memory-actions button{border:0;background:transparent;color:#68cfe6;padding:2px 0;cursor:pointer;font-size:.51rem}.ghost-context-memory-actions button:disabled{color:#5a6f80;cursor:default}

.ghost-context-activity-row{display:grid;grid-template-columns:10px minmax(0,1fr);gap:8px;align-items:start}.ghost-context-activity-dot{width:7px;height:7px;margin-top:4px;border-radius:50%;background:#506274}.ghost-context-activity-dot.good{background:#35e6a2;box-shadow:0 0 12px rgba(53,230,162,.3)}.ghost-context-activity-dot.live{background:#9c6cff;box-shadow:0 0 13px rgba(156,108,255,.36);animation:ghost-context-pulse 1.2s ease-in-out infinite}.ghost-context-activity-dot.bad{background:#ff445f;box-shadow:0 0 11px rgba(255,68,95,.3)}.ghost-context-activity-dot.warn{background:#ffb84a}
.ghost-context-activity-row strong{display:block;color:#cfdee8;font-size:.65rem}.ghost-context-activity-row small{display:block;margin-top:3px;color:#60788c;font-size:.52rem;line-height:1.4}
.ghost-context-activity .ghost-context-chips{margin-top:8px}
.ghost-context-wide-action{width:100%;margin-top:8px;padding:7px 8px;border:1px solid rgba(var(--cortex-rgb),.17);border-radius:9px;background:rgba(var(--cortex-rgb),.055);color:#b7a8f4;cursor:pointer;font-size:.55rem}.ghost-context-wide-action:hover{border-color:rgba(var(--cortex-rgb),.3);color:#ded6ff;background:rgba(var(--cortex-rgb),.085)}

.ghost-context-provider-list{display:grid;gap:5px}.ghost-context-provider-list>div{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:4px 8px;padding:6px 0;border-top:1px solid rgba(var(--accent-rgb),.045)}.ghost-context-provider-list>div:first-child{border-top:0}.ghost-context-provider-list span{color:#60798d;font-size:.51rem}.ghost-context-provider-list strong{color:#c1d4df;font-size:.56rem;text-align:right;overflow-wrap:anywhere}.ghost-context-provider-list small{grid-column:1/-1;color:#4f687c;font-size:.49rem;line-height:1.4}
.ghost-context-empty{padding:8px 0;color:#546e82;font-size:.55rem;line-height:1.5}
.ghost-context-loading{min-height:210px;display:grid;place-items:center;align-content:center;text-align:center;gap:6px;color:#60788d;padding:24px}.ghost-context-loading>span{width:17px;height:17px;border:2px solid rgba(var(--accent-rgb),.12);border-top-color:#55daf5;border-radius:50%;animation:ghost-context-spin .9s linear infinite}.ghost-context-loading strong{color:#b7cbd7;font-size:.68rem}.ghost-context-loading small{font-size:.52rem;line-height:1.45}
.ghost-context-foot{display:grid;gap:2px;padding:7px 3px 1px;color:#4f687a;text-align:center}.ghost-context-foot span{font-size:.52rem}.ghost-context-foot small{font-size:.47rem;color:#415a6e}

@keyframes ghost-context-spin{to{transform:rotate(360deg)}}
@keyframes ghost-context-pulse{0%,100%{opacity:.7;transform:scale(.92)}50%{opacity:1;transform:scale(1.12)}}

/* Existing available-width observer already tells us when the chat workspace is no longer wide enough for a persistent rail. */
body[data-ghost-main-width="medium"] .main.ghost-context-host,
body[data-ghost-main-width="compact"] .main.ghost-context-host{grid-template-columns:minmax(0,1fr)!important}
body[data-ghost-main-width="medium"] .main.ghost-context-host>.topbar,
body[data-ghost-main-width="medium"] .main.ghost-context-host>.deploy-note,
body[data-ghost-main-width="medium"] .main.ghost-context-host>.messages,
body[data-ghost-main-width="medium"] .main.ghost-context-host>.composer-wrap,
body[data-ghost-main-width="compact"] .main.ghost-context-host>.topbar,
body[data-ghost-main-width="compact"] .main.ghost-context-host>.deploy-note,
body[data-ghost-main-width="compact"] .main.ghost-context-host>.messages,
body[data-ghost-main-width="compact"] .main.ghost-context-host>.composer-wrap{grid-column:1}
body[data-ghost-main-width="medium"][data-ghost-context-state="peek"] .ghost-context-rail,
body[data-ghost-main-width="compact"][data-ghost-context-state="peek"] .ghost-context-rail{display:none}
body[data-ghost-main-width="medium"][data-ghost-context-state="open"] .ghost-context-backdrop,
body[data-ghost-main-width="compact"][data-ghost-context-state="open"] .ghost-context-backdrop{display:block;position:absolute;z-index:54;inset:0;border:0;background:rgba(1,5,10,.46);backdrop-filter:blur(7px)}
body[data-ghost-main-width="medium"][data-ghost-context-state="open"] .ghost-context-rail,
body[data-ghost-main-width="compact"][data-ghost-context-state="open"] .ghost-context-rail{display:block;position:absolute;z-index:55;right:0;top:0;bottom:0;width:min(var(--ghost-context-open),calc(100% - 18px));grid-column:auto;grid-row:auto;box-shadow:-28px 0 90px rgba(0,0,0,.5)}

@media(max-width:700px){
  .ghost-context-toggle{width:34px;height:34px;border-radius:10px}
  .ghost-context-head{padding:12px 11px 10px}
  .ghost-context-body{padding:8px 8px 14px}
  body[data-ghost-context-state="open"] .ghost-context-rail{width:min(340px,calc(100% - 10px))}
}
@media(max-width:430px){
  body[data-ghost-context-state="open"] .ghost-context-rail{width:calc(100% - 6px)}
  .ghost-context-memory-meta{align-items:flex-start;flex-direction:column;gap:3px}.ghost-context-memory-meta span:last-child{text-align:left}
}
@media(prefers-reduced-motion:reduce){.ghost-context-peek-dot.live,.ghost-context-activity-dot.live,.ghost-context-loading>span{animation:none}}
