/* ==========================================================================
   turnstone server UI — page-specific styles
   Design tokens, reset, shared components live in /shared/base.css
   ========================================================================== */

/* ==========================================================================
   Header — server-specific elements
   ========================================================================== */
#mcp-status {
  color: var(--magenta);
  font-size: 11px;
  font-family: var(--font-mono);
  opacity: 0;
  transition: opacity 0.3s;
  cursor: default;
}
#health-indicator {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 8px;
  font-family: var(--font-mono);
  transition:
    opacity 0.3s ease,
    background 0.3s ease;
}
#health-indicator.health-ok {
  opacity: 0;
  pointer-events: none;
}
#health-indicator.health-degraded {
  background: var(--accent);
  color: var(--bg);
  opacity: 1;
}
.skip-permissions-warning {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--yellow);
  padding: 2px 8px;
  border: 1px solid var(--yellow);
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Theme toggle
   ========================================================================== */
#theme-toggle {
  color: var(--fg);
  margin-left: auto;
  font-size: 14px;
  line-height: 1;
}

/* ==========================================================================
   Mobile overrides
   ========================================================================== */
@media (max-width: 600px) {
  .ws-tab .tab-chevron {
    opacity: 1;
    padding: 8px 10px;
    font-size: 14px;
    min-width: 36px;
    min-height: 36px;
  }
  .ws-tab-dropdown-item.mobile-hide {
    display: none;
  }
  #split-btn {
    display: none;
  }
  .tab-wsid {
    display: none;
  }
}

/* ==========================================================================
   Tab bar
   ========================================================================== */
#tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
#tab-list {
  display: flex;
  align-items: center;
  gap: 2px;
}
#tab-bar::-webkit-scrollbar {
  height: 3px;
}
#tab-bar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.ws-tab {
  padding: 6px 10px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  color: var(--fg-dim);
  white-space: nowrap;
  user-select: none;
  position: relative;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
}
.ws-tab:hover {
  background: var(--bg-highlight);
  color: var(--fg-bright);
}
.ws-tab.active {
  background: var(--bg-highlight);
  color: var(--fg-bright);
  border-bottom: 2px solid var(--accent);
}

/* Tab state indicators — LED glow */
.ws-tab .tab-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-tab .tab-indicator[data-state="idle"] {
  background: var(--fg-dim);
  opacity: 0.3;
}
.ws-tab .tab-indicator[data-state="thinking"] {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
  animation: pulse 1.5s ease-in-out infinite;
  will-change: opacity;
}
.ws-tab .tab-indicator[data-state="running"] {
  background: var(--green);
  border-radius: 2px;
  box-shadow: 0 0 6px var(--green-glow);
  animation: pulse 1s ease-in-out infinite;
  will-change: opacity;
}
.ws-tab .tab-indicator[data-state="attention"] {
  background: var(--yellow);
  border-radius: 1px;
  transform: rotate(45deg);
  box-shadow: 0 0 6px var(--yellow-glow);
  animation: pulse 1s ease-in-out infinite;
  will-change: opacity;
}
.ws-tab .tab-indicator[data-state="error"] {
  background: var(--red);
  box-shadow: 0 0 4px var(--red-glow);
}

.ws-tab .tab-chevron {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.1s,
    background 0.1s;
  border-radius: var(--radius-sm);
  margin-right: -4px;
}
.ws-tab:hover .tab-chevron,
.ws-tab:focus-within .tab-chevron,
.ws-tab .tab-chevron:focus-visible {
  opacity: 1;
}
.ws-tab.active .tab-chevron {
  opacity: 0.7;
}
.ws-tab .tab-chevron[aria-expanded="true"] {
  opacity: 1;
  color: var(--fg-bright);
}
.ws-tab .tab-chevron:hover {
  color: var(--fg-bright);
  background: rgba(255, 255, 255, 0.06);
}

/* Subtle ws_id badge in tabs */
.tab-wsid {
  font-size: 9px;
  color: var(--fg-dim);
  opacity: 0;
  margin-left: 4px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.02em;
  transition: opacity 0.15s;
}
.ws-tab:hover .tab-wsid,
.ws-tab.active .tab-wsid {
  opacity: 0.45;
}

/* .card-wsid moved to /shared/cards.css (with vertical-align added so it
   aligns with .card-meta).  Single source for both surfaces. */

#new-tab-btn {
  background: none;
  border: 1px dashed var(--border-strong);
  color: var(--fg-dim);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
#new-tab-btn:hover {
  background: var(--bg-highlight);
  color: var(--accent);
  border-color: var(--accent);
}

#split-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--fg-dim);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 6px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
  margin-left: 2px;
}
#split-btn:hover {
  background: var(--bg-highlight);
  color: var(--accent);
  border-color: var(--accent);
}
#split-btn.hidden {
  display: none;
}

/* Tab dropdown menu */
@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ws-tab-dropdown {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 300;
  overflow: hidden;
  padding: 4px 0;
  animation: dropdown-in 0.1s ease-out;
}
[data-theme="light"] .ws-tab-dropdown {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.ws-tab-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--fg);
  font: inherit;
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.1s;
}
.ws-tab-dropdown-item:hover:not([aria-disabled="true"]) {
  background: var(--bg-highlight);
  color: var(--fg-bright);
}
.ws-tab-dropdown-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.ws-tab-dropdown-item[aria-disabled="true"] {
  color: var(--fg-dim);
  opacity: 0.55;
  cursor: not-allowed;
}
.ws-tab-dropdown-item.destructive:hover:not([aria-disabled="true"]),
.ws-tab-dropdown-item.destructive:focus-visible:not([aria-disabled="true"]) {
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
}
.ws-tab-dropdown-item.destructive:focus-visible:not([aria-disabled="true"]) {
  outline-color: var(--red);
}
.ws-tab-dropdown-label {
  flex: 1;
}
.ws-tab-dropdown-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  flex-shrink: 0;
}
.ws-tab-dropdown-sep {
  height: 1px;
  background: var(--border-strong);
  margin: 6px 0;
}
.header-spacer {
  flex: 1;
}

/* Edit title & delete modals */
#edit-title-overlay,
#delete-ws-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
#edit-title-box,
#delete-ws-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 90%;
}
#edit-title-box h3,
#delete-ws-box h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--fg-bright);
}
#edit-title-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg-bright);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  box-sizing: border-box;
}
#edit-title-input:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
#edit-title-buttons,
#delete-ws-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#edit-title-buttons button,
#delete-ws-buttons button {
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-bright);
}
#delete-ws-buttons button.danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
#delete-ws-message {
  font-size: 14px;
  color: var(--fg-bright);
  margin: 0 0 16px;
}

/* ==========================================================================
   Split panes
   ========================================================================== */
#split-root {
  display: flex;
  flex: 1;
  min-height: 0;
}
.split-container {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.split-horizontal {
  flex-direction: row;
}
.split-vertical {
  flex-direction: column;
}
.split-child {
  display: flex;
  min-width: 0;
  min-height: 0;
}
.split-handle {
  flex: 0 0 4px;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.15s;
  z-index: 1;
  position: relative;
  touch-action: none;
}
.split-handle:hover,
.split-handle:active,
.split-handle.dragging {
  background: var(--accent);
}
.split-vertical > .split-handle {
  cursor: row-resize;
}
/* Expand hit area to 12px via pseudoelement */
.split-handle::before {
  content: "";
  position: absolute;
  z-index: 1;
}
.split-horizontal > .split-handle::before {
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}
.split-vertical > .split-handle::before {
  left: 0;
  right: 0;
  top: -4px;
  bottom: -4px;
}

/* Pane */
.pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 200px;
  min-height: 150px;
  overflow: hidden;
  position: relative;
}
.pane.focused {
  outline: 1px solid var(--accent-dim);
  outline-offset: -1px;
}
.multi-pane .pane.focused .pane-header {
  border-bottom-color: var(--accent);
  background: var(--bg-highlight);
}

/* Pane header — only visible in multi-pane mode */
.pane-header {
  display: none;
}
.multi-pane .pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 24px;
}
.pane-ws-name {
  font-size: 11px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pane.focused .pane-ws-name {
  color: var(--accent);
}
.pane-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.pane-action-btn {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
  opacity: 0.3;
  transition:
    opacity 0.15s,
    color 0.1s,
    background 0.1s;
}
.pane.focused .pane-action-btn {
  opacity: 0.5;
}
.pane-header:hover .pane-action-btn,
.pane-action-btn:focus-visible {
  opacity: 1;
}
.pane-action-btn:hover {
  color: var(--fg-bright);
  background: var(--bg-highlight);
}
.pane-close-btn:hover {
  color: var(--red);
}

/* Pane context menu */
.pane-ctx-menu {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 300;
  overflow: hidden;
  padding: 4px 0;
}
[data-theme="light"] .pane-ctx-menu {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.pane-ctx-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--fg);
  font: inherit;
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.1s;
}
.pane-ctx-item:hover:not(:disabled) {
  background: var(--bg-highlight);
}
.pane-ctx-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.pane-ctx-item:disabled {
  color: var(--fg-dim);
  opacity: 0.4;
  cursor: default;
}
.pane-ctx-label {
  flex: 1;
}
.pane-ctx-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  flex-shrink: 0;
}
.pane-ctx-sep {
  height: 1px;
  background: var(--border-strong);
  margin: 4px 0;
}

/* ==========================================================================
   Messages
   ========================================================================== */
.pane-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  /* No flexbox gap — .msg supplies its own margin-bottom for inter-card
     spacing.  A 14px gap here was stacking with the 4px card
     margin-bottom and pushing the per-card spacing to ~18px. */
}
/* .msg (shared_static/chat.css) provides padding / border / radius /
   line-height / word-wrap / margin / background.  The interactive UI
   adds a brighter text colour on user messages so "the thing I said"
   reads distinctly against the lower-chroma assistant colour. */
.msg.user {
  color: var(--fg-bright);
}
/* .msg.assistant / .msg.info / .msg.error alignment + baseline visuals
   come from shared_static/chat.css.  Interactive UI adds a pre-wrap
   override for info messages and a tightened tool-message shape with
   the cyan accent bar the instrument-panel look established. */
.msg.info {
  white-space: pre-wrap;
}
.msg.tool {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  /* Tool cards use --cyan to read distinctly from user (amber) and
     assistant (neutral); the tool-name header carries the role
     signal redundantly. */
  border-left: 3px solid var(--cyan);
  font-size: 12px;
  padding: 8px 12px;
}
.msg.tool .tool-header {
  color: var(--cyan);
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 11px;
}
.msg.tool .tool-preview {
  color: var(--fg-dim);
  white-space: pre-wrap;
  font-size: 12px;
  max-height: 300px;
  overflow-y: auto;
}

/* Streaming content — .msg.reasoning (chat.css) styles reasoning
   bubbles; .reasoning is never emitted on its own, only paired with
   the .msg base class. */
.thinking-indicator {
  color: var(--fg-dim);
  font-size: 12px;
  padding: 6px 14px;
}
.thinking-indicator::after {
  content: "...";
  animation: dots 1.5s steps(3, end) infinite;
}
@keyframes dots {
  0% {
    content: ".";
  }
  33% {
    content: "..";
  }
  66% {
    content: "...";
  }
}

/* ==========================================================================
   Markdown styling
   ========================================================================== */
/* Override KaTeX body rule — our layout requires body as a static flex container */
body {
  position: static;
}
.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3,
.msg.assistant h4,
.msg.assistant h5,
.msg.assistant h6 {
  color: var(--accent);
  margin: 8px 0 4px;
  font-family: var(--font-ui);
}
.msg.assistant h1 {
  font-size: 18px;
}
.msg.assistant h2 {
  font-size: 16px;
}
.msg.assistant h3 {
  font-size: 14px;
}
.msg.assistant h4 {
  font-size: 13px;
  font-weight: 600;
}
.msg.assistant h5 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.msg.assistant h6 {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-dim);
}
.msg.assistant strong {
  color: var(--fg-bright);
}
.msg.assistant em {
  color: var(--magenta);
}
.msg.assistant del {
  color: var(--fg-dim);
  text-decoration: line-through;
}
.msg.assistant code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--border);
}
.msg.assistant pre {
  background: var(--code-bg);
  padding: 12px 14px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
}
.msg.assistant pre code {
  background: none;
  padding: 0;
  border: none;
}
.msg.assistant ul,
.msg.assistant ol {
  margin: 4px 0 4px 20px;
}
.msg.assistant li {
  margin: 2px 0;
}
.msg.assistant a {
  color: var(--accent);
  text-decoration: underline;
}
.msg.assistant blockquote {
  border-left: 3px solid var(--accent-dim);
  padding-left: 12px;
  color: var(--fg-dim);
  margin: 6px 0;
}
.msg.assistant hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}
.msg.assistant p {
  margin: 4px 0;
}
.msg.assistant .table-wrap {
  overflow-x: auto;
  margin: 8px 0;
  -webkit-overflow-scrolling: touch;
}
.msg.assistant .table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.msg.assistant table {
  border-collapse: collapse;
  width: auto;
  min-width: 50%;
  font-size: 13px;
}
.msg.assistant thead {
  border-bottom: 2px solid var(--border-strong);
}
.msg.assistant th {
  background: var(--code-bg);
  font-weight: 600;
  color: var(--fg-bright);
}
.msg.assistant th,
.msg.assistant td {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
}
.msg.assistant tbody tr {
  transition: background 0.12s ease;
}
.msg.assistant tbody tr:nth-child(even) {
  background: var(--row-alt);
}
.msg.assistant tbody tr:hover {
  background: var(--bg-highlight);
}
.msg.assistant .align-left {
  text-align: left;
}
.msg.assistant .align-center {
  text-align: center;
}
.msg.assistant .align-right {
  text-align: right;
}
.msg.assistant img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 4px 0;
}
.msg.assistant .img-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 4px 0;
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.msg.assistant .img-placeholder:hover {
  border-color: var(--accent);
}
.msg.assistant .img-placeholder:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.msg.assistant .img-placeholder-icon {
  font-size: 16px;
}
.msg.assistant .img-placeholder-label {
  color: var(--fg-bright);
  font-size: 13px;
}
.msg.assistant .img-placeholder-domain {
  color: var(--fg-dim);
  font-size: 11px;
}
.msg.assistant li > input[type="checkbox"] {
  margin-right: 6px;
  vertical-align: middle;
  accent-color: var(--accent);
}
.msg.assistant blockquote blockquote {
  margin: 4px 0;
  border-left-color: var(--border-strong);
}
.msg.assistant blockquote blockquote blockquote {
  border-left-color: var(--border);
}
.msg.assistant .katex-display {
  margin: 8px 0;
  padding: 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.msg.assistant .katex-error {
  color: var(--red) !important;
  font-size: 12px;
}

/* Syntax highlighting — highlight.js theme (instrument panel) */
.msg.assistant pre code.hljs {
  background: var(--code-bg);
  color: var(--fg);
  padding: 0;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in,
.hljs-type {
  color: var(--magenta);
}
.hljs-string,
.hljs-attr,
.hljs-template-tag,
.hljs-template-variable {
  color: var(--green);
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-symbol,
.hljs-bullet {
  color: var(--cyan);
}
.hljs-title,
.hljs-title.class_,
.hljs-title.function_ {
  color: var(--accent);
}
.hljs-comment,
.hljs-quote {
  color: var(--fg-dim);
  font-style: italic;
}
.hljs-meta {
  color: var(--fg-dim);
}
.hljs-doctag {
  color: var(--cyan);
  font-weight: 500;
}
.hljs-char.escape_ {
  color: var(--cyan);
}
.hljs-emphasis {
  font-style: italic;
}
.hljs-strong {
  font-weight: bold;
  color: var(--fg-bright);
}
.hljs-attribute {
  color: var(--yellow);
}
.hljs-regexp,
.hljs-link {
  color: var(--cyan);
}
.hljs-selector-id,
.hljs-selector-class {
  color: var(--yellow);
}
.hljs-section {
  color: var(--accent);
  font-weight: bold;
}
.hljs-tag {
  color: var(--fg-dim);
}
.hljs-name {
  color: var(--magenta);
}
.hljs-params {
  color: var(--fg);
}
.hljs-addition {
  color: var(--green);
  background: rgba(52, 211, 153, 0.08);
  display: inline-block;
  width: 100%;
}
.hljs-deletion {
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
  display: inline-block;
  width: 100%;
}
.msg.assistant pre.code-terminal {
  border-left: 2px solid var(--green);
}
[data-theme="light"] .hljs-addition {
  background: rgba(4, 120, 87, 0.06);
}
[data-theme="light"] .hljs-deletion {
  background: rgba(220, 38, 38, 0.06);
}

/* Mermaid diagrams */
.msg.assistant .mermaid-container {
  margin: 8px 0;
  text-align: center;
  border-radius: var(--radius);
  overflow-x: auto;
  min-height: 40px;
}
.msg.assistant .mermaid-container svg {
  max-width: 100%;
  height: auto;
}
.msg.assistant .mermaid-loading {
  padding: 16px;
  color: var(--fg-dim);
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.msg.assistant .mermaid-error {
  text-align: left;
}
.msg.assistant .mermaid-error-msg {
  padding: 8px 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
@media (prefers-reduced-motion: reduce) {
  .msg.assistant .mermaid-container svg * {
    animation: none !important;
  }
}

/* Safe HTML elements */
.msg.assistant details {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  overflow: hidden;
}
.msg.assistant details summary {
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--fg-bright);
  user-select: none;
}
.msg.assistant details summary:hover {
  color: var(--accent);
}
.msg.assistant details[open] > summary {
  border-bottom: 1px solid var(--border);
}
.msg.assistant details > :not(summary) {
  padding: 0 12px;
}
.msg.assistant kbd {
  background: var(--bg-highlight);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  box-shadow: 0 1px 0 var(--border-strong);
}
.msg.assistant mark {
  background: var(--yellow-glow);
  color: var(--fg-bright);
  border-radius: 2px;
  padding: 0 2px;
}

/* GFM Callouts / Alerts */
.msg.assistant .callout {
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-surface);
  margin: 8px 0;
  overflow: hidden;
}
.msg.assistant .callout-title {
  padding: 8px 12px 4px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg.assistant .callout-icon {
  font-size: 14px;
}
.msg.assistant .callout-body {
  padding: 0 12px 8px;
  color: var(--fg);
}
.msg.assistant .callout-body p:first-child {
  margin-top: 0;
}
.msg.assistant .callout-body p:last-child {
  margin-bottom: 0;
}
.msg.assistant .callout-note {
  border-left-color: var(--cyan);
}
.msg.assistant .callout-note .callout-title {
  color: var(--cyan);
}
.msg.assistant .callout-tip {
  border-left-color: var(--green);
}
.msg.assistant .callout-tip .callout-title {
  color: var(--green);
}
.msg.assistant .callout-important {
  border-left-color: var(--magenta);
}
.msg.assistant .callout-important .callout-title {
  color: var(--magenta);
}
.msg.assistant .callout-warning {
  border-left-color: var(--yellow);
}
.msg.assistant .callout-warning .callout-title {
  color: var(--yellow);
}
.msg.assistant .callout-caution {
  border-left-color: var(--red);
}
.msg.assistant .callout-caution .callout-title {
  color: var(--red);
}

/* Definition lists */
.msg.assistant dl {
  margin: 8px 0;
}
.msg.assistant dt {
  font-weight: 600;
  color: var(--fg-bright);
  margin-top: 8px;
}
.msg.assistant dt:first-child {
  margin-top: 0;
}
.msg.assistant dd {
  margin: 2px 0 0 20px;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
}

/* Footnotes */
.msg.assistant .footnotes {
  margin-top: 16px;
  font-size: 12px;
  color: var(--fg-dim);
}
.msg.assistant .footnotes-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 8px;
}
.msg.assistant .footnotes-list {
  margin: 0 0 0 20px;
  padding: 0;
}
.msg.assistant .footnote-item {
  margin: 4px 0;
  line-height: 1.5;
}
.msg.assistant .fn-ref a {
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.msg.assistant .fn-ref a:hover {
  text-decoration: underline;
}
.msg.assistant .fn-backref {
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  margin-left: 4px;
}
.msg.assistant .fn-backref:hover {
  text-decoration: underline;
}
.msg.assistant .fn-ref a:focus-visible,
.msg.assistant .fn-backref:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 2px;
}

/* ==========================================================================
   Action button icons — glyphs rendered inside .msg-action-btn (toolbar
   chrome + hover/focus styling lives in the .msg-actions/.msg-action-btn
   rules in shared_static/chat.css).
   ========================================================================== */

/* Icon: retry (circular arrow) */
.icon-retry {
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  border-bottom-color: transparent;
  position: relative;
}
.icon-retry::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 0;
  height: 0;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  border-top: 3px solid currentColor;
  transform: rotate(-30deg);
}

/* Icon: edit (pencil) */
.icon-edit {
  width: 12px;
  height: 12px;
  position: relative;
  transform: rotate(-45deg);
}
.icon-edit::before {
  content: "";
  position: absolute;
  top: 0;
  left: 3px;
  width: 6px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 1px 1px 0 0;
  box-sizing: border-box;
}
.icon-edit::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 3px;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 3px solid currentColor;
}

/* Icon: rewind (chevrons pointing left) */
.icon-rewind {
  width: 14px;
  height: 12px;
  position: relative;
}
.icon-rewind::before,
.icon-rewind::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 6px;
  height: 6px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.icon-rewind::before {
  left: 1px;
}
.icon-rewind::after {
  left: 6px;
}

/* Edit-in-place form */
.msg-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.msg-edit-textarea {
  width: 100%;
  min-height: 40px;
  max-height: 200px;
  background: var(--bg);
  color: var(--fg-bright);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.12s ease;
  box-sizing: border-box;
}
.msg-edit-textarea:focus {
  border-color: var(--accent);
}
.msg-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.msg-edit-btn {
  padding: 4px 14px;
  font-size: 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  transition:
    background 0.1s ease,
    border-color 0.1s ease,
    color 0.1s ease;
}
.msg-edit-btn:hover {
  background: var(--bg-highlight);
}
.msg-edit-btn-send {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}
.msg-edit-btn-send:hover {
  background: var(--accent);
  color: #fff;
}

/* Edit-in-place active state */
.msg-editing {
  background: var(--bg-surface);
  border-color: var(--accent-dim);
}
.msg-editing .msg-actions {
  display: none;
}

/* Busy-state disables action buttons */
[data-busy="true"] .msg-action-btn {
  opacity: 0.3;
  pointer-events: none;
  cursor: not-allowed;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .msg-edit-textarea,
  .msg-edit-btn {
    transition: none;
  }
}

/* ==========================================================================
   Input area — composer DOM + styling lives in /shared/composer.js +
   /shared/chat.css.  No page-specific overrides needed.
   ========================================================================== */

/* Attachment chips — pill cluster above the textarea */
.composer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.composer-chips:empty {
  display: none;
}
.composer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 8px 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  max-width: 280px;
}
.composer-chip-icon {
  font-size: 12px;
  opacity: 0.7;
}
.composer-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.composer-chip-size {
  color: var(--fg-dim, var(--fg));
  opacity: 0.65;
  font-size: 10px;
}
.composer-chip-remove {
  background: transparent;
  color: var(--fg-dim, var(--fg));
  border: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.composer-chip-remove:hover {
  color: var(--red, #c94040);
  background: var(--bg-surface);
}
.composer-chip-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* New-workstream modal: attachment row + chips */
#new-ws-attach-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 4px;
}
#new-ws-attach-btn {
  align-self: flex-start;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
}
#new-ws-attach-btn:hover {
  background: var(--bg-surface);
}
#new-ws-attach-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#new-ws-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#new-ws-attach-chips:empty {
  display: none;
}
.new-ws-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 8px 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  max-width: 280px;
}
.new-ws-attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.new-ws-attach-chip-size {
  color: var(--fg-dim, var(--fg));
  opacity: 0.65;
  font-size: 10px;
}
.new-ws-attach-chip-remove {
  background: transparent;
  color: var(--fg-dim, var(--fg));
  border: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.new-ws-attach-chip-remove:hover {
  color: var(--red, #c94040);
  background: var(--bg-surface);
}
.new-ws-attach-chip-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
#new-ws-initial-message {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
  min-height: 60px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 6px 8px;
  box-sizing: border-box;
}

/* Drag-and-drop visual state on the pane */
.pane.pane-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}
.pane.pane-drop-target::after {
  content: "Drop file to attach";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim, rgba(0, 0, 0, 0.1));
  color: var(--fg-bright, var(--fg));
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
}

/* Historical-message attachment pills — beneath the user bubble */
.msg-user-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.msg-user-attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  color: var(--fg-dim, var(--fg));
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
}
.msg-user-attach-icon {
  font-size: 11px;
  opacity: 0.7;
}
.msg-user-attach-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Per-workstream status bar — above input
   ========================================================================== */
.ws-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-dim);
  flex-shrink: 0;
  min-height: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  overflow: hidden;
  transition:
    background 0.3s,
    border-color 0.3s;
}
.ws-sb-model {
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--accent);
  font-size: 10px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-sb-tokens {
  color: var(--fg-dim);
  white-space: nowrap;
}
.ws-sb-tools {
  color: var(--fg-dim);
  white-space: nowrap;
}
.ws-sb-turns {
  color: var(--fg-dim);
  white-space: nowrap;
  margin-left: auto;
}

/* Context warning states */
.ws-status-bar.ws-sb-warn .ws-sb-tokens {
  color: var(--yellow);
  font-weight: 600;
}
.ws-status-bar.ws-sb-danger .ws-sb-tokens {
  color: var(--red);
  font-weight: 600;
  text-shadow: 0 0 4px var(--red-glow);
}
[data-theme="light"] .ws-status-bar.ws-sb-danger .ws-sb-tokens {
  text-shadow: none;
}

/* Disconnected state */
.ws-status-bar.ws-sb-disconnected {
  border-top: 2px solid var(--red);
  background: rgba(248, 113, 113, 0.04);
}
.ws-status-bar.ws-sb-disconnected .ws-sb-tokens {
  color: var(--red);
}
.ws-status-bar.ws-sb-disconnected .ws-sb-model,
.ws-status-bar.ws-sb-disconnected .ws-sb-tools,
.ws-status-bar.ws-sb-disconnected .ws-sb-turns {
  opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
  .ws-status-bar {
    transition: none;
  }
}

/* ==========================================================================
   Inline approval blocks
   ========================================================================== */
.ts-approval {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  /* Cyan matches .msg.tool — both are tool-role surfaces. */
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  padding: 0;
  font-size: 12px;
}
.ts-approval.approved {
  border-left-color: var(--green);
}
.ts-approval.error {
  border-left-color: var(--red);
}
.ts-approval.denied {
  border-left-color: var(--red);
}
.ts-approval.denied .ts-approval-tool {
  opacity: 0.55;
}
.ts-approval.denied .ts-approval-tool .tool-name {
  color: var(--fg-dim);
}
/* .ts-approval (chat.css) stacks children with flex gap; the old
   border-bottom would dangle between rows now. */
.ts-approval-tool {
  padding: 8px 12px;
}
.ts-approval-tool:last-of-type {
  border-bottom: none;
}
.ts-approval-tool .tool-name {
  color: var(--cyan);
  font-weight: 600;
  font-size: 11px;
  margin-bottom: 3px;
}
.ts-approval-tool .tool-cmd {
  color: var(--fg-bright);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 120px;
  overflow: hidden;
}
.ts-approval-tool .tool-cmd .dollar {
  color: var(--green);
}
.ts-approval-tool .tool-diff {
  white-space: pre-wrap;
  font-size: 12px;
  margin-top: 4px;
}
.ts-approval-tool .tool-diff .diff-del {
  color: var(--red);
}
.ts-approval-tool .tool-diff .diff-add {
  color: var(--green);
}
.ts-approval-tool .tool-diff .diff-warn {
  color: var(--yellow);
}
/* .ts-approval (chat.css) stacks its children with flex gap, so a
   border-top on the body would float above a strip of container
   background instead of sitting flush against the previous tool row.
   Rely on the gap as the separator. */
.ts-approval-body {
  padding: 8px 12px;
  font-size: 12px;
  background: var(--bg-highlight);
}
.ts-approval-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.ts-approval-btn {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--fg-bright);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition:
    background 0.1s,
    border-color 0.1s,
    color 0.1s;
}
.ts-approval-btn:hover {
  background: var(--bg-highlight);
}
.ts-approval-btn .key {
  display: inline-block;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 4px;
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}
/* Approve / deny / always button hover + dashed styles are provided
   by chat.css .ts-approval-btn--approve / --deny / --always; the
   legacy .btn-approve / .btn-deny / .btn-always classes are gone
   from app.js, so no local overrides needed here. */
.ts-approval-feedback {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.ts-approval-feedback:focus {
  border-color: var(--accent);
}
.ts-approval-feedback::placeholder {
  color: var(--fg-dim);
}
/* chat.css shrinks .ts-approval-badge to max-content width, so a
   border-top would only span the text and read as a truncated line
   (same rationale as .verdict-badge).  Colour variants come from
   chat.css .ts-approval-badge--approved / --denied / --error — the
   legacy .badge-* modifiers are no longer emitted. */
.ts-approval-badge {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: break-word;
  word-break: break-word;
}
.tool-output {
  padding: 8px 12px;
  background: var(--code-bg);
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
  font-size: 12px;
  color: var(--fg-dim);
  max-height: 300px;
  overflow-y: auto;
}
.tool-output-error {
  color: var(--red);
}
.tool-output-stream {
  border-left: 2px solid var(--accent);
  max-height: 400px;
  animation: stream-pulse 2s ease-in-out infinite;
}
@keyframes stream-pulse {
  0%,
  100% {
    border-left-color: var(--accent);
  }
  50% {
    border-left-color: var(--accent-dim);
  }
}
.tool-output.collapsed {
  max-height: 150px;
  position: relative;
  overflow: hidden;
}
.tool-output.collapsed::after {
  content: "click to expand";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 6px;
  background: linear-gradient(transparent, var(--code-bg) 60%);
  color: var(--fg-dim);
  font-size: 10px;
  font-family: var(--font-ui);
  cursor: pointer;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   Media embed cards (MCP tool output with stream_url / results)
   ========================================================================== */
.media-embed {
  border-top: 1px solid var(--border);
  background: var(--code-bg);
}
.media-card {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  align-items: flex-start;
}
.media-card-thumb {
  width: 80px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.media-card-info {
  flex: 1;
  min-width: 0;
}
.media-card-title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-bright);
  margin-bottom: 2px;
}
.media-card-meta {
  font-size: 11px;
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.media-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}
.media-play-btn:hover {
  background: rgba(229, 160, 66, 0.1);
}
.media-play-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.media-play-btn:active {
  background: rgba(229, 160, 66, 0.2);
}
.media-play-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.media-player {
  width: 100%;
  max-height: 480px;
  background: #000;
  border-radius: 0;
}
audio.media-player {
  max-height: 54px;
}
.media-player-error {
  color: var(--red);
  font-size: 12px;
  padding: 8px 12px;
  background: var(--code-bg);
}
.media-results-list {
  padding: 6px 12px;
}
.media-result-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  align-items: center;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.media-result-row:last-child {
  border-bottom: none;
}
.media-result-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.media-result-title {
  color: var(--fg-bright);
  font-weight: 500;
}
.media-result-meta {
  color: var(--fg-dim);
  font-size: 11px;
}
.media-results-count {
  text-align: right;
  font-size: 10px;
  color: var(--fg-dim);
  padding: 4px 0;
}
@media (max-width: 480px) {
  .media-card {
    flex-direction: column;
  }
  .media-card-thumb {
    width: 100%;
    height: auto;
    max-height: 200px;
  }
  .media-player {
    max-height: 280px;
  }
}

/* ==========================================================================
   Plan review dialog
   ========================================================================== */
#plan-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
#plan-overlay.active {
  display: flex;
}
#plan-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5);
  position: relative;
}
#plan-dialog::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
}
#plan-dialog h3 {
  font-family: var(--font-ui);
  color: var(--accent);
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
#plan-content {
  white-space: pre-wrap;
  font-size: 12px;
  color: var(--fg-bright);
  margin-bottom: 16px;
  max-height: 50vh;
  overflow-y: auto;
  background: var(--code-bg);
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
#plan-feedback {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s;
}
#plan-feedback:focus {
  border-color: var(--accent);
}
#plan-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#plan-buttons button {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition:
    filter 0.15s,
    background 0.2s;
}
#plan-buttons button:hover {
  filter: brightness(1.1);
}
#plan-buttons button:focus-visible {
  outline: 2px solid var(--fg-bright);
  outline-offset: 2px;
}
#plan-buttons button .key {
  display: inline-block;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 0 4px;
  font-size: 10px;
  font-weight: 600;
}
#btn-plan-approve {
  background: var(--green);
  color: var(--on-color);
}
#btn-plan-reject {
  background: var(--red);
  color: var(--on-color);
}

/* Inline plan block (rendered in chat after plan review) */
.plan-inline {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.plan-inline-header {
  padding: 6px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.plan-inline-label.plan-approved {
  color: var(--green);
}
.plan-inline-label.plan-rejected {
  color: var(--red);
}
.plan-inline-label.plan-amending {
  color: var(--accent);
}
.plan-inline-body {
  padding: 10px 14px;
  background: var(--code-bg);
  font-size: 12px;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}
.plan-inline-body.collapsed {
  max-height: 150px;
  position: relative;
  overflow: hidden;
}
.plan-inline-body.collapsed::after {
  content: "click to expand";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 8px 0 4px;
  background: linear-gradient(transparent, var(--code-bg));
  color: var(--fg-dim);
  font-size: 11px;
  cursor: pointer;
}
.plan-inline-body h2,
.plan-inline-body h3 {
  font-size: 13px;
  margin: 10px 0 4px;
  color: var(--accent);
}
.plan-inline-body p {
  margin: 4px 0;
}
.plan-inline-body ol,
.plan-inline-body ul {
  margin: 4px 0;
  padding-left: 20px;
}
.plan-inline-feedback {
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--accent);
  font-style: italic;
}

/* ==========================================================================
   Focus indicators — server-specific overrides
   ========================================================================== */
/* Slightly thicker ring than chat.css (2px → 3px) — the interactive
   pane sits over denser pane-bottom chrome, so the ring needs more
   visual weight to pop. */
.composer-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  color: var(--fg-dim);
  text-align: center;
  padding: 48px 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-style: italic;
  opacity: 0.7;
}

/* ==========================================================================
   Dashboard overlay
   ========================================================================== */
.dashboard-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  overflow-y: auto;
}
.dashboard-overlay.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.dashboard-content {
  width: 100%;
  max-width: 960px;
  padding: 32px 20px 24px;
}
.dashboard-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px;
  /* position context for the .dashboard-composer-drop::before overlay */
  position: relative;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.dashboard-composer:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.dashboard-composer-drop {
  border-style: dashed;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow-strong);
  background: var(--accent-glow);
}
/* Drag-over affordance — make the action explicit so users know what
   dropping does.  Pseudo-element so the markup stays clean; the inner
   composer controls remain interactive. */
.dashboard-composer-drop::before {
  content: "Drop to attach";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--bg-surface);
  opacity: 0.92;
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 1;
}
.dashboard-input {
  background: transparent;
  color: var(--fg);
  border: none;
  /* Hairline below the textarea so it reads as an input even before focus.
     --border-strong (was --border) for light-mode visibility — at
     rgba(0,0,0,0.08) the legacy --border was effectively invisible on
     the white --bg-surface composer card. */
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  padding: 6px 8px;
  font: inherit;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 60px;
  font-family: var(--font-mono);
}
.dashboard-input::placeholder {
  color: var(--fg-dim);
}
.dashboard-input.dashboard-input-error {
  outline: 2px solid var(--red);
  outline-offset: -1px;
}
.dashboard-error {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 14px;
  padding: 0 4px;
}
.dashboard-error:empty {
  display: none;
}
.dashboard-options-caret {
  font-size: 9px;
  opacity: 0.7;
  transition: transform 0.15s;
}
.dashboard-options-btn[aria-expanded="true"] .dashboard-options-caret {
  transform: rotate(180deg);
  display: inline-block;
}
/* Inline summary of non-default options so users see at a glance which
   defaults they've overridden, without having to expand the panel.
   Hidden via [hidden] when everything is default. */
.dashboard-options-summary {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-dim);
  padding: 2px 6px;
  border-left: 1px solid var(--border-strong);
  margin-left: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.dashboard-options-summary[hidden] {
  display: none;
}
@media (max-width: 600px) {
  /* On phones the action row stacks; the summary hides to keep the
     row compact — power users on mobile can expand the panel itself. */
  .dashboard-options-summary {
    display: none;
  }
}
.dashboard-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}
.dashboard-composer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dashboard-icon-btn {
  background: transparent;
  color: var(--fg-dim, var(--fg));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* Larger comfortable hit target without growing the visible chrome */
  min-height: 28px;
}
.dashboard-icon-btn:hover {
  color: var(--fg);
  background: var(--bg);
}
.dashboard-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.dashboard-options-btn[aria-expanded="true"] {
  color: var(--fg);
  background: var(--bg);
}
#dashboard-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}
#dashboard-attach-chips:empty {
  display: none;
}
.dashboard-options {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: center;
  padding: 8px;
  /* Recessed surface — --bg matched the page background and was
     invisible against the composer wrapper in light mode.
     --bg-highlight is one step deeper (off-white in light, slightly
     raised in dark) so the options zone reads as its own tier. */
  background: var(--bg-highlight);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
}
.dashboard-options[hidden] {
  display: none;
}
.dashboard-options label {
  color: var(--fg-dim, var(--fg));
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.dashboard-options select {
  background: var(--bg-surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.dashboard-new-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font: inherit;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: filter 0.15s;
}
.dashboard-new-btn:hover {
  filter: brightness(1.1);
}
.dashboard-new-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: none;
}
.dashboard-section {
  margin-bottom: 24px;
}
.dashboard-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dashboard-section-title {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0;
}
.ws-delete-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-dim);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.ws-delete-btn:hover {
  color: var(--red);
  border-color: var(--red);
}
/* .dashboard-cards / .dashboard-card / .card-title / .card-meta moved to
   /shared/cards.css so console (Saved Coordinators) and ui/static (Saved
   Workstreams) share one source of truth for the basic card primitive.
   Delete-mode rules stay below — they're ui/static-only until coordinator
   gets the same UX. */

/* Delete mode */
.dashboard-card.ws-delete-mode {
  cursor: pointer;
}
.dashboard-card.ws-delete-mode:hover {
  border-color: var(--red);
  background: rgba(248, 113, 113, 0.04);
}
.dashboard-card.ws-delete-mode.ws-selected {
  cursor: default;
}
.dashboard-card.ws-delete-mode.ws-selected:hover {
  border-color: var(--red);
  background: rgba(248, 113, 113, 0.08);
}
[data-theme="light"] .dashboard-card.ws-delete-mode:hover {
  background: rgba(220, 38, 38, 0.04);
}
[data-theme="light"] .dashboard-card.ws-delete-mode.ws-selected:hover {
  background: rgba(220, 38, 38, 0.08);
}
.ws-card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  accent-color: var(--red);
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  animation: ws-check-fadein 0.2s ease-out forwards;
}
@keyframes ws-check-fadein {
  to {
    opacity: 1;
  }
}
.dashboard-card.ws-selected {
  border-color: var(--red);
  background: rgba(248, 113, 113, 0.08);
}
[data-theme="light"] .dashboard-card.ws-selected {
  background: rgba(220, 38, 38, 0.08);
}
.ws-delete-bar {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ws-delete-bar.visible {
  display: flex;
  animation: ws-bar-slide 0.2s ease-out;
}
@keyframes ws-bar-slide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ws-card-check {
    animation: none;
    opacity: 1;
  }
  .ws-delete-bar.visible {
    animation: none;
  }
}
.ws-delete-bar .ws-delete-count-label {
  font-size: 12px;
  color: var(--fg-dim);
}
.ws-delete-bar .ws-delete-bar-btn {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.ws-delete-bar .ws-delete-bar-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}
.ws-delete-bar .ws-delete-bar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ws-delete-bar .ws-delete-cancel-btn {
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.ws-delete-bar .ws-delete-cancel-btn:hover {
  color: var(--fg-bright);
  border-color: var(--border-strong);
  background: var(--bg-highlight);
}
.ws-delete-bar .ws-delete-selectall-btn {
  background: transparent;
  color: var(--fg-bright);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.ws-delete-bar .ws-delete-selectall-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-highlight);
}

/* Delete modal */
#ws-delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
#ws-delete-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: 90%;
}
#ws-delete-box h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--fg-bright);
}
#ws-delete-list {
  max-height: 200px;
  overflow-y: auto;
  margin: 12px 0;
}
#ws-delete-list .ws-delete-item {
  padding: 6px 0;
  font-size: 13px;
  color: var(--fg-bright);
  border-bottom: 1px solid var(--border);
}
#ws-delete-list .ws-delete-item:last-child {
  border-bottom: none;
}
#ws-delete-list .ws-delete-item.ws-delete-error {
  color: var(--red);
}
#ws-delete-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
#ws-delete-buttons button {
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-bright);
}
#ws-delete-buttons button:last-child {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
#ws-delete-buttons button.ws-delete-close {
  background: transparent;
  color: var(--fg-bright);
  border-color: var(--border);
}

/* Server dashboard row — clickable */
.dash-row {
  cursor: pointer;
}

/* Dashboard footer */
.dash-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--code-bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 11px;
  margin-bottom: 24px;
}
.dash-footer-nodes {
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-footer-node-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 4px var(--green-glow);
}
.dash-footer-stats {
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* Dashboard responsive */
@media (max-width: 700px) {
  :root {
    --dash-grid: 68px 110px 1fr 56px 44px;
  }
  .dash-col-model,
  .dash-cell-model,
  .dash-col-node,
  .dash-cell-node {
    display: none;
  }
  .dash-row-sub {
    padding-left: 76px;
  }
}
@media (max-width: 600px) {
  /* Drop the row constraint and let composer children flow vertically so
     Send can naturally come after chips + options instead of breaking the
     reading order with a giant button mid-card. */
  .dashboard-composer-row {
    display: contents;
  }
  .dashboard-composer-actions {
    order: 2;
    justify-content: flex-start;
  }
  .dashboard-composer #dashboard-error {
    order: 3;
  }
  .dashboard-composer #dashboard-attach-chips {
    order: 4;
  }
  .dashboard-composer .dashboard-options {
    order: 5;
  }
  .dashboard-composer .dashboard-new-btn {
    order: 6;
    width: 100%;
  }
}
@media (max-width: 480px) {
  .dashboard-content {
    padding: 24px 12px 16px;
  }
  /* .dashboard-cards 1-col at 480px lives in /shared/cards.css */
  :root {
    --dash-grid: 50px 1fr 50px;
  }
  .dash-col-model,
  .dash-cell-model,
  .dash-col-node,
  .dash-cell-node,
  .dash-col-task,
  .dash-cell-task,
  .dash-col-ctx,
  .dash-cell-ctx {
    display: none;
  }
  .dash-row-sub {
    padding-left: 66px;
  }
  .tool-output,
  .tool-output-stream {
    max-height: 200px;
  }
}

/* ==========================================================================
   Verdict badges (intent judge)
   ========================================================================== */
.verdict-badge {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  /* No top separator — .ts-verdict-badge (chat.css) shrinks to
     max-content width, and a 1px border-top would extend only under
     the badge text and read as a truncated line. */
}
.verdict-low {
  color: var(--green);
  border-left: 3px solid var(--green);
}
.verdict-medium {
  color: var(--yellow);
  border-left: 3px solid var(--yellow);
}
.verdict-high {
  color: var(--red);
  border-left: 3px solid var(--red);
}
.verdict-critical {
  color: var(--red);
  border-left: 3px solid var(--red);
  background: rgba(255, 80, 80, 0.05);
}

.verdict-detail {
  padding: 6px 12px;
  font-size: 11px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.verdict-detail .verdict-summary {
  margin-bottom: 4px;
  font-weight: 600;
}
.verdict-detail .verdict-reasoning {
  color: var(--fg-dim);
  margin-bottom: 4px;
}
.verdict-detail .verdict-evidence {
  color: var(--fg-dim);
  font-style: italic;
  margin-bottom: 4px;
}
.verdict-detail .verdict-tier {
  color: var(--fg-dim);
  font-size: 10px;
}

.verdict-expand {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 10px;
  text-decoration: underline;
  padding: 0;
}
.verdict-expand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.verdict-judge-spinner {
  font-size: 10px;
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}
.judge-spinner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: judge-pulse 1.2s ease-in-out infinite;
}
@keyframes judge-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* Verdict glow on approval action buttons — amplifies chat.css's
   base .ts-verdict-glow--* rules with a stronger shadow + border
   tint on the interactive-server page. */
.ts-approval-body.ts-verdict-glow--approve .ts-approval-btn--approve {
  box-shadow: 0 0 8px var(--green-glow);
  border-color: var(--green);
}
.ts-approval-body.ts-verdict-glow--deny .ts-approval-btn--deny {
  box-shadow: 0 0 8px var(--red-glow);
  border-color: var(--red);
}
.ts-approval-body.ts-verdict-glow--review .ts-approval-btn--approve,
.ts-approval-body.ts-verdict-glow--review .ts-approval-btn--deny {
  box-shadow: 0 0 6px var(--yellow-glow);
  border-color: var(--yellow);
}

/* Output guard warning */
.output-warning {
  padding: 4px 8px;
  font-size: 11px;
  border-left: 3px solid;
  margin: 2px 0 2px 16px;
}
.output-warning-low {
  border-color: var(--cyan);
  color: var(--cyan);
}
.output-warning-medium {
  border-color: var(--yellow);
  color: var(--yellow);
}
.output-warning-high {
  border-color: var(--red);
  color: var(--red);
}
.output-warning-label {
  font-weight: 600;
}
.output-warning-redacted {
  color: var(--fg-dim);
  font-style: italic;
}

/* ==========================================================================
   New workstream modal
   ========================================================================== */
#new-ws-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
}
#new-ws-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 32px 24px;
  width: 380px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow:
    0 24px 48px -12px rgba(0, 0, 0, 0.5),
    0 0 80px -20px var(--accent-dim);
  position: relative;
}
#new-ws-box::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 1px;
}
#new-ws-box h3 {
  font-family: var(--font-ui);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 16px;
}
#new-ws-box label {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 14px;
  margin-bottom: 5px;
}
#new-ws-box label:first-of-type {
  margin-top: 0;
}
.nws-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.6;
}
#new-ws-box input[type="text"],
#new-ws-box select {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  box-sizing: border-box;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
#new-ws-box input[type="text"]:focus,
#new-ws-box select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
#new-ws-box input[type="text"]::placeholder {
  color: var(--fg-dim);
}
#new-ws-box select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a93ad' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
#new-ws-error {
  color: var(--red);
  font-size: 12px;
  margin-bottom: 8px;
  display: none;
}
#new-ws-buttons {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}
#new-ws-cancel {
  padding: 9px 20px;
  background: var(--bg-highlight);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
#new-ws-cancel:hover {
  background: var(--bg-elevated);
}
#new-ws-cancel:focus-visible {
  outline: 2px solid var(--fg-bright);
  outline-offset: 2px;
}
#new-ws-submit {
  padding: 9px 20px;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
#new-ws-submit:hover {
  filter: brightness(1.1);
}
#new-ws-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}
#new-ws-submit:focus-visible {
  outline: 2px solid var(--fg-bright);
  outline-offset: 2px;
}

/* ==========================================================================
   Reduced motion — page-specific
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .ws-tab .tab-indicator[data-state="thinking"],
  .ws-tab .tab-indicator[data-state="running"],
  .ws-tab .tab-indicator[data-state="attention"] {
    animation: none;
    opacity: 1;
  }
  .tool-output-stream {
    animation: none;
    border-left-color: var(--accent);
  }
  .judge-spinner-dot {
    animation: none;
    opacity: 1;
  }
  .thinking-indicator::after {
    animation: none;
    content: "...";
  }
  .ws-tab,
  .ws-tab .tab-chevron,
  #new-tab-btn,
  #split-btn,
  .dashboard-card,
  .ts-approval-btn,
  .ts-approval-feedback,
  #plan-buttons button,
  .composer button,
  .dashboard-new-btn,
  .dashboard-input,
  #health-indicator,
  #theme-toggle,
  #mcp-status,
  .msg.assistant tbody tr,
  .msg.assistant .img-placeholder,
  .media-play-btn,
  #new-ws-cancel,
  #new-ws-submit,
  #new-ws-box input,
  #new-ws-box select,
  .split-handle,
  .pane-action-btn,
  .pane-ctx-item,
  .ws-tab-dropdown-item {
    transition: none;
  }
  .ws-tab-dropdown {
    animation: none;
  }
}

/* ==========================================================================
   Tool call + approval block — page-specific styling for the inline
   approval card and its inner verdict + tool-output children.  Lives
   here (not chat.css) because these classes only render on the
   per-node UI surface; coord uses the .approval-dock pattern instead.

   DOM shape rendered by buildToolDiv() + renderVerdictBadge():
     .msg.ts-approval.ts-approval--inline[.approved]  ← outer card
       .ts-approval-tool
         .tool-name                   ← tool function name
         .tool-cmd                    ← header / command
         .tool-diff .diff-[del|add|warn]
         (.tool-output appended dynamically by appendToolOutput)
       .verdict-badge.verdict-[low|medium|high|critical]
         .verdict-risk, .verdict-rec, .verdict-conf
         button.verdict-expand
       .verdict-detail (hidden until expand)
       .ts-approval-badge[--approved|--denied]          ← auto-approved pill

   The block uses the unified token palette (--cyan / --ink / --panel /
   --ok / --err / --warn) rather than the older --yellow / --green /
   --red literals.
   ========================================================================== */

.msg.ts-approval--inline {
  /* Cyan for tool-role surfaces — matches .msg.tool border + the
     .ts-approval container in the chat-css approval theme.  Selector
     keeps the .msg qualifier so its (0,2,0) specificity ties with
     .ts-approval.approved/.denied/.error and the later-cascade rule
     here wins, holding the inline card cyan regardless of state.
     width: 100% forces consistent card width across tool calls; without
     it, cards shrink to content width (short-output cards read narrow,
     long-output cards read full-width → jagged column). */
  border-left-color: var(--cyan);
  background: var(--panel-2);
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
}

.ts-approval-tool {
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r-sm);
}

.ts-approval-tool + .ts-approval-tool {
  margin-top: 6px;
}

.ts-approval-tool .tool-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  margin-bottom: 4px;
  letter-spacing: 0;
}

/* Error variant of the tool name (replaces the prior inline
   name.style.color = "var(--red)" in buildToolDiv — inline styles win
   over CSS and broke the token mapping). */
.ts-approval-tool .tool-name--error {
  color: var(--err);
}

.ts-approval-tool .tool-cmd {
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

.ts-approval-tool .tool-cmd .dollar {
  color: var(--ok);
}

.ts-approval-tool .tool-diff {
  white-space: pre-wrap;
  font-size: 12px;
  margin-top: 4px;
}
.ts-approval-tool .tool-diff .diff-del {
  color: var(--err);
}
.ts-approval-tool .tool-diff .diff-add {
  color: var(--ok);
}
.ts-approval-tool .tool-diff .diff-warn {
  color: var(--warn);
}

/* Verdict badge — semantic palette via the 12% bg / 38% border / 70%
   text color-mix pattern.  Risk level drives the hue:
   low=ok, medium=warn, high/critical=err. */
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--hair);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--ink-2);
  border-left-width: 3px;
  max-width: max-content;
}

.verdict-badge.verdict-low {
  color: color-mix(in srgb, var(--ok) 70%, var(--ink-2));
  border-color: color-mix(in srgb, var(--ok) 38%, var(--hair));
  border-left-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, var(--panel-2));
}
.verdict-badge.verdict-medium {
  color: color-mix(in srgb, var(--warn) 70%, var(--ink-2));
  border-color: color-mix(in srgb, var(--warn) 38%, var(--hair));
  border-left-color: var(--warn);
  background: var(--warn-tint);
}
.verdict-badge.verdict-high,
.verdict-badge.verdict-critical {
  color: color-mix(in srgb, var(--err) 70%, var(--ink-2));
  border-color: color-mix(in srgb, var(--err) 38%, var(--hair));
  border-left-color: var(--err);
  background: color-mix(in srgb, var(--err) 12%, var(--panel-2));
}

.verdict-badge .verdict-risk {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}
.verdict-badge .verdict-rec {
  color: inherit;
}
.verdict-badge .verdict-conf {
  color: var(--ink-3);
  font-size: 10px;
}

.verdict-judge-spinner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-3);
  font-size: 10px;
}
.verdict-judge-spinner .judge-spinner-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: ts-pulse 1.2s infinite;
}
/* ts-pulse keyframe is defined in shared_static/ui-base.css; no
   local duplicate needed. */

.verdict-expand {
  background: transparent;
  border: none;
  padding: 0 4px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.verdict-expand:hover {
  color: var(--ink);
}
.verdict-expand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.verdict-detail {
  margin-top: 6px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-3);
  background: var(--panel-2);
  border: 1px solid var(--hair);
  border-radius: var(--r-sm);
}
.verdict-detail .verdict-summary {
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 4px;
}
.verdict-detail .verdict-reasoning {
  color: var(--ink-3);
  margin-bottom: 4px;
}
.verdict-detail .verdict-evidence {
  color: var(--ink-4);
  font-style: italic;
  margin-bottom: 4px;
}
.verdict-detail .verdict-tier {
  color: var(--ink-4);
  font-size: 10px;
}

/* Auto-approved / denied badges — flat badge aesthetic (matches the
   .risk primitive in ui-base.css), not a button.  Uppercase mono label
   on a soft semantic-coloured background, no border — reads as
   "status tag" not "click me." */
.ts-approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 3px;
  max-width: max-content;
  border: none;
}
.ts-approval-badge--approved {
  color: var(--ok);
  background: var(--ok-soft);
}
.ts-approval-badge--denied {
  color: var(--err);
  background: var(--err-soft);
}
.ts-approval-badge--error {
  color: #fff;
  background: var(--err-fill);
}

/* Tool output (streamed command/fetch result) — uses the panel / ink
   tokens for surface + text colour. */
.tool-output {
  background: var(--panel);
  color: var(--ink-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--hair);
}
.tool-output-error {
  color: var(--err);
}
.tool-output-stream {
  border-left: 2px solid var(--accent);
}

.tool-output.collapsed::after {
  background: linear-gradient(transparent, var(--panel) 70%);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding-top: 14px;
}

/* Verdict-glow halo on action buttons — soft coloured ring when the
   heuristic verdict suggests an action. */
.ts-verdict-glow--approve .ts-approval-btn--approve {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 25%, transparent);
}
.ts-verdict-glow--deny .ts-approval-btn--deny {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--err) 25%, transparent);
}
.ts-verdict-glow--review .ts-approval-btn--approve,
.ts-verdict-glow--review .ts-approval-btn--deny {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 25%, transparent);
}
