/**
 * components.css — F2 Extract
 *
 * Sidebar content (jobs, skills, sessions lists), message bubbles,
 * think blocks, react steps, process log, progress panel, progress
 * cards, artifact cards, model switcher, quick mode popover, badges,
 * queued prompts, main content area, chat view, chat messages,
 * chat welcome, floating chat input, settings inputs, scrollbars.
 *
 * Lines 474-1273 from original <style> block.
 */

@property --pm-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --pm-shift {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 40%;
}

@property --pm-glow {
  syntax: "<color>";
  inherits: false;
  initial-value: rgba(255, 106, 0, 0.25);
}

:root {
  --pm-orange: #f97316;
  --pm-orange-hot: #ff5a00;
  --pm-ember: #b45309;
  --pm-gold: #facc15;
  --composer-bg: rgba(238, 235, 228, 0.72);
  --composer-panel: rgba(255, 255, 255, 0.72);
  --composer-input: rgba(255, 255, 255, 0.86);
  --composer-border: rgba(255, 255, 255, 0.65);
  --composer-text: #2b2a28;
  --composer-muted: rgba(40, 38, 35, 0.55);
}

:root[data-theme="dark"] {
  --pm-orange: #f97316;
  --pm-orange-hot: #fb5607;
  --pm-ember: #7c2d12;
  --pm-gold: #f59e0b;
  --composer-bg: rgba(20, 20, 19, 0.74);
  --composer-panel: rgba(34, 34, 32, 0.72);
  --composer-input: rgba(45, 45, 43, 0.82);
  --composer-border: rgba(255, 255, 255, 0.08);
  --composer-text: #f2eee7;
  --composer-muted: rgba(242, 238, 231, 0.55);
}

#jobs-list,
#skills-list,
#skills-search-results { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; }

.job-item,
.skill-item,
.skill-result,
.task-card,
.approval-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  transition: all 0.15s ease;
}

.job-item {
  position: relative;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text);
}

.job-item:hover {
  border-color: var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.job-item.active {
  border-color: var(--flame-border);
  background: color-mix(in srgb, var(--flame-glow) 50%, var(--panel) 50%);
  color: var(--text);
}
.job-item.unread {
  background: color-mix(in srgb, var(--flame-glow) 34%, var(--panel) 66%);
  border-color: rgba(249,115,22,0.28);
  color: var(--text);
}
.job-item.unread.active {
  background: color-mix(in srgb, var(--flame-glow) 58%, var(--panel) 42%);
  border-color: var(--flame-border);
}

#channels-list .job-item.channel-chat-item:not(.active) {
  background: color-mix(in srgb, var(--flame-glow) 50%, var(--panel) 50%);
  border-color: var(--flame-border);
  color: var(--text);
}

#channels-list .job-item.channel-chat-item:not(.active):hover {
  background: color-mix(in srgb, var(--flame-glow) 58%, var(--panel) 42%);
  border-color: var(--flame);
}

#channels-list .job-item.channel-chat-item.active,
#channels-list .job-item.channel-chat-item.unread.active {
  background: #fff;
  border-color: rgba(249,115,22,0.28);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.job-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.job-item-head--pinned {
  padding-right: 24px;
}

.job-item-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.job-item-title {
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.session-search-preview {
  margin-top: 7px;
  color: var(--sidebar-muted, var(--muted));
  font-size: 10.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.session-search-preview span {
  color: var(--sidebar-text, var(--text));
  font-weight: 800;
}

.session-search-highlight {
  background: rgba(249, 115, 22, 0.26);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.session-search-error {
  margin: 8px 2px 0;
  color: #fca5a5;
  font-size: 10.5px;
  line-height: 1.45;
}

.job-item-action {
  flex: 0 0 auto;
  align-self: flex-start;
}

.sessions-section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 12px 8px 4px 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  margin-bottom: 4px;
}

.chat-pin-btn {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}
.chat-pin-btn:hover,
.chat-pin-btn.active {
  color: var(--brand);
  background: rgba(249,115,22,0.12);
}
.pinned-chats-heading {
  border-top: 0;
  margin-top: 0;
  padding-top: 4px;
}

/* Compact pinned-chat cards in dedicated pinned section */
#pinned-chats-list .job-item {
  padding: 6px 26px 6px 8px;
  border-radius: 8px;
  gap: 4px;
}
#pinned-chats-list .job-item-head {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
#pinned-chats-list .job-item-head--pinned {
  padding-right: 0;
}
#pinned-chats-list .job-item-title {
  font-size: 12px;
  font-weight: 600;
  -webkit-line-clamp: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
}
/* Flatten the chunky pills into a subtle muted meta row */
#pinned-chats-list .job-item .badge,
#pinned-chats-list .job-item .badge-queued {
  background: transparent;
  color: var(--sidebar-muted);
  padding: 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  border-radius: 0;
}
#pinned-chats-list .job-item .badge + .badge::before,
#pinned-chats-list .job-item .badge-queued + .badge::before,
#pinned-chats-list .job-item .badge + span::before {
  content: " · ";
  color: var(--sidebar-muted);
  margin: 0 3px;
}
#pinned-chats-list .chat-pin-btn {
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
}
#pinned-chats-list .chat-pin-btn svg {
  width: 11px;
  height: 11px;
}

.session-terminal {
  /* Inherits from .job-item; no additional styling needed */
}

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 4px 8px;
}
.badge-planning { background: #e6f0ff; color: #225ab6; }
.badge-executing { background: #e9f8ff; color: #1d7ea7; }
.badge-completed { background: #e8fbf3; color: #0f8b63; }
.badge-failed { background: #fff0f0; color: #c33f3f; }
.badge-queued { background: #eef2f7; color: #607086; }
.badge-needs_approval { background: #fff6e9; color: #b06b00; }

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 22px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  background: var(--panel-2);
}

.status-active {
  background: #c8f0c4;
  color: #0d5c2f;
}

.status-paused {
  background: #fff4d6;
  color: #7d5700;
}

.status-failed {
  background: #ffd6d6;
  color: #8b0000;
}

.progress-card {
  border: 1px solid var(--progress-border);
  border-radius: 14px;
  background: var(--progress-bg);
  box-shadow: var(--progress-shadow);
  padding: 10px 12px 12px;
}
.progress-card-header {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--progress-header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 800;
  font-family: 'Manrope', sans-serif;
  cursor: pointer;
  padding: 2px 2px 8px;
}
.progress-card-header .chev {
  color: var(--progress-chevron);
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s ease;
}
.progress-card.collapsed .progress-card-header .chev {
  transform: rotate(-90deg);
}
.progress-list-wrap {
  display: block;
}
.progress-card.collapsed .progress-list-wrap {
  display: none;
}
.progress-empty {
  border: 1px dashed var(--progress-empty-border);
  border-radius: 10px;
  color: var(--progress-empty-text);
  font-size: 12px;
  padding: 10px;
  line-height: 1.55;
  background: var(--progress-empty-bg);
}
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  transition: opacity 0.2s ease;
}
.progress-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 28px;
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.progress-item.pending .progress-step-dot {
  background: var(--progress-dot-pending-bg);
  color: var(--progress-dot-pending-text);
  border: 1px solid var(--progress-dot-pending-border);
}
.progress-item.done .progress-step-dot {
  background: var(--progress-dot-done-bg);
  color: var(--progress-dot-done-text);
  border: 1px solid var(--progress-dot-done-border);
}
.progress-item.failed .progress-step-dot {
  background: var(--progress-dot-failed-bg);
  color: var(--progress-dot-failed-text);
  border: 1px solid var(--progress-dot-failed-border);
}
.progress-item.in_progress .progress-step-dot {
  background: var(--progress-dot-active-bg);
  color: var(--progress-dot-active-text);
  border: 1px solid var(--progress-dot-active-border);
}
.progress-spinner {
  position: absolute;
  inset: -1px;
  border-radius: 999px;
  border: 2px solid var(--progress-spinner-track);
  border-top-color: var(--progress-spinner-head);
  animation: progress-spin 0.85s linear infinite;
}
@keyframes progress-spin {
  to { transform: rotate(360deg); }
}
.progress-step-text {
  color: var(--progress-text-base);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  flex: 1;
  transition: color 0.25s ease, font-weight 0.15s ease;
}
.progress-item.done .progress-step-text {
  color: var(--progress-text-done);
  text-decoration: line-through;
}
.progress-item.pending .progress-step-text {
  color: var(--progress-text-pending);
}
.progress-item.failed .progress-step-text {
  color: var(--progress-text-failed);
}
.progress-item.in_progress .progress-step-text {
  color: var(--progress-text-active);
  font-weight: 700;
}
.team-progress-runs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.team-progress-run {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.team-progress-run-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
}
.team-progress-run-btn:hover {
  background: var(--panel-2);
}
.team-progress-run-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.team-progress-run-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-progress-run-sub {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-progress-run-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.team-progress-run-meta.ok {
  color: var(--ok);
}
.team-progress-run-meta.fail {
  color: var(--err);
}
.team-progress-run-meta.pending {
  color: var(--muted);
}
.team-progress-inline-spinner {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--progress-spinner-track);
  border-top-color: var(--progress-spinner-head);
  animation: progress-spin 0.85s linear infinite;
}
.team-progress-run-chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.team-progress-run.open .team-progress-run-chevron {
  transform: rotate(180deg);
}
.team-progress-run-body {
  padding: 0 10px 10px;
}

main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  background: #d8d6d2;
  height: 100%;
}

:root[data-theme="dark"] main {
  background: #1a1a1a;
}

#chat-view,
#mission-view { flex: 1; min-height: 0; height: 100%; display: flex; flex-direction: column; }
#chat-view {
  position: relative;
  background: #d8d6d2 url('/assets/chat-main-background.png') center center / cover no-repeat;
}
:root[data-theme="dark"] #chat-view {
  background: #1a1a1a url('/assets/chat-main-background-dark.png') center center / cover no-repeat;
}
#mission-view { display: none; }

#chat-messages,
#main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}

.main-goal-strip {
  flex: 0 0 auto;
  margin: 0 24px 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, var(--brand) 8%);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(16, 32, 64, 0.08);
}

.main-goal-strip[data-status="active"] { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.main-goal-strip[data-status="blocked"],
.main-goal-strip[data-status="failed"] { border-color: var(--red); }

.main-goal-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.main-goal-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.main-goal-title {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 750;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-goal-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-goal-denial {
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--red);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-goal-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.main-goal-action {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  min-width: 34px;
  height: 28px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.main-goal-action:hover { border-color: var(--brand); }

.chat-welcome,
.welcome {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  color: var(--muted);
}

.chat-welcome-icon,
.welcome-logo { font-size: 48px; opacity: 0.6; }
.chat-welcome h2 { font-size: 28px; font-weight: 800; color: var(--text); }

.msg {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  width: 100%;
}

.msg.user {
  justify-content: flex-end;
}

.msg-bubble-stack {
  position: relative;
  min-width: 0;
  max-width: 82%;
  padding-bottom: 24px;
}

.msg:not(.user) .msg-bubble-stack {
  flex: 1 1 0;
  max-width: 100%;
}

.msg.user .msg-bubble-stack {
  width: fit-content;
  max-width: 82%;
}

.msg-shell {
  width: min(860px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.msg-shell.user {
  align-items: flex-end;
}

.msg-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  opacity: 0.62;
  transition: opacity 0.15s ease;
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
}

.msg-shell:hover .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
}

.msg-action-btn {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #697383;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.msg-action-btn:hover:not(:disabled) {
  background: rgba(20, 26, 35, 0.07);
  color: #1f2937;
}

.msg-action-btn:disabled {
  opacity: 0.34;
  cursor: default;
}

.msg-variant-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  padding-left: 2px;
}

.msg.user .msg-body {
  order: -1;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.msg.user .msg-avatar { background: #e8f1ff; border-color: #c4d9fb; }

.msg-body {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  width: fit-content;
  background: rgba(225,223,218,0.88);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.msg:not(.user) .msg-body {
  flex: 1 1 0;
  width: 100%;
  max-width: 100%;
}

.msg.user .msg-body {
  background: #2e2e2e;
  color: #ffffff;
  overflow: hidden;
  isolation: isolate;
  border-color: rgba(0,0,0,0.04);
  padding: 13px 18px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.12),
    0 6px 20px rgba(0,0,0,0.10);
}

.msg.user .msg-actions {
  top: auto;
  right: auto;
  bottom: 0;
  left: 0;
  min-height: 22px;
  gap: 5px;
  opacity: 0.62;
}

.msg.user .msg-action-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.msg.user .msg-action-btn iconify-icon {
  width: 14px;
  height: 14px;
}

.msg.user .msg-body::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background:
    conic-gradient(
      from var(--pm-angle),
      rgba(255,255,255,0.22),
      color-mix(in srgb, var(--pm-orange), transparent 34%),
      rgba(255,255,255,0.05),
      color-mix(in srgb, var(--pm-gold), transparent 58%),
      color-mix(in srgb, var(--pm-ember), transparent 48%),
      rgba(255,255,255,0.18)
    );
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  opacity: 0.68;
  animation: prometheus-liquid-spin 16s linear infinite;
}

.msg.user .msg-body::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(249,115,22,0.18);
  box-shadow:
    0 0 14px rgba(249,115,22,0.18),
    inset 0 1px 0 rgba(255,255,255,0.08);
  opacity: 0.72;
}

.msg.user .msg-body > * {
  position: relative;
  z-index: 1;
}

:root[data-theme="dark"] .msg.user .msg-body {
  background: #2e2e2e;
  border-color: rgba(0,0,0,0.04);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.12),
    0 6px 20px rgba(0,0,0,0.16);
}

:root[data-theme="dark"] .msg.user .msg-body::before {
  opacity: 0.58;
}

:root[data-theme="dark"] .msg.user .msg-body::after {
  border-color: rgba(249,115,22,0.16);
  box-shadow:
    0 0 14px rgba(249,115,22,0.14),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.msg-role { font-size: 11px; color: #4f617b; font-weight: 700; margin-bottom: 6px; }
.msg-channel-tag {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #6f7f95;
  opacity: 0.82;
}
.msg-content { line-height: 1.7; font-size: 13px; white-space: pre-wrap; word-break: break-word; color: #17243b; }
.msg.user .msg-content {
  color: #ffffff;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.msg-content.markdown-body { white-space: normal; }
.voice-pending-body {
  border-style: dashed;
  border-color: rgba(249, 115, 22, 0.62);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.12), 0 6px 18px rgba(0,0,0,0.09);
}
.voice-pending-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: rgba(255,255,255,0.72);
  font-size: 11px;
  font-weight: 700;
}
.voice-pending-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.voice-pending-btn {
  height: 24px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 7px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.voice-pending-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.16);
}
.voice-pending-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.msg-edit-composer {
  width: min(100%, 760px);
  min-width: min(620px, calc(100vw - 96px));
}
.msg-edit-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  resize: vertical;
  min-height: 96px;
  font: inherit;
  line-height: 1.65;
}
.msg-edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.msg-edit-btn {
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: inherit;
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.msg-edit-btn-primary {
  border-color: #ffffff;
  background: #ffffff;
  color: #202124;
}
.markdown-body p { margin-bottom: 8px; line-height: 1.7; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { font-weight: 700; margin: 14px 0 6px; color: var(--text); line-height: 1.3; }
.markdown-body h1 { font-size: 1.25em; }
.markdown-body h2 { font-size: 1.1em; }
.markdown-body h3 { font-size: 1em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin-bottom: 8px; }
.markdown-body li { margin-bottom: 3px; line-height: 1.65; }
.markdown-body li > ul, .markdown-body li > ol { margin-top: 3px; margin-bottom: 3px; }
.markdown-body strong { font-weight: 700; color: var(--text); }
.markdown-body em { font-style: italic; }
.markdown-body code { font-family: 'IBM Plex Mono', monospace; background: rgba(0,0,0,0.07); border: 1px solid rgba(0,0,0,0.10); border-radius: 4px; padding: 1px 5px; font-size: 0.85em; word-break: break-all; color: #1a2a3a; }
.markdown-body pre { background: rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.10); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin-bottom: 8px; }
.markdown-body pre code { background: none; border: none; padding: 0; font-size: 0.85em; word-break: normal; color: #1a2a3a; }
.markdown-body th { background: rgba(0,0,0,0.06); font-weight: 600; }
.markdown-body blockquote { border-left: 3px solid var(--brand); padding-left: 12px; color: var(--muted); margin: 8px 0; font-style: italic; }
.markdown-body table { border-collapse: collapse; width: 100%; margin-bottom: 8px; font-size: 0.9em; }
.markdown-body th, .markdown-body td { border: 1px solid rgba(0,0,0,0.12); padding: 6px 10px; text-align: left; }
.markdown-body a { color: var(--brand); text-decoration: underline; }
.markdown-body hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
:root[data-theme="dark"] .markdown-body code { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.12); color: #e2e8f0; }
:root[data-theme="dark"] .markdown-body pre { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.10); }
:root[data-theme="dark"] .markdown-body pre code { color: #e2e8f0; }
:root[data-theme="dark"] .markdown-body th { background: rgba(255,255,255,0.06); }
:root[data-theme="dark"] .markdown-body th, :root[data-theme="dark"] .markdown-body td { border-color: rgba(255,255,255,0.10); }
/* User message markdown styling */
.msg.user .markdown-body code { background: rgba(0,0,0,0.2); border-color: rgba(255,255,255,0.15); color: #e8e6e1; }
.msg.user .markdown-body pre { background: rgba(0,0,0,0.2); border-color: rgba(255,255,255,0.15); }
.msg.user .markdown-body blockquote { color: #c8dbff; border-left-color: rgba(249,115,22,0.5); }
.msg.user .markdown-body a { color: #9fc2ff; }
.msg.user .markdown-body strong { color: #ffffff; }
.msg.user .markdown-body h1, .msg.user .markdown-body h2, .msg.user .markdown-body h3, .msg.user .markdown-body h4 { color: #c8dbff; }
.msg-staged { display: flex; flex-direction: column; gap: 10px; }
.msg-stage {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px;
}
.msg-stage-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}
.artifact-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.artifact-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbff;
  padding: 10px;
}
.artifact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.artifact-title {
  font-size: 11px;
  font-weight: 800;
  color: #15386f;
  letter-spacing: 0.02em;
}
.artifact-status {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.artifact-status.ok { background: #e8fbf3; color: #0f8b63; }
.artifact-status.error { background: #fff0f0; color: #c33f3f; }
.artifact-status.skipped { background: #f4f6fa; color: #7d8ca2; }
.artifact-row {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.5;
  word-break: break-word;
}
.artifact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.artifact-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #1a355f;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.artifact-btn:hover { border-color: #aac6ef; background: #f2f7ff; }
.artifact-preview {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  font-size: 11px;
  color: #2f3e55;
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
}

.mission-bar {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f9fbff);
  padding: 14px 16px;
}

/* ── Floating chat input (ChatGPT/Claude style) ── */
.chat-input-area {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 40px));
  overflow: visible;
  isolation: isolate;
  --pm-angle: 0deg;
  --pm-shift: 38%;
  --pm-glow: rgba(249, 115, 22, 0.22);
  background:
    linear-gradient(
      135deg,
      var(--composer-bg),
      color-mix(in srgb, var(--composer-bg), transparent 18%)
    );
  border: 1px solid var(--composer-border);
  border-radius: 24px;
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255,255,255,0.58);
  padding: 10px 12px 8px;
  z-index: 10;
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  transition:
    --pm-shift 700ms ease,
    --pm-glow 700ms ease,
    box-shadow 300ms ease,
    border-color 300ms ease;
}
.chat-input-area::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background:
    conic-gradient(
      from var(--pm-angle),
      transparent 0deg,
      color-mix(in srgb, var(--pm-orange), transparent 86%) 52deg,
      color-mix(in srgb, var(--pm-gold), transparent 91%) 95deg,
      transparent 150deg,
      color-mix(in srgb, var(--pm-ember), transparent 84%) 225deg,
      transparent 310deg,
      color-mix(in srgb, var(--pm-orange-hot), transparent 88%) 360deg
    );
  filter: blur(34px);
  opacity: 0.62;
  animation: prometheus-liquid-spin 18s linear infinite;
}
.chat-input-area::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background:
    conic-gradient(
      from var(--pm-angle),
      rgba(255,255,255,0.30),
      color-mix(in srgb, var(--pm-orange), transparent 46%),
      rgba(255,255,255,0.08),
      color-mix(in srgb, var(--pm-gold), transparent 62%),
      rgba(255,255,255,0.25)
    );
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  opacity: 0.48;
  animation: prometheus-liquid-spin 14s linear infinite;
}
.chat-input-area > * {
  position: relative;
  z-index: 1;
}
.chat-input-area:hover,
.chat-input-area:focus-within {
  --pm-shift: 58%;
  --pm-glow: rgba(249, 115, 22, 0.34);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.25),
    0 0 34px var(--pm-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(255,255,255,0.62);
}
:root[data-theme="dark"] .chat-input-area {
  background:
    linear-gradient(
      135deg,
      var(--composer-bg),
      color-mix(in srgb, var(--composer-bg), transparent 12%)
    );
  border-color: var(--composer-border);
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255,255,255,0.10);
}
:root[data-theme="dark"] .chat-input-area::before {
  opacity: 0.52;
}
:root[data-theme="dark"] .chat-input-area::after {
  opacity: 0.42;
}
:root[data-theme="dark"] .chat-input-area:hover,
:root[data-theme="dark"] .chat-input-area:focus-within {
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.42),
    0 0 30px rgba(249, 115, 22, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 0 0 1px rgba(255,255,255,0.12);
}

body.right-canvas-open.browser-surface-active .chat-input-area {
  width: min(860px, calc(100% - 28px));
  padding: 54px 14px 14px;
  border-radius: 22px;
}

/* Chat messages container - centered with max-width */
#chat-messages {
  padding: 28px 0 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 30px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0,
    #000 calc(100% - 188px),
    transparent calc(100% - 98px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0,
    #000 calc(100% - 188px),
    transparent calc(100% - 98px),
    transparent 100%
  );
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 180ms ease;
}

#chat-messages.chat-scroller-active {
  scrollbar-color: rgba(249,115,22,0.42) transparent;
}

#chat-messages::-webkit-scrollbar {
  width: 9px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background-color: transparent;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  transition: background-color 180ms ease, border-color 180ms ease;
}

#chat-messages.chat-scroller-active::-webkit-scrollbar-thumb {
  background-color: rgba(249,115,22,0.42);
}

:root[data-theme="dark"] #chat-messages.chat-scroller-active {
  scrollbar-color: rgba(249,115,22,0.50) transparent;
}

:root[data-theme="dark"] #chat-messages.chat-scroller-active::-webkit-scrollbar-thumb {
  background-color: rgba(249,115,22,0.50);
}

.agent-toggle,
.mission-input-row,
.chat-input-row { display: flex; align-items: center; gap: 10px; }

.chat-input-area .agent-toggle {
  overflow: visible;
}

.chat-model-switcher-wrap {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

#model-switcher-popover {
  left: auto !important;
  right: 0 !important;
  max-width: min(320px, calc(100vw - 32px));
  max-height: min(360px, calc(100vh - 180px));
  overflow: hidden;
}

.chat-input-row {
  position: relative;
}

.chat-input-area .chat-attach-btn,
.chat-input-area .chat-voice-btn {
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  flex: 0 0 auto;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 8px;
  border: 0;
  background:
    conic-gradient(
      from var(--pm-angle),
      #ff7a18,
      #f97316,
      #ea580c,
      #fb923c,
      #ff7a18
    );
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 6px 14px rgba(0,0,0,0.16),
    inset 0 1px 0 rgba(255,255,255,0.28);
  animation: prometheus-liquid-spin 9s linear infinite;
  will-change: transform;
  transition:
    transform 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}
.chat-input-area .chat-attach-btn > svg,
.chat-input-area .chat-voice-btn > svg,
.chat-input-area .chat-attach-btn > iconify-icon,
.chat-input-area .chat-voice-btn > iconify-icon {
  display: block;
  width: 15px;
  height: 15px;
}
.chat-input-area #chat-realtime-voice-btn > iconify-icon {
  transform: translateX(0.5px);
}
:root[data-theme="dark"] .chat-input-area .chat-attach-btn,
:root[data-theme="dark"] .chat-input-area .chat-voice-btn {
  border: 0;
  background:
    conic-gradient(
      from var(--pm-angle),
      #ff7a18,
      #f97316,
      #ea580c,
      #fb923c,
      #ff7a18
    );
  color: #fff;
  box-shadow:
    0 6px 14px rgba(0,0,0,0.32),
    0 0 12px rgba(249,115,22,0.16),
    inset 0 1px 0 rgba(255,255,255,0.28);
}
.chat-input-area .chat-attach-btn:hover,
.chat-input-area .chat-voice-btn:hover,
.chat-input-area .chat-attach-btn:focus-visible,
.chat-input-area .chat-voice-btn:focus-visible {
  transform: translateY(-1px) scale(1.025);
  color: #fff;
  box-shadow:
    0 10px 22px rgba(249,115,22,0.34),
    0 0 18px rgba(249,115,22,0.18),
    inset 0 1px 0 rgba(255,255,255,0.32);
}

body.right-canvas-open.browser-surface-active .chat-input-row {
  gap: 12px;
}

body.right-canvas-open.browser-surface-active .chat-attach-btn,
body.right-canvas-open.browser-surface-active .agent-toggle {
  display: none !important;
}

body.right-canvas-open.browser-surface-active .chat-voice-btn {
  position: absolute;
  top: 14px;
  z-index: 2;
}

body.right-canvas-open.browser-surface-active #chat-voice-btn {
  left: 14px;
}

body.right-canvas-open.browser-surface-active #chat-realtime-voice-btn {
  right: 14px;
}

body.right-canvas-open.browser-surface-active #chat-input {
  min-width: 0;
}

:root[data-creative-mode]:not([data-creative-mode=""]) .chat-input-area .chat-attach-btn,
:root[data-creative-mode]:not([data-creative-mode=""]) .chat-input-area .chat-voice-btn {
  display: none !important;
}
.chat-slash-command-popover {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% + 8px);
  border: 1px solid rgba(249, 115, 22, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.20);
  overflow: hidden;
  z-index: 25;
  backdrop-filter: blur(10px);
}
:root[data-theme="dark"] .chat-slash-command-popover {
  background: rgba(32, 32, 32, 0.98);
  border-color: rgba(249, 115, 22, 0.28);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
}
.chat-slash-command-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  font-family: 'Manrope', sans-serif;
}
.chat-slash-command-item:hover,
.chat-slash-command-item.active {
  background: rgba(249, 115, 22, 0.10);
}
.chat-slash-token {
  border: 1px solid rgba(249, 115, 22, 0.30);
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.10);
  color: #9a3412;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
  white-space: nowrap;
}
:root[data-theme="dark"] .chat-slash-token {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.16);
}
.chat-slash-label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-slash-hint {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}
.chat-command-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(249, 115, 22, 0.32);
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.12);
  color: #9a3412;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 900;
  padding: 9px 10px;
  line-height: 1;
}
.chat-command-chip:hover {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.46);
}
:root[data-theme="dark"] .chat-command-chip {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.15);
}
.queued-prompts-panel {
  display: none;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7faff, #f2f7ff);
  overflow: hidden;
}
.queued-prompts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.queued-prompts-list { padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
.queued-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #d9e4f4;
  border-radius: 10px;
  background: #fff;
  padding: 7px 8px;
  font-size: 12px;
  color: #21324a;
}
.queued-item-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queued-item-btn,
.queued-clear-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
}
.queued-item-btn:hover,
.queued-clear-btn:hover { border-color: #c1d2ec; color: #26487e; }

.agent-toggle { margin-bottom: 6px; }
.chat-input-area > .agent-toggle {
  margin-top: 4px !important;
}
.agent-toggle-right { margin-left: auto; position: relative; }
.agent-toggle-label { font-size: 11px; color: var(--muted); font-weight: 700; }

.toggle-switch { position: relative; width: 38px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #e8eef7;
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  top: 2px; left: 2px;
  border-radius: 50%;
  background: #6d7f97;
  transition: all 0.2s ease;
}
.toggle-switch input:checked + .toggle-track { background: #dce9ff; border-color: #9fc1f7; }
.toggle-switch input:checked + .toggle-track::after { left: 20px; background: var(--brand); }

.agent-mode-badge {
  display: none;
  border: 1px solid #9fc1f7;
  background: #ebf3ff;
  color: #0d4faf;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
}
.agent-mode-badge.visible { display: inline-block; }

#chat-input,
#mission-input,
#skill-search-input {
  flex: 1;
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.74);
}

#chat-input {
  min-width: 0;
  min-height: 48px;
  max-height: 150px;
  resize: none;
  line-height: 1.5;
  overflow-y: auto;
  border-radius: 16px;
  padding: 12px 14px;
  background:
    linear-gradient(
      135deg,
      var(--composer-input),
      color-mix(in srgb, var(--composer-input), var(--pm-orange) 3%)
    );
  color: var(--composer-text);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.16),
    inset 0 -1px 1px rgba(0,0,0,0.06);
}
#chat-input::placeholder {
  color: var(--composer-muted);
}
#chat-input:focus,
#mission-input:focus,
#skill-search-input:focus { border-color: #9fc1f7; box-shadow: 0 0 0 4px rgba(22, 104, 227, 0.11); }
#chat-input:focus {
  border-color: color-mix(in srgb, var(--pm-orange), transparent 38%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--pm-orange), transparent 82%),
    inset 0 1px 2px rgba(255,255,255,0.16);
}

.btn,
.send-btn,
.skill-search-btn,
.skill-install-btn {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #f97316, #c2410c);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  transition: all 0.15s ease;
  box-shadow: 0 6px 20px rgba(249,115,22,0.38);
}

.btn:hover,
.send-btn:hover,
.skill-search-btn:hover,
.skill-install-btn:hover { background: linear-gradient(145deg, #fb923c, #b45309); transform: translateY(-1px); }

.btn { padding: 10px 16px; font-size: 12px; }
.btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 10px; }
.btn-green { background: var(--ok); }
.btn-red { background: var(--err); }

.process-pill-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(225,223,218,0.88);
  color: #4f617b;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 9px;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.process-pill-btn:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
  color: #17243b;
}
:root[data-theme="dark"] .process-pill-btn {
  background: rgba(90,90,90,0.6);
  border-color: var(--line);
  color: #e8edf6;
}
:root[data-theme="dark"] .process-pill-btn:hover {
  background: rgba(105,105,105,0.72);
  border-color: var(--line-strong);
  color: #ffffff;
}

.live-turn-trace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 8px;
}
.live-turn-segment {
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 10px;
  color: var(--text);
}
.live-turn-segment > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.live-turn-text,
.live-turn-md {
  font-size: 13px;
  line-height: 1.65;
  white-space: normal;
  word-break: break-word;
}
.live-turn-think {
  border-color: rgba(99, 102, 241, 0.45);
  color: color-mix(in srgb, var(--text) 78%, var(--muted) 22%);
}
.live-turn-tool {
  border-color: rgba(245, 158, 11, 0.55);
}
.live-turn-result {
  border-color: rgba(34, 197, 94, 0.5);
}
.live-turn-error {
  border-color: rgba(239, 68, 68, 0.55);
}
.live-turn-assistant {
  border-color: rgba(59, 130, 246, 0.42);
}
.live-turn-assistant > span {
  display: none;
}
.live-turn-md > :first-child { margin-top: 0; }
.live-turn-md > :last-child { margin-bottom: 0; }

:root[data-theme="dark"] .live-turn-segment {
  border-color: rgba(148, 163, 184, 0.38);
}
:root[data-theme="dark"] .live-turn-think {
  border-color: rgba(129, 140, 248, 0.55);
  color: #cdd6e6;
}
:root[data-theme="dark"] .live-turn-tool {
  border-color: rgba(245, 158, 11, 0.56);
}
:root[data-theme="dark"] .live-turn-result {
  border-color: rgba(34, 197, 94, 0.52);
}
:root[data-theme="dark"] .live-turn-error {
  border-color: rgba(248, 113, 113, 0.58);
}

.chat-approval-card {
  margin: 2px 0 4px;
  border: 1px solid color-mix(in srgb, #d6b272 28%, var(--line) 72%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, #fff7ed 6%);
  color: var(--text);
  padding: 11px 12px;
  max-width: min(520px, 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.chat-approval-card-high { border-color: color-mix(in srgb, #f59e0b 42%, var(--line) 58%); }
.chat-approval-card-medium { border-color: color-mix(in srgb, #d6b272 38%, var(--line) 62%); }
.chat-approval-card-low { border-color: color-mix(in srgb, #22c55e 35%, var(--line) 65%); }
.chat-approval-card-denied,
.chat-approval-card-rejected,
.chat-approval-card-failed,
.chat-approval-card-expired {
  border-color: color-mix(in srgb, #ef4444 28%, var(--line) 72%);
  background: color-mix(in srgb, var(--panel) 96%, #fee2e2 4%);
  max-width: min(460px, 100%);
  box-shadow: none;
}
.chat-approval-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 7px;
}
.chat-approval-kicker {
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chat-approval-title {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
}
.chat-approval-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}
.chat-approval-status,
.chat-approval-risk {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 82%, #f59e0b 18%);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 7px;
  text-transform: uppercase;
}
.chat-approval-status-approved {
  background: color-mix(in srgb, #dcfce7 76%, var(--panel) 24%);
  color: #166534;
}
.chat-approval-status-denied,
.chat-approval-status-rejected,
.chat-approval-status-failed,
.chat-approval-status-expired {
  background: color-mix(in srgb, #fee2e2 78%, var(--panel) 22%);
  color: #991b1b;
}
.chat-approval-detail {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 650;
  margin-bottom: 5px;
}
.chat-approval-subdetail {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 7px;
}
.chat-approval-reason,
.chat-approval-scope {
  display: grid;
  gap: 3px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin-bottom: 8px;
}
.chat-approval-reason span,
.chat-approval-scope span {
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chat-approval-command {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  padding: 8px;
  font: 11px/1.5 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 132px;
  overflow: auto;
}
.chat-approval-technical {
  margin-top: 8px;
}
.chat-approval-technical summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  list-style-position: inside;
}
.chat-approval-technical[open] {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.chat-approval-systems {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
}
.chat-approval-systems span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.58);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
}
.chat-approval-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin-top: 10px;
}
.chat-approval-btn,
.chat-approval-link {
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  min-height: 34px;
}
.chat-approval-btn {
  border: 0;
  color: #fff;
}
.chat-approval-approve { background: #16a34a; }
.chat-approval-deny { background: #dc2626; }
.chat-approval-link {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.chat-approval-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-2);
}
.chat-approval-resolved {
  margin-top: 7px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
:root[data-theme="dark"] .chat-approval-card {
  background: color-mix(in srgb, var(--panel) 92%, #f59e0b 8%);
  border-color: rgba(214, 178, 114, 0.32);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}
:root[data-theme="dark"] .chat-approval-card-denied,
:root[data-theme="dark"] .chat-approval-card-rejected,
:root[data-theme="dark"] .chat-approval-card-failed,
:root[data-theme="dark"] .chat-approval-card-expired {
  background: color-mix(in srgb, var(--panel) 94%, #ef4444 6%);
  border-color: rgba(239, 68, 68, 0.22);
  box-shadow: none;
}
:root[data-theme="dark"] .chat-approval-command {
  background: rgba(0, 0, 0, 0.22);
  border-color: var(--line);
  color: #e8edf6;
}
:root[data-theme="dark"] .chat-approval-systems span {
  background: rgba(255,255,255,0.06);
}
:root[data-theme="dark"] .chat-approval-status,
:root[data-theme="dark"] .chat-approval-risk {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.26);
  color: #f7d08a;
}
:root[data-theme="dark"] .chat-approval-status-approved {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.25);
  color: #86efac;
}
:root[data-theme="dark"] .chat-approval-status-denied,
:root[data-theme="dark"] .chat-approval-status-rejected,
:root[data-theme="dark"] .chat-approval-status-failed,
:root[data-theme="dark"] .chat-approval-status-expired {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.24);
  color: #fca5a5;
}

.settings-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  font-family: 'Manrope', sans-serif;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  outline: none;
}

.settings-input:focus {
  border-color: #9fc1f7;
  box-shadow: 0 0 0 4px rgba(22, 104, 227, 0.11);
}

.settings-input[type="number"] {
  font-family: 'IBM Plex Mono', monospace;
}

select.settings-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, #6d7f97 50%),
    linear-gradient(135deg, #6d7f97 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% + 1px),
    calc(100% - 11px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.send-btn { width: 44px; height: 44px; font-size: 16px; }
.chat-input-area .send-btn {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background:
    conic-gradient(
      from var(--pm-angle),
      #ff7a18,
      #f97316,
      #ea580c,
      #fb923c,
      #ff7a18
    );
  color: #fff;
  box-shadow:
    0 12px 26px rgba(249,115,22,0.34),
    inset 0 1px 0 rgba(255,255,255,0.28);
  animation: prometheus-liquid-spin 9s linear infinite;
}
.chat-input-area .send-btn:hover {
  transform: translateY(-1px) scale(1.025);
  box-shadow:
    0 16px 32px rgba(249,115,22,0.42),
    0 0 26px rgba(249,115,22,0.24),
    inset 0 1px 0 rgba(255,255,255,0.32);
}
.send-btn:disabled,
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.chat-hint { color: var(--muted); font-size: 11px; }
.chat-hint .switch-link { color: var(--brand); cursor: pointer; text-decoration: underline; }

.thinking { display: flex; align-items: center; gap: 6px; padding-top: 4px; }
.thinking-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  opacity: 0.25;
  animation: thinkBounce 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkBounce { 0%,80%,100%{transform:scale(0.75);opacity:0.25;} 40%{transform:scale(1);opacity:1;} }

/* Thinking-only state: no bubble, just the dots */
.msg.thinking-only .msg-body {
  background: none !important;
  border: none !important;
  padding: 4px 0 !important;
  box-shadow: none !important;
}
.msg.thinking-only .msg-role { display: none; }

.react-steps {
  margin-top: 10px;
  border-left: 2px solid #c8d9f1;
  padding-left: 10px;
}
.react-step { font-size: 12px; margin-bottom: 8px; }
.react-step-thought { color: var(--muted); font-style: italic; }
.react-step-action { color: #0d4faf; font-weight: 700; margin-top: 3px; }
.react-step-result { color: var(--ok); margin-top: 3px; font-size: 11px; }
.react-step-result.error { color: var(--err); }
.react-steps-toggle { margin-top: 8px; font-size: 11px; color: #0d4faf; cursor: pointer; }

.think-block { margin-top: 8px; border: 1px solid #d5e3f8; border-radius: 12px; overflow: hidden; }
.think-toggle {
  width: 100%; border: 0; cursor: pointer; text-align: left;
  padding: 8px 10px; background: #f3f8ff; color: #23519f;
  display: flex; align-items: center; gap: 8px; font-size: 11px; font-family: 'IBM Plex Mono', monospace;
}
.think-toggle .think-icon { transition: transform 0.2s ease; }
.think-toggle.open .think-icon { transform: rotate(90deg); }
.think-content {
  display: none;
  padding: 10px 12px;
  background: #fff;
  color: var(--muted);
  border-top: 1px solid #dde7f6;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
}
.think-content.live {
  display: block;
}

.mission-bar-label,
.section-title,
.right-section-title {
  font-size: 11px;
  font-weight: 800;
  color: #5b6e88;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.job-detail-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.job-detail-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 18px; }

.task-card { padding: 14px; margin-bottom: 8px; }
.task-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.task-card-title { font-weight: 700; font-size: 14px; }
.task-card-desc { color: var(--muted); font-size: 12px; line-height: 1.7; }

.task-criteria { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.task-criteria-item { font-size: 12px; color: var(--muted); padding: 2px 0; }

#log-panel,
#process-log {
  background: var(--log-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: 'IBM Plex Mono', monospace;
  color: var(--log-text);
}

#log-panel { padding: 12px; margin-top: 16px; max-height: 220px; overflow-y: auto; font-size: 11px; }

.log-line { color: var(--log-text); }
.log-line.info { color: var(--log-info); }
.log-line.success { color: var(--ok); }
.log-line.error { color: var(--err); }
.log-line.warn { color: var(--warn); }

/* ── Right panel dark overrides ──────────────────────────────────
   CSS vars are scoped on .right-panel in base.css so most var()
   references inherit dark values automatically. Only hard-coded
   colours need explicit overrides here.
───────────────────────────────────────────────────────────────── */
.right-panel { color: #e8e6e1; }
.right-panel .right-section-title { color: #9a9890; }

/* Topbar – override inline background:var(--panel) */
.right-panel #right-panel-topbar {
  background: rgba(0,0,0,0.22) !important;
  border-bottom: 1px solid rgba(249,115,22,0.16) !important;
  color: #9a9890;
}

/* Process log */
.right-panel #process-log {
  background: rgba(0,0,0,0.28) !important;
  border: none !important;
  border-radius: 0 !important;
  color: #9aa8b0;
}
.right-panel #process-log .log-line { color: #9aa8b0; }
.right-panel #process-log .log-line.info    { color: #82adff; }
.right-panel #process-log .log-line.success { color: #4ade80; }
.right-panel #process-log .log-line.error   { color: #f87171; }
.right-panel #process-log .log-line.warn    { color: #fbbf24; }

/* Progress card */
.right-panel .progress-card {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
  box-shadow: none;
}

/* Connections */
.right-panel .right-section { border-bottom-color: rgba(255,255,255,0.08); }
.right-panel #connections-grid .conn-tile {
  background: rgba(255,255,255,0.06);
  border-color: rgba(249,115,22,0.22);
}

/* Pending approvals badge */
.right-panel #session-approvals-badge {
  background: rgba(249,115,22,0.15) !important;
  color: #fb923c !important;
  border-color: rgba(249,115,22,0.32) !important;
}

/* Canvas panel header (inherits dark vars, just enforce border) */
.right-panel #canvas-panel > div:first-child {
  border-bottom-color: rgba(255,255,255,0.10) !important;
}

/* Canvas mode toggle buttons active state in dark panel */
.right-panel .canvas-mode-btn.active { color: var(--text) !important; }

/* Section header separators */
.right-panel [style*="border-bottom"] {
  border-bottom-color: rgba(255,255,255,0.08);
}

/* Job items in new dark sidebar */
.session-item .job-item,
#jobs-list .job-item {
  background: var(--sidebar-item-bg);
  border: 1px solid rgba(249,115,22,0.25);
  color: var(--sidebar-text);
}
#jobs-list .job-item:hover { background: var(--sidebar-item-hover); }
#jobs-list .job-item.active { background: var(--sidebar-active-bg); border-color: var(--flame-border); }
#jobs-list .job-item.unread { border-color: var(--flame-border); }
#jobs-list .job-item-title { color: var(--sidebar-text); }
#jobs-list .empty-state { border-color: rgba(255,255,255,0.10); background: rgba(255,255,255,0.04); color: var(--sidebar-muted); }

.process-runs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.process-run-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.process-run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.process-run-title {
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-run-pill {
  flex-shrink: 0;
  border: 1px solid;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
}

.process-run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.process-run-preview,
.process-run-log {
  margin: 0;
  border-radius: 8px;
  background: var(--log-bg);
  color: var(--log-text);
  padding: 8px;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
}

.process-run-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.process-run-actions button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.process-run-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
}

.coding-workspace-card,
.coding-workspace-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px 12px;
}

.coding-workspace-empty {
  color: var(--muted);
  font-size: 12px;
}

.coding-workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.coding-workspace-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.coding-workspace-root {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  word-break: break-all;
}

.coding-workspace-pill {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}

.coding-workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.coding-workspace-grid div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}

.coding-workspace-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.coding-workspace-grid strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coding-workspace-command {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.coding-workspace-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.coding-workspace-files span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coding-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.coding-workspace-actions button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.coding-workspace-diff {
  margin: 10px 0 0;
  border-radius: 8px;
  background: var(--log-bg);
  color: var(--log-text);
  padding: 8px;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}

@keyframes prometheus-liquid-spin {
  to {
    --pm-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-theme="dark"] .sidebar::before,
  :root[data-theme="dark"] .sidebar::after,
  :root[data-theme="dark"] .topbar::before,
  :root[data-theme="dark"] .topbar::after,
  .sidebar::before,
  .sidebar::after,
  .topbar::before,
  .topbar::after,
  .chat-input-area,
  .chat-input-area::before,
  .chat-input-area::after,
  .chat-input-area .chat-attach-btn,
  .chat-input-area .chat-voice-btn,
  .chat-input-area .send-btn,
  .msg.user .msg-body::before {
    animation: none;
    transition-duration: 0.01ms;
  }
}

@media (max-width: 640px) {
  .chat-input-area {
    position: fixed;
    left: 50vw;
    width: calc(100vw - 24px);
    padding: 10px;
    border-radius: 22px;
  }
  body.right-canvas-open.browser-surface-active .chat-input-area {
    padding: 46px 12px 12px;
    border-radius: 22px;
  }
  .chat-input-row {
    gap: 8px;
  }
  .chat-input-area .chat-attach-btn,
  .chat-input-area .chat-voice-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .chat-input-area .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
  #chat-input {
    min-height: 48px;
    font-size: 13px;
    padding: 9px 11px;
  }
}
