@import './components-sidebar.css';
.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: var(--t-font-ui);
  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: var(--t-font-mono);
  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: var(--t-font-ui);
}
.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;
  /* Main messages and composer are one responsive conversation column. Keep
     both edges locked together as sidebars/canvases change the center width. */
  --chat-content-max-width: 860px;
  --chat-content-inline-gutter: clamp(20px, 4cqw, 44px);
  /* The welcome screen must size against the remaining center column, not the
     browser viewport when the sidebar and context drawer are both open. */
  container-type: inline-size;
  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;
}
#chat-view.chat-empty {
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 28px 20px clamp(240px, 32vh, 420px);
  gap: 18px;
}
#mission-view { display: none; }

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

.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); }

.chat-session-load-notice {
  width: min(620px, 100%);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 34%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel), transparent 8%);
  color: var(--text);
  text-align: left;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
}

.chat-session-load-notice--error {
  border-color: color-mix(in srgb, var(--red) 48%, var(--line));
}

.chat-session-load-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
  font-size: 18px;
  font-weight: 800;
}

.chat-session-load-notice--loading .chat-session-load-icon {
  animation: chat-session-load-spin 1.1s linear infinite;
}

@keyframes chat-session-load-spin {
  to { transform: rotate(360deg); }
}

.chat-session-load-copy {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
}

.chat-session-load-copy strong { font-size: 13px; line-height: 1.3; }
.chat-session-load-copy span { color: var(--muted); font-size: 12px; line-height: 1.4; }

.chat-session-load-retry {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--brand) 55%, var(--line));
  border-radius: 10px;
  padding: 7px 10px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.chat-session-load-retry:hover,
.chat-session-load-retry:focus-visible {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 18%, transparent);
}

.chat-welcome p {
  max-width: 620px;
  margin: 0;
  line-height: 1.55;
}

body:not(.pm-mobile-active) #chat-view .chat-welcome :is(h2, p) {
  font-family: 'Cinzel', Georgia, 'Times New Roman', serif;
  font-weight: 600;
}

.chat-welcome .hint {
  font-size: 13px;
  line-height: 1.45;
}

.chat-pulse-cards {
  width: min(860px, 100%);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.chat-pulse-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 15px;
  background: color-mix(in srgb, var(--panel), transparent 24%);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.07);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.chat-pulse-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--panel), var(--pm-orange) 4%);
  box-shadow: 0 14px 36px rgba(16, 24, 40, 0.11);
}

.chat-pulse-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: var(--pm-orange, var(--brand));
}

.chat-pulse-card-icon iconify-icon {
  display: block;
}

.chat-pulse-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--panel), var(--pm-orange) 4%);
  box-shadow: 0 14px 36px rgba(16, 24, 40, 0.11);
}

.chat-pulse-card-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-pulse-card-body {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root[data-theme="dark"] .chat-pulse-card {
  background: color-mix(in srgb, var(--panel), transparent 12%);
  border-color: var(--line);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

:root[data-theme="dark"] .chat-pulse-card:hover,
:root[data-theme="dark"] .chat-pulse-card:focus-visible {
  background: color-mix(in srgb, var(--panel), var(--pm-orange) 6%);
  border-color: var(--line-strong);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.30);
}

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

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

/* Visuals are inline conversation content, not a second card surface. The
   embedded document owns any intentional internal surfaces and receives the
   current Prometheus theme tokens from utils.js. */
.visual-block {
  width: 100%;
  max-width: 100%;
  margin: 12px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.visual-block iframe {
  width: 100%;
  max-width: 100%;
  border: 0;
  display: block;
  background: transparent;
}

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

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

.msg:not(.user).has-visual .msg-bubble-stack,
.msg:not(.user).has-visual .msg-body,
.msg:not(.user).has-visual .msg-content,
.msg:not(.user):has(.visual-block) .msg-bubble-stack,
.msg:not(.user):has(.visual-block) .msg-body,
.msg:not(.user):has(.visual-block) .msg-content {
  width: 100%;
  max-width: 100%;
}

.msg:not(.user).has-visual .visual-block,
.msg:not(.user):has(.visual-block) .visual-block {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

.msg:not(.user).has-visual .visual-block iframe,
.msg:not(.user):has(.visual-block) .visual-block iframe {
  width: 100%;
}

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

.msg-shell {
  width: min(var(--chat-content-max-width), calc(100% - var(--chat-content-inline-gutter) - var(--chat-content-inline-gutter)));
  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;
  pointer-events: none;
  transition: opacity 0.15s ease;
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
}

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

.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 auto;
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 0 0;
  box-shadow: none;
}

.msg:not(.user) .msg-body.msg-body-approval-only {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.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.voice-worker-handoff .msg-body {
  background: color-mix(in srgb, var(--pm-orange), #262626 82%);
  border-color: color-mix(in srgb, var(--t-accent) 34%, transparent);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 8px 22px rgba(0,0,0,0.12);
}

.msg.user.voice-worker-handoff .msg-body::before {
  opacity: 0.28;
}

.msg.user.voice-worker-handoff .msg-body::after {
  border-color: color-mix(in srgb, var(--t-accent) 34%, transparent);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--t-accent) 14%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.voice-handoff-role {
  color: rgba(255,220,186,0.92);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 6px;
}

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

.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 color-mix(in srgb, var(--t-accent) 18%, transparent);
  box-shadow:
    0 0 14px color-mix(in srgb, var(--t-accent) 18%, transparent),
    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: color-mix(in srgb, var(--t-accent) 16%, transparent);
  box-shadow:
    0 0 14px color-mix(in srgb, var(--t-accent) 14%, transparent),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.assistant-work-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.voice-room-speaker {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}
.assistant-work-timer::after {
  content: none;
  font-size: 15px;
  line-height: 1;
  opacity: .72;
}
.assistant-work-timer--expandable {
  width: auto;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--t-font-ui);
  cursor: pointer;
  text-align: left;
  user-select: none;
}
.assistant-work-timer--expandable::after {
  content: none;
}
.assistant-work-timer--expandable:active {
  opacity: .72;
}
.assistant-work-timer-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin-left: 0;
  transition: transform .2s ease;
  transform: rotate(-90deg);
}
.assistant-work-timer--expandable.expanded .assistant-work-timer-chevron {
  transform: rotate(0deg);
}
.assistant-status-divider {
  width: 100%;
  height: 2px;
  margin: 2px 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 76%, transparent);
}
:root[data-theme="dark"] .assistant-status-divider {
  background: color-mix(in srgb, var(--line) 62%, transparent);
}
.assistant-trace-drawer {
  display: none;
  width: 100%;
  margin-bottom: 8px;
}
.assistant-trace-drawer.open {
  display: block;
}
.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; max-width: 100%; min-width: 0; }
.goal-completion-report {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 9px;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

/* Desktop notification stack. These use the shared theme tokens instead of
   hard-coded light success/error colors, so completions remain legible in every
   desktop theme. */
@keyframes scToastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.__sc-toast {
  --sc-toast-accent: var(--brand);
  --sc-toast-tint: color-mix(in srgb, var(--brand) 10%, var(--panel));
  min-width: 260px;
  max-width: 390px;
  padding: 12px 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 92%, var(--sc-toast-accent) 8%);
  border: 1px solid color-mix(in srgb, var(--sc-toast-accent) 38%, var(--line));
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  font-family: var(--font);
  animation: scToastIn .2s ease;
  transition: opacity .24s ease, transform .24s ease, border-color .18s ease;
}
.__sc-toast--success { --sc-toast-accent: var(--ok); }
.__sc-toast--error { --sc-toast-accent: var(--err); }
.__sc-toast--warning { --sc-toast-accent: var(--warn); }
.__sc-toast--activity-live { --sc-toast-accent: var(--brand); }
.__sc-toast--activity-complete { --sc-toast-accent: var(--ok); }
.__sc-toast--activity-failed { --sc-toast-accent: var(--err); }
.__sc-toast-icon { flex: 0 0 auto; font-size: 16px; line-height: 1.35; color: var(--sc-toast-accent); }
.__sc-toast-copy { min-width: 0; flex: 1; }
.__sc-toast-title { color: var(--sc-toast-accent); font-size: 13px; font-weight: 800; line-height: 1.3; }
.__sc-toast-body { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.__sc-toast-close {
  flex: 0 0 auto;
  margin: -2px -1px 0 0;
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
.__sc-toast-close:hover { color: var(--text); background: color-mix(in srgb, var(--line) 72%, transparent); }
.__sc-toast-action {
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--sc-toast-accent) 42%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--sc-toast-accent) 15%, var(--panel));
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
}
.__sc-toast-action:hover { background: color-mix(in srgb, var(--sc-toast-accent) 24%, var(--panel)); }
.goal-completion-report strong { color: var(--text); font-weight: 700; }
.msg.user .msg-content {
  color: #ffffff;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.inline-command-token {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  vertical-align: baseline;
  gap: 4px;
  color: #48a6ff;
  font-weight: 700;
  line-height: 1.18;
  padding: 0;
  border: 0;
  background: transparent;
}
.inline-command-token-icon {
  width: .78em;
  height: .78em;
  flex: 0 0 auto;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  transform: rotate(45deg);
  opacity: .92;
  box-shadow: inset 0 0 0 1px rgba(72,166,255,.18);
}
.msg-content.markdown-body { white-space: normal; }
.msg-content img,
.markdown-body img,
.live-turn-md img,
#streaming-text-content img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: min(560px, 62vh);
  object-fit: contain;
  border-radius: 12px;
}
.msg-content p > img:only-child,
.markdown-body p > img:only-child {
  margin: 8px 0 2px;
}
.voice-pending-body {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--t-accent) 62%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--t-accent) 12%, transparent), 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: var(--t-font-mono); 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: color-mix(in srgb, var(--t-accent) 50%, transparent); }
.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;
}
details.msg-stage--bg > summary.msg-stage-title {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
details.msg-stage--bg > summary.msg-stage-title::-webkit-details-marker { display: none; }
details.msg-stage--bg > summary.msg-stage-title::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s ease;
}
details.msg-stage--bg[open] > summary.msg-stage-title { margin-bottom: 6px; }
details.msg-stage--bg[open] > summary.msg-stage-title::before { transform: rotate(45deg); }
details.msg-stage--bg > summary.msg-stage-title:hover { color: var(--text); }
.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;
}

.file-changes-card {
  width: min(100%, 640px);
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 88%, #fff 12%);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(20, 24, 32, 0.06);
}
.file-changes-grouped {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.file-changes-grouped .file-changes-card {
  margin-top: 0;
}
.file-changes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
}
.file-changes-head strong {
  min-width: 0;
}
.file-changes-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.file-change-restore-btn {
  border: 1px solid color-mix(in srgb, var(--brand) 42%, var(--line) 58%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 10%, var(--panel) 90%);
  color: var(--brand);
  cursor: pointer;
  flex: 0 0 auto;
  font-family: var(--t-font-ui);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  padding: 6px 9px;
}
.file-change-restore-btn:hover,
.file-change-restore-btn:focus-visible {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  outline: none;
}
.file-change-restore-btn:disabled {
  cursor: wait;
  opacity: 0.62;
}
.file-changes-total,
.file-change-counts {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  font-family: var(--t-font-mono);
  font-weight: 800;
  font-size: 12px;
}
.file-changes-card .ins { color: #2f9e44; }
.file-changes-card .del { color: #c7435a; }
.file-change-list {
  display: flex;
  flex-direction: column;
}
.file-change-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--text);
}
.file-change-row:last-child,
.file-change-more .file-change-row:last-child {
  border-bottom: 0;
}
.file-change-row.is-openable {
  cursor: pointer;
}
.file-change-row.is-openable:hover,
.file-change-row.is-openable:focus-visible {
  background: color-mix(in srgb, var(--brand) 8%, var(--panel) 92%);
  outline: none;
}
.file-change-row.is-disabled {
  opacity: 0.72;
}
.file-change-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.file-change-status {
  flex: 0 0 auto;
  min-width: 54px;
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}
.file-change-status.added { background: rgba(47, 158, 68, 0.12); color: #218739; }
.file-change-status.deleted { background: rgba(199, 67, 90, 0.12); color: #b8324b; }
.file-change-status.renamed { background: rgba(74, 130, 209, 0.12); color: #326cba; }
.file-change-path {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-change-more {
  border-bottom: 1px solid var(--line);
}
.file-change-more:last-child {
  border-bottom: 0;
}
.file-change-more summary {
  min-height: 38px;
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  list-style: none;
}
.file-change-more summary::-webkit-details-marker { display: none; }
.file-change-more summary::after {
  content: '›';
  float: right;
  color: var(--muted);
  font-size: 18px;
  line-height: 12px;
}
.file-change-more[open] summary::after {
  content: '⌄';
}
:root[data-theme="dark"] .file-changes-card {
  background: rgba(31, 34, 39, 0.94);
  box-shadow: none;
}
:root[data-theme="dark"] .file-change-row {
  background: rgba(25, 28, 33, 0.82);
}
:root[data-theme="dark"] .file-change-row.is-openable:hover,
:root[data-theme="dark"] .file-change-row.is-openable:focus-visible {
  background: color-mix(in srgb, var(--t-accent) 8%, transparent);
}
:root[data-theme="dark"] .file-changes-card .ins { color: #7bd88f; }
:root[data-theme="dark"] .file-changes-card .del { color: #ff8da1; }

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

/* ── Floating chat input (ChatGPT/Claude style) ── */
.background-spawn-dock {
  position: absolute;
  left: 50%;
  bottom: var(--background-spawn-dock-bottom, 128px);
  transform: translateX(-50%);
  /* One horizontal row (side scroller) instead of a vertical stack. */
  width: max-content;
  max-width: min(860px, calc(100% - 40px));
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  z-index: 11;
  pointer-events: none;
}
.background-spawn-dock[hidden] { display: none; }
.background-spawn-dock > .background-spawn-lane { flex: 0 0 min(260px, calc(100vw - 96px)); min-width: 0; }
.background-spawn-dock.has-many { flex-direction: row; flex-wrap: nowrap; align-items: stretch; overflow-x: auto; overflow-y: hidden; pointer-events: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; padding-bottom: 4px; }
.background-spawn-dock.has-many > * { scroll-snap-align: start; }
.background-spawn-dock.is-collapsed { width: max-content; max-width: calc(100% - 40px); }
.background-spawn-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid color-mix(in srgb, var(--composer-border), transparent 8%);
  border-radius: 999px;
  background: var(--composer-bg);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}
.background-spawn-pill strong { font-size: 11px; font-weight: 700; }
.background-spawn-pill-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--pm-orange, var(--t-accent)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pm-orange, var(--t-accent)) 14%, transparent); }
.background-spawn-close {
  /* Inline first item of the row; sticky so it stays reachable while scrolling. */
  position: sticky;
  left: 0;
  z-index: 3;
  flex: 0 0 26px;
  align-self: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--composer-border);
  border-radius: 999px;
  background: var(--composer-bg);
  color: var(--muted);
  font: 18px/1 system-ui, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.background-spawn-lane {
  pointer-events: auto;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--composer-border), transparent 8%);
  border-radius: 18px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--composer-bg), var(--panel) 18%),
      color-mix(in srgb, var(--composer-bg), transparent 8%)
    );
  box-shadow:
    0 14px 38px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.14);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}
.background-spawn-close:hover, .background-spawn-close:focus-visible { color: var(--text); }
.background-spawn-summary {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 11px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.background-spawn-avatar {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--background-agent-color, var(--pm-orange)) 18%, var(--panel-2));
  color: var(--background-agent-color, var(--pm-orange));
  font-size: 10px;
  font-weight: 900;
}
.background-spawn-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.background-spawn-main strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 500;
}
.background-spawn-main em,
.background-spawn-task {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}
.background-spawn-task {
  padding: 0 12px 8px 55px;
}
.background-spawn-status {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.background-spawn-lane.running .background-spawn-status,
.background-spawn-lane.in_progress .background-spawn-status {
  color: var(--pm-orange);
}
.background-spawn-lane.completed .background-spawn-status {
  color: var(--green, #16a34a);
}
.background-spawn-lane.failed .background-spawn-status {
  color: var(--red);
}
.background-spawn-chevron {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.background-spawn-panel {
  display: none;
  max-height: min(56vh, 520px);
  overflow: auto;
  margin: 0 10px 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  font-size: 11px;
  line-height: 1.55;
}
.background-spawn-lane.expanded .background-spawn-panel {
  display: block;
}
.background-spawn-plan {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-2) 94%, var(--composer-bg) 6%);
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  padding: 10px;
}
.background-spawn-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--text);
}
.background-spawn-plan-head strong {
  font-size: 13px;
  font-weight: 900;
}
.background-spawn-plan-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.background-spawn-plan-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.background-spawn-events {
  min-height: 180px;
}
.background-spawn-empty {
  color: var(--muted);
  font-size: 11px;
}

.background-agent-side-pane .side-chat-title { font-weight: 650; }
.background-agent-side-messages {
  align-items: center;
  padding-bottom: var(--desktop-composer-clearance, 180px);
}
.background-agent-side-messages .msg-shell { width: min(100%, 680px); }

.chat-input-area {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--chat-content-max-width), calc(100% - var(--chat-content-inline-gutter) - var(--chat-content-inline-gutter)));
  overflow: visible;
  isolation: isolate;
  background: var(--composer-bg);
  border: none;
  border-radius: 24px;
  box-shadow: none;
  padding: 10px 12px 8px;
  z-index: 10;
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  transition: background 200ms ease;
}

#chat-view.chat-empty .chat-input-area {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: min(780px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  margin: 2px auto 0;
}

#chat-view.chat-empty .queued-prompts-panel,
#chat-view.chat-empty #chat-design-selection-pills,
#chat-view.chat-empty #chat-file-staging {
  text-align: left;
}

#chat-view.chat-empty .chat-input-row {
  min-height: 48px;
}

#chat-view.chat-empty .agent-toggle {
  margin-top: 4px !important;
}

#chat-view.chat-empty .chat-context-window-btn,
#chat-view.chat-empty .chat-context-window-popover {
  display: none !important;
}
.chat-input-area::before,
.chat-input-area::after {
  content: none;
  display: none;
}
.chat-input-area > * {
  position: relative;
  z-index: 1;
}

/* Desktop new-chat stack: welcome content, recessed project shelf, composer.
   The selector is a sibling of the composer so its popover can clear the Brain
   cards while its tucked lower edge remains beneath the composer surface. */
body:not(.pm-mobile-active) #chat-view:has(> #chat-messages > #chat-welcome) > #chat-messages {
  position: relative;
  z-index: 0;
}
body:not(.pm-mobile-active) #chat-view > .chat-new-context-dock {
  display: flex;
  position: relative;
  inset: auto;
  flex: 0 0 auto;
  width: min(708px, calc(100% - 72px));
  max-width: calc(100% - 72px);
  margin: 0 auto -18px;
  box-sizing: border-box;
  min-height: 52px;
  padding: 6px 8px 24px;
  overflow: visible;
  border: 1px solid var(--composer-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--composer-bg) 88%, #000 12%);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  z-index: 1;
}
body:not(.pm-mobile-active).desktop-new-context-popover-open #chat-view > .chat-new-context-dock {
  z-index: 1;
}
body:not(.pm-mobile-active) #chat-view:has(> #chat-messages > #chat-welcome) > .chat-input-area {
  position: relative;
  z-index: 2;
}
body:not(.pm-mobile-active) #chat-view > .chat-new-context-dock[hidden],
body:not(.pm-mobile-active) .chat-new-context-popover[hidden] {
  display: none !important;
}
body.background-agent-detail-active:not(.pm-mobile-active) .chat-new-context-dock,
body.background-agent-detail-active:not(.pm-mobile-active) .chat-new-context-popover {
  display: none !important;
}
.chat-new-context-trigger {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.chat-new-context-trigger:hover,
.chat-new-context-trigger:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
}
.chat-new-context-icon,
.chat-new-context-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pm-gold, var(--brand));
}
.chat-new-context-icon {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.chat-new-context-icon svg { width: 15px; height: 15px; }
.chat-new-context-value {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-new-context-value strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-new-context-value small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.2;
}
.chat-new-context-chevron svg { width: 14px; height: 14px; }
.chat-new-context-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% - 8px);
  width: min(360px, calc(100vw - 40px));
  max-height: min(56vh, 420px);
  box-sizing: border-box;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--composer-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--composer-bg) 94%, #000 6%);
  box-shadow: 0 16px 34px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 20;
}
.chat-new-context-popover-title {
  padding: 6px 8px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.chat-new-context-loading {
  padding: 12px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.chat-new-context-option {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.chat-new-context-option:hover,
.chat-new-context-option:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
}
.chat-new-context-option-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel-2) 82%, var(--brand) 18%);
  color: var(--pm-gold, var(--brand));
  font-size: 18px;
  line-height: 1;
}
.chat-new-context-option-icon svg { width: 14px; height: 14px; }
.chat-new-context-option-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.chat-new-context-option-copy strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-new-context-option-check {
  width: 16px;
  flex: 0 0 16px;
  color: var(--pm-gold, var(--brand));
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}
.chat-new-context-new-project {
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 5px 5px;
}
.chat-new-context-new-project .chat-new-context-option-icon {
  background: color-mix(in srgb, var(--pm-orange) 18%, var(--panel-2));
  color: var(--pm-orange);
}
.chat-new-project-form {
  display: grid;
  gap: 8px;
  padding: 2px 4px 4px;
}
.chat-new-project-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}
.chat-new-project-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: color-mix(in srgb, var(--panel-2) 86%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}
.chat-new-project-input:focus {
  border-color: color-mix(in srgb, var(--brand) 68%, var(--line-strong));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent);
}
.chat-new-project-error {
  color: var(--err, #f87171);
  font-size: 10px;
  line-height: 1.35;
}
.chat-new-project-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 2px;
}
.chat-new-project-button {
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}
.chat-new-project-button:hover { color: var(--text); background: var(--panel-2); }
.chat-new-project-confirm {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.chat-new-project-confirm:hover { background: color-mix(in srgb, var(--brand) 88%, #000); color: #fff; }
.chat-new-project-button:disabled { opacity: .55; cursor: default; }

.chat-skill-trigger-pill {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  max-width: min(720px, calc(100vw - 40px));
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--composer-border);
  border-radius: 16px;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--composer-bg), var(--panel) 16%),
      color-mix(in srgb, var(--composer-bg), transparent 10%)
    );
  color: var(--text);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255,255,255,0.16);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  z-index: 14;
  transform-origin: 50% 100%;
}
.chat-skill-trigger-pill.pop {
  animation: skill-trigger-pill-pop 360ms cubic-bezier(.22,1.34,.36,1);
}
.chat-skill-trigger-pill.expanded {
  width: min(680px, calc(100vw - 40px));
  align-items: flex-start;
  border-radius: 18px;
}
.skill-trigger-summary {
  min-width: 0;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 5px 8px;
  font: inherit;
  cursor: pointer;
}
.skill-trigger-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 16%, var(--panel-2));
  color: var(--pm-orange, var(--t-accent));
}
.skill-trigger-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.skill-trigger-count {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-2) 88%, var(--brand) 12%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}
.skill-trigger-preview {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.skill-trigger-preview span {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.skill-trigger-close {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.skill-trigger-close:hover,
.skill-trigger-summary:hover {
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
}
.skill-trigger-expanded {
  width: 100%;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 4px 4px;
  scrollbar-width: thin;
}
.skill-trigger-item {
  flex: 0 0 auto;
  max-width: 168px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel-2) 72%, transparent);
  color: var(--text);
  padding: 6px 9px;
  font: inherit;
  cursor: pointer;
}
.skill-trigger-item.active,
.skill-trigger-item:hover {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  background: color-mix(in srgb, var(--brand) 12%, var(--panel-2));
}
.skill-trigger-item-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}
.skill-trigger-item-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: capitalize;
}
.skill-trigger-description {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 8px 10px 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.skill-trigger-description-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.skill-trigger-description strong {
  color: var(--text);
  font-size: 12px;
}
.skill-trigger-description-copy small {
  color: var(--muted);
  font-size: 10px;
}
.skill-trigger-remove {
  border: 1px solid color-mix(in srgb, var(--danger, #ef4444) 42%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent);
  color: var(--danger, #ef4444);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  padding: 7px 9px;
  white-space: nowrap;
}
.skill-trigger-remove:hover {
  background: color-mix(in srgb, var(--danger, #ef4444) 18%, transparent);
}
:root[data-theme="dark"] .chat-skill-trigger-pill {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--composer-bg), var(--panel) 18%),
      color-mix(in srgb, var(--composer-bg), transparent 8%)
    );
  border-color: var(--composer-border);
  box-shadow: 0 16px 42px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.10);
}
:root[data-theme="dark"] .skill-trigger-count,
:root[data-theme="dark"] .skill-trigger-close:hover,
:root[data-theme="dark"] .skill-trigger-summary:hover {
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
}
:root[data-theme="dark"] .skill-trigger-item {
  background: color-mix(in srgb, var(--panel-2) 76%, transparent);
  border-color: var(--line);
}
:root[data-theme="dark"] .skill-trigger-item.active,
:root[data-theme="dark"] .skill-trigger-item:hover {
  background: color-mix(in srgb, var(--brand) 14%, var(--panel-2));
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
}
@keyframes skill-trigger-pill-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.96); }
  70% { opacity: 1; transform: translateX(-50%) translateY(-2px) scale(1.015); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.chat-input-area:hover,
.chat-input-area:focus-within {
  box-shadow: none;
  border: none;
}
:root[data-theme="dark"] .chat-input-area {
  background: var(--composer-bg);
  border: none;
  box-shadow: none;
}
:root[data-theme="dark"] .chat-input-area::before,
:root[data-theme="dark"] .chat-input-area::after {
  content: none;
  display: none;
}
:root[data-theme="dark"] .chat-input-area:hover,
:root[data-theme="dark"] .chat-input-area:focus-within {
  box-shadow: none;
  border: none;
}

/* Chat messages container - centered with max-width */
#chat-messages {
  padding: 28px 0 var(--desktop-composer-clearance, 180px);
  scroll-padding-bottom: var(--desktop-composer-clearance, 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-message-navigator {
  position: absolute;
  z-index: 8;
  left: 18px;
  top: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  min-height: 80px;
  max-height: min(44vh, 300px);
  transform: translateY(-50%);
  pointer-events: auto;
}
.chat-message-nav-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 30px;
  height: 11px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.chat-message-nav-marker::before {
  content: '';
  display: block;
  width: 9px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 30%, transparent);
  box-shadow: none;
  transition: width 180ms cubic-bezier(.22,.75,.25,1), background 160ms ease, box-shadow 160ms ease;
}
.chat-message-navigator.is-pointer-tracking .chat-message-nav-marker::before {
  width: var(--nav-hover-wave-width, 9px);
}
.chat-message-nav-marker.active::before {
  background: var(--brand);
  box-shadow: 0 0 9px color-mix(in srgb, var(--brand) 42%, transparent);
}
.chat-message-nav-marker:hover,
.chat-message-nav-marker:focus-visible {
  outline: none;
}
.chat-message-nav-marker:focus-visible::before {
  width: 26px;
  background: color-mix(in srgb, var(--brand) 82%, #fff 18%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 54%, transparent);
}
.chat-message-nav-preview {
  position: absolute;
  left: 48px;
  top: 50%;
  width: min(300px, 34vw);
  padding: 10px 12px;
  border: 0;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 93%, #000 7%);
  box-shadow: 0 16px 42px rgba(0,0,0,.26);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-6px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.chat-message-nav-preview strong,
.chat-message-nav-preview small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.chat-message-nav-preview strong { color: var(--text); font-size: 12px; font-weight: 700; line-height: 1.35; }
.chat-message-nav-preview small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.38; }
.chat-message-nav-marker:hover .chat-message-nav-preview,
.chat-message-nav-marker:focus-visible .chat-message-nav-preview { opacity: 1; transform: translateY(-50%) translateX(0); }
.msg-shell.navigator-target .msg-body { animation: chat-message-navigator-flash 1.4s ease; }
@keyframes chat-message-navigator-flash {
  0%, 100% { box-shadow: none; }
  25%, 70% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 68%, transparent), 0 0 26px color-mix(in srgb, var(--brand) 30%, transparent); }
}
@media (max-width: 900px) { .chat-message-navigator { display: none; } }

#chat-view.chat-empty .chat-welcome {
  width: min(760px, 100%);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: auto;
  justify-content: flex-start;
  gap: 9px;
}

#chat-view.chat-empty .chat-welcome p {
  width: min(620px, 100%);
  max-width: 100%;
}

#chat-view.chat-empty .chat-welcome-icon img {
  width: 72px !important;
  height: 72px !important;
}

#chat-view.chat-empty .chat-welcome h2 {
  margin: 2px 0 0;
  font-size: 36px;
  line-height: 1.08;
}

/* A compact center column is normal when the session rail and context panel
   share the screen. Keep the opening composition intact, just denser. */
@container (max-width: 820px) {
  body:not(.pm-mobile-active) #chat-view.chat-empty {
    padding-inline: 14px;
    gap: 14px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome-icon img {
    width: 60px !important;
    height: 60px !important;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome h2 {
    font-size: 30px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome p {
    font-size: 13px;
    line-height: 1.42;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome .hint {
    font-size: 12px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-cards {
    gap: 8px;
    margin-top: 12px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-card {
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-card-body {
    font-size: 12px;
    line-height: 1.35;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-input-area {
    padding: 8px 10px 7px;
    border-radius: 20px;
  }
}

/* The empty desktop chat is a composed landing state. Let the message column
   size to the welcome cards so the flow composer follows the third card rather
   than being pushed to the bottom by an empty flex spacer. */
@media (min-width: 901px) {
  body:not(.pm-mobile-active) #chat-view.chat-empty {
    overflow-x: hidden;
    overflow-y: auto;
    align-items: stretch;
    justify-content: center;
    padding: clamp(12px, 2.5vh, 28px) 20px clamp(12px, 2vh, 22px);
    gap: 0;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty > #chat-messages {
    flex: 0 0 auto;
    min-height: auto;
    width: 100%;
    height: auto;
    padding: 0 0 8px;
    overflow-x: hidden;
    overflow-y: visible;
    justify-content: flex-start;
    align-items: center;
    -webkit-mask-image: none;
    mask-image: none;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome {
    position: relative;
    z-index: 2;
    flex: 0 1 auto;
    max-height: 100%;
    gap: clamp(6px, 1vh, 9px);
    transform: translateY(clamp(-28px, -2.5vh, -8px));
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome-icon img {
    width: clamp(56px, 8vh, 72px) !important;
    height: clamp(56px, 8vh, 72px) !important;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome h2 {
    font-size: clamp(28px, 4.6vh, 36px);
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-cards {
    margin-top: clamp(8px, 1.5vh, 18px);
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-card {
    min-height: clamp(44px, 6vh, 50px);
    padding: clamp(9px, 1.4vh, 12px) clamp(12px, 1.6vw, 16px);
    position: relative;
    z-index: 3;
    opacity: 1;
    visibility: visible;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-card-body {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty > .chat-input-area {
    position: relative;
    z-index: 10;
    flex: 0 0 auto;
    margin: clamp(8px, 1.5vh, 16px) auto 0;
  }
}

@media (min-width: 901px) and (max-height: 760px) {
  body:not(.pm-mobile-active) #chat-view.chat-empty {
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 10px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-welcome h2 {
    font-size: 28px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-cards {
    gap: 9px;
    margin-top: 8px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-pulse-card {
    min-height: 42px;
    padding: 10px 11px;
  }

  body:not(.pm-mobile-active) #chat-view.chat-empty .chat-input-area {
    padding: 7px 10px 6px;
  }
}

#chat-messages.chat-scroller-active {
  scrollbar-color: color-mix(in srgb, var(--t-accent) 42%, transparent) 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: color-mix(in srgb, var(--t-accent) 42%, transparent);
}

:root[data-theme="dark"] #chat-messages.chat-scroller-active {
  scrollbar-color: color-mix(in srgb, var(--t-accent) 50%, transparent) transparent;
}

:root[data-theme="dark"] #chat-messages.chat-scroller-active::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--t-accent) 50%, transparent);
}

#chat-messages.side-chat-split-shell {
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.92fr);
  align-items: stretch;
  gap: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  -webkit-mask-image: none;
  mask-image: none;
}

.side-chat-main-pane,
.side-chat-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #d8d6d2 url('/assets/chat-main-background.png') center center / cover no-repeat;
}

:root[data-theme="dark"] .side-chat-main-pane,
:root[data-theme="dark"] .side-chat-pane {
  background: #1a1a1a url('/assets/chat-main-background-dark.png') center center / cover no-repeat;
}

.side-chat-main-pane {
  border-right: 1px solid var(--line);
}

.side-chat-pane-header,
.side-chat-header {
  min-height: 46px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--panel), transparent 12%);
  backdrop-filter: blur(16px);
}

.side-chat-title-wrap {
  min-width: 0;
}

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

.side-chat-title {
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-chat-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.side-chat-close:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.side-chat-main-messages,
.side-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 22px var(--desktop-composer-clearance, 180px);
  scroll-padding-bottom: var(--desktop-composer-clearance, 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  scrollbar-width: thin;
}

.side-chat-messages {
  padding-bottom: var(--desktop-composer-clearance, 180px);
}

.side-chat-main-messages .msg-shell,
.side-chat-messages .msg-shell {
  width: min(100%, 760px);
}

.side-chat-messages .msg-shell {
  width: min(100%, 680px);
}

.side-chat-boundary-msg .msg-body {
  border-style: dashed;
  color: var(--muted);
  font-size: 12px;
}

.side-chat-empty {
  margin: auto;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  max-width: 280px;
}

.side-chat-composer.chat-input-area {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 52px));
  max-width: calc(100% - 52px);
  margin: 0;
}

.side-chat-composer.chat-input-area .send-btn {
  flex: 0 0 auto;
}

.side-chat-composer-footer .chat-context-window-btn {
  cursor: default;
}

.unified-desktop-chat-composer {
  box-sizing: border-box;
}
.unified-desktop-chat-composer .chat-composer-attachment-stack {
  display: block;
  min-height: 0;
}
.unified-desktop-chat-composer .chat-file-staging {
  margin: 0 0 6px;
}
.unified-desktop-chat-composer .unified-chat-model-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font: 11px var(--t-font-ui);
  cursor: default;
}
.unified-chat-queue-badge {
  align-items: center;
  margin-left: 8px;
  color: var(--brand);
  font-weight: 700;
}
.unified-live-progress {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.unified-agent-chat-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #d8d6d2 url('/assets/chat-main-background.png') center center / cover no-repeat;
}
:root[data-theme="dark"] .unified-agent-chat-shell {
  background: #1a1a1a url('/assets/chat-main-background-dark.png') center center / cover no-repeat;
}
.unified-agent-chat-header {
  min-height: 46px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--panel), transparent 12%);
  backdrop-filter: blur(16px);
}
.unified-agent-chat-header .side-chat-title-wrap { min-width: 0; }
.unified-agent-chat-header .side-chat-kicker,
.unified-agent-chat-header .side-chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unified-agent-chat-participants {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unified-agent-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 22px var(--desktop-composer-clearance, 180px);
  scroll-padding-bottom: var(--desktop-composer-clearance, 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  scrollbar-width: thin;
}
.unified-agent-chat-messages .msg-shell { width: min(100%, 680px); }
.unified-agent-chat-composer.chat-input-area {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  bottom: 18px !important;
  transform: translateX(-50%) !important;
  width: min(760px, calc(100% - 52px)) !important;
  max-width: calc(100% - 52px) !important;
  margin: 0 !important;
}
.unified-agent-chat-composer .chat-input-row { align-items: center; }
.unified-agent-chat-composer .chat-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unified-agent-chat-composer .subagent-reasoning-trigger { flex: 0 0 auto; }

#side-chats-toggle-btn.active {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand), var(--line) 42%);
  background: color-mix(in srgb, var(--brand), var(--panel-2) 84%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand), transparent 70%);
}

body.side-chat-split-active #chat-view > .chat-input-area {
  left: 25%;
  width: min(760px, calc(50% - 52px));
  max-width: calc(50% - 52px);
}

@media (max-width: 900px) {
  #chat-messages.side-chat-split-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(280px, 0.9fr);
  }
  .side-chat-main-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  body.side-chat-split-active #chat-view > .chat-input-area {
    left: 50%;
    width: calc(100% - 28px);
    max-width: 760px;
  }
}

/* Side-chat split: stack panes when the right panel narrows the chat column (container query). */
@container desktop-chat (max-width: 1040px) {
  body:not(.pm-mobile-active) #chat-messages.side-chat-split-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(280px, 0.9fr);
  }
  body:not(.pm-mobile-active) .side-chat-main-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  body:not(.pm-mobile-active).side-chat-split-active #chat-view > .chat-input-area {
    left: 50%;
    width: calc(100% - 28px);
    max-width: 760px;
  }
}

.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;
  gap: 8px;
  min-width: 0;
}

.chat-context-window-btn {
  --chat-context-window-deg: 0deg;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: conic-gradient(
    #5ab4ff var(--chat-context-window-deg),
    rgba(148, 163, 184, 0.20) 0
  );
  color: inherit;
  cursor: pointer;
  -webkit-mask: radial-gradient(circle farthest-side at center, transparent 70%, white 72%);
  mask: radial-gradient(circle farthest-side at center, transparent 70%, white 72%);
}

.chat-context-window-btn:hover,
.chat-context-window-btn:focus-visible,
.chat-context-window-btn[aria-expanded="true"] {
  outline: none;
  filter: drop-shadow(0 0 4px rgba(90, 180, 255, 0.60));
}

.chat-context-window-btn.is-over-capacity {
  background: conic-gradient(var(--t-accent) var(--chat-context-window-deg), rgba(148, 163, 184, 0.20) 0);
}

.chat-context-window-dot {
  display: none;
}

.chat-context-window-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(342px, calc(100vw - 34px));
  padding: 10px 11px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.98);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
  z-index: 125;
}

:root[data-theme="dark"] .chat-context-window-popover {
  background: rgba(42, 42, 42, 0.98);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.40);
}

.chat-context-window-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 46px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

button.chat-context-window-row {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
}

.chat-context-window-row.is-expandable {
  cursor: pointer;
}

.chat-context-window-row.is-expandable:hover .chat-context-window-label {
  color: var(--text);
}

.chat-context-window-row.is-child {
  padding-left: calc(var(--ccw-depth, 0) * 12px);
  font-size: 11px;
  opacity: 0.86;
}

.chat-context-window-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-context-window-caret {
  width: 8px;
  flex: 0 0 8px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

.chat-context-window-estimate {
  flex: 0 0 auto;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(125, 185, 255, 0.10);
  color: rgba(190, 216, 255, 0.78);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chat-context-window-value,
.chat-context-window-percent,
.chat-context-window-row span:last-child {
  color: var(--text);
  font-weight: 800;
  text-align: right;
}

.chat-context-window-value {
  font-variant-numeric: tabular-nums;
}

.chat-context-window-percent {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chat-context-window-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 2px;
  background: rgba(100, 116, 139, 0.42);
}

.chat-context-window-row.is-active .chat-context-window-swatch {
  background: #7db9ff;
}

.chat-context-window-row.is-out-of-band {
  opacity: 0.72;
}

.chat-context-window-head {
  font-weight: 800;
  grid-template-columns: minmax(0, 1fr) auto;
}

.chat-context-window-track {
  height: 4px;
  margin: 6px 0 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(100, 116, 139, 0.22);
}

.chat-context-window-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38a3ff, #7dd3fc);
  transition: width 180ms ease;
}

.chat-context-window-fill.is-over-capacity {
  background: linear-gradient(90deg, var(--t-accent), #fb7185);
}

.chat-context-window-metrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* A class `display` overrides the bare [hidden] attribute, so guard it explicitly
   — keeps the detailed breakdown collapsed until the bar is clicked. */
.chat-context-window-metrics[hidden],
.chat-context-window-plan[hidden] { display: none; }

/* Clickable context-window bar that expands the detailed breakdown */
.chat-context-window-toggle {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-context-window-toggle .chat-context-window-head span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ccw-chevron {
  transition: transform 160ms ease;
  opacity: 0.6;
}
.chat-context-window-toggle[aria-expanded="true"] .ccw-chevron {
  transform: rotate(90deg);
}
.chat-context-window-toggle:hover .ccw-chevron { opacity: 1; }

/* Plan usage (live provider limits) */
.chat-context-window-plan {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ccw-plan-head {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.ccw-plan-body { display: flex; flex-direction: column; gap: 9px; }
.ccw-plan-gauge { display: flex; flex-direction: column; gap: 4px; }
.ccw-plan-gauge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.ccw-plan-gauge-label { color: var(--muted); }
.ccw-plan-gauge-pct { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.ccw-plan-gauge-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.22);
  overflow: hidden;
}
.ccw-plan-gauge-fill { height: 100%; border-radius: 999px; transition: width 200ms ease; }
.ccw-plan-gauge-fill.ok { background: linear-gradient(90deg, #38a3ff, #7dd3fc); }
.ccw-plan-gauge-fill.warn { background: linear-gradient(90deg, #f0b54f, #e08a2f); }
.ccw-plan-gauge-fill.crit { background: linear-gradient(90deg, #f0744f, #e0402f); }
.ccw-plan-tokens { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

#model-switcher-popover,
[data-model-switcher-popover="1"] {
  left: auto !important;
  right: 0 !important;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: max-content;
  max-width: min(600px, calc(100vw - 32px));
  padding: 0 !important;
  overflow: visible;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.model-switcher-panel {
  box-sizing: border-box;
  width: 238px;
  max-height: min(270px, calc(100vh - 180px));
  padding: 7px;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 94%, #000 6%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255,255,255,.06);
}
.model-switcher-detail { width: 232px; }
.model-switcher-heading,
.model-switcher-detail-title {
  padding: 6px 8px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.model-switcher-row,
.model-switcher-option,
.model-switcher-default {
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.model-switcher-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(0, 1.4fr) 14px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
}
.model-switcher-row span { font-size: 12px; font-weight: 700; }
.model-switcher-row strong { min-width: 0; color: var(--muted); font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-switcher-row i { color: var(--muted); font-size: 19px; font-style: normal; font-weight: 300; line-height: 1; }
.model-switcher-row:hover:not(:disabled),
.model-switcher-row:focus-visible { background: color-mix(in srgb, var(--brand) 13%, transparent); outline: none; }
.model-switcher-row:disabled { cursor: default; opacity: .42; }
.model-switcher-source { margin: 8px 8px 4px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.model-switcher-default { margin-top: 6px; padding: 8px 10px; color: var(--brand); font-size: 12px; font-weight: 750; }
.model-switcher-default:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.model-switcher-options { display: grid; gap: 2px; }
.model-switcher-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
}
.model-switcher-option span { min-width: 0; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-switcher-option small { grid-column: 1 / -1; margin-top: -5px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.model-switcher-option:hover,
.model-switcher-option:focus-visible { background: color-mix(in srgb, var(--brand) 12%, transparent); outline: none; }
.model-switcher-option.selected { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--text); }
.model-switcher-check { color: var(--brand); font-size: 20px !important; }
.model-switcher-empty,
.model-switcher-loading { padding: 14px 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.model-switcher-advanced {
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.model-switcher-advanced:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--text); }
.model-switcher-advanced span { margin-left: 5px; font-size: 19px; line-height: .6; vertical-align: -1px; }
.model-switcher-effort-slider {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin: 7px 3px 13px;
  height: 30px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-2) 88%, #000 12%);
  isolation: isolate;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.model-switcher-effort-slider.is-dragging { cursor: grabbing; }
.model-switcher-effort-slider::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: var(--effort-progress, 0%);
  border-radius: inherit;
  background: var(--brand);
  transition: width 180ms ease;
}
.model-switcher-effort-segment {
  position: relative;
  z-index: 1;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: inherit;
}
.model-switcher-effort-segment::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 60%, transparent);
  transform: translate(-50%, -50%);
  transition: width 180ms ease, height 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.model-switcher-effort-segment.filled::after { opacity: 0; }
.model-switcher-effort-segment i { display: none; }
.model-switcher-effort-segment.active::after {
  width: 36px;
  height: 36px;
  background: #fff;
  box-shadow: 0 4px 13px rgba(255,255,255,.24), 0 2px 7px color-mix(in srgb, var(--brand) 42%, transparent);
}
.model-switcher-quick-label { display: grid; grid-template-columns: minmax(0, 1fr) auto 14px; align-items: center; gap: 5px; min-height: 28px; padding: 0 9px; border-radius: 999px; background: color-mix(in srgb, var(--panel-2) 86%, #000 14%); }
.model-switcher-quick-label strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.model-switcher-quick-label span { color: var(--muted); font-size: 12px; }
.model-switcher-quick-label i { color: var(--muted); font-size: 14px; font-style: normal; }
.model-switcher-quick-empty { padding: 10px; color: var(--muted); font-size: 11px; }

@media (max-width: 640px) {
  #model-switcher-popover,
  [data-model-switcher-popover="1"] { width: min(320px, calc(100vw - 32px)); flex-direction: column; }
  .model-switcher-panel, .model-switcher-detail { width: 100%; }
}

/* Compact model/reasoning controls. Keep the desktop switcher dense and calm
   so the effort slider reads like a control rather than a second composer. */
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-panel,
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-detail {
  width: 220px;
  padding: 6px;
  border-radius: 14px;
  background: var(--panel) !important;
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-heading,
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-detail-title {
  padding: 4px 6px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-row {
  grid-template-columns: minmax(58px, 1fr) minmax(0, 1.35fr) 12px;
  gap: 5px;
  min-height: 31px;
  padding: 0 6px;
  border-radius: 8px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-row span {
  font-size: 10.5px;
  font-weight: 600;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-row strong {
  font-size: 10px;
  font-weight: 550;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-row i {
  font-size: 15px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-source {
  margin: 5px 6px 2px;
  padding-top: 5px;
  font-size: 9.5px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-default {
  margin-top: 3px;
  padding: 6px;
  font-size: 10px;
  font-weight: 650;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-options { gap: 1px; }
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-option {
  gap: 5px;
  min-height: 31px;
  padding: 5px 6px;
  border-radius: 8px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-option span {
  font-size: 10.5px;
  font-weight: 550;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-option small {
  margin-top: -3px;
  font-size: 9px;
  line-height: 1.2;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-check { font-size: 15px !important; }
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-advanced {
  padding: 4px 6px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 600;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-advanced span {
  margin-left: 3px;
  font-size: 15px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-effort-slider {
  margin: 5px 2px 8px;
  height: 22px;
  box-shadow: none;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-effort-segment { height: 22px; }
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-effort-segment::after {
  width: 5px;
  height: 5px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-effort-segment.active::after {
  width: 25px;
  height: 25px;
  box-shadow: 0 2px 7px rgba(255,255,255,.18);
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-quick-label {
  min-height: 24px;
  padding: 0 7px;
  gap: 4px;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-quick-label strong,
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-quick-label span {
  font-size: 10px;
  font-weight: 550;
}
body:not(.pm-mobile-active) :is(#model-switcher-popover, [data-model-switcher-popover="1"]) .model-switcher-quick-label i { font-size: 12px; }

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

.chat-composer-input-wrap {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  align-self: stretch;
}

.chat-composer-rich-preview {
  position: absolute;
  z-index: 1;
  inset: 0;
  box-sizing: border-box;
  min-height: 48px;
  max-height: 150px;
  padding: 12px 52px 12px 14px;
  overflow: hidden;
  pointer-events: none;
  color: var(--composer-text);
  font-family: var(--t-font-ui);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-composer-rich-preview[hidden] { display: none; }

.chat-composer-input-wrap.has-rich-preview #chat-input {
  position: relative;
  z-index: 2;
  border-color: transparent;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--composer-text);
  box-shadow: none;
  text-shadow: none;
}

.chat-composer-input-wrap.has-rich-preview #chat-input::placeholder { color: transparent; }

.chat-composer-input-wrap.has-rich-preview {
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: 16px;
  background:
    linear-gradient(
      135deg,
      var(--composer-input),
      color-mix(in srgb, var(--composer-input), var(--pm-orange) 3%)
    );
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.16),
    inset 0 -1px 1px rgba(0,0,0,0.06);
}

.chat-composer-input-wrap.has-rich-preview:focus-within {
  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);
}

.chat-composer-skill-token,
.chat-composer-command-token {
  display: inline;
  color: #48a6ff;
  font-weight: inherit;
  line-height: inherit;
  white-space: inherit;
}

.chat-input-area .chat-voice-btn {
  position: absolute;
  top: 50%;
  right: 68px;
  z-index: 8;
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  box-shadow: none;
  pointer-events: auto;
  transform: translateY(-50%);
  transition:
    color 160ms ease,
    transform 160ms ease,
    background 160ms 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-voice-btn > svg,
.chat-input-area .chat-voice-btn > iconify-icon {
  pointer-events: none;
}
.chat-input-area .chat-voice-btn[data-voice-mode="openai_realtime"] > iconify-icon {
  transform: translateX(0.5px);
}
.chat-input-area .chat-attach-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, 0deg),
      #ff7a18,
      var(--t-accent),
      #ea580c,
      #fb923c,
      #ff7a18
    );
  color: #fff;
  cursor: pointer;
  box-shadow: none;
  animation: none;
  will-change: auto;
  transition:
    transform 180ms ease,
    color 180ms ease,
    background 180ms ease;
}
:root[data-theme="dark"] .chat-input-area .chat-attach-btn {
  border: 0;
  background:
    conic-gradient(
      from var(--pm-angle, 0deg),
      #ff7a18,
      var(--t-accent),
      #ea580c,
      #fb923c,
      #ff7a18
    );
  color: #fff;
  box-shadow: none;
}
.chat-input-area .chat-attach-btn:hover,
.chat-input-area .chat-attach-btn:focus-visible {
  transform: translateY(-1px) scale(1.025);
  color: #fff;
  box-shadow: none;
}
.chat-input-area .chat-voice-btn:hover,
.chat-input-area .chat-voice-btn:focus-visible {
  transform: translateY(-50%) scale(1.06);
}
.chat-input-area .chat-voice-btn.recording,
.chat-input-area .chat-voice-btn.recording.active {
  background: #d8473a;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(216,71,58,.16);
  animation: pm-desktop-dictation-pulse 1.1s ease-in-out infinite;
}
.chat-input-area .chat-voice-btn.voice-mode-active,
.chat-input-area .chat-voice-btn.voice-mode-active:hover,
.chat-input-area .chat-voice-btn.voice-mode-active:focus-visible {
  background: #d8473a;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(216,71,58,.20);
  animation: none;
}
@keyframes pm-desktop-dictation-pulse {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-input-area .chat-voice-btn.recording,
  .chat-input-area .chat-voice-btn.recording.active { animation: none; }
}
.chat-input-area .send-btn.voice-mode-btn {
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.38), transparent 34%),
    conic-gradient(from var(--pm-angle), #ff7a18, var(--t-accent), #ea580c, #fb923c, #ff7a18);
}
.chat-input-area .send-btn.realtime-voice-stop,
.chat-input-area .send-btn.realtime-voice-stop:hover,
.chat-input-area .send-btn.realtime-voice-stop:focus-visible {
  background: #d8473a !important;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(216,71,58,.22), 0 8px 20px rgba(216,71,58,.24);
  animation: none;
}
.chat-input-area .send-btn.voice-mode-btn .send-voice-icon {
  width: 25px;
  height: 25px;
  /* The source asset is a black silhouette; keep the voice-mode glyph white
     against the gold send control across every desktop skin. */
  filter: brightness(0) invert(1);
}
.chat-slash-command-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 25;
  width: auto;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  max-height: min(280px, 42vh);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}
.chat-question-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 26;
  max-height: min(62vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}
.chat-question-popover .chat-question-card {
  margin: 0;
  max-width: none;
}
.chat-question-popover[hidden] { display: none; }
:root[data-theme="dark"] .chat-slash-command-popover {
  background: var(--panel-2);
  border-color: color-mix(in srgb, var(--line-strong) 82%, transparent);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.38);
}
.chat-slash-command-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  text-align: left;
  font-family: var(--t-font-ui);
  transition: background 120ms ease, color 120ms ease;
}
.chat-slash-command-item + .chat-slash-command-item {
  border-top: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
}
.chat-slash-command-item:hover,
.chat-slash-command-item.active {
  background: color-mix(in srgb, var(--brand) 11%, transparent);
}
.chat-slash-token,
.chat-skill-suggestion-token {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-skill-suggestion-token {
  color: var(--pm-gold, var(--brand));
}
.chat-slash-label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}
.chat-slash-hint {
  min-width: 34px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: right;
}
.chat-command-chip {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--t-accent) 32%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--t-accent) 12%, transparent);
  color: #9a3412;
  cursor: pointer;
  font-family: var(--t-font-ui);
  font-size: 13px;
  font-weight: 900;
  padding: 9px 10px;
  line-height: 1;
}
.chat-command-chip:hover {
  background: color-mix(in srgb, var(--t-accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--t-accent) 46%, transparent);
}
:root[data-theme="dark"] .chat-command-chip {
  color: #fdba74;
  background: color-mix(in srgb, var(--t-accent) 15%, transparent);
}
.queued-prompts-panel {
  display: none;
  position: absolute;
  /* Stack into the composer like a file tab: the clipped lower edge disappears
     behind the foreground composer instead of reading as a separate panel. */
  bottom: calc(100% - 34px);
  left: 24px;
  right: auto;
  width: calc(100% - 48px);
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  transform: none;
  padding-bottom: 38px;
  border: 1px solid var(--composer-border);
  border-radius: 14px;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--composer-bg), var(--panel) 22%),
      color-mix(in srgb, var(--composer-bg), transparent 8%)
    );
  box-shadow: 0 -8px 24px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  overflow: visible;
  z-index: 1;
  clip-path: inset(0 -2px 34px -2px round 16px 16px 0 0);
}
.queued-prompts-list { padding: 3px 6px 4px; display: flex; flex-direction: column; gap: 2px; }
.queued-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 4px 2px 4px 8px;
  font-size: 11px;
  color: var(--text);
  transition: background 0.12s;
}
.queued-item:hover { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.queued-item-index {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.55;
  margin-right: 2px;
  min-width: 12px;
}
.queued-item-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  display: block;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}
.queued-item-text:hover { color: var(--text); }
.queued-item-attachments { font-size: 11px; color: var(--muted); margin-left: 4px; }
.queued-item-actions { display: inline-flex; align-items: center; gap: 1px; flex: 0 0 auto; margin-left: 2px; }
.queued-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.queued-icon-btn:hover { background: transparent; color: var(--text); }
.queued-steer-btn { color: var(--brand); }
.queued-steer-btn:hover { background: transparent; color: var(--brand); }
.queued-remove-btn:hover { background: transparent; color: #c0392b; }
.queued-clear-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  font-family: var(--t-font-ui);
}
.queued-clear-btn:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  color: var(--text);
}
.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,
#side-chat-input,
.subagent-panel-chat-composer .chat-textarea,
.unified-desktop-chat-composer .chat-textarea,
#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: var(--t-font-ui);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.74);
}

#chat-input,
#side-chat-input,
.subagent-panel-chat-composer .chat-textarea,
.unified-desktop-chat-composer .chat-textarea {
  min-width: 0;
  min-height: 48px;
  max-height: 150px;
  resize: none;
  line-height: 1.5;
  overflow-y: auto;
  border-radius: 16px;
  padding: 12px 52px 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);
}

/* Keep long composer drafts scrollable without exposing an intrusive native
   scrollbar inside the input surface. */
.chat-input-area textarea {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.chat-input-area textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
#chat-input::placeholder,
#side-chat-input::placeholder,
.subagent-panel-chat-composer .chat-textarea::placeholder,
.unified-desktop-chat-composer .chat-textarea::placeholder {
  color: var(--composer-muted);
}
#chat-input:focus,
#side-chat-input:focus,
.subagent-panel-chat-composer .chat-textarea:focus,
.unified-desktop-chat-composer .chat-textarea: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,
#side-chat-input:focus,
.subagent-panel-chat-composer .chat-textarea:focus,
.unified-desktop-chat-composer .chat-textarea: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, var(--t-accent), #c2410c);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--t-font-ui);
  transition: all 0.15s ease;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--t-accent) 38%, transparent);
}
.chat-input-area .send-btn,
.chat-input-area .send-btn:hover,
.chat-input-area .send-btn:focus-visible {
  box-shadow: none;
}

.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: var(--t-font-ui);
  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;
}
.workflow-transition-label {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 3px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.workflow-transition-avatar {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  overflow: visible;
  border-radius: 7px;
  color: var(--pm-gold, var(--brand));
  background: var(--sidebar-icon-bg, var(--panel-2));
  border: 1px solid var(--sidebar-icon-border, var(--line));
}
.workflow-transition-avatar svg {
  display: block;
  width: 20px;
  height: 23px;
  overflow: visible;
}
.msg-shell.user .workflow-transition-label {
  align-self: flex-end;
}
: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-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.live-turn-thought {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.live-turn-thought-group {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.live-turn-thought-summary {
  min-width: 0;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}
.live-turn-thought-summary .t-think {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-turn-thought-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.live-turn-trace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.live-turn-segment {
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 10px;
  color: var(--text);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.live-turn-prose {
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}
.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;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.live-stream-enter {
  animation: live-stream-enter 210ms cubic-bezier(.16,1,.3,1) both;
}
.live-stream-text-refresh .msg-content.markdown-body > :last-child {
  animation: live-stream-text-refresh 240ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes live-stream-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes live-stream-text-refresh {
  from { opacity: .45; transform: translateY(2px); filter: blur(.25px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-stream-enter,
  .live-stream-text-refresh .msg-content.markdown-body > :last-child {
    animation: none !important;
  }
}
.live-turn-tool-group {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-left: 3px solid rgba(245, 158, 11, 0.62);
  padding-left: 10px;
  color: var(--text);
}
.live-turn-tool-group-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.live-turn-collapsed-vision-previews {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 5px 0 3px 13px;
}
.live-turn-tool-group[open] + .live-turn-collapsed-vision-previews {
  display: none;
}
.live-turn-collapsed-vision-previews .live-turn-vision-preview {
  margin-top: 0;
}
.live-turn-tool-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  color: var(--muted);
  font-family: var(--t-font-ui);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.live-turn-tool-summary::-webkit-details-marker {
  display: none;
}
.live-turn-tool-summary strong {
  display: inline-block;
  flex: 1 1 auto;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.live-turn-tool-summary strong.t-think {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-turn-tool-summary .t-think-sizer {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: transparent;
  white-space: nowrap;
  text-overflow: ellipsis;
  visibility: hidden;
}
.live-turn-tool-summary .t-think-text {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateY(0);
  filter: blur(0);
  opacity: 1;
  transition:
    transform 150ms ease-in-out,
    filter 150ms ease-in-out,
    opacity 150ms ease-in-out;
  will-change: transform, filter, opacity;
}
.live-turn-tool-group[data-live-trace-current="1"] .t-think-text::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  background-image: linear-gradient(90deg,
    transparent 0%,
    transparent 40%,
    #f5f5f5 50%,
    transparent 60%,
    transparent 100%);
  background-size: 400% 100%;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* steps(): background-clip:text repaints the whole label per frame; 12/s instead of 120/s. */ animation: t-think-shimmer 2000ms steps(24, end) infinite;
}
.live-turn-tool-group:not([data-live-trace-current="1"]) .t-think-text::before {
  display: none;
}
.live-turn-tool-summary .t-think-text.is-exit {
  transform: translateY(-8px);
  filter: blur(2px);
  opacity: 0;
}
.live-turn-tool-summary .t-think-text.is-enter-start {
  transition: none;
  transform: translateY(8px);
  filter: blur(2px);
  opacity: 0;
}
@keyframes t-think-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .live-turn-tool-summary .t-think-text {
    transition: none !important;
    transform: none !important;
    filter: none !important;
  }
  .live-turn-tool-summary .t-think-text::before {
    display: none !important;
  }
}
.live-turn-tool-summary em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  opacity: .82;
}
.live-turn-tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex: 0 0 1em;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-align: center;
}
.live-turn-tool-icon svg {
  display: block;
  width: 1em;
  height: 1em;
}
.live-turn-tool-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .18s ease;
}
.live-turn-tool-group[open] > .live-turn-tool-summary .live-turn-tool-chevron {
  transform: rotate(90deg);
}
.live-turn-tool-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 4px;
  padding-bottom: 2px;
}
.tool-activity-entry {
  width: 100%;
  min-width: 0;
  border: 0;
  border-left: 3px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  overflow: visible;
  padding: 2px 0 2px 10px;
  box-sizing: border-box;
}
.tool-activity-entry-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  font-size: 13px;
  line-height: 1.65;
  padding: 0;
}
.tool-activity-tool-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 1em;
  color: var(--muted);
  vertical-align: middle;
}
.tool-activity-tool-icon[data-tool-icon="terminal"] { color: #4aa8ff; }
.tool-activity-tool-icon[data-tool-icon="pointer"],
.tool-activity-tool-icon[data-tool-icon="keyboard"] { color: color-mix(in srgb, #4aa8ff 72%, var(--text)); }
.tool-activity-tool-icon[data-tool-icon="edit"] { color: #f5c451; }
.tool-activity-tool-icon[data-tool-icon="image"],
.tool-activity-tool-icon[data-tool-icon="video"] { color: color-mix(in srgb, #a78bfa 72%, var(--text)); }
.tool-activity-tool-icon svg { display: block; width: 1em; height: 1em; }
.tool-activity-connector-logo {
  display: inline-block;
  width: 1.08em;
  height: 1.08em;
  flex: 0 0 1.08em;
  background: var(--connector-logo-color, currentColor);
  -webkit-mask-image: var(--connector-logo-url);
  mask-image: var(--connector-logo-url);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  vertical-align: middle;
}
.tool-activity-status-icon {
  display: inline-flex;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}
.tool-activity-status-icon[data-status="running"],
.tool-activity-status-icon[data-status="preparing"] {
  border-color: color-mix(in srgb, #4aa8ff 72%, transparent);
  border-top-color: transparent;
  color: #4aa8ff;
  animation: pm-tool-activity-spin .9s linear infinite;
}
.tool-activity-status-icon[data-status="succeeded"] {
  border-color: color-mix(in srgb, #22c55e 70%, transparent);
  color: #22c55e;
}
.tool-activity-status-icon[data-status="failed"] {
  border-color: color-mix(in srgb, var(--red) 72%, transparent);
  color: var(--red);
}
@keyframes pm-tool-activity-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .tool-activity-status-icon[data-status="running"],
  .tool-activity-status-icon[data-status="preparing"] {
    animation: none;
  }
}
.tool-activity-entry-summary .tool-activity-label {
  flex: 1 1 auto;
  grid-column: auto;
  grid-row: auto;
}
.tool-activity-wrap + .tool-activity-wrap { margin-top: 8px; }
.tool-activity-disclosure > summary { list-style: none; cursor: pointer; }
.tool-activity-disclosure > summary::-webkit-details-marker { display: none; }
.tool-activity-chevron { margin-left: auto; color: currentColor; font-style: normal; opacity: .62; transform: rotate(0); transition: transform .15s ease; }
.tool-activity-disclosure[open] .tool-activity-chevron { transform: rotate(90deg); }
.tool-activity-inline-detail { margin: 8px 0 0 24px; padding: 10px 12px; border: 1px solid var(--border, rgba(127,127,127,.22)); border-radius: 10px; background: rgba(0,0,0,.14); }
.tool-activity-skill-detail { display: grid; gap: 4px; }
.tool-activity-skill-detail strong { color: var(--text, inherit); font-size: 12px; }
.tool-activity-skill-detail span { color: var(--muted, #8b93a1); font-size: 12px; line-height: 1.45; }
.tool-activity-file-diff { max-height: 320px; overflow: auto; color: var(--text-soft, inherit); font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
.tool-activity-diff-line { display: grid; grid-template-columns: 34px 34px 18px minmax(max-content, 1fr); min-width: max-content; min-height: 20px; align-items: stretch; }
.tool-activity-diff-line.is-added { background: rgba(34, 197, 94, .105); }
.tool-activity-diff-line.is-removed { background: rgba(244, 63, 94, .10); }
.tool-activity-diff-line.is-meta { display: block; min-width: 100%; color: var(--accent, var(--theme-palette-gold)); background: color-mix(in srgb, var(--accent, var(--theme-palette-gold)) 8%, transparent); }
.tool-activity-diff-meta { display: block; padding: 3px 9px; white-space: pre; }
.tool-activity-diff-number { padding: 1px 7px 1px 2px; color: color-mix(in srgb, currentColor 42%, transparent); background: color-mix(in srgb, currentColor 2.5%, transparent); text-align: right; user-select: none; }
.tool-activity-diff-marker { padding-top: 1px; color: color-mix(in srgb, currentColor 48%, transparent); text-align: center; user-select: none; }
.tool-activity-diff-line.is-added .tool-activity-diff-marker { color: #35e981; font-weight: 800; }
.tool-activity-diff-line.is-removed .tool-activity-diff-marker { color: #ff6680; font-weight: 800; }
.tool-activity-diff-code { display: block; min-width: 0; padding: 1px 10px 1px 4px; color: inherit; font: inherit; white-space: pre; }
.tool-activity-diff-code .tok-tag,
.tool-activity-diff-code .tok-keyword { color: #f08fa3; }
.tool-activity-diff-code .tok-attr,
.tool-activity-diff-code .tok-function { color: #c6a0f6; }
.tool-activity-diff-code .tok-string { color: #a6da95; }
.tool-activity-diff-code .tok-number { color: #eed49f; }
.tool-activity-diff-code .tok-punctuation { color: #8aadf4; }
.tool-activity-diff-code .tok-comment { color: #7f849c; font-style: italic; }
.tool-activity-diff-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.tool-activity-entry > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 7px;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.tool-activity-entry > summary:hover .tool-activity-label { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.tool-activity-entry > summary::-webkit-details-marker { display: none; }
.tool-activity-kicker {
  grid-column: 1;
  grid-row: 1;
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.2;
  text-transform: uppercase;
}
.tool-activity-entry[data-status="running"],
.tool-activity-entry[data-status="preparing"] { border-left-color: #f59e0b; }
.tool-activity-entry[data-status="succeeded"] { border-left-color: color-mix(in srgb, #22c55e 62%, var(--line-strong)); }
.tool-activity-entry[data-status="failed"] { border-left-color: var(--red); }
.tool-activity-label {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  color: var(--text);
  font-family: var(--t-font-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: normal;
}
.tool-activity-chevron {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .16s ease;
}
.tool-activity-entry[open] .tool-activity-chevron { transform: rotate(90deg); }
.tool-activity-details {
  display: grid;
  gap: 5px;
  padding: 7px 8px 4px 0;
  border: 0;
  background: transparent;
}
.tool-activity-detail-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.tool-activity-detail-row strong { color: var(--text); font-weight: 750; }
.tool-activity-detail-row span { min-width: 0; overflow-wrap: anywhere; }
.tool-activity-detail-row.is-block { grid-template-columns: 1fr; gap: 4px; }
.tool-activity-detail-row pre {
  max-height: 220px;
  margin: 0;
  padding: 3px 0 3px 8px;
  overflow: auto;
  border-left: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: 10px/1.45 'IBM Plex Mono', monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tool-activity-detail-empty { color: var(--muted); font-size: 11px; }
.tool-command-terminal {
  margin: 7px 4px 2px 13px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 7px;
  background: #0b0d10;
  color: #d6d9df;
}
.tool-command-terminal > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 7px;
  min-height: 27px;
  padding: 3px 8px;
  list-style: none;
  cursor: pointer;
  color: #9299a6;
  font: 700 9px/1.2 'IBM Plex Mono', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.tool-command-terminal > summary::-webkit-details-marker { display: none; }
.tool-command-terminal > summary em { color: #6f7784; font-style: normal; font-weight: 600; }
.tool-command-terminal.is-live > summary em { color: #6fce91; }
.tool-command-terminal > summary i { color: #737b87; font-style: normal; font-size: 13px; transform: rotate(0); transition: transform .15s ease; }
.tool-command-terminal[open] > summary i { transform: rotate(90deg); }
.tool-command-terminal > pre {
  max-height: 160px;
  min-height: 62px;
  margin: 0;
  padding: 7px 9px 9px;
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,.055);
  color: #d6d9df;
  background: #080a0c;
  font: 10px/1.45 'IBM Plex Mono', ui-monospace, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
}
.live-turn-compaction {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 4px 0 2px;
  color: var(--muted);
}
.live-turn-compaction summary {
  display: grid;
  grid-template-columns: minmax(40px, 1fr) auto minmax(40px, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 30px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.live-turn-compaction summary::-webkit-details-marker {
  display: none;
}
.live-turn-compaction-line {
  display: block;
  height: 1px;
  min-width: 0;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  opacity: .62;
}
.live-turn-compaction strong {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
  white-space: nowrap;
}
.live-turn-compaction strong::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.live-turn-compaction[data-status="compacting"] strong::before {
  border-color: rgba(245,158,11,.75);
  border-top-color: transparent;
  border-radius: 50%;
  animation: live-turn-spin .9s linear infinite;
}
.live-turn-compaction[data-status="compacted"] strong::before,
.live-turn-compaction[data-status="done"] strong::before {
  border-color: rgba(34,197,94,.68);
  background: linear-gradient(135deg, rgba(34,197,94,.95), rgba(22,163,74,.7));
}
.live-turn-compaction[data-status="failed"] strong::before {
  border-color: rgba(248,113,113,.72);
  background: rgba(248,113,113,.18);
}
.live-turn-compaction-body {
  margin: 7px 0 2px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 78%, transparent);
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  overflow: hidden;
}
.live-turn-compaction-body.muted {
  color: var(--muted);
}
.live-turn-compaction-body .live-turn-md {
  font-size: 12px;
  line-height: 1.55;
}
@keyframes live-turn-spin {
  to { transform: rotate(360deg); }
}
.live-turn-vision-preview {
  display: block;
  width: min(180px, 100%);
  max-height: 112px;
  margin-top: 7px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  overflow: hidden;
  cursor: zoom-in;
}
.live-turn-vision-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 112px;
  object-fit: contain;
}
.live-turn-vision-break .live-turn-vision-preview {
  width: min(560px, 100%);
  max-height: none;
  margin: 10px 0;
}
.live-turn-vision-break .live-turn-vision-preview img {
  max-height: 60vh;
}
.live-turn-vision-carousel {
  display: flex;
  gap: 12px;
  max-width: 560px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.live-turn-vision-carousel .live-turn-vision-preview {
  flex: 0 0 calc(100% - 24px);
  scroll-snap-align: start;
}
.live-turn-think {
  border-color: rgba(99, 102, 241, 0.45);
  color: color-mix(in srgb, var(--text) 78%, var(--muted) 22%);
}
.live-turn-preamble {
  border-color: rgba(59, 130, 246, 0.42);
}
.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-vision {
  border-color: rgba(56, 189, 248, 0.55);
}
.live-turn-md > :first-child { margin-top: 0; }
.live-turn-md > :last-child { margin-bottom: 0; }

/* Pending question docked inside the live streaming bubble (below the tool
   stream, above the Process button) — same slot as the plan-progress panel. */
.streaming-question-dock {
  width: min(620px, calc(100vw - 180px));
  max-width: 100%;
  margin: 10px 0 2px;
}
.streaming-question-dock .chat-approval-card { margin: 0; }

.inline-runtime-plan {
  /* Size to the chat column, not the viewport, so it never overflows when the right panel is open. */
  width: min(620px, 100%);
  box-sizing: border-box;
  max-width: 100%;
  margin: 10px 0 2px;
  border: 1px solid var(--progress-border);
  border-radius: 12px;
  background: var(--progress-bg);
  box-shadow: var(--progress-shadow);
  padding: 10px 12px;
}
.inline-runtime-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--progress-header-text);
  font-family: var(--t-font-ui);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.inline-runtime-plan-head span:last-child {
  color: var(--progress-empty-text);
  font-family: var(--t-font-mono);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.inline-runtime-plan-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.inline-runtime-plan .progress-item {
  min-height: 24px;
  gap: 8px;
}
.inline-runtime-plan .progress-step-dot {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  font-size: 11px;
}
.inline-runtime-plan .progress-spinner {
  inset: -2px;
}
.inline-runtime-plan .progress-step-text {
  font-size: 12px;
  line-height: 1.4;
  font-weight: 650;
}

@media (max-width: 720px) {
  .inline-runtime-plan {
    display: none;
  }
}

: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-preamble {
  border-color: rgba(96, 165, 250, 0.56);
}
: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 rgba(148, 163, 184, 0.22);
  border-left: 3px solid color-mix(in srgb, #d6b272 60%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel) 58%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: var(--text);
  padding: 12px 14px;
  max-width: min(520px, 100%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.chat-live-approvals {
  display: grid;
  gap: 10px;
  margin: 10px 0 2px;
  max-width: 760px;
}

.chat-live-approvals .chat-approval-card {
  margin: 0;
}
.chat-approval-card-high { border-left-color: #f59e0b; }
.chat-approval-card-medium { border-left-color: #d6b272; }
.chat-approval-card-low { border-left-color: #22c55e; }

/* Prometheus question card — the question and checklist stay visually quiet
   until an option is selected. */
.chat-question-card,
.chat-question-card.chat-approval-card {
  border: 0 !important;
  border-left: 0 !important;
  box-shadow: none;
}
.chat-question-card .pq-block { display: flex; flex-direction: column; gap: 8px; }
.chat-question-card .pq-q-label { font-size: 14px; font-weight: 700; line-height: 1.35; }
.chat-question-card .pq-head { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 4px; }
.chat-question-card .pq-progress { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .62; }
.chat-question-card .pq-progress-current { color: #38bdf8; font-weight: 800; opacity: 1; }
.chat-question-card .pq-progress-total { opacity: .72; }
.chat-question-card .pq-options { display: flex; flex-direction: column; gap: 0; border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.chat-question-card .pq-option {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  width: 100%; box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 0; padding: 10px 9px; font-size: 13px;
  background: transparent; color: var(--text);
}
.chat-question-card .pq-option:hover { background: rgba(255,255,255,0.04); }
.chat-question-card .pq-option:focus-within { outline: 2px solid color-mix(in srgb, #38bdf8 70%, transparent); outline-offset: -2px; }
.chat-question-card .pq-option:has(input:checked) { background: rgba(56,189,248,0.12); color: #dff6ff; }
.chat-question-card .pq-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chat-question-card .pq-option-check {
  display: inline-grid; place-items: center; flex: 0 0 17px; width: 17px; height: 17px;
  border: 1.5px solid currentColor; border-radius: 50%; opacity: 0.68; color: transparent;
}
.chat-question-card .pq-option-check::after { content: '✓'; font-size: 11px; line-height: 1; font-weight: 800; transform: scale(0); transition: transform 120ms ease; }
.chat-question-card .pq-option:has(input:checked) .pq-option-check { border-color: #38bdf8; background: #38bdf8; color: #07111d; opacity: 1; }
.chat-question-card .pq-option:has(input:checked) .pq-option-check::after { transform: scale(1); }
.chat-question-card .pq-option-label { min-width: 0; }
.chat-question-card .pq-other-row { display: flex; flex-direction: column; gap: 6px; align-items: stretch; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.chat-question-card .pq-other-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  width: 100%;
  border: 0;
  background: transparent; color: var(--text);
  border-radius: 0; padding: 10px 9px; font-size: 13px; white-space: nowrap; cursor: pointer; text-align: left;
}
.chat-question-card .pq-other-toggle:hover { background: rgba(255,255,255,0.04); }
.chat-question-card .pq-other-toggle:focus-visible { outline: 2px solid color-mix(in srgb, #38bdf8 70%, transparent); outline-offset: -2px; }
.chat-question-card .pq-other-toggle.selected { background: rgba(56,189,248,0.12); color: #dff6ff; }
.chat-question-card .pq-other-toggle .pq-option-check { color: transparent; }
.chat-question-card .pq-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line, rgba(148,163,184,0.28)); border-radius: 8px;
  padding: 8px 9px; font: inherit; font-size: 12px; resize: vertical;
  background: rgba(127,127,127,0.06); color: var(--text);
}
.chat-question-card .pq-input::placeholder { opacity: 0.5; }
.chat-question-card .pq-other-row .pq-input { margin: 0 9px 9px; width: calc(100% - 18px); }
.chat-question-card .pq-actions { display: flex; gap: 8px; margin-top: 12px; }
.chat-question-card .pq-login-handoff { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
.chat-question-card .pq-login-open {
  appearance: none; border: 0; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  font: inherit; font-weight: 600; background: var(--prom-accent, var(--accent, #fff)); color: var(--prom-bg, #111);
}
.chat-question-card .pq-login-note { font-size: 12px; color: var(--muted, rgba(255,255,255,.6)); }
.chat-question-card .pq-submit { flex: 1; min-height: 34px; padding: 8px 12px; border: 0; border-radius: 8px; background: #2563eb; color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.chat-question-card .pq-submit:hover { background: #1d4ed8; }
.chat-question-card .pq-submit:disabled { cursor: wait; opacity: .6; }
.chat-question-card .pq-cancel { min-height: 34px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.chat-question-card .pq-cancel:hover { color: var(--text); background: var(--panel-2); border-color: var(--line-strong); }
.chat-question-card .pq-submit:focus-visible,
.chat-question-card .pq-cancel:focus-visible { outline: 2px solid color-mix(in srgb, #38bdf8 70%, transparent); outline-offset: 2px; }
:root[data-theme="dark"] .chat-question-card .pq-option,
:root[data-theme="dark"] .chat-question-card .pq-input { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.14); }
:root[data-theme="dark"] .chat-question-card .pq-option,
:root[data-theme="dark"] .chat-question-card .pq-other-toggle { background: transparent; border-color: transparent; }
:root[data-theme="dark"] .chat-question-card .pq-option:hover,
:root[data-theme="dark"] .chat-question-card .pq-other-toggle:hover { background: rgba(255,255,255,0.06); }
:root[data-theme="dark"] .chat-question-card .pq-option:has(input:checked),
:root[data-theme="dark"] .chat-question-card .pq-other-toggle.selected { background: rgba(56,189,248,0.16); }
:root[data-theme="dark"] .chat-question-card .pq-options { border-top-color: rgba(255,255,255,0.14); }
:root[data-theme="dark"] .chat-question-card .pq-option,
:root[data-theme="dark"] .chat-question-card .pq-other-row { border-bottom-color: rgba(255,255,255,0.14); }
.chat-approval-card-denied,
.chat-approval-card-rejected,
.chat-approval-card-failed,
.chat-approval-card-expired {
  border-left-color: #ef4444;
  background: color-mix(in srgb, var(--panel) 56%, rgba(239, 68, 68, 0.10));
  max-width: min(460px, 100%);
  box-shadow: none;
}
.chat-approval-card-resolved {
  padding: 10px 12px;
  max-width: min(460px, 100%);
  box-shadow: none;
}
.chat-approval-card-resolved .chat-approval-head {
  margin-bottom: 5px;
}
.chat-approval-card-resolved .chat-approval-detail {
  margin-bottom: 3px;
}
.chat-approval-card-resolved .chat-approval-subdetail {
  margin-bottom: 0;
}
.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-plan {
  margin: 7px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0;
}
.chat-approval-plan li {
  margin: 2px 0;
  padding-left: 2px;
}
.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-process {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.chat-approval-process-toggle {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 28px;
  padding: 4px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.chat-approval-process-toggle:hover {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line-strong);
}
.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) 42%, transparent);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
: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) 42%, rgba(239, 68, 68, 0.12));
  border-color: rgba(239, 68, 68, 0.22);
}
: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: var(--t-font-ui);
  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: var(--t-font-mono);
}

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,
      var(--t-accent),
      #ea580c,
      #fb923c,
      #ff7a18
    );
  color: #fff;
  box-shadow:
    0 12px 26px color-mix(in srgb, var(--t-accent) 34%, transparent),
    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 color-mix(in srgb, var(--t-accent) 42%, transparent),
    0 0 26px color-mix(in srgb, var(--t-accent) 24%, transparent),
    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; }

.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; }
/* Per-theme loading word (theme-registry.js loadingWords). */
.thinking .prom-loading-word {
  margin-left: 6px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  letter-spacing: .01em;
  white-space: nowrap;
}
@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: var(--t-font-mono);
}
.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: var(--t-font-mono);
  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: var(--t-font-mono);
  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 color-mix(in srgb, var(--t-accent) 16%, transparent) !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: color-mix(in srgb, var(--t-accent) 22%, transparent);
}

/* Pending approvals badge */
.right-panel #session-approvals-badge {
  background: color-mix(in srgb, var(--t-accent) 15%, transparent) !important;
  color: #fb923c !important;
  border-color: color-mix(in srgb, var(--t-accent) 32%, transparent) !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 color-mix(in srgb, var(--t-accent) 25%, transparent);
  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); }

#jobs-list .chat-session-item.job-item,
#channels-list .chat-session-item.job-item {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

#jobs-list .chat-session-item.job-item:hover,
#channels-list .chat-session-item.job-item:hover {
  background: var(--sidebar-item-hover);
  border-color: transparent;
  box-shadow: none;
}

#jobs-list .chat-session-item.job-item.active,
#channels-list .chat-session-item.job-item.active {
  background: var(--sidebar-active-bg);
  border-color: transparent;
  box-shadow: none;
}

#jobs-list .chat-session-item.job-item.unread:not(.active),
#channels-list .chat-session-item.job-item.unread:not(.active) {
  background: color-mix(in srgb, var(--sidebar-active-bg) 52%, transparent);
  border-color: transparent;
  box-shadow: none;
}

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

.process-run-card {
  --process-terminal-bg: color-mix(in srgb, var(--panel) 88%, #10140f 12%);
  --process-terminal-bar-bg: color-mix(in srgb, var(--panel-2) 84%, #10140f 16%);
  --process-terminal-text: var(--text);
  --process-terminal-muted: var(--muted);
  --process-terminal-prompt: var(--accent);
}

:root[data-theme="dark"] .process-run-card {
  --process-terminal-bg: color-mix(in srgb, var(--panel) 54%, #080a07 46%);
  --process-terminal-bar-bg: color-mix(in srgb, var(--panel-2) 60%, #11140f 40%);
  --process-terminal-text: color-mix(in srgb, var(--text) 92%, #ffffff 8%);
  --process-terminal-muted: color-mix(in srgb, var(--muted) 86%, #ffffff 14%);
  --process-terminal-prompt: color-mix(in srgb, var(--accent) 76%, #f8d887 24%);
}

.process-run-card {
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 12px;
  background: var(--panel);
  padding: 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: 13px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-run-kicker {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.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-terminal {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  border-radius: 10px;
  background: var(--process-terminal-bg);
  color: var(--process-terminal-text);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--line) 42%, transparent);
}

.process-run-terminal-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  background: var(--process-terminal-bar-bg);
  color: var(--process-terminal-muted);
  font-size: 11px;
  font-weight: 800;
}

.process-run-command {
  margin: 0;
  background: transparent;
  color: var(--process-terminal-text);
  padding: 12px 12px 4px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--t-font-mono);
}

.process-run-prompt {
  color: var(--process-terminal-prompt);
  font-weight: 800;
}

.process-run-hint,
.process-run-summary {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  white-space: pre-wrap;
}

.process-run-failure {
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.09);
}

.process-run-preview,
.process-run-log {
  margin: 0;
  background: transparent;
  color: var(--process-terminal-text);
  padding: 8px 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
  font-family: var(--t-font-mono);
}

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

.process-run-actions button,
.process-run-input {
  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-actions button:hover {
  background: var(--panel-2);
  border-color: var(--line-strong);
}

.process-run-input {
  min-width: 160px;
  cursor: text;
  font-weight: 500;
}

.process-run-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: -2px;
}

.process-run-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  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;
}

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

@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-skill-trigger-pill,
  .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-view.chat-empty {
    padding: 22px 14px 34px;
    justify-content: flex-start;
    overflow-y: auto;
  }
  #chat-view.chat-empty #chat-messages {
    width: 100%;
    padding-top: 12px;
  }
  #chat-view.chat-empty .chat-welcome h2 {
    font-size: 30px;
  }
  .chat-pulse-cards {
    width: 100%;
    gap: 8px;
    margin-top: 12px;
  }
  .chat-pulse-card {
    min-height: 0;
    padding: 12px 13px;
  }
  .chat-input-area {
    position: fixed;
    left: 50vw;
    width: calc(100vw - 24px);
    padding: 10px;
    border-radius: 22px;
  }
  .side-chat-composer.chat-input-area {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 24px));
    max-width: calc(100% - 24px);
  }
  #chat-view.chat-empty .chat-input-area {
    position: relative;
    left: auto;
    width: 100%;
    margin-top: 0;
  }
  .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 .chat-voice-btn {
    right: 58px;
    border-radius: 999px;
  }
  .chat-input-area .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
  #chat-input,
  #side-chat-input,
  #background-agent-chat-input {
    min-height: 48px;
    font-size: 13px;
    padding: 9px 44px 9px 11px;
  }
}

/* Canvas CodeMirror is mounted inside a flex surface. Give it the complete
   canvas footprint instead of allowing its intrinsic width to stop early. */
#canvas-editor-wrap {
  width: 100%;
  min-width: 0;
}
#canvas-editor-wrap > .CodeMirror {
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Creative Editor — layout, timeline, viewport, and panel styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* Root layout grid */
body.creative-editor-on #canvas-creative-shell.creative-studio-shell,
#canvas-creative-shell[data-creative-editor="on"].creative-studio-shell {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  display: flex !important;
  overflow: hidden;
}

/* ── Editor shell: min-size so it never collapses ─────────────────────────── */
#canvas-creative-shell,
.ce-layout-shell {
  min-width: 960px;
  min-height: 600px;
}

.ce-layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: grid;
  /*
   * Col 1: left panel   Col 2: col handle   Col 3: preview (flex)
   * Col 4: col handle   Col 5: right panel
   */
  grid-template-columns: var(--ce-left-w, 260px) 6px 1fr 6px var(--ce-right-w, 300px);
  /*
   * Row 1: header bar (40px)
   * Row 2: main content (flex)
   * Row 3: row resize handle
   * Row 4: timeline (enforced min 120px)
   */
  grid-template-rows: 40px 1fr 6px minmax(120px, var(--ce-timeline-h, 200px));
  gap: 0;
  background: #0d0d0f;
  overflow: hidden;
  font-family: 'Manrope', system-ui, sans-serif;
  color: #e8e6e1;
}

/* ── Header bar ───────────────────────────────────────────────────────────── */
.ce-editor-header {
  grid-row: 1;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  background: #111118;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 20;
}
.ce-editor-header__left  { display: flex; align-items: center; gap: 4px; }
.ce-editor-header__center { flex: 1; display: flex; align-items: center; justify-content: center; }
.ce-editor-header__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.ce-editor-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ce-hdr-btn {
  padding: 4px 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.ce-hdr-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.ce-hdr-btn:active { background: rgba(214,183,94,0.2); }

/* Export button lives in header right slot */
.ce-export-trigger-btn {
  padding: 5px 14px;
  background: linear-gradient(135deg, var(--theme-palette-gold), #a98a3b);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.ce-export-trigger-btn:hover  { opacity: 0.9; }
.ce-export-trigger-btn:active { transform: scale(0.97); }

/* ── Panel areas ──────────────────────────────────────────────────────────── */
.ce-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ce-pane--left    { grid-row: 2; grid-column: 1; border-right: 1px solid rgba(255,255,255,0.07); }
.ce-pane--preview { grid-row: 2; grid-column: 3; }
.ce-pane--right   { grid-row: 2; grid-column: 5; border-left: 1px solid rgba(255,255,255,0.07); }
.ce-pane--timeline {
  grid-row: 4;
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255,255,255,0.07);
  /* ensure it fills full width */
  width: 100%;
  min-width: 0;
}
/* legacy compat */
.ce-pane--full-row { grid-row: 4; grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,0.07); }
.ce-pane--assets    { grid-row: 2; grid-column: 1; border-right: 1px solid rgba(255,255,255,0.07); }
.ce-pane--properties { grid-row: 2; grid-column: 5; border-left: 1px solid rgba(255,255,255,0.07); }

/* ── Tab bar ──────────────────────────────────────────────────────────────── */
.ce-tab-bar {
  display: flex;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: #111118;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 0;
}
.ce-tab-bar::-webkit-scrollbar { display: none; }

.ce-tab {
  flex-shrink: 0;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.45);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  outline: none;
}
.ce-tab:hover { color: rgba(255,255,255,0.8); }
.ce-tab--active {
  color: var(--theme-palette-gold);
  border-bottom-color: var(--theme-palette-gold);
}

/* ── Tab panels ───────────────────────────────────────────────────────────── */
.ce-tab-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.ce-tab-panel {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.ce-tab-panel--active { display: block; }

/* ── Generic library panel (used by text/shapes/effects tabs) ─────────────── */
.ce-lib-panel {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ce-lib-header {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 0 4px;
}
.ce-lib-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  padding: 8px 4px;
  line-height: 1.5;
}
.ce-lib-section-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ── Text preset panel ────────────────────────────────────────────────────── */
.ce-lib-grid--text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ce-text-preset-btn {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.ce-text-preset-btn:hover {
  background: rgba(214,183,94,0.12);
  border-color: rgba(214,183,94,0.35);
}
.ce-text-preset-preview {
  display: block;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Shapes panel ─────────────────────────────────────────────────────────── */
.ce-lib-grid--shapes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.ce-shape-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ce-shape-preset-btn:hover {
  background: rgba(214,183,94,0.12);
  border-color: rgba(214,183,94,0.35);
}
.ce-shape-preset-icon { font-size: 22px; line-height: 1; }
.ce-shape-preset-label { font-size: 9px; color: rgba(255,255,255,0.5); font-weight: 600; }

/* ── Effects panel ────────────────────────────────────────────────────────── */
.ce-effects-active {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}
.ce-effect-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  background: rgba(99,102,241,0.2);
  border: 1px solid rgba(99,102,241,0.4);
  border-radius: 20px;
  font-size: 10px;
  color: #a5b4fc;
}
.ce-effect-chip-remove {
  background: none;
  border: none;
  color: rgba(165,180,252,0.6);
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  line-height: 1;
}
.ce-effect-chip-remove:hover { color: #f87171; }

.ce-lib-grid--effects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.ce-effect-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ce-effect-preset-btn:hover:not(:disabled) {
  background: rgba(99,102,241,0.18);
  border-color: rgba(99,102,241,0.4);
}
.ce-effect-preset-btn--disabled,
.ce-effect-preset-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ce-effect-preset-icon { font-size: 20px; line-height: 1; }
.ce-effect-preset-label { font-size: 9px; color: rgba(255,255,255,0.5); font-weight: 600; }

/* ── Filters panel (cinematic looks) ──────────────────────────────────────── */
.ce-filter-intensity {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px 10px;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
}
.ce-filter-intensity label { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ce-filter-intensity input[type="range"] { flex: 1; accent-color: var(--theme-palette-gold); }
.ce-filter-intensity span { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.ce-filters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ce-filter-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.ce-filter-tile:hover { background: rgba(99,102,241,0.16); border-color: rgba(99,102,241,0.4); }
.ce-filter-tile:active { transform: scale(0.97); }
.ce-filter-tile--active { border-color: var(--theme-palette-gold); background: rgba(214,183,94,0.16); }
.ce-filter-swatch {
  width: 100%;
  height: 46px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, #ff6b6b 0%, #ffd93d 28%, #6bcB77 55%, #4d96ff 78%, #b06bff 100%);
}
.ce-filter-label { font-size: 9px; color: rgba(255,255,255,0.65); font-weight: 600; }

/* legacy compat — old CSS vars may still be referenced */
.ce-pane--assets    { grid-row: 1; grid-column: 1; border-right: 1px solid rgba(255,255,255,0.07); }
.ce-pane--properties { grid-row: 1; grid-column: 5; border-left: 1px solid rgba(255,255,255,0.07); }

.ce-pane-label {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}

.ce-pane-body { flex: 1; min-height: 0; overflow: hidden; position: relative; }

/* Resize handles */
.ce-resize-handle {
  background: transparent;
  transition: background 0.15s;
  z-index: 20;           /* above pane content */
  position: relative;    /* ensure z-index takes effect */
  flex-shrink: 0;
}
.ce-resize-handle::after {
  content: '';
  position: absolute;
  inset: 0;
  /* expand hit area without expanding visible handle */
}
.ce-resize-handle:hover { background: rgba(214,183,94,0.4); }

.ce-resize-handle--col {
  grid-row: 2;           /* main content row */
  cursor: col-resize;
  width: 6px;
  min-width: 6px;
}
.ce-resize-handle--col::after { left: -4px; right: -4px; }  /* wider hit area */
.ce-resize-handle--col[data-resize="left"]   { grid-column: 2; }
.ce-resize-handle--col[data-resize="right"]  { grid-column: 4; }
/* legacy compat */
.ce-resize-handle--col[data-resize="assets"] { grid-column: 2; }
.ce-resize-handle--col[data-resize="props"]  { grid-column: 4; }

.ce-resize-handle--row {
  grid-row: 3;           /* between content and timeline */
  grid-column: 1 / -1;
  height: 6px;
  min-height: 6px;
  cursor: row-resize;
}
.ce-resize-handle--row::after { top: -4px; bottom: -4px; }

/* Placeholder pane content */
.ce-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: rgba(255,255,255,0.25);
}
.ce-placeholder__icon  { font-size: 28px; opacity: 0.3; }
.ce-placeholder__title { font-size: 12px; font-weight: 800; color: rgba(255,255,255,0.45); }
.ce-placeholder__hint  { font-size: 11px; line-height: 1.6; }
.ce-placeholder__btn {
  margin-top: 6px;
  padding: 5px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.3);
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: not-allowed;
}

/* Preview stub */
.ce-preview-stub {
  display: flex;
  flex-direction: column;
  height: 100%;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 30%, rgba(214,183,94,0.06), transparent 60%),
    #0d0d0f;
}

.ce-preview-stub__frame {
  position: relative;
  max-width: 100%;
  max-height: calc(100% - 56px);
  min-width: 120px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
  width: min(100%, 66vh * 16/9);
}

.ce-preview-stub__label {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  padding: 2px 6px;
}

.ce-preview-stub__count {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.2);
}

.ce-preview-stub__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  padding: 0 4px;
}

.ce-ctrl-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e8e6e1;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s;
}
.ce-ctrl-btn:hover { background: rgba(214,183,94,0.18); border-color: rgba(214,183,94,0.3); }

.ce-timecode {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  min-width: 60px;
  font-variant-numeric: tabular-nums;
}

.ce-scrubber {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}
.ce-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--theme-palette-gold);
  cursor: pointer;
  transition: transform 0.1s;
}
.ce-scrubber::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* Timeline stub — must fill the full-width timeline row */
.ce-timeline-stub {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;       /* fill the pane horizontally */
  overflow: hidden;
  box-sizing: border-box;
}

.ce-timeline-stub__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.ce-timeline-stub__label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
}

.ce-timeline-stub__dur {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  font-variant-numeric: tabular-nums;
}

.ce-timeline-stub__tracks {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
}

.ce-timeline-stub__empty {
  padding: 16px 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
}

/* Track rows */
.ce-track-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  height: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.ce-track-row__label {
  padding: 0 10px;
  display: flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ce-track-row__lane {
  position: relative;
  background: rgba(255,255,255,0.015);
}

.ce-track-row__clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(214,183,94,0.25);
  border: 1px solid rgba(214,183,94,0.5);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.1s;
}
.ce-track-row__clip:hover { background: rgba(214,183,94,0.4); }
.ce-track-row__clip.ce-timeline-clip--selected {
  background: rgba(214,183,94,0.5);
  border-color: rgba(255,255,255,0.75);
}
.ce-timeline-editor .ce-track-row__clip {
  cursor: grab;
}
.ce-timeline-editor .ce-track-row__clip:active {
  cursor: grabbing;
}
.ce-timeline-ruler {
  position: relative;
  height: 16px;
  margin-left: 120px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background:
    repeating-linear-gradient(
      to right,
      rgba(255,255,255,0.08) 0,
      rgba(255,255,255,0.08) 1px,
      transparent 1px,
      transparent 10%
    );
}
.ce-timeline-playhead {
  position: absolute;
  top: 0;
  bottom: -999px;
  width: 2px;
  background: var(--theme-palette-gold);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
  pointer-events: none;
  z-index: 4;
}
.ce-timeline-trim {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7px;
  z-index: 2;
}
.ce-timeline-trim--left {
  left: 0;
  cursor: ew-resize;
}
.ce-timeline-trim--right {
  right: 0;
  cursor: ew-resize;
}
.ce-timeline-clip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.ce-track-row__drop-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 12px;
  font-size: 10px;
  color: rgba(255,255,255,0.12);
  pointer-events: none;
}

.ce-track-row--empty .ce-track-row__lane {
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 2px;
  margin: 4px 6px;
}

/* ── Multi-track timeline ─────────────────────────────────────────── */
.ce-timeline-multitrack { display: flex; flex-direction: column; height: 100%; }
.ce-timeline--drop-over .ce-tl-body {
  outline: 1px dashed rgba(214,183,94,0.8);
  outline-offset: -2px;
  background: rgba(214,183,94,0.04);
}
.ce-tl-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.ce-tl-gutter {
  flex: 0 0 84px;
  width: 84px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 5;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.012);
}
.ce-tl-gutter-ruler { height: 18px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.ce-tl-gutter-row {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 10px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ce-tl-gutter-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ce-tl-gutter-actions {
  display: inline-flex;
  gap: 2px;
  flex: 0 0 auto;
}
.ce-tl-lane-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.42);
  font-size: 8px;
  font-weight: 800;
  cursor: pointer;
}
.ce-tl-lane-btn:hover { color: #fff; background: rgba(255,255,255,0.12); }
.ce-tl-lane-btn.is-active {
  color: #fed7aa;
  border-color: rgba(214,183,94,0.5);
  background: rgba(214,183,94,0.2);
}
.ce-tl-lanes { position: relative; flex: 0 0 auto; min-width: 0; }
.ce-timeline-toolbar {
  gap: 8px;
  min-height: 34px;
  overflow: hidden;
}
.ce-timeline-toolbar__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ce-timeline-toolbar__controls::-webkit-scrollbar { display: none; }
.ce-timeline-tool-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.76);
  border-radius: 6px;
  min-height: 22px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.ce-timeline-tool-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.ce-timeline-tool-btn.is-active {
  border-color: rgba(214,183,94,0.55);
  background: rgba(214,183,94,0.18);
  color: #fed7aa;
}
.ce-timeline-tool-btn--danger { color: #fca5a5; border-color: rgba(244,63,94,0.32); }
.ce-timeline-multitrack .ce-timeline-ruler { margin-left: 0; height: 18px; }
.ce-tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.06); }
.ce-tl-tick:first-child, .ce-tl-tick:last-child { background: transparent; }
.ce-tl-tick-label {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.3);
  pointer-events: none;
}
.ce-timeline-multitrack .ce-track-row {
  display: block;
  height: 34px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.ce-timeline-multitrack .ce-track-row__lane { height: 100%; width: 100%; }
.ce-timeline-multitrack .ce-timeline-playhead {
  bottom: 0;
  pointer-events: auto;
  cursor: ew-resize;
}
.ce-timeline-multitrack .ce-track-row__clip.is-locked {
  opacity: 0.42;
  filter: grayscale(0.35);
  cursor: not-allowed;
}
.ce-timeline-multitrack .ce-track-row__clip.is-muted {
  filter: saturate(0.3);
}
.ce-timeline-multitrack .ce-track-row--track-hidden .ce-track-row__lane {
  opacity: 0.4;
}
/* Category clip colours */
.ce-clip--video   { background: rgba(56,132,255,0.28);  border-color: rgba(56,132,255,0.55); }
.ce-clip--video:hover { background: rgba(56,132,255,0.42); }
.ce-clip--overlay { background: rgba(168,85,247,0.26);  border-color: rgba(168,85,247,0.55); }
.ce-clip--overlay:hover { background: rgba(168,85,247,0.42); }
.ce-clip--text    { background: rgba(20,184,166,0.26);  border-color: rgba(20,184,166,0.55); }
.ce-clip--text:hover { background: rgba(20,184,166,0.42); }
.ce-clip--audio   { background: rgba(34,197,94,0.24);   border-color: rgba(34,197,94,0.5); }
.ce-clip--audio:hover { background: rgba(34,197,94,0.4); }
.ce-timeline-multitrack .ce-track-row__clip.ce-timeline-clip--selected {
  border-color: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
}

/* ── Viewport (Phase 2) ─────────────────────────────────────────── */

.ce-viewport-root {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d0d1a;
  display: flex;
  flex-direction: column;
}

.ce-viewport-canvas {
  display: block;
  flex: 1;
  min-height: 0;
}

.ce-viewport-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(13,13,26,0.75);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 3px 6px;
  backdrop-filter: blur(6px);
  z-index: 10;
}

.ce-viewport-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}
.ce-viewport-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.ce-viewport-zoom-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  min-width: 36px;
  text-align: right;
}

/* ── Playback overlay ───────────────────────────────────────────── */

.ce-playback-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(10,10,20,0.82);
  border-top: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(4px);
  z-index: 10;
}

.ce-playback-overlay .ce-scrubber {
  flex: 1;
}

/* ── Properties panel (Phase 4) ─────────────────────────────────── */

.ce-prop-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 12px;
}

.ce-prop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.ce-prop-type-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(214,183,94,0.18);
  color: var(--theme-palette-gold);
  border: 1px solid rgba(214,183,94,0.3);
  border-radius: 4px;
  padding: 2px 6px;
}

.ce-prop-name {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ce-prop-section {
  padding: 8px 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ce-prop-section__title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  margin-bottom: 6px;
}

.ce-prop-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.ce-prop-row--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ce-prop-row--2col .ce-prop-row {
  margin-bottom: 0;
}

.ce-prop-label {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  min-width: 48px;
  flex-shrink: 0;
}

.ce-prop-control {
  flex: 1;
  min-width: 0;
}

.ce-prop-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  padding: 3px 6px;
  box-sizing: border-box;
  outline: none;
}

.ce-prop-input:focus {
  border-color: rgba(214,183,94,0.5);
  background: rgba(214,183,94,0.06);
}

.ce-prop-input--text {
  font-size: 11px;
}

/* Slider + number pair (every numeric property) */
.ce-prop-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.ce-prop-range {
  flex: 1;
  min-width: 0;
  height: 16px;
  accent-color: var(--theme-palette-gold);
  cursor: pointer;
}
.ce-prop-num {
  width: 52px;
  flex: 0 0 52px;
  text-align: right;
}
.ce-prop-row--2col .ce-prop-num { width: 44px; flex-basis: 44px; }

.ce-prop-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  padding: 4px 6px;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
}

.ce-prop-textarea:focus {
  border-color: rgba(214,183,94,0.5);
}

.ce-prop-select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  padding: 3px 6px;
  outline: none;
}

.ce-prop-select:focus {
  border-color: rgba(214,183,94,0.5);
}

.ce-prop-color-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ce-prop-color {
  width: 28px;
  height: 24px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.ce-prop-input--hex {
  flex: 1;
  font-family: var(--t-font-mono);
}

/* â”€â”€ Assets panel (Phase 5) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.ce-assets-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ce-assets-toolbar {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.ce-assets-upload-btn {
  background: rgba(214,183,94,0.15);
  border: 1px solid rgba(214,183,94,0.35);
  color: var(--theme-palette-gold);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
}
.ce-assets-upload-btn:hover { background: rgba(214,183,94,0.28); }

.ce-assets-drop-zone {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  transition: background 0.15s;
}
.ce-assets-drop-zone--over { background: rgba(214,183,94,0.08); }

.ce-assets-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  min-height: 100px;
}
.ce-assets-empty__icon { font-size: 24px; opacity: 0.3; }
.ce-assets-empty__text { font-size: 11px; color: rgba(255,255,255,0.25); text-align: center; }

.ce-assets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ce-asset-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  overflow: hidden;
  cursor: grab;
  transition: border-color 0.12s;
}
.ce-asset-card:hover { border-color: rgba(214,183,94,0.4); }
.ce-asset-card:active { cursor: grabbing; }

.ce-asset-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(0,0,0,0.3);
  overflow: hidden;
}

.ce-asset-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ce-asset-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 20px;
  color: rgba(255,255,255,0.2);
  background: rgba(80,80,120,0.3);
}

.ce-asset-dur {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 9px;
  color: #fff;
  background: rgba(0,0,0,0.6);
  border-radius: 2px;
  padding: 1px 3px;
}

.ce-asset-card__meta {
  padding: 4px 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.ce-asset-badge {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}
.ce-asset-badge--image { background: rgba(99,102,241,0.3); color: #a5b4fc; }
.ce-asset-badge--video { background: rgba(214,183,94,0.3); color: #fdba74; }
.ce-asset-badge--audio { background: rgba(34,197,94,0.3);  color: #86efac; }

.ce-asset-name {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ce-asset-wave {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  width: 100%;
  height: 100%;
  padding: 4px;
  box-sizing: border-box;
}

.ce-asset-wave-bar {
  flex: 1;
  min-height: 1px;
  background: #22c55e;
  border-radius: 1px;
  opacity: 0.7;
}

/* â”€â”€ Transform handles (Phase 6) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.ce-handles-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: visible;
}

.ce-handle-box {
  position: absolute;
  border: 1.5px dashed var(--theme-palette-gold);
  pointer-events: none;
  box-sizing: border-box;
}

.ce-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 1.5px solid var(--theme-palette-gold);
  border-radius: 1px;
  pointer-events: all;
  box-sizing: border-box;
}

.ce-handle--rotate {
  border-radius: 50%;
  background: var(--theme-palette-gold);
  border-color: #fff;
  cursor: grab;
}

.ce-handle-rot-line {
  position: absolute;
  width: 1px;
  background: var(--theme-palette-gold);
  opacity: 0.6;
  pointer-events: none;
}

/* â”€â”€ In-place text editor (Phase 6) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.ce-text-edit-overlay {
  position: absolute;
  z-index: 20;
}

.ce-text-edit-input {
  display: block;
  outline: none;
  line-height: 1.3;
}

/* â”€â”€ Context menu (Phase 6) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.ce-context-menu {
  position: absolute;
  background: #1c1c2e;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.ce-context-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.ce-context-menu__item:hover { background: rgba(214,183,94,0.12); color: #fff; }
.ce-context-menu__item--danger { color: #f87171; }
.ce-context-menu__item--danger:hover { background: rgba(248,113,113,0.12); }

.ce-context-menu__shortcut {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  margin-left: 16px;
}

.ce-context-menu__divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 3px 0;
}

/* â”€â”€ Export dialog (Phase 7) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

/* ce-export-trigger-btn defined in header section above */

.ce-export-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

.ce-export-modal {
  background: #14142a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.ce-export-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.ce-export-modal__title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.ce-export-modal__close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
}
.ce-export-modal__close:hover { color: #fff; }

.ce-export-modal__body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ce-export-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ce-export-label {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  min-width: 72px;
}

.ce-export-select,
.ce-export-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
}
.ce-export-select:focus,
.ce-export-input:focus { border-color: rgba(214,183,94,0.5); }

.ce-export-range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.ce-export-range-sep,
.ce-export-range-unit { font-size: 11px; color: rgba(255,255,255,0.3); flex-shrink: 0; }

.ce-export-status { display: flex; flex-direction: column; gap: 6px; }

.ce-export-progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.ce-export-progress-fill {
  height: 100%;
  background: var(--theme-palette-gold);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s;
}

.ce-export-status-text {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

.ce-export-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.ce-export-btn-cancel {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
}
.ce-export-btn-cancel:hover { border-color: rgba(255,255,255,0.3); color: #fff; }

.ce-export-btn-export {
  background: var(--theme-palette-gold);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: 5px;
  cursor: pointer;
}
.ce-export-btn-export:hover { background: #ea6d10; }
.ce-export-btn-export:disabled { opacity: 0.5; cursor: not-allowed; }

/* Creative editor Phase 9 tools */
.ce-timeline-stack {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(96px, 1fr) minmax(132px, auto);
  min-height: 0;
}

.ce-timeline-stack__timeline {
  min-height: 0;
  overflow: auto;
}

.ce-timeline-stack__phase9 {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 0.8fr);
  gap: 8px;
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.ce-graph-editor,
.ce-subs-panel {
  min-width: 0;
  height: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  background: rgba(8,10,24,0.55);
  overflow: hidden;
}

.ce-graph-toolbar,
.ce-subs-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.ce-graph-prop-select,
.ce-graph-btn,
.ce-subs-add-btn,
.ce-sub-input,
.ce-sub-textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.11);
  color: rgba(255,255,255,0.88);
  border-radius: 4px;
  font: inherit;
}

.ce-graph-btn,
.ce-subs-add-btn {
  padding: 4px 8px;
  cursor: pointer;
}

.ce-graph-canvas {
  width: 100%;
  display: block;
}

.ce-graph-hint,
.ce-subs-empty {
  padding: 6px;
  color: rgba(255,255,255,0.42);
  font-size: 11px;
}

.ce-subs-title {
  flex: 1;
  color: rgba(255,255,255,0.74);
  font-size: 12px;
  font-weight: 700;
}

.ce-subs-list {
  max-height: 150px;
  overflow: auto;
  padding: 6px;
}

.ce-sub-row {
  display: grid;
  gap: 5px;
  padding: 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.04);
  margin-bottom: 6px;
}

.ce-sub-row--active {
  outline: 1px solid rgba(214,183,94,0.55);
}

.ce-sub-times,
.ce-sub-text-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ce-sub-input {
  width: 74px;
  padding: 3px 5px;
  font-size: 11px;
}

.ce-sub-textarea {
  min-width: 0;
  flex: 1;
  resize: vertical;
  padding: 4px 6px;
  font-size: 11px;
}

.ce-sub-remove {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: rgba(248,113,113,0.13);
  color: #fca5a5;
  cursor: pointer;
}

/* ── Agent Work Card (rich artifact) ──────────────────────────── */
.thread-links-artifact {
  width: min(100%, 620px);
  margin: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thread-link-card {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border, #dedede);
  border-radius: 14px;
  background: var(--card-bg, #fafafa);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.thread-link-card:hover { border-color: var(--brand, #5a91ff); background: var(--accent-soft, rgba(90,145,255,.08)); }
.thread-link-card:active { transform: scale(.995); }
.thread-link-card:focus-visible { outline: 2px solid var(--brand, #5a91ff); outline-offset: 2px; }
.thread-link-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(127,127,127,.10);
}
.thread-link-icon svg { width: 21px; height: 21px; }
.thread-link-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.thread-link-copy strong, .thread-link-copy small, .thread-link-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-link-label { font-size: 11px; font-weight: 750; opacity: .58; }
.thread-link-copy strong { font-size: 13px; line-height: 1.35; }
.thread-link-copy small { font-size: 11px; opacity: .55; }
.thread-link-open { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 12px; font-weight: 650; opacity: .62; }
.thread-link-open span { font-size: 19px; line-height: 1; }
[data-theme="dark"] .thread-link-card { background: #181818; border-color: #2e2e2e; }
[data-theme="dark"] .thread-link-card:hover { background: rgba(90,145,255,.09); border-color: #496b9d; }

.agent-work-card {
  margin: 14px 0 6px;
  max-width: min(100%, 640px);
  border: 1px solid var(--border, #e3e3e3);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--card-bg, #fafafa);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
[data-theme="dark"] .agent-work-card { background: #181818; border-color: #2a2a2a; }
.agent-work-card .aw-head { display: flex; flex-direction: column; gap: 2px; }
.agent-work-card .aw-greeting { font-size: 16px; font-weight: 700; }
.agent-work-card .aw-title { font-size: 13px; font-weight: 700; opacity: 0.85; }
.agent-work-card .aw-subtitle { font-size: 12px; opacity: 0.6; }
.agent-work-card .aw-summary { display: flex; flex-direction: column; gap: 8px; }
.agent-work-card .aw-summary-row { display: flex; align-items: flex-start; gap: 10px; }
.agent-work-card .aw-icon { font-size: 16px; line-height: 1.3; flex: 0 0 auto; }
.agent-work-card .aw-meta { display: flex; flex-direction: column; }
.agent-work-card .aw-meta strong { font-size: 13px; font-weight: 650; }
.agent-work-card .aw-meta span { font-size: 12px; opacity: 0.62; }
.agent-work-card .aw-priorities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: aw; }
.agent-work-card .aw-priorities li { display: flex; align-items: center; gap: 10px; counter-increment: aw; }
.agent-work-card .aw-priorities li::before {
  content: counter(aw);
  flex: 0 0 auto;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 11px; font-weight: 700;
  background: var(--accent-soft, rgba(120,120,255,0.14));
}
.agent-work-card .aw-priority-body { display: flex; flex-direction: column; flex: 1; }
.agent-work-card .aw-priority-body strong { font-size: 13px; }
.agent-work-card .aw-priority-body span { font-size: 12px; opacity: 0.62; }
.agent-work-card .aw-teams,
.agent-work-card .aw-active { display: flex; flex-direction: column; gap: 8px; }
.agent-work-card .aw-team-row,
.agent-work-card .aw-active-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border, #ececec);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}
[data-theme="dark"] .agent-work-card .aw-team-row,
[data-theme="dark"] .agent-work-card .aw-active-row { border-color: #2a2a2a; }
.agent-work-card .aw-team-body,
.agent-work-card .aw-active-body { display: flex; flex-direction: column; flex: 1; }
.agent-work-card .aw-team-body strong,
.agent-work-card .aw-active-body strong { font-size: 13px; }
.agent-work-card .aw-team-body span,
.agent-work-card .aw-active-body span { font-size: 12px; opacity: 0.62; }
.agent-work-card .aw-status {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft, rgba(120,120,255,0.14));
  opacity: 0.85;
}
.agent-work-card .aw-status.running { background: rgba(96,165,250,0.18); color: #60a5fa; }
.agent-work-card .aw-status.ready,
.agent-work-card .aw-status.active { background: rgba(74,222,128,0.16); color: #4ade80; }
.agent-work-card .aw-status.blocked,
.agent-work-card .aw-status.failed,
.agent-work-card .aw-status.needs_assistance { background: rgba(248,113,113,0.16); color: #fca5a5; }
.agent-work-card .aw-status.paused,
.agent-work-card .aw-status.stalled { background: rgba(250,204,21,0.16); color: #facc15; }

/* Clickable rows + inline detail drawer */
.agent-work-card .aw-row-head { display: flex; align-items: center; gap: 10px; flex: 1; }
.agent-work-card .aw-priorities li { flex-wrap: wrap; }
.agent-work-card .aw-priorities li .aw-row-head { width: 100%; }
.agent-work-card .aw-clickable { cursor: pointer; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; transition: background 0.12s; }
.agent-work-card .aw-clickable:hover { background: var(--accent-soft, rgba(120,120,255,0.10)); }
.agent-work-card .aw-chevron { margin-left: auto; font-size: 11px; opacity: 0.5; transition: transform 0.15s; }
.agent-work-card .aw-row-head.aw-open .aw-chevron { transform: rotate(180deg); }
.agent-work-card .aw-row-removed { opacity: 0.4; text-decoration: line-through; }
.agent-work-card .aw-active-item { display: flex; flex-direction: column; }
.agent-work-card .aw-detail {
  margin: 6px 0 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-bg-2, rgba(127,127,127,0.07));
  border: 1px solid var(--border, #ececec);
  display: flex; flex-direction: column; gap: 8px;
  font-size: 12px;
}
.agent-work-card .aw-detail[hidden] { display: none; }
[data-theme="dark"] .agent-work-card .aw-detail { background: rgba(255,255,255,0.04); border-color: #2a2a2a; }
.agent-work-card .aw-detail-loading { font-size: 12px; opacity: 0.6; }
.agent-work-card .aw-detail-meta { display: flex; align-items: center; gap: 8px; }
.agent-work-card .aw-detail-step { font-size: 11px; opacity: 0.6; }
.agent-work-card .aw-detail-row { line-height: 1.4; }
.agent-work-card .aw-detail-row b { opacity: 0.7; font-weight: 650; }
.agent-work-card .aw-detail-prompt { opacity: 0.8; }
.agent-work-card .aw-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-work-card .aw-act {
  font-size: 11px; font-weight: 650;
  padding: 5px 12px; border-radius: 7px;
  border: 1px solid var(--border, #d8d8d8);
  background: transparent; color: inherit; cursor: pointer;
}
.agent-work-card .aw-act:hover { background: var(--accent-soft, rgba(120,120,255,0.12)); }
.agent-work-card .aw-act:disabled { opacity: 0.5; cursor: default; }
.agent-work-card .aw-act-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.agent-work-card .aw-act-primary:hover { background: #1d4ed8; }
.agent-work-card .aw-act-danger { color: #ef4444; border-color: rgba(239,68,68,0.4); }
.agent-work-card .aw-act-danger:hover { background: rgba(239,68,68,0.12); }
.agent-work-card .aw-msg { display: flex; gap: 6px; }
.agent-work-card .aw-msg-input {
  flex: 1; font-size: 12px;
  padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--border, #d8d8d8);
  background: var(--input-bg, #fff); color: inherit;
}
[data-theme="dark"] .agent-work-card .aw-msg-input { background: #111; border-color: #2a2a2a; }

/* ── Sources card (news/research) ─────────────────────────────── */
.chat-resources-section { background: transparent; }
.chat-resources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 7px;
}
.chat-resources-header .right-section-title { margin: 0; }
.chat-resources-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.chat-resources-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.chat-resources-list { padding: 0 10px 9px; }
.chat-resources-empty {
  padding: 9px 8px 11px;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}
.chat-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 4px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.chat-source-row:first-child { border-top: 0; }
.chat-source-row.is-unavailable { opacity: .62; }
.chat-source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(255,255,255,0.10);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}
.chat-source-label { min-width: 0; flex: 1; }
.chat-source-title {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-source-link { color: var(--text); text-decoration: none; cursor: pointer; }
.chat-source-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.chat-source-file { padding: 0; cursor: pointer; }
.chat-source-file:hover { color: var(--brand); }
.chat-sources-view-more {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 7px 6px 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}
.chat-sources-view-more:hover { color: var(--brand); }
.chat-resources-expanded-toolbar {
  padding: 0 0 8px;
}
.chat-resources-expanded-toolbar input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}
.chat-resources-expanded-toolbar input:focus { border-color: var(--brand); }
.chat-resources-expanded-list {
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand) 38%, transparent) transparent;
}
.chat-resources-expanded-list::-webkit-scrollbar { width: 4px; }
.chat-resources-expanded-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--brand) 38%, transparent); border-radius: 999px; }

.sources-artifact { margin: 14px 0 6px; max-width: min(100%, 980px); }
.sources-artifact .src-heading { font-size: 11px; font-weight: 800; letter-spacing: 0.02em; opacity: 0.62; margin-bottom: 10px; text-transform: uppercase; }
.sources-cards .src-track { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.sources-list .src-track { display: flex; flex-direction: column; gap: 8px; }
.src-card {
  position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: flex-end;
  text-decoration: none; color: inherit;
  border: 1px solid var(--border, #e3e3e3); border-radius: 12px;
  overflow: hidden; background: var(--card-bg, #fafafa); min-height: 210px;
}
.sources-cards .src-card { flex: 0 0 250px; max-width: 250px; }
.sources-list .src-card { min-height: 150px; }
[data-theme="dark"] .src-card { background: #1a1a1a; border-color: #2a2a2a; }
.src-card:hover { border-color: var(--brand, #5a91ff); }
.src-img-wrap { position: absolute; z-index: 0; inset: 0; overflow: hidden; background: rgba(127,127,127,0.1); }
.sources-list .src-img-wrap { inset: 0; width: auto; height: auto; }
.src-img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.src-img-placeholder { position: absolute; inset: 0; display: none; align-items: flex-start; padding: 12px; background: linear-gradient(135deg, rgba(90,145,255,0.28), rgba(168,85,247,0.16)), #edf2fb; color: #26334a; }
.src-img-placeholder span { max-width: 100%; font-size: 12px; font-weight: 750; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-img-missing .src-img-placeholder { display: flex; }
[data-theme="dark"] .src-img-placeholder { background: linear-gradient(135deg, rgba(90,145,255,0.28), rgba(168,85,247,0.14)), #20242d; color: #dbe7ff; }
.src-body { position: relative; z-index: 2; margin-top: 64px; padding: 13px 14px; display: flex; flex-direction: column; gap: 5px; color: #fff; background: linear-gradient(to top, rgba(5,7,11,0.94), rgba(5,7,11,0.68) 72%, rgba(5,7,11,0.18)); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.src-publisher { font-size: 11px; color: rgba(255,255,255,0.86); font-weight: 650; display: flex; align-items: center; gap: 6px; text-shadow: 0 1px 2px #000; }
.src-badge { font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft, rgba(120,120,255,0.14)); text-transform: uppercase; }
.src-title { font-size: 13px; line-height: 1.3; color: #fff; text-shadow: -1px -1px 0 rgba(0,0,0,0.95), 1px -1px 0 rgba(0,0,0,0.95), -1px 1px 0 rgba(0,0,0,0.95), 1px 1px 0 rgba(0,0,0,0.95), 0 2px 5px #000; }
.src-snippet { font-size: 12px; color: rgba(255,255,255,0.82); line-height: 1.4; text-shadow: 0 1px 3px #000; }
.src-date { font-size: 11px; color: rgba(255,255,255,0.68); text-shadow: 0 1px 2px #000; }

/* ── Stocks / crypto market card ──────────────────────────────── */
.stocks-artifact {
  margin: 14px 0 6px; max-width: min(100%, 560px);
  border: 1px solid var(--border, #e3e3e3); border-radius: 14px;
  padding: 12px 14px; background: var(--card-bg, #fafafa);
  display: flex; flex-direction: column; gap: 8px;
}
[data-theme="dark"] .stocks-artifact { background: #181818; border-color: #2a2a2a; }
.stocks-artifact .mk-heading { font-size: 11px; font-weight: 800; letter-spacing: 0.02em; opacity: 0.62; text-transform: uppercase; }
.mk-row { display: flex; align-items: center; gap: 12px; }
.mk-row.mk-single { padding: 4px 0; }
.mk-id { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.mk-logo { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; }
.mk-id-text { display: flex; flex-direction: column; min-width: 0; }
.mk-id-text strong { font-size: 14px; }
.mk-id-text span { font-size: 11px; opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-spark { width: 120px; height: 32px; flex: 0 0 auto; }
.mk-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mk-price { font-size: 14px; font-weight: 700; }
.mk-delta { font-size: 11px; font-weight: 700; }
.mk-delta.up { color: #22c55e; }
.mk-delta.down { color: #ef4444; }
.mk-cap { font-size: 10px; opacity: 0.55; }
.mk-source { font-size: 10px; opacity: 0.45; align-self: flex-end; }

/* ── Weather card ─────────────────────────────────────────────── */
.weather-artifact {
  margin: 14px 0 6px; max-width: min(100%, 680px);
  border: 1px solid var(--border, #e3e3e3); border-radius: 16px;
  padding: 16px 18px; background: var(--card-bg, #fafafa);
  display: flex; flex-direction: column; gap: 14px;
}
[data-theme="dark"] .weather-artifact { background: #181818; border-color: #2a2a2a; }
.wx-head { display: flex; flex-direction: column; gap: 2px; }
.wx-loc { font-size: 13px; font-weight: 700; opacity: 0.85; }
.wx-now { display: flex; align-items: flex-start; gap: 4px; }
.wx-temp { font-size: 44px; font-weight: 300; line-height: 1; }
.wx-unit { font-size: 12px; opacity: 0.6; margin-top: 4px; }
.wx-cond { font-size: 13px; opacity: 0.75; }
.wx-days { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; touch-action: pan-x; }
.wx-days::-webkit-scrollbar, .wx-hourly-track::-webkit-scrollbar { display: none; }
.wx-day { flex: 0 0 auto; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 7px; border: 1px solid transparent; border-radius: 12px; background: rgba(127,127,127,0.06); color: inherit; font: inherit; cursor: pointer; scroll-snap-align: start; }
.wx-day.is-active { border-color: color-mix(in srgb, var(--brand, #5a91ff) 62%, transparent); background: var(--accent-soft, rgba(90,145,255,0.15)); box-shadow: inset 0 0 0 1px rgba(90,145,255,0.08); }
.wx-day:focus-visible { outline: 2px solid var(--brand, #5a91ff); outline-offset: 2px; }
.wx-day-name { font-size: 11px; font-weight: 600; opacity: 0.7; }
.wx-day-icon { font-size: 20px; }
.wx-day-hi { font-size: 13px; font-weight: 700; }
.wx-day-lo { font-size: 12px; opacity: 0.5; }
.wx-hourly { min-width: 0; }
.wx-hourly-panel[hidden] { display: none; }
.wx-hourly-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 1px 1px 7px; }
.wx-hourly-title strong { font-size: 12px; }
.wx-hourly-title span { font-size: 10px; opacity: 0.52; }
.wx-hourly-track { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 7px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; touch-action: pan-x; }
.wx-hour { flex: 0 0 62px; min-height: 106px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 5px; border: 1px solid rgba(127,127,127,.12); border-radius: 12px; background: rgba(127,127,127,.055); scroll-snap-align: start; }
.wx-hour-time { font-size: 10px; opacity: .62; white-space: nowrap; }
.wx-hour-icon { font-size: 18px; line-height: 1; }
.wx-hour strong { font-size: 13px; }
.wx-hour small { font-size: 9px; line-height: 1.15; opacity: .56; text-align: center; white-space: nowrap; }
.wx-hour .wx-hour-rain { color: #3b9cff; opacity: .92; }
.wx-hourly-empty { padding: 12px; border-radius: 10px; background: rgba(127,127,127,.06); font-size: 11px; opacity: .6; }

/* ── Comparison table ─────────────────────────────────────────── */
.comparison-artifact { margin: 14px 0 6px; max-width: min(100%, 980px); }
.cmp-heading { font-size: 11px; font-weight: 800; opacity: 0.62; text-transform: uppercase; margin-bottom: 10px; }
.cmp-scroll { overflow-x: auto; border: 1px solid var(--border, #e3e3e3); border-radius: 12px; }
[data-theme="dark"] .cmp-scroll { border-color: #2a2a2a; }
.cmp-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.cmp-table th, .cmp-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border, #ececec); white-space: nowrap; }
[data-theme="dark"] .cmp-table th, [data-theme="dark"] .cmp-table td { border-color: #262626; }
.cmp-table thead th { font-weight: 700; background: rgba(127,127,127,0.06); }
.cmp-table tbody tr:last-child td { border-bottom: none; }
.cmp-table .cmp-label { font-weight: 650; opacity: 0.85; position: sticky; left: 0; background: var(--card-bg, #fafafa); }
[data-theme="dark"] .cmp-table .cmp-label { background: #181818; }
.cmp-table .cmp-hl { background: var(--accent-soft, rgba(90,145,255,0.10)); }
.cmp-table thead th.cmp-hl { background: rgba(90,145,255,0.18); }

/* ── Chart card ───────────────────────────────────────────────── */
.chart-artifact {
  margin: 14px 0 6px; max-width: min(100%, 560px);
  border: 1px solid var(--border, #e3e3e3); border-radius: 14px;
  padding: 14px; background: var(--card-bg, #fafafa);
}
[data-theme="dark"] .chart-artifact { background: #181818; border-color: #2a2a2a; }
.chart-heading { font-size: 11px; font-weight: 800; opacity: 0.62; text-transform: uppercase; margin-bottom: 10px; }
.chart-frame-wrap { height: 236px; overflow: hidden; border-radius: 10px; background: #fff; }
[data-theme="dark"] .chart-frame-wrap { background: #141b22; }
.chart-frame { width: 100%; height: 100%; border: 0; display: block; }
.chart-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 9px; color: var(--muted, #667085); font-size: 10px; font-weight: 600; }
[data-theme="dark"] .chart-meta { color: #8c9aa5; }

/* ── Run result card ──────────────────────────────────────────── */
.run-result-artifact {
  margin: 14px 0 6px; max-width: min(100%, 560px);
  border: 1px solid var(--border, #e3e3e3); border-radius: 14px;
  padding: 14px 16px; background: var(--card-bg, #fafafa);
  display: flex; flex-direction: column; gap: 10px;
}
[data-theme="dark"] .run-result-artifact { background: #181818; border-color: #2a2a2a; }
.rr-head { display: flex; align-items: center; gap: 8px; }
.rr-icon { font-size: 16px; }
.rr-title { font-size: 14px; font-weight: 700; flex: 1; }
.rr-summary { font-size: 12px; opacity: 0.8; line-height: 1.45; }
.rr-files, .rr-links, .rr-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rr-file, .rr-link {
  font-size: 11px; font-weight: 600; text-decoration: none; color: inherit;
  padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--border, #d8d8d8); background: transparent; cursor: pointer;
}
.rr-file:hover, .rr-link:hover { background: var(--accent-soft, rgba(120,120,255,0.12)); }

/* ── Email composer card ─────────────────────────────────────── */
.email-composer-card {
  width: min(420px, 100%);
  margin: 10px 0 6px;
  padding: 14px;
  border: 1px solid var(--border, var(--pm-border));
  border-radius: 22px;
  background: var(--surface-2, var(--pm-surface-secondary));
  box-sizing: border-box;
}
.email-composer-kicker {
  margin-bottom: 8px;
  color: var(--muted, var(--pm-muted));
  font-size: 13px;
  font-weight: 700;
}
.email-composer-preview {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface, var(--pm-surface));
  color: var(--text, var(--pm-text));
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.email-composer-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.email-send-btn,
.email-discard-btn {
  flex: 1 1 0;
  min-height: 40px;
  border-radius: 999px;
  border: 0;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.email-send-btn {
  background: var(--text, var(--pm-text));
  color: var(--bg, #fff);
}
.email-discard-btn {
  background: transparent;
  border: 1px solid var(--border, var(--pm-border));
  color: var(--text, var(--pm-text));
}
.email-composer-sent {
  margin-top: 10px;
  color: var(--muted, var(--pm-muted));
  font-size: 13px;
}

.email-composer-card {
  margin: 14px 0 6px;
  max-width: min(100%, 640px);
  border: 1px solid var(--border, #e3e3e3);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}
[data-theme="dark"] .email-composer-card { background: #181818; border-color: #2a2a2a; box-shadow: 0 18px 44px rgba(0,0,0,0.34); }
.email-composer-card > summary {
  list-style: none;
}
.email-composer-card > summary::-webkit-details-marker { display: none; }
.email-composer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: rgba(127,127,127,0.05);
  border-bottom: 1px solid transparent;
}
.email-composer-card[open] .email-composer-summary { border-bottom-color: var(--border, #e8e8e8); }
[data-theme="dark"] .email-composer-card[open] .email-composer-summary { border-bottom-color: #262626; }
.email-composer-summary-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.email-composer-summary-main strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}
.email-composer-summary-main small {
  display: block;
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.email-composer-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2563eb;
  flex: 0 0 auto;
}
.email-composer-card.is-sent .email-composer-dot { background: #16a34a; }
.email-composer-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.10);
}
.email-composer-card.is-sent .email-composer-status {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
}
.email-composer-window {
  background: #fff;
}
[data-theme="dark"] .email-composer-window { background: #181818; }
.email-composer-titlebar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
}
[data-theme="dark"] .email-composer-titlebar { background: #20242b; color: #f8fafc; }
.email-composer-title-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.email-composer-title-actions button,
.email-composer-toolbar button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.email-composer-title-actions button {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: 12px;
}
.email-composer-title-actions button:hover,
.email-composer-toolbar button:hover { background: rgba(127,127,127,0.12); }
.email-composer-fields {
  display: flex;
  flex-direction: column;
}
.email-composer-fields label {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border, #ececec);
  padding: 0 12px;
}
[data-theme="dark"] .email-composer-fields label { border-bottom-color: #262626; }
.email-composer-fields span {
  flex: 0 0 auto;
  min-width: 34px;
  color: var(--muted);
  font-size: 13px;
}
.email-composer-fields input,
.email-field-body {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.email-composer-fields input[readonly],
.email-field-body[readonly] {
  color: var(--text);
}
.email-field-body {
  box-sizing: border-box;
  min-height: 240px;
  max-height: 520px;
  resize: vertical;
  padding: 14px 12px;
  line-height: 1.5;
}
.email-composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}
.email-composer-attachment {
  border: 1px solid var(--border, #d8d8d8);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(127,127,127,0.06);
}
.email-composer-meta {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 10px;
}
.email-composer-toolbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-top: 1px solid var(--border, #ececec);
}
[data-theme="dark"] .email-composer-toolbar { border-top-color: #262626; }
.email-composer-toolbar button {
  min-width: 30px;
  height: 30px;
  border-radius: 6px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
}
.email-composer-send-wrap {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}
.email-composer-toolbar .email-send-btn {
  min-width: 62px;
  border-radius: 999px 0 0 999px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
}
.email-composer-toolbar .email-send-menu {
  min-width: 30px;
  border-radius: 0 999px 999px 0;
  background: #1d4ed8;
  color: #fff;
  font-weight: 800;
}
.email-composer-toolbar .email-send-btn.is-sent {
  border-radius: 999px;
  background: #16a34a;
}
.email-composer-toolbar .email-send-btn:disabled,
.email-composer-toolbar button:disabled {
  cursor: default;
  opacity: 0.7;
}
.email-composer-spacer { flex: 1; }
.email-composer-card.is-sending { opacity: 0.82; pointer-events: none; }

@media (max-width: 640px) {
  .email-composer-card { max-width: 100%; }
  .email-composer-summary-main small { max-width: 220px; }
  .email-field-body { min-height: 220px; }
  .email-composer-toolbar { overflow-x: auto; }
}

/* ── Map card ─────────────────────────────────────────────────── */
.map-artifact { margin: 14px 0 6px; max-width: min(100%, 680px); }
.map-heading { font-size: 11px; font-weight: 800; opacity: 0.62; text-transform: uppercase; margin-bottom: 10px; }
.map-frame-wrap { border-radius: 14px; overflow: hidden; border: 1px solid rgba(87,166,183,.34); background: #09151d; box-shadow: 0 10px 26px rgba(8,24,31,.14); }
[data-theme="dark"] .map-frame-wrap { border-color: rgba(109,196,214,.28); }
.map-frame { width: 100%; height: 280px; border: 0; display: block; }
.map-markers { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.map-marker { display: flex; gap: 10px; padding: 9px 11px; border: 1px solid var(--border, #ececec); border-radius: 11px; }
[data-theme="dark"] .map-marker { border-color: #262626; }
.map-marker-num { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; background: var(--accent-soft, rgba(90,145,255,0.16)); }
.map-marker-body { flex: 1; min-width: 0; }
.map-marker-top { display: flex; align-items: center; gap: 8px; }
.map-marker-top strong { font-size: 13px; }
.map-rating { font-size: 11px; color: #f59e0b; font-weight: 700; }
.map-marker-sub { font-size: 12px; opacity: 0.62; margin-top: 1px; }
.map-marker-links { display: flex; gap: 12px; margin-top: 4px; }
.map-link { font-size: 11px; font-weight: 600; color: var(--brand, #5a91ff); text-decoration: none; }
.map-link:hover { text-decoration: underline; }

/* ── Prediction market (Polymarket) card ──────────────────────── */
.prediction-market-artifact { margin: 14px 0 6px; max-width: min(100%, 680px); }
.pmkt-heading { font-size: 11px; font-weight: 800; opacity: 0.62; text-transform: uppercase; margin-bottom: 10px; }
.pmkt-cards { display: flex; flex-direction: column; gap: 10px; }
.pmkt-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border, #e3e3e3); border-radius: 12px;
  padding: 12px 14px; background: var(--card-bg, #fafafa);
}
[data-theme="dark"] .pmkt-card { background: #181818; border-color: #2a2a2a; }
.pmkt-card:hover { border-color: var(--brand, #5a91ff); }
.pmkt-q { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 650; line-height: 1.35; margin-bottom: 10px; }
.pmkt-icon { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; flex: 0 0 auto; }
.pmkt-outcomes { display: flex; flex-direction: column; gap: 7px; }
.pmkt-outcome-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.pmkt-outcome-label { opacity: 0.85; }
.pmkt-outcome-pct { font-weight: 700; }
.pmkt-bar { height: 6px; border-radius: 4px; background: rgba(127,127,127,0.18); overflow: hidden; }
.pmkt-bar-fill { height: 100%; border-radius: 4px; background: var(--brand, #5a91ff); }
.pmkt-bar-fill.yes { background: #22c55e; }
.pmkt-bar-fill.no { background: #ef4444; }
.pmkt-meta { font-size: 11px; opacity: 0.55; margin-top: 9px; }
.pmkt-source { font-size: 10px; opacity: 0.45; margin-top: 8px; }

/* ── Product Carousel ─────────────────────────────────────────── */
.product-carousel { margin: 14px 0 6px; position: relative; max-width: min(100%, 980px); }
.pc-heading { font-size: 11px; font-weight: 800; letter-spacing: 0.02em; opacity: 0.62; margin-bottom: 10px; text-transform: uppercase; }
.pc-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 42px 12px 0;
  position: relative;
  scrollbar-width: none;
}
.pc-track::-webkit-scrollbar { display: none; }
.pc-card {
  flex: 0 0 206px;
  min-height: 318px;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
  background: var(--surface, #fff);
}
.pc-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.13); transform: translateY(-1px); }
[data-theme="dark"] .pc-card { background: #1c1c1c; border-color: #2e2e2e; }
.pc-img-wrap { position: relative; height: 124px; background: #f0f0f0; overflow: hidden; flex: 0 0 124px; }
[data-theme="dark"] .pc-img-wrap { background: #252525; }
.pc-img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; position: relative; z-index: 1; }
[data-theme="dark"] .pc-img { background: #181818; }
.pc-img-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--t-accent) 18%, transparent), rgba(59,130,246,0.12)),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0, rgba(255,255,255,0.08) 10px, transparent 10px, transparent 22px);
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
}
.pc-img-missing .pc-img-placeholder { display: flex; }
[data-theme="dark"] .pc-img-placeholder { background: linear-gradient(135deg, color-mix(in srgb, var(--t-accent) 18%, transparent), rgba(96,165,250,0.10)), #222; }
.pc-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  z-index: 2;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pc-card-body { display: flex; flex: 1; flex-direction: column; gap: 7px; padding: 11px 12px 12px; min-height: 0; }
.pc-merchant { color: var(--muted, #64748b); font-size: 10px; font-weight: 800; letter-spacing: 0.04em; line-height: 1; text-transform: uppercase; }
.pc-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.28;
  min-height: 50px;
}
.pc-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 18px; }
.pc-meta {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted, #64748b);
  font-size: 12px;
  line-height: 1.35;
}
.pc-price { font-weight: 800; color: var(--text, #0f172a); }
.pc-rating { display: block; font-size: 12px; color: #f59e0b; }
.pc-reviews { color: var(--muted, #64748b); font-size: 11px; font-weight: 650; }
.pc-badge-inline {
  border: 1px solid rgba(245,158,11,0.36);
  border-radius: 999px;
  color: #92400e;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
}
[data-theme="dark"] .pc-rating { color: #fbbf24; }
[data-theme="dark"] .pc-price { color: #f8fafc; }
[data-theme="dark"] .pc-badge-inline { background: rgba(245,158,11,0.12); color: #fbbf24; }
.pc-arrow {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  color: #374151;
  padding: 0;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.pc-arrow.pc-prev { left: 4px; right: auto; }
.pc-arrow.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.92);
}
.pc-arrow:hover { background: #f9fafb; box-shadow: 0 4px 14px rgba(0,0,0,0.22); }
[data-theme="dark"] .pc-arrow { background: #2a2a2a; border-color: #3a3a3a; color: #e5e7eb; }
[data-theme="dark"] .pc-arrow:hover { background: #333; }

/* ── Command palette (Ctrl+K) & shortcuts help (Ctrl+/) ──────────────────── */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 20, 40, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 18px 18px;
}
.cmdk-card {
  width: min(640px, 96vw);
  max-height: 70vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cmdk-input {
  width: 100%;
  box-sizing: border-box;
  padding: 16px 18px;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  outline: none;
}
.cmdk-results {
  overflow-y: auto;
  max-height: 50vh;
  padding: 6px;
}
.cmdk-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 8px 10px 4px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.cmdk-item.active, .cmdk-item:hover {
  background: var(--panel-2);
}
.cmdk-item-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.cmdk-item-text {
  flex: 1;
  min-width: 0;
}
.cmdk-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item-kbd {
  font-size: 11px;
  font-family: var(--t-font-mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.cmdk-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.cmdk-footer {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.cmdk-footer kbd,
.shortcuts-help-combo kbd {
  font-family: var(--t-font-mono);
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 2px;
  background: var(--panel-2);
  color: var(--text);
}

.shortcuts-help-card {
  width: min(520px, 96vw);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.shortcuts-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  color: var(--text);
}
.shortcuts-help-close {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 13px;
}
.shortcuts-help-body {
  padding: 8px 16px 16px;
  overflow-y: auto;
}
.shortcuts-help-group {
  margin-top: 14px;
}
.shortcuts-help-group:first-child {
  margin-top: 4px;
}
.shortcuts-help-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.shortcuts-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}
.shortcuts-help-row:last-child {
  border-bottom: none;
}
.shortcuts-help-plus {
  margin: 0 3px;
  color: var(--muted);
  font-size: 11px;
}

/* Flash highlight used by the command palette to point at a settings control
   after jumping to it from search. */
.cmdk-highlight {
  animation: cmdkHighlightFlash 1.6s ease-out;
  border-radius: 8px;
}
@keyframes cmdkHighlightFlash {
  0% { background-color: color-mix(in srgb, var(--t-accent) 35%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-accent) 45%, transparent); }
  100% { background-color: transparent; box-shadow: 0 0 0 0 color-mix(in srgb, var(--t-accent) 0%, transparent); }
}

.subagent-panel-chat-composer.chat-input-area {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  flex: 0 0 auto;
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  margin: 12px 0 0 !important;
  box-sizing: border-box;
  z-index: 1;
}
.subagent-panel-chat-composer .chat-input-row {
  align-items: center;
  gap: 10px;
}
.model-speed-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  color: currentColor;
}
.model-speed-icon[hidden] { display: none !important; }

/* ── Sources panel ────────────────────────────────────────────
   The source drawer is intentionally a single, quiet surface. The old
   progress/process targets remain hidden in the DOM for stream compatibility. */
.right-panel .source-panel-topbar {
  align-items: center;
  justify-content: space-between;
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  color: var(--text);
  background: var(--pm-shell-surface, var(--panel)) !important;
  border-bottom: 1px solid var(--line) !important;
}
.right-panel .source-panel-heading {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.source-panel-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.source-panel-icon-btn,
.source-panel-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--pm-shell-accent, var(--brand)) 6%, transparent);
  cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.source-panel-icon-btn:hover,
.source-panel-close-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--pm-shell-accent, var(--brand)) 13%, transparent);
  border-color: color-mix(in srgb, var(--pm-shell-accent, var(--brand)) 42%, var(--line-strong));
}
.source-panel-close-btn {
  margin-left: 2px;
  border-color: transparent;
  background: transparent;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}
.source-panel-canvas-btn {
  position: relative;
  width: 28px;
  min-width: 28px;
  gap: 0;
  padding: 0;
  font: 700 11px/1 var(--t-font-ui);
}
.source-panel-icon-btn svg { width: 14px; height: 14px; }
.source-panel-canvas-btn svg { width: 13px; height: 13px; }
.source-panel-canvas-btn #canvas-notify-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--pm-shell-surface, var(--panel));
  border-radius: 999px;
  background: var(--pm-shell-accent, var(--brand));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pm-shell-accent, var(--brand)) 18%, transparent);
  display: none;
}
#source-panel-refresh,
.source-panel-canvas-btn,
.sources-minimized-header .source-panel-icon-btn {
  border-color: transparent;
  background: transparent;
}
#source-panel-refresh:hover,
#source-panel-refresh:focus-visible,
.source-panel-canvas-btn:hover,
.source-panel-canvas-btn:focus-visible,
.sources-minimized-header .source-panel-icon-btn:hover,
.sources-minimized-header .source-panel-icon-btn:focus-visible {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}
.source-panel-canvas-btn.browser-live,
.source-panel-canvas-btn.browser-live:hover,
.source-panel-canvas-btn.browser-live:focus-visible {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.source-panel-canvas-btn.browser-live:hover,
.source-panel-canvas-btn.browser-live:focus-visible { color: var(--text); }
.source-panel-canvas-btn #canvas-notify-dot,
.source-panel-canvas-btn.browser-live #canvas-notify-dot { display: none; }
.source-panel-shell {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  color: var(--text);
  background: var(--bg);
}
#source-panel-runtime-compat[hidden] { display: none !important; }
.source-panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 0 0 auto;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.source-panel-tab {
  position: relative;
  min-height: 48px;
  padding: 0 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: 600 12px/1 var(--t-font-ui);
  cursor: pointer;
  transition: color .15s ease;
}
.source-panel-tab:hover { color: var(--text); }
.source-panel-tab.is-active { color: var(--pm-shell-accent-light, var(--brand)); }
.source-panel-tab.is-active::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--pm-shell-accent, var(--brand));
  content: '';
}
.source-panel-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 13px 16px 0;
  padding: 0 10px;
  min-height: 36px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  color: #828894;
  background: #171b21;
}
.source-panel-filter-row[hidden] { display: none !important; }
.source-panel-filter-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: #e8e8e5;
  background: transparent;
  font: 12px/1.2 var(--t-font-ui);
}
.source-panel-filter-row input::placeholder { color: #737985; }
.source-panel-filter-row button {
  padding: 0;
  border: 0;
  color: #8e949f;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.source-panel-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px 28px;
  scrollbar-color: rgba(255,255,255,.16) transparent;
}
.source-panel-body::-webkit-scrollbar { width: 7px; }
.source-panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }
.source-panel-subtitle {
  margin: 0 0 15px;
  color: #777e8a;
  font-size: 11px;
  line-height: 1.45;
}
.source-panel-project-name {
  margin: 0 0 3px;
  color: #f0f0ed;
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-panel-project-root {
  overflow: hidden;
  color: #777e8a;
  font: 10px/1.4 'JetBrains Mono', monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-panel-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 24px;
}
.source-panel-count-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.045);
  border-radius: 11px;
  color: #dfe1e5;
  background: #191d23;
}
.source-panel-count-card .count-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
}
.source-panel-count-card .count-label svg { color: #a5aab4; }
.source-panel-count-card .count-value {
  color: #dfe1e4;
  font: 600 14px/1 'JetBrains Mono', monospace;
}
.source-panel-section { margin-top: 22px; }
.source-panel-section:first-child { margin-top: 0; }
.source-panel-section-title {
  margin: 0 0 9px;
  color: #9da2ac;
  font-size: 11px;
  font-weight: 650;
}
.source-panel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.source-panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.045);
  border-radius: 11px;
  color: #e5e6e8;
  background: #191d23;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
button.source-panel-row:hover {
  border-color: rgba(169,112,255,.28);
  background: #20252d;
  transform: translateY(-1px);
}
.source-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 8px;
  color: #d9dbe2;
  background: #30353e;
  font: 700 9px/1 'JetBrains Mono', monospace;
  text-transform: uppercase;
}
.source-item-icon--web { color: #ffede1; background: #ef5f22; }
.source-item-icon--image { color: #fff7e6; background: #a69173; }
.source-item-icon--html,
.source-item-icon--code { color: #eadbff; background: #6e4db2; }
.source-item-icon--pdf { color: #ffe8e8; background: #b34242; }
.source-item-icon--video { color: #f1f2f4; background: #30343b; }
.source-item-icon--git { color: #f2f2f2; background: #292e36; }
.source-item-icon--edit { color: #ede2ff; background: #58408f; }
.source-item-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.source-item-title {
  display: block;
  overflow: hidden;
  color: #e9e9e7;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-item-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 4px;
  overflow: hidden;
  color: #7f8691;
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-item-meta .source-meta-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-item-chevron {
  flex: 0 0 auto;
  color: #a2a7b0;
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
}
.source-panel-empty {
  padding: 18px 4px;
  color: #777e8a;
  font-size: 11px;
  line-height: 1.5;
}
.source-panel-link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding: 0;
  border: 0;
  color: #b895ff;
  background: transparent;
  font: 600 11px/1.2 var(--t-font-ui);
  cursor: pointer;
}
.source-panel-link-button:hover { color: #d0baff; }
.source-count-add { color: #58cb88; font-family: var(--t-font-mono); }
.source-count-del { color: #ec7373; font-family: var(--t-font-mono); }
.source-count-muted { color: #7e8590; }
.source-panel-group-divider {
  height: 1px;
  margin: 22px 0 0;
  background: rgba(255,255,255,.07);
}
.source-panel-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
  color: #858c97;
  font-size: 10px;
}
.source-panel-scope-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.source-panel-scope-toggle button,
.coding-diff-view-toggle button {
  border: 0;
  border-radius: 5px;
  padding: 3px 7px;
  color: #858c97;
  background: transparent;
  font: 600 10px/1.2 var(--t-font-ui);
  cursor: pointer;
}
.source-panel-scope-toggle button.is-active,
.coding-diff-view-toggle button.is-active { color: #f0efff; background: rgba(169,112,255,.18); }
.source-panel-row--workspace-file .source-item-icon { font-family: var(--t-font-mono); font-size: 10px; font-weight: 700; }
.source-panel-row--status-added .source-item-icon { color: #63d896; background: rgba(65,190,119,.14); }
.source-panel-row--status-deleted .source-item-icon { color: #ed7777; background: rgba(210,70,70,.14); }
.source-panel-row--status-modified .source-item-icon,
.source-panel-row--status-renamed .source-item-icon { color: #d1b5ff; background: rgba(125,84,190,.18); }
.source-panel-row--work .source-item-icon { color: #b895ff; background: rgba(169,112,255,.14); }
.source-panel-row--background-agent .source-item-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.source-panel-row--background-agent .source-item-icon { color: var(--source-agent-color, #1677d2); background: color-mix(in srgb, var(--source-agent-color, #1677d2) 16%, transparent); }
.source-agent-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.source-agent-age { flex: 0 0 auto; color: #7f8691; font-size: 9px; font-weight: 500; white-space: nowrap; }

.coding-diff-workspace {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.coding-diff-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4,5,8,.68);
  backdrop-filter: blur(3px);
}
.coding-diff-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1120px, 100%);
  height: min(760px, 92vh);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  background: #111419;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.coding-diff-header,
.coding-diff-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.coding-diff-header { flex-wrap: wrap; }
.coding-diff-header strong { display: block; color: #f0f1f3; font-size: 12px; }
.coding-diff-header-actions { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.coding-diff-action { border: 1px solid rgba(255,255,255,.1); border-radius: 6px; padding: 4px 8px; color: #b895ff; background: transparent; font: 600 10px/1.2 var(--t-font-ui); cursor: pointer; }
.coding-diff-action:hover { border-color: rgba(184,149,255,.55); background: rgba(169,112,255,.1); }
.coding-diff-branch-select { max-width: 138px; padding: 4px 22px 4px 7px; border: 1px solid rgba(255,255,255,.1); border-radius: 6px; color: #b895ff; background: #171923; font: 600 10px/1.2 var(--t-font-ui); cursor: pointer; }
.coding-diff-branch-select:focus { outline: 1px solid rgba(184,149,255,.55); outline-offset: 1px; }
.coding-diff-meta,
.coding-diff-root { display: block; margin-top: 3px; overflow: hidden; color: #858c97; font: 10px/1.25 'IBM Plex Mono', monospace; text-overflow: ellipsis; white-space: nowrap; }
.coding-diff-toolbar { justify-content: flex-start; padding-top: 7px; padding-bottom: 7px; }
.coding-diff-view-toggle { display: inline-flex; padding: 2px; border: 1px solid rgba(255,255,255,.08); border-radius: 7px; }
.coding-diff-root { margin: 0 0 0 auto; max-width: 52%; }
.coding-diff-layout { display: grid; grid-template-columns: minmax(190px, 260px) minmax(0, 1fr); min-height: 0; flex: 1 1 auto; }
.coding-diff-files { overflow: auto; padding: 8px; border-right: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.018); }
.coding-diff-tree-title { padding: 4px 7px 5px; color: #737b87; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.coding-diff-tree-title--changes { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 10px; }
.coding-diff-tree-list { display: flex; flex-direction: column; gap: 1px; }
.coding-diff-tree-entry { display: flex; align-items: center; gap: 6px; width: 100%; overflow: hidden; padding: 5px 7px; border: 0; border-radius: 5px; color: #a3aab5; background: transparent; font: 10px/1.3 'IBM Plex Mono', monospace; text-align: left; cursor: pointer; }
.coding-diff-tree-entry span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coding-diff-tree-entry:hover { color: #f0efff; background: rgba(169,112,255,.1); }
.coding-diff-tree-entry--folder { color: #c2b4e7; }
.coding-diff-tree-loading { padding: 5px 7px; color: #737b87; font-size: 10px; }
.coding-diff-file { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 1px 0; padding: 7px 8px; border: 0; border-radius: 6px; color: #b8bdc7; background: transparent; font: 10px/1.3 'IBM Plex Mono', monospace; text-align: left; cursor: pointer; }
.coding-diff-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coding-diff-file small { flex: 0 0 auto; color: #737b87; font: 9px/1.2 var(--t-font-ui); }
.coding-diff-file:hover,
.coding-diff-file.is-active { color: #f2efff; background: rgba(169,112,255,.14); }
.coding-diff-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0e1014; }
.coding-diff-history { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 5px 12px; max-height: 52px; overflow: auto; padding: 6px 12px; border-bottom: 1px solid rgba(255,255,255,.06); color: #8e96a3; font: 10px/1.3 var(--t-font-ui); }
.coding-diff-history-row { display: inline-flex; align-items: baseline; gap: 5px; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coding-diff-history-hash { color: #b895ff; font: 10px/1.2 'IBM Plex Mono', monospace; }
.coding-diff-history-empty { color: #737b87; }
.coding-diff-view { min-width: 0; min-height: 0; flex: 1 1 auto; overflow: auto; background: #0e1014; }
.coding-diff-loading,
.coding-diff-empty { padding: 28px 20px; color: #7f8691; font-size: 11px; }
.coding-diff-lines { min-width: 620px; padding: 10px 0 24px; color: #c7ccd4; font: 11px/1.55 'IBM Plex Mono', monospace; }
.coding-diff-line { display: grid; grid-template-columns: 42px 42px 18px minmax(0, 1fr); min-height: 18px; white-space: pre; }
.coding-diff-line--add { color: #c5f6d8; background: rgba(37,134,78,.22); }
.coding-diff-line--del { color: #ffd0d0; background: rgba(163,53,53,.22); }
.coding-diff-number { padding: 0 7px; color: #68717e; background: rgba(255,255,255,.025); text-align: right; user-select: none; }
.coding-diff-prefix { color: #777f8b; text-align: center; user-select: none; }
.coding-diff-line--add .coding-diff-prefix { color: #68d997; }
.coding-diff-line--del .coding-diff-prefix { color: #ed7777; }
.coding-diff-content { min-width: 0; padding: 0 12px 0 4px; overflow: hidden; text-overflow: ellipsis; }
.coding-diff-hunk { margin: 8px 0 2px; padding: 3px 12px; color: #b895ff; background: rgba(169,112,255,.1); font: 10px/1.4 'IBM Plex Mono', monospace; }
.coding-diff-note { padding: 7px 12px; color: #737b87; font: 10px/1.35 'IBM Plex Mono', monospace; }
.coding-diff-binary { display: flex; align-items: center; gap: 8px; padding: 24px 18px; color: #adb3bd; font-size: 11px; }
.canvas-diff-wrap { min-width: 0; min-height: 0; flex-direction: column; background: #0e1014; color: #c7ccd4; }
.canvas-diff-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; min-height: 34px; padding: 7px 12px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.025); }
.canvas-diff-title { min-width: 0; overflow: hidden; color: #e6e8ed; font: 600 11px/1.3 var(--t-font-ui); text-overflow: ellipsis; white-space: nowrap; }
.canvas-diff-meta { flex: 0 0 auto; color: #858c97; font: 10px/1.25 'IBM Plex Mono', monospace; white-space: nowrap; }
.canvas-diff-loading { padding: 28px 20px; color: #7f8691; font: 11px/1.5 var(--t-font-ui); }
.canvas-diff-wrap > .coding-diff-lines { flex: 1 1 auto; overflow: auto; min-height: 0; }
.coding-workspace-files button { max-width: 100%; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); background: transparent; font: 10px/1.2 var(--t-font-ui); cursor: pointer; }
.coding-workspace-files button:hover { color: var(--text); border-color: var(--brand); }
@media (max-width: 720px) {
  .coding-diff-workspace { padding: 0; }
  .coding-diff-shell { width: 100%; height: 100%; border-radius: 0; }
  .coding-diff-layout { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 28vh) minmax(0, 1fr); }
  .coding-diff-files { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.07); }
  .coding-diff-root { display: none; }
}
.source-panel-repo-card,
.source-panel-info-card,
.source-panel-environment-card {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  background: #171b21;
}
.source-panel-repo-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.source-panel-repo-card .source-item-icon { width: 34px; height: 34px; flex-basis: 34px; }
.source-panel-repo-copy { min-width: 0; flex: 1; }
.source-panel-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #5ed491;
  background: rgba(65,190,119,.12);
  font-size: 9px;
  font-weight: 700;
}
.source-panel-status--local { color: #b8bdc7; background: rgba(255,255,255,.08); }
.source-panel-env-row,
.source-panel-info-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 31px;
  color: #d0d3d8;
  font-size: 11px;
}
.source-panel-env-row svg,
.source-panel-info-row svg { flex: 0 0 auto; color: #959ca7; }
.source-panel-env-row .env-value,
.source-panel-info-row .info-value {
  margin-left: auto;
  color: #9299a4;
  font: 10px/1.2 'JetBrains Mono', monospace;
  text-align: right;
}
.source-panel-env-row .env-value.is-positive { color: #62d895; }
.source-panel-env-row .env-value.is-negative { color: #ed7777; }
.source-panel-info-row { cursor: default; }
.source-panel-info-row.is-link { cursor: pointer; }
.source-panel-info-row.is-link:hover { color: #f0efff; }
.source-panel-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.source-panel-section-heading .source-panel-section-title { margin-bottom: 9px; }
.source-panel-section-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: -3px 0 5px;
  padding: 0;
  border: 0;
  color: #8e949f;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.source-panel-section-add:hover { color: #d0baff; }
.source-panel-environment-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 31px;
  padding: 0;
  border: 0;
  color: #d0d3d8;
  background: transparent;
  font: 11px/1.2 var(--t-font-ui);
  text-align: left;
}
.source-panel-environment-row.is-link { cursor: pointer; }
.source-panel-environment-row.is-link:hover { color: #f0efff; }
.source-panel-environment-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex: 0 0 16px;
  color: #a5aab4;
  font-size: 14px;
}
.source-panel-environment-label { min-width: 0; }
.source-panel-environment-value {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: #9299a4;
  font: 10px/1.2 'JetBrains Mono', monospace;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-panel-environment-value.is-negative { color: #dba5a5; }
.source-panel-environment-value.is-positive { color: #62d895; }
.source-panel-environment-value.is-muted { color: #7e8590; }
.source-panel-environment-chevron {
  margin-left: auto;
  color: #9da2ac;
  font-size: 15px;
}
.source-panel-process-list { gap: 5px; }
.source-panel-row--process .source-item-icon { color: #c5c9d2; background: #30343d; font-size: 10px; }
.source-panel-row--process .source-item-title { font-family: var(--t-font-mono); font-size: 10px; font-weight: 500; }
.source-panel-row--process .source-item-meta { text-transform: capitalize; }
.source-panel-computer-row,
.source-panel-browser-row { min-height: 32px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.source-panel-computer-row:hover,
.source-panel-browser-row:hover { transform: none; border-color: transparent; background: transparent; color: #f0efff; }
.source-panel-computer-glyph,
.source-panel-browser-glyph { display: inline-flex; width: 18px; flex: 0 0 18px; align-items: center; justify-content: center; color: #aab0bb; }
.source-panel-browser-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 14%, transparent); }
.source-panel-browser-row.is-active .source-panel-browser-glyph { color: #22c55e; }
.source-panel-browser-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-panel-browser-row .info-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-panel-section--mini { margin-top: 16px; }
.source-panel-section--mini:first-child { margin-top: 0; }
.source-panel-section--mini .source-panel-section-title { margin-bottom: 7px; }
.source-panel-section--mini .source-panel-environment-card,
.source-panel-section--mini .source-panel-info-card { margin-bottom: 0; padding: 8px 10px; border-radius: 11px; }
.source-panel-environment-row--mini { min-height: 27px; }
.source-panel-environment-row--mini .source-panel-environment-label { font-size: 11px; }
.source-panel-row--mini { min-height: 42px; padding: 6px 8px; border-radius: 9px; }
.source-panel-row--mini .source-item-icon { width: 25px; height: 25px; flex-basis: 25px; }
.source-panel-row--mini .source-item-meta { margin-top: 2px; }
.source-panel-computer-row--mini,
.source-panel-browser-row--mini { min-height: 30px; }
.source-panel-sources-section .source-mini-list { padding: 0; }
.sources-minimized-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 90;
  width: min(324px, calc(100vw - 28px));
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0;
  transform: translateX(calc(100% + 28px));
  transition: opacity .18s ease, transform .22s cubic-bezier(.22,.75,.25,1);
}
.sources-minimized-panel[hidden] { display: block; }
.sources-minimized-panel.is-visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateX(0);
}
.sources-minimized-panel.is-closing {
  opacity: 0;
  transform: translateX(calc(100% + 28px));
}
.sources-minimized-card {
  max-height: calc(100vh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.095);
  border-radius: 16px;
  color: #e9e9e7;
  background: #111419;
  box-shadow: 0 18px 55px rgba(0,0,0,.4), 0 0 0 1px rgba(169,112,255,.03);
}
.sources-minimized-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 11px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111419;
}
.sources-minimized-header strong { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.sources-minimized-header-actions { display: flex; align-items: center; gap: 6px; }
.sources-minimized-header .source-panel-icon-btn,
.sources-minimized-header .source-panel-close-btn { width: 32px; height: 32px; }
.sources-minimized-header .source-panel-close-btn { margin-left: 0; }
.sources-minimized-body { padding: 0 14px 4px; }
.sources-minimized-body > .source-panel-section { border-top: 1px solid rgba(255,255,255,.075); padding-top: 13px; }
.sources-minimized-body > .source-panel-section:first-child { border-top: 0; }
.sources-minimized-body .source-panel-empty { padding: 8px 2px; }
.sources-minimized-card::-webkit-scrollbar { width: 6px; }
.sources-minimized-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,.13); border-radius: 999px; }
.source-panel-add-btn { color: #aeb3bd; font-size: 18px; }
.source-panel-add-btn:hover { color: #d0baff; }
.source-mini-list { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.sources-minimized-footer {
  display: block;
  width: 100%;
  padding: 2px 16px 16px;
  border: 0;
  color: #aeb3bd;
  background: transparent;
  font: 600 12px/1.4 var(--t-font-ui);
  text-align: left;
  cursor: pointer;
}
.sources-minimized-footer:hover { color: #d0baff; }

/* Minimized Sources: compact density (fix/sources-mini-compact) */
.sources-minimized-panel{top:12px;right:12px;width:min(272px,calc(100vw - 24px))}
.sources-minimized-card{max-height:min(620px,calc(100vh - 24px));border-radius:14px}
.sources-minimized-header{padding:11px 12px 8px}
.sources-minimized-header strong{font-size:14px;font-weight:600;letter-spacing:-.01em}
.sources-minimized-header .source-panel-icon-btn,.sources-minimized-header .source-panel-close-btn{width:26px;height:26px}
.sources-minimized-body{padding:0 10px 4px}
.sources-minimized-body>.source-panel-section{padding-top:10px}
.source-panel-section--mini{margin-top:10px}
.source-panel-section--mini .source-panel-section-title{margin-bottom:6px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--muted,#8b919b)}
.source-panel-section--mini .source-panel-section-add{width:18px;height:18px;font-size:15px}
.source-panel-section--mini .source-panel-environment-card{padding:6px 9px;border-radius:10px}
.source-panel-environment-row--mini{min-height:24px}
.source-panel-mini-more{display:inline-block;margin-top:4px;padding:2px 0;border:0;background:transparent;color:var(--muted,#8b919b);font:600 10.5px/1.3 var(--t-font-ui);cursor:pointer}
.source-panel-mini-more:hover{color:#d0baff}
.source-panel-row--mini{min-height:34px;padding:5px 8px;border-radius:8px;gap:8px}
.source-panel-row--mini .source-item-icon{width:20px;height:20px;flex-basis:20px;border-radius:6px;font-size:11px}
.source-panel-row--mini .source-item-title{font-size:11.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.source-panel-row--mini .source-item-meta{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.source-panel-row--mini .source-item-chevron{display:none}
.source-panel-row--process.source-panel-row--mini{min-height:30px;padding:4px 8px}
.source-panel-row--process.source-panel-row--mini .source-item-icon{font-size:9px}
.source-item-copy--inline{display:flex;align-items:baseline;gap:5px;min-width:0}
.source-item-copy--inline .source-item-meta{margin-top:0;flex:0 0 auto}
.source-panel-browser-row--mini{min-height:26px}
.source-mini-list{gap:5px}
.sources-minimized-footer{padding:4px 12px 10px;font-size:11px}
@media (max-width: 760px) {
  .sources-minimized-panel { top: 10px; right: 10px; width: min(272px, calc(100vw - 20px)); }
  .source-panel-body { padding-right: 13px; padding-left: 13px; }
}

/* Highlighted chat text actions. The popover is intentionally compact enough
   to work as both a right-click context surface and a text-selection toolbar. */
.chat-text-selection-popover {
  position: fixed;
  z-index: 2400;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: min(92vw, 520px);
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--line-strong, var(--line)) 88%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel, #17191d) 96%, #000 4%);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.04);
  color: var(--text, #f4f4f5);
  white-space: nowrap;
}
.chat-text-selection-popover[hidden] { display: none !important; }
.chat-text-selection-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #a1a1aa);
  font: 700 11px/1 var(--t-font-ui);
  cursor: pointer;
}
.chat-text-selection-action:hover,
.chat-text-selection-action:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--brand, #38bdf8) 15%, transparent);
  color: var(--text, #fff);
}
.chat-text-selection-copy { color: var(--brand, #7dd3fc); }
.chat-text-selection-divider {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: var(--line, rgba(255,255,255,0.12));
}
.chat-annotation-pill .pill-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}
.chat-annotation-pill .pill-ext {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-canvas-annotations {
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}
.browser-canvas-annotation-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 8px;
  background: rgba(15,23,42,0.36);
}
.browser-canvas-annotation-index {
  grid-column: 1 / -1;
  color: #7dd3fc;
  font: 800 9px/1.2 var(--t-font-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.browser-canvas-annotation-row strong,
.browser-canvas-annotation-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-word;
}
.browser-canvas-annotation-row strong {
  color: #f8fafc;
  font: 700 11px/1.35 var(--t-font-ui);
}
.browser-canvas-annotation-row small {
  color: #93c5fd;
  font: 10px/1.35 'IBM Plex Mono', monospace;
}
.chat-history-pager {
  display: flex;
  justify-content: center;
  padding: 10px 12px 18px;
}

.chat-history-pager .btn {
  min-height: 34px;
}
.tool-activity-readable-detail {
  max-height: 360px;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 10px 12px;
}
.tool-activity-detail-fields {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.tool-activity-detail-fields > div {
  display: grid;
  grid-template-columns: minmax(60px, 90px) minmax(0, 1fr);
  gap: 12px;
  line-height: 1.5;
}
.tool-activity-detail-fields strong { font-size: .85em; opacity: .65; }
.tool-activity-readable-detail .markdown-body > :first-child { margin-top: 0; }
.tool-activity-readable-detail .markdown-body > :last-child { margin-bottom: 0; }

/* Stop soft-lock right after sending: dim and ignore taps briefly. */
#send-btn.pm-stop-soft-locked { opacity: 0.45; cursor: wait; transition: opacity 0.2s ease; }


/* Banked usage reset row (context-window popover, desktop + mobile) */
.pm-banked-reset { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.pm-banked-reset-row { display: flex; align-items: center; gap: 10px; }
.pm-banked-reset-row + .pm-banked-reset-row { margin-top: 6px; }
.pm-banked-reset-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pm-banked-reset-title { font-size: 12px; font-weight: 600; color: var(--text, #f4f4f5); }
.pm-banked-reset-sub { font-size: 11px; opacity: 0.6; }
.pm-banked-reset-btn { flex: none; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: inherit; cursor: pointer; }
.pm-banked-reset-btn:hover { background: rgba(255,255,255,0.14); }
.pm-banked-reset-confirm-backdrop { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pm-banked-reset-confirm { width: min(360px, 100%); padding: 18px; border-radius: 18px; background: rgba(28,28,32,0.92); border: 1px solid rgba(255,255,255,0.12); box-shadow: 0 20px 60px rgba(0,0,0,0.5); color: #f4f4f5; -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); }
.pm-brc-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.pm-brc-body { font-size: 13px; line-height: 1.45; opacity: 0.85; }
.pm-brc-status { font-size: 12px; min-height: 16px; margin-top: 10px; opacity: 0.9; }
.pm-brc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pm-brc-actions button { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.16); background: rgba(255,255,255,0.06); color: inherit; cursor: pointer; }
.pm-brc-actions .pm-brc-confirm { background: #f4f4f5; color: #111; border-color: transparent; }
.pm-brc-actions button:disabled { opacity: 0.45; cursor: default; }
/* Workspace media embedded in assistant markdown (utils.js resolveWorkspaceImageSources).
   Kept in sync with the matching block in components.css (desktop). */
.prom-inline-figure {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
  margin: 8px 0 4px;
  vertical-align: top;
}
.prom-inline-figure .prom-inline-media {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: min(460px, 56vh);
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--prom-border, rgba(127,127,127,.22));
  background: var(--prom-surface-secondary, rgba(127,127,127,.08));
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.prom-inline-figure.is-video .prom-inline-media { cursor: auto; width: 100%; }
.prom-inline-video-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.prom-inline-video-row .prom-inline-caption { flex: 1; min-width: 0; }
.prom-inline-save { flex: none; margin-top: 4px; padding: 4px; border: 0; background: none; color: var(--prom-muted, rgba(127,127,127,.9)); cursor: pointer; line-height: 0; }
.prom-inline-save:hover { color: var(--prom-text, inherit); }
.prom-inline-save.is-busy { opacity: .45; }
.prom-inline-save.is-done { color: var(--prom-success, #22c55e); }
.prom-inline-save.is-error { color: var(--prom-danger, #ef4444); }
.prom-inline-figure.is-video{position:relative}
.prom-inline-figure.is-video.is-failed::after {
  content: 'Video didn\2019t load. Click to retry';
  position:absolute;left:0;right:0;top:0;height:min(200px,40vh);
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: rgba(0,0,0,.55); color: #fff;
  font-size:14px;font-weight:600;cursor:pointer;
}

.prom-inline-caption {
  margin-top: 6px;
  font-size: .82em;
  line-height: 1.35;
  color: var(--prom-muted, rgba(127,127,127,.9));
}
/* Several images in one paragraph -> 2-column gallery. */
p:has(> .prom-inline-figure + .prom-inline-figure),
p:has(> .prom-inline-figure + br + .prom-inline-figure) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
p:has(> .prom-inline-figure + .prom-inline-figure) > br,
p:has(> .prom-inline-figure + br + .prom-inline-figure) > br { display: none; }
p:has(> .prom-inline-figure + .prom-inline-figure) .prom-inline-figure,
p:has(> .prom-inline-figure + br + .prom-inline-figure) .prom-inline-figure { margin: 0; }
p:has(> .prom-inline-figure + .prom-inline-figure) .prom-inline-media,
p:has(> .prom-inline-figure + br + .prom-inline-figure) .prom-inline-media {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  max-height: none;
}
.prom-inline-lightbox {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.86); padding: 24px; cursor: zoom-out;
}
.prom-inline-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; cursor: auto; }
.prom-inline-lightbox-close {
  position: absolute; top: 14px; right: 18px; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff;
  font-size: 26px; line-height: 40px; cursor: pointer;
}


/* ══ Creative editor: icon controls + Studio (generation) panel ═══════════════
   Icon-first controls with tooltips; neutral graphite surfaces, one warm
   accent. Appended last so these override the earlier text-button styles. */
.ce-layout { --ce-accent: var(--theme-palette-gold); --ce-ink: #ecebe8; --ce-dim: rgba(236,235,232,0.56); --ce-faint: rgba(236,235,232,0.32);
  --ce-line: rgba(255,255,255,0.08); --ce-fill: rgba(255,255,255,0.045); --ce-fill-hi: rgba(255,255,255,0.1); }
.ce-icon { display: block; flex: 0 0 auto; }
.ce-icon-btn, .ce-hdr-btn, .ce-viewport-btn, .ce-timeline-tool-btn, .ce-tl-lane-btn, .ce-graph-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 7px;
  border: 1px solid transparent; background: transparent; color: var(--ce-dim, rgba(255,255,255,0.6));
  cursor: pointer; transition: background .12s, color .12s, border-color .12s; line-height: 1; font-size: 0;
}
.ce-icon-btn:hover, .ce-hdr-btn:hover, .ce-viewport-btn:hover, .ce-timeline-tool-btn:hover, .ce-tl-lane-btn:hover, .ce-graph-btn:hover {
  background: var(--ce-fill-hi, rgba(255,255,255,0.1)); color: var(--ce-ink, #fff);
}
.ce-icon-btn:focus-visible, .ce-hdr-btn:focus-visible, .ce-timeline-tool-btn:focus-visible, .ce-tab:focus-visible {
  outline: 2px solid rgba(214,183,94,0.55); outline-offset: 1px;
}
.ce-icon-btn.is-active, .ce-timeline-tool-btn.is-active, .ce-tl-lane-btn.is-active {
  color: var(--ce-accent, var(--theme-palette-gold)); background: rgba(214,183,94,0.12); border-color: rgba(214,183,94,0.28);
}
.ce-icon-btn:disabled, .ce-timeline-tool-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.ce-icon-btn.is-danger:hover, .ce-timeline-tool-btn--danger:hover { color: #fca5a5; background: rgba(244,63,94,0.12); }
.ce-timeline-tool-btn--danger { color: var(--ce-dim, rgba(255,255,255,0.6)); border-color: transparent; background: transparent; }
.ce-tl-lane-btn { width: 20px; height: 20px; border-radius: 5px; }
.ce-timeline-toolbar__controls { display: inline-flex; align-items: center; gap: 2px; }
.ce-timeline-toolbar__sep, .ce-studio-toolbar__sep { width: 1px; height: 16px; background: var(--ce-line, rgba(255,255,255,0.08)); margin: 0 4px; }
.ce-viewport-controls { gap: 2px; }
.ce-ctrl-btn { color: var(--ce-ink, #ecebe8); }
.ce-ctrl-btn .ce-icon { width: 14px; height: 14px; }
.ce-export-trigger-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--ce-accent, var(--theme-palette-gold)); }
.ce-editor-title { color: var(--ce-dim); text-transform: none; letter-spacing: .01em; font-size: 12px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Icon tabs: icon only, label as tooltip; active gets the accent underline. */
.ce-tab.ce-tab--icon { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 9px; color: var(--ce-faint); }
.ce-tab.ce-tab--icon .ce-tab__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ce-tab.ce-tab--icon:hover { color: var(--ce-ink); }
.ce-tab.ce-tab--icon.ce-tab--active { color: var(--ce-ink); border-bottom-color: var(--ce-accent); }
.ce-tab[data-ce-tab="studio"].ce-tab--active { color: var(--ce-accent); }

/* ── Studio panel ─────────────────────────────────────────────────────────── */
.ce-studio { display: flex; flex-direction: column; gap: 10px; padding: 10px; color: var(--ce-ink); font-size: 12px; }
.ce-studio-bar, .ce-studio-toolbar, .ce-studio-inline, .ce-studio-genrow { display: flex; align-items: center; gap: 4px; }
.ce-studio-toolbar { padding: 2px 0 6px; border-bottom: 1px solid var(--ce-line); flex-wrap: wrap; }
.ce-studio-toolbar__spacer { flex: 1; }
.ce-studio-select, .ce-studio-textarea, .ce-studio-field input, .ce-studio-field textarea, .ce-studio-field select, .ce-studio-key input {
  width: 100%; min-width: 0; background: rgba(0,0,0,0.28); color: var(--ce-ink); border: 1px solid var(--ce-line);
  border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 12px; outline: none;
}
.ce-studio-select { flex: 1; height: 28px; padding: 0 8px; }
.ce-studio-select.is-compact { flex: 0 0 auto; width: auto; height: 24px; }
.ce-studio-textarea, .ce-studio-field textarea { resize: vertical; line-height: 1.45; }
.ce-studio-select:focus, .ce-studio-textarea:focus, .ce-studio-field :is(input,textarea,select):focus, .ce-studio-key input:focus { border-color: rgba(214,183,94,0.5); }
.ce-studio-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ce-studio-chip { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 999px; color: var(--ce-faint); border: 1px solid var(--ce-line); }
.ce-studio-chip.is-ok { color: #86efac; border-color: rgba(134,239,172,0.28); background: rgba(34,197,94,0.07); }
.ce-studio-card { border: 1px solid var(--ce-line); border-radius: 9px; padding: 9px; background: var(--ce-fill); display: flex; flex-direction: column; gap: 8px; }
.ce-studio-key { display: flex; flex-direction: column; gap: 4px; color: var(--ce-dim); font-size: 11px; }
.ce-studio-key em { color: #86efac; font-style: normal; margin-left: 4px; }
.ce-studio-key__row { display: flex; gap: 4px; }
.ce-studio-hint { margin: 0; color: var(--ce-faint); font-size: 11px; line-height: 1.4; }
.ce-studio-error, .ce-studio-busy { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; font-size: 11px; }
.ce-studio-error { color: #fecaca; background: rgba(244,63,94,0.1); border: 1px solid rgba(244,63,94,0.25); }
.ce-studio-error span { flex: 1; }
.ce-studio-busy { color: var(--ce-dim); background: var(--ce-fill); }
.ce-studio-spinner { width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.18); border-top-color: var(--ce-accent); animation: ce-studio-spin .8s linear infinite; flex: 0 0 auto; }
@keyframes ce-studio-spin { to { transform: rotate(360deg); } }
.ce-studio-section { display: flex; flex-direction: column; gap: 7px; }
.ce-studio-section > header { display: flex; align-items: center; justify-content: space-between; color: var(--ce-dim); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.ce-studio-section > header > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.ce-studio-section > header em { font-style: normal; color: var(--ce-faint); font-weight: 500; }
.ce-studio-budget { display: inline-flex; align-items: center; gap: 6px; color: var(--ce-dim); font-size: 11px; }
.ce-studio-budget strong { color: var(--ce-ink); font-weight: 600; }
.ce-studio-budget__bar { width: 48px; height: 4px; border-radius: 2px; background: var(--ce-fill-hi); overflow: hidden; }
.ce-studio-budget__bar i { display: block; height: 100%; background: var(--ce-accent); }
.ce-studio-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 12px; color: var(--ce-dim); }
.ce-studio-empty h4 { margin: 4px 0 0; font-size: 13px; color: var(--ce-ink); font-weight: 600; }
.ce-studio-empty p { margin: 0; font-size: 11.5px; line-height: 1.5; max-width: 240px; }
.ce-studio-empty.is-compact { padding: 22px 12px; }
.ce-studio-primary { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 7px; border: none;
  background: var(--ce-accent); color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ce-studio-primary:hover { filter: brightness(1.08); }
.ce-studio-chars { display: flex; flex-direction: column; gap: 4px; }
.ce-studio-char { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; }
.ce-studio-char:hover { background: var(--ce-fill); }
.ce-studio-char__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-studio-char__actions { display: inline-flex; opacity: .75; }
.ce-studio-char:hover .ce-studio-char__actions { opacity: 1; }
.ce-studio-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--ce-fill-hi); display: grid; place-items: center; color: var(--ce-faint); flex: 0 0 auto; }
.ce-studio-shots { display: flex; flex-direction: column; gap: 6px; }
.ce-studio-shot { display: grid; grid-template-columns: 88px 1fr auto; gap: 8px; padding: 6px; border-radius: 9px; border: 1px solid var(--ce-line); background: var(--ce-fill); cursor: pointer; outline: none; }
.ce-studio-shot:hover { border-color: rgba(255,255,255,0.16); }
.ce-studio-shot.is-selected { border-color: rgba(214,183,94,0.55); background: rgba(214,183,94,0.06); }
.ce-studio-shot__media { position: relative; width: 88px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.ce-studio-thumb { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; color: var(--ce-faint); }
.ce-studio-thumb.is-empty { background: var(--ce-fill-hi); }
.ce-studio-shot__n { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: rgba(0,0,0,0.6); color: #fff; }
.ce-studio-status { position: absolute; left: 4px; bottom: 4px; font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,0.65); color: var(--ce-dim); text-transform: capitalize; }
.ce-studio-status.is-ready { color: #86efac; }
.ce-studio-status.is-generating { color: #fdba74; }
.ce-studio-status.is-failed { color: #fca5a5; }
.ce-studio-shot__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ce-studio-shot__body strong { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-studio-shot__body p { margin: 0; color: var(--ce-dim); font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ce-studio-shot__meta { color: var(--ce-faint); font-size: 10px; margin-top: auto; }
.ce-studio-shot__actions { display: flex; flex-direction: column; gap: 0; }
.ce-studio-shot__actions .ce-icon-btn { width: 24px; height: 24px; }
.ce-studio-job { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ce-dim); padding: 3px 0; }
.ce-studio-job span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-studio-job.is-failed { color: #fca5a5; }
.ce-studio-render { width: 100%; border-radius: 8px; background: #000; }
.ce-studio-inspector { display: flex; flex-direction: column; gap: 10px; padding: 10px; color: var(--ce-ink, #ecebe8); font-size: 12px; }
.ce-studio-field { display: flex; flex-direction: column; gap: 4px; }
.ce-studio-field > span { color: var(--ce-dim, rgba(255,255,255,0.56)); font-size: 11px; font-weight: 600; }
.ce-studio-grid2 { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }
.ce-studio-checks { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.ce-studio-checks label, .ce-studio-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--ce-dim, rgba(255,255,255,0.6)); font-size: 11.5px; cursor: pointer; }
.ce-studio-checks input, .ce-studio-toggle input { accent-color: var(--theme-palette-gold); }
.ce-studio-takes { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ce-studio-take { border-radius: 9px; overflow: hidden; border: 1px solid var(--ce-line, rgba(255,255,255,0.08)); background: #000; }
.ce-studio-take.is-selected { border-color: rgba(214,183,94,0.6); }
.ce-studio-take video, .ce-studio-take img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.ce-studio-take__meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 4px 8px; background: #121218; color: var(--ce-dim, rgba(255,255,255,0.6)); font-size: 10.5px; }
.ce-studio-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: #fdba74; padding: 0 6px; }

/* Website sign-in handoff: neutral action family; existing browser and decision flow. */
.chat-question-card:has(.pq-login-handoff){border-radius:24px;padding:20px}
.chat-question-card .pq-login-handoff{flex-direction:column;align-items:stretch;gap:12px}
.chat-question-card .pq-login-origin{font-size:13px;color:var(--muted);overflow-wrap:anywhere}
.chat-question-card .pq-login-open{min-height:49px;border-radius:28px;background:var(--text-primary,#f4f4f4);color:var(--bg-secondary,#222);font-weight:600}
.chat-question-card .pq-login-note{line-height:1.6}
.chat-question-card:has(.pq-login-handoff) .pq-actions button{border-radius:28px;min-height:44px}

/* Reasoning summaries (OpenAI + Anthropic) show the full newest paragraph,
   wrapped, instead of a one-line ellipsis (Raul, 2026-11-11). */
.live-turn-tool-summary strong.t-think.is-reasoning,
.live-turn-thought-summary .t-think.is-reasoning,
.live-turn-tool-summary strong.t-think.is-reasoning .t-think-sizer,
.live-turn-thought-summary .t-think.is-reasoning .t-think-sizer,
.live-turn-tool-summary strong.t-think.is-reasoning .t-think-text,
.live-turn-thought-summary .t-think.is-reasoning .t-think-text {
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-overflow: clip;
}
.live-turn-tool-summary strong.t-think.is-reasoning,
.live-turn-thought-summary .t-think.is-reasoning {
  font-weight: 600;
  line-height: 1.4;
}
.live-turn-tool-summary:has(strong.t-think.is-reasoning) {
  align-items: flex-start;
}

/* Exposed reasoning blocks inside the expanded tool body stay muted grey (Raul, 2026-11-12). */
.live-turn-prose.is-reasoning-prose,
.live-turn-prose.is-reasoning-prose .live-turn-md,
.live-turn-prose.is-reasoning-prose .live-turn-md * {
  color: var(--prom-muted, var(--muted, #8a8f98)) !important;
}
.live-turn-prose.is-reasoning-prose { font-size: 0.92em; line-height: 1.45; border-color: transparent; }
