:root {
  color-scheme: light;
  --canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-subtle: #f8f9fd;
  --surface-hover: #f1f3f9;
  --ink: #1d2545;
  --ink-soft: #414968;
  --muted: #747b93;
  --line: #e6e8f0;
  --line-strong: #d6d9e5;
  --accent: #23326d;
  --accent-dark: #172453;
  --accent-soft: #edf0fa;
  --blue: #ff6d00;
  --blue-soft: #fff0e6;
  --amber: #b85a00;
  --amber-soft: #fff4e8;
  --red: #b43b32;
  --red-soft: #fcebea;
  --success: #2d9279;
  --success-soft: #e8f5f1;
  --shadow: 0 14px 34px rgba(35, 50, 109, 0.1);
  font-family: "Quicksand", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

h1,
h2,
h3,
p,
ol,
ul,
pre {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

.studio-header {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(260px, 420px) minmax(430px, 1fr);
  align-items: center;
  gap: 18px;
  height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 3px 18px rgba(35, 50, 109, 0.05);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand-logo {
  display: block;
  width: 82px;
  height: auto;
}

.brand-divider {
  width: 1px;
  height: 28px;
  background: var(--line-strong);
}

.brand-name {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand-name strong {
  color: var(--accent);
  font-size: 13px;
  line-height: 1.2;
}

.brand-name small,
.product-trigger small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 10px 6px 12px;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.product-trigger:hover {
  border-color: var(--line-strong);
  background: var(--surface-subtle);
}

.product-trigger:focus-visible,
.icon-button:focus-visible,
.send-button:focus-visible,
.publish-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-command:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(255, 109, 0, 0.18);
}

.product-trigger > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-trigger strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-trigger svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.provider-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  margin-right: 4px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
}

.provider {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.provider-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa5aa;
}

.provider.ready .provider-dot {
  background: #2d9279;
  box-shadow: 0 0 0 2px rgba(45, 146, 121, 0.12);
}

.provider.offline .provider-dot,
.provider.missing .provider-dot,
.provider.error .provider-dot {
  background: #ca6b21;
}

.provider.disabled .provider-dot {
  background: #9aa5aa;
}

.icon-button,
.send-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 0;
  text-decoration: none;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--ink);
}

.icon-button.quiet {
  border-color: transparent;
  background: transparent;
}

.icon-button svg,
.send-button svg,
.publish-button svg,
.secondary-button svg,
.primary-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.publish-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 13px;
}

.publish-button,
.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.publish-button:hover,
.primary-button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.secondary-button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.studio-shell {
  display: grid;
  grid-template-columns: minmax(340px, 40%) minmax(0, 60%);
  height: calc(100vh - 72px);
  min-height: 520px;
  transition: grid-template-columns 180ms ease;
}

.conversation-pane,
.workflow-pane {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.conversation-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.pane-header,
.workflow-header {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 15px 22px;
}

.pane-header-actions,
.workflow-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-toggle,
.restore-conversation {
  width: 32px;
  height: 32px;
}

.restore-conversation {
  display: none;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pane-header h1,
.workflow-header h2,
.dialog-header h2 {
  font-size: 18px;
  font-weight: 740;
  line-height: 1.25;
}

.quiet-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.conversation-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 24px 18px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  gap: 11px;
  max-width: 760px;
  margin-bottom: 22px;
}

.message-avatar {
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border-radius: 7px;
  box-shadow: inset 0 -2px 0 var(--blue);
  font-size: 11px;
}

.message-content {
  min-width: 0;
  max-width: calc(100% - 42px);
}

.message-content p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.user-message {
  justify-content: flex-end;
  margin-left: auto;
}

.user-message .message-content {
  max-width: min(82%, 650px);
  border-radius: 8px 8px 2px 8px;
  background: var(--accent);
  padding: 12px 14px;
}

.user-message .message-content p {
  color: #f5f8f9;
}

.user-message .message-meta {
  color: #cbd1e7;
}

.failed-message .message-content {
  border-left: 3px solid var(--red);
  border-radius: 0 6px 6px 0;
  background: var(--red-soft);
  padding: 10px 12px;
}

.failed-message .message-content p,
.failed-message .text-command {
  color: var(--red);
}

.failed-message .text-command {
  min-height: 26px;
  margin-top: 5px;
}

.text-command {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 0;
}

.text-command:hover {
  color: var(--accent-dark);
}

.text-command svg {
  width: 15px;
  height: 15px;
}

.workflow-artifact-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(100%, 330px);
  min-height: 40px;
  margin-top: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
  text-align: left;
  padding: 8px 10px;
}

.workflow-artifact-link:hover {
  border-color: #9ba5ce;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.workflow-artifact-link > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--accent);
}

.workflow-artifact-link > span {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.workflow-artifact-link strong {
  font-size: 12px;
  font-weight: 750;
}

.workflow-artifact-link small {
  color: var(--muted);
  font-size: 10px;
}

.workflow-artifact-link .artifact-arrow {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.message-assets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 92px));
  gap: 7px;
  margin-top: 10px;
}

.message-asset {
  position: relative;
  min-width: 0;
  height: 70px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.message-asset img,
.message-asset video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-asset.file {
  display: grid;
  place-items: center;
  color: #e8eff1;
}

.message-asset.file svg {
  width: 22px;
  height: 22px;
}

.message-asset.voice {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  width: 100%;
  height: auto;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  padding: 10px;
}

.voice-player {
  display: grid;
  grid-template-columns: 32px minmax(70px, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.voice-play-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: var(--accent);
  padding: 0;
}

.voice-play-button:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.voice-play-button:focus-visible,
.voice-seek:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.voice-play-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.voice-seek {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.voice-seek::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.voice-seek::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  margin-top: -4px;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
}

.voice-seek::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.voice-seek::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
}

.voice-time {
  color: #d8dded;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.voice-transcript {
  display: grid;
  gap: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 9px;
}

.voice-transcript > span {
  color: #ffb47c;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.voice-transcript p {
  color: #ffffff;
  font-size: 12px;
  line-height: 1.45;
}

.voice-transcript.unavailable p {
  color: #d8dded;
}

.processing-message {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 10px 24px;
  color: var(--muted);
  font-size: 12px;
}

.thinking-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.thinking-mark span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: think 1s infinite ease-in-out;
}

.thinking-mark span:nth-child(2) {
  animation-delay: 120ms;
}

.thinking-mark span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes think {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.composer-wrap {
  flex: 0 0 auto;
  padding: 10px 18px 18px;
  background: var(--surface);
}

.composer {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(35, 50, 109, 0.06);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.composer:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(255, 109, 0, 0.12), 0 5px 18px rgba(35, 50, 109, 0.06);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 76px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  padding: 13px 14px 5px;
}

.composer textarea::placeholder {
  color: #95a0a5;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 47px;
  padding: 5px 8px 8px;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.send-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.send-button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.composer.voice-mode {
  border-color: #d79a94;
  background: #fffafa;
}

.composer.voice-mode textarea,
.composer.voice-mode .composer-toolbar {
  display: none;
}

.composer-wrap.voice-mode .attachment-tray {
  display: none;
}

.voice-composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 123px;
  padding: 16px;
}

.voice-capture-state,
.voice-state-copy,
.voice-meter {
  display: flex;
  align-items: center;
}

.voice-capture-state {
  min-width: 0;
  gap: 13px;
}

.voice-state-copy {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.voice-state-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.voice-state-copy small {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.voice-meter {
  justify-content: center;
  gap: 3px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--red-soft);
}

.voice-meter span {
  width: 3px;
  height: 9px;
  border-radius: 2px;
  background: var(--red);
  animation: voice-level 0.9s infinite ease-in-out alternate;
}

.voice-meter span:nth-child(2),
.voice-meter span:nth-child(4) {
  animation-delay: 140ms;
}

.voice-meter span:nth-child(3) {
  animation-delay: 280ms;
}

.voice-composer[data-phase="starting"] .voice-meter span,
.voice-composer[data-phase="processing"] .voice-meter span {
  animation-duration: 1.3s;
}

.voice-composer[data-phase="processing"] .voice-meter {
  background: var(--accent-soft);
}

.voice-composer[data-phase="processing"] .voice-meter span {
  background: var(--accent);
}

.voice-stop-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-color: var(--red);
  border-radius: 50%;
  background: var(--red);
  color: #ffffff;
}

.voice-stop-button:hover {
  border-color: #8e322d;
  background: #8e322d;
}

.voice-stop-button svg {
  width: 14px;
  height: 14px;
}

@keyframes voice-level {
  to { height: 22px; }
}

.attachment-tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 1px 9px;
}

.pending-asset {
  position: relative;
  flex: 0 0 96px;
  height: 76px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
}

.pending-asset img,
.pending-asset video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pending-file {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 8px;
  color: var(--ink-soft);
  text-align: center;
}

.pending-file svg {
  width: 21px;
  height: 21px;
  margin-bottom: 5px;
}

.pending-file span {
  width: 100%;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-asset-state {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 20px;
  border-radius: 4px;
  background: rgba(24, 33, 38, 0.82);
  color: #ffffff;
  font-size: 8px;
  font-weight: 720;
  padding: 3px 5px;
}

.pending-asset-state.ready {
  background: rgba(16, 84, 71, 0.9);
}

.pending-asset-state.failed {
  background: rgba(125, 44, 39, 0.92);
}

.pending-asset-state > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-asset-state svg {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
}

.pending-asset-state.uploading > svg {
  animation: upload-spin 0.9s linear infinite;
}

.pending-asset-state button {
  display: grid;
  width: 17px;
  height: 17px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  padding: 0;
}

@keyframes upload-spin {
  to { transform: rotate(360deg); }
}

.remove-asset {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(19, 29, 33, 0.78);
  color: #ffffff;
  padding: 0;
}

.remove-asset svg {
  width: 12px;
  height: 12px;
}

.action-status {
  margin: 0 2px 8px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
  padding: 8px 10px;
}

.action-status.pass {
  background: var(--success-soft);
  color: var(--success);
}

.action-status.blocked,
.action-status.retake {
  background: var(--red-soft);
  color: var(--red);
}

.workflow-pane {
  display: flex;
  flex-direction: column;
  background: var(--surface-subtle);
}

.workflow-pane.artifact-focus {
  box-shadow: inset 3px 0 0 var(--blue);
}

.workflow-header {
  min-height: 76px;
  padding: 13px 22px 11px;
}

.workflow-heading-wrap,
.workflow-summary {
  display: flex;
  align-items: center;
}

.workflow-heading-wrap {
  justify-content: space-between;
  gap: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  background: #e9edef;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
  padding: 4px 9px;
  white-space: nowrap;
}

.status-pill.draft {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.published {
  background: var(--success-soft);
  color: var(--success);
}

.workflow-summary {
  gap: 15px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.workflow-summary span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.workflow-summary strong {
  color: var(--ink-soft);
  font-weight: 750;
}

.workflow-summary svg {
  width: 12px;
  height: 12px;
  color: var(--success);
}

.workflow-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workflow-tabs button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  padding: 0 12px;
}

.workflow-tabs button::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  background: transparent;
  content: "";
}

.workflow-tabs button:hover,
.workflow-tabs button.active {
  color: var(--ink);
}

.workflow-tabs button.active::after {
  background: var(--blue);
}

.tab-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 999px;
  background: #e9edef;
  color: var(--ink-soft);
  font-size: 9px;
  padding: 0 5px;
}

.workflow-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 20px 22px 28px;
}

.tab-panel.active {
  display: block;
}

.workflow-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
}

.empty-icon svg {
  width: 20px;
  height: 20px;
}

.workflow-empty h3 {
  margin-bottom: 13px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.workflow-editor {
  display: grid;
  gap: 9px;
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.workflow-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 33, 38, 0.03);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.workflow-step:hover,
.workflow-step:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 5px 16px rgba(24, 33, 38, 0.06);
}

.workflow-step.dragging {
  opacity: 0.55;
}

.workflow-step.drag-over {
  border-color: var(--accent);
  transform: translateY(2px);
}

.workflow-step.is-updated {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(255, 109, 0, 0.1), 0 5px 16px rgba(35, 50, 109, 0.06);
  animation: workflow-step-update 1.7s ease-out;
}

.workflow-step.is-updated .step-number {
  color: var(--blue);
}

.step-change-chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 750;
}

@keyframes workflow-step-update {
  0% {
    background: var(--blue-soft);
  }
  100% {
    background: var(--surface);
  }
}

.step-rail {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  padding-top: 13px;
  border-right: 1px solid #edf0f1;
  color: #95a0a5;
}

.drag-handle {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  cursor: grab;
}

.drag-handle svg {
  width: 15px;
  height: 15px;
}

.step-number {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.step-body {
  min-width: 0;
  padding: 11px 12px 12px;
}

.step-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.step-title-input,
.step-instruction {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  outline: 0;
}

.step-title-input {
  min-width: 0;
  font-size: 13px;
  font-weight: 730;
  line-height: 1.35;
  padding: 5px 6px;
}

.step-instruction {
  display: block;
  min-height: 54px;
  margin-top: 4px;
  resize: vertical;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  padding: 6px;
}

.step-title-input:hover,
.step-instruction:hover {
  background: var(--surface-subtle);
}

.step-title-input:focus,
.step-instruction:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(255, 109, 0, 0.08);
}

.risk-select {
  width: 76px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background: #edf0f1;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 750;
  padding: 0 8px;
  text-transform: capitalize;
}

.risk-select.medium {
  background: var(--accent-soft);
  color: var(--accent);
}

.risk-select.high {
  background: var(--amber-soft);
  color: var(--amber);
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}

.step-actions button {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.step-actions button:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.step-actions button.danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

.step-actions svg {
  width: 14px;
  height: 14px;
}

.step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 23px;
  border-radius: 5px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 9px;
  padding: 3px 7px;
}

.meta-chip svg {
  width: 11px;
  height: 11px;
}

.workflow-canvas {
  width: min(900px, 100%);
  margin: 0 auto;
}

.flow-canvas-toolbar {
  position: sticky;
  top: -20px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 45px;
  margin: -8px -2px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 249, 253, 0.96);
  backdrop-filter: blur(8px);
}

.flow-mode-label,
.flow-toolbar-actions {
  display: flex;
  align-items: center;
}

.flow-mode-label {
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 720;
}

.flow-mode-label svg {
  width: 15px;
  height: 15px;
  color: var(--blue);
}

.flow-shape-badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 8px;
  font-weight: 760;
  padding: 2px 6px;
}

.flow-shape-badge.has-loops {
  border-color: #e0b06d;
  background: #fff7e8;
  color: #8d5818;
}

.flow-toolbar-actions {
  gap: 3px;
}

.flow-toolbar-actions .icon-button {
  width: 31px;
  height: 31px;
}

.flow-stage {
  --route-gutter: 0px;
  position: relative;
  width: min(700px, 100%);
  margin: 0 auto;
  padding: 2px 0 18px;
}

.flow-stage.has-rework-routes {
  padding-right: var(--route-gutter);
}

.workflow-links {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.workflow-rework-path {
  fill: none;
  stroke: #b77525;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.workflow-rework-origin {
  fill: var(--surface);
  stroke: #b77525;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.flow-terminal {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 34px;
  margin-right: auto;
  margin-left: auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 780;
  padding: 6px 12px;
}

.flow-terminal svg {
  width: 13px;
  height: 13px;
}

.flow-start {
  margin-bottom: 42px;
  border-color: #aeb7dc;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.flow-start::after {
  position: absolute;
  top: 100%;
  left: calc(50% - 1px);
  width: 2px;
  height: 43px;
  background: #aeb4ca;
  content: "";
}

.flow-complete {
  border-color: #ffb47c;
  background: var(--blue-soft);
  color: var(--blue);
}

.workflow-editor {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-step {
  display: block;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: none;
}

.workflow-step:hover,
.workflow-step:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.workflow-step.dragging {
  opacity: 0.45;
}

.workflow-step.drag-over {
  transform: none;
}

.workflow-step.drag-over .flow-node {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(255, 109, 0, 0.1);
}

.workflow-step.is-updated {
  border: 0;
  box-shadow: none;
  animation: none;
}

.workflow-step.is-updated .flow-node {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(255, 109, 0, 0.1), 0 8px 24px rgba(35, 50, 109, 0.08);
  animation: workflow-step-update 1.7s ease-out;
}

.flow-node {
  position: relative;
  z-index: 2;
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(35, 50, 109, 0.06);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.flow-node:hover {
  border-color: #b8bdd1;
  box-shadow: 0 8px 24px rgba(35, 50, 109, 0.09);
}

.workflow-step.is-selected .flow-node {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(255, 109, 0, 0.09), 0 10px 28px rgba(35, 50, 109, 0.09);
}

.workflow-step.has-rework .flow-node {
  border-right-color: #c88b3f;
}

.flow-node::before,
.flow-node::after {
  position: absolute;
  left: calc(50% - 4px);
  z-index: 3;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #9da4bd;
  content: "";
}

.flow-node::before {
  top: -4px;
}

.flow-node::after {
  bottom: -4px;
}

.flow-node-summary {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 68px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
}

.flow-node-summary:hover {
  background: var(--surface-subtle);
}

.flow-node-kind {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-hover);
  color: var(--ink-soft);
}

.flow-node-kind svg {
  width: 16px;
  height: 16px;
}

.flow-node-kind.evidence {
  background: var(--blue-soft);
  color: var(--blue);
}

.flow-node-kind.validation {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.flow-node-kind.critical {
  background: var(--amber-soft);
  color: var(--amber);
}

.flow-node-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.flow-node-copy small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 760;
  line-height: 1.2;
  text-transform: uppercase;
}

.flow-node-copy strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.flow-node-copy > span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.flow-node-summary-meta {
  display: flex;
  align-items: center;
  gap: 7px;
}

.flow-node-summary-meta > svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.node-risk,
.node-change {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 780;
  padding: 3px 7px;
  text-transform: capitalize;
}

.node-risk {
  background: #edf0f1;
  color: var(--ink-soft);
}

.node-risk.medium {
  background: var(--accent-soft);
  color: var(--accent);
}

.node-risk.high {
  background: var(--amber-soft);
  color: var(--amber);
}

.node-change {
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.flow-node-routes {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 34px;
  border-top: 1px solid #edf0f1;
  background: #fbfcfc;
  padding: 6px 12px;
}

.flow-route {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.flow-route > svg {
  width: 11px;
  height: 11px;
}

.flow-route > svg:nth-of-type(2) {
  width: 10px;
  color: #9ba6aa;
}

.flow-route strong {
  overflow: hidden;
  max-width: 100px;
  color: var(--ink-soft);
  font-size: 8px;
  text-overflow: ellipsis;
}

.flow-route.pass > svg:first-child {
  color: var(--success);
}

.flow-route.fail > svg:first-child {
  color: var(--amber);
}

.flow-node-editor {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0 14px 12px;
}

.flow-editor-section {
  display: grid;
  gap: 9px;
  padding: 13px 0;
  border-bottom: 1px solid #edf0f1;
}

.flow-editor-section h3 {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 780;
}

.node-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 680;
}

.node-field input,
.node-field select,
.node-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  outline: 0;
  font-size: 11px;
  line-height: 1.45;
  padding: 7px 8px;
}

.node-field input,
.node-field select {
  height: 34px;
}

.node-field textarea {
  min-height: 58px;
  resize: vertical;
}

.node-field input:hover,
.node-field select:hover,
.node-field textarea:hover {
  border-color: var(--line-strong);
}

.node-field input:focus,
.node-field select:focus,
.node-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(255, 109, 0, 0.08);
}

.step-title-input,
.step-instruction {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  padding: 7px 8px;
}

.step-title-input {
  font-size: 11px;
  font-weight: 650;
}

.step-instruction {
  min-height: 72px;
  color: var(--ink-soft);
  font-size: 11px;
}

.node-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.node-editor-settings {
  grid-template-columns: minmax(80px, 1fr) minmax(68px, 0.7fr) minmax(92px, 0.9fr);
}

.node-toggle-field {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 680;
  padding: 7px 8px;
}

.node-toggle-field input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.flow-node-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 11px;
}

.node-drag-handle {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  padding: 0;
}

.node-drag-handle:hover {
  border-color: var(--line);
  background: var(--surface-hover);
  color: var(--ink-soft);
}

.node-drag-handle svg {
  width: 15px;
  height: 15px;
}

.flow-node-editor-footer .step-actions {
  display: flex;
  grid-column: auto;
  justify-content: flex-end;
}

.flow-connector {
  position: relative;
  height: 42px;
}

.flow-connector-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 1px);
  width: 2px;
  background: #aeb4ca;
}

.flow-insert-step {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #abb2ca;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  opacity: 0.35;
  padding: 0;
  transform: translate(-50%, -50%);
  transition: opacity 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.workflow-step:hover .flow-insert-step,
.flow-insert-step:focus-visible,
.flow-insert-step:hover {
  box-shadow: 0 3px 9px rgba(24, 33, 38, 0.1);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.06);
}

.flow-insert-step svg {
  width: 13px;
  height: 13px;
}

.review-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: min(900px, 100%);
  margin: 0 auto;
}

.review-columns > section {
  min-width: 0;
}

.review-columns header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink-soft);
}

.review-columns header svg {
  width: 17px;
  height: 17px;
  color: var(--amber);
}

.review-columns section:last-child header svg {
  color: var(--blue);
}

.review-columns h3 {
  font-size: 13px;
}

.review-list {
  display: grid;
  gap: 7px;
  padding: 0;
  list-style: none;
}

.review-list li {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 11px;
}

.source-history {
  display: grid;
  gap: 18px;
  width: min(820px, 100%);
  margin: 0 auto;
}

.source-entry {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.source-time {
  color: var(--muted);
  font-size: 10px;
  padding-top: 2px;
}

.source-detail {
  min-width: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.source-detail p {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.source-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.source-asset-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 10px;
  padding: 5px 8px;
  text-decoration: none;
}

.source-asset-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-asset-link svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
}

.source-change-set {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfc;
}

.source-change-set summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  padding: 7px 9px;
  list-style: none;
}

.source-change-set summary::-webkit-details-marker {
  display: none;
}

.source-change-set summary svg {
  width: 13px;
  height: 13px;
  margin-left: auto;
  transition: transform 140ms ease;
}

.source-change-set[open] summary svg {
  transform: rotate(180deg);
}

.source-change-mode {
  color: var(--accent-dark);
  font-weight: 760;
}

.source-change-list {
  display: grid;
  gap: 5px;
  max-height: 260px;
  margin: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 8px 9px;
  list-style: none;
}

.source-change-list li {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  min-width: 0;
}

.source-change-list code {
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.45;
}

.source-change-detail {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.source-change-detail small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font: 8px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.source-change-operation {
  border-radius: 4px;
  background: #e9eeef;
  color: var(--muted);
  font-size: 8px;
  font-weight: 760;
  padding: 2px 4px;
  text-align: center;
  text-transform: capitalize;
}

.source-change-operation.add {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.source-change-operation.remove {
  background: #fbeceb;
  color: #9a3f39;
}

.source-change-operation.reorder {
  background: var(--blue-soft);
  color: var(--blue);
}

.json-view {
  width: min(980px, 100%);
  min-height: 100%;
  margin: 0 auto;
  overflow: auto;
  border: 1px solid #354478;
  border-radius: 8px;
  background: #172453;
  color: #edf0fa;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.product-dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(24, 33, 38, 0.24);
  color: var(--ink);
  padding: 0;
}

.product-dialog::backdrop {
  background: rgba(23, 36, 83, 0.42);
}

.product-dialog form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.publish-review-content {
  display: grid;
  gap: 16px;
  overflow-y: auto;
  padding: 18px 19px;
}

.publish-review-content > p {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.publish-review-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.publish-review-lists > section {
  min-width: 0;
}

.publish-review-lists header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--ink-soft);
}

.publish-review-lists header svg {
  width: 16px;
  height: 16px;
  color: var(--amber);
}

.publish-review-lists section:last-child header svg {
  color: var(--blue);
}

.publish-review-lists h3 {
  font-size: 12px;
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 17px 19px;
}

.dialog-header {
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.product-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  padding: 18px 19px;
}

.product-fields label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 680;
}

.product-fields select,
.product-fields input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  padding: 0 10px;
}

.product-fields select:focus,
.product-fields input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(255, 109, 0, 0.1);
}

.recent-section {
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding: 15px 19px 18px;
}

.dialog-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.dialog-section-title h3 {
  font-size: 12px;
}

.dialog-section-title span {
  color: var(--muted);
  font-size: 10px;
}

.recent-workflows {
  display: grid;
  gap: 6px;
}

.recent-workflow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 7px 10px;
  text-align: left;
}

.recent-workflow:hover {
  background: var(--surface-subtle);
}

.recent-workflow > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.recent-workflow strong,
.recent-workflow small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-workflow strong {
  font-size: 12px;
}

.recent-workflow small {
  color: var(--muted);
  font-size: 10px;
}

.recent-workflow svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(390px, calc(100vw - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--accent);
  box-shadow: var(--shadow);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.45;
  padding: 11px 13px;
}

.toast.error {
  border-color: #d5827b;
  background: #7d2c27;
}

@media (max-width: 1180px) {
  .studio-header {
    grid-template-columns: minmax(180px, 1fr) minmax(230px, 340px) auto;
  }

  .provider span:not(.provider-dot) {
    display: none;
  }

  .provider-strip {
    gap: 8px;
    padding: 0 9px;
  }

  .studio-shell {
    grid-template-columns: minmax(320px, 40%) minmax(0, 60%);
  }
}

@media (min-width: 761px) {
  .studio-shell.chat-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .studio-shell.chat-collapsed .conversation-pane {
    visibility: hidden;
    overflow: hidden;
    border-right: 0;
    opacity: 0;
    pointer-events: none;
  }

  .studio-shell.chat-collapsed .restore-conversation {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  body {
    overflow: hidden;
  }

  .studio-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    height: 62px;
    padding: 0 12px;
  }

  .brand-name small,
  .provider-strip,
  .header-actions > .runtime-link,
  .publish-button span {
    display: none;
  }

  .product-trigger {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
  }

  .publish-button {
    width: 38px;
    padding: 0;
  }

  .studio-shell {
    height: calc(100vh - 62px);
  }
}

@media (max-width: 760px) {
  .studio-shell {
    display: grid;
    grid-template-columns: minmax(0, 44%) minmax(0, 56%);
    height: calc(100vh - 62px);
    min-height: 0;
  }

  .conversation-pane,
  .workflow-pane {
    position: static;
    display: flex;
    width: auto;
    height: 100%;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
  }

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

  .pane-toggle,
  .restore-conversation {
    display: none !important;
  }

  .pane-header,
  .workflow-header {
    min-height: 58px;
    padding: 9px 10px;
  }

  .pane-header {
    gap: 8px;
  }

  .pane-header h1,
  .workflow-header h2 {
    font-size: 14px;
  }

  .section-kicker {
    font-size: 8px;
  }

  .quiet-count {
    display: none;
  }

  .conversation-thread {
    padding: 14px 10px 10px;
  }

  .message {
    gap: 7px;
    margin-bottom: 16px;
  }

  .message-avatar {
    width: 25px;
    height: 25px;
    border-radius: 6px;
    font-size: 9px;
  }

  .message-content {
    max-width: calc(100% - 32px);
  }

  .message-content p {
    font-size: 12px;
    line-height: 1.48;
  }

  .user-message .message-content {
    max-width: 92%;
    padding: 9px 10px;
  }

  .workflow-artifact-link {
    width: 100%;
    min-height: 36px;
    padding: 7px 8px;
  }

  .composer-wrap {
    padding: 7px 7px max(7px, env(safe-area-inset-bottom));
  }

  .composer textarea {
    min-height: 64px;
    font-size: 12px;
    padding: 10px 10px 3px;
  }

  .workflow-tabs {
    gap: 0;
    overflow-x: auto;
    padding: 0 3px;
  }

  .workflow-tabs button {
    height: 40px;
    font-size: 10px;
    padding: 0 6px;
  }

  .tab-panel {
    padding: 10px 7px 18px;
  }

  .workflow-editor {
    gap: 7px;
  }

  .workflow-step {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .step-rail {
    gap: 3px;
    padding-top: 8px;
  }

  .drag-handle {
    width: 22px;
    height: 22px;
  }

  .step-body {
    padding: 7px 7px 8px;
  }

  .step-topline {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .step-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .step-title-input {
    font-size: 11px;
    padding: 4px;
  }

  .step-instruction {
    min-height: 48px;
    font-size: 10.5px;
    padding: 4px;
  }

  .risk-select {
    width: 58px;
    height: 25px;
    padding: 0 5px;
    font-size: 8px;
  }

  .step-actions button {
    width: 24px;
    height: 24px;
  }

  .meta-chip {
    font-size: 8px;
    padding: 2px 5px;
  }

  .workflow-summary {
    gap: 7px;
    font-size: 8px;
  }

  .workflow-summary #save-state {
    display: none;
  }
}

@media (max-width: 620px) {
  .review-columns {
    grid-template-columns: 1fr;
  }

  .source-entry {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .product-fields {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .publish-review-lists {
    grid-template-columns: 1fr;
  }

  .message-assets {
    grid-template-columns: repeat(2, minmax(0, 92px));
  }
}

@media (max-width: 420px) {
  .studio-shell {
    grid-template-columns: minmax(0, 43%) minmax(0, 57%);
  }

  .flow-canvas-toolbar {
    top: -10px;
    min-height: 42px;
    margin-bottom: 11px;
  }

  .flow-mode-label {
    gap: 5px;
    font-size: 9px;
  }

  .flow-mode-label svg {
    width: 13px;
    height: 13px;
  }

  .flow-toolbar-actions .icon-button {
    width: 27px;
    height: 27px;
  }

  .flow-node-summary {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 7px;
    min-height: 78px;
    padding: 8px;
  }

  .flow-node-kind {
    grid-row: 1 / span 2;
    width: 28px;
    height: 28px;
  }

  .flow-node-kind svg {
    width: 14px;
    height: 14px;
  }

  .flow-node-copy strong {
    font-size: 11px;
  }

  .flow-node-summary-meta {
    grid-column: 2;
    justify-content: flex-start;
    gap: 5px;
  }

  .node-risk,
  .node-change {
    min-height: 19px;
    padding: 2px 6px;
  }

  .flow-node-routes {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 7px 9px;
  }

  .flow-route strong {
    max-width: 76px;
  }

  .flow-node-editor {
    padding-right: 8px;
    padding-left: 8px;
  }

  .node-editor-grid,
  .node-editor-settings {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .flow-node-editor-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .flow-node-editor-footer .step-actions {
    align-self: flex-end;
  }

  .flow-terminal {
    min-height: 30px;
    font-size: 9px;
    padding: 5px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
