/* SaaS page and feature layouts. Shared tokens, components and shell are separate. */

.saas-route-index .shell > .hero {
  display: none;
}

.saas-route-index .shell > .card {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.saas-route-index .home-tabs {
  display: none;
}

.saas-route-index .home-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.saas-route-index .platform-overview-panel {
  border: 0;
  background: var(--bg);
  box-shadow: none;
}

/* Keep configuration workspaces content-sized inside the viewport-height panel.
   The legacy grid otherwise stretches every row and turns compact controls into
   disproportionately tall bands. */
body.saas-app
  .workspace-tab-panel:not([data-workspace-panel="chat"])
  > .card.panel
  > .body {
  align-content: start;
  grid-auto-rows: max-content;
  gap: 12px;
  padding: 18px 20px 22px;
}

body.saas-app
  .workspace-tab-panel:is(
    [data-workspace-panel="mcp"],
    [data-workspace-panel="skill-studio"]
  )
  .management-section {
  align-content: start;
  grid-auto-rows: max-content;
  gap: 12px;
}

body.saas-app [data-workspace-panel="mcp"] .management-policy-bar {
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
}

body.saas-app
  .workspace-tab-panel:is(
    [data-workspace-panel="mcp"],
    [data-workspace-panel="skill-studio"]
  )
  .management-toolbar {
  min-height: 0;
  gap: 10px;
  padding-bottom: 0;
}

body.saas-app
  .workspace-tab-panel:is(
    [data-workspace-panel="prompt-studio"],
    [data-workspace-panel="skill-policy"]
  )
  > .card.panel
  > .body
  > .row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.saas-app
  .workspace-tab-panel:is(
    [data-workspace-panel="prompt-studio"],
    [data-workspace-panel="skill-policy"]
  )
  > .card.panel
  > .body
  > .row
  > button {
  width: auto;
}

.platform-overview-panel {
  background: var(--bg);
}

.platform-overview {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.platform-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.platform-page-header h1,
.platform-page-header h2 {
  margin-top: 5px;
  font-size: 26px;
}

.platform-page-header p {
  margin: 4px 0 0;
  color: var(--text-tertiary);
}

.platform-breadcrumb {
  color: var(--text-tertiary);
  font-size: 12px;
}

.platform-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.platform-kpi {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.platform-kpi-icon {
  width: 48px;
  height: 48px;
  display: grid;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 11px;
  font-size: 19px;
  font-weight: 750;
}

.platform-kpi-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.platform-kpi-icon.indigo {
  background: #eef2ff;
  color: #4f46e5;
}

.platform-kpi-icon.blue {
  background: #eff6ff;
  color: #2563eb;
}

.platform-kpi-icon.green {
  background: #ecfdf5;
  color: #059669;
}

.platform-kpi-icon.amber {
  background: #fffbeb;
  color: #d97706;
}

.platform-kpi div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.platform-kpi span:not(.platform-kpi-icon) {
  color: var(--text-secondary);
  font-size: 13px;
}

.platform-kpi strong {
  color: var(--text);
  font-size: 27px;
  font-weight: 680;
  line-height: 1.1;
}

.platform-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.72fr);
  gap: 16px;
}

.platform-dashboard-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.platform-card-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-subtle);
}

.platform-card-head h3 {
  font-size: 15px;
}

.platform-card-head div > span {
  display: block;
  margin-top: 3px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.platform-chart-legend {
  display: flex;
  gap: 14px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.platform-chart-legend span {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
}

.platform-chart-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.platform-chart-legend i.success {
  background: #059669;
}

.platform-chart-legend i.failed {
  background: #ef4444;
}

.platform-chart-canvas {
  min-height: 232px;
  padding: 16px 18px 12px;
}

.platform-chart-canvas svg {
  width: 100%;
  height: 204px;
  overflow: visible;
}

.platform-chart-grid-line {
  stroke: #eef0f3;
  stroke-width: 1;
}

.platform-chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.platform-chart-line.success {
  stroke: #059669;
}

.platform-chart-line.failed {
  stroke: #ef4444;
}

.platform-chart-point {
  fill: #ffffff;
  stroke-width: 2;
}

.platform-chart-point.success {
  stroke: #059669;
}

.platform-chart-point.failed {
  stroke: #ef4444;
}

.platform-chart-label {
  fill: #6b7280;
  font: 10px Inter, "Noto Sans SC", sans-serif;
}

.platform-health-list {
  display: grid;
  padding: 14px 18px 18px;
}

.platform-health-list > div {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-subtle);
}

.platform-health-list > div:last-child {
  border-bottom: 0;
}

.platform-health-list span {
  color: var(--text-secondary);
  font-size: 13px;
}

.platform-health-list strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.platform-health-list strong.ok {
  color: var(--ok);
}

.platform-runs-card .management-table-wrap {
  border: 0;
  border-radius: 0 0 10px 10px;
}

.platform-runs-table {
  min-width: 680px;
}

.platform-runs-table td,
.platform-runs-table th {
  padding: 10px 14px;
}

.platform-resource-list {
  display: grid;
  padding: 8px 18px;
}

.platform-resource-row {
  min-height: 45px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line-subtle);
}

.platform-resource-row:last-child {
  border-bottom: 0;
}

.platform-resource-type {
  min-width: 46px;
  padding: 3px 6px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
}

.platform-resource-row span:nth-child(2) {
  color: var(--text-secondary);
  font-size: 13px;
}

.platform-resource-row strong {
  font-size: 16px;
}

.platform-card-action {
  width: calc(100% - 36px);
  margin: 12px 18px 18px;
}

.run-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 11px;
  white-space: nowrap;
}

.run-status-chip.completed {
  background: #ecfdf5;
  color: #047857;
}

.run-status-chip.running,
.run-status-chip.permission_required,
.run-status-chip.user_input_required {
  background: #eef2ff;
  color: #4338ca;
}

.run-status-chip.failed,
.run-status-chip.stopped {
  background: #fef2f2;
  color: #b91c1c;
}

.resource-governance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.saas-route-index .resource-overview-strip {
  display: none;
}

.saas-route-index #resource-tabs {
  gap: 24px;
  padding: 0 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

body.saas-app.saas-route-index #resource-tabs button,
body.saas-app.saas-route-index #resource-tabs button:hover:not(:disabled) {
  position: relative;
  min-height: 48px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}

body.saas-app.saas-route-index #resource-tabs button.active {
  background: transparent;
  color: var(--brand);
  font-weight: 620;
}

body.saas-app.saas-route-index #resource-tabs button.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
  content: "";
}

.resource-governance-kpi {
  min-height: 82px;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
}

.resource-governance-kpi span {
  color: var(--text-tertiary);
  font-size: 12px;
}

.resource-governance-kpi strong {
  font-size: 23px;
  font-weight: 680;
}

.unified-resource-table {
  min-width: 980px;
}

.resource-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 620;
}

.resource-type-badge.mcp {
  background: #f5f3ff;
  color: #6d28d9;
}

.resource-type-badge.skill {
  background: #fff7ed;
  color: #c2410c;
}

.resource-type-badge.cli {
  background: #ecfeff;
  color: #0e7490;
}

.resource-type-badge.model {
  background: #eff6ff;
  color: #1d4ed8;
}

.platform-empty {
  padding: 28px 16px !important;
  color: var(--text-tertiary);
  text-align: center !important;
}

.agent-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-enabled-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #a7f3d0;
  border-radius: 5px;
  background: #ecfdf5;
  color: #047857;
  font-size: 11px;
  font-weight: 620;
  white-space: nowrap;
}

.agent-runtime-meta {
  color: var(--text-tertiary);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.agent-hero-side {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.agent-hero-side > .sub {
  grid-column: 1;
}

#hero-config-agent-btn {
  grid-column: 2;
  grid-row: 1;
}

.saas-route-agent .agent-hero-side > .sub {
  display: none;
}

/*
 * Agent workbench height contract:
 * - the application shell is locked to the dynamic viewport;
 * - the workbench header remains outside the scrolling content row;
 * - desktop chat columns own their vertical scrolling independently.
 */
body.saas-app.saas-route-agent {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: var(--saas-topbar-height) minmax(0, 1fr);
  overflow: hidden;
}

body.saas-app.saas-route-agent > .workspace.saas-page {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  padding-bottom: 24px;
  overflow: hidden;
}

body.saas-app.saas-route-agent .workspace > .hero {
  position: sticky;
  z-index: 20;
  top: 0;
  margin-bottom: 18px;
  background: var(--layout-bg);
}

body.saas-app.saas-route-agent .workspace-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.saas-app.saas-route-agent [data-workspace-panel="chat"].active,
body.saas-app.saas-route-agent [data-workspace-panel="chat"].active > .chat-workspace {
  height: 100%;
  min-height: 0;
}

body.saas-app button.conversation-list-main,
body.saas-app button.conversation-list-main:hover:not(:disabled),
body.saas-app button.conversation-menu-trigger,
body.saas-app button.conversation-menu-trigger:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
  color: var(--text);
}

body.saas-app button.conversation-menu-trigger {
  color: var(--text-tertiary);
}

body.saas-app .chat-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(210px, 230px) minmax(520px, 1fr) minmax(300px, 330px);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

body.saas-app .chat-workspace > * {
  min-width: 0;
}

body.saas-app .chat-workspace > .card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.saas-app .conversation-sidebar {
  height: 100%;
  min-height: 0;
  max-height: none;
  border-right: 1px solid var(--line) !important;
}

body.saas-app .conversation-sidebar-head {
  border-color: var(--line);
  background: #ffffff;
}

body.saas-app .conversation-list-item {
  border-radius: 7px;
}

body.saas-app .conversation-list-item:hover {
  background: #f9fafb;
}

body.saas-app .conversation-list-item.active {
  border-color: #c7d2fe;
  background: #eef2ff;
}

body.saas-app .conversation-list-main {
  border-radius: 6px;
}

body.saas-app button.conversation-list-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: stretch;
  justify-items: start;
  gap: 4px;
}

body.saas-app .conversation-list-name {
  display: block;
  width: 100%;
  font-family: Inter, "Noto Sans SC", sans-serif;
  font-weight: 580;
}

body.saas-app .conversation-list-meta,
body.saas-app .conversation-count {
  font-family: Inter, "Noto Sans SC", sans-serif;
}

body.saas-app .conversation-list-meta {
  display: block;
  width: 100%;
  white-space: nowrap;
}

body.saas-app .chat {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line) !important;
}

body.saas-app .chat > .head {
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 12px;
}

body.saas-app .chat-fullscreen-toggle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  flex: 0 0 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-secondary);
  box-shadow: none;
}

body.saas-app .chat-fullscreen-toggle:hover:not(:disabled),
body.saas-app .chat-fullscreen-toggle:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
}

body.saas-app .chat-fullscreen-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.saas-app .chat-fullscreen-toggle svg[hidden] {
  display: none;
}

body.saas-app .chat.chat-browser-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff;
  box-shadow: none;
}

body.saas-app .chat.chat-browser-fullscreen > .head {
  padding-inline: clamp(18px, 3vw, 48px);
}

body.saas-app .chat.chat-browser-fullscreen .chat-log {
  padding-inline: clamp(18px, 5vw, 80px);
}

body.saas-app .chat.chat-browser-fullscreen .composer {
  padding-inline: clamp(18px, 5vw, 80px);
}

body.saas-app .chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #fbfcfe;
}

body.saas-app .msg {
  border-radius: 9px;
}

body.saas-app .msg.user {
  max-width: 80%;
  background: #eef2ff;
  color: #1f2937;
  box-shadow: none;
}

body.saas-app .msg.assistant {
  max-width: 94%;
  border-color: var(--line);
  background: #ffffff;
}

body.saas-app .reasoning-overview,
body.saas-app .trace-step,
body.saas-app .stream-panel,
body.saas-app .permission-request {
  border-color: var(--line);
  border-radius: 7px;
  background: #ffffff;
}

body.saas-app .permission-request {
  border-color: #fed7aa;
  background: #fffaf2;
}

body.saas-app .permission-request pre {
  border: 1px solid #fed7aa;
  border-radius: 6px;
  background: #ffffff;
}

body.saas-app .composer {
  flex: 0 0 auto;
  min-height: 0;
  max-height: calc(100% - 220px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  border-color: var(--line);
}

body.saas-app .composer textarea#message {
  min-height: 82px;
}

body.saas-app .chat-control-bar {
  display: grid;
  grid-template-columns: minmax(176px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

body.saas-app .chat-mode-field {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(118px, 1fr);
  align-items: center;
  gap: 8px;
}

body.saas-app .chat-mode-field label {
  margin: 0;
  white-space: nowrap;
  font-size: 12px;
}

body.saas-app .chat-mode-field select {
  height: 36px;
  min-width: 0;
  min-height: 36px;
  padding-block: 7px;
}

body.saas-app .chat-mode-field .select-control {
  height: 36px;
}

body.saas-app .chat-option-group {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.saas-app .chat-control-bar .check {
  height: 36px;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
}

body.saas-app .chat-control-bar .check input {
  margin: 0;
}

body.saas-app .chat-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

body.saas-app .chat-control-bar .chat-actions button {
  min-height: 36px;
  padding: 8px 11px;
  white-space: nowrap;
  font-size: 12px;
}

body.saas-app #ask-btn {
  min-width: 104px;
}

body.saas-app .composer[data-composer-mode="direction"] textarea#message {
  border-color: #8f82ed;
  background: #faf9ff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

body.saas-app #ask-btn[data-composer-action="direction"] {
  min-width: 112px;
}

body.saas-app .chat-control-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.execution-inspector {
  min-width: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #ffffff;
}

.execution-inspector-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.execution-inspector-head h2 {
  font-size: 15px;
}

.execution-inspector-head div > span {
  display: block;
  max-width: 170px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-tertiary);
  font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.execution-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}

.execution-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
}

.execution-state.running,
.execution-state.waiting {
  color: #047857;
}

.execution-state.running i {
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  animation: execution-pulse 1.4s ease-in-out infinite;
}

.execution-state.waiting {
  color: #b45309;
}

.execution-state.waiting i {
  background: #f59e0b;
}

.execution-state.completed {
  color: #047857;
}

.execution-state.completed i {
  background: #10b981;
}

.execution-state.failed,
.execution-state.stopped {
  color: #b91c1c;
}

.execution-state.failed i,
.execution-state.stopped i {
  background: #ef4444;
}

@keyframes execution-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.execution-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-subtle);
}

.execution-metrics > div {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.execution-metrics span {
  color: var(--text-tertiary);
  font-size: 10px;
}

.execution-metrics strong {
  font-size: 16px;
  font-weight: 650;
}

.execution-timeline {
  min-height: 160px;
  display: grid;
  align-content: start;
  gap: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-subtle);
}

.execution-empty {
  padding: 20px 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.execution-step {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  min-height: 52px;
}

.execution-step:not(:last-child)::after {
  position: absolute;
  top: 24px;
  bottom: 0;
  left: 11px;
  width: 1px;
  background: #e5e7eb;
  content: "";
}

.execution-step-index {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  color: #6b7280;
  font-size: 10px;
  font-weight: 650;
}

.execution-step.completed .execution-step-index {
  border-color: #10b981;
  background: #059669;
  color: #ffffff;
}

.execution-step.running .execution-step-index {
  border-color: #6366f1;
  background: #4f46e5;
  color: #ffffff;
}

.execution-step.failed .execution-step-index {
  border-color: #ef4444;
  background: #dc2626;
  color: #ffffff;
}

.execution-step-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding-top: 2px;
}

.execution-step-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.execution-step-copy code,
.execution-step-copy span {
  overflow: hidden;
  color: var(--text-tertiary);
  font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.execution-step-status {
  padding-top: 3px;
  color: var(--text-tertiary);
  font-size: 10px;
  white-space: nowrap;
}

.execution-step.completed .execution-step-status {
  color: var(--ok);
}

.execution-step.running .execution-step-status {
  color: var(--brand);
}

.execution-step.failed .execution-step-status {
  color: var(--error);
}

.execution-evidence {
  display: grid;
  padding: 8px 14px;
}

.execution-evidence details {
  border-bottom: 1px solid var(--line-subtle);
}

.execution-evidence summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.execution-evidence summary::-webkit-details-marker {
  display: none;
}

.execution-evidence summary::after {
  color: #9ca3af;
  content: "›";
  font-size: 17px;
  transition: transform 0.15s ease;
}

.execution-evidence details[open] summary::after {
  transform: rotate(90deg);
}

.execution-evidence summary span {
  margin-left: auto;
  color: #9ca3af;
  font-size: 10px;
}

.execution-evidence details > div {
  max-height: 150px;
  padding: 0 4px 10px;
  overflow: auto;
  color: var(--text-tertiary);
  font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.execution-retention-note {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: auto 14px 14px;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  background: #eff6ff;
  color: #475569;
  font-size: 10px;
}

.execution-retention-note span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
}

.run-record-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.run-record-summary article {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.run-record-summary span {
  color: var(--text-tertiary);
  font-size: 11px;
}

.run-record-summary strong {
  font-size: 20px;
  font-weight: 670;
}

.run-record-table {
  min-width: 1040px;
}

.run-record-table .run-record-title {
  max-width: 230px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-record-detail-body,
.run-record-detail-body .management-modal-panel {
  min-height: 0;
}

.run-record-conversation,
.run-record-reasoning,
.run-record-execution,
.run-record-log-list {
  display: grid;
  gap: 14px;
}

.run-record-conversation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--text-tertiary);
  font-size: 11px;
}

.run-record-message {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
}

.run-record-message.user {
  margin-left: min(12%, 96px);
  border-color: #c7d2fe;
  background: #eef2ff;
}

.run-record-message-label {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 650;
}

.run-record-message-body {
  min-width: 0;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.run-record-message.assistant .run-record-message-body {
  white-space: normal;
}

.run-record-detail-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.run-record-detail-metrics article {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.run-record-detail-metrics span {
  color: var(--text-tertiary);
  font-size: 10px;
}

.run-record-detail-metrics strong {
  font-size: 17px;
  font-weight: 650;
}

.run-record-execution details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.run-record-execution summary {
  min-height: 44px;
  padding: 11px 14px;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
}

.run-record-execution pre {
  max-height: 320px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-top: 1px solid var(--line-subtle);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.run-record-log-list .debug-log-item {
  margin: 0;
}

.run-record-detail-empty {
  padding: 32px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--text-tertiary);
  text-align: center;
}

.saas-search-hit {
  animation: saas-search-pulse 1.6s ease;
}

@keyframes saas-search-pulse {
  0%,
  100% {
    box-shadow: none;
  }
  25%,
  75% {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
  }
}

@media (max-width: 1320px) {
  body.saas-app.saas-route-agent [data-workspace-panel="chat"].active,
  body.saas-app.saas-route-agent [data-workspace-panel="chat"].active > .chat-workspace {
    height: auto;
  }

  body.saas-app .chat-workspace {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto auto;
    overflow: visible;
  }

  body.saas-app.saas-route-agent .conversation-sidebar,
  body.saas-app.saas-route-agent .chat {
    height: clamp(560px, calc(100dvh - 170px), 760px);
  }

  .execution-inspector {
    grid-column: 1 / -1;
    height: auto;
    min-height: 0;
    max-height: 560px;
    border-top: 1px solid var(--line);
  }

  .execution-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
  }
}

@media (max-width: 1180px) {
  .platform-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .platform-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .run-record-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .run-record-detail-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  body.saas-app.saas-route-agent > .workspace.saas-page {
    height: calc(100vh - var(--saas-topbar-height));
    height: calc(100dvh - var(--saas-topbar-height));
  }

  body.saas-app.saas-route-agent .workspace > .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
  }

  body.saas-app.saas-route-agent .hero-head {
    min-width: 0;
    align-items: flex-start;
    flex-wrap: nowrap;
  }

  body.saas-app.saas-route-agent .hero-copy,
  body.saas-app.saas-route-agent .agent-title-row {
    min-width: 0;
  }

  body.saas-app.saas-route-agent .agent-title-row {
    align-items: flex-start;
  }

  body.saas-app.saas-route-agent .agent-hero-side {
    width: auto;
    min-width: 0;
    justify-items: end;
  }

  .platform-overview {
    padding: 16px;
  }

  .resource-governance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.saas-app .chat-workspace {
    grid-template-columns: 1fr;
  }

  body.saas-app .conversation-sidebar {
    height: auto;
    min-height: 0;
    max-height: 300px;
    border-right: 0 !important;
    border-bottom: 1px solid var(--line) !important;
  }

  body.saas-app .chat {
    height: clamp(560px, calc(100dvh - 150px), 720px);
    min-height: 620px;
    border-right: 0 !important;
  }

  body.saas-app .chat-control-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  body.saas-app .chat-mode-field,
  body.saas-app .chat-option-group,
  body.saas-app .chat-actions {
    grid-column: 1;
  }

  body.saas-app .chat-option-group {
    flex-wrap: wrap;
  }

  .run-record-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .run-record-detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  body.saas-app.saas-route-agent .workspace > .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  body.saas-app.saas-route-agent .agent-hero-side {
    grid-column: 1;
    justify-items: start;
    padding-left: 50px;
  }

  .platform-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .platform-kpi-grid,
  .resource-governance-summary {
    grid-template-columns: 1fr;
  }
}
