:root {
  --viewer-bg: #f4efe7;
  --viewer-panel: #fffdf9;
  --viewer-ink: #1b1f23;
  --viewer-muted: #6c757d;
  --viewer-accent: #1f6f78;
  --viewer-accent-soft: #d8ecef;
  --viewer-border: #ddd4c8;
  --viewer-nav-height: 4.6rem;
  --assistant-panel-width: 24rem;
  --assistant-tab-width: 3.25rem;
}

body {
  background:
    radial-gradient(circle at top left, rgba(31, 111, 120, 0.12), transparent 28%),
    linear-gradient(180deg, #f9f6f1 0%, var(--viewer-bg) 100%);
  color: var(--viewer-ink);
  min-height: 100vh;
}

.viewer-navbar {
  background: rgba(255, 253, 249, 0.92);
  border-bottom: 1px solid var(--viewer-border);
  backdrop-filter: blur(14px);
  min-height: var(--viewer-nav-height);
}

.navbar-brand,
.nav-link {
  color: var(--viewer-ink) !important;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: 0;
}

.viewer-brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
}

.card {
  background: var(--viewer-panel);
  border: 1px solid var(--viewer-border);
  border-radius: 1rem;
}

.viewer-health {
  gap: 0.45rem;
  min-width: 0;
}

.viewer-health-indicator {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #c7bdb0;
  box-shadow: 0 0 0 0.14rem rgba(199, 189, 176, 0.25);
  flex: 0 0 auto;
}

.viewer-health-indicator.is-ok {
  background: #1f8a45;
  box-shadow: 0 0 0 0.14rem rgba(31, 138, 69, 0.18);
}

.viewer-health-indicator.is-error {
  background: #c0392b;
  box-shadow: 0 0 0 0.14rem rgba(192, 57, 43, 0.18);
}

.viewer-health-indicator.is-checking {
  background: #b0a69b;
  box-shadow: 0 0 0 0.14rem rgba(176, 166, 155, 0.18);
}

.card {
  box-shadow: 0 10px 30px rgba(27, 31, 35, 0.04);
}

.progress-thin {
  height: 0.5rem;
}

.progress-subtle {
  height: 0.32rem;
}

.progress-tall {
  height: 0.9rem;
}

.progress-bar {
  background: linear-gradient(90deg, var(--viewer-accent) 0%, #4d9aa6 100%);
}

.experiment-phase-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

@media (min-width: 992px) {
  .experiment-phase-progress-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  }

  .experiment-phase-progress-item--phase1 {
    grid-column: 1;
  }

  .experiment-phase-progress-item--phase3 {
    grid-column: 2;
  }
}

.experiment-phase-progress-item {
  min-width: 0;
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.7rem 0.8rem;
}

.experiment-phase-progress-item.is-active {
  border-color: rgba(13, 110, 253, 0.28);
  box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.08);
}

.experiment-phase-progress-label,
.experiment-phase-progress-count {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.experiment-phase-progress-label {
  color: var(--viewer-ink);
  font-weight: 600;
}

.experiment-phase-progress-count {
  color: var(--viewer-muted);
  font-weight: 600;
}

.experiment-phase-subprogress-label {
  font-size: 0.78rem;
}

.experiment-agent-activity-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.6rem;
}

.experiment-agent-activity-card {
  min-height: 4.25rem;
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.6rem;
  text-align: center;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.experiment-agent-activity-card[data-active="true"] {
  border-color: rgba(13, 110, 253, 0.36);
  background: rgba(13, 110, 253, 0.08);
  box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.12);
  animation: experiment-agent-activity-pulse 1.8s ease-in-out infinite;
}

.experiment-agent-activity-card-label {
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@keyframes experiment-agent-activity-pulse {
  0%,
  100% {
    background: rgba(13, 110, 253, 0.08);
    box-shadow:
      inset 0 0 0 1px rgba(13, 110, 253, 0.12),
      0 0 0 0 rgba(13, 110, 253, 0.1);
  }

  50% {
    background: rgba(13, 110, 253, 0.16);
    box-shadow:
      inset 0 0 0 1px rgba(13, 110, 253, 0.18),
      0 0 0 6px rgba(13, 110, 253, 0.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .experiment-agent-activity-card[data-active="true"] {
    animation: none;
  }
}

@media (max-width: 1199.98px) {
  .experiment-agent-activity-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .experiment-agent-activity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.icon-only-button {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.favorite-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: #8a6a1f;
  transition: color 120ms ease, background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.favorite-toggle:hover:not(:disabled) {
  background: rgba(211, 155, 20, 0.12);
  transform: scale(1.04);
}

.favorite-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(211, 155, 20, 0.22);
}

.favorite-toggle:disabled {
  opacity: 0.6;
  cursor: default;
}

.favorite-toggle .fa-star {
  color: #d39b14;
  font-size: 1.2rem;
}

.table-sort-button {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 600;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dashboard-child-row td {
  background: rgba(31, 111, 120, 0.03);
}

.dashboard-clickable-row {
  cursor: pointer;
}

.dashboard-clickable-row:hover td,
.dashboard-clickable-row:focus-within td {
  background: rgba(31, 111, 120, 0.06);
}

.dashboard-run-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dashboard-run-cell-child {
  padding-left: 1.25rem;
}

.dashboard-run-indent {
  width: 0.9rem;
  height: 0.9rem;
  border-left: 2px solid rgba(31, 111, 120, 0.35);
  border-bottom: 2px solid rgba(31, 111, 120, 0.35);
  border-bottom-left-radius: 0.4rem;
  flex: 0 0 auto;
}

.experiment-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.6rem;
}

.experiment-detail-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--viewer-border);
  border-radius: 0.5rem;
  background: rgba(31, 111, 120, 0.08);
  color: var(--viewer-accent);
  font-weight: 700;
  line-height: 1;
}

.experiment-detail-actions > .btn,
.experiment-detail-actions > a.btn {
  flex: 0 0 auto;
  align-self: flex-start;
}

.experiment-detail-status {
  min-width: 12rem;
}

.status-badge {
  border: 1px solid transparent;
}

.status-badge--success,
.status-badge--primary,
.status-badge--info,
.status-badge--danger,
.status-badge--secondary,
.status-badge--warning,
.status-badge--dark,
.status-badge--light {
  color: #fff;
  background-color: #6c757d;
}

.status-badge--success {
  background-color: #198754;
}

.status-badge--primary {
  background-color: #0d6efd;
}

.status-badge--info {
  color: #052c65;
  background-color: #9ec5fe;
}

.status-badge--danger {
  background-color: #dc3545;
}

.status-badge--secondary {
  background-color: #6c757d;
}

.status-badge--warning {
  color: #664d03;
  background-color: #fff3cd;
}

.status-badge--dark {
  background-color: #212529;
}

.status-badge--light {
  color: #495057;
  background-color: #f8f9fa;
}

.experiment-detail-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--assistant-panel-width);
  align-items: start;
  gap: 1.5rem;
}

.experiment-detail-workspace.assistant-collapsed {
  grid-template-columns: minmax(0, 1fr) var(--assistant-tab-width);
}

.experiment-detail-main {
  min-width: 0;
}

.experiment-detail-card {
  position: relative;
}

.experiment-detail-card > .card-body {
  padding-left: 2.75rem;
}

.card-collapse-toggle {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #495057;
}

.card-collapse-toggle:hover,
.card-collapse-toggle:focus {
  background: rgba(0, 0, 0, 0.06);
  color: #212529;
}

.experiment-detail-card-collapsed-label {
  padding: 0.9rem 1rem 0.9rem 2.75rem;
  font-weight: 600;
  color: #343a40;
}

.diagnostic-timeline-item {
  color: #495057;
  background-color: #f8f9fa;
  border-color: #dee2e6;
}

.diagnostic-timeline-item--completed,
.diagnostic-timeline-item--active,
.diagnostic-timeline-item--future {
  border-width: 1px;
  border-style: solid;
}

.diagnostic-timeline-item--completed {
  color: #fff;
  background-color: #198754;
  border-color: #198754;
}

.diagnostic-timeline-item--active {
  color: #fff;
  background-color: #0d6efd;
  border-color: #0d6efd;
}

.diagnostic-timeline-item--future {
  color: #495057;
  background-color: #f8f9fa;
  border-color: #dee2e6;
}

.dual-evaluation-trajectory-plot {
  min-width: 0;
}

.dual-evaluation-trajectory-chart-shell {
  position: relative;
  width: 100%;
  min-height: 280px;
}

.dual-evaluation-trajectory-chart {
  display: block;
  width: 100%;
  height: 280px;
}

.dual-evaluation-trajectory-grid {
  stroke: #dfe3e8;
  stroke-width: 1;
}

.dual-evaluation-trajectory-grid--vertical {
  stroke-dasharray: 3 4;
}

.dual-evaluation-trajectory-axis {
  stroke: #6c757d;
  stroke-width: 1.25;
}

.dual-evaluation-trajectory-axis-label {
  fill: #6c757d;
  font-size: 11px;
}

.dual-evaluation-trajectory-axis-label--right {
  fill: #8b5e34;
}

.dual-evaluation-trajectory-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 120ms ease;
}

.dual-evaluation-trajectory-line--live,
.dual-evaluation-trajectory-point--live,
.dual-evaluation-trajectory-swatch--live {
  stroke: #0d6efd;
  color: #0d6efd;
  background-color: #0d6efd;
}

.dual-evaluation-trajectory-line--frozen,
.dual-evaluation-trajectory-point--frozen,
.dual-evaluation-trajectory-swatch--frozen {
  stroke: #198754;
  color: #198754;
  background-color: #198754;
}

.dual-evaluation-trajectory-line--frozen {
  stroke-dasharray: 6 4;
  stroke-width: 2.5;
}

.dual-evaluation-trajectory-line--target-identity,
.dual-evaluation-trajectory-point--target-identity,
.dual-evaluation-trajectory-swatch--target-identity {
  stroke: #dc2626;
  color: #dc2626;
  background-color: #dc2626;
}

.dual-evaluation-trajectory-line--framework-identity,
.dual-evaluation-trajectory-point--framework-identity,
.dual-evaluation-trajectory-swatch--framework-identity {
  stroke: #b45309;
  color: #b45309;
  background-color: #b45309;
}

.dual-evaluation-trajectory-line--target-identity {
  stroke-dasharray: 6 5;
  stroke-width: 2;
}

.dual-evaluation-trajectory-line--framework-identity {
  stroke-dasharray: 2 5;
  stroke-width: 2;
}

.dual-evaluation-trajectory-line--divergence,
.dual-evaluation-trajectory-point--divergence,
.dual-evaluation-trajectory-swatch--divergence {
  stroke: #111827;
  color: #111827;
  background-color: #111827;
}

.dual-evaluation-trajectory-line--divergence {
  stroke-width: 2.5;
}

.dual-evaluation-trajectory-line--agent-score {
  stroke-width: 2.5;
}

.dual-evaluation-trajectory-line--dimension-score {
  stroke-width: 2.5;
}

.dual-evaluation-trajectory-line--zero {
  stroke: #9ca3af;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.dual-evaluation-trajectory-point {
  fill: currentColor;
  stroke: #ffffff;
  stroke-width: 1.5;
  transition: opacity 120ms ease;
}

.dual-evaluation-trajectory-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #495057;
}

.dual-evaluation-trajectory-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.dual-evaluation-trajectory-legend-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #495057;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  transition: opacity 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.dual-evaluation-trajectory-legend-button:hover {
  background: rgba(15, 23, 42, 0.04);
}

.dual-evaluation-trajectory-legend-button.is-active {
  border-color: #ced4da;
  background: rgba(15, 23, 42, 0.05);
  color: #212529;
}

.dual-evaluation-trajectory-filter-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #495057;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.dual-evaluation-trajectory-filter-button:hover {
  background: rgba(15, 23, 42, 0.04);
}

.dual-evaluation-trajectory-filter-button.is-active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.dual-evaluation-trajectory-tooltip {
  position: absolute;
  z-index: 2;
  max-width: min(320px, calc(100% - 24px));
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.92);
  color: #f8f9fa;
  font-size: 0.75rem;
  line-height: 1.35;
  pointer-events: none;
  transform: translateY(-100%);
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.dual-evaluation-trajectory-empty {
  padding: 0.75rem 0;
}

.assistant-sidepanel {
  width: var(--assistant-panel-width);
  max-width: 100%;
  min-width: 0;
  position: sticky;
  top: calc(var(--viewer-nav-height) + 1rem);
  height: calc(100vh - var(--viewer-nav-height) - 2rem);
  border-left: 1px solid var(--viewer-border);
  background: rgba(255, 253, 249, 0.96);
  box-shadow: -12px 0 30px rgba(27, 31, 35, 0.08);
  backdrop-filter: blur(12px);
}

.assistant-sidepanel.is-collapsed {
  position: sticky;
  top: calc(var(--viewer-nav-height) + 1rem);
  width: var(--assistant-tab-width);
  max-width: 100%;
  min-height: 0;
  height: auto;
  justify-self: end;
  background: transparent;
  border-left: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.assistant-sidepanel.is-collapsed .assistant-panel-tab {
  position: static;
  right: auto;
  top: auto;
  transform: none;
  margin-left: auto;
}

.assistant-panel-shell {
  height: 100%;
}

.assistant-panel-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.1rem 1.25rem 1.1rem;
  overflow-x: hidden;
}

.assistant-panel-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.assistant-panel-composer {
  flex: 0 0 auto;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--viewer-border);
  background: rgba(255, 253, 249, 0.96);
}

.assistant-sidepanel-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.assistant-panel-toggle {
  white-space: nowrap;
}

.assistant-panel-tab {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--viewer-border);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: rgba(255, 253, 249, 0.98);
  color: var(--viewer-ink);
  padding: 0.75rem 0.4rem;
  box-shadow: -6px 0 18px rgba(27, 31, 35, 0.08);
}

.assistant-panel-tab .fa-solid {
  transform: rotate(90deg);
}

.experiment-detail-notes {
  border-top: 1px solid var(--viewer-border);
  padding-top: 1.25rem;
}

.operational-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem;
}

.operational-summary-item {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(31, 111, 120, 0.04);
}

.operational-change-list {
  display: grid;
  gap: 0.75rem;
}

.operational-change-item.is-active .btn {
  border-color: var(--viewer-accent);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 120, 0.12);
}

.operational-change-detail {
  min-height: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.operational-json-block {
  max-height: 14rem;
  overflow: auto;
  margin: 0 0 1rem;
  padding: 0.75rem;
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(27, 31, 35, 0.04);
}

.governance-banner {
  border-radius: 8px;
}

.governance-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1055;
  background: rgba(27, 31, 35, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.governance-modal {
  width: min(1080px, 100%);
  max-height: calc(100vh - 3rem);
  background: var(--viewer-panel);
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(27, 31, 35, 0.22);
  display: flex;
  flex-direction: column;
}

.governance-modal-header,
.governance-modal-footer {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--viewer-border);
}

.governance-modal-footer {
  border-top: 1px solid var(--viewer-border);
  border-bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.governance-modal-body {
  padding: 1.25rem;
  overflow: auto;
}

.governance-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.governance-summary-card {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: rgba(31, 111, 120, 0.04);
}

.governance-rationale {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: #fff;
}

.governance-diff-groups {
  display: grid;
  gap: 0.85rem;
}

.governance-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.governance-view-toggle,
.governance-change-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.governance-diff-group {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  overflow: hidden;
}

.governance-diff-group-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--viewer-border);
  background: rgba(31, 111, 120, 0.04);
}

.governance-context-document {
  background: #fff;
}

.governance-context-section {
  border-left: 4px solid transparent;
}

.governance-context-section.has-changes {
  border-left-color: #c8921e;
  background: rgba(200, 146, 30, 0.04);
}

.governance-context-section-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.95rem 0 0.95rem;
}

.governance-context-line {
  padding: 0.22rem 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86rem;
}

.governance-context-line.is-addition {
  background: #e8f6ec;
  color: #1f5c34;
}

.governance-context-line.is-deletion {
  background: #fbe9e8;
  color: #8a3026;
  text-decoration: line-through;
}

.governance-context-line.is-active-change {
  box-shadow: inset 3px 0 0 #1f6f78;
}

@media (max-width: 767.98px) {
  .governance-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .governance-modal-backdrop {
    padding: 0.75rem;
  }
}

.trace-explorer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1056;
  background: rgba(27, 31, 35, 0.6);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 1rem;
}

.trace-explorer-modal {
  width: min(1440px, 100%);
  height: calc(100vh - 2rem);
  background: var(--viewer-panel);
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(27, 31, 35, 0.26);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trace-explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--viewer-border);
}

.trace-explorer-body {
  display: grid;
  grid-template-columns: minmax(19rem, 24rem) minmax(0, 1fr);
  min-height: 0;
  flex: 1 1 auto;
}

.trace-explorer-tree-panel,
.trace-explorer-detail-panel {
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.1rem;
}

.trace-explorer-tree-panel {
  border-right: 1px solid var(--viewer-border);
  background: rgba(31, 111, 120, 0.04);
}

.trace-explorer-tree {
  display: grid;
  gap: 0.35rem;
}

.trace-explorer-tree-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--viewer-ink);
  padding: 0.45rem 0.55rem;
}

.trace-explorer-tree-button:hover,
.trace-explorer-tree-button.is-selected {
  background: #fff;
  border-color: var(--viewer-border);
}

.trace-explorer-tree-button.is-selected {
  box-shadow: inset 0 0 0 1px rgba(31, 111, 120, 0.14);
}

.trace-explorer-tree-label {
  font-weight: 600;
}

.trace-explorer-tree-meta {
  font-size: 0.8rem;
}

.trace-explorer-tree-caret {
  width: 0.9rem;
  color: var(--viewer-muted);
}

.trace-explorer-section {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
}

.trace-explorer-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--viewer-muted);
  margin-bottom: 0.85rem;
}

.trace-explorer-metadata-grid dt,
.trace-explorer-metadata-grid dd {
  margin-bottom: 0.45rem;
}

.trace-explorer-code-block {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(27, 31, 35, 0.04);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
}

.trace-explorer-interaction {
  margin-bottom: 0.75rem;
}

.trace-explorer-interaction:last-child {
  margin-bottom: 0;
}

.trace-explorer-eval-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.trace-explorer-eval-card {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: rgba(31, 111, 120, 0.04);
}

.trace-explorer-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.trace-explorer-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.trace-explorer-detail-span-full {
  grid-column: 1 / -1;
}

.trace-explorer-recommendation-card {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
}

.trace-explorer-agent-card {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.85rem;
  margin-bottom: 0.85rem;
}

.trace-explorer-agent-card:last-child {
  margin-bottom: 0;
}

.trace-explorer-agent-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.trace-explorer-agent-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0.9rem;
}

.trace-explorer-chat-list {
  display: grid;
  gap: 0.75rem;
}

.trace-explorer-chat-message {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.88);
}

.trace-explorer-chat-message.is-system {
  background: rgba(31, 111, 120, 0.08);
}

.trace-explorer-chat-message.is-user {
  background: rgba(255, 245, 231, 0.9);
}

.trace-explorer-chat-message.is-assistant {
  background: rgba(223, 243, 232, 0.88);
}

.trace-explorer-chat-message.is-repair {
  background: rgba(255, 243, 205, 0.9);
}

.trace-explorer-chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.trace-explorer-chat-content {
  margin-top: 0.3rem;
}

.trace-explorer-metric-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.trace-explorer-attempt-row {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: rgba(27, 31, 35, 0.03);
  margin-bottom: 0.55rem;
}

.trace-explorer-attempt-row:last-child {
  margin-bottom: 0;
}

@media (max-width: 991.98px) {
  .trace-explorer-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .trace-explorer-tree-panel {
    border-right: 0;
    border-bottom: 1px solid var(--viewer-border);
    max-height: 34vh;
  }

  .trace-explorer-detail-grid,
  .trace-explorer-agent-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767.98px) {
  .trace-explorer-backdrop {
    padding: 0.5rem;
  }

  .trace-explorer-modal {
    height: calc(100vh - 1rem);
  }

  .trace-explorer-header {
    padding: 0.85rem 1rem;
  }

  .trace-explorer-tree-panel,
  .trace-explorer-detail-panel {
    padding: 0.85rem;
  }

  .trace-explorer-eval-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.experiment-configuration {
  flex: 1 1 20rem;
  min-width: 0;
  padding: 0 1rem;
}

.experiment-configuration-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin-top: 0.35rem;
}

.experiment-configuration-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
  font-size: 0.92rem;
}

.experiment-configuration-label {
  color: var(--viewer-muted);
  white-space: nowrap;
}

.experiment-configuration-value {
  font-weight: 600;
  color: var(--viewer-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.launch-repeat-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.launch-repeat-controls-toggle-row {
  display: flex;
  align-items: flex-end;
}

.launch-repeat-controls-toggle {
  margin-bottom: 0;
}

.launch-repeat-controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.launch-repeat-control {
  min-width: 0;
}

.launch-repeat-control .form-label {
  display: block;
}

@media (max-width: 991.98px) {
  .launch-repeat-controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .launch-repeat-controls-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.branch-card-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.branch-card-status {
  min-width: 0;
}

.branch-card-action-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  line-height: 1.15;
  flex: 0 0 auto;
}

.branch-card-action-button .fa-solid {
  margin-right: 0;
}

.branch-phase-progress {
  display: grid;
  gap: 0.7rem;
}

.branch-events-layout {
  align-items: start;
}

.branch-side-column {
  display: grid;
  gap: 1rem;
}

.branch-case-progress {
  margin-top: 0.35rem;
  padding-left: 0.9rem;
}

.branch-case-progress-label {
  font-size: 0.78rem;
}

.branch-case-progress-bar {
  height: 0.32rem;
}

.branch-case-progress-fill {
  background: linear-gradient(90deg, #6ca7ae 0%, #9fc8cd 100%);
}

.branch-case-progress-meta {
  margin-top: 0.25rem;
  font-size: 0.76rem;
}

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.experiment-notes-textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.journal-note-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-thread {
  display: grid;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  align-content: start;
}

.assistant-turn {
  border: 1px solid var(--viewer-border);
  border-radius: 0.9rem;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.72);
  min-width: 0;
}

.assistant-turn.is-user {
  background: rgba(31, 111, 120, 0.08);
}

.assistant-turn-role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--viewer-muted);
  margin-bottom: 0.35rem;
}

.assistant-turn-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.assistant-turn-timestamp {
  margin-top: 0.45rem;
}

.assistant-turn-meta {
  margin-top: 0.65rem;
}

.assistant-evidence {
  display: grid;
  gap: 0.55rem;
}

.assistant-evidence-item {
  border-left: 3px solid rgba(31, 111, 120, 0.25);
  padding-left: 0.75rem;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.assistant-evidence-item a,
.assistant-limitations,
.assistant-turn pre,
.assistant-turn code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1199.98px) {
  .experiment-detail-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .assistant-sidepanel,
  .assistant-sidepanel.is-collapsed {
    position: static;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-left: 1px solid var(--viewer-border);
    box-shadow: 0 10px 30px rgba(27, 31, 35, 0.04);
    margin-top: 1rem;
  }

  .assistant-panel-tab {
    position: static;
    transform: none;
    writing-mode: horizontal-tb;
    border-right: 1px solid var(--viewer-border);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
  }

  .assistant-panel-tab .fa-solid {
    transform: none;
  }
}

.artefact-explorer,
.artefact-preview-panel {
  border: 1px solid var(--viewer-border);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.7);
}

.artefact-explorer {
  padding: 1rem;
  max-height: 72vh;
  overflow: auto;
}

.artefact-group + .artefact-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--viewer-border);
}

.artefact-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.artefact-tree-node {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 0.8rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.artefact-tree-folder {
  color: var(--viewer-ink);
  font-weight: 600;
}

.artefact-tree-count {
  margin-left: auto;
  color: var(--viewer-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.artefact-tree-file {
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
}

.artefact-tree-file.is-selected {
  background: rgba(31, 111, 120, 0.12);
}

.artefact-tree-file-main,
.artefact-tree-file-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.artefact-tree-file-label {
  font-weight: 600;
}

.artefact-tree-file-name,
.artefact-tree-file-meta {
  color: var(--viewer-muted);
  font-size: 0.82rem;
}

.artefact-preview-panel {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
}

.modal-dialog.modal-xl.modal-dialog-scrollable {
  width: min(92vw, 1400px);
  max-width: min(92vw, 1400px);
  height: min(88vh, 1000px);
  margin: 1.75rem auto;
}

.modal-dialog.modal-xl.modal-dialog-scrollable .modal-content {
  width: 100%;
  height: 100%;
  resize: both;
  overflow: hidden;
  min-width: 720px;
  min-height: 520px;
  max-width: 92vw;
  max-height: 88vh;
}

.modal-dialog.modal-xl.modal-dialog-scrollable .modal-body {
  flex: 1 1 auto;
}

.artefact-preview-header {
  padding: 1rem 1rem 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.artefact-preview-header > div {
  min-width: 0;
}

.artefact-preview-meta {
  padding: 0 1rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--viewer-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--viewer-border);
}

.artefact-preview-body {
  min-height: 70vh;
  padding: 1rem;
  background: #f7f4ef;
  overflow: auto;
  width: 100%;
}

.artefact-preview-frame {
  width: 100%;
  min-height: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.artefact-preview-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  background: #fff;
}

.artefact-preview-loading {
  min-height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #5c6570;
  font-weight: 500;
}

.assistant-loading-icon {
  color: #1f7a8c;
}

.artefact-preview-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border: 1px solid var(--viewer-border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.artefact-preview-diff {
  background: #fff;
  border: 1px solid var(--viewer-border);
  border-radius: 0.75rem;
  overflow: hidden;
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86rem;
}

.artefact-preview-diff-line {
  padding: 0.22rem 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px solid rgba(221, 212, 200, 0.45);
}

.artefact-preview-diff-line:first-child {
  border-top: 0;
}

.artefact-preview-diff-line.is-meta,
.artefact-preview-diff-line.is-file {
  background: #f5efe3;
  color: #6a5c45;
}

.artefact-preview-diff-line.is-hunk {
  background: #e8f1f8;
  color: #1f4f73;
}

.artefact-preview-diff-line.is-addition {
  background: #e8f6ec;
  color: #1f5c34;
}

.artefact-preview-diff-line.is-deletion {
  background: #fbe9e8;
  color: #8a3026;
}

.artefact-preview-table-wrap {
  background: #fff;
  border: 1px solid var(--viewer-border);
  border-radius: 0.75rem;
  overflow: auto;
  width: 100%;
}

.markdown-body {
  background: #fff;
  border: 1px solid var(--viewer-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  width: 100%;
  max-width: 100%;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--viewer-border);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
}

.markdown-body pre,
.markdown-body code {
  background: #f7f4ef;
  border-radius: 0.45rem;
}

.markdown-body pre {
  padding: 0.85rem 1rem;
  overflow: auto;
}

.artefact-preview-empty {
  min-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.report-empty-state {
  padding: 1rem 0;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.9rem;
}

.report-preview img {
  max-width: 100%;
  height: auto;
}

.event-feed {
  display: grid;
  gap: 0.75rem;
  max-height: 480px;
  overflow: auto;
}

.event-item {
  padding: 0.75rem;
  border: 1px solid var(--viewer-border);
  border-radius: 0.75rem;
  background: #fff;
}

.event-item--override {
  border-color: #c96b10;
  background: #fff7ed;
  box-shadow: inset 3px 0 0 #c96b10;
}

.campaign-manager-section + .campaign-manager-section {
  border-top: 1px solid var(--viewer-border);
  padding-top: 1rem;
}

.campaign-variable-row + .campaign-variable-row {
  margin-top: 0.5rem;
}

.campaign-loop-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.campaign-dashboard-panel {
  border: 1px solid var(--viewer-border);
  border-radius: 8px;
  padding: 0.875rem;
}

.campaign-list {
  max-height: 16rem;
  overflow: auto;
}

@media (max-width: 991.98px) {
  .campaign-loop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
