/* The two adjustable workspace columns share one source of truth with file preview positioning. */
@media (min-width: 981px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--workbench-w) !important; }
  .shell.hide-left { grid-template-columns: minmax(0, 1fr) var(--workbench-w) !important; }
  .shell.hide-right { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) !important; }
  .shell.hide-left.hide-right { grid-template-columns: minmax(0, 1fr) !important; }
}
.workspace-resizer { position: fixed; z-index: 12; top: 0; bottom: 0; width: 12px; cursor: col-resize; touch-action: none; background: transparent; }
@media (pointer: coarse) {
  .workspace-resizer { width: 22px; }
  .sidebar-resizer { left: calc(var(--sidebar-w, 270px) - 11px); }
  .workbench-resizer { right: calc(var(--workbench-w, 360px) - 11px); }
}
.workspace-resizer::after { content: none; }
.sidebar-resizer { left: calc(var(--sidebar-w, 270px) - 6px); }
.workbench-resizer { right: calc(var(--workbench-w, 360px) - 6px); }
.shell.hide-left:not(.show-left) > .sidebar {
  display: none !important;
}
.shell > .sidebar {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
@media (min-width: 981px) {
  .shell:not(.hide-left):not(.shell-compact) > .sidebar {
    min-width: min(250px, var(--sidebar-w, 270px));
  }
}
.hide-left .sidebar-resizer,
.hide-right .workbench-resizer,
.shell.shell-compact:not(.show-right) .workbench-resizer,
.shell.shell-compact:not(.show-left) .sidebar-resizer { display: none; }
.is-resizing-workspace { cursor: col-resize; user-select: none; }
.workbench-head-actions { display: flex; align-items: center; gap: 6px; }
.workbench:fullscreen { width: 100vw; height: 100dvh; background: var(--bg); padding: 0 12px; border: 0; }
.workbench:fullscreen .workbench-content { flex: 1; min-height: 0; }
.workbench:fullscreen .desktop-panel,.workbench:fullscreen .terminal-panel-shell,.workbench:fullscreen .changes-panel-shell { flex: 1; min-height: 0; }
.workbench-content { overscroll-behavior: contain; }
.workbench .tabs button { text-transform:none !important; letter-spacing:0; font-size: 12px; font-weight: 620; padding: 0 12px; }
.workbench .tabs button[aria-selected=true] { font-size: 11px; font-weight: 760; }
.workbench-head strong { font-size: 12px; font-weight: 650; letter-spacing:0; text-transform:none !important; }
.workbench .panel-label,
.workbench .quick-action { text-transform:none; letter-spacing:0; }

/* Section eyebrows: sit below the tab rail with consistent breathing room */
.workbench-content > .panel-block:first-child,
.workbench-content > .panel-label:first-child {
  margin-top: 44px;
}

.workbench-content .panel-label {
  margin-bottom: 14px;
  padding-top: 6px;
  line-height: 1.35;
  font-weight: 620;
  color: var(--muted);
}

.workbench-content .panel-block > .panel-label:first-child {
  margin-top: 0;
  padding-top: 10px;
}
.workbench-head .icon-btn { width: 32px; height: 32px; font-size: 21px; }
.overview-details { margin: 0 16px 10px; border: 1px solid color-mix(in srgb, var(--border) 85%, transparent); border-radius: 12px; padding: 0 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 42%, transparent); }
.overview-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 10px 0; font-size: 12px; font-weight: 600; list-style: none; cursor: pointer; }
.overview-details > summary::-webkit-details-marker { display: none; }
.overview-details > summary::after { content: '›'; flex: 0 0 auto; color: var(--faint); font-size: 14px; line-height: 1; transition: transform 0.15s ease; }
.overview-details[open] > summary::after { transform: rotate(90deg); }
.overview-details-title { letter-spacing:0; text-transform:none; font-size: 12px; color: var(--muted); }
.overview-details-count { min-width: 22px; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: center; }
.overview-details-body { padding: 0 0 12px; border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.overview-source-list { display: grid; gap: 8px; padding-top: 10px; }
.overview-empty { margin: 10px 0 0; padding: 10px 12px; border-radius: 9px; background: color-mix(in srgb, var(--elevated) 65%, transparent); color: var(--muted); font-size: 12px; line-height: 1.5; }
.overview-sources-manage { width: 100%; margin-top: 10px; justify-content: center; }
.overview-metric { margin: 0 16px 10px; }
.thread-usage-values { display: grid; gap: 12px; margin: 16px 0 0; }
.thread-usage-values > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.thread-usage-values dt { font-size: 12px; color: var(--muted); }
.thread-usage-values dd { margin: 0; text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.thread-usage-values dd small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; }
.thread-usage-values dd small.runtime-breakdown { display: flex; justify-content: flex-end; align-items: center; gap: 0; white-space: nowrap; overflow-wrap: normal; font-size: 11px; }
.thread-usage-plan { margin-left: auto; font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--text); }
.thread-usage-remaining { display: grid; gap: 8px; margin-top: 14px; }
.thread-usage-remaining-title { font-size: 12px; font-weight: 600; color: var(--text); }
.thread-limit-row { display: grid; grid-template-columns: minmax(48px, 1fr) auto auto; align-items: baseline; gap: 12px; }
.thread-limit-name { font-size: 12px; color: var(--text); text-align: left; }
.thread-limit-pct, .thread-limit-reset { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.thread-limit-pct { font-weight: 650; }
.thread-limit-pct.is-empty { color: var(--error); }
.thread-limit-reset { min-width: 4.75rem; color: var(--muted); white-space: nowrap; }
.thread-limit-track { height: 3px; margin-top: 5px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.thread-limit-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.thread-limit small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.thread-limit.is-held .thread-limit-track span { opacity: 0.35; }
.thread-limit.is-held .thread-limit-pct { color: var(--muted); }
.thread-usage-hold { color: var(--text); }
.thread-usage-manage { font-size: 12px; color: var(--text); }
.runtime-item { display: inline-flex; align-items: center; gap: 5px; }
.runtime-item + .runtime-item { margin-left: 10px; padding-left: 10px; border-left: 1px solid color-mix(in srgb, var(--border) 85%, transparent); }
.runtime-status-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #8b8f96; }
.runtime-running .runtime-status-dot { background: #22c55e; }
.runtime-paused .runtime-status-dot { border: 1.5px solid #ef4444; background: transparent; }
.overview-metric .context-meter,
.overview-metric .sandbox-meter { margin: 0; }
.workspace-file-error { margin: 10px 18px; padding: 12px; border: 1px solid color-mix(in srgb, var(--error) 45%, var(--border)); border-radius: 10px; font-size: 12px; }
.workspace-file-error p { margin: 0 0 8px; }
.workspace-file-error details { margin-top: 10px; color: var(--muted); overflow-wrap: anywhere; }
/* Partial: some project conversations' files are unavailable, the rest loaded. Informational, not an error. */
.workspace-file-notice { display:flex; align-items:center; justify-content:space-between; gap:10px; margin: 10px 18px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised, transparent); color: var(--muted); font-size: 12px; line-height:1.45; }
.workspace-file-notice p { margin: 0; }
.workspace-file-notice .secondary-btn { flex: 0 0 auto; }
.files-loading { display: flex; align-items: center; gap: 10px; padding: 26px 12px; color: var(--muted); font-size: 12px; }
.workbench .files-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  justify-content: flex-start;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.workbench .files-action-btn,
.workbench .files-actions > .advanced-file-actions > summary.files-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.workbench .files-action-btn .icon,
.workbench .files-actions summary.files-action-btn .icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.workbench .files-action-text { display: inline; }
.workbench .advanced-file-actions {
  position: relative;
  flex: 0 0 auto;
}
.workbench .advanced-file-actions > summary.files-action-btn {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}
.workbench .advanced-file-actions > summary.files-action-btn::-webkit-details-marker { display: none; }
.workbench .advanced-file-actions[open] > summary.files-action-btn {
  color: var(--text);
  background: var(--hover);
}
.workbench .advanced-file-actions[open] > div {
  position: absolute;
  z-index: 8;
  right: 0;
  top: calc(100% + 6px);
  display: grid;
  min-width: 200px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px #0005;
}
.workbench .advanced-file-actions[open] .files-action-btn {
  width: 100%;
  justify-content: flex-start;
}
.workbench .files-action-btn:disabled,
.workbench .advanced-file-actions > summary.files-action-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.workbench .files-action-btn .icon[class*='lucide-loader-circle'] {
  animation: files-action-spin 0.85s linear infinite;
}
@keyframes files-action-spin {
  to { transform: rotate(360deg); }
}
@media (max-width: 650px) {
  .workbench .files-actions .files-action-text { display: inline !important; }
}
.workbench:fullscreen .interactive-terminal-host { height: min(64dvh, 720px); }
.workbench:fullscreen .project-preview-frame-wrap { min-height: 0; }
.hide-right .file-preview-panel { right: 12px; }
.hide-left .file-preview-panel { left: 12px; }

/* File preview floats above sidebar, conversation, workbench, and resizers when open. */
.shell.preview-open::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 95;
  background: color-mix(in srgb, #000 32%, transparent);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: preview-backdrop-in 0.22s ease-out;
  pointer-events: auto;
}
@keyframes preview-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.shell.preview-open .file-preview-panel {
  z-index: 100 !important;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  left: max(14px, env(safe-area-inset-left, 0px));
  width: auto;
  max-width: none;
  border-radius: 18px;
  box-shadow:
    0 40px 120px #000a,
    0 12px 40px #0006,
    0 0 0 1px color-mix(in srgb, var(--border) 70%, transparent);
  animation: preview-panel-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.shell.preview-open.hide-right .file-preview-panel,
.shell.preview-open.hide-left .file-preview-panel {
  left: max(14px, env(safe-area-inset-left, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
}
@media (prefers-reduced-motion: reduce) {
  .shell.preview-open::before,
  .shell.preview-open .file-preview-panel {
    animation: none;
  }
}
/* Down to just above the composer, so a long turn reads comfortably (page header, turn header and composer ~280px). */
.awb-timeline { max-height: max(280px, calc(100dvh - 280px)) !important; overflow-y: auto !important; overscroll-behavior: contain; scrollbar-gutter: stable; scroll-behavior: smooth; }
.awb-timeline.scroll-fade { --fade: 44px; }
.awb-tool-detail,.terminal-block-output,.workspace-history-diff pre { max-height: min(42dvh, 400px); overflow: auto; overscroll-behavior: contain; }
.awb-tool-result-content { max-height: min(34dvh, 260px) !important; overflow: auto !important; overscroll-behavior: contain; }
.rich-text pre { max-height: min(60dvh, 560px); overflow: auto; overscroll-behavior: contain; }
/* Thread rail: same column as composer-dock (wins over responsive max-width:100% on .rich-text). */
#messages.messages,
.conversation > .welcome,
.composer-area > .composer-dock,
.composer-area > .composer-note {
  width: var(--thread-rail-width, min(100%, var(--thread-width, 820px)));
  max-width: var(--thread-width, 820px);
  margin-inline: auto;
  box-sizing: border-box;
}
.message.assistant,
.message.assistant .rich-text,
.message.assistant .work-summary,
.message.assistant .awb-summary,
.message.assistant .awb-progress-update {
  width: 100%;
  max-width: none;
  align-self: stretch;
}
.message.assistant .rich-text > :is(p, pre, ul, ol, blockquote, hr, .rich-table-wrap) {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.message.assistant .rich-text pre,
.message.assistant .awb-progress-update pre {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}
/* Compact, icon-led links match the artifact and the linked site's identity. */
.message.assistant .rich-text a[href] {
  display: inline;
  --link-color: #8AB4F8;
  --link-hover: #AECBFA;
  color: var(--link-color);
  text-decoration: none !important;
  text-underline-offset: 2px;
  border-radius: 3px;
  transition: color .14s ease, background-color .14s ease;
}
html[data-theme='light'] .message.assistant .rich-text a[href] { --link-color: #1A5FB4; --link-hover: #134A8E; }
.message.assistant .rich-text a[href]:hover,
.message.assistant .rich-text a[href]:active { color: var(--link-hover); text-decoration: none !important; }
.message.assistant .rich-text a[href]:focus-visible { color: var(--accent); outline: 2px solid var(--accent); outline-offset: 3px; text-decoration: none !important; }
.rich-link-icon {
  display: inline-flex;
  width: 1.12em;
  height: 1.12em;
  margin: 0 .3em 0 0;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex: 0 0 auto;
  line-height: 1;
}
.rich-link-icon svg { display: block; width: 1em; height: 1em; }
.rich-link-icon--file { color: var(--link-color, var(--muted)); }
.rich-link-icon--image { color: #c084fc; }
.rich-link-icon--data { color: #34b883; }
.rich-link-icon--document { color: #f07878; }
.rich-link-icon--archive { color: #e7ae48; }
.rich-link-icon--code { color: var(--link-color, var(--muted)); }
.rich-link-icon--react { color: #61dafb; }
.rich-link-icon--site {
  width: 1em;
  height: 1em;
  border-radius: .34em;
  color: #fff;
  background: #64748b;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  vertical-align: middle;
}
.rich-link-icon--site[data-initial]::before { content: attr(data-initial); font-size: .68em; }
.rich-link-icon--site .rich-site-favicon { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: .2em; }
.rich-link-icon--github { background: #4b5563; }
.rich-link-icon--gitlab { background: #e56a32; }
.rich-link-icon--mdn { background: #7c3aed; }
.rich-link-icon--openai { background: #16866f; }
.rich-link-icon--blue { background: #3478d4; }
.rich-link-icon--violet { background: #8053c8; }
.rich-link-icon--teal { background: #168c83; }
.rich-link-icon--amber { background: #b87912; }
.rich-link-icon--rose { background: #c84a72; }
.rich-link-icon--indigo { background: #555fc1; }
.rich-link-icon--mail, .rich-link-icon--anchor { color: var(--muted); }
.project-chats { padding-left: 13px; border-left: 1px solid var(--border); margin-left: 21px; }
.optional-source { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 8px; background: var(--surface); }
.optional-source summary { font-size: 13px; font-weight: 600; }
.optional-source[open] summary { margin-bottom: 14px; }
.optional-source .field { margin-top: 12px; }
.source-choices { max-height: 180px; overflow-y: auto; }
.chat-search-field { display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.chat-search-field:focus-within { border-color: var(--accent); }
.chat-search-field svg { flex: 0 0 auto; color: var(--muted); }
.chat-search-field input { margin: 0; border: 0; background: transparent; padding: 14px 0; box-shadow: none; }
.chat-search-results { max-height: min(58dvh, 580px); overflow-y: auto; overscroll-behavior: contain; padding: 10px 2px; }
.chat-search-results h4 { margin: 17px 8px 6px; color: var(--muted); font-size: 11px; font-weight: 650; }
.chat-search-results .search-result { display: block; width: 100%; padding: 11px 12px; background: transparent; border-radius: 9px; text-align: left; }
.chat-search-results .search-result:hover,.chat-search-results .search-result:focus-visible,.chat-search-results .search-result.is-active { background: var(--hover); }
.search-result-title { display: block; font-size: 13px; color: var(--text); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.search-result mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); border-radius: 2px; }
.search-empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.search-status { padding: 8px 12px; color: var(--muted); font-size: 12px; }
.search-empty strong { color: var(--text); }
.project-preview {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin: 14px 16px 16px;
  padding: 14px;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 42%, transparent);
}
.project-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.project-preview-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.project-preview-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
}
.project-preview-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 650;
  letter-spacing:0;
  text-transform:none;
}
.project-preview-title strong {
  display: block;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.02em;
  color: var(--text);
}
.project-preview-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.project-preview-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.project-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.project-preview-toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 8px 10px;
  align-items: end;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: 11px;
  background: color-mix(in srgb, var(--elevated) 55%, transparent);
}
.project-preview-port {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.project-preview-port-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing:0;
  text-transform:none;
  color: var(--muted);
}
.project-preview-port input {
  width: 88px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.project-preview-open {
  justify-self: start;
  min-height: 32px;
  padding-inline: 14px;
}
.project-preview-port-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--faint);
}
.project-preview-error { margin: 0; }
.project-preview-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.project-preview-frame-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0f1110;
  box-shadow: inset 0 1px 0 #ffffff0a;
}
.project-preview-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  background: color-mix(in srgb, var(--elevated) 90%, #1a1c1a);
  border-bottom: 1px solid var(--border);
}
.project-preview-chrome span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 18%, transparent);
}
.project-preview-chrome span:first-child { background: #e38a7a; opacity: 0.85; }
.project-preview-chrome span:nth-child(2) { background: #d4b06a; opacity: 0.85; }
.project-preview-chrome span:nth-child(3) { background: #7cb87a; opacity: 0.85; }
.project-preview-frame-wrap iframe {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 220px;
  border: 0;
  background: #fff;
}
.project-preview-loading {
  position: absolute;
  z-index: 2;
  inset: 28px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--muted);
  font-size: 12px;
}
.project-preview-loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: preview-pulse 1s ease-in-out infinite;
}
@keyframes preview-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}
.project-preview-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 24px 20px;
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  color: var(--muted);
}
.project-preview-placeholder .icon {
  width: 32px;
  height: 32px;
  color: var(--faint);
  margin-bottom: 4px;
}
.project-preview-placeholder strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.project-preview-placeholder p {
  margin: 0;
  max-width: 28ch;
  font-size: 12px;
  line-height: 1.55;
}
.project-preview-placeholder-note {
  margin-top: 6px !important;
  font-size: 11px !important;
  color: var(--faint) !important;
}
.project-preview--empty-root {
  margin: 16px;
  min-height: 240px;
}
.file-preview-panel:fullscreen { inset: 0; width: 100vw; height: 100dvh; border: 0; border-radius: 0; background: var(--bg); }
.file-preview-panel:fullscreen .preview-panel-body { min-height: 0; }
.preview-fullscreen { min-width: 30px; }
.file-list { flex: 1 1 auto; }
/* Changes tab — same density as Results file list */
.workbench-content > .changes-panel-shell {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 12px 12px 10px !important;
  gap: 0;
}
.changes-panel-shell {
  min-width: 0;
}
.changes-heading {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 10px;
  margin: 0 !important;
  text-transform: none;
  letter-spacing: 0;
}
.changes-heading strong {
  display: block;
  font-size: 13px;
  font-weight: 620;
  letter-spacing: -0.15px;
  text-transform: none;
}
.changes-heading small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--faint);
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}
.changes-loading-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  vertical-align: middle;
}
.changes-loading-indicator .attachment-spinner {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}
.changes-loading-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.changes-heading-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.changes-heading-actions .text-btn {
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.changes-file-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px 32px !important;
}
.changes-empty {
  flex: 1 1 auto;
  min-height: 200px;
  margin: 0 8px;
}
.change-tree {
  gap: 6px;
}
.change-folder-children {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.change-entry .tree-file-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
.change-file-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 4px !important;
}
.change-file-main:disabled {
  cursor: default;
  opacity: 1;
}
.change-chevron-spacer {
  width: 12px;
  flex-shrink: 0;
}
.change-file-main > .icon:first-of-type {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--faint);
}
.change-file-main > span {
  min-width: 0;
}
.change-entry.kind-delete .change-file-main strong {
  text-decoration: line-through;
  color: var(--muted);
}
.change-diff-stats {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  padding: 0 4px;
  white-space: nowrap;
}
.change-kind {
  display: inline-block;
  margin-right: 2px;
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.2;
  background: var(--elevated);
  color: var(--muted);
}
.change-kind.tone-add {
  color: var(--success, #22c55e);
  background: color-mix(in srgb, var(--success, #22c55e) 14%, var(--elevated));
}
.change-kind.tone-update {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--elevated));
}
.change-kind.tone-delete {
  color: var(--error);
  background: color-mix(in srgb, var(--error) 14%, var(--elevated));
}
.change-diff-body {
  margin: 0 0 6px 28px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.change-diff-body .diff-unified {
  border-radius: 0;
  margin: 0;
  padding: 0;
  max-height: min(40vh, 360px);
  overflow: auto;
  background: var(--bg);
  color: var(--text);
  font: 11px/1.65 var(--font-mono);
  white-space: normal;
}
.codex-diff-line {
  display: flex;
  align-items: stretch;
  min-height: 1.65em;
}
.codex-diff-no {
  flex: 0 0 auto;
  box-sizing: content-box;
  width: var(--codex-gutter, 3ch);
  padding: 0 10px;
  text-align: right;
  user-select: none;
  color: var(--muted);
}
.codex-diff-body {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 12px;
}
.codex-diff-sign {
  flex: 0 0 1.4ch;
  user-select: none;
  text-align: center;
}
.codex-diff-text {
  white-space: pre;
}
.codex-diff-line.is-add {
  background: #213a2b;
  color: #aff5b4;
}
.codex-diff-line.is-add .codex-diff-no {
  background: #1a3324;
  color: #7ee787;
}
.codex-diff-line.is-add .codex-diff-sign { color: #3fb950; }
.codex-diff-line.is-del {
  background: #4a221d;
  color: #ffdcd7;
}
.codex-diff-line.is-del .codex-diff-no {
  background: #3d1c18;
  color: #ffa198;
}
.codex-diff-line.is-del .codex-diff-sign { color: #f85149; }
.codex-diff-line.is-context .codex-diff-no { background: color-mix(in srgb, var(--elevated) 70%, transparent); }
.codex-diff-line.is-gap,
.codex-diff-line.is-note {
  color: var(--muted);
}
.codex-diff-line.is-note .codex-diff-body { padding-left: 12px; }
html[data-theme=light] .change-diff-body .diff-unified {
  background: #ffffff;
  color: #1f2328;
}
html[data-theme=light] .codex-diff-line.is-add {
  background: #dafbe1;
  color: #1f2328;
}
html[data-theme=light] .codex-diff-line.is-add .codex-diff-no {
  background: #aceebb;
  color: #1f2328;
}
html[data-theme=light] .codex-diff-line.is-add .codex-diff-sign { color: #1a7f37; }
html[data-theme=light] .codex-diff-line.is-del {
  background: #ffebe9;
  color: #1f2328;
}
html[data-theme=light] .codex-diff-line.is-del .codex-diff-no {
  background: #ffcecb;
  color: #1f2328;
}
html[data-theme=light] .codex-diff-line.is-del .codex-diff-sign { color: #cf222e; }
html[data-theme=light] .codex-diff-line.is-context .codex-diff-no {
  background: #f6f8fa;
  color: #57606a;
}
html[data-theme=light] .codex-diff-line.is-gap .codex-diff-no,
html[data-theme=light] .codex-diff-line.is-note {
  background: #f6f8fa;
  color: #57606a;
}
.change-diff-body .hitl-diff {
  border: 0;
  max-height: min(40vh, 360px);
}
.change-entry .tree-row-actions {
  gap: 4px;
  padding-right: 2px;
}
@media (max-width: 980px) {
  .shell,.shell.hide-right { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) !important; }
  .shell.hide-left,.shell.hide-left.hide-right { grid-template-columns: minmax(0, 1fr) !important; }
  .workspace-resizer { display: block; }
  .shell.show-right .workbench { width: min(var(--workbench-w, 360px), calc(100dvw - 24px)); }
  .shell.show-right .file-preview-panel { right: 12px; }
  .shell.show-left .file-preview-panel { left: 12px; }
}
@media (max-width: 650px) {
  .shell:not(.show-left) .sidebar-resizer { display: none; }
  .shell.show-left .sidebar { width: min(max(var(--sidebar-w, 270px), 220px), calc(100dvw - 36px)); }
  .shell.show-left .sidebar-resizer { z-index: 11; }
  .chat-search-results { max-height: 52dvh; }
  .project-preview { padding: 12px; }
  .shell.show-right .workbench { width: min(var(--workbench-w, 360px), calc(100dvw - 16px)); max-width: calc(100dvw - 16px); }
  .shell.show-right .workbench-resizer { display: block; z-index: 13; }
}

/* Clearer controls and stronger reading contrast in the everyday workspace. */
html[data-theme=light] {
  --bg: #FAFAFA;
  --sidebar: #F3F3F5;
  --surface: #FFFFFF;
  --elevated: #F4F4F6;
  --border: #E4E4E7;
  --border-strong: #787882;
  --text: #0A0A0C;
  --muted: #52525B;
  --faint: #63636B;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-text: #0A0A0C;
  --hover: #E4E4E7;
  --success: #16a34a;
}
.workspace-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.section-label,.chat-group-label { font-size: 11px; }
.panel-label { font-size: 11px; }
.workbench-head strong { font-size: 12px; letter-spacing:0; text-transform:none !important; }
.workbench-footer { font-size: 11px; }
.tabs-rail::before,.tabs-rail::after { width: 38px; }
.tabs-rail[data-overflow-end]::after { opacity: 1; }
.tabs-rail[data-overflow-start]::before { opacity: 1; }
#agent-popover .agent-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
#agent-popover .agent-card-top {
  margin-bottom: 2px;
}
#agent-popover .agent-card-advanced {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 6px 0 10px;
  padding: 8px 0 6px;
  border-block: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}
#agent-popover .agent-card-model#popover-model {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  max-width: calc(100% - 8px);
  min-height: 30px;
  margin: 0 auto !important;
  padding: 5px 14px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 550;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
#agent-popover .agent-card-model#popover-model[aria-expanded='true'] {
  color: var(--text) !important;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
#agent-popover .agent-card-model#popover-model:hover {
  color: var(--text) !important;
  background: var(--hover);
  border-color: color-mix(in srgb, var(--text) 22%, transparent);
}
#agent-popover .agent-card-advanced .model-menu {
  position: absolute;
  top: auto !important;
  bottom: calc(100% + 6px);
  left: 8px !important;
  right: 8px !important;
  z-index: 8;
  transform: none;
  width: auto;
  display: grid;
  gap: 2px;
  margin: 0 !important;
  padding: 6px !important;
  max-height: min(220px, calc(100dvh - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px !important;
  background: var(--elevated) !important;
  border: 1px solid var(--border) !important;
  box-shadow:
    0 16px 36px color-mix(in srgb, var(--text) 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent) !important;
  color: var(--text);
}
#agent-popover .model-choice {
  color: var(--muted) !important;
  background: transparent !important;
  font-size: 11px !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
  line-height: 1.35;
  text-align: left;
}
#agent-popover .model-choice:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
}
#agent-popover .model-choice.selected {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface)) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, var(--border));
}
#agent-popover .model-choice-locked {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  row-gap: 1px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  cursor: default;
}
#agent-popover .model-choice-name {
  grid-column: 1;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
#agent-popover .model-choice-plan {
  grid-column: 1;
  font-size: 10px;
  line-height: 1.3;
  color: var(--faint);
}
#agent-popover .model-choice-upgrade {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 11px;
  font-weight: 620;
  color: var(--accent);
  text-decoration: none;
}
#agent-popover .model-choice-upgrade:hover {
  text-decoration: underline;
}
#agent-popover .agent-card-effort {
  padding-top: 2px;
}
.model-menu-label {
  margin: 2px 4px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing:0;
  text-transform:none;
}
.effort-labels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 4px 2px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.effort-labels span { flex: 1; text-align: center; }
.effort-labels span:first-child { text-align: left; }
.effort-labels span:last-child { text-align: right; }
.agent-reset { display: grid !important; place-items: center; }
.message-actions .copy-done-mark {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}
.message-actions-wrap {
  position: relative;
  margin-top: 6px;
}
.message.assistant .message-actions-wrap {
  opacity: 0;
  transition: opacity 0.12s ease;
}
.message.assistant:hover .message-actions-wrap,
.message.assistant:focus-within .message-actions-wrap,
.message-actions-wrap:hover,
.message-actions-wrap:focus-within {
  opacity: 1;
}
.message-actions-assistant {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 0;
  opacity: 1;
  pointer-events: auto;
}
.message.assistant .message-actions-wrap .message-actions-assistant,
.message.assistant .message-actions-wrap:focus-within .message-actions-assistant {
  opacity: 1;
}
.message-actions-assistant .icon-btn {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex-shrink: 0;
  color: var(--faint);
  border-radius: 6px;
  transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.message-actions-assistant .icon-btn .icon,
.message-actions-assistant .copy-done-mark {
  width: 12px;
  height: 12px;
}
.message-actions-assistant .icon-btn:not(.message-action-copy):hover {
  color: var(--faint);
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
.message-actions-assistant .icon-btn:not(.message-action-copy)[aria-pressed="true"] {
  color: var(--faint);
  background: transparent;
}
.message-actions .icon-btn.message-action-copy:hover:not(.is-copied) {
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.message-actions .icon-btn.message-action-copy.is-copied {
  color: #9ed4b0;
  background: color-mix(in srgb, #3ecf7a 16%, var(--elevated));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #52d68a 36%, transparent);
}
html[data-theme='light'] .message-actions .icon-btn.message-action-copy.is-copied {
  color: #1b6b47;
  background: color-mix(in srgb, #22c55e 14%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #16a34a 26%, var(--border));
}
.message-actions .icon-btn.message-action-copy.is-copied .copy-done-mark {
  color: inherit;
}
.message-actions-feedback {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.message-actions-time {
  margin-left: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--faint);
  line-height: 1;
}
.message-feedback-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--elevated);
  box-shadow: 0 12px 32px #0006;
  white-space: nowrap;
}
.message-feedback-popover select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  padding: 5px 8px;
}
.message-feedback-popover button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 560;
  padding: 6px 10px;
}
.message-feedback-popover [role="alert"] {
  font-size: 10px;
  color: var(--error);
}
/* With the optional note: reason on top, a full-width note, then Send on the right. */
.message-feedback-popover:has(.feedback-note) {
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  width: min(340px, calc(100vw - 32px));
  padding: 10px;
  white-space: normal;
}
.message-feedback-popover:has(.feedback-note) select,
.message-feedback-popover .feedback-note {
  flex: 1 1 100%;
  min-width: 0;
}
.message-feedback-popover .feedback-note {
  min-height: 60px;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.45;
}
.message-feedback-popover:has(.feedback-note) button {
  margin-left: auto;
}
.message-feedback-popover:has(.feedback-note) [role="alert"] {
  flex: 1 1 100%;
}
@media (max-width: 650px) {
  .message.assistant .message-actions-wrap {
    opacity: 1;
  }
}
html[data-theme='light'] #agent-popover .agent-card-advanced {
  border-block-color: color-mix(in srgb, var(--text) 10%, transparent);
}
html[data-theme='light'] #agent-popover .agent-card-model#popover-model {
  background: color-mix(in srgb, var(--elevated) 80%, #fff);
}
html[data-theme='light'] #agent-popover .agent-card-advanced .model-menu {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  box-shadow:
    0 14px 32px color-mix(in srgb, var(--text) 10%, transparent),
    inset 0 1px 0 #fff !important;
}
html[data-theme='light'] #agent-popover .model-choice {
  color: var(--muted) !important;
}
html[data-theme='light'] #agent-popover .model-choice:hover {
  background: var(--hover) !important;
  color: var(--text) !important;
}
html[data-theme='light'] #agent-popover .model-choice.selected {
  background: color-mix(in srgb, var(--accent) 14%, var(--elevated)) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, var(--border));
}
html[data-theme='light'] #agent-popover .model-menu-label {
  color: var(--faint);
}
html[data-theme='midnight'] #agent-popover .agent-card-advanced .model-menu,
html[data-theme='graphite'] #agent-popover .agent-card-advanced .model-menu {
  background: var(--elevated) !important;
  border-color: var(--border) !important;
}
.terminal-panel-toolbar small { font-size: 11px; }
.workbench-content > .terminal-panel-shell {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 16px 16px 14px;
}
.workbench-content > .terminal-panel-shell .terminal-history {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
@media (min-width: 981px) {
  .sidebar-section .chat-entry.project-entry .project-select { min-height: 32px; }
  .sidebar-section .chat-row { padding-top: 6px; padding-bottom: 6px; }
}

/* Sidebar hierarchy: project conversations sit beneath their project; Recents stays separate. */
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  min-width: 0;
}
.sidebar .brand .workspace-label { flex: 0 1 auto; min-width: 0; }
.sidebar .brand .sidebar-close-btn {
  display: none;
  margin-left: auto;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
}
.shell.show-left .sidebar .brand .sidebar-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar {
  --sidebar-rail-inset: 2px;
  --sidebar-item-pad-x: 9px;
  --sidebar-item-pad-y: 5px;
  --sidebar-nav-icon: 16px;
  --sidebar-nav-gap: 9px;
  --sidebar-nav-text-indent: calc(var(--sidebar-item-pad-x) + var(--sidebar-nav-icon) + var(--sidebar-nav-gap));
  --sidebar-list-size: 13px;
  --sidebar-list-weight: 500;
  --sidebar-list-tracking: -0.01em;
  --sidebar-list-line: 1.35;
  --sidebar-nested-list-size: 12.5px;
  --sidebar-nested-weight: 480;
  /* Left edge of primary-nav icons (section headers align here). */
  --sidebar-icon-start: var(--sidebar-item-pad-x);
}
.sidebar-primary-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 0 4px;
  padding: 0 var(--sidebar-rail-inset) 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 52%, transparent);
}
.sidebar-primary-nav .nav-item {
  display: flex;
  align-items: center;
  gap: var(--sidebar-nav-gap);
  width: 100%;
  min-height: 30px;
  padding: var(--sidebar-item-pad-y) var(--sidebar-item-pad-x);
  border-radius: 8px;
  font-size: var(--sidebar-list-size);
  font-weight: var(--sidebar-list-weight);
  line-height: var(--sidebar-list-line);
  letter-spacing: var(--sidebar-list-tracking);
  text-align: left;
}
.sidebar-primary-nav .nav-item .icon {
  width: var(--sidebar-nav-icon);
  height: var(--sidebar-nav-icon);
  flex-shrink: 0;
  opacity: 0.9;
}
.sidebar-panels {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
  padding: 0 var(--sidebar-rail-inset);
}
.sidebar-panels:has(.sidebar-section.is-collapsed) { gap: 2px; }
.sidebar-panels:has(.projects-section.is-collapsed):has(.chats-section.is-collapsed) {
  flex: 0 0 auto;
  gap: 0;
}
.sidebar-panels:has(.projects-section.is-collapsed) .chats-section:not(.is-collapsed) { flex: 1 1 auto; }
.sidebar-panels:has(.chats-section.is-collapsed) .projects-section:not(.is-collapsed) { flex: 1 1 auto; }
.sidebar-section { display:flex; flex:1 1 0; flex-direction:column; min-height:0; overflow:hidden; }
.sidebar-section.projects-section { flex:1 1 44%; margin-top:0; min-height:0; }
.sidebar-section.chats-section { flex:1 1 56%; margin-top:0; padding-top:0; border:0; min-height:0; }
.sidebar-section.is-collapsed { flex:0 0 auto; }
.sidebar-section .section-label {
  display:flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  min-height:22px;
  padding:0 0 2px;
  color:var(--faint);
  font-size:12px;
  font-weight:600;
  letter-spacing:0;
  text-transform:none;
}
.section-toggle {
  display:flex;
  flex:1 1 auto;
  align-items:center;
  gap:6px;
  min-height:30px;
  min-width:0;
  padding:var(--sidebar-item-pad-y) var(--sidebar-item-pad-x);
  padding-left:var(--sidebar-icon-start);
  background:transparent;
  color:inherit;
  font:inherit;
  letter-spacing:inherit;
  text-transform:inherit;
  text-align:left;
  border-radius:8px;
}
.section-toggle:hover { color:var(--text); }
.projects-section .section-label { position:relative; }
.section-toggle .section-chevron {
  display:inline-flex;
  flex:0 0 14px;
  align-items:center;
  justify-content:center;
  width:14px;
  height:14px;
  margin-left:1px;
  color:var(--faint);
  font-size:0;
  line-height:0;
  transform:rotate(0);
  transform-origin:50% 50%;
  transition:transform .16s ease,color .16s ease;
}
.section-toggle .section-chevron::before {
  content:'';
  width:5px;
  height:5px;
  border-right:1.5px solid currentColor;
  border-bottom:1.5px solid currentColor;
  transform:rotate(-45deg);
  margin-top:-1px;
}
.section-toggle:hover .section-chevron { color:var(--muted); }
.sidebar-section:not(.is-collapsed) .section-toggle .section-chevron { visibility:hidden; transform:rotate(90deg); }
.sidebar-section:not(.is-collapsed) .section-label:hover .section-toggle .section-chevron,.sidebar-section:not(.is-collapsed) .section-label:focus-within .section-toggle .section-chevron { visibility:visible; }
.sidebar-section.is-collapsed .section-toggle .section-chevron { visibility:visible; transform:rotate(0); }
.sidebar-section.is-collapsed .projects,.sidebar-section.is-collapsed .chats { display:none; }
.sidebar-section .projects,.sidebar-section .chats { flex:1 1 auto; max-height:none; min-height:0!important; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:0 var(--sidebar-item-pad-x) 6px 0; }
.sidebar-section .empty-panel { padding:6px var(--sidebar-item-pad-x) 6px var(--sidebar-icon-start)!important; color:var(--muted); font-size:11px; line-height:1.5; }
.sidebar-section .chat-row { padding-left:var(--sidebar-icon-start); padding-right:var(--sidebar-item-pad-x); }
.sidebar .chat-group-label { padding-left:var(--sidebar-icon-start); padding-right:var(--sidebar-item-pad-x); }
.chat-entry.project-entry .project-row { padding-left:0; }
.chat-entry.project-entry .project-select { padding-left:var(--sidebar-icon-start); }
.sidebar-section .section-label .icon-btn { width:26px; height:26px; border-radius:6px; }
.sidebar-section .section-label .icon-btn:hover { background:var(--hover); color:var(--text); }
.sidebar-footer { flex:0 0 auto; margin-top:auto; padding-left:var(--sidebar-rail-inset); padding-right:var(--sidebar-rail-inset); }
.sidebar-footer .account-host .nav-item { padding-left:var(--sidebar-icon-start); padding-right:var(--sidebar-item-pad-x); }
.sidebar-footer .account-host .nav-item > span:nth-child(2) { flex:1 1 auto; }
.sidebar-footer .account-host .nav-item > svg:last-child { flex:0 0 18px; width:18px; height:18px; margin-left:auto; }
.projects-section .section-label .icon-btn { opacity:0; }
.projects-section .section-label:hover .icon-btn,.projects-section .section-label:focus-within .icon-btn { opacity:1; }
.recent-actions { display:none; align-items:center; gap:4px; }
.chats-section:not(.is-collapsed) .recent-actions { display:flex; }
/* Project rows reuse chat-entry hover actions (rename / new chat / delete). */
.chat-entry.project-entry > .project-row {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 10px;
  background: transparent;
}
.chat-entry.project-entry .project-folder-toggle {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.chat-entry.project-entry .project-folder-toggle:hover,
.chat-entry.project-entry .project-folder-toggle:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.chat-entry.project-entry .project-select {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 30px;
  padding: 5px 6px 5px 2px;
  gap: 0;
  font-size: var(--sidebar-list-size);
  font-weight: var(--sidebar-list-weight);
  letter-spacing: var(--sidebar-list-tracking);
  line-height: var(--sidebar-list-line);
  color: var(--text);
  background: transparent;
  border-radius: 8px;
}
.chat-entry.project-entry .project-select:hover,
.chat-entry.project-entry .project-select.active {
  background: transparent;
}
.chat-entry.project-entry .project-select .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-entry.project-entry .project-select .icon {
  display: none;
}
.chat-entry.project-entry .chat-row-actions .icon-btn {
  width: 25px;
  height: 25px;
}
.project-chats { margin:0; padding:0; border:0; }
.project-chats .chat-row {
  padding-left: var(--sidebar-nav-text-indent);
  color: var(--muted);
  font-size: var(--sidebar-nested-list-size);
  font-weight: var(--sidebar-nested-weight);
  letter-spacing: 0;
}
.chat-group-label {
  padding: 6px var(--sidebar-item-pad-x) 2px var(--sidebar-icon-start);
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing:0;
  text-transform:none;
}
.sidebar-section .chat-entry { margin: 0; }
.sidebar-section .projects,
.sidebar-section .chats {
  font-size: var(--sidebar-list-size);
  line-height: var(--sidebar-list-line);
}
.sidebar-section .chat-row {
  min-height: 30px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: var(--sidebar-list-size);
  font-weight: var(--sidebar-list-weight);
  letter-spacing: var(--sidebar-list-tracking);
  line-height: var(--sidebar-list-line);
  white-space: nowrap;
}
.sidebar-section .chat-row-title,
.chat-entry.project-entry .project-select .name {
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}
.sidebar-section .chat-entry:hover .chat-row,.sidebar-section .chat-entry:focus-within .chat-row { padding-right:68px; }
.sidebar-section .chat-row-label { min-width:0; width:100%; }
.sidebar-section .chat-row-title { min-width:0; }
.sidebar-section .chat-row-label:has(>.thread-status-badge) .chat-row-title { padding-right:0; }
.sidebar-section .chat-row-label>.thread-status-badge {
  position:static;
  top:auto;
  right:auto;
  transform:none;
  z-index:auto;
  visibility:visible;
  opacity:1;
  pointer-events:auto;
  text-transform:none;
  letter-spacing:0;
  white-space:nowrap;
}
.sidebar-section .chat-entry:hover .chat-row-label>.thread-status-badge,
.sidebar-section .chat-entry:focus-within .chat-row-label>.thread-status-badge {
  visibility:visible;
  opacity:1;
}
.sidebar-section .chat-entry.active { background:var(--hover); }
.sidebar-section .chat-entry.active .chat-row { color:var(--text); }
.sidebar-section .chat-row-actions .icon-btn { width:22px; height:22px; }
.sidebar-section .thread-status-badge { font-size:9px; padding:1px 5px; }
.sidebar-section .thread-status-badge.thread-status-icon { padding:0; }
@media (max-height:620px) {
  .sidebar-panels { gap: 4px; }
  .sidebar-section .section-label { padding-bottom:2px; min-height:24px; }
  .sidebar-primary-nav { margin-bottom:4px; padding-bottom:4px; }
}
@media (max-width:650px) {
  .sidebar-section .section-label { padding-left:8px; padding-right:8px; }
  .chat-entry.project-entry .project-select,
  .sidebar-section .chat-row {
    font-size: var(--sidebar-list-size);
  }
}

/* Split-pane / narrow shell: layout by shell width, not viewport (media queries miss this). */
.shell.shell-compact {
  --thread-width: 100%;
  --thread-rail-width: 100%;
  grid-template-columns: minmax(0, 1fr) !important;
}
.shell.shell-compact > .sidebar {
  display: none !important;
}
.shell.shell-compact > .workbench {
  display: none !important;
}
.shell.shell-compact > .main {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}
.shell.shell-compact.show-left > .sidebar {
  display: flex !important;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(max(var(--sidebar-w, 270px), 220px), calc(100% - 36px));
  max-width: 100%;
  z-index: 10;
  box-shadow: 20px 0 70px #0005;
}
.shell.shell-compact.show-right > .workbench {
  display: flex !important;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(var(--workbench-w, 360px), calc(100% - 24px));
  max-width: calc(100% - 16px);
  z-index: 9;
  box-shadow: -20px 0 70px #0005;
}
.shell.shell-compact.show-right .workbench-resizer,
.shell.shell-compact.show-left .sidebar-resizer {
  z-index: 13;
}
.shell.shell-compact .file-preview-panel {
  top: 12px;
  left: 12px;
  right: 12px;
}
.shell.shell-phone {
  --thread-pad-x: clamp(10px, 3.2vw, 14px);
}
.shell.shell-phone .sidebar-resizer,
.shell.shell-phone .workbench-resizer {
  display: none !important;
}
.shell.shell-phone .conversation {
  padding: clamp(12px, 3vw, 16px) var(--thread-pad-x) clamp(160px, 30dvh, 220px) !important;
}
.shell.shell-phone .composer-area {
  padding: 0 var(--thread-pad-x) max(8px, env(safe-area-inset-bottom));
}
.shell.shell-phone #messages.messages,
.shell.shell-phone .composer-area > .composer-dock,
.shell.shell-phone .composer-area > .composer-note,
.shell.shell-phone .conversation > .welcome {
  width: 100%;
  max-width: 100%;
}

/* Tablet/mobile overlay panels: honor JS --workbench-w / --sidebar-w (overrides app.css fixed widths). */
.shell.show-right > .workbench {
  width: min(var(--workbench-w, 360px), calc(100dvw - 16px)) !important;
  max-width: calc(100dvw - 16px);
}
.shell.show-left > .sidebar {
  width: min(max(var(--sidebar-w, 270px), 220px), calc(100dvw - 24px)) !important;
  max-width: calc(100dvw - 16px);
  min-width: min(220px, calc(100dvw - 24px));
}
.shell.show-right .workbench-resizer,
.shell.show-left .sidebar-resizer {
  display: block;
}

/* Toasts: top-center stack, matches toast-card markup in ToastStack + legacy fallback. */
.toast-stack {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.toast-stack .toast-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 10px 9px;
  box-sizing: border-box;
  transform: translate3d(0, -10px, 0) scale(0.98);
}
.toast-stack .toast-card.in {
  opacity: 1;
  transform: none;
}
.toast-stack .toast-copy {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  text-align: center;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.toast-stack .toast-dismiss {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
}
/* Legacy broken .toast rows (if any) */
.toast-stack > .toast:not(.toast-card) {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

/* HITL approval cards: compact rectangle, viewport-safe scroll inside */
:root {
  --hitl-card-max: min(var(--thread-rail-width, 820px), calc(100vw - 40px));
  --hitl-card-max-height: min(46dvh, 400px);
  --hitl-ask-max-height: min(46dvh, 440px);
}
#hitl-dock-slot:empty { display: none; }
#hitl-dock-slot > .approval-card.hitl-card {
  width: 100%;
  max-width: none;
  margin: 0 0 10px;
  transform-origin: bottom center;
  animation: hitl-dock-enter 180ms ease-out both;
}
@keyframes hitl-dock-enter {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #hitl-dock-slot > .approval-card.hitl-card { animation: none; }
}
.messages .hitl-scroll-anchor {
  scroll-margin-bottom: min(180px, 28dvh);
}
#hitl-dock-slot .approval-card.hitl-card:not(.hitl-plan) {
  scroll-margin-top: 20px;
  scroll-margin-bottom: min(180px, 28dvh);
  display: flex;
  flex-direction: column;
  max-height: var(--hitl-card-max-height);
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  box-shadow:
    0 10px 28px #0000002a,
    0 0 0 1px color-mix(in srgb, var(--border) 80%, transparent);
  font-size: 12px;
  line-height: 1.5;
}
#hitl-dock-slot .approval-card.hitl-card .hitl-head {
  flex: 0 0 auto;
  padding: 12px 14px 8px;
}
#hitl-dock-slot .approval-card.hitl-card .hitl-head h3 {
  margin: 6px 0 4px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
#hitl-dock-slot .approval-card.hitl-card .hitl-head p {
  font-size: 11px;
  line-height: 1.45;
}
#hitl-dock-slot .approval-card.hitl-card .hitl-kicker {
  font-size: 9px;
  letter-spacing: 0.12em;
}
#hitl-dock-slot .approval-card.hitl-card .hitl-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 8px;
  padding: 0 12px 10px;
}
#hitl-dock-slot .approval-card.hitl-card .hitl-diff {
  max-height: min(28dvh, 220px);
}
#hitl-dock-slot .approval-card.hitl-card .hitl-diff-sidebyside .hitl-diff-scroll {
  max-height: min(32dvh, 260px);
}
#hitl-dock-slot .approval-card.hitl-card .hitl-actions {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  gap: 6px;
  border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
}
#hitl-dock-slot .approval-card.hitl-card .hitl-reject,
#hitl-dock-slot .approval-card.hitl-card .hitl-once,
#hitl-dock-slot .approval-card.hitl-card .hitl-turn,
#hitl-dock-slot .approval-card.hitl-card .secondary-btn {
  padding: 8px 12px;
  font-size: 11px;
}
#hitl-dock-slot .approval-card.hitl-ask {
  display: flex;
  flex-direction: column;
  max-width: var(--hitl-card-max);
  max-height: var(--hitl-ask-max-height);
  margin-inline: auto;
  border-radius: 10px;
  box-shadow:
    0 8px 22px #00000024,
    0 0 0 1px color-mix(in srgb, var(--border) 82%, transparent);
}
#hitl-dock-slot .approval-card.hitl-ask .hitl-head {
  padding: 8px 12px 4px;
}
#hitl-dock-slot .approval-card.hitl-ask .hitl-head h3 {
  margin: 4px 0 2px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}
#hitl-dock-slot .approval-card.hitl-ask .hitl-head p {
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#hitl-dock-slot .approval-card.hitl-ask .hitl-kicker {
  font-size: 8px;
  letter-spacing: 0.1em;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-tabs {
  flex: 0 0 auto;
  padding: 0 10px 6px;
  gap: 4px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-tab {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 10px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 10px 4px;
  gap: 6px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-question,
#hitl-dock-slot .approval-card.hitl-ask .ask-review {
  padding: 8px 10px;
  border-radius: 8px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-question-text {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.4;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-question header h4,
#hitl-dock-slot .approval-card.hitl-ask .ask-review h4 {
  font-size: 11px;
  line-height: 1.35;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-options {
  max-height: min(18dvh, 140px);
  overflow-y: auto;
  overscroll-behavior: contain;
  gap: 4px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option {
  min-height: 0;
  padding: 6px 8px;
  border-radius: 7px;
  gap: 2px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option-label {
  font-size: 11px;
  font-weight: 560;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option-copy {
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-other-field {
  margin-top: 6px;
  gap: 4px;
  font-size: 10px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-other-field input {
  padding: 7px 8px;
  font-size: 12px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-hint {
  padding: 0 10px 2px;
  font-size: 10px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-nav {
  flex: 0 0 auto;
  padding: 0 10px 4px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-actions {
  flex: 0 0 auto;
  padding: 6px 10px 8px;
  gap: 6px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-fallback-answer {
  display: grid;
  gap: 4px;
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 11px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-fallback-answer textarea {
  width: 100%;
  height: 56px;
  min-height: 48px;
  max-height: 96px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  box-sizing: border-box;
}
#hitl-dock-slot .approval-card.hitl-ask .hitl-reject,
#hitl-dock-slot .approval-card.hitl-ask .hitl-once {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 11px;
}
#hitl-dock-slot .approval-card.hitl-plan {
  max-height: none;
  height: 84px;
  min-height: 84px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 15px;
  background: linear-gradient(125deg,
    color-mix(in srgb, var(--accent) 14%, var(--elevated)),
    color-mix(in srgb, var(--accent) 5%, var(--surface)) 72%);
  box-shadow: 0 8px 22px #0000001c, inset 0 1px 0 color-mix(in srgb, #fff 16%, transparent);
}
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  transition: background-color 140ms ease;
}
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip > span {
  min-width: 0;
  overflow: hidden;
}
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip strong,
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip strong {
  font-size: 12px;
  font-weight: 620;
}
#hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip small {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.25;
}
#hitl-dock-slot .approval-card.hitl-plan.plan-reference {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}
#hitl-dock-slot .approval-card.hitl-plan.plan-reference > .plan-file-chip {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
}
#hitl-dock-slot .plan-reference-build {
  flex: 0 0 auto;
  align-self: center;
  min-width: 70px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: filter 140ms ease, transform 140ms ease;
}
#hitl-dock-slot .plan-reference-build:not(:disabled):hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
@media (max-width: 650px) {
  :root {
    --hitl-card-max: calc(100vw - 28px);
    --hitl-card-max-height: min(52dvh, 420px);
    --hitl-ask-max-height: min(38dvh, 340px);
  }
  #hitl-dock-slot .approval-card.hitl-card .hitl-file-copy small {
    display: none;
  }
  #hitl-dock-slot .approval-card.hitl-plan > .plan-file-chip {
    gap: 8px;
    padding-inline: 7px;
  }
  #hitl-dock-slot .plan-reference-build {
    min-width: 64px;
    padding-inline: 12px;
  }
}

/* Sidebar typography (single scale for nav, projects, and recents). */
.sidebar {
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.sidebar-primary-nav .nav-item,
.sidebar-section .chat-row,
.chat-entry.project-entry .project-select,
.sidebar-footer .account-host .nav-item {
  font-size: var(--sidebar-list-size);
  font-weight: var(--sidebar-list-weight);
  line-height: var(--sidebar-list-line);
  letter-spacing: var(--sidebar-list-tracking);
}
.project-chats .chat-row {
  font-size: var(--sidebar-nested-list-size);
  font-weight: var(--sidebar-nested-weight);
  letter-spacing: 0;
}
.sidebar-section .empty-panel {
  font-size: var(--sidebar-nested-list-size);
  line-height: 1.45;
}
.sidebar-footer .account-host .nav-item > span:nth-child(2) small {
  font-size: 11px;
  line-height: 1.35;
}

/* Welcome eyebrow: subtle time-of-day gradient (data-time-period from welcomeCopy.ts). */
.welcome h4.eyebrow {
  background-image: var(--welcome-eyebrow-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.welcome[data-time-period="night"],
.welcome[data-time-period="lateNight"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #8b9bb8 0%, #a89ad4 52%, #6e7fad 100%);
}
.welcome[data-time-period="dawn"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #c4a4b8 0%, #e8b896 55%, #d4c48a 100%);
}
.welcome[data-time-period="morning"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #d4b86a 0%, #e8d4a0 48%, #b8c992 100%);
}
.welcome[data-time-period="midday"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #9ec4b0 0%, #a8c4dc 50%, #c4d4a8 100%);
}
.welcome[data-time-period="afternoon"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #7eb8a8 0%, #8ec4b8 52%, #6a9e94 100%);
}
.welcome[data-time-period="dusk"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #d49a7a 0%, #e8b888 48%, #c4a878 100%);
}
.welcome[data-time-period="evening"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #9a8ec4 0%, #7a8ec4 45%, #6888b8 100%);
}
html[data-theme="light"] .welcome[data-time-period="night"],
html[data-theme="light"] .welcome[data-time-period="lateNight"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #4a5568 0%, #5b4d7a 52%, #3d4f72 100%);
}
html[data-theme="light"] .welcome[data-time-period="dawn"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #8a5a72 0%, #a86a48 55%, #7a7048 100%);
}
html[data-theme="light"] .welcome[data-time-period="morning"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #8a7040 0%, #9a8048 48%, #6a7848 100%);
}
html[data-theme="light"] .welcome[data-time-period="midday"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #4a7868 0%, #487090 50%, #607848 100%);
}
html[data-theme="light"] .welcome[data-time-period="afternoon"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #3a6858 0%, #488078 52%, #356858 100%);
}
html[data-theme="light"] .welcome[data-time-period="dusk"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #9a5840 0%, #a87040 48%, #806838 100%);
}
html[data-theme="light"] .welcome[data-time-period="evening"] {
  --welcome-eyebrow-gradient: linear-gradient(102deg, #5a4888 0%, #485a88 45%, #3a5080 100%);
}

/* Keyboard shortcuts dialog (Account → Help). */
dialog.dialog-shortcuts .shortcut-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
dialog.dialog-shortcuts .shortcut-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}
dialog.dialog-shortcuts .shortcut-list kbd {
  font: 500 11px/1 var(--font-mono);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

dialog.dialog-shortcuts .shortcut-note {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

dialog.dialog-help-guide .help-guide {
  display: grid;
  gap: 4px;
}
dialog.dialog-help-guide .help-guide article {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
dialog.dialog-help-guide .help-guide article:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
dialog.dialog-help-guide .help-guide-step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
dialog.dialog-help-guide .help-guide h3,
dialog.dialog-contact .help-contact h3 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 620;
  line-height: 1.4;
}
dialog.dialog-help-guide .help-guide p,
dialog.dialog-contact .help-contact > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
dialog.dialog-contact .help-contact > p {
  margin-bottom: 16px;
}
dialog.dialog-contact .help-contact .field {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 550;
}
dialog.dialog-contact .help-contact textarea {
  display: block;
  width: 100%;
  min-height: 104px;
  margin-top: 7px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}
dialog.dialog-contact .help-contact textarea:focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 1px;
}
dialog.dialog-contact .help-contact .dialog-actions {
  margin-top: 12px;
}
dialog.dialog-contact .help-contact > .help {
  margin-top: 12px;
}

@media (max-width: 520px) {
  dialog.dialog-help-guide .help-guide article {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
  }
}

/* Compact overlay scrim + panel motion (see shellLayout.ts). */
.shell-overlay-scrim {
  position: fixed;
  inset: 0;
  z-index: 8;
  border: 0;
  padding: 0;
  margin: 0;
  background: color-mix(in srgb, #000 46%, transparent);
  cursor: default;
  animation: shell-scrim-in 0.18s ease;
}
.shell-overlay-scrim:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}
@keyframes shell-scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.shell.shell-compact.show-left > .sidebar,
.shell.shell-compact.show-right > .workbench {
  animation: shell-panel-in 0.18s ease;
}
.shell.shell-compact.show-left > .sidebar {
  --shell-panel-shift: -12px;
}
.shell.shell-compact.show-right > .workbench {
  --shell-panel-shift: 12px;
}
@keyframes shell-panel-in {
  from {
    opacity: 0.94;
    transform: translateX(var(--shell-panel-shift, 0));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .shell-overlay-scrim,
  .shell.shell-compact.show-left > .sidebar,
  .shell.shell-compact.show-right > .workbench {
    animation: none;
  }
}
body.is-resizing-workspace .shell-overlay-scrim {
  pointer-events: none;
}

/* Chat headings: a modest, scannable scale that stays conversational. Markdown #, ## and ### render as
   h3 (sections), #### as h4 (sub-sections); smaller ranks stay at body size. Before, every rank was
   1em, so a long answer's sections read as bold sentences and were hard to scan. */
.message.assistant .rich-text :is(h1,h2,h3,h4,h5,h6) {
  font-size: 1em;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: normal;
  margin: 1em 0 .4em;
}
.message.assistant .rich-text :is(h1,h2,h3) {
  font-size: 1.2em;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -.01em;
  margin: 1.5em 0 .5em;
}
.message.assistant .rich-text h4 {
  font-size: 1.06em;
  line-height: 1.4;
  font-weight: 650;
  margin: 1.25em 0 .35em;
}
.message.assistant .rich-text > :first-child:is(h1,h2,h3,h4,h5,h6) { margin-top: 0; }
/* A table header follows its column: left by default, right or center when the table marks it so. */
.rich-text .rich-data-table thead th[align="right"] { text-align: right; }
.rich-text .rich-data-table thead th[align="center"] { text-align: center; }
.answer-word-reveal { animation: answer-word-reveal 150ms ease-out both; }
@keyframes answer-word-reveal { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .answer-word-reveal { animation: none; } }
.goal-card-heading h3 small { font-size: .75em; font-weight: 400; color: var(--muted); }
.composer-mode-divider{width:1px;height:19px;flex:none;background:var(--border);margin:0 2px}
.composer-mode-chip{display:inline-flex;align-items:center;gap:6px;flex:none;height:30px;padding:0 10px;border:1px solid color-mix(in srgb,var(--border) 78%,var(--text));border-radius:999px;background:color-mix(in srgb,var(--surface) 76%,var(--text));color:var(--text);font-size:11px;font-weight:600;line-height:1;white-space:nowrap;transition:background .14s ease,border-color .14s ease}
.composer-mode-chip:hover{background:var(--hover);border-color:var(--muted)}
.composer-mode-chip>svg:last-child{margin-left:2px;color:var(--muted)}
.composer-mode-chip.is-goal{border-color:color-mix(in srgb,var(--accent) 35%,var(--border))}
.composer-mode-chip:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.send.send-create-plan{display:inline-flex;align-items:center;justify-content:center;gap:7px;width:auto;min-width:0;height:32px;padding:0 13px;border-radius:999px;background:var(--accent);color:var(--accent-text);font-size:11px;font-weight:650;white-space:nowrap;box-shadow:0 3px 10px color-mix(in srgb,var(--accent) 18%,transparent);transition:filter .14s ease,transform .14s ease}
.send.send-create-plan:hover:not(:disabled){filter:brightness(1.08);transform:translateY(-1px)}
.send.send-create-plan:disabled{opacity:.48;box-shadow:none}
@media(max-width:520px){.composer-mode-divider{margin:0}.composer-mode-chip{gap:4px;padding:0 8px}.send.send-create-plan{padding:0 10px;font-size:10px}}

.link-hover-preview { position: fixed; z-index: 10000; width: min(320px, calc(100vw - 24px)); overflow: hidden; border: 1px solid #454641; border-radius: 16px; background: #2c2d2a; color: #efefec; box-shadow: 0 14px 42px #0005; font: 14px/1.5 var(--font-sans, system-ui); animation: link-preview-reveal 120ms ease-out; }
.link-hover-preview header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border-bottom:1px solid #ffffff12; }
.link-hover-preview header span, .link-hover-preview header a { display:flex; align-items:center; gap:8px; }
.link-hover-preview header span { color:#bcbdb7; min-width:0; overflow-wrap:anywhere; }
.link-hover-preview a { color:#f5f5f1; text-decoration:none; white-space:nowrap; }
.link-hover-preview a:focus-visible { outline:2px solid #94baff; outline-offset:3px; }
.link-hover-preview section { padding:12px; }
.link-hover-preview strong { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; font-weight:600; font-size:14px; }
.link-hover-preview p { margin:6px 0 0; color:#bcbdb7; overflow-wrap:anywhere; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.link-hover-image { display:block; width:100%; max-height:145px; object-fit:cover; background:#fff; }
.link-hover-path { width:max-content; max-width:min(420px, calc(100vw - 24px)); padding:10px 14px; text-align:center; overflow-wrap:anywhere; }
@keyframes link-preview-reveal { from { opacity:0; } to { opacity:1; } }
@media (prefers-reduced-motion:reduce) { .link-hover-preview { animation:none; } }

/* Keep the icon centered on the label, and the label on the sentence baseline. */
.message.assistant .rich-text a.rich-inline-link {
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  max-width: 100%;
  line-height: 1;
  vertical-align: baseline;
}
.rich-inline-link > .rich-link-icon { width: .95em; height: .95em; margin: 0; align-self: center; }
.rich-inline-link > .rich-link-label { min-width: 0; overflow-wrap: anywhere; line-height: 1; }
.rich-link-icon--site { background: transparent; }
.rich-link-icon--site[data-initial] { background: #64748b; border-radius: .22em; }

/* Plan document preview: independent controls keep opening and approval distinct. */
#hitl-dock-slot .approval-card.hitl-plan.plan-reference {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  height: auto; min-height: 0; max-height: min(42vh, 360px); padding: 14px 18px 12px;
  border-radius: 17px; background: var(--elevated); overflow: hidden;
}
.plan-preview-head, .plan-preview-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; flex:0 0 auto; }
.plan-preview-head { color:var(--muted); font-size:12px; }
.plan-preview-head > span, .plan-preview-tools, .plan-reference-build { display:inline-flex; align-items:center; gap:8px; }
.plan-preview-tools button { display:grid; place-items:center; width:30px; height:30px; padding:0; border:0; border-radius:7px; background:transparent; color:var(--muted); cursor:pointer; }
.plan-preview-tools button.plan-disclosure-toggle { display:inline-flex; align-items:center; gap:4px; width:auto; padding:0 8px; font-size:11.5px; font-weight:500; }
.plan-preview-tools button:hover { background:color-mix(in srgb,var(--accent) 10%,transparent); color:var(--text); }
.plan-preview-body { flex:1 1 auto; min-height:0; overflow-y:auto; scrollbar-width:thin; white-space:pre-wrap; }
.plan-preview-body[hidden], .plan-preview-footer[hidden] { display:none !important; }
.plan-preview-content { display:block; width:100%; max-height:none; min-height:0; margin:8px 0 10px; padding:0 4px 8px 0; overflow:visible; text-align:left; border:0; background:transparent; color:var(--text); font:inherit; cursor:pointer; mask-image:none; }
.plan-preview-content > * { display:block; }
.plan-preview-title { font-size:18px; line-height:1.35; font-weight:650; margin-bottom:13px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.plan-preview-content > b { font-size:13px; margin:10px 0 5px; }
.plan-preview-content > span, .plan-preview-content li { font-size:12px; line-height:1.65; }
.plan-preview-content ul { margin:4px 0; padding-left:18px; }
.plan-preview-footer { padding-top:10px; border-top:1px solid var(--border); color:var(--muted); font-size:10px; }
#hitl-dock-slot .plan-preview-footer .plan-reference-build { min-height:34px; min-width:80px; justify-content:center; border-radius:9px; }
.plan-preview-content:focus-visible, .plan-preview-tools button:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media(max-height:700px) {
  #hitl-dock-slot .approval-card.hitl-plan.plan-reference { max-height:min(32vh, 220px); padding:10px 14px; }
}

/* Interactive approval cards replace the composer while awaiting input. */
.composer-dock:has(#hitl-dock-slot > .hitl-card:not(.hitl-plan)) > #composer,
.composer-dock:has(#hitl-dock-slot > .hitl-card:not(.hitl-plan)) > #background-task-slot,
.composer-dock:has(#hitl-dock-slot > .hitl-card:not(.hitl-plan)) > #source-strip,
.composer-area:has(#hitl-dock-slot > .hitl-card:not(.hitl-plan)) > .composer-note {
  display: none;
}
.composer-dock:has(#hitl-dock-slot > .hitl-card:not(.hitl-plan)) > #hitl-dock-slot {
  margin-bottom: 0;
}

/* Clarifications lead with the question and use one scrolling surface. */
#hitl-dock-slot .approval-card.hitl-ask .ask-body { padding: 18px 18px 8px; }
#hitl-dock-slot .approval-card.hitl-ask .ask-question,
#hitl-dock-slot .approval-card.hitl-ask .ask-review {
  padding: 0; border: 0; background: transparent; box-shadow: none;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-question header h4 {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.45;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-selection-hint {
  margin: 5px 0 14px; font-size: 12px; line-height: 1.5; color: var(--muted);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-options {
  max-height: none; overflow: visible; gap: 7px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option {
  position: relative; padding: 11px 13px 11px 39px; min-height: 44px;
  border-radius: 10px; text-align: left;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option::before {
  content: ''; position: absolute; left: 13px; top: 14px;
  width: 15px; height: 15px; border: 1.5px solid var(--border-strong); border-radius: 50%;
  background: transparent; box-sizing: border-box;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option:hover:not(.selected) {
  border-color: var(--border-strong); background: var(--hover);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option.selected::before {
  border: 4.5px solid var(--accent); background: var(--bg);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option.selected {
  border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option:focus-visible,
#hitl-dock-slot .approval-card.hitl-ask .ask-option:has(:focus-visible) {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option-label {
  font-size: 13px; line-height: 1.45; font-weight: 600; flex-wrap: wrap; color: var(--text);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option-label em {
  font-size: 10px; font-weight: 500; font-style: normal;
  padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option-copy {
  font-size: 12px; line-height: 1.5; display: block; -webkit-line-clamp: unset;
}
.ask-tab-status {
  color: var(--muted); font-weight: 400; font-size: 11px;
}
.ask-other-hint {
  display: block; margin-top: 2px; font-size: 11px; line-height: 1.4; color: var(--muted);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-actions { padding: 10px 18px 14px; }
#hitl-dock-slot .approval-card.hitl-ask .ask-actions button {
  min-height: 36px; font-size: 12px; padding: 8px 16px; border-radius: 9px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-actions .hitl-reject {
  color: var(--muted); border-color: var(--border); background: transparent;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-tabs { padding: 14px 18px 0; }

/* Match the composer rail exactly while it is replaced by a clarification card. */
#hitl-dock-slot > .approval-card.hitl-ask {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

/* Keep HITL cards compact; a bottom fade appears only while more content is below. */
#hitl-dock-slot .approval-card.hitl-ask {
  max-height: min(40dvh, 320px);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body {
  position: relative;
  flex: 1 1 auto;
  max-height: min(25dvh, 200px);
  overflow-y: auto;
  padding: 12px 18px 6px;
  scrollbar-width: thin;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body.has-more-below::after {
  content: '';
  position: sticky;
  z-index: 1;
  bottom: 0;
  display: block;
  height: 22px;
  margin-top: -22px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--surface) 94%, transparent));
}
#hitl-dock-slot .approval-card.hitl-ask .ask-selection-hint {
  margin-bottom: 9px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option {
  padding-top: 8px;
  padding-bottom: 8px;
  min-height: 40px;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-option::before { top: 12px; }
#hitl-dock-slot .approval-card.hitl-ask .ask-actions { padding-top: 7px; padding-bottom: 9px; }

/* Fade the clipped choices themselves so the scroll affordance stays visible. */
#hitl-dock-slot .approval-card.hitl-ask .ask-body.has-more-below {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 56px), transparent 100%);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body.has-more-below::after {
  content: none;
}

/* Anchor a clear fade to the viewport edge, independently from the scrolling content. */
#hitl-dock-slot .approval-card.hitl-ask .ask-body-frame {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(25dvh, 200px);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body-frame > .ask-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow-y: auto;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body-fade {
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  bottom: 0;
  height: 58px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--elevated) 62%, transparent) 45%, var(--elevated) 100%);
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body.has-more-below {
  -webkit-mask-image: none;
  mask-image: none;
}
#hitl-dock-slot .approval-card.hitl-ask .ask-body.has-more-below::after {
  content: none;
}

#hitl-dock-slot .approval-card.hitl-ask .ask-body-frame.has-more-above .ask-body-fade-top {
  top: 0;
  bottom: auto;
  background: linear-gradient(to top, transparent 0%, color-mix(in srgb, var(--elevated) 62%, transparent) 45%, var(--elevated) 100%);
}

.plan-preview-footer { flex-wrap: wrap; }
.plan-preview-footer > span { flex: 1 1 180px; }

.plan-disclosure { border:1px solid var(--border); border-radius:14px; background:var(--surface, var(--bg)); margin-bottom:10px; overflow:hidden; }
.plan-disclosure .plan-preview-content { text-align:left; }
.plan-disclosure .plan-reference { padding:16px; margin:0; }
.plan-disclosure.is-archived { margin-top:16px; }

#hitl-dock-slot > .plan-disclosure { animation:hitl-dock-enter 180ms ease-out both; }
@media (prefers-reduced-motion: reduce) { #hitl-dock-slot > .plan-disclosure { animation:none; } }

.plan-reference:has(.plan-disclosure-toggle[aria-expanded="false"]) { cursor:pointer; }

/* File attachment and conversation organization feedback. */
.composer-drop-message{display:none;padding:12px;color:var(--accent);font-size:12px;font-weight:600;pointer-events:none}
#composer.drop-target .composer-drop-message{display:block}
.thread-drop-zone{position:relative;min-height:4px}
.thread-drop-zone.drag-over{outline:2px solid var(--accent);outline-offset:-2px;border-radius:8px;background:var(--hover)}
.thread-drop-zone:has(>.chat-entry).drag-over{border-top:3px solid var(--accent);outline:none}
.thread-drop-hint{display:none;padding:10px 12px;color:var(--muted);font-size:11px;min-height:32px;border:1px dashed var(--border);border-radius:8px;margin-top:8px}
/* Shown only while a conversation is being dragged, so the sidebar is not cluttered at rest. */
body[data-thread-dragging="true"] .thread-drop-hint{display:block}
.thread-move-status{display:block;padding:4px 8px;font-size:11px;color:var(--muted)}

/* Conversation titles and indicators share a stable right edge. A long title fades at the edge and
   scrolls only while hovered or keyboard-focused: after a click the row keeps focus, and a title that
   kept scrolling showed the active chat cut mid-word. */
.sidebar-section .chat-row,.sidebar-section .chat-row-title { text-overflow:clip; }
.sidebar-section .chat-row-title { padding-right:0; }
.chat-row-title-content { display:inline-block; white-space:nowrap; }
.chat-row-title[data-overflow="true"] { mask-image:linear-gradient(to right,#000 calc(100% - 14px),transparent); }
.chat-entry:hover .chat-row-title[data-overflow="true"],.chat-entry:has(>.chat-row:focus-visible) .chat-row-title[data-overflow="true"] { mask-image:linear-gradient(to right,transparent,#000 10px,#000 calc(100% - 14px),transparent); }
.chat-entry:hover .chat-row-title[data-overflow="true"] .chat-row-title-content,.chat-entry:has(>.chat-row:focus-visible) .chat-row-title[data-overflow="true"] .chat-row-title-content { animation:thread-title-scroll var(--title-duration,6s) linear infinite alternate; }
@keyframes thread-title-scroll { 0%,15% { transform:translateX(0); } 85%,100% { transform:translateX(var(--title-travel,0)); } }
.thread-indicator { position:absolute; right:8px; top:50%; transform:translateY(-50%); width:14px; height:14px; display:flex; align-items:center; justify-content:center; color:var(--muted); z-index:3; }
.thread-indicator-input::before,.thread-indicator-unread::before { content:""; width:7px; height:7px; border-radius:50%; background:#d5aa36; }
.thread-indicator-unread::before { background:#5ca46a; }
.thread-indicator-failed { color:var(--error); }
.thread-indicator-handoff { color:#d5aa36; }
.thread-indicator-processing .thread-status-spin { width:12px; height:12px; border:2px solid color-mix(in srgb,var(--text) 20%,transparent); border-top-color:var(--text); border-radius:50%; animation:attach-spin .75s linear infinite; }
.sidebar-section .chat-entry:has(>.thread-indicator) .chat-row { padding-right:28px; }
.sidebar-section .chat-entry:hover .chat-row,.sidebar-section .chat-entry:focus-within .chat-row { padding-right:60px; }
.sidebar-section .chat-entry:has(>.thread-indicator):hover .chat-row,.sidebar-section .chat-entry:has(>.thread-indicator):focus-within .chat-row { padding-right:80px; }
.sidebar-section .chat-entry:has(>.thread-indicator) .chat-row-actions { right:24px; }
#chat-title { cursor:text; text-overflow:clip; }
#chat-title:focus-visible,.thread-indicator:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
@media (prefers-reduced-motion:reduce) {
  .chat-entry:hover .chat-row-title[data-overflow="true"] .chat-row-title-content,.chat-entry:has(>.chat-row:focus-visible) .chat-row-title[data-overflow="true"] .chat-row-title-content { animation:none; }
}

.unsent-request-notice {
  margin: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #c8cec1);
  border-radius: 12px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.unsent-request-notice p { margin: 0 0 8px; }
.unsent-request-notice button { margin: 0 6px 4px 0; }

/* No content-visibility on conversation rows: skipped rows painted late while scrolling (for seconds on some
   browsers), so answers showed blank beside their user bubbles. History arrives in pages of 40, so the DOM stays small. */

/* Problems, queue status and unsent requests read as an assistant reply in the conversation (Codex style). */
.message.assistant.conversation-notice { padding: 8px 0; color: var(--text); max-width: min(100%, 720px); overflow-wrap: anywhere; }
.message.assistant.conversation-notice p { margin: 0; line-height: 1.7; }
.conversation-notice-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- Rich answers (src/shell/AnswerBlocks.tsx) ---------- */
:root{--code-bg:#0e0e11;--code-head:#16161a;--syn-keyword:#c792ea;--syn-string:#a5d6a7;--syn-number:#f78c6c;--syn-comment:#6b7280;--syn-title:#82aaff;--syn-attr:#ffcb6b;--syn-built:#89ddff;--syn-add:#2ea04326;--syn-del:#f8514926;--tone-info:#60a5fa;--tone-success:#34d399;--tone-warning:#fbbf24;--tone-danger:#f87171}
html[data-theme=light]{--code-bg:#f7f7f9;--code-head:#efeff3;--syn-keyword:#8b3fd1;--syn-string:#257a3e;--syn-number:#b45309;--syn-comment:#8a8f98;--syn-title:#1d5fd1;--syn-attr:#a1580a;--syn-built:#0e7490;--syn-add:#1a7f3726;--syn-del:#cf222e1f;--tone-info:#2563eb;--tone-success:#15803d;--tone-warning:#b45309;--tone-danger:#b91c1c}
.rich-text .answer-code{margin:12px 0 16px;border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--code-bg)}
.answer-code-head{display:flex;align-items:center;gap:10px;min-height:34px;padding:0 6px 0 12px;background:var(--code-head);border-bottom:1px solid var(--border);font-size:11px;color:var(--muted)}
.answer-code-lang{font-weight:600;letter-spacing:.02em;color:var(--text)}
.answer-code-lines{color:var(--faint)}
.answer-code-copy{margin-left:auto;display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border-radius:7px;background:transparent;color:var(--muted);font-size:11px}
.answer-code-copy:hover{color:var(--text)}
/* The generic .rich-text pre cap (max-height, overscroll contain) made an opened block stay 468px tall, cut off and
   wheel-trapped; a settled code block takes its full height and hands vertical scrolling to the page. */
.rich-text .answer-code pre.answer-code-body{margin:0;padding:12px 14px;border:0;border-radius:0;background:transparent;white-space:pre;overflow-x:auto;overflow-y:hidden;max-height:none;overscroll-behavior:auto;tab-size:2}
/* Only a block still streaming scrolls inside itself; a settled long block folds instead (no wheel trap). */
.rich-text .answer-code[data-streaming] pre.answer-code-body{overflow-y:auto;max-height:min(60dvh,560px);overscroll-behavior:contain}
.rich-text .answer-code[data-folded] pre.answer-code-body{max-height:calc(24 * 12.5px * 1.65 + 12px);-webkit-mask-image:linear-gradient(to bottom,#000 70%,transparent);mask-image:linear-gradient(to bottom,#000 70%,transparent)}
.answer-code-fold{display:block;width:100%;padding:7px 12px;border:0;border-top:1px solid var(--border);border-radius:0;background:var(--code-head);color:var(--muted);font-size:11.5px;font-weight:550;text-align:center}
.answer-code-fold:hover{color:var(--text)}
.answer-code-fold:focus-visible{outline:2px solid var(--accent,#7dd3fc);outline-offset:-2px}
/* Mermaid diagrams in answers */
.rich-text .answer-diagram{margin:12px 0 16px;border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--code-bg)}
.answer-code-lang svg{vertical-align:-2px;margin-right:4px}
.answer-diagram-actions{margin-left:auto;display:inline-flex;align-items:center;gap:2px}
.answer-diagram-actions .answer-code-copy{margin-left:0}
.answer-diagram-canvas{display:flex;justify-content:center;padding:18px 16px;overflow:auto;max-height:min(75dvh,760px)}
.answer-diagram-canvas svg{max-width:100%;height:auto}
.answer-diagram-canvas.is-drawing{min-height:120px;align-items:center;color:var(--faint);font-size:12.5px}
.rich-text .answer-diagram pre.answer-diagram-source{margin:0;padding:12px 14px;border:0;border-radius:0;background:transparent;white-space:pre;overflow:auto;max-height:min(60dvh,560px);font-size:12.5px}
.answer-diagram-error{margin:0;padding:8px 14px;border-bottom:1px solid var(--border);color:var(--warning,#f59e0b);font-size:12px}
.rich-text .answer-code pre.answer-code-body code{display:block;padding:0;background:none;border-radius:0;font:12.5px/1.65 var(--font-mono);color:var(--text)}
.hljs-keyword,.hljs-selector-tag,.hljs-meta .hljs-keyword,.hljs-doctag{color:var(--syn-keyword)}
.hljs-string,.hljs-regexp,.hljs-template-string,.hljs-meta .hljs-string{color:var(--syn-string)}
.hljs-number,.hljs-literal,.hljs-symbol,.hljs-bullet{color:var(--syn-number)}
.hljs-comment,.hljs-quote{color:var(--syn-comment);font-style:italic}
.hljs-title,.hljs-title.function_,.hljs-section,.hljs-name{color:var(--syn-title)}
.hljs-attr,.hljs-attribute,.hljs-variable,.hljs-template-variable,.hljs-property,.hljs-params{color:var(--syn-attr)}
.hljs-built_in,.hljs-type,.hljs-title.class_,.hljs-selector-class,.hljs-selector-id,.hljs-tag{color:var(--syn-built)}
.hljs-addition{display:inline-block;width:100%;background:var(--syn-add)}
.hljs-deletion{display:inline-block;width:100%;background:var(--syn-del)}
.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}

/* Inline code, headings, lists and rules read like a finished document. */
.message.assistant .rich-text :not(pre)>code{padding:1.5px 6px;border:1px solid color-mix(in srgb,var(--border) 70%,transparent);border-radius:6px;background:color-mix(in srgb,var(--text) 6%,transparent);font-size:.86em;white-space:break-spaces;overflow-wrap:anywhere;-webkit-box-decoration-break:clone;box-decoration-break:clone}
.message.assistant .rich-text h3{padding-top:2px}
.message.assistant .rich-text h3+p,.message.assistant .rich-text h4+p{margin-top:2px}
.message.assistant .rich-text ul>li::marker{color:var(--faint)}
.message.assistant .rich-text ol>li::marker{color:var(--muted);font-variant-numeric:tabular-nums;font-weight:600}
.message.assistant .rich-text li+li{margin-top:3px}
.message.assistant .rich-text hr{border:0;height:1px;margin:18px 0;background:linear-gradient(90deg,transparent,var(--border) 12%,var(--border) 88%,transparent)}
.message.assistant .rich-text strong{font-weight:640;color:var(--text)}
.rich-task-box{vertical-align:-3px;margin-right:6px;color:var(--faint)}
.rich-task-box.is-done{color:var(--tone-success)}
.rich-text li:has(>.rich-task-box),.rich-text li:has(>p>.rich-task-box){list-style:none;margin-left:-1.15em}

/* Agent UI catalog */
.agent-ui{display:grid;gap:10px;margin:12px 0 16px}
.agent-ui-pending{display:inline-flex;align-items:center;gap:8px;margin:10px 0;padding:9px 12px;border:1px dashed var(--border);border-radius:10px;color:var(--muted);font-size:12px}
.agent-ui .rich-inline p{display:inline;margin:0}
.agent-ui-callout{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;align-items:start;margin:12px 0;padding:11px 14px;border:1px solid color-mix(in srgb,var(--tone,var(--tone-info)) 34%,var(--border));border-radius:11px;background:color-mix(in srgb,var(--tone,var(--tone-info)) 8%,var(--surface));color:var(--text)}
.agent-ui .agent-ui-callout{margin:0}
.agent-ui-callout.tone-info{--tone:var(--tone-info)}.agent-ui-callout.tone-success{--tone:var(--tone-success)}.agent-ui-callout.tone-warning{--tone:var(--tone-warning)}.agent-ui-callout.tone-danger{--tone:var(--tone-danger)}
.agent-ui-callout-icon{margin-top:2px;color:var(--tone)}
/* Only the callout's own title is a block; bold inside its body stays inline. */
.agent-ui-callout > div > strong{display:block;font-size:13px;font-weight:650;margin-bottom:2px}
.agent-ui-callout-body,.agent-ui-callout-body p{font-size:13px;line-height:1.6;color:color-mix(in srgb,var(--text) 88%,var(--muted))}
.agent-ui-callout-body>div>p:last-child{margin-bottom:0}
.agent-ui-steps,.agent-ui-files{border:1px solid var(--border);border-radius:12px;background:var(--surface);overflow:hidden}
.agent-ui-steps header,.agent-ui-files header{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:9px 14px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--text) 3%,transparent)}
.agent-ui-steps header strong,.agent-ui-files header strong{font-size:12.5px;font-weight:650}
.agent-ui-steps header span,.agent-ui-files header span{font-size:11px;color:var(--faint);font-variant-numeric:tabular-nums}
.agent-ui-steps ol{list-style:none;margin:0;padding:6px 0}
.agent-ui-steps li{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;padding:7px 14px}
.agent-ui-steps li:not(:last-child)::after{content:"";position:absolute;left:21px;top:27px;bottom:-7px;width:1px;background:var(--border)}
.agent-ui-step-icon{margin-top:2px;color:var(--faint);position:relative;z-index:1;background:var(--surface);border-radius:50%}
.agent-ui-steps li.is-done .agent-ui-step-icon{color:var(--tone-success)}
.agent-ui-steps li.is-active .agent-ui-step-icon{color:var(--accent);animation:attach-spin 1.4s linear infinite}
.agent-ui-steps li.is-failed .agent-ui-step-icon{color:var(--tone-danger)}
.agent-ui-step-title{display:block;font-size:13px;font-weight:560;line-height:1.45}
.agent-ui-step-detail{display:block;margin-top:2px;font-size:12px;line-height:1.5;color:var(--muted)}
.agent-ui-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px}
.agent-ui-metric{display:flex;flex-direction:column;gap:3px;padding:12px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
.agent-ui-metric-label{font-size:12px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--faint)}
.agent-ui-metric-value{font-size:21px;font-weight:650;letter-spacing:-.02em;line-height:1.2;font-variant-numeric:tabular-nums}
.agent-ui-metric-delta{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;color:var(--muted)}
.agent-ui-metric.tone-up .agent-ui-metric-delta{color:var(--tone-success)}.agent-ui-metric.tone-down .agent-ui-metric-delta{color:var(--tone-danger)}
.agent-ui-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px}
.agent-ui-card{padding:12px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface);transition:border-color .16s ease}
.agent-ui-card:hover{border-color:color-mix(in srgb,var(--accent) 40%,var(--border))}
.agent-ui-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
.agent-ui-card-head strong{font-size:13px;font-weight:650;line-height:1.4}
.agent-ui-tag{flex:none;padding:2px 7px;border-radius:999px;font-size:10px;font-weight:600;color:var(--accent);background:color-mix(in srgb,var(--accent) 13%,transparent)}
.agent-ui-card-body{margin-top:5px;font-size:12.5px;line-height:1.55;color:var(--muted)}
.agent-ui-kv{display:grid;margin:0;border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--surface)}
.agent-ui-kv>div{display:grid;grid-template-columns:minmax(110px,32%) minmax(0,1fr);gap:12px;padding:8px 14px}
.agent-ui-kv>div+div{border-top:1px solid var(--border)}
.agent-ui-kv dt{font-size:12px;font-weight:600;color:var(--muted)}
.agent-ui-kv dd{margin:0;font-size:13px;overflow-wrap:anywhere}
.agent-ui-files ul{list-style:none;margin:0;padding:4px 0}
.agent-ui-files li{display:grid;grid-template-columns:auto minmax(0,max-content) minmax(0,1fr);align-items:center;gap:9px;padding:6px 14px}
.agent-ui-files li svg{color:var(--muted)}
.agent-ui-files li.is-added svg{color:var(--tone-success)}.agent-ui-files li.is-deleted svg{color:var(--tone-danger)}.agent-ui-files li.is-modified svg{color:var(--tone-warning)}
.agent-ui-files li code{font:12px/1.4 var(--font-mono);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:none!important;border:0!important;padding:0!important}
.agent-ui-file-summary{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.agent-ui-progress{padding:12px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
.agent-ui-progress-head{display:flex;justify-content:space-between;font-size:12.5px;margin-bottom:8px}
.agent-ui-progress-head strong{font-variant-numeric:tabular-nums}
.agent-ui-progress-track{height:6px;border-radius:999px;background:color-mix(in srgb,var(--text) 10%,transparent);overflow:hidden}
.agent-ui-progress-track span{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,color-mix(in srgb,var(--accent) 70%,#fff0),var(--accent));transition:width .4s ease}
.agent-ui-table{margin:0}
@media(max-width:560px){.agent-ui-files li{grid-template-columns:auto minmax(0,1fr)}.agent-ui-file-summary{grid-column:2;white-space:normal}.agent-ui-kv>div{grid-template-columns:minmax(0,1fr);gap:2px}.agent-ui-metric-value{font-size:18px}}
@media(prefers-reduced-motion:reduce){.agent-ui-steps li.is-active .agent-ui-step-icon{animation:none}}
/* Agent UI charts */
/* Chart series colors: neighbors are distinct hues (blue, orange, green, pink, purple, cyan, yellow, red),
   the way Tableau and Observable order them. The second color was another blue, so two-series bar charts
   and donuts read as one color. */
:root{--chart-0:var(--accent);--chart-1:#fb923c;--chart-2:#34d399;--chart-3:#f472b6;--chart-4:#a78bfa;--chart-5:#22d3ee;--chart-6:#facc15;--chart-7:#f87171}
html[data-theme=light]{--chart-0:var(--accent-hover);--chart-1:#ea7a2f;--chart-2:#059669;--chart-3:#db2777;--chart-4:#7c3aed;--chart-5:#0891b2;--chart-6:#ca8a04;--chart-7:#dc2626}
.agent-chart{margin:0;padding:12px 14px 10px;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
.agent-chart-title{margin-bottom:6px;font-size:12.5px;font-weight:650}
.agent-chart-unit{display:block;margin-top:2px;color:var(--faint);font-size:11.5px;font-weight:450}
.agent-chart-body{display:grid;gap:8px}
.agent-chart-body.is-pie{grid-template-columns:minmax(150px,240px) minmax(0,1fr);align-items:center}
.agent-chart-svg{display:block;width:100%;height:auto;overflow:visible;font-family:inherit}
.agent-chart-grid line{stroke:var(--border);stroke-dasharray:3 4}
.agent-chart-grid text,.agent-chart-xlabel{fill:var(--faint);font-size:11px;font-variant-numeric:tabular-nums}
.agent-chart-axis{stroke:color-mix(in srgb,var(--text) 28%,transparent)}
.agent-chart-series.s-0{--c:var(--chart-0)}.agent-chart-series.s-1{--c:var(--chart-1)}.agent-chart-series.s-2{--c:var(--chart-2)}.agent-chart-series.s-3{--c:var(--chart-3)}.agent-chart-series.s-4{--c:var(--chart-4)}
.agent-chart-series rect{fill:var(--c);opacity:.92;transition:opacity .15s ease}
.agent-chart-series rect:hover{opacity:1}
.agent-chart-line{fill:none;stroke:var(--c);stroke-width:2.2;stroke-linejoin:round;stroke-linecap:round}
.agent-chart-area{fill:var(--c);opacity:.16}
.agent-chart-series circle{fill:var(--surface);stroke:var(--c);stroke-width:2}
.agent-chart-slice{stroke:var(--surface);stroke-width:2;transition:opacity .15s ease}
.agent-chart-slice:hover{opacity:.85}
.agent-chart-slice.s-0,.agent-chart-swatch.s-0{fill:var(--chart-0);background:var(--chart-0)}.agent-chart-slice.s-1,.agent-chart-swatch.s-1{fill:var(--chart-1);background:var(--chart-1)}.agent-chart-slice.s-2,.agent-chart-swatch.s-2{fill:var(--chart-2);background:var(--chart-2)}.agent-chart-slice.s-3,.agent-chart-swatch.s-3{fill:var(--chart-3);background:var(--chart-3)}.agent-chart-slice.s-4,.agent-chart-swatch.s-4{fill:var(--chart-4);background:var(--chart-4)}.agent-chart-slice.s-5,.agent-chart-swatch.s-5{fill:var(--chart-5);background:var(--chart-5)}.agent-chart-slice.s-6,.agent-chart-swatch.s-6{fill:var(--chart-6);background:var(--chart-6)}.agent-chart-slice.s-7,.agent-chart-swatch.s-7{fill:var(--chart-7);background:var(--chart-7)}
.agent-chart-total{fill:var(--text);font-size:20px;font-weight:650}
.agent-chart-total-label{fill:var(--muted);font-size:11px;font-weight:500;letter-spacing:.02em}
.agent-chart-legend{display:flex;flex-wrap:wrap;gap:6px 14px;margin:0;padding:0;list-style:none;font-size:11.5px;color:var(--muted)}
.agent-chart-body.is-pie .agent-chart-legend{flex-direction:column}
.agent-chart-legend li{display:flex;align-items:center;gap:7px}
.agent-chart-legend strong{margin-left:auto;padding-left:10px;color:var(--text);font-variant-numeric:tabular-nums;font-weight:600}
.agent-chart-swatch{width:9px;height:9px;border-radius:3px;flex:none}
@media(max-width:560px){.agent-chart-body.is-pie{grid-template-columns:minmax(0,1fr)}.agent-chart-grid text,.agent-chart-xlabel{font-size:13px}}
/* A plan card in the transcript sits evenly between the answer above and the next message:
   the answer's own bottom padding is the gap above, and the gap below matches answer → user. */
.messages > .message.assistant:has(+ .plan-disclosure) { margin-bottom:0; }
.messages > .plan-disclosure, .messages > .plan-disclosure.is-archived { margin-top:0; margin-bottom:22px; }

/* Map and gallery answer blocks (MediaBlocks.tsx) */
.agent-map,.agent-gallery{margin:0;padding:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
.agent-map-title,.agent-gallery-title{display:flex;align-items:center;gap:6px;margin:0 0 10px;font-weight:600;font-size:13px}
.agent-map-frame{position:relative;border-radius:10px;overflow:hidden;border:1px solid var(--border);background:var(--elevated)}
.agent-map-svg{display:block;width:100%;height:auto}
.agent-map-water{fill:color-mix(in srgb,var(--elevated) 70%,#9ec9e6)}
.agent-map-pin path{fill:var(--accent);stroke:#0A0A0C;stroke-width:1.5;transition:transform .12s ease}
.agent-map-pin text{fill:#0A0A0C;font:700 11px var(--font-ui);pointer-events:none}
.agent-map-pin{cursor:default}
.agent-map-pin.is-active path{fill:#fff;transform:scale(1.15)}
.agent-map-zoom{position:absolute;top:8px;right:8px;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--surface)}
.agent-map-zoom button{display:grid;place-items:center;width:28px;height:28px;border:0;background:transparent;color:var(--text);cursor:pointer}
.agent-map-zoom button+button{border-top:1px solid var(--border)}
.agent-map-zoom button:hover:not(:disabled){background:var(--hover)}
.agent-map-zoom button:disabled{opacity:.4;cursor:default}
.agent-map-attribution{position:absolute;right:0;bottom:0;padding:1px 6px;font-size:10px;color:#333;background:rgba(255,255,255,.8);border-top-left-radius:6px;text-decoration:none}
.agent-map-places{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:4px 12px;margin:10px 0 0;padding:0;list-style:none}
.agent-map-places li{display:flex;gap:8px;align-items:flex-start;padding:4px 6px;border-radius:8px}
.agent-map-places li.is-active{background:var(--hover)}
.agent-map-num{flex:none;display:grid;place-items:center;width:18px;height:18px;border-radius:50%;background:var(--accent);color:#0A0A0C;font-size:11px;font-weight:700}
.agent-map-name{display:flex;flex-direction:column;min-width:0;font-size:13px}
.agent-map-name small{color:var(--muted);font-size:12px}
.agent-map-foot,.agent-gallery-foot{margin:8px 0 0;font-size:12px;color:var(--muted)}
.agent-map-foot a{display:inline-flex;align-items:center;gap:3px}
.agent-gallery-grid{display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.agent-gallery-grid.count-1{grid-template-columns:minmax(0,420px)}
.agent-gallery-grid.count-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.agent-gallery-item{margin:0;min-width:0}
.agent-gallery-item button{display:block;width:100%;padding:0;border:1px solid var(--border);border-radius:10px;overflow:hidden;background:var(--elevated);cursor:zoom-in;aspect-ratio:4/3}
.agent-gallery-item button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.agent-gallery-item img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .2s ease}
.agent-gallery-item button:hover img{transform:scale(1.03)}
.agent-gallery-item figcaption{margin-top:4px;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.agent-gallery-skeleton{display:block;width:100%;height:100%;background:linear-gradient(90deg,var(--elevated),var(--hover),var(--elevated));background-size:200% 100%;animation:agent-gallery-shimmer 1.2s linear infinite}
.agent-gallery-skeleton.is-large{width:min(70vw,720px);height:min(60vh,480px);border-radius:10px}
@keyframes agent-gallery-shimmer{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.agent-gallery-skeleton{animation:none}.agent-gallery-item img{transition:none}}
.agent-lightbox{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:24px;background:rgba(0,0,0,.82)}
.agent-lightbox-body{position:relative;display:flex;flex-direction:column;align-items:center;max-width:min(1100px,100%);max-height:100%}
.agent-lightbox-body img{max-width:100%;max-height:calc(100vh - 140px);border-radius:10px;object-fit:contain;background:#111}
.agent-lightbox-caption{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline;justify-content:center;margin-top:10px;color:#fff;font-size:13px;text-align:center}
.agent-gallery-credit{color:#c8c8cc;font-size:12px}
.agent-gallery-credit a,.agent-lightbox-caption a{color:#fff}
.agent-lightbox-count{color:#c8c8cc;font-size:12px}
.agent-lightbox-close,.agent-lightbox-nav{position:absolute;display:grid;place-items:center;border:0;border-radius:50%;background:rgba(20,20,24,.75);color:#fff;cursor:pointer}
.agent-lightbox-close{top:-12px;right:-12px;width:32px;height:32px}
.agent-lightbox-nav{top:calc(50% - 40px);width:40px;height:40px}
.agent-lightbox-nav.is-prev{left:8px}.agent-lightbox-nav.is-next{right:8px}
.agent-lightbox-close:hover,.agent-lightbox-nav:hover{background:rgba(60,60,66,.9)}
@media (max-width:640px){.agent-lightbox{padding:12px}.agent-lightbox-close{top:4px;right:4px}.agent-gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.composer-slash-tag{margin-left:6px;padding:0 5px;border:1px solid var(--border);border-radius:4px;font-size:10px;font-style:normal;color:var(--muted);vertical-align:1px}
.agent-gallery:has(.agent-gallery-grid:empty){display:none}
/* While a turn is still working, its activity runs down to just above the composer:
   the end-of-chat spacing (kept for finished answers) shrinks, and the timeline uses the room. */
#conversation.conversation:has(#messages > .assistant-pending:last-child) { padding-bottom: 12px !important; }
/* #messages carries its padding inline (room for the jump pill); while working the pill sits over the fade instead. */
#conversation #messages:has(> .assistant-pending:last-child) { padding-bottom: 16px !important; }
#messages > .assistant-pending:last-child { margin-bottom: 0; }
#messages > .assistant-pending:last-child .awb-timeline { max-height: max(280px, calc(100dvh - 230px)) !important; }

/* Inline audio and video for media the app serves (RichMedia.tsx). One card: the player, then a quiet
   bar with the file name and a download button. */
.rich-media-link { display: block; }
.rich-media { display: flex; flex-direction: column; width: 100%; max-width: 640px; margin: 10px 0 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.rich-media--video .rich-media-element { display: block; width: 100%; max-height: 420px; background: #000; }
.rich-media--audio { max-width: 520px; }
.rich-media--audio .rich-media-element { display: block; width: 100%; height: 44px; padding: 10px 10px 4px; box-sizing: content-box; max-width: calc(100% - 20px); }
.rich-media-bar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px 8px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.4; }
.rich-media--audio .rich-media-bar { border-top: 0; padding-top: 2px; }
.rich-media-icon { flex: 0 0 auto; }
.rich-media-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 520; }
.rich-media-download { display: inline-grid; place-items: center; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.rich-media-download:hover { background: var(--surface-hover, color-mix(in srgb, var(--text) 6%, transparent)); color: var(--text); }
.rich-media-download:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rich-media-error { display: block; padding: 14px 12px; color: var(--muted); font-size: 12.5px; }
/* Answer images: a framed, bounded figure rather than a raw full-width bitmap. */
.message.assistant .rich-text img:not(.rich-site-favicon):not(.link-hover-image):not(.rich-link-icon img) { display: block; max-width: 100%; max-height: 520px; width: auto; height: auto; margin: 10px 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
/* Plain (untracked) steps: numbered badges instead of status icons. */
.agent-ui-steps.is-plain .agent-ui-step-number { display: inline-grid; place-items: center; flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); font-size: 11px; font-weight: 650; line-height: 1; }
/* A group of progress bars under one title. */
.agent-ui-progress-group { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.agent-ui-progress-group .agent-ui-progress { padding: 0; border: 0; background: transparent; margin: 0; }
.agent-ui-progress-title { font-size: 13px; font-weight: 650; color: var(--text); }
/* A comparison block's title sits above its table, left-aligned like a chart title. */
.agent-ui-table-caption { caption-side: top; text-align: left; padding: 11px 14px 9px; font-size: 13px; font-weight: 650; color: var(--text); border-bottom: 1px solid var(--border); }
