:root {
  /* Modern Color Palette */
  --primary-color: #2563eb;
  /* Royal Blue */
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  /* Slate */
  --accent-color: #0ea5e9;
  /* Sky Blue */
  --success-color: #10b981;
  /* Emerald */
  --warning-color: #f59e0b;
  /* Amber */
  --error-color: #ef4444;
  /* Red */

  /* Backgrounds */
  --bg-body: #f8fafc;
  /* Very light slate */
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  /* Dark Slate */

  /* Text */
  --text-main: #0f172a;
  /* Darkest Slate */
  --text-secondary: #475569;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-body);
  font-family: var(--font-sans);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
}

/* Steps Navigation */
.steps-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.step.active {
  opacity: 1;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--secondary-color);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
}

.step.active .step-num {
  background-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.step-text {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.step-line {
  flex-grow: 1;
  height: 2px;
  background-color: var(--border-color);
  margin: 0 1rem;
  border-radius: 1px;
}

main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex-grow: 1;
}

section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

section:hover {
  box-shadow: var(--shadow-md);
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

h2::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.2em;
  background-color: var(--primary-color);
  border-radius: 2px;
}

/* Grid System */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.scenario-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

.card.selected {
  border-color: var(--primary-color);
  background-color: #eff6ff;
  /* Light blue tint */
  box-shadow: 0 0 0 2px var(--primary-color);
}

.scenario-card.selected {
  box-shadow:
    0 0 0 2px var(--primary-color),
    var(--shadow-lg);
}

.scenario-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
  overflow: hidden;
}

.scenario-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scenario-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1rem 1.05rem;
  min-height: 8.5rem;
}

.scenario-card-title {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scenario-card-summary {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scenario-card-hint {
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-color);
}

.scenario-card.missing-cover .scenario-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
}

.scenario-card.missing-cover .scenario-cover::after {
  content: "Cover missing";
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: 700;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.card .tag {
  display: inline-block;
  padding: 2px 8px;
  background-color: #e2e8f0;
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-right: 4px;
  margin-top: 4px;
}

/* Controls */
.controls-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  background: #f1f5f9;
  padding: 1rem;
  border-radius: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#controls {
  position: relative;
  overflow: hidden;
}

#controls::after {
  content: "";
  position: absolute;
  right: -140px;
  top: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(37, 99, 235, 0.12),
    rgba(37, 99, 235, 0) 68%
  );
  pointer-events: none;
}

#controls > * {
  position: relative;
  z-index: 1;
}

.run-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 1100px) {
  .run-layout {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  }
}

.run-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  border: 1px solid rgba(37, 99, 235, 0.14);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
}

.run-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.run-panel-copy {
  flex: 1 1 320px;
}

.run-panel-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 0.35rem;
}

.run-panel-subtitle {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.94rem;
}

.run-panel-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.run-panel .status-indicator {
  margin-right: 0;
}

.run-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.run-mode-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 18px;
  padding: 1rem;
  min-height: 11.25rem;
  box-shadow: var(--shadow-sm);
  text-align: left;
  align-items: flex-start;
  flex-direction: column;
}

.run-mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: var(--shadow-md);
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
}

.run-mode-card.active {
  border-color: var(--primary-color);
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.12),
    var(--shadow-md);
}

.run-mode-card strong {
  display: block;
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1.35;
}

.run-mode-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.run-mode-card small {
  margin-top: auto;
  color: var(--primary-color);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
}

.run-mode-card-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-color);
  font-size: 0.74rem;
  font-weight: 800;
}

.run-mode-card-badge-accent {
  background: rgba(14, 165, 233, 0.14);
  color: #0369a1;
}

.run-mode-summary-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.03), rgba(37, 99, 235, 0.06));
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.run-mode-summary-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.run-mode-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.run-mode-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 800;
}

.run-mode-summary {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}

.run-panel-footer {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.run-panel-note {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

.run-panel #run-btn {
  min-width: 160px;
  justify-content: center;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
}

.run-log-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.15rem 1.2rem;
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.run-log-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.run-log-header h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #f8fafc;
}

.run-log-hint {
  margin: 0;
  color: #94a3b8;
  font-size: 0.88rem;
  line-height: 1.5;
}

.run-phase-banner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
  min-width: 240px;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(14, 165, 233, 0.14));
  color: #dbeafe;
}

.run-phase-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #93c5fd;
}

.run-phase-copy {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  color: #e0f2fe;
}

button.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  flex: 0 0 auto;
}

button.help-btn:hover {
  background: #eef6ff;
  border-color: rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button.help-btn:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.run-log-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.run-log-toolbar input {
  flex: 1 1 280px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  padding: 0.72rem 0.85rem;
  color: var(--text-main);
}

.run-log-footer {
  display: flex;
  justify-content: flex-end;
}

.run-log-footer #view-results-btn {
  min-width: 120px;
  justify-content: center;
}

.run-history-panel {
  margin-top: 1rem;
  padding: 1.25rem;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(37, 99, 235, 0.12);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
}

.run-history-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.run-history-copy {
  flex: 1 1 320px;
}

.run-history-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 0.35rem;
}

.run-history-header h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--text-main);
}

.run-history-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.run-history-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.run-history-stat {
  min-width: 112px;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.run-history-stat strong {
  font-size: 1.25rem;
  line-height: 1;
  color: var(--primary-color);
}

.run-history-stat span {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.run-history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.run-history-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.run-history-card[open] {
  box-shadow: var(--shadow-md);
}

.run-history-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.run-history-card > summary::-webkit-details-marker {
  display: none;
}

.run-history-card-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.run-history-card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.run-history-condition-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.run-history-condition-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 800;
}

.run-history-condition-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.run-history-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 700;
}

.run-history-chip.warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.run-history-chip.neutral {
  background: #e2e8f0;
  color: var(--text-secondary);
}

.run-history-card-body {
  padding: 0 1.1rem 1.1rem;
}

.run-history-scene-card {
  margin-top: 0.9rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.92), #ffffff);
  padding: 0.95rem;
}

.run-history-scene-card:first-child {
  margin-top: 0;
}

.run-history-scene-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.run-history-scene-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.run-history-scene-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.run-history-scene-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.run-history-entry-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.run-history-entry {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.8rem 0.85rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.run-history-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 80px;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.run-history-entry-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.run-history-entry-event {
  color: var(--text-main);
  line-height: 1.65;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.run-history-entry-event.empty {
  color: var(--text-light);
  font-style: italic;
}

.run-history-entry-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.run-history-entry-participant {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.run-history-scene-note {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.scene-toolbar {
  justify-content: space-between;
  align-items: flex-start;
}

.scene-toolbar-copy {
  flex: 1 1 320px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.scene-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-left: auto;
}

.scene-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}

.scene-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.scene-group:last-child {
  margin-bottom: 0;
}

.scene-group-header {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.15rem 0.1rem 0.1rem;
}

.scene-group-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

.scene-group-description {
  margin: 0.3rem 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
}

.scene-group-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scene-sidebar {
  position: sticky;
  top: 1rem;
  height: auto;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.scene-sidebar h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.scene-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  padding-right: 0.15rem;
}

.scene-card {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0.8rem 0.85rem;
  text-align: left;
  background: white;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.scene-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.scene-card.selected {
  border-color: var(--primary-color);
  background-color: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.scene-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.28;
  overflow-wrap: anywhere;
  word-break: normal;
}

.scene-card-summary {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.6em;
}

.scene-card-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.scene-card-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.scene-editor {
  min-width: 0;
  display: flex;
}

.scene-editor-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.scene-editor-intro {
  margin: 0 0 1rem;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(14, 165, 233, 0.05));
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.scene-editor-intro-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.scene-editor-intro-group,
.scene-editor-intro-scene {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.scene-editor-intro-group {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.scene-editor-intro-scene {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-main);
}

.scene-editor-intro-body {
  color: var(--text-secondary);
  line-height: 1.65;
  font-size: 0.95rem;
}

.scene-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.scene-editor-header h3 {
  margin-bottom: 0.25rem;
  font-size: 1.08rem;
}

.scene-editor-meta {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

#scene-editor-meta,
#scene-call-to-action-hint,
#scene-default-premise-hint {
  color: var(--text-secondary);
}

.scene-dirty-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.scene-field-block {
  margin-bottom: 1.1rem;
}

.scene-field-block label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.scene-field-block textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-main);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.scene-premise-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0.9rem;
}

.scene-premise-card {
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.scene-premise-card h4 {
  font-size: 0.96rem;
  margin-bottom: 0.45rem;
}

.scene-premise-card textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font-family: var(--font-sans);
  font-size: 0.94rem;
  line-height: 1.6;
  margin-top: 0.35rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  color: var(--text-main);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.scene-field-block textarea:focus,
.scene-premise-card textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.12),
    inset 0 1px 2px rgba(15, 23, 42, 0.04);
  background: #fff;
}

.scene-field-block textarea:hover,
.scene-premise-card textarea:hover {
  border-color: rgba(37, 99, 235, 0.3);
}

.scene-empty-state {
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  color: var(--text-secondary);
  background: #fafcff;
}

select,
button {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  outline: none;
  transition: all 0.2s;
}

select {
  background-color: white;
  min-width: 200px;
  cursor: pointer;
}

select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

button.secondary:hover {
  background-color: #f8fafc;
  border-color: var(--text-secondary);
}

/* Logs */
.log-container {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  border-radius: 16px;
  padding: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 20px 30px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.18);
  height: 500px; /* Fixed height to prevent layout jumps */
  display: flex;
  flex-direction: column;
}

.run-time-notice {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.08),
    rgba(14, 165, 233, 0.08)
  );
  color: #1e3a8a;
  font-size: 0.92rem;
  font-weight: 600;
}

pre#log-output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  overflow-y: auto;
  line-height: 1.5;
  flex-grow: 1;
  margin: 0;
  padding-right: 10px; /* Space for scrollbar */
}

/* Results */
.result-block {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.result-header {
  background: #f8fafc;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-content {
  padding: 1.5rem;
}

.json-view {
  background-color: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

/* Result Section Styles */
.result-section {
  transition: all 0.3s ease;
}

.result-section h3 {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.5rem;
}

.result-overview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding: 0.05rem 0 0.35rem;
}

.result-overview-copy {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: 60ch;
}

.result-path-pill {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ecfeff 0%, #eff6ff 100%);
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  border: 1px solid rgba(15, 118, 110, 0.12);
  max-width: min(100%, 480px);
  word-break: break-all;
}

.result-overview-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.agent-overview-shell {
  gap: 1rem;
}

.metric-selector-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.metric-selector-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metric-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  flex: 1;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #fff;
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.metric-chip:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: #f8fbff;
}

.metric-chip.selected {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.2));
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
}

.metric-chip-label {
  white-space: nowrap;
}

.metric-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

.metric-chip.selected .metric-chip-count {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
}

.result-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 1rem;
  align-items: start;
}

.result-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(290px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.agent-overview-flow,
.agent-overview-detail-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.result-chart-card,
.result-summary-card,
.result-metric-table-card {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.result-chart-card {
  padding: 1rem 1rem 0.9rem;
}

.result-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.result-chart-title,
.result-summary-title,
.result-metric-table-header {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.result-chart-host {
  overflow-x: auto;
}

.trend-chart-shell {
  min-width: 520px;
}

.trend-chart {
  width: 100%;
  height: auto;
  display: block;
}

.result-summary-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.agent-overview-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.agent-overview-agent-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-top: 0.3rem;
}

.agent-overview-goal {
  margin-top: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
}

.agent-overview-profile {
  margin: 0.55rem 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

.agent-overview-current-pill {
  flex-shrink: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.14));
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(15, 118, 110, 0.12);
  white-space: nowrap;
}

.agent-overview-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.agent-overview-summary-note {
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(15, 118, 110, 0.06));
  border: 1px solid rgba(37, 99, 235, 0.12);
  color: var(--text-main);
  font-size: 0.84rem;
  line-height: 1.55;
}

.agent-overview-focus-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.agent-overview-focus-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.agent-overview-focus-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.agent-overview-focus-pill {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.agent-overview-focus-pill.is-gap {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(255, 255, 255, 0.98));
  border-color: rgba(245, 158, 11, 0.18);
}

.agent-overview-focus-pill.is-change {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(255, 255, 255, 0.98));
  border-color: rgba(124, 58, 237, 0.18);
}

.agent-overview-focus-label {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.agent-overview-focus-name {
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.agent-overview-focus-value {
  color: var(--primary-color);
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
}

.agent-overview-badge,
.agent-overview-mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin-right: 0.35rem;
}

.agent-overview-mini-badge {
  margin-right: 0.25rem;
  margin-bottom: 0.2rem;
}

.agent-overview-mini-muted {
  color: var(--text-light);
  font-size: 0.78rem;
}

.agent-overview-status-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.agent-overview-status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.agent-overview-status-badges .agent-overview-mini-badge {
  margin-right: 0;
  margin-bottom: 0;
}

.agent-overview-status-note {
  padding: 0.42rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.88);
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.45;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.agent-overview-chart-subtitle,
.agent-overview-table-note,
.agent-overview-timeline-note {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
}

.value-stat-subtext {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
}

.result-summary-metric-name {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

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

.value-stat-card {
  padding: 0.82rem 0.9rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  min-width: 0;
}

.value-stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.value-stat-value {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
  line-height: 1.25;
}

.value-stat-value.positive,
.metric-number.positive {
  color: var(--success-color);
}

.value-stat-value.negative,
.metric-number.negative {
  color: var(--error-color);
}

.result-summary-path {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  line-height: 1.45;
  word-break: break-all;
}

.result-view-note {
  margin: 0.2rem 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
}

.result-metric-table-card {
  padding: 1rem;
}

.result-metric-table-header {
  margin-bottom: 0.75rem;
}

.result-metric-table-host {
  overflow: auto;
  max-height: 34rem;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
}

.result-metric-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.result-metric-table th {
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}

.result-metric-table td {
  padding: 0.8rem;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.result-metric-table tr:last-child td {
  border-bottom: none;
}

.result-metric-table tr.is-baseline {
  background: #f8fbff;
}

.result-metric-table tr.is-selected {
  background: rgba(15, 118, 110, 0.06);
}

.result-metric-table tr.is-hidden {
  opacity: 0.82;
}

.result-metric-table tr.is-top-gap td {
  background: rgba(245, 158, 11, 0.08);
}

.result-metric-table tr.is-top-change td {
  background: rgba(124, 58, 237, 0.08);
}

.result-metric-table tr.is-top-gap.is-top-change td {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.09), rgba(124, 58, 237, 0.09));
}

.agent-overview-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.agent-overview-row-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
  background: rgba(37, 99, 235, 0.08);
  color: #0f172a;
}

.agent-overview-row-tag.is-gap {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.16);
}

.agent-overview-row-tag.is-change {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.16);
}

.condition-label {
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.condition-subtext {
  margin-top: 0.15rem;
  color: var(--text-light);
  font-size: 0.78rem;
  line-height: 1.35;
}

.metric-number {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.agent-desire-table {
  table-layout: fixed;
  min-width: 760px;
}

.agent-desire-table td {
  vertical-align: top;
}

.agent-desire-table th:nth-child(1),
.agent-desire-table td:nth-child(1) {
  width: 38%;
}

.agent-desire-table th:nth-child(2),
.agent-desire-table td:nth-child(2) {
  width: 22%;
}

.agent-desire-table th:nth-child(3),
.agent-desire-table td:nth-child(3),
.agent-desire-table th:nth-child(4),
.agent-desire-table td:nth-child(4),
.agent-desire-table th:nth-child(5),
.agent-desire-table td:nth-child(5),
.agent-desire-table th:nth-child(6),
.agent-desire-table td:nth-child(6),
.agent-desire-table th:nth-child(7),
.agent-desire-table td:nth-child(7) {
  width: 8%;
}

.agent-value-chart-shell {
  min-width: 560px;
}

.agent-overview-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.16));
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(15, 118, 110, 0.14);
  flex-shrink: 0;
}

.agent-overview-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.agent-overview-timeline-item {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem 0.9rem;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.agent-overview-timeline-item.is-baseline {
  background: #f8fbff;
}

.agent-overview-timeline-item.is-latest {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(15, 118, 110, 0.05));
  border-color: rgba(37, 99, 235, 0.18);
}

.agent-overview-timeline-item.is-latest .agent-overview-step-badge {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(15, 118, 110, 0.2));
  border-color: rgba(37, 99, 235, 0.2);
}

.agent-overview-timeline-time {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
  margin-bottom: 0.18rem;
}

.agent-overview-timeline-action {
  color: var(--text-main);
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.agent-overview-inline-tag {
  margin: 0;
}

.trend-chart text {
  user-select: none;
}

.trend-chart circle {
  filter: drop-shadow(0 6px 14px rgba(37, 99, 235, 0.18));
}

.rater-controls-panel {
  border: 1px solid #e2e8f0;
}

.rater-tool-header,
.measurement-toolkit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.measurement-toolkit {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.measurement-toolkit-title {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 800;
}

.measurement-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.measurement-tool-card {
  width: 100%;
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

button.measurement-tool-card {
  cursor: pointer;
}

button.measurement-tool-card:hover {
  border-color: rgba(37, 99, 235, 0.38);
  background: #fbfdff;
}

.measurement-tool-card.is-selected {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.measurement-tool-title {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.measurement-tool-description,
.measurement-tool-interpretation {
  margin: 0.4rem 0 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.45;
}

.measurement-tool-interpretation {
  color: #31536f;
}

.measurement-tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.measurement-tool-chip {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.measurement-legacy-select {
  display: none !important;
}

.measurement-condition-block {
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.measurement-condition-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  align-items: flex-start;
  gap: 1rem;
}

.measurement-condition-title {
  margin-top: 0.2rem;
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;
}

.measurement-condition-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.measurement-card {
  gap: 0.9rem;
  padding: 1rem;
  border-radius: 16px;
  box-shadow: none;
}

.measurement-card[data-track='rater'] {
  background: linear-gradient(180deg, #ffffff 0%, #f7fdfb 100%);
}

.measurement-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.measurement-card-title {
  margin-top: 0.2rem;
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.measurement-mode-pill,
.measurement-track-pill {
  white-space: nowrap;
}

.measurement-explanation {
  padding: 0.75rem 0.85rem;
  border-left: 3px solid rgba(37, 99, 235, 0.5);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

.measurement-explanation p {
  margin: 0;
}

.measurement-explanation p + .measurement-interpretation,
.measurement-interpretation + p {
  margin-top: 0.35rem;
}

.measurement-interpretation strong {
  color: var(--text-main);
}

.measurement-insight-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: #f7fbfa;
}

.measurement-insight-title {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 800;
}

.measurement-insight-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.measurement-evidence-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.measurement-meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.measurement-stat-card {
  min-width: 0;
  padding: 0.75rem 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.measurement-stat-card.is-wide {
  grid-column: span 2;
}

.measurement-stat-label {
  margin-bottom: 0.22rem;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
}

.measurement-stat-value {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.measurement-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(15, 118, 110, 0.04));
}

.measurement-row-title {
  margin: 0.85rem 0 0.45rem;
}

.measurement-detail-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 0.75rem;
}

.measurement-detail-panel summary {
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 800;
}

.measurement-table-host {
  max-height: 24rem;
  border-radius: 8px;
}

.measurement-table {
  min-width: 560px;
}

.measurement-empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-secondary);
}

.measurement-empty-state.is-pending {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.measurement-json-view {
  max-height: 22rem;
}

.measurement-source-files {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.measurement-source-files summary {
  cursor: pointer;
  font-weight: 700;
}

.measurement-source-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.measurement-source-item {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
}

.measurement-source-item span {
  font-weight: 700;
  color: var(--text-secondary);
}

.measurement-source-item code {
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text-main);
  font-size: 0.78rem;
}

.measurement-answers-panel {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.measurement-toggle-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 1rem;
}

.measurement-toggle-btn span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
}

.measurement-toggle-btn small {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}

.measurement-answers-content {
  margin-top: 1rem;
}

.measurement-answer-block {
  margin-bottom: 1rem;
}

.measurement-answer-block:last-child {
  margin-bottom: 0;
}

.measurement-answer-label {
  margin-bottom: 0.55rem;
  color: var(--text-main);
  font-weight: 700;
}

/* Ensure the multi-select looks good */
.rater-controls-panel {
  border: 1px solid #e2e8f0;
}

.rater-target-select {
  background: #fff;
  color: var(--text-main);
  outline: none;
}

.rater-target-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#rubric-modules {
  background-color: #fff;
  outline: none;
}

#rubric-modules:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#rubric-modules option {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
}

#rubric-modules option:checked {
  background-color: #eff6ff;
  color: var(--primary-color);
  font-weight: 500;
}

@media (max-width: 720px) {
  .rater-tool-header,
  .measurement-toolkit-header,
  .measurement-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .measurement-meta-grid,
  .measurement-insight-grid {
    grid-template-columns: 1fr;
  }

  .measurement-stat-card.is-wide {
    grid-column: span 1;
  }

  .measurement-source-item {
    grid-template-columns: 1fr;
  }
}

/* Utilities */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    padding: 10px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .run-panel-header,
  .run-panel-footer,
  .run-log-header {
    flex-direction: column;
    align-items: stretch;
  }

  .run-mode-grid {
    grid-template-columns: 1fr;
  }

  .run-phase-banner {
    align-items: flex-start;
    min-width: 0;
  }

  .run-log-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .result-overview-header,
  .metric-selector-row,
  .result-overview-grid,
  .result-detail-grid {
    display: flex;
    flex-direction: column;
  }

  .result-overview-grid {
    gap: 0.85rem;
  }

  .result-detail-grid {
    gap: 0.85rem;
  }

  .agent-overview-card-head {
    flex-direction: column;
  }

  .agent-overview-focus-row {
    grid-template-columns: 1fr;
  }

  .result-summary-stats {
    grid-template-columns: 1fr 1fr;
  }

  .measurement-card-header,
  .measurement-condition-header {
    flex-direction: column;
  }

  .measurement-meta-grid,
  .measurement-summary-strip {
    grid-template-columns: 1fr;
  }

  .measurement-source-item {
    grid-template-columns: 1fr;
  }

  .agent-value-chart-shell {
    min-width: 100%;
  }

  .result-metric-table-host {
    max-height: none;
  }

  .agent-overview-timeline-item {
    grid-template-columns: 2.4rem minmax(0, 1fr);
  }

  .run-history-header,
  .run-history-card-summary-row,
  .run-history-scene-header {
    flex-direction: column;
    align-items: stretch;
  }

  .run-history-stats {
    width: 100%;
  }

  .run-history-stat {
    flex: 1 1 120px;
  }

  .run-history-entry {
    grid-template-columns: 1fr;
  }

  .scene-workbench {
    grid-template-columns: 1fr;
  }

  .scene-sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

  .scene-editor-card {
    min-height: auto;
  }

  .scene-group-header,
  .scene-editor-header {
    flex-direction: column;
    align-items: stretch;
  }

  .scene-toolbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .help-modal-highlights {
    grid-template-columns: 1fr;
  }

  select,
  button {
    width: 100%;
  }

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

  .run-panel #run-btn,
  .run-log-footer #view-results-btn {
    width: 100%;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 16px;
  width: min(1080px, calc(100vw - 40px));
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.help-modal {
  width: min(920px, calc(100vw - 40px));
}

.help-modal-header-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.help-modal-kicker {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-color);
}

.help-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.help-modal-lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.7;
}

.help-modal-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.help-highlight-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-sm);
}

.help-highlight-title {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
}

.help-highlight-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
}

.help-modal-note {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
  color: var(--text-main);
  line-height: 1.65;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  box-shadow: none;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--text-main);
  transform: none;
}

.modal-body {
  padding: 1.5rem 1.75rem 1.25rem;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  outline: none;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.agent-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.mode-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(37, 99, 235, 0.05));
  margin-bottom: 1.25rem;
}

.mode-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mode-toggle-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.switch-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.switch-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-slider {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: transform 0.2s ease;
}

.switch-toggle input:checked + .switch-slider {
  background: var(--primary-color);
}

.switch-toggle input:checked + .switch-slider::after {
  transform: translateX(22px);
}

.social-settings-card {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: #f8fafc;
  padding: 1rem 1.1rem 0.35rem;
  margin-bottom: 1.25rem;
}

.compact-form-group {
  margin-bottom: 0.8rem;
}

.desire-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.9rem;
}

.desire-panel,
.value-panel {
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 1rem 1rem 1.05rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.desire-panel h4,
.value-panel h5 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.9rem;
}

.panel-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-color);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1;
}

.toggle-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.toggle-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.toggle-chip:hover {
  border-color: rgba(37, 99, 235, 0.32);
  background: #f8fbff;
  transform: translateY(-1px);
}

.toggle-chip.selected {
  border-color: rgba(37, 99, 235, 0.55);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.2));
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.1);
}

.toggle-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-desires-editor {
  margin-top: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: #f8fafc;
}

.custom-desires-copy {
  margin-bottom: 0.75rem;
}

.custom-desires-editor textarea {
  min-height: 220px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  background: #fff;
}

.custom-desire-status {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.custom-desire-status.error {
  color: var(--error-color);
}

.panel-empty-state {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.45;
}

.panel-empty-state.is-pending {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.panel-empty-state.is-error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.value-panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.value-panel h5 {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.value-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.value-item label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.value-item input[type="range"] {
  width: 100%;
  margin-top: 4px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.value-item input[type="range"]:disabled {
  accent-color: var(--border-color);
  cursor: not-allowed;
  opacity: 0.5;
}

.slider-val-display {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary-color);
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.slider-val-display.disabled {
  color: var(--text-light);
  background: #f1f5f9;
}

@media (max-width: 900px) {
  .agent-meta-grid,
  .value-panels-grid {
    grid-template-columns: 1fr;
  }

  .mode-toggle-card {
    align-items: flex-start;
  }

  .modal {
    width: calc(100vw - 20px);
    max-height: 94vh;
  }

  .modal-body {
    padding: 1.1rem 1rem 1rem;
  }
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  background-color: #f1f5f9;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status-indicator.running {
  background-color: #e0f2fe;
  color: #0369a1;
}

.status-indicator.completed {
  background-color: #dcfce7;
  color: #15803d;
}

.status-icon svg.spin {
  animation: spin 1s linear infinite;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  border-left: 4px solid var(--primary-color);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 300px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-content {
  flex-grow: 1;
  font-weight: 500;
  color: var(--text-main);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text-main);
  background: none;
  transform: none;
  box-shadow: none;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  transition: all 0.2s;
}

.search-box:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box input {
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  width: 200px;
  color: var(--text-main);
}

.search-box input::placeholder {
  color: var(--text-light);
}

/* Pagination */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.pagination-controls button {
  padding: 0.5rem;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f1f5f9;
  color: var(--text-light);
}

#page-indicator {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: #f1f5f9;
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
}

@media (max-width: 1100px) {
  .scenario-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

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

  .scenario-card-body {
    min-height: auto;
  }
}
