/**
 * Sovereign LLM Workbench (/) — enterprise UI layer
 * Loads after enterprise.css; validates dark + light contrast and brand alignment.
 */

body.legacy-workbench.wb-page {
  font-family: var(--font);
  background: var(--wb-bg);
  color: var(--text);
  color-scheme: dark light;
}

/* ── Brand tokens (navy + gold from product identity) ── */
body.legacy-workbench.wb-page {
  --wb-gold: #c9a227;
  --wb-gold-muted: rgba(201, 162, 39, 0.14);
  --wb-navy: #1a2744;
  --wb-bg: var(--bg);
  --wb-glow: rgba(201, 162, 39, 0.1);
  --wb-topbar-h: 72px;
}

html[data-theme="light"] body.legacy-workbench.wb-page {
  --wb-gold: #9a7b1a;
  --wb-gold-muted: rgba(154, 123, 26, 0.12);
  --wb-glow: rgba(37, 99, 235, 0.07);
}

body.legacy-workbench.page-shell {
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, var(--wb-glow), transparent 58%),
    radial-gradient(ellipse 50% 35% at 100% 0%, rgba(37, 99, 235, 0.06), transparent 50%),
    var(--wb-bg);
  min-height: 100vh;
}

html[data-theme="light"] body.legacy-workbench.page-shell {
  background: var(--wb-bg);
}

/* ── Top bar ── */
body.legacy-workbench .wb-topbar,
body.legacy-workbench .legacy-topbar {
  height: var(--wb-topbar-h);
  padding: 0 clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] body.legacy-workbench .legacy-topbar {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 1px 0 rgba(15, 20, 25, 0.04);
}

body.legacy-workbench .legacy-topbar-brand {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

body.legacy-workbench .legacy-topbar-brand.has-logo [data-brand="product"] {
  display: none;
}

body.legacy-workbench .legacy-topbar-brand.has-logo .legacy-brand-logo,
body.legacy-workbench .legacy-topbar-brand.has-logo .wb-topbar-logo {
  display: block !important;
  height: 56px;
  max-height: 56px;
  width: auto;
  max-width: min(420px, 48vw);
  object-fit: contain;
  object-position: left center;
}

body.legacy-workbench .legacy-topbar-nav a {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

body.legacy-workbench .legacy-topbar-nav a.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

html[data-theme="light"] body.legacy-workbench .legacy-topbar-nav a.primary {
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.2);
}

body.legacy-workbench .legacy-theme-toggle {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Layout ── */
body.legacy-workbench .wb-layout,
body.legacy-workbench .legacy-shell {
  max-width: 1200px;
  padding: clamp(20px, 3vw, 32px) clamp(16px, 3vw, 32px) 56px;
}

/* ── Hero ── */
body.legacy-workbench .wb-hero,
body.legacy-workbench .legacy-hero {
  position: relative;
  text-align: center;
  padding: clamp(32px, 5vw, 48px) clamp(24px, 4vw, 40px);
  margin-bottom: clamp(20px, 3vw, 28px);
  background: linear-gradient(165deg, var(--surface) 0%, var(--surface-elevated, var(--surface2)) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

body.legacy-workbench .wb-hero::before,
body.legacy-workbench .legacy-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 75% 55% at 50% 0%, var(--wb-glow), transparent 70%);
  pointer-events: none;
}

body.legacy-workbench .wb-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

body.legacy-workbench .wb-hero-logo {
  max-width: min(380px, 88vw);
  margin: 0 auto clamp(16px, 2.5vw, 24px);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

html[data-theme="light"] body.legacy-workbench .wb-hero-logo {
  filter: drop-shadow(0 6px 20px rgba(15, 20, 25, 0.08));
}

body.legacy-workbench .legacy-hero p,
body.legacy-workbench .wb-hero-tagline {
  margin: 0 auto;
  max-width: 560px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-secondary, var(--muted));
  font-weight: 400;
}

body.legacy-workbench .wb-capabilities,
body.legacy-workbench .legacy-hero-tags {
  justify-content: center;
  margin-top: 20px;
  gap: 10px;
}

body.legacy-workbench .legacy-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: var(--wb-gold-muted);
  border-color: color-mix(in srgb, var(--wb-gold) 35%, var(--border));
  color: var(--text-secondary, var(--muted));
}

html[data-theme="light"] body.legacy-workbench .legacy-tag {
  color: var(--text-secondary);
}

/* ── Insights (usage / spending / analytics) ── */
body.legacy-workbench .wb-insights {
  margin-bottom: clamp(20px, 3vw, 28px);
}

body.legacy-workbench .wb-insights-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

body.legacy-workbench .wb-insights-header h2 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

body.legacy-workbench .wb-insights-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  padding: clamp(16px, 2.5vw, 20px);
  box-shadow: var(--shadow-sm);
}

body.legacy-workbench .wb-account-bar {
  border-radius: var(--radius-lg);
  background: var(--surface2);
  border-color: var(--border-subtle, var(--border));
}

body.legacy-workbench .wb-plan-pill {
  background: var(--wb-gold-muted);
  border-color: color-mix(in srgb, var(--wb-gold) 45%, transparent);
  color: var(--wb-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.6875rem;
}

body.legacy-workbench .wb-subtabs {
  padding: 4px;
  background: var(--surface2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  gap: 4px;
}

body.legacy-workbench .wb-subtab {
  flex: 1;
  min-width: 100px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

body.legacy-workbench .wb-subtab:hover {
  color: var(--text);
  background: var(--surface-elevated, var(--surface));
}

body.legacy-workbench .wb-subtab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

html[data-theme="dark"] body.legacy-workbench .wb-subtab.active {
  background: var(--surface-elevated);
}

body.legacy-workbench .wb-panel {
  padding-top: 16px;
}

body.legacy-workbench .wb-gate-card {
  border-radius: var(--radius-xl, 16px);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: linear-gradient(135deg, var(--accent-muted) 0%, var(--surface) 55%);
  padding: clamp(20px, 3vw, 28px);
  text-align: center;
}

body.legacy-workbench .wb-gate-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

body.legacy-workbench .wb-gate-card .button {
  margin-top: 8px;
  min-width: 200px;
}

body.legacy-workbench .wb-free-review {
  border-radius: var(--radius-lg);
  background: var(--wb-gold-muted);
  border-color: color-mix(in srgb, var(--wb-gold) 40%, transparent);
  color: var(--text-secondary, var(--text));
}

html[data-theme="light"] body.legacy-workbench .wb-free-review {
  color: var(--text);
}

/* ── Main workspace card ── */
body.legacy-workbench .wb-main .container,
body.legacy-workbench .container {
  border-radius: var(--radius-xl, 16px);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

body.legacy-workbench .settings-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle, var(--border));
}

body.legacy-workbench .tabs {
  padding: 16px 20px 0;
  gap: 8px;
  background: var(--surface);
  border-bottom: none;
}

body.legacy-workbench .tab {
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  margin-bottom: 0;
  padding: 10px 18px;
}

body.legacy-workbench .tab:hover {
  background: var(--surface2);
  border-color: var(--border);
}

body.legacy-workbench .tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

body.legacy-workbench .content {
  background: var(--bg);
  padding: clamp(24px, 3vw, 32px);
}

body.legacy-workbench .input-group label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.legacy-workbench .input-group textarea,
body.legacy-workbench .input-group input,
body.legacy-workbench .input-group select {
  background: var(--surface);
  border-color: var(--border);
  font-size: 0.9375rem;
}

html[data-theme="light"] body.legacy-workbench .tab.active {
  background: var(--accent);
  color: #fff;
}

body.legacy-workbench .button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border-radius: var(--radius-lg);
  font-weight: 600;
  letter-spacing: 0.01em;
}

body.legacy-workbench .status {
  margin: 0 0 16px;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.8125rem;
}

body.legacy-workbench .status.healthy {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.35);
  color: #4ade80;
}

html[data-theme="light"] body.legacy-workbench .status.healthy {
  color: #15803d;
  background: rgba(22, 163, 74, 0.08);
}

body.legacy-workbench .status.degraded {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
  color: #fbbf24;
}

html[data-theme="light"] body.legacy-workbench .status.degraded {
  color: #b45309;
  background: rgba(217, 119, 6, 0.08);
}

body.legacy-workbench .wb-stat {
  border-radius: var(--radius-lg);
  background: var(--surface);
}

body.legacy-workbench .wb-stat .value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

body.legacy-workbench .wb-analytics-table th {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.legacy-workbench .wb-muted-hint {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
  margin: 0;
}

body.legacy-workbench .content .wb-muted-hint code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8125rem;
}

body.legacy-workbench .legacy-powered-by {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

/* Sub-tabs inside Assist */
body.legacy-workbench .sub-tab.active {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 768px) {
  body.legacy-workbench .legacy-topbar-nav {
    gap: 4px;
  }
  body.legacy-workbench .legacy-topbar-nav a:not(.primary) {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  body.legacy-workbench .wb-subtab {
    min-width: 0;
    font-size: 0.75rem;
    padding: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.legacy-workbench .button,
  body.legacy-workbench .tab {
    transition: none;
  }
}

/* ── Sidebar layout (prompt-focused) ── */
body.legacy-workbench.wb-sidebar-layout {
  --wb-sidebar-w: 280px;
}

body.legacy-workbench.wb-sidebar-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.legacy-workbench.wb-sidebar-layout .wb-app {
  display: grid;
  grid-template-columns: var(--wb-sidebar-w) 1fr;
  grid-template-rows: 1fr;
  flex: 1;
  min-height: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

body.legacy-workbench.wb-sidebar-layout .legacy-shell,
body.legacy-workbench.wb-sidebar-layout .wb-layout {
  display: contents;
}

body.legacy-workbench.wb-sidebar-layout .wb-sidebar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100vh - var(--wb-topbar-h, 64px));
  padding: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  z-index: 30;
  pointer-events: auto;
}

body.legacy-workbench .wb-sidebar-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 10px 10px 0;
}

body.legacy-workbench .wb-sidebar-toolbar-top {
  align-items: center;
  gap: 8px;
  padding: 12px 12px 6px;
}

body.legacy-workbench .wb-new-chat-top {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.08));
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

body.legacy-workbench .wb-new-chat-top:hover {
  border-color: rgba(96, 165, 250, 0.65);
  background: rgba(37, 99, 235, 0.22);
}

body.legacy-workbench .wb-new-chat-icon {
  font-size: 1.1rem;
  line-height: 1;
}

body.legacy-workbench .wb-recent-label {
  margin: 4px 0 0;
  padding-left: 10px;
}

body.legacy-workbench .wb-chat-context-hint {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 clamp(12px, 2vw, 20px);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: rgba(37, 99, 235, 0.08);
  font-size: 0.82rem;
  color: var(--muted);
}

body.legacy-workbench .wb-chat-context-hint.hidden {
  display: none !important;
}

body.legacy-workbench .wb-chat-context-new {
  border: none;
  background: transparent;
  color: #93c5fd;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

body.legacy-workbench .wb-history-item.active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(37, 99, 235, 0.12);
}

body.legacy-workbench .wb-file-export-card {
  margin: 12px 0;
  padding: 20px 22px;
  border-radius: 14px;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(145deg, rgba(26, 39, 68, 0.92), rgba(37, 99, 235, 0.12));
  color: var(--text);
  text-align: center;
}

body.legacy-workbench .wb-file-export-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(201, 162, 39, 0.2);
  color: #f5d77a;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

body.legacy-workbench .wb-file-export-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

body.legacy-workbench .wb-file-export-desc {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

body.legacy-workbench .wb-file-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
}

body.legacy-workbench .wb-click-here-download,
.maha-file-export .wb-click-here-download {
  color: var(--accent, #6c8cff);
  text-decoration: underline;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
  min-width: 0;
}

body.legacy-workbench .wb-file-export-demo-note,
.maha-file-export .wb-file-export-demo-note {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

body.legacy-workbench .wb-file-export-link-line,
.maha-file-export .wb-file-export-link-line {
  margin: 0;
}

body.legacy-workbench .wb-sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 1.125rem;
  line-height: 1;
}

body.legacy-workbench .wb-sidebar-collapse-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

body.legacy-workbench .wb-sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

body.legacy-workbench .wb-sidebar-footer {
  flex-shrink: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.legacy-workbench .wb-sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.legacy-workbench .wb-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.legacy-workbench .wb-profile-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.legacy-workbench .wb-profile-text strong {
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.legacy-workbench .wb-footer-btn {
  width: 100%;
  margin: 0;
}

body.legacy-workbench.wb-sidebar-collapsed {
  --wb-sidebar-w: 56px;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-sidebar-label-row,
body.legacy-workbench.wb-sidebar-collapsed .wb-pick-hint,
body.legacy-workbench.wb-sidebar-collapsed .wb-profile-text {
  display: none;
}

body.legacy-workbench.wb-sidebar-collapsed #wb-sidebar-signin {
  width: 36px;
  height: 36px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  line-height: 36px;
}

body.legacy-workbench.wb-sidebar-collapsed #wb-sidebar-signin::before {
  content: "?";
  font-size: 1rem;
  font-weight: 700;
}

body.legacy-workbench.wb-sidebar-collapsed #wb-sidebar-logout {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 0;
  line-height: 36px;
}

body.legacy-workbench.wb-sidebar-collapsed #wb-sidebar-logout::after {
  content: "⎋";
  font-size: 1.125rem;
  line-height: 36px;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-sidebar-footer {
  padding: 10px 8px;
  align-items: center;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-sidebar-profile {
  justify-content: center;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-tool-chip {
  justify-content: center;
  padding: 10px 8px;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-tool-chip-label {
  display: none;
}

body.legacy-workbench .wb-tool-chip-icon {
  display: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-muted);
  flex-shrink: 0;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-tool-chip-icon {
  display: inline-flex;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-tool-chip {
  gap: 0;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-collapse-icon {
  transform: rotate(180deg);
  display: inline-block;
}

body.legacy-workbench .wb-sidebar-expand-btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
}

body.legacy-workbench.wb-sidebar-layout .wb-canvas {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: calc(100vh - var(--wb-topbar-h, 64px));
  padding: 12px clamp(16px, 3vw, 24px) 16px;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  isolation: isolate;
}

body.legacy-workbench .wb-workspace-head {
  flex-shrink: 0;
  margin-bottom: 10px;
}

body.legacy-workbench .wb-workspace-title {
  margin: 0 0 4px;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

body.legacy-workbench .wb-workspace-subtitle {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary, var(--muted));
  max-width: 52rem;
}

body.legacy-workbench .wb-gate-banner {
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-muted);
}

body.legacy-workbench .wb-gate-banner .wb-gate-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-secondary, var(--text));
  flex: 1;
  min-width: 200px;
}

body.legacy-workbench .wb-gate-banner .wb-gate-btn {
  flex-shrink: 0;
  min-width: auto;
  padding: 9px 18px;
  font-size: 0.8125rem;
}

body.legacy-workbench .wb-workspace-card {
  flex: 1 1 420px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

body.legacy-workbench .legacy-topbar-brand.has-logo .wb-topbar-product-fallback,
body.legacy-workbench .legacy-topbar-brand.has-logo [data-brand="product"] {
  display: none;
}

body.legacy-workbench .wb-logo-transparent {
  background: transparent !important;
  object-fit: contain;
}

html[data-theme="dark"] body.legacy-workbench .wb-sidebar-logo.wb-logo-transparent {
  filter: none;
}

html[data-theme="light"] body.legacy-workbench .wb-sidebar-logo.wb-logo-transparent {
  filter: none;
}

body.legacy-workbench .wb-workspace-card .wb-prompt-toolbar {
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px) var(--radius-xl, 16px) 0 0;
  border-bottom: none;
  box-shadow: none;
}

body.legacy-workbench .wb-tool-picker-prompt .wb-tool-pick-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

body.legacy-workbench .wb-prompt-toolbar-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

body.legacy-workbench .wb-tool-select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

body.legacy-workbench .wb-tool-select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

body.legacy-workbench .wb-tool-select-group label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

body.legacy-workbench .wb-tool-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  appearance: auto;
}

body.legacy-workbench .wb-tool-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

body.legacy-workbench .wb-tool-select:disabled,
body.legacy-workbench .wb-tool-select option:disabled {
  opacity: 0.45;
}

body.legacy-workbench .wb-prompt-toolbar .wb-options-slot {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

body.legacy-workbench .wb-sidebar-tagline {
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.45;
  margin: 0;
}

body.legacy-workbench .wb-sidebar-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.legacy-workbench .wb-sidebar-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

body.legacy-workbench .wb-pick-count {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--wb-gold);
}

body.legacy-workbench .wb-pick-hint {
  margin: 4px 0 10px;
  font-size: 0.75rem;
}

body.legacy-workbench .wb-tool-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.legacy-workbench .wb-tool-chip {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-secondary, var(--text));
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

body.legacy-workbench .wb-tool-chip:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--wb-gold) 50%, var(--border));
}

body.legacy-workbench .wb-tool-chip.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  box-shadow: inset 3px 0 0 var(--accent);
}

body.legacy-workbench .wb-tool-chip.disabled,
body.legacy-workbench .wb-tool-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body.legacy-workbench .wb-options-slot {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body.legacy-workbench .wb-options-slot .wb-tool-options {
  display: block;
}

body.legacy-workbench .wb-options-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

body.legacy-workbench .wb-sidebar-drawer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

body.legacy-workbench .wb-sidebar-drawer summary,
body.legacy-workbench .wb-sidebar-drawer .wb-drawer-trigger {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  list-style: none;
  display: block;
  padding: 12px 4px;
  margin: 0;
  user-select: none;
  pointer-events: auto;
}

body.legacy-workbench .wb-sidebar-drawer summary:hover,
body.legacy-workbench .wb-sidebar-drawer .wb-drawer-trigger:hover {
  color: var(--text);
}

body.legacy-workbench .wb-sidebar-drawer summary::-webkit-details-marker {
  display: none;
}

body.legacy-workbench .wb-drawer-body {
  margin-top: 10px;
}

body.legacy-workbench .wb-settings-compact {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  background: transparent;
  border: none;
  gap: 8px;
}

body.legacy-workbench .wb-settings-compact label {
  font-size: 0.75rem;
}

body.legacy-workbench .wb-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

body.legacy-workbench .wb-sidebar-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
}

body.legacy-workbench .wb-sidebar-links a:hover {
  color: var(--accent);
}

body.legacy-workbench .wb-workspace-card .wb-prompt-stack {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: transparent;
  min-height: 320px;
  overflow: visible;
}

body.legacy-workbench .wb-prompt-stack .tab-content {
  display: none;
  flex: 1 1 300px;
  flex-direction: column;
  min-height: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xl, 16px) var(--radius-xl, 16px);
  padding: 0;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

body.legacy-workbench .wb-prompt-stack .tab-content.wb-visible {
  display: flex;
}

body.legacy-workbench .wb-prompt-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

body.legacy-workbench .wb-output-area {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 16px 20px 12px;
}

body.legacy-workbench .wb-output-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  padding: 24px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface2) 80%, transparent);
}

body.legacy-workbench .wb-output-placeholder-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

body.legacy-workbench .wb-output-placeholder p {
  margin: 0;
  font-size: 0.875rem;
  max-width: 28rem;
  line-height: 1.5;
}

body.legacy-workbench .wb-output-placeholder.hidden {
  display: none !important;
}

body.legacy-workbench .wb-output-area:has(.response.wb-output:not([style*="display: none"])) .wb-output-placeholder,
body.legacy-workbench .wb-output-area:has(.prompt-turn) .wb-output-placeholder {
  display: none;
}

body.legacy-workbench .prompt-turns {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.legacy-workbench .prompt-turn {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.legacy-workbench .prompt-turn-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

body.legacy-workbench .prompt-turn-ask {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

body.legacy-workbench .prompt-turn-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
}

body.legacy-workbench .prompt-turn-response .response.wb-output {
  margin-top: 0;
}

body.legacy-workbench .wb-output-area .response.wb-output {
  margin-top: 0;
  min-height: 80px;
}

body.legacy-workbench .wb-output-area .response.wb-output[style*="display: none"] {
  display: none !important;
}

body.legacy-workbench .wb-output-area .response:not([style*="display: none"]) {
  display: block !important;
}

body.legacy-workbench .wb-composer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  position: relative;
  z-index: 2;
}

body.legacy-workbench #assist .wb-prompt-block,
body.legacy-workbench #assist .assist-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.legacy-workbench #assist .assist-pane:not(.active) {
  display: none;
}

body.legacy-workbench .wb-prompt-panel .wb-tool-options {
  display: none;
}

body.legacy-workbench .wb-prompt-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

body.legacy-workbench .wb-prompt-input {
  width: 100%;
  min-height: 112px;
  max-height: 220px;
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.55;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  font-family: inherit;
}

body.legacy-workbench .wb-prompt-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

body.legacy-workbench .wb-send-btn {
  margin-top: 14px;
  min-width: 160px;
}

body.legacy-workbench .wb-status-compact {
  flex-shrink: 0;
  margin: 0 0 8px;
  max-width: 100%;
}

body.legacy-workbench .wb-gate-card {
  flex-shrink: 0;
  margin-bottom: 8px;
}

body.legacy-workbench .wb-knowledge-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
}

body.legacy-workbench .wb-topbar-product-fallback.hidden {
  display: none !important;
}

body.legacy-workbench .wb-assist-subtabs {
  margin-bottom: 12px;
}

body.legacy-workbench .wb-assist-opt {
  display: none;
}

@media (max-width: 900px) {
  body.legacy-workbench.wb-sidebar-layout .wb-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  body.legacy-workbench.wb-sidebar-layout .wb-sidebar {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  body.legacy-workbench .wb-tool-select-row {
    grid-template-columns: 1fr;
  }
}

/* ── Workbench polish (light + dark) ── */
body.legacy-workbench .wb-canvas {
  gap: 12px;
}

body.legacy-workbench .wb-prompt-stack.content,
body.legacy-workbench .wb-workspace-card .wb-prompt-stack {
  padding: 0;
  background: transparent;
}

body.legacy-workbench .wb-status-compact.status {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

html[data-theme="light"] body.legacy-workbench .status.healthy {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}

html[data-theme="light"] body.legacy-workbench .status.degraded {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #b45309;
}

html[data-theme="dark"] body.legacy-workbench .status.healthy {
  color: #6ee7b7;
}

html[data-theme="dark"] body.legacy-workbench .status.degraded {
  color: #fcd34d;
}

body.legacy-workbench .wb-onboarding-compact.onboarding {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  line-height: 1.5;
}

body.legacy-workbench .wb-onboarding-compact .wb-onboarding-title {
  font-weight: 700;
  color: var(--accent);
  margin-right: 6px;
}

body.legacy-workbench .wb-onboarding-compact a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

body.legacy-workbench .wb-onboarding-compact a:hover {
  text-decoration: underline;
}

html[data-theme="light"] body.legacy-workbench .wb-onboarding-compact.onboarding {
  background: #f0f5ff;
  border-color: #c7d7fe;
  color: var(--text-secondary);
}

body.legacy-workbench .wb-prompt-toolbar {
  box-shadow: none;
}

html[data-theme="light"] body.legacy-workbench .wb-workspace-card .wb-prompt-toolbar {
  background: #f4f6fa;
  border-color: var(--border-subtle);
}

body.legacy-workbench .wb-tool-picker-prompt .wb-tool-pick-header {
  margin-bottom: 12px;
}

body.legacy-workbench .wb-pick-count {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--wb-gold-muted);
  color: var(--wb-gold);
  border: 1px solid color-mix(in srgb, var(--wb-gold) 35%, transparent);
}

body.legacy-workbench .wb-prompt-toolbar .wb-options-slot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
  align-items: start;
}

body.legacy-workbench .wb-prompt-toolbar .wb-options-group {
  margin: 0;
}

body.legacy-workbench .wb-prompt-toolbar .wb-tool-options .input-group {
  margin-bottom: 12px;
}

body.legacy-workbench .wb-prompt-toolbar .checkbox-group {
  margin: 8px 0 0;
}

body.legacy-workbench .wb-prompt-stack .tab-content {
  box-shadow: var(--shadow-md);
}

html[data-theme="light"] body.legacy-workbench .wb-prompt-stack .tab-content {
  border-color: var(--border-subtle);
  box-shadow:
    0 1px 2px rgba(15, 20, 25, 0.04),
    0 8px 24px rgba(15, 20, 25, 0.06);
}

body.legacy-workbench .wb-output-area {
  padding: 20px 24px 16px;
  background: transparent;
}

body.legacy-workbench .wb-output-area .response.wb-output {
  margin-top: 0;
  min-height: 72px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle, var(--border));
  border-left: none;
  background: var(--surface2);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
  box-shadow: none;
}

html[data-theme="light"] body.legacy-workbench .wb-output-area .response.wb-output {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body.legacy-workbench .wb-output-area .response.wb-output.loading {
  color: var(--muted);
  font-style: normal;
  background: transparent;
  border: 1px dashed var(--border);
}

body.legacy-workbench .wb-output-area .response.wb-output.error {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.25);
}

html[data-theme="light"] body.legacy-workbench .wb-output-area .response.wb-output.error {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

body.legacy-workbench .wb-composer {
  padding: 18px 24px 22px;
  background: var(--surface2);
}

html[data-theme="light"] body.legacy-workbench .wb-composer {
  background: #f8fafc;
  border-top-color: #e8ecf3;
}

body.legacy-workbench .wb-prompt-label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  color: var(--muted);
}

body.legacy-workbench .wb-prompt-input {
  min-height: 88px;
  font-size: 0.9375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

html[data-theme="light"] body.legacy-workbench .wb-prompt-input {
  background: #ffffff;
  border-color: #d8dee9;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.04);
}

html[data-theme="light"] body.legacy-workbench .wb-prompt-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

body.legacy-workbench .wb-composer .wb-send-btn {
  align-self: flex-end;
  margin-top: 12px;
  min-width: 132px;
  padding: 11px 22px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.08);
}

html[data-theme="light"] body.legacy-workbench .wb-composer .wb-send-btn {
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

html[data-theme="light"] body.legacy-workbench .wb-composer .wb-send-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

html[data-theme="light"] body.legacy-workbench.wb-sidebar-layout .wb-sidebar {
  background: var(--surface);
  border-right-color: var(--border-subtle);
  box-shadow: 1px 0 0 rgba(15, 20, 25, 0.04);
}

html[data-theme="light"] body.legacy-workbench .wb-sidebar-footer {
  background: #f8fafc;
  border-top-color: var(--border-subtle);
}

html[data-theme="light"] body.legacy-workbench .wb-profile-avatar {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent);
}

html[data-theme="light"] body.legacy-workbench .wb-tool-select {
  background: #ffffff;
  border-color: #d8dee9;
}

html[data-theme="light"] body.legacy-workbench .legacy-topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: #e8ecf3;
}

html[data-theme="light"] body.legacy-workbench.page-shell {
  --wb-bg: var(--bg);
  background: var(--wb-bg);
}

html[data-theme="light"] body.legacy-workbench .wb-gate-card {
  background: linear-gradient(180deg, #f0f5ff 0%, #ffffff 100%);
  border-color: #c7d7fe;
}

html[data-theme="light"] body.legacy-workbench .legacy-topbar-nav a:not(.primary) {
  color: var(--text-secondary);
}

html[data-theme="light"] body.legacy-workbench .legacy-topbar-nav a:not(.primary):hover {
  background: #eef1f7;
  color: var(--text);
}

html[data-theme="light"] body.legacy-workbench .wb-prompt-toolbar .input-group select,
html[data-theme="light"] body.legacy-workbench .wb-prompt-toolbar .input-group input {
  background: #fff;
  border-color: #d8dee9;
}

/* ── Prompt-only canvas: response + prompt, tools in dropdowns only ── */
body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-canvas-meta {
  position: absolute;
  z-index: 12;
  margin: 0;
  max-width: calc(100% - 24px);
}

body.legacy-workbench.wb-canvas-prompt-only #status.wb-status-compact,
body.legacy-workbench.wb-canvas-prompt-only #wb-view-workspace > #status {
  display: none !important;
}

body.legacy-workbench.wb-canvas-prompt-only #wb-gate.wb-gate-banner {
  top: 10px;
  left: 12px;
  right: 12px;
  margin-bottom: 0;
  padding-right: clamp(120px, 18vw, 160px);
}

body.legacy-workbench.wb-canvas-prompt-only .wb-onboarding-compact {
  display: none !important;
}

body.legacy-workbench .wb-options-hidden {
  display: none !important;
  visibility: hidden;
  height: 0;
  overflow: hidden;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card .wb-prompt-stack {
  flex: 1 1 auto;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-prompt-stack .tab-content {
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-prompt-stack .tab-content.wb-visible {
  flex: 1;
  min-height: 0;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-prompt-block {
  height: 100%;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-output-area {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: none;
}

body.legacy-workbench.wb-canvas-prompt-only #knowledge.wb-visible {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-assist-subtabs {
  display: none !important;
}

body.legacy-workbench .wb-prompt-footer {
  flex: 0 0 auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: transparent;
}

/* Prompt-only: response top, prompt bottom */
body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-prompt-stack {
  order: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-prompt-footer {
  order: 2;
  flex: 0 0 auto;
  margin-top: auto;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card:not(.wb-has-response) .wb-prompt-stack {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card:not(.wb-has-response) .wb-prompt-footer {
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 0;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card.wb-has-response .wb-prompt-stack {
  display: flex !important;
  flex-direction: column;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card.wb-has-response .wb-prompt-stack .tab-content.wb-visible {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card.wb-has-response .wb-prompt-block {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card.wb-has-response .wb-output-area {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card.wb-has-response .wb-output-placeholder {
  display: none !important;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card:not(.wb-has-response) .wb-output-area .response,
body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card:not(.wb-has-response) .wb-output-area .wb-output {
  display: none !important;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card:not(.wb-has-response) #chat-output-placeholder {
  display: flex !important;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card.wb-has-response .wb-prompt-footer {
  flex: 0 0 auto;
  margin-top: 0;
}

body.legacy-workbench.wb-canvas-prompt-only #wb-options-slot {
  display: none !important;
}

body.legacy-workbench .wb-composer-route {
  padding: 10px 16px 0;
}

body.legacy-workbench .wb-auto-route-badge {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wb-gold);
  line-height: 1.35;
}

body.legacy-workbench .wb-auto-route-badge.wb-auto-route-badge-idle {
  color: var(--muted);
  font-weight: 500;
}

body.legacy-workbench .wb-auto-route-badge.hidden {
  display: none;
}

body.legacy-workbench .wb-tool-multiselect {
  position: relative;
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 320px;
}

body.legacy-workbench .wb-tool-multiselect-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-lg, 10px);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

body.legacy-workbench .wb-tool-multiselect-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

body.legacy-workbench .wb-tool-multiselect-caret {
  opacity: 0.65;
  font-size: 0.75rem;
}

body.legacy-workbench .wb-tool-multiselect-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius-lg, 10px);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

body.legacy-workbench .wb-tool-multiselect-menu.hidden {
  display: none !important;
}

body.legacy-workbench .wb-tool-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius, 8px);
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--text);
}

body.legacy-workbench .wb-tool-multiselect-option:hover:not(.disabled) {
  background: var(--surface2);
}

body.legacy-workbench .wb-tool-multiselect-option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body.legacy-workbench .wb-unified-composer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  margin: 0;
  border-radius: var(--radius-xl, 16px);
  border: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
}

body.legacy-workbench .wb-unified-composer-box {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 12px 12px;
}

body.legacy-workbench .wb-unified-composer-box .wb-prompt-input {
  width: 100%;
  height: 96px;
  min-height: 88px;
  max-height: 120px;
  resize: none;
  margin: 0;
  padding: 12px 56px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--surface);
  box-sizing: border-box;
  line-height: 1.45;
}

body.legacy-workbench .wb-unified-send-inline {
  position: absolute;
  right: 20px;
  bottom: 20px;
  margin: 0;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 2;
}

body.legacy-workbench .wb-unified-send-inline .wb-send-logo {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: contain;
  pointer-events: none;
}

body.legacy-workbench.wb-canvas-prompt-only .tab-content .wb-composer,
body.legacy-workbench.wb-canvas-prompt-only .assist-pane .wb-composer {
  display: none !important;
}

body.legacy-workbench .wb-composer.hidden {
  display: none !important;
}

body.legacy-workbench .wb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html[data-theme="light"] body.legacy-workbench .wb-unified-composer {
  background: #f8fafc;
  border-color: #e8ecf3;
}

html[data-theme="light"] body.legacy-workbench.wb-canvas-prompt-only .wb-workspace-card {
  border-color: #e4e9f2;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 12px 32px rgba(15, 20, 25, 0.07);
}

/* ── Sidebar nav → right panel (Account / Settings) ── */
body.legacy-workbench .wb-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 16px;
}

body.legacy-workbench .wb-sidebar-nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 12px 6px;
}

body.legacy-workbench .wb-sidebar-nav-rich {
  align-items: flex-start;
  flex-direction: row;
  padding: 10px 12px;
}

body.legacy-workbench .wb-sidebar-nav-rich .wb-sidebar-nav-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

body.legacy-workbench .wb-sidebar-nav-rich .wb-sidebar-nav-desc {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

body.legacy-workbench a.wb-sidebar-nav-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

body.legacy-workbench .wb-sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-secondary, var(--muted));
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

body.legacy-workbench .wb-sidebar-nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

body.legacy-workbench .wb-sidebar-nav-item.active {
  background: var(--accent-muted);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

body.legacy-workbench .wb-sidebar-nav-icon {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

body.legacy-workbench .wb-canvas-views {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
}

body.legacy-workbench .wb-main-view {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  flex-direction: column;
  overflow: hidden;
  display: none;
}

body.legacy-workbench .wb-main-view.active {
  display: flex !important;
}

body.legacy-workbench .wb-main-view.wb-main-view-hidden {
  display: none !important;
}

body.legacy-workbench #wb-view-workspace.active {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
}

body.legacy-workbench #wb-view-workspace .wb-workspace-card {
  flex: 1 1 auto;
  min-height: 0;
}

body.legacy-workbench.wb-canvas-prompt-only #wb-view-workspace.active {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.legacy-workbench #wb-view-workspace .wb-status-compact {
  flex-shrink: 0;
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  width: auto;
  max-width: 100%;
}

body.legacy-workbench .wb-page-panel {
  flex: 1 1 auto;
  min-height: 200px;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-md);
  margin: 0;
  width: 100%;
}

body.legacy-workbench #wb-view-workspace.active {
  border: none;
  box-shadow: none;
  background: transparent;
  overflow: visible;
}

body.legacy-workbench .wb-page-panel .wb-page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

body.legacy-workbench .wb-page-header {
  flex-shrink: 0;
  padding: clamp(18px, 3vw, 24px) clamp(20px, 3vw, 28px) 14px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
  background: color-mix(in srgb, var(--surface2) 60%, var(--surface));
}

body.legacy-workbench .wb-page-title {
  margin: 0 0 6px;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

body.legacy-workbench .wb-page-lead {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary, var(--muted));
  max-width: 42rem;
}

body.legacy-workbench .wb-page-body {
  padding: clamp(16px, 3vw, 24px) clamp(20px, 3vw, 28px) 32px;
}

body.legacy-workbench .wb-settings-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.legacy-workbench .wb-settings-card {
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle, var(--border));
  background: var(--surface2);
}

body.legacy-workbench .wb-settings-card-title {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
}

body.legacy-workbench .wb-settings-api-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

body.legacy-workbench .wb-settings-input {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
}

body.legacy-workbench .wb-settings-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

body.legacy-workbench .wb-settings-link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

body.legacy-workbench .wb-settings-link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

body.legacy-workbench .wb-settings-link-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
}

html[data-theme="light"] body.legacy-workbench .wb-page-panel {
  border-color: #e4e9f2;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 12px 28px rgba(15, 20, 25, 0.06);
}

body.legacy-workbench.wb-sidebar-collapsed .wb-sidebar-nav-label {
  display: none;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-sidebar-nav-item {
  justify-content: center;
  padding: 10px 8px;
}

body.legacy-workbench.wb-sidebar-collapsed .wb-sidebar-scroll {
  display: block;
  padding: 4px 6px;
}

/* Assist code / HTML results with copy toolbar */
body.legacy-workbench .assist-result-formatted {
  font-size: 0.92rem;
  line-height: 1.55;
}

body.legacy-workbench .assist-deliverable-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

body.legacy-workbench .assist-section {
  margin-bottom: 16px;
}

body.legacy-workbench .assist-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 8px;
}

body.legacy-workbench .assist-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

body.legacy-workbench .assist-toolbar .chat-code-copy {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
}

body.legacy-workbench .assist-toolbar .chat-code-copy:hover {
  border-color: var(--accent);
}

body.legacy-workbench .assist-explanation .chat-md {
  margin-bottom: 8px;
}

body.legacy-workbench .assist-preview iframe,
body.legacy-workbench .chat-html-preview iframe {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

/* Full-page dashboard (workbench) */
body.legacy-workbench .wb-dash-fullpage {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}

body.legacy-workbench .wb-dash-fullpage.active {
  height: 100%;
}

body.legacy-workbench .wb-dash-layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

body.legacy-workbench .wb-dash-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface2);
  min-height: 0;
}

body.legacy-workbench .wb-dash-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px;
  padding: 12px;
}

body.legacy-workbench .wb-dash-user-text strong {
  display: block;
  font-size: 0.95rem;
}

body.legacy-workbench .wb-dash-user-role {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

body.legacy-workbench .wb-dash-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 12px;
}

body.legacy-workbench .wb-dash-nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 6px;
}

body.legacy-workbench .wb-dash-nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin: 2px 0;
  border: none;
  border-radius: var(--radius, 8px);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

body.legacy-workbench .wb-dash-nav-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

body.legacy-workbench .wb-dash-nav-item.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

body.legacy-workbench .wb-dash-nav-label {
  font-size: 0.8125rem;
  font-weight: 600;
}

body.legacy-workbench .wb-dash-nav-desc {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

body.legacy-workbench .wb-dash-sidebar-foot {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.legacy-workbench .wb-dash-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.legacy-workbench .wb-dash-main-header {
  flex-shrink: 0;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
}

body.legacy-workbench .wb-dash-main-title {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
}

body.legacy-workbench .wb-dash-main-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

body.legacy-workbench .wb-dash-main-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

body.legacy-workbench .wb-dash-overview {
  padding: 16px 20px;
  overflow-y: auto;
  height: 100%;
}

body.legacy-workbench .wb-dash-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--surface);
}

body.legacy-workbench .wb-dash-frame.hidden,
body.legacy-workbench .wb-dash-overview.hidden {
  display: none !important;
}

body.legacy-workbench.wb-canvas-prompt-only .wb-canvas[data-active-view="dashboard"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.legacy-workbench.wb-canvas-prompt-only #wb-view-dashboard.active {
  flex: 1 1 auto;
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
}

/* Re-apply professional light theme after workbench-specific rules */
@import url('theme-light.css');
