.cc-ai-surface,
.cc-ai-surface * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.module-tabs-shell.is-ai-workbench-hidden {
  display: none !important;
}

.cc-ai-surface {
  min-width: 0;
  max-width: 100%;
  color: var(--cc-ink, #17211d);
  overflow-x: clip;
}

.ai-settings-stage.panel,
body.owner-shell-v1 .ai-settings-stage.panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ai-workbench-entry {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface-muted, #f8faf9);
  border: 1px solid var(--cc-line-strong, #bac6c0);
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-workbench,
.ai-settings {
  width: 100%;
  background: var(--cc-surface, #fff);
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 6px;
}

.ai-workbench__header,
.ai-settings__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__header h2,
.ai-settings__header h2,
.ai-workbench__pane-head h3,
.ai-settings__section-head h3,
.ai-settings__audit-group h4 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.ai-workbench__eyebrow,
.ai-settings__header > div > span {
  display: block;
  margin-bottom: 3px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
}

.ai-settings__header p {
  max-width: 560px;
  margin: 0;
  color: var(--cc-ink-soft, #52605a);
  font-size: 13px;
  line-height: 1.55;
}

.ai-workbench__status-rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-height: 28px;
}

.ai-workbench__status-rail > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 3px 7px;
  color: var(--cc-ink-soft, #52605a);
  background: var(--cc-surface-muted, #f8faf9);
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}

.ai-workbench__status-rail svg,
.ai-settings__segments svg,
.ai-settings__section-head svg,
.ai-command-button svg,
.ai-secondary-button svg,
.ai-icon-button svg,
.ai-workbench__source-link svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.ai-workbench__status-rail .ai-workbench__draft-only {
  color: var(--cc-accent-strong, #0f573f);
  background: var(--cc-accent-soft, #e5f1ec);
  border-color: var(--cc-accent, #176b50);
}

.ai-workbench__view-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 18px;
  background: var(--cc-surface-muted, #f8faf9);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 40px;
  padding: 7px 12px;
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface, #fff);
  border: 1px solid var(--cc-line-strong, #bac6c0);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-workbench__view-tabs button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.ai-workbench__view-tabs button[aria-selected="true"] {
  color: #fff;
  background: var(--cc-accent, #176b50);
  border-color: var(--cc-accent, #176b50);
  box-shadow: 0 4px 10px rgb(23 107 80 / 15%);
}

.ai-workbench[data-ai-active-view="qa"] [data-ai-workbench-section="write"]:not([data-ai-context-panel]),
.ai-workbench[data-ai-active-view="qa"] [data-ai-workbench-pane="write"]:not([data-ai-context-panel]),
.ai-workbench[data-ai-active-view="write"] [data-ai-workbench-section="qa"],
.ai-workbench[data-ai-active-view="write"] [data-ai-workbench-pane="qa"] {
  display: none !important;
}

.ai-workbench[data-ai-active-view="qa"] .module-canvas-widget:has([data-ai-workbench-pane="write"]),
.ai-workbench[data-ai-active-view="write"] .module-canvas-widget:has([data-ai-workbench-pane="qa"]) {
  display: none !important;
}

.ai-workbench__query {
  padding: 12px 18px;
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__archive-form {
  padding-block: 16px 18px;
}

.ai-workbench__archive-form textarea {
  min-height: 210px;
  max-height: 420px;
  line-height: 1.6;
}

.ai-workbench__query > label,
.ai-settings label > span:first-child,
.ai-workbench__unlock label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  font-weight: 700;
}

.ai-workbench__query > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}

.ai-workbench__archive-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}

.ai-workbench__archive-actions > button {
  flex: 1 1 180px;
}

.ai-workbench__input-hint {
  display: block;
  margin-top: 7px;
  color: var(--cc-muted, #6d665d);
  font-size: 12px;
  line-height: 1.5;
}

.ai-workbench textarea,
.ai-settings input,
.ai-settings select,
.ai-workbench__unlock input {
  width: 100%;
  min-width: 0;
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface, #fff);
  border: 1px solid var(--cc-line-strong, #bac6c0);
  border-radius: 3px;
  font: inherit;
}

.ai-workbench textarea {
  min-height: 58px;
  max-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 9px 10px;
  line-height: 1.45;
  resize: vertical;
}

.ai-settings input,
.ai-settings select,
.ai-workbench__unlock input {
  min-height: 36px;
  padding: 7px 9px;
}

.ai-workbench textarea:focus,
.ai-settings input:focus,
.ai-settings select:focus,
.ai-workbench__unlock input:focus {
  outline: 2px solid var(--cc-accent, #176b50);
  outline-offset: 1px;
}

.ai-command-button,
.ai-secondary-button,
.ai-text-button,
.ai-icon-button,
.ai-settings__segments button,
.ai-workbench__mobile-segments button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ai-command-button {
  color: #fff;
  background: var(--cc-accent, #176b50);
  border: 1px solid var(--cc-accent, #176b50);
}

.ai-secondary-button,
.ai-icon-button,
.ai-settings__segments button,
.ai-workbench__mobile-segments button {
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface, #fff);
  border: 1px solid var(--cc-line-strong, #bac6c0);
}

.ai-text-button {
  color: var(--cc-accent-strong, #0f573f);
  background: transparent;
  border: 0;
}

.ai-command-button:disabled,
.ai-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ai-icon-button {
  min-width: 36px;
  padding-inline: 8px;
}

.ai-workbench__columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  min-width: 0;
  min-height: 410px;
}

.ai-workbench__columns:not(.has-context) {
  display: block;
  min-height: 360px;
}

/* The shared canvas grid adds a second track globally. AI owns its own
 * Codex-style responsive boundary: one full-width conversation until a
 * source, finance result, or proposal is explicitly opened. */
.ai-workbench__columns.module-canvas-grid:not(.has-context) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
}

.ai-workbench__columns.module-canvas-grid.has-context {
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr) !important;
}

/* The shared canvas gives widgets 12-column geometry. In the normal Codex
 * state AI must opt out of those implicit tracks until a context pane opens. */
.ai-workbench__columns.ai-codex-full-bleed {
  display: block !important;
  grid-template-columns: none !important;
}

.ai-workbench__columns.ai-codex-full-bleed > .module-canvas-widget {
  display: block !important;
  grid-area: auto !important;
  min-width: 0;
}

/* The shared canvas wraps each AI pane in a generic `overflow:auto` panel.
 * Keep those wrappers from becoming a second vertical scroll host: the
 * conversation result and the active right-rail panel own scrolling below. */
.ai-workbench__columns.module-canvas-grid > .module-canvas-widget > [data-ai-pane] {
  overflow: hidden !important;
}

.ai-workbench__columns:not(.has-context) .ai-workbench__pane--answer {
  min-height: 360px;
}

.ai-workbench__context-pane[hidden] {
  display: none !important;
}

.ai-workbench__context-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  padding: 6px;
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
  scrollbar-width: thin;
}

.ai-workbench__context-tab-item {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  max-width: 240px;
  border: 1px solid transparent;
  border-radius: 4px;
}

.ai-workbench__context-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 220px;
  min-height: 32px;
  padding: 6px 10px;
  overflow: hidden;
  color: var(--cc-ink-soft, #52605a);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ai-workbench__context-tab span {
  opacity: .72;
  font-size: 11px;
}

.ai-workbench__context-tab.is-active {
  color: var(--cc-accent-strong, #0f573f);
  background: var(--cc-accent-soft, #e5f1ec);
  border-color: var(--cc-accent, #176b50);
}

.ai-workbench__context-tab-close {
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  margin-left: -7px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--cc-ink-soft, #52605a);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.ai-workbench__context-tab-close:hover,
.ai-workbench__context-tab-close:focus-visible {
  background: color-mix(in srgb, var(--cc-accent, #176b50) 16%, transparent);
  color: var(--cc-accent-strong, #0f573f);
}

.ai-workbench__document-preview {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
  background: #fff;
}

.ai-workbench__columns:not(.has-context) .ai-workbench__context-pane {
  display: none;
}

.ai-workbench__composer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding-block: 12px 14px;
  background: color-mix(in srgb, var(--cc-surface, #fff) 94%, transparent);
  box-shadow: 0 -8px 20px rgb(23 33 29 / 7%);
  backdrop-filter: blur(10px);
}

.ai-workbench__composer > div {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "query attachment submit";
  align-items: center;
}

.ai-workbench__composer > div > textarea {
  grid-area: query;
}

.ai-workbench__composer-editor {
  grid-area: query;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 88px;
  padding: 8px 10px 6px;
  border: 1px solid var(--cc-line-strong, #8fa59b);
  border-radius: 8px;
  background: var(--cc-surface, #fff);
  box-shadow: inset 0 1px 2px rgb(23 33 29 / 5%);
}

.ai-workbench__composer-editor:focus-within {
  border-color: var(--cc-accent, #176b50);
  outline: 2px solid color-mix(in srgb, var(--cc-accent, #176b50) 22%, transparent);
  outline-offset: 1px;
}

.ai-workbench__composer-editor > textarea {
  width: 100%;
  min-height: 48px;
  padding: 6px 0 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  resize: vertical;
}

.ai-workbench__composer-editor > textarea:focus {
  outline: 0;
}

.ai-workbench__attachment-dropzone {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 4px;
  border: 1px dashed var(--cc-line-strong, #8fa59b);
  border-radius: 6px;
  background: var(--cc-surface-muted, #f8faf9);
  color: var(--cc-ink-soft, #52605a);
  transition: border-color .16s ease, background-color .16s ease;
}

.ai-workbench__attachment-dropzone:focus-within,
.ai-workbench__attachment-dropzone:focus-visible,
.ai-workbench__attachment-dropzone.is-dragover {
  border-color: var(--cc-accent, #176b50);
  background: var(--cc-accent-soft, #e5f1ec);
  outline: 2px solid color-mix(in srgb, var(--cc-accent, #176b50) 24%, transparent);
  outline-offset: 1px;
}

.ai-workbench__attachment-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 112px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #176b50;
  border-radius: 5px;
  background: #176b50;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ai-workbench__attachment-button:hover,
.ai-workbench__attachment-button:focus-visible {
  background: #0f573f;
  border-color: #0f573f;
}

.ai-workbench__attachment-button svg {
  width: 16px;
  height: 16px;
}

.ai-workbench__attachment-hint {
  min-width: 0;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  white-space: nowrap;
}

.ai-workbench__composer > div > .ai-command-button {
  grid-area: submit;
  min-width: 88px;
}

.ai-workbench__attachment-dropzone {
  grid-area: attachment;
}

.ai-workbench__pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  order: -1;
  margin: 0 0 4px;
}

.ai-workbench__pending-attachment {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--cc-accent, #176b50);
  border-radius: 4px;
  background: var(--cc-accent-soft, #e5f1ec);
  color: var(--cc-accent-strong, #0f573f);
  font-size: 12px;
  font-weight: 650;
}

.ai-workbench__pending-attachment-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--cc-surface, #fff);
  border-radius: 50%;
  background: #17211d;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgb(23 33 29 / 25%);
}

.ai-workbench__pending-attachment-remove:hover,
.ai-workbench__pending-attachment-remove:focus-visible {
  background: #a33131;
}

.ai-workbench__pending-attachment-preview {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgb(23 107 80 / 28%);
  background: #fff;
}

.ai-workbench__pending-attachment-name {
  max-width: min(280px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-workbench__pending-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-workbench__message-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-workbench__source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 9px;
  color: var(--cc-accent-strong, #0f573f);
  background: var(--cc-accent-soft, #e5f1ec);
  border: 1px solid var(--cc-accent, #176b50);
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ai-workbench__source-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-workbench__source-preview {
  padding: 16px;
}

.ai-workbench__source-preview h4 {
  margin: 7px 0;
  font-size: 16px;
}

.ai-workbench__source-preview p {
  margin: 0 0 14px;
  color: var(--cc-ink-soft, #52605a);
  line-height: 1.6;
}

.ai-workbench__pane {
  min-width: 0;
  padding: 14px;
  border-left: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__pane:first-child {
  border-left: 0;
}

.ai-workbench__pane--write {
  grid-column: 1 / -1;
}

.ai-workbench__pane-head,
.ai-settings__section-head,
.ai-workbench__source-heading,
.ai-workbench__proposal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-workbench__pane-head {
  min-height: 28px;
  margin-bottom: 10px;
}

.ai-workbench__pane-head h3,
.ai-settings__section-head h3 {
  font-size: 14px;
}

.ai-workbench__pane-head > span,
.ai-settings__section-head > span,
.ai-workbench__proposal-meta > span {
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
}

.ai-workbench__result,
.ai-workbench__source-list,
.ai-workbench__proposal-list {
  min-width: 0;
  min-height: 320px;
}

/* Keep long conversations inside the workbench instead of pushing the
 * whole page below the fixed composer. The scrollbar is intentionally on the
 * primary answer surface so it remains discoverable on desktop and mobile. */
.ai-workbench__pane--answer .ai-workbench__result {
  height: clamp(320px, 58vh, 620px);
  max-height: 620px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.ai-workbench__pane--write .ai-workbench__proposal-list {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 2px 2px 14px;
  scroll-snap-type: x proximity;
  scrollbar-gutter: stable;
}

.ai-workbench__answer-copy {
  color: var(--cc-ink, #17211d);
  font-size: 14px;
  line-height: 1.72;
}

.ai-workbench__answer-copy p {
  margin: 0 0 12px;
}

.ai-workbench__state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 280px;
  padding: 20px;
  color: var(--cc-ink-soft, #52605a);
  text-align: center;
}

.ai-workbench__state svg {
  width: 24px;
  height: 24px;
  margin-bottom: 9px;
}

.ai-workbench__state strong {
  color: var(--cc-ink, #17211d);
}

.ai-workbench__state span {
  margin-top: 4px;
  font-size: 12px;
}

.ai-workbench__state--error {
  color: var(--cc-danger, #ae3e4b);
  background: var(--cc-danger-soft, #f9e9eb);
  border-radius: 3px;
}

.ai-workbench__source,
.ai-workbench__proposal {
  padding: 10px 0;
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__proposal-group {
  flex: 0 0 clamp(320px, 38vw, 480px);
  min-width: 300px;
  margin: 0 0 12px;
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 4px;
  overflow: hidden;
  scroll-snap-align: start;
}

.ai-workbench__pane--write .ai-workbench__proposal-group {
  margin: 0;
}

.ai-workbench__proposal-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface-muted, #f8faf9);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__proposal-group h4 {
  margin: 0;
  font-size: 12px;
}

.ai-workbench__proposal-group > header > span {
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
}

.ai-workbench__proposal-group-list {
  padding: 0 10px;
}

.ai-workbench__source:first-child,
.ai-workbench__proposal:first-child {
  padding-top: 0;
}

.ai-workbench__source-heading {
  justify-content: flex-start;
}

.ai-workbench__source-heading > span:last-child,
.ai-workbench__proposal-select > span {
  min-width: 0;
}

.ai-workbench__source-heading strong,
.ai-workbench__source-heading small,
.ai-workbench__proposal-select strong,
.ai-workbench__proposal-select small {
  display: block;
  overflow-wrap: anywhere;
}

.ai-workbench__source-heading small,
.ai-workbench__proposal-select small {
  margin-top: 2px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
  line-height: 1.4;
}

.ai-workbench__citation {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  color: var(--cc-accent-strong, #0f573f);
  background: var(--cc-accent-soft, #e5f1ec);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.ai-workbench__source p {
  margin: 7px 0;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ai-workbench__source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--cc-accent-strong, #0f573f);
  font-size: 12px;
  text-decoration: none;
}

.ai-workbench__source-link--disabled {
  color: var(--cc-ink-soft, #52605a);
}

.ai-workbench__proposal-select {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.ai-workbench__proposal-select input {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 2px;
  accent-color: var(--cc-accent, #176b50);
}

.ai-workbench__proposal-meta {
  margin-top: 7px;
}

.ai-workbench__proposal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: var(--cc-surface-muted, #f8faf9);
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 3px;
}

.ai-workbench__proposal-fields label {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.ai-workbench__proposal-fields label:has(textarea) {
  grid-column: 1 / -1;
}

.ai-workbench__proposal-fields label > span {
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
  font-weight: 700;
}

.ai-workbench__proposal-fields input {
  width: 100%;
  min-width: 0;
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface, #fff);
  border: 1px solid var(--cc-line-strong, #bac6c0);
  border-radius: 3px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.ai-workbench__proposal-fields input { min-height: 32px; padding: 6px 8px; }
.ai-workbench__proposal-fields textarea {
  width: 100%;
  min-width: 0;
  color: var(--cc-ink, #17211d);
  background: var(--cc-surface, #fff);
  border: 1px solid var(--cc-line-strong, #bac6c0);
  border-radius: 3px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  min-height: 68px;
  padding: 7px 8px;
  resize: vertical;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

@media (max-width: 640px) {
  .ai-workbench__proposal-fields { grid-template-columns: minmax(0, 1fr); }
  .ai-workbench__proposal-fields label:has(textarea) { grid-column: auto; }
}

.ai-workbench__proposal-actions {
  padding-top: 12px;
  border-top: 1px solid var(--cc-line, #d9e0dc);
}

[data-ai-proposals-form] {
  margin: 0;
}

.ai-workbench__empty {
  min-height: 72px;
  padding: 18px 8px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  text-align: center;
}

.ai-workbench__archive-coverage {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--cc-line, #d9e0dc);
  border-left: 3px solid var(--cc-accent, #176b50);
  border-radius: 5px;
  background: var(--cc-surface-muted, #f8faf9);
}

.ai-workbench__archive-coverage.is-incomplete {
  border-left-color: #b36b19;
  background: #fff8ed;
}

.ai-workbench__archive-coverage-head,
.ai-workbench__archive-coverage-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ai-workbench__archive-coverage-head span,
.ai-workbench__archive-coverage-stats,
.ai-workbench__archive-coverage summary {
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
}

.ai-workbench__archive-coverage-stats {
  justify-content: flex-start;
  gap: 14px;
  margin-top: 6px;
}

.ai-workbench__archive-coverage details {
  margin-top: 8px;
}

.ai-workbench__archive-coverage ul {
  display: grid;
  gap: 5px;
  margin: 6px 0 0;
  padding-left: 18px;
}

.ai-workbench__archive-coverage li {
  display: grid;
  gap: 2px;
  font-size: 11px;
}

.ai-workbench__archive-coverage li span {
  color: #9a5b18;
}

.ai-workbench__archive-coverage li b {
  font-weight: 500;
  overflow-wrap: anywhere;
}

html[data-theme="night"] .ai-workbench__archive-coverage.is-incomplete {
  border-left-color: #e8a44f;
  background: #33291c;
}

.ai-workbench__unlock {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.8fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px 18px;
  background: var(--cc-warning-soft, #fbf1d9);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-workbench__unlock > div:first-child strong,
.ai-workbench__unlock > div:first-child span {
  display: block;
}

.ai-workbench__unlock--active {
  grid-template-columns: minmax(0, 1fr) auto;
  background: var(--cc-accent-soft, #e5f1ec);
}

.ai-workbench__unlock > div:first-child span {
  margin-top: 3px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
}

.ai-workbench__inline-actions,
.ai-settings__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-workbench__feedback,
.ai-settings__feedback,
.ai-settings__test-result {
  min-height: 34px;
  padding: 8px 14px;
  color: var(--cc-ink-soft, #52605a);
  border-top: 1px solid var(--cc-line, #d9e0dc);
  font-size: 12px;
}

.ai-workbench__mobile-segments {
  display: none;
}

.ai-settings__segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 18px;
  background: var(--cc-surface-muted, #f8faf9);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-settings__segments button[aria-pressed="true"] {
  color: #fff;
  background: var(--cc-accent, #176b50);
  border-color: var(--cc-accent, #176b50);
}

.ai-settings__panel {
  min-width: 0;
  min-height: 410px;
  padding: 16px 18px;
}

.ai-settings__panel[hidden] {
  display: none;
}

.ai-settings__section-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.ai-settings__section-head p {
  margin: 3px 0 0;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
}

.ai-settings__form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-settings__field--wide {
  grid-column: 1 / -1;
}

.ai-settings__toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px;
  background: var(--cc-surface-muted, #f8faf9);
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 3px;
}

.ai-settings__toggle input {
  width: 36px;
  min-height: 20px;
  height: 20px;
  flex: 0 0 36px;
  margin: 1px 0 0;
  accent-color: var(--cc-accent, #176b50);
}

.ai-settings__toggle span,
.ai-settings__toggle strong,
.ai-settings__toggle small {
  display: block;
}

.ai-settings__toggle small {
  margin-top: 3px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  line-height: 1.45;
}

.ai-settings__key-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 14px;
  padding: 11px;
  background: var(--cc-accent-soft, #e5f1ec);
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 3px;
}

.ai-settings__key-summary > span strong,
.ai-settings__key-summary > span small {
  display: block;
}

.ai-settings__key-summary small {
  margin-top: 3px;
  color: var(--cc-ink-soft, #52605a);
}

.ai-settings__key-summary dl {
  display: flex;
  gap: 16px;
  margin: 0;
}

.ai-settings__key-summary dl div {
  min-width: 120px;
}

.ai-settings__key-summary dt,
.ai-settings__key-summary dd {
  margin: 0;
  font-size: 11px;
}

.ai-settings__key-summary dt {
  color: var(--cc-ink-soft, #52605a);
}

.ai-settings__key-summary dd {
  margin-top: 3px;
  font-family: var(--cc-font-mono, monospace);
  overflow-wrap: anywhere;
}

.ai-settings__actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.ai-settings__mode-field {
  display: block;
  max-width: 480px;
  margin-top: 14px;
}

.ai-settings__permission-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
  border-top: 1px solid var(--cc-line, #d9e0dc);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-settings__permission-notes > div {
  display: flex;
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border-left: 1px solid var(--cc-line, #d9e0dc);
}

.ai-settings__permission-notes > div:first-child {
  border-left: 0;
}

.ai-settings__permission-notes svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--cc-accent, #176b50);
}

.ai-settings__permission-notes strong,
.ai-settings__permission-notes small {
  display: block;
}

.ai-settings__permission-notes small {
  margin-top: 3px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
  line-height: 1.45;
}

.ai-settings__audit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 3px;
}

.ai-settings__audit-group {
  min-width: 0;
  border-left: 1px solid var(--cc-line, #d9e0dc);
}

.ai-settings__audit-group:first-child {
  border-left: 0;
}

.ai-settings__audit-group > header {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 10px;
  background: var(--cc-surface-muted, #f8faf9);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
}

.ai-settings__audit-group > header svg {
  width: 16px;
  height: 16px;
  color: var(--cc-accent, #176b50);
}

.ai-settings__audit-group h4 {
  font-size: 13px;
}

.ai-settings__audit-group > header span {
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
}

.ai-settings__audit-list {
  min-height: 280px;
}

.ai-settings__audit-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
  font-size: 12px;
}

.ai-settings__audit-row strong,
.ai-settings__audit-row small {
  display: block;
  overflow-wrap: anywhere;
}

.ai-settings__audit-row small {
  margin-top: 2px;
  color: var(--cc-ink-soft, #52605a);
}

.ai-settings__audit-row > span:last-child {
  color: var(--cc-accent-strong, #0f573f);
  white-space: nowrap;
}

.ai-settings__empty {
  padding: 20px 10px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  text-align: center;
}

html[data-theme="night"] .ai-workbench,
html[data-theme="night"] .ai-settings {
  color: var(--cc-ink, #e8eeeb);
  background: var(--cc-surface, #17211d);
}

html[data-theme="night"] .ai-workbench textarea,
html[data-theme="night"] .ai-settings input,
html[data-theme="night"] .ai-settings select,
html[data-theme="night"] .ai-workbench__unlock input {
  color: var(--cc-ink, #e8eeeb);
  background: var(--cc-surface-muted, #202b27);
}

@media (max-width: 1080px) {
  .ai-workbench__columns {
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
  }

  .ai-workbench__status-rail {
    justify-content: flex-start;
  }

  .ai-workbench__header {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  body.owner-shell-v1 .ai-panel {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .ai-workbench-entry {
    min-height: 44px;
  }

  .ai-workbench,
  .ai-settings {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .ai-workbench {
    padding-bottom: calc(var(--cc-mobile-nav-height, 104px) + 190px);
  }

  .ai-workbench__composer {
    position: fixed;
    inset-inline: 9px;
    bottom: var(--cc-mobile-nav-height, 104px);
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
    border: 1px solid var(--cc-line, #d9e0dc);
    border-radius: 8px;
  }

  .ai-workbench__header,
  .ai-settings__header {
    display: block;
    padding: 12px;
  }

  .ai-workbench__view-tabs {
    padding: 8px 12px;
  }

  .ai-settings__header p {
    margin-top: 7px;
  }

  .ai-workbench__status-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
  }

  .ai-workbench__status-rail > span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .ai-workbench__query {
    padding: 10px 12px;
  }

  .ai-workbench__archive-form {
    padding-block: 12px 14px;
  }

  .ai-workbench__archive-form textarea {
    min-height: 180px;
  }

  .ai-workbench__query > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-workbench__query .ai-command-button {
    min-height: 44px;
  }

  .ai-workbench__unlock {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .ai-workbench__unlock--active {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-workbench__inline-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-workbench__mobile-segments {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    position: sticky;
    top: var(--cc-viewbar-height, 46px);
    z-index: 4;
    padding: 8px 12px;
    background: var(--cc-surface, #fff);
    border-bottom: 1px solid var(--cc-line, #d9e0dc);
  }

  .ai-workbench__mobile-segments button {
    min-width: 0;
    min-height: 42px;
    padding-inline: 5px;
    font-size: 12px;
  }

  .ai-workbench__mobile-segments button[aria-pressed="true"] {
    color: #fff;
    background: var(--cc-accent, #176b50);
    border-color: var(--cc-accent, #176b50);
  }

  .ai-workbench[data-ai-active-view="qa"] .ai-workbench__mobile-segments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-workbench[data-ai-active-view="write"] .ai-workbench__mobile-segments {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-workbench[data-ai-active-view="qa"] [data-ai-mobile-segment="proposals"],
  .ai-workbench[data-ai-active-view="write"] [data-ai-mobile-segment="answer"],
  .ai-workbench[data-ai-active-view="write"] [data-ai-mobile-segment="sources"] {
    display: none;
  }

  .ai-workbench__columns {
    display: block;
    min-height: 420px;
  }

  .ai-workbench__pane {
    display: none;
    min-height: 420px;
    padding: 12px;
    border-left: 0;
  }

  .ai-workbench[data-ai-mobile-active="answer"] [data-ai-pane="answer"],
  .ai-workbench[data-ai-mobile-active="sources"] [data-ai-pane="sources"],
  .ai-workbench[data-ai-mobile-active="proposals"] [data-ai-pane="proposals"] {
    display: block;
  }

  .ai-workbench__result,
  .ai-workbench__source-list,
  .ai-workbench__proposal-list {
    min-height: 300px;
  }

  .ai-workbench__pane--answer .ai-workbench__result {
    height: min(52vh, 460px);
    max-height: 460px;
    padding-bottom: calc(var(--cc-mobile-nav-height, 104px) + 24px);
  }

  .ai-workbench__pane--write .ai-workbench__proposal-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow-x: visible;
    padding: 0;
  }

  .ai-workbench__proposal-group,
  .ai-workbench__pane--write .ai-workbench__proposal-group {
    width: 100%;
    min-width: 0;
    flex: none;
    margin: 0 0 12px;
  }

  .ai-workbench__pane--write {
    grid-column: auto;
  }

  .ai-settings__segments {
    padding: 8px 12px;
  }

  .ai-settings__segments button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 5px;
  }

  .ai-settings__panel {
    min-height: 460px;
    padding: 14px 12px calc(var(--cc-mobile-nav-height, 104px) + 24px);
  }

  .ai-settings__form-grid,
  .ai-settings__permission-notes,
  .ai-settings__audit-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-settings__permission-notes > div,
  .ai-settings__audit-group {
    border-left: 0;
    border-top: 1px solid var(--cc-line, #d9e0dc);
  }

  .ai-settings__permission-notes > div:first-child,
  .ai-settings__audit-group:first-child {
    border-top: 0;
  }

  .ai-settings__key-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-settings__key-summary dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-settings__key-summary dl div {
    min-width: 0;
  }

  .ai-settings__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-settings__actions button {
    min-height: 44px;
  }

  .ai-settings__audit-list {
    min-height: 100px;
  }
}

/* Keep the conversation visible while reviewing write cards; the tabs now select
   the input mode, not whether the conversation disappears. */
.ai-workbench[data-ai-active-view="write"] [data-ai-workbench-pane="qa"] {
  display: block !important;
}

.ai-workbench[data-ai-active-view="write"] [data-ai-workbench-pane="write"]:not([data-ai-context-panel]) {
  display: block !important;
}

/* Reviewing a draft must not remove the Codex composer. Keep the same input
 * available at the bottom so the user can correct or continue the conversation
 * without switching away from the confirmation panel. */
.ai-workbench[data-ai-active-view="write"] .ai-workbench__query--qa {
  display: grid !important;
}

/* Pending model proposals remain reviewable beside the answer in the default
 * conversation view; the response action still provides the mobile focus path. */
.ai-workbench[data-ai-active-view="qa"] .ai-workbench__context-pane:not([hidden]) {
  display: block;
}

@media (max-width: 760px) {
  /* Keep pending drafts reachable from the default answer segment on mobile. */
  .ai-workbench[data-ai-active-view="qa"] .ai-workbench__mobile-segments {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ai-workbench[data-ai-active-view="qa"] [data-ai-mobile-segment="proposals"] {
    display: block !important;
  }
}

@media (max-width: 520px) {
  .ai-workbench__status-rail,
  .ai-settings__key-summary dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-settings__section-head,
  .ai-workbench__pane-head,
  .ai-workbench__proposal-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-workbench__view-tabs {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-workbench__view-tabs button {
    justify-content: flex-start;
  }

  .ai-settings__section-head > span,
  .ai-workbench__pane-head > span,
  .ai-workbench__proposal-meta > span {
    align-self: flex-start;
  }

  .ai-settings__mode-field {
    max-width: none;
  }

  .ai-settings__segments {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-settings__segments button {
    justify-content: flex-start;
  }
}

/* Keep the three AI workbench surfaces readable after restoring older canvas layouts. */
@media (min-width: 761px) {
  .ai-workbench__columns.module-canvas-grid:not(.is-editing) {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr) !important;
  }

  .ai-workbench__columns.module-canvas-grid:not(.is-editing) > .module-canvas-widget {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  .ai-workbench[data-ai-active-view="write"] .ai-workbench__columns.module-canvas-grid:not(.is-editing) > .module-canvas-widget:has([data-ai-workbench-pane="write"]) {
    grid-column: 1 / -1 !important;
  }
}

/* owner-shell-v1: composed archive desk for AI query, evidence and review. */
body.owner-shell-v1:not(.auth-required) .cc-ai-surface {
  min-width: 0;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench,
body.owner-shell-v1:not(.auth-required) .ai-settings {
  overflow: hidden;
  border: 1px solid rgb(54 88 84 / 26%);
  border-radius: 8px;
  background: rgb(251 252 247 / 86%);
  box-shadow:
    0 24px 54px rgb(30 65 62 / 15%),
    0 5px 14px rgb(30 65 62 / 7%),
    inset 0 1px 0 rgb(255 255 255 / 92%);
  backdrop-filter: blur(18px) saturate(108%);
  -webkit-backdrop-filter: blur(18px) saturate(108%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__header,
body.owner-shell-v1:not(.auth-required) .ai-settings__header {
  padding: 18px 20px;
  border-bottom-color: rgb(56 91 87 / 21%);
  background: rgb(255 255 252 / 58%);
  box-shadow: inset 0 -1px 0 rgb(255 255 255 / 62%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs {
  padding: 10px 20px;
  background: rgb(238 245 239 / 66%);
  border-bottom-color: rgb(56 91 87 / 18%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs button {
  min-height: 40px;
  border-color: rgb(73 105 101 / 30%);
  border-radius: 5px;
  background: rgb(255 255 252 / 78%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs button[aria-selected="true"] {
  color: #fff;
  border-color: #1d6a52;
  background: #1d7457;
  box-shadow: 0 5px 12px rgb(28 93 70 / 16%), inset 0 1px 0 rgb(255 255 255 / 16%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__header h2,
body.owner-shell-v1:not(.auth-required) .ai-settings__header h2 {
  color: #173d3b;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__header p,
body.owner-shell-v1:not(.auth-required) .ai-settings__header p,
body.owner-shell-v1:not(.auth-required) .ai-settings__section-head p {
  color: #587069;
  line-height: 1.5;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__status-rail > span {
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid rgb(60 108 96 / 20%);
  border-radius: 4px;
  background: rgb(228 241 234 / 68%);
  color: #3e6459;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__query,
body.owner-shell-v1:not(.auth-required) .ai-workbench__unlock {
  border-bottom-color: rgb(56 91 87 / 18%);
  background: rgb(245 248 243 / 48%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__query {
  padding: 16px 20px;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench textarea,
body.owner-shell-v1:not(.auth-required) .ai-workbench__unlock input,
body.owner-shell-v1:not(.auth-required) .ai-settings input,
body.owner-shell-v1:not(.auth-required) .ai-settings select {
  border-color: rgb(73 105 101 / 30%);
  border-radius: 5px;
  background: rgb(255 255 252 / 78%);
  box-shadow: inset 0 1px 2px rgb(26 63 60 / 4%), 0 1px 0 rgb(255 255 255 / 72%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench textarea:focus,
body.owner-shell-v1:not(.auth-required) .ai-workbench__unlock input:focus,
body.owner-shell-v1:not(.auth-required) .ai-settings input:focus,
body.owner-shell-v1:not(.auth-required) .ai-settings select:focus {
  border-color: rgb(32 117 92 / 68%);
  box-shadow: 0 0 0 3px rgb(32 117 92 / 11%), inset 0 1px 2px rgb(26 63 60 / 4%);
  outline: 0;
}

body.owner-shell-v1:not(.auth-required) .ai-command-button,
body.owner-shell-v1:not(.auth-required) .ai-secondary-button,
body.owner-shell-v1:not(.auth-required) .ai-text-button,
body.owner-shell-v1:not(.auth-required) .ai-icon-button {
  border-radius: 5px;
}

body.owner-shell-v1:not(.auth-required) .ai-command-button {
  min-height: 38px;
  border-color: #1d6a52;
  background: #1d7457;
  box-shadow: 0 7px 14px rgb(28 93 70 / 18%), inset 0 1px 0 rgb(255 255 255 / 18%);
}

body.owner-shell-v1:not(.auth-required) .ai-command-button:hover:not(:disabled) {
  background: #145942;
  box-shadow: 0 9px 18px rgb(28 93 70 / 24%), inset 0 1px 0 rgb(255 255 255 / 20%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__columns {
  gap: 0;
  background: rgb(232 240 234 / 34%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__pane {
  min-width: 0;
  padding: 18px 20px 20px;
  border-left-color: rgb(56 91 87 / 17%);
  background: rgb(255 255 252 / 34%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__pane:first-child {
  background: rgb(255 255 252 / 50%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__pane-head,
body.owner-shell-v1:not(.auth-required) .ai-settings__section-head {
  padding-bottom: 10px;
  border-bottom: 1px solid rgb(68 103 98 / 18%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__pane-head h3,
body.owner-shell-v1:not(.auth-required) .ai-settings__section-head h3 {
  color: #204845;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__result,
body.owner-shell-v1:not(.auth-required) .ai-workbench__source-list,
body.owner-shell-v1:not(.auth-required) .ai-workbench__proposal-list,
body.owner-shell-v1:not(.auth-required) .ai-settings__audit-grid {
  border: 1px solid rgb(68 103 98 / 22%);
  border-radius: 6px;
  background: rgb(255 255 252 / 62%);
  box-shadow: 0 9px 22px rgb(28 63 60 / 6%), inset 0 1px 0 rgb(255 255 255 / 78%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__result {
  padding: 16px;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__answer-copy {
  color: #263f3a;
  line-height: 1.7;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__source,
body.owner-shell-v1:not(.auth-required) .ai-workbench__proposal {
  padding: 12px;
  border-bottom-color: rgb(68 103 98 / 15%);
  background: rgb(251 253 249 / 52%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__source:last-child,
body.owner-shell-v1:not(.auth-required) .ai-workbench__proposal:last-child {
  border-bottom: 0;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__citation {
  border-radius: 4px;
  background: rgb(219 239 229 / 90%);
  color: #1c6950;
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__proposal-actions,
body.owner-shell-v1:not(.auth-required) .ai-workbench__feedback,
body.owner-shell-v1:not(.auth-required) .ai-settings__feedback,
body.owner-shell-v1:not(.auth-required) .ai-settings__test-result {
  border-color: rgb(68 103 98 / 17%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__state {
  min-height: 126px;
  padding: 22px 16px;
  border: 1px dashed rgb(67 107 98 / 34%);
  border-radius: 6px;
  background: rgb(240 247 241 / 62%);
}

body.owner-shell-v1:not(.auth-required) .ai-workbench__unlock,
body.owner-shell-v1:not(.auth-required) .ai-workbench__unlock--active {
  border-bottom: 1px solid rgb(56 91 87 / 18%);
}

body.owner-shell-v1:not(.auth-required) .ai-settings__segments,
body.owner-shell-v1:not(.auth-required) .ai-workbench__mobile-segments {
  padding: 10px 20px;
  background: rgb(238 245 239 / 66%);
  border-bottom-color: rgb(56 91 87 / 18%);
}

body.owner-shell-v1:not(.auth-required) .ai-settings__segments button,
body.owner-shell-v1:not(.auth-required) .ai-workbench__mobile-segments button {
  min-height: 38px;
  border-radius: 5px;
}

body.owner-shell-v1:not(.auth-required) .ai-settings__segments button[aria-pressed="true"],
body.owner-shell-v1:not(.auth-required) .ai-workbench__mobile-segments button[aria-pressed="true"] {
  background: #1d7457;
  box-shadow: 0 5px 12px rgb(28 93 70 / 16%), inset 0 1px 0 rgb(255 255 255 / 16%);
}

body.owner-shell-v1:not(.auth-required) .ai-settings__panel {
  padding: 20px;
}

body.owner-shell-v1:not(.auth-required) .ai-settings__toggle,
body.owner-shell-v1:not(.auth-required) .ai-settings__key-summary {
  border-color: rgb(68 103 98 / 20%);
  border-radius: 6px;
  background: rgb(244 249 244 / 68%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 74%);
}

body.owner-shell-v1:not(.auth-required) .ai-settings__permission-notes {
  border-color: rgb(68 103 98 / 18%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings {
  border-color: rgb(130 184 175 / 24%);
  background: rgb(14 29 30 / 90%);
  box-shadow: 0 26px 60px rgb(0 5 7 / 38%), inset 0 1px 0 rgb(180 220 205 / 9%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__header,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__header,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__query,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__unlock,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__segments,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__mobile-segments {
  border-color: rgb(130 184 175 / 19%);
  background: rgb(19 39 40 / 64%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs {
  border-color: rgb(130 184 175 / 19%);
  background: rgb(19 39 40 / 64%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs button {
  border-color: rgb(130 184 175 / 24%);
  background: rgb(21 44 44 / 68%);
  color: #d4e7df;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs button[aria-selected="true"] {
  color: #fff;
  border-color: #2f8a6d;
  background: #25765d;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__header h2,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__header h2,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__pane-head h3,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__section-head h3,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__answer-copy {
  color: #e1eee7;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__header p,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__header p,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__section-head p {
  color: #9cb6ae;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__status-rail > span {
  border-color: rgb(130 184 175 / 24%);
  background: rgb(35 71 67 / 70%);
  color: #b8d0c7;
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__columns {
  background: rgb(10 24 25 / 72%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__pane {
  border-left-color: rgb(130 184 175 / 17%);
  background: rgb(17 35 36 / 54%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__pane:first-child {
  background: rgb(18 39 39 / 70%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__result,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__source-list,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__proposal-list,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__audit-grid {
  border-color: rgb(130 184 175 / 22%);
  background: rgb(17 35 36 / 78%);
  box-shadow: 0 10px 24px rgb(0 5 7 / 24%), inset 0 1px 0 rgb(180 220 205 / 6%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__source,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__proposal,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__toggle,
html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-settings__key-summary {
  border-color: rgb(130 184 175 / 14%);
  background: rgb(21 44 44 / 68%);
}

html[data-theme="night"] body.owner-shell-v1:not(.auth-required) .ai-workbench__state {
  border-color: rgb(130 184 175 / 32%);
  background: rgb(28 57 55 / 58%);
}

@media (max-width: 760px) {
  body.owner-shell-v1:not(.auth-required) .ai-workbench__header,
  body.owner-shell-v1:not(.auth-required) .ai-settings__header,
  body.owner-shell-v1:not(.auth-required) .ai-workbench__query,
  body.owner-shell-v1:not(.auth-required) .ai-workbench__pane,
  body.owner-shell-v1:not(.auth-required) .ai-settings__panel {
    padding-inline: 14px;
  }

  body.owner-shell-v1:not(.auth-required) .ai-settings__segments,
  body.owner-shell-v1:not(.auth-required) .ai-workbench__mobile-segments,
  body.owner-shell-v1:not(.auth-required) .ai-workbench__view-tabs {
    padding-inline: 14px;
  }

  body.owner-shell-v1:not(.auth-required) .ai-workbench__pane {
    border-left: 0;
  }
}

@media (max-width: 520px) {
  body.owner-shell-v1:not(.auth-required) .ai-workbench,
  body.owner-shell-v1:not(.auth-required) .ai-settings {
    border-radius: 7px;
  }

  body.owner-shell-v1:not(.auth-required) .ai-workbench__status-rail {
    gap: 6px;
  }

  body.owner-shell-v1:not(.auth-required) .ai-workbench__state {
    min-height: 110px;
    padding: 18px 12px;
  }
}
/* Split-workspace golden slice: conversation stays primary, context stays visible beside it. */
.ai-workbench__context-pane {
  display: grid;
  min-width: 0;
  gap: 12px;
  align-content: start;
}

.ai-workbench__conversation {
  display: grid;
  gap: 12px;
  align-content: start;
}

.ai-workbench__message {
  max-width: 92%;
  padding: 12px 14px;
  border: 1px solid var(--cc-line, #d9e0dc);
  border-radius: 8px;
  background: var(--cc-surface, #fff);
}

.ai-workbench__message--user {
  justify-self: end;
  border-color: color-mix(in srgb, var(--cc-accent, #176b50) 32%, var(--cc-line, #d9e0dc));
  background: color-mix(in srgb, var(--cc-accent-soft, #e5f1ec) 72%, #fff);
}

.ai-workbench__message--loading {
  opacity: .78;
}

.ai-workbench__message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
}

.ai-workbench__message-meta strong {
  color: var(--cc-ink, #17211d);
  font-size: 12px;
}

.ai-workbench__message-body {
  color: var(--cc-ink, #17211d);
  line-height: 1.65;
  white-space: normal;
}

.ai-workbench__message-attachments {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.ai-workbench__message-attachment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--cc-accent, #176b50) 34%, var(--cc-line, #d9e0dc));
  border-radius: 5px;
  background: color-mix(in srgb, var(--cc-accent-soft, #e5f1ec) 62%, #fff);
  color: var(--cc-ink, #17211d);
}

.ai-workbench__message-attachment svg {
  width: 16px;
  height: 16px;
  color: var(--cc-accent-strong, #0f573f);
}

.ai-workbench__message-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.ai-workbench__message-attachment small {
  color: var(--cc-ink-soft, #52605a);
  font-size: 11px;
  white-space: nowrap;
}

.ai-workbench__context-pane > .ai-workbench__pane {
  min-width: 0;
  max-height: 560px;
  overflow-x: hidden;
  overflow-y: auto;
}

@media (max-width: 760px) {
  .ai-workbench__context-pane {
    gap: 10px;
  }

  .ai-workbench__message {
    max-width: 100%;
  }

  .ai-workbench__composer > div {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "query query" "attachment submit";
  }

  .ai-workbench__attachment-dropzone {
    width: 100%;
  }

  .ai-workbench__attachment-hint {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ai-workbench__context-pane > .ai-workbench__pane {
    max-height: none;
  }
}
/* Unified Codex-style response actions and right-side contextual finance view. */
.ai-legacy-compat { display: none !important; }
.ai-workbench__message-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-workbench__action-button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 7px 11px; border: 1px solid rgb(35 111 82 / 38%); border-radius: 5px; background: rgb(235 247 238 / 90%); color: #176044; font-weight: 650; cursor: pointer; }
.ai-workbench__action-button:hover, .ai-workbench__action-button:focus-visible { border-color: #176044; background: #d9efdf; }
.ai-workbench__action-button svg { width: 15px; height: 15px; }
.ai-workbench__context-result { min-height: 180px; }
.ai-workbench__finance-context-meta { margin-bottom: 10px; color: var(--cc-text-muted, #63756d); font-size: .86rem; }
.ai-workbench__finance-context-table-wrap { overflow: auto; max-height: 420px; border: 1px solid rgb(45 85 68 / 16%); border-radius: 5px; }
.ai-workbench__finance-context table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: .84rem; }
.ai-workbench__finance-context th, .ai-workbench__finance-context td { padding: 8px 9px; border-bottom: 1px solid rgb(45 85 68 / 12%); text-align: left; white-space: nowrap; }
.ai-workbench__finance-context th { position: sticky; top: 0; background: rgb(239 247 240 / 96%); color: #31594b; }
@media (max-width: 760px) { .ai-workbench__finance-context-table-wrap { max-height: 340px; } .ai-workbench__action-button { width: 100%; justify-content: center; } }

/* UI polish 2026-09: keep the workbench a two-surface desk.  The answer and
 * active context panel own their content scroll; the page itself stays still
 * while the composer remains available for the next request. */
.ai-workbench__columns.has-context {
  align-items: stretch;
  min-height: clamp(460px, 68vh, 720px);
  max-height: min(720px, calc(100vh - 250px));
}

.ai-workbench__columns.has-context > .module-canvas-widget,
.ai-workbench__columns.has-context > .ai-workbench__pane,
.ai-workbench__columns.has-context > .ai-workbench__context-pane {
  min-height: 0;
}

.ai-workbench__pane--answer {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.ai-workbench__pane--answer .ai-workbench__pane-head {
  flex: 0 0 auto;
}

.ai-workbench__pane--answer .ai-workbench__result {
  height: auto;
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 8px 8px 2px;
  scrollbar-color: color-mix(in srgb, var(--cc-accent, #176b50) 58%, transparent) transparent;
  scrollbar-width: thin;
}

.ai-workbench__context-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  max-height: none;
  gap: 0;
  overflow: hidden;
  border-left: 1px solid color-mix(in srgb, var(--cc-line, #d9e0dc) 82%, transparent);
  background: color-mix(in srgb, var(--cc-surface-muted, #f8faf9) 62%, transparent);
}

.ai-workbench__context-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 44px;
  padding: 7px 8px 0;
  gap: 3px;
  align-items: stretch;
  background: color-mix(in srgb, var(--cc-surface, #fff) 94%, transparent);
  border-bottom: 1px solid var(--cc-line, #d9e0dc);
  box-shadow: 0 3px 10px rgb(23 33 29 / 6%);
  overscroll-behavior-inline: contain;
  scrollbar-color: color-mix(in srgb, var(--cc-accent, #176b50) 42%, transparent) transparent;
}

.ai-workbench__context-tab-item {
  min-height: 36px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, var(--cc-surface-muted, #f8faf9) 72%, transparent);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.ai-workbench__context-tab-item:has(.ai-workbench__context-tab.is-active) {
  border-color: var(--cc-line, #d9e0dc);
  background: var(--cc-surface, #fff);
  box-shadow: 0 -1px 0 var(--cc-surface, #fff), 0 2px 6px rgb(23 33 29 / 5%);
}

.ai-workbench__context-tab {
  min-height: 35px;
  padding: 7px 9px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 12px;
  letter-spacing: .01em;
}

.ai-workbench__context-tab:hover,
.ai-workbench__context-tab:focus-visible {
  color: var(--cc-accent-strong, #0f573f);
  background: color-mix(in srgb, var(--cc-accent-soft, #e5f1ec) 54%, transparent);
}

.ai-workbench__context-tab.is-active {
  border-color: transparent;
  color: var(--cc-accent-strong, #0f573f);
  background: transparent;
}

.ai-workbench__context-tab-close {
  width: 26px;
  min-width: 26px;
  height: 26px;
  margin: 4px 4px 0 0;
  border-radius: 4px;
  color: var(--cc-ink-soft, #52605a);
  font-size: 15px;
}

.ai-workbench__context-tab-close:hover,
.ai-workbench__context-tab-close:focus-visible {
  color: var(--cc-danger, #a34136);
  background: color-mix(in srgb, var(--cc-danger, #a34136) 12%, transparent);
  outline: 2px solid color-mix(in srgb, var(--cc-danger, #a34136) 22%, transparent);
  outline-offset: -1px;
}

.ai-workbench__context-pane > [role="tabpanel"]:not([hidden]) {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.ai-workbench__context-pane > [role="tabpanel"]:not([hidden]) > .ai-workbench__pane-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 14px 10px;
}

.ai-workbench__context-pane > [role="tabpanel"][data-ai-pane="sources"]:not([hidden]) .ai-workbench__source-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 12px 14px;
  scrollbar-color: color-mix(in srgb, var(--cc-accent, #176b50) 48%, transparent) transparent;
  scrollbar-width: thin;
}

.ai-workbench__context-pane > [role="tabpanel"][data-ai-context-panel="proposals"]:not([hidden]) .ai-workbench__proposal-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 2px 12px 14px 14px;
  scrollbar-color: color-mix(in srgb, var(--cc-accent, #176b50) 48%, transparent) transparent;
}

.ai-workbench__context-result:not([hidden]) {
  overflow-y: auto !important;
  scrollbar-color: color-mix(in srgb, var(--cc-accent, #176b50) 48%, transparent) transparent;
  scrollbar-width: thin;
}

.ai-workbench__composer {
  margin-top: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid color-mix(in srgb, var(--cc-line, #d9e0dc) 76%, transparent);
}

.ai-workbench__composer > div {
  display: grid;
  gap: 10px;
}

.ai-workbench__attachment-dropzone {
  min-width: 148px;
  border-style: solid;
  background: color-mix(in srgb, var(--cc-surface-muted, #f8faf9) 82%, transparent);
}

@media (max-width: 1080px) and (min-width: 761px) {
  .ai-workbench__columns.has-context {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr) !important;
    max-height: min(680px, calc(100vh - 270px));
  }

  .ai-workbench__context-tab {
    max-width: 180px;
  }
}

@media (max-width: 760px) {
  .ai-workbench__columns.has-context {
    min-height: 0;
    max-height: none;
  }

  .ai-workbench__pane--answer .ai-workbench__result {
    height: min(52vh, 460px);
    flex: 0 1 auto;
    padding: 4px 5px 8px 0;
  }

  .ai-workbench__context-pane {
    display: grid;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--cc-line, #d9e0dc);
  }

  .ai-workbench__context-tabs {
    position: sticky;
    top: var(--cc-viewbar-height, 46px);
    min-height: 45px;
    padding: 7px 10px 0;
  }

  .ai-workbench__context-pane > [role="tabpanel"]:not([hidden]) {
    min-height: 360px;
    max-height: min(62vh, 520px);
  }

  .ai-workbench__context-pane > [role="tabpanel"][data-ai-pane="sources"]:not([hidden]) .ai-workbench__source-list {
    max-height: none;
    padding-inline: 10px;
  }

  .ai-workbench__composer {
    padding-inline: 10px;
  }

  .ai-workbench__attachment-dropzone {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-workbench__context-tab-item {
    transition: none;
  }
}

/* Deep workbench pass: a quiet, high-density archive console. */
.ai-workbench {
  --ai-stage: #f4f7f5;
  --ai-panel: #ffffff;
  --ai-ink: #16211d;
  --ai-muted: #687770;
  --ai-line: #d7dfda;
  --ai-line-strong: #b5c3bc;
  --ai-accent: #176b50;
  --ai-accent-strong: #0d5039;
  --ai-accent-soft: #e7f2ed;
  overflow-x: hidden;
  display: flex;
  height: calc(100dvh - 154px);
  min-height: 560px;
  max-height: 880px;
  flex-direction: column;
  border: 1px solid var(--ai-line);
  border-radius: 8px;
  background: var(--ai-stage);
  box-shadow: 0 18px 48px rgb(20 36 29 / 9%);
}

.ai-workbench__header {
  flex: 0 0 auto;
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 0;
  background: #18241f;
  color: #f6faf8;
}

.ai-workbench__header h2 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 720;
}

.ai-workbench__header .ai-workbench__eyebrow {
  color: #9fc9b8;
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.ai-workbench__status-rail {
  max-width: min(62%, 760px);
  align-items: center;
  gap: 7px;
}

.ai-workbench__status-rail > span {
  min-height: 29px;
  padding: 5px 9px;
  border: 1px solid rgb(221 239 231 / 16%);
  border-radius: 4px;
  background: rgb(255 255 255 / 6%);
  color: #dce9e3;
  font-size: 11px;
}

.ai-workbench__status-rail > span svg {
  color: #72bd9e;
}

.ai-workbench__status-rail > .ai-workbench__draft-only {
  border-color: rgb(234 184 91 / 34%);
  color: #f1d696;
}

.ai-workbench__session-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) repeat(3, minmax(140px, 1fr));
  min-width: 0;
  border-bottom: 1px solid var(--ai-line);
  background: var(--ai-panel);
}

.ai-workbench__session-item {
  display: flex;
  min-width: 0;
  min-height: 66px;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-right: 1px solid var(--ai-line);
}

.ai-workbench__session-item:last-child {
  border-right: 0;
}

.ai-workbench__session-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid var(--ai-line);
  border-radius: 6px;
  background: #f7f9f8;
  color: #51615a;
}

.ai-workbench__session-icon svg {
  width: 16px;
  height: 16px;
}

.ai-workbench__session-item > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ai-workbench__session-item small {
  overflow: hidden;
  color: var(--ai-muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-workbench__session-item strong {
  overflow: hidden;
  color: var(--ai-ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-workbench__session-item--primary {
  box-shadow: inset 3px 0 0 var(--ai-accent);
}

.ai-workbench__session-item--primary .ai-workbench__session-icon {
  border-color: #a8cabd;
  background: var(--ai-accent-soft);
  color: var(--ai-accent-strong);
}

.ai-workbench__session-item--guard .ai-workbench__session-icon {
  border-color: #d6c596;
  background: #fcf5e3;
  color: #80601a;
}

.ai-workbench__columns {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--ai-stage);
}

.ai-workbench__columns.has-context {
  min-height: 0;
  max-height: none;
}

.ai-workbench__columns:not(.has-context) .ai-workbench__pane--answer {
  height: 100%;
  min-height: 0;
}

.ai-workbench__pane--answer {
  padding: 0;
  background: #fbfcfb;
}

.ai-workbench__pane--answer > .ai-workbench__pane-head {
  min-height: 45px;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ai-line);
  background: rgb(255 255 255 / 88%);
}

.ai-workbench__pane-head h3 {
  color: var(--ai-ink);
  font-size: 13px;
  font-weight: 740;
}

.ai-workbench__pane-head > span {
  padding: 3px 7px;
  border-radius: 3px;
  background: #edf1ef;
  color: #66766e;
  font-size: 10px;
  font-weight: 650;
}

.ai-workbench__pane--answer .ai-workbench__result {
  padding: 20px 22px 24px;
  background-color: #fbfcfb;
}

.ai-workbench__conversation {
  gap: 18px;
  max-width: 980px;
  margin-inline: auto;
}

.ai-workbench__message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  width: min(92%, 820px);
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.ai-workbench__message--user {
  grid-template-columns: minmax(0, 1fr) 30px;
  justify-self: end;
  border: 0;
  background: transparent;
}

.ai-workbench__message--user .ai-workbench__message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.ai-workbench__message--user .ai-workbench__message-content {
  grid-column: 1;
  grid-row: 1;
  border-color: #bad4c9;
  background: #edf6f2;
}

.ai-workbench__message-avatar {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #b8c7c0;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ai-accent-strong);
  box-shadow: 0 2px 7px rgb(29 46 38 / 8%);
}

.ai-workbench__message-avatar svg {
  width: 15px;
  height: 15px;
}

.ai-workbench__message--assistant .ai-workbench__message-avatar {
  border-color: #2f6f58;
  background: #1b624a;
  color: #ffffff;
}

.ai-workbench__message-content {
  min-width: 0;
  padding: 12px 14px 13px;
  border: 1px solid var(--ai-line);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgb(26 42 34 / 5%);
}

.ai-workbench__message-meta {
  margin-bottom: 7px;
}

.ai-workbench__message-meta strong {
  font-size: 11px;
  font-weight: 760;
}

.ai-workbench__message-body {
  font-size: 13px;
  line-height: 1.7;
}

.ai-workbench__message--loading .ai-workbench__message-content {
  border-style: dashed;
}

.ai-workbench__typing-dots {
  display: inline-flex;
  margin-left: 5px;
  gap: 3px;
  vertical-align: middle;
}

.ai-workbench__typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ai-accent);
  animation: ai-workbench-pulse 1.1s ease-in-out infinite;
}

.ai-workbench__typing-dots i:nth-child(2) { animation-delay: .14s; }
.ai-workbench__typing-dots i:nth-child(3) { animation-delay: .28s; }

@keyframes ai-workbench-pulse {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

.ai-workbench__context-pane {
  border-left-color: #cdd8d2;
  background: #f5f7f6;
  box-shadow: -10px 0 28px rgb(31 48 40 / 5%);
}

.ai-workbench__context-tabs {
  min-height: 45px;
  padding: 7px 8px 0;
  border-bottom-color: #cbd6d0;
  background: #e9eeeb;
  box-shadow: none;
}

.ai-workbench__context-tab-item {
  border-radius: 5px 5px 0 0;
  background: transparent;
}

.ai-workbench__context-tab-item:has(.ai-workbench__context-tab.is-active) {
  border-color: #c8d3cd;
  background: #ffffff;
  box-shadow: 0 -2px 0 var(--ai-accent), 0 1px 0 #ffffff;
}

.ai-workbench__context-tab {
  font-size: 11px;
}

.ai-workbench__context-pane > [role="tabpanel"]:not([hidden]) {
  background: #ffffff;
}

.ai-workbench__source {
  margin: 0 0 8px;
  padding: 11px 12px;
  border: 1px solid var(--ai-line);
  border-radius: 6px;
  background: #ffffff;
}

.ai-workbench__source:last-child {
  margin-bottom: 0;
}

.ai-workbench__source:hover {
  border-color: #9ebcad;
  box-shadow: 0 5px 14px rgb(24 58 43 / 6%);
}

.ai-workbench__citation {
  border-radius: 4px;
  background: #1d624a;
  color: #ffffff;
}

.ai-workbench__composer {
  flex: 0 0 auto;
  padding: 13px 18px 15px;
  border-top-color: #cfd9d4;
  background: rgb(248 250 249 / 96%);
  box-shadow: 0 -12px 30px rgb(22 39 31 / 8%);
}

.ai-workbench__composer > label {
  display: block;
  margin-bottom: 7px;
  color: #53625b;
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.ai-workbench__composer-editor {
  min-height: 82px;
  padding: 8px 11px 7px;
  border-color: #aebdb6;
  background: #ffffff;
  box-shadow: 0 3px 12px rgb(27 44 36 / 5%);
}

.ai-workbench__composer-editor:focus-within {
  border-color: var(--ai-accent);
  outline: 3px solid rgb(23 107 80 / 13%);
  box-shadow: 0 5px 18px rgb(23 107 80 / 10%);
}

.ai-workbench__attachment-dropzone {
  min-height: 42px;
  border-color: #b6c4bd;
  background: #ffffff;
}

.ai-workbench__attachment-button {
  min-width: 106px;
  border-color: #9fb1a8;
  background: #ffffff;
  color: #30423a;
}

.ai-workbench__attachment-button:hover,
.ai-workbench__attachment-button:focus-visible {
  border-color: var(--ai-accent);
  background: var(--ai-accent-soft);
  color: var(--ai-accent-strong);
}

.ai-workbench__composer > div > .ai-command-button {
  min-width: 82px;
  min-height: 42px;
  border-radius: 6px;
  box-shadow: 0 5px 12px rgb(23 107 80 / 16%);
}

.ai-workbench__pending-attachment {
  min-height: 50px;
  padding: 5px 28px 5px 6px;
  border-color: #b8cfc5;
  border-radius: 6px;
  background: #f3f8f6;
}

.ai-workbench__pending-attachment-remove {
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #51615a;
  box-shadow: none;
}

.ai-workbench__pending-attachment-remove:hover,
.ai-workbench__pending-attachment-remove:focus-visible {
  background: #f7e8e8;
  color: #9c3030;
}

.ai-workbench__feedback {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 7px 16px;
  border-top-color: #d8e0dc;
  background: #f0f4f2;
  color: #617068;
  font-size: 11px;
}

.ai-workbench :where(button, textarea, input, select):focus-visible {
  outline: 2px solid #2b8063;
  outline-offset: 2px;
}

html[data-theme="night"] .ai-workbench {
  --ai-stage: #151b18;
  --ai-panel: #1c2420;
  --ai-ink: #eef5f1;
  --ai-muted: #9cafA5;
  --ai-line: #334139;
  --ai-line-strong: #526259;
  --ai-accent-soft: #203d32;
  border-color: #3a4941;
  background: var(--ai-stage);
}

html[data-theme="night"] .ai-workbench__session-strip,
html[data-theme="night"] .ai-workbench__session-item,
html[data-theme="night"] .ai-workbench__pane--answer,
html[data-theme="night"] .ai-workbench__pane--answer .ai-workbench__result,
html[data-theme="night"] .ai-workbench__context-pane > [role="tabpanel"]:not([hidden]),
html[data-theme="night"] .ai-workbench__message-content,
html[data-theme="night"] .ai-workbench__source,
html[data-theme="night"] .ai-workbench__composer-editor,
html[data-theme="night"] .ai-workbench__attachment-dropzone,
html[data-theme="night"] .ai-workbench__attachment-button {
  background: var(--ai-panel);
}

html[data-theme="night"] .ai-workbench__session-icon,
html[data-theme="night"] .ai-workbench__pane--answer > .ai-workbench__pane-head,
html[data-theme="night"] .ai-workbench__context-tabs,
html[data-theme="night"] .ai-workbench__composer,
html[data-theme="night"] .ai-workbench__feedback {
  background: #202a25;
}

html[data-theme="night"] .ai-workbench__message--user .ai-workbench__message-content {
  background: #203b31;
}

@media (max-width: 980px) {
  .ai-workbench__header {
    align-items: flex-start;
  }

  .ai-workbench__status-rail {
    max-width: 70%;
  }

  .ai-workbench__session-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-workbench__session-item:nth-child(2) {
    border-right: 0;
  }

  .ai-workbench__session-item:nth-child(-n+2) {
    border-bottom: 1px solid var(--ai-line);
  }
}

@media (max-width: 760px) {
  .ai-workbench {
    height: auto;
    min-height: 0;
    max-height: none;
    border-inline: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .ai-workbench__header {
    display: grid;
    gap: 10px;
    min-height: 0;
    padding: 13px 12px;
  }

  .ai-workbench__status-rail {
    max-width: 100%;
    justify-content: flex-start;
  }

  .ai-workbench__status-rail > span:nth-child(n+4) {
    display: none;
  }

  .ai-workbench__session-item {
    min-height: 58px;
    padding: 9px 10px;
  }

  .ai-workbench__session-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .ai-workbench__pane--answer .ai-workbench__result {
    padding: 14px 10px 18px;
  }

  .ai-workbench__message,
  .ai-workbench__message--user {
    width: 100%;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 7px;
  }

  .ai-workbench__message--user .ai-workbench__message-avatar {
    grid-column: 1;
  }

  .ai-workbench__message--user .ai-workbench__message-content {
    grid-column: 2;
  }

  .ai-workbench__message-avatar {
    width: 26px;
    height: 26px;
    border-radius: 5px;
  }

  .ai-workbench__message-content {
    padding: 10px 11px;
  }

  .ai-workbench__context-pane {
    box-shadow: none;
  }

  .ai-workbench__composer {
    padding: 10px;
  }

  .ai-workbench__attachment-hint {
    display: none;
  }
}

@media (max-width: 440px) {
  .ai-workbench__session-item {
    gap: 7px;
  }

  .ai-workbench__session-item small {
    font-size: 9px;
  }

  .ai-workbench__session-item strong {
    font-size: 11px;
  }

  .ai-workbench__composer > div {
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .ai-workbench__attachment-button {
    min-width: 0;
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-workbench__typing-dots i {
    animation: none;
  }
}

/* Structural polish 2026-09: one calm work surface with explicit state
   affordances. This final layer is intentionally token-based so the existing
   forest-green and night themes remain the source of truth. */
.ai-workbench[data-ai-phase="loading"] .ai-workbench__session-item--primary {
  box-shadow: inset 3px 0 0 #c48a27;
}

.ai-workbench[data-ai-phase="error"] .ai-workbench__session-item--primary {
  box-shadow: inset 3px 0 0 #a33131;
}

.ai-workbench[data-ai-context-state="closed"] .ai-workbench__columns {
  border-top: 1px solid var(--ai-line);
}

.ai-workbench__session-strip {
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px rgb(20 36 29 / 4%);
}

.ai-workbench__session-item {
  transition: background-color .16s ease, box-shadow .16s ease;
}

.ai-workbench__session-item:hover {
  background: #f7faf8;
}

.ai-workbench__columns.has-context {
  border-bottom: 1px solid var(--ai-line);
}

.ai-workbench__context-pane {
  border-left: 1px solid #bfcfc7;
}

.ai-workbench__context-tabs {
  min-width: 0;
  overscroll-behavior: contain;
}

.ai-workbench__context-tab-item {
  flex: 0 0 auto;
  max-width: min(220px, 42%);
}

.ai-workbench__context-tab {
  max-width: calc(100% - 30px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-workbench__pending-attachments {
  align-items: stretch;
  padding: 2px 2px 4px;
}

.ai-workbench__pending-attachment {
  min-width: 0;
  min-height: 50px;
  padding: 4px 30px 4px 5px;
  border-color: #9dbdaf;
  background: #f0f7f3;
  box-shadow: 0 2px 7px rgb(23 78 57 / 7%);
}

.ai-workbench__pending-attachment-preview {
  width: 40px;
  height: 40px;
  border-color: #8eb3a2;
}

.ai-workbench__pending-attachment-name {
  max-width: min(260px, 34vw);
  color: #20483a;
}

.ai-workbench[data-ai-attachment-count="0"] .ai-workbench__composer-editor {
  min-height: 78px;
}

.ai-workbench[data-ai-attachment-count]:not([data-ai-attachment-count="0"]) .ai-workbench__composer-editor {
  min-height: 104px;
}

html[data-theme="night"] .ai-workbench__session-item:hover {
  background: #24312b;
}

html[data-theme="night"] .ai-workbench__context-pane {
  border-left-color: #4b6257;
}

html[data-theme="night"] .ai-workbench__pending-attachment {
  border-color: #557e6b;
  background: #1d382d;
}

html[data-theme="night"] .ai-workbench__pending-attachment-name {
  color: #d7ebe1;
}

@media (max-width: 760px) {
  .ai-workbench__session-strip {
    box-shadow: none;
  }

  .ai-workbench__context-tab-item {
    max-width: 68%;
  }

  .ai-workbench__pending-attachment-name {
    max-width: min(220px, 56vw);
  }
}

/* Viewport/scroll repair 2026-09: the shared canvas wrapper must stretch with
   the workbench, while each active right-rail panel owns its own y-scroll. */
@media (min-width: 761px) {
  .ai-workbench {
    height: min(880px, calc(100dvh - 210px));
    min-height: min(560px, calc(100dvh - 210px));
  }

  .ai-workbench__columns.has-context {
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }

  .ai-workbench__columns.has-context > .module-canvas-widget {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }

  .ai-workbench__columns.has-context > .module-canvas-widget > [data-ai-pane] {
    height: 100%;
    min-height: 0;
  }

  .ai-workbench__context-pane > [role="tabpanel"][data-ai-context-panel="proposals"]:not([hidden]) .ai-workbench__proposal-list {
    overflow-y: auto;
  }
}

.ai-workbench__context-pane > [role="tabpanel"][data-ai-context-panel="proposals"]:not([hidden]) .ai-workbench__proposal-list,
.ai-workbench__context-pane > [role="tabpanel"][data-ai-pane="sources"]:not([hidden]) .ai-workbench__source-list,
.ai-workbench__context-result:not([hidden]) {
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

@media (max-width: 760px) {
  .ai-workbench__context-pane > [role="tabpanel"][data-ai-context-panel="proposals"]:not([hidden]) .ai-workbench__proposal-list {
    overflow-y: auto;
    max-height: min(62vh, 520px);
  }
}

/* Layout containment repair 2026-09: the composer is a normal flex child on
   desktop, so conversation and context columns cannot paint through it. */
@media (min-width: 761px) {
  .ai-workbench__columns {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .ai-workbench__columns.has-context {
    height: auto;
    min-height: 0;
  }

  .ai-workbench__composer {
    position: relative;
    inset: auto;
    z-index: 5;
  }
}
