/* Chat assistant overlay. Uses the explorer's tokens (styles.css): navy title bar, Georgia title,
   bracketed cyan label, white body under a 2px navy rule, square corners, hairlines, 12px text,
   no shadows except one subtle drop shadow on the floating window. */

/* launcher */
#as-launcher{position:fixed;right:20px;bottom:20px;z-index:150;width:44px;height:44px;border-radius:50%;
  background:var(--navy);color:var(--cyan);display:flex;align-items:center;justify-content:center;border:1px solid var(--navy3)}
#as-launcher:hover{background:var(--navy2)}
#as-launcher:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}
#as-launcher[hidden],#as-launcher.is-hidden{display:none}
.as-dot{position:absolute;top:4px;right:4px;width:9px;height:9px;border-radius:50%;background:var(--orange);border:1.5px solid var(--surface)}
.as-dot[hidden]{display:none}

/* window */
#as-window{position:fixed;z-index:151;display:flex;flex-direction:column;background:var(--surface);color:var(--ink);
  border:1px solid var(--hair);border-top:2px solid var(--navy);border-radius:0;box-shadow:0 6px 22px rgba(5,28,44,.22);
  font:12px/1.4 var(--sans);min-width:0}
#as-window[hidden]{display:none}
#as-window.is-dragging{user-select:none}
#as-window.is-dragging iframe{pointer-events:none}
#as-window.is-collapsed .as-body,#as-window.is-collapsed .as-grip{display:none}
#as-window header{flex:none;height:32px;background:var(--navy);color:#fff;display:flex;align-items:center;gap:6px;padding:0 4px 0 10px;cursor:move;user-select:none}
.as-title{font:700 13px var(--serif);letter-spacing:.01em}
.as-tag{color:var(--cyan);font-size:10px;font-weight:700;letter-spacing:.06em}
.as-conv{font-size:11px;color:#B7C4CE;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-left:4px}
.as-spacer{flex:1}
#as-window header button{width:24px;height:24px;color:#B7C4CE;font-size:15px;line-height:1;border-radius:0}
#as-window header button:hover:not(:disabled){background:var(--navy2);color:#fff}
#as-window header button:disabled{opacity:.35;cursor:default}
#as-window.is-offline header::after{content:"offline";font-size:10px;color:var(--orange);margin-left:4px}

.as-body{flex:1;min-height:0;display:flex;flex-direction:column;position:relative}
#as-banner{flex:none;background:#FFF4EC;border-bottom:1px solid var(--orange);color:#8A3A06;padding:4px 10px;font-size:11px}
#as-banner[hidden]{display:none}
#as-transcript{flex:1;min-height:0;overflow-y:auto;padding:8px 10px;display:flex;flex-direction:column;gap:8px;background:var(--surface)}

/* drawer: conversations */
#as-drawer{position:absolute;z-index:3;left:0;top:0;bottom:0;width:230px;max-width:90%;background:var(--surface);border-right:1px solid var(--hair);display:flex;flex-direction:column}
#as-drawer[hidden]{display:none}
.as-drawer-head{flex:none;padding:6px 10px 4px;font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink2);border-bottom:1px solid var(--hair)}
#as-list{list-style:none;overflow-y:auto;flex:1}
.as-list-item{display:flex;align-items:stretch;border-bottom:1px solid #E4E8EB}
.as-list-item.is-current{background:var(--tint);box-shadow:inset 2px 0 0 var(--cyan)}
.as-list-open{flex:1;min-width:0;text-align:left;padding:5px 4px 5px 10px;display:flex;flex-direction:column;gap:1px}
.as-list-open:hover:not(:disabled){background:var(--tint)}
.as-list-open:disabled{opacity:.5;cursor:default}
.as-list-title{font-weight:700;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.as-list-when{font-size:10px;color:var(--ink2)}
.as-list-action{width:22px;color:var(--ink2);font-size:13px;visibility:hidden}
.as-list-item:hover .as-list-action,.as-list-item:focus-within .as-list-action{visibility:visible}
.as-list-action:hover:not(:disabled){color:var(--blue)}
.as-list-action:disabled{opacity:.3}
.as-list-empty{padding:10px;color:var(--ink2)}

/* transcript */
.as-msg.as-user{display:flex;flex-direction:column;align-items:flex-end;gap:2px}
.as-bubble{background:var(--navy);color:#fff;padding:5px 8px;max-width:88%;white-space:pre-wrap;overflow-wrap:anywhere}
.as-meta{font-size:10px;color:var(--ink2);max-width:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.as-turn{display:flex;flex-direction:column;gap:6px;min-width:0}
.as-status{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink2)}
.as-status::before{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--cyan);margin-right:6px;animation:as-pulse 1s ease-in-out infinite}
@keyframes as-pulse{50%{opacity:.25}}
.as-notice{font-size:11px;color:var(--ink2);overflow-wrap:anywhere}
.as-notice-error{border-left:3px solid var(--orange);background:#FFF4EC;color:#8A3A06;padding:4px 8px}
.as-notice-error p{margin:0}
.as-notice-muted{padding:2px 0}

.as-text{overflow-wrap:anywhere;min-width:0}
.as-text>*:first-child{margin-top:0}.as-text>*:last-child{margin-bottom:0}
.as-text p,.as-text ul,.as-text ol,.as-text blockquote,.as-text pre,.as-text table,.as-text .mermaid{margin:0 0 6px}
.as-text ul,.as-text ol{padding-left:18px}
.as-text h1,.as-text h2,.as-text h3,.as-text h4{font-family:var(--serif);font-size:13px;line-height:1.25;margin:8px 0 3px}
.as-text h1{font-size:14px}
.as-text a{color:var(--blue)}
.as-text blockquote{border-left:2px solid var(--hair);padding-left:8px;color:var(--ink2)}
.as-text hr{border:0;border-top:1px solid var(--hair);margin:6px 0}
.as-text code{font:11px/1.35 Menlo,Consolas,monospace;background:var(--tint);padding:0 3px}
.as-text pre{background:var(--tint);border:1px solid var(--hair);padding:5px 7px;overflow-x:auto}
.as-text pre code{background:none;padding:0}
.as-text table{border-collapse:collapse;display:block;overflow-x:auto;max-width:100%;font-variant-numeric:tabular-nums}
.as-text th,.as-text td{border:1px solid var(--hair);padding:2px 6px;text-align:left;white-space:nowrap}
.as-text th{background:var(--tint);font-size:11px;font-weight:700}
.as-text td:has(+ td),.as-text td{vertical-align:top}
.as-text img{max-width:100%;cursor:zoom-in;border:1px solid var(--hair)}
.as-text .katex-display{overflow-x:auto;overflow-y:hidden;margin:4px 0}
.as-text .mermaid{overflow-x:auto;text-align:center}
.mermaid-pending{color:var(--ink2);font-size:11px}
/* highlight.js tokens, in the explorer's palette */
.hljs{color:var(--ink)}
.hljs-comment,.hljs-quote{color:#6B7780;font-style:italic}
.hljs-keyword,.hljs-selector-tag,.hljs-built_in{color:var(--blue)}
.hljs-string,.hljs-attr,.hljs-template-variable{color:#0B7A55}
.hljs-number,.hljs-literal,.hljs-symbol{color:var(--orange)}
.hljs-title,.hljs-function .hljs-title,.hljs-name{color:var(--navy3);font-weight:700}

/* tool calls */
.as-tool-wrap{display:flex;flex-direction:column;gap:4px;min-width:0}
.as-tool{border:1px solid var(--hair);background:var(--surface)}
.as-tool>summary{list-style:none;cursor:pointer;display:flex;gap:6px;align-items:baseline;padding:2px 6px;font-size:11px;min-width:0}
.as-tool>summary::-webkit-details-marker{display:none}
.as-tool>summary::before{content:"▸";color:var(--ink2);font-size:9px}
.as-tool[open]>summary::before{content:"▾"}
.as-tool>summary:hover{background:var(--tint)}
.as-tool-name{font-weight:700;color:var(--navy3);white-space:nowrap}
.as-tool-args{flex:1;min-width:0;color:var(--ink2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.as-tool-status{font-size:10px;color:var(--ink2);white-space:nowrap}
.as-tool.is-error{border-color:var(--orange)}
.as-tool.is-error .as-tool-status{color:var(--orange)}
.as-tool-body{border-top:1px solid var(--hair);padding:4px 6px;display:flex;flex-direction:column;gap:3px}
.as-io-label{font-size:9px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink2)}
.as-tool-body pre{font:10.5px/1.35 Menlo,Consolas,monospace;background:var(--tint);padding:4px 6px;max-height:200px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}
.as-tool-images{display:flex;flex-wrap:wrap;gap:4px}
.as-tool-images img{max-width:100%;max-height:220px;cursor:zoom-in;border:1px solid var(--hair)}

/* sources + context chip */
.as-sources,.as-chip{flex:none;display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;padding:2px 10px;font-size:10px;color:var(--ink2);border-top:1px solid var(--hair);background:var(--tint)}
.as-chip{border-top:0;color:var(--ink);font-size:11px;padding-bottom:3px;white-space:nowrap}
.as-chip #as-chip-t{overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1}
.as-chip-l{font-size:9px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink2)}
.as-src::before{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:3px;vertical-align:0}
.as-src-live::before{background:var(--ok)}
.as-src-down::before{background:transparent;border:1px solid var(--ink2)}
.as-src-down{color:var(--ink2)}

/* composer */
#as-composer{flex:none;border-top:1px solid var(--hair);padding:6px 10px 8px;display:flex;flex-direction:column;gap:5px;background:var(--surface)}
#as-input{width:100%;resize:none;border:1px solid var(--hair);padding:5px 7px;font:12px/1.4 var(--sans);color:var(--ink);background:#fff;border-radius:0;min-height:42px;max-height:140px}
#as-input:focus{outline:1px solid var(--blue);border-color:var(--blue)}
.as-actions{display:flex;align-items:center;gap:6px}
#as-model{border:1px solid var(--hair);background:#fff;font:11px var(--sans);padding:2px 4px;border-radius:0;color:var(--ink)}
#as-send,#as-stop{padding:3px 12px;font-size:12px;font-weight:700;border-radius:0;color:#fff;background:var(--blue)}
#as-send:hover{background:#3A64FF}
#as-stop{background:var(--navy)}
#as-stop:hover{background:var(--navy2)}
#as-send[hidden],#as-stop[hidden]{display:none}

/* resize grips */
.as-grip{position:absolute;z-index:4;display:block}
.as-grip-n,.as-grip-s{left:8px;right:8px;height:6px;cursor:ns-resize}
.as-grip-e,.as-grip-w{top:8px;bottom:8px;width:6px;cursor:ew-resize}
.as-grip-n{top:-3px}.as-grip-s{bottom:-3px}.as-grip-e{right:-3px}.as-grip-w{left:-3px}
.as-grip-ne,.as-grip-nw,.as-grip-se,.as-grip-sw{width:12px;height:12px}
.as-grip-ne{top:-3px;right:-3px;cursor:nesw-resize}.as-grip-nw{top:-3px;left:-3px;cursor:nwse-resize}
.as-grip-se{bottom:-3px;right:-3px;cursor:nwse-resize}.as-grip-sw{bottom:-3px;left:-3px;cursor:nesw-resize}
