/* Assistant: chat, thread, composer and the owner's spend page. Colours come from the tokens in app.css, so dark mode follows. */

/* The page uses the whole height, so the thread scrolls inside it and the composer stays in view. */
.content.as-content { padding-top: 12px; padding-bottom: 12px; }
.as-page { display: flex; flex-direction: column; height: calc(100dvh - 56px - 24px); min-height: 460px; min-width: 0; }
.as-holder { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.as-holder > .as-wrap { flex: 1; }
.as-spend { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.as-page > .empty { margin: auto; max-width: 520px; }

.as-tabs { flex: none; margin: 0 0 10px; }
.as-tabs a { padding: 10px 12px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.as-tabs a:hover { color: var(--text); }
.as-tabs a.on { color: var(--text); border-bottom-color: var(--crimson); }
.as-tabs a:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.as-wrap { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; min-height: 0; min-width: 0; }

/* chats list */
.as-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.as-side-h { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.as-side-h h2 { margin: 0; font-size: 16px; font-weight: 600; }
.as-sessions { list-style: none; margin: 0; padding: 6px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.as-sessions.archived { flex: 0 1 35%; border-top: 1px solid var(--border); }
.as-s { display: flex; align-items: center; gap: 2px; border-radius: 8px; min-width: 0; }
.as-s:hover, .as-s:focus-within { background: var(--surface-2); }
.as-s.on { background: var(--navy-tint); }
.as-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: start; border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--text); border-radius: 8px; font-family: inherit; }
.as-open:focus-visible { outline: none; box-shadow: var(--focus); }
.as-s-t { max-width: 100%; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-s-acts { display: flex; flex: none; opacity: 0; }
.as-s:hover .as-s-acts, .as-s:focus-within .as-s-acts, .as-s.on .as-s-acts { opacity: 1; }
@media (pointer: coarse) { .as-s-acts { opacity: 1; } }
.as-ib { width: 36px; height: 36px; }
.as-none { padding: 12px; font-size: 13px; }
.as-side-f { flex: none; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 13px; }

/* main column */
.as-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.as-head { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.as-head .spacer { flex: 1; }
.as-title { margin: 0; font-size: 16px; font-weight: 600; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.as-chatsbtn { display: none; }
.as-newbtn { display: none; }
.as-model { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
.as-model-sel { width: auto; min-width: 96px; height: 32px; min-height: 0; padding: 2px 28px 2px 8px; font-size: 13px; }
.as-caps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: end; } /* inputs line up even when one label wraps */
.as-caps-msg:empty, .as-route-msg:empty { display: none; }
.as-route-msg { color: var(--crimson-text); font-size: 13px; }
.as-caps-msg { color: var(--crimson-text); font-size: 13px; }
.as-trimmed { align-self: stretch; }
.as-meter { min-width: 190px; display: flex; flex-direction: column; gap: 3px; }
.as-meter-t { font-size: 13px; font-variant-numeric: tabular-nums; }
.as-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.as-bar > span { display: block; height: 100%; background: var(--navy); border-radius: 999px; }
.as-bar.hot > span { background: var(--crimson-solid); }
.as-banners:empty { display: none; }
.as-banners { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 0; }
.as-banners .callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }

/* thread */
.as-thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.as-thread:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #1E4FBF; }
.as-intro { margin: auto; text-align: center; max-width: 520px; padding: 24px 8px; }
.as-intro .ic { width: 48px; height: 48px; border-radius: 999px; background: var(--navy-tint); color: var(--navy); display: inline-grid; place-items: center; margin-bottom: 10px; }
.as-intro h3 { margin: 0 0 6px; font-size: 17px; }
.as-intro p { margin: 0; }
.as-msg { min-width: 0; max-width: 100%; }
.as-msg.user { align-self: flex-end; max-width: min(720px, 88%); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.as-bubble { background: var(--navy-tint); border: 1px solid var(--border); border-radius: 14px 14px 4px 14px; padding: 9px 14px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; text-align: start; }
.as-msg.assistant { align-self: stretch; max-width: 860px; }
.as-meta { gap: 4px 10px; margin-bottom: 4px; }
.as-body { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.as-note { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.as-note.bad { color: var(--crimson-text); }
.as-actions { margin-top: 8px; gap: 6px; }
.as-oldwrap { align-self: stretch; max-width: 860px; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 6px 12px; }
.as-oldwrap summary { cursor: pointer; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.as-oldwrap summary:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.as-oldwrap .as-msg { opacity: .85; padding-top: 6px; }
.as-notice { align-self: stretch; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* who answered */
.as-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; font-family: var(--font-sans); background: var(--st-ns-bg); color: var(--st-ns-fg); }
.as-badge.sonnet { background: var(--navy-tint); color: var(--navy); }
.as-badge.haiku { background: var(--st-rv-bg); color: var(--st-rv-fg); }
.as-badge.local { background: var(--st-wt-bg); color: var(--st-wt-fg); }

/* waiting dots */
.as-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.as-dots i { width: 7px; height: 7px; border-radius: 999px; background: var(--text-3); animation: as-pulse 1.1s ease-in-out infinite; }
.as-dots i:nth-child(2) { animation-delay: .15s; }
.as-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes as-pulse { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* markdown inside a reply */
.as-md > :first-child { margin-top: 0; }
.as-md > :last-child { margin-bottom: 0; }
.as-md p { margin: 0 0 .75em; line-height: 1.55; }
.as-md h3, .as-md h4, .as-md h5, .as-md h6 { margin: 1em 0 .4em; line-height: 1.3; font-weight: 700; }
.as-md h3 { font-size: 18px; } .as-md h4 { font-size: 16px; } .as-md h5, .as-md h6 { font-size: 15px; }
.as-md ul, .as-md ol { margin: 0 0 .75em; padding-inline-start: 1.5em; }
.as-md li { margin: .2em 0; line-height: 1.5; }
.as-md li > ul, .as-md li > ol { margin: .2em 0 0; }
.as-md blockquote { margin: 0 0 .75em; padding: 2px 12px; border-inline-start: 3px solid var(--border-strong); color: var(--text-2); }
.as-md hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.as-md a { color: var(--navy); text-decoration: underline; overflow-wrap: anywhere; }
.as-linkurl { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.as-md code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }
.as-md pre { margin: 0 0 .75em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; direction: ltr; text-align: left; max-width: 100%; }
.as-md pre:focus-visible { outline: none; box-shadow: var(--focus); }
.as-md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; white-space: pre; overflow-wrap: normal; }
.as-tablewrap { overflow-x: auto; margin: 0 0 .75em; max-width: 100%; }
.as-tablewrap:focus-visible { outline: none; box-shadow: var(--focus); }
.as-md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.as-md th, .as-md td { border: 1px solid var(--border); padding: 6px 10px; text-align: start; vertical-align: top; overflow-wrap: normal; }
.as-md th { background: var(--surface-2); font-weight: 700; }

/* attachments */
.as-chips-wrap:empty { display: none; }
.as-chips { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.as-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 4px 2px 8px; font-size: 13px; }
.as-chip-name { min-width: 0; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-attach-note { color: var(--crimson-text); font-size: 13px; margin-bottom: 6px; }

/* composer */
.as-composer { flex: none; border-top: 1px solid var(--border); padding: 10px 16px 8px; background: var(--surface); }
.as-cbox { display: flex; align-items: flex-end; gap: 8px; }
textarea.input.as-input { flex: 1; min-width: 0; height: auto; min-height: 40px; max-height: 180px; padding: 8px 10px; resize: none; line-height: 1.45; }
.as-attach { width: 40px; padding: 0; flex: none; height: 40px; }
.as-send { flex: none; height: 40px; min-width: 88px; }
.as-hint { margin-top: 6px; }
.as-elsewhere { margin-bottom: 6px; }

/* confidentiality note, requests */
.as-points { margin: 0; padding-inline-start: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.as-past { margin: 4px 0 0; padding-inline-start: 1.2em; font-size: 13px; }

/* owner */
.as-big { font-size: 26px; line-height: 34px; font-weight: 600; font-variant-numeric: tabular-nums; }
.as-admin { max-width: 980px; }
.as-admin-card .row { gap: 8px 12px; }
.as-req { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.as-req:last-child { border-bottom: 0; }
.as-req .grow { flex: 1 1 260px; min-width: 0; }
.as-req-reason { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.as-tblwrap { overflow-x: auto; }
.as-tbl th.num, .as-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.as-tbl tr.static { cursor: default; }
/* the shared table pins its header to the page; inside a scrolling card that would lay it over the first row */
.as-tbl th { position: static; }
.as-dashcard { padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.as-dashcard:hover { border-color: var(--border-strong); }
.as-dashcard .k { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.as-dash-fig { margin-bottom: 8px; }
.as-dash-pend { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--st-wt-fg); }
.as-dashcard-slot:empty { display: none; }

/* a narrower screen: the chats list becomes its own view, opened with the Chats button */
@media (max-width: 900px) {
  .as-wrap { grid-template-columns: minmax(0, 1fr); }
  .as-side { display: none; }
  .as-wrap.side-open .as-side { display: flex; }
  .as-wrap.side-open .as-main { display: none; }
  .as-chatsbtn { display: inline-flex; }
  .as-newbtn { display: inline-flex; }
  .as-meter { min-width: 0; flex: 1 1 200px; }
}
@media (max-width: 767px) {
  .content.as-content { padding: 8px 8px calc(64px + env(safe-area-inset-bottom) + 8px); }
  .as-page { height: calc(100dvh - 56px - 64px - env(safe-area-inset-bottom) - 16px); min-height: 380px; }
  .as-head { padding: 8px 12px; }
  .as-thread { padding: 12px; }
  .as-composer { padding: 8px 12px 6px; }
  .as-msg.user { max-width: 94%; }
  .as-hint { display: none; }
  .as-send { min-width: 76px; }
  .as-banners { padding: 8px 12px 0; }
  /* touch targets: 44px for what the owner and everyone else press on a phone */
  .as-page .btn, .as-page .btn.sm, .as-page select.input, .as-model-sel, .as-admin .btn, .as-admin .btn.sm, .as-admin .input, .as-admin select.input, .as-req .btn { min-height: 44px; }
  .as-model-sel { height: 44px; font-size: 16px; }
  .as-ib { width: 44px; height: 44px; }
  .as-attach { width: 44px; height: 44px; }
  .as-send { height: 44px; }
  textarea.input.as-input { min-height: 44px; }
  .as-admin .check { min-height: 44px; }
  .as-side-f .linklike, .as-tabs a { display: inline-flex; align-items: center; min-height: 44px; }
  .as-side-f { padding: 0 12px; }
  .as-open { min-height: 44px; }
}
