.scenario-page-content {
  padding: 20px 6px 34px;
}

.scenario-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.scenario-title-row {
  display: flex;
  align-items: center;
  gap: 13px;
}

.scenario-title-icon {
  width: 54px;
  height: 54px;
  border: 1px solid #d7e1f5;
  border-radius: 15px;
  background: #eef3ff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.scenario-title-icon img {
  width: 23px;
  height: 23px;
  filter: invert(29%) sepia(89%) saturate(2840%) hue-rotate(219deg) brightness(96%);
}

.scenario-title-row h2 {
  margin: 0 0 5px;
  color: #2458e8;
  font-size: 1.85rem;
  line-height: 1.15;
}

.scenario-title-row p {
  margin: 0;
  color: #8290aa;
  font-size: .88rem;
}

.create-scenario-btn,
.empty-create-btn {
  height: 52px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(90deg,#2855e9,#1f63f2);
  color: #fff;
  font-weight: 800;
  font-size: .92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  box-shadow: 0 10px 22px rgba(37,88,234,.18);
  cursor: pointer;
}

.scenario-filters {
  background: rgba(255,255,255,.84);
  border: 1px solid #dce4f1;
  border-radius: 18px;
  box-shadow: 0 9px 24px rgba(53,73,116,.055);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group > span {
  color: #64738f;
  font-size: .83rem;
  font-weight: 800;
}

.segmented-filter {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 13px;
  background: #f2f5fb;
  border: 1px solid #e0e8f5;
}

.segmented-filter button {
  height: 34px;
  min-width: 72px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #667792;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}

.segmented-filter button.active {
  background: #fff;
  color: #2458e8;
  box-shadow: 0 5px 13px rgba(40,88,220,.11);
}

.scenario-list-section {
  display: grid;
  gap: 12px;
}

.scenario-list-header {
  display: flex;
  justify-content: flex-start;
}

.scenario-list-header h3 {
  margin: 0;
  font-size: 1rem;
}

.scenario-list {
  display: grid;
  gap: 12px;
}

.scenario-card {
  background: rgba(255,255,255,.88);
  border: 1px solid #dce4f1;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(53,73,116,.055);
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(220px,1.6fr) minmax(160px,.9fr) minmax(130px,.7fr) minmax(120px,.65fr) auto;
  align-items: center;
  gap: 14px;
}

.scenario-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scenario-card-main h4 {
  margin: 0 0 9px;
  color: #1f2f58;
  font-size: .97rem;
}

.scenario-type-badge,
.scenario-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: .79rem;
  font-weight: 900;
}

.scenario-type-badge.rgb {
  background: #f0e2ff;
  color: #8c35d8;
}

.scenario-type-badge.relay {
  background: #e9efff;
  color: #2458e8;
}

.scenario-status-badge.active {
  background: #e6f8ed;
  color: #1ea34c;
}

.scenario-status-badge.paused {
  background: #f0f2f6;
  color: #7b879a;
}

.scenario-card-meta {
  display: grid;
  gap: 5px;
  border-right: 1px solid #e2e7ef;
  padding-right: 14px;
}

.scenario-card-meta span,
.scenario-card-meta small {
  color: #8290aa;
  font-size: .78rem;
}

.scenario-card-meta small {
  direction: ltr;
  text-align: right;
}

.scenario-card-meta strong {
  color: #1f2f58;
  font-size: .88rem;
}

.scenario-card-preview {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--step-color);
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(30,44,74,.18);
}

.scenario-color-empty {
  color: #8794ad;
  font-size: .8rem;
}

.scenario-card-actions {
  display: flex;
  gap: 7px;
}

.scenario-card-actions button {
  height: 38px;
  border: 1px solid #d8e2f2;
  border-radius: 10px;
  background: #f8faff;
  color: #6b7890;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}

.scenario-card-actions button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.scenario-icon-action {
  width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.scenario-icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scenario-icon-action.edit {
  color: #2458e8;
  background: #eef4ff;
  border-color: #d6e2ff;
}

.scenario-icon-action.delete {
  color: #ef4444;
  background: #fff0f0;
  border-color: #ffcaca;
}

.scenario-run-action {
  min-width: 82px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.scenario-run-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.scenario-run-action.ready {
  color: #2458e8;
  background: #eef4ff;
  border-color: #d6e2ff;
}

.scenario-run-action.ready svg {
  fill: currentColor;
}

.scenario-run-action.pending {
  color: #8a6a14;
  background: #fff8e6;
  border-color: #ffe3a8;
}

.scenario-run-action.pending svg {
  animation: scenario-spin .8s linear infinite;
}

.scenario-run-action.running {
  color: #ef4444;
  background: #fff0f0;
  border-color: #ffcaca;
}

.scenario-run-action.running svg {
  fill: currentColor;
}

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

.scenario-empty {
  background: rgba(255,255,255,.84);
  border: 1px solid #dce4f1;
  border-radius: 18px;
  padding: 44px 18px;
  text-align: center;
}

.scenario-empty span {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: #eef3ff;
  display: grid;
  place-items: center;
  margin: 0 auto 13px;
}

.scenario-empty img {
  width: 24px;
  height: 24px;
}

.scenario-empty h4 {
  margin: 0 0 8px;
  color: #1f2f58;
  font-size: 1rem;
}

.scenario-empty p {
  max-width: 580px;
  margin: 0 auto 18px;
  color: #8794ad;
  font-size: .86rem;
  line-height: 1.9;
}

html[data-theme="dark"] .scenario-filters,
html[data-theme="dark"] .scenario-card,
html[data-theme="dark"] .scenario-empty {
  background: rgba(17,28,50,.9);
  border-color: #2d3a56;
}

html[data-theme="dark"] .segmented-filter {
  background: #14213a;
  border-color: #33415e;
}

html[data-theme="dark"] .segmented-filter button.active {
  background: #1d2b48;
}

html[data-theme="dark"] .scenario-card-main h4,
html[data-theme="dark"] .scenario-card-meta strong,
html[data-theme="dark"] .scenario-empty h4 {
  color: #e8eefb;
}

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

  .scenario-card-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .scenario-page-content {
    padding: 14px 0 26px;
  }

  .scenario-hero,
  .scenario-filters {
    display: grid;
  }

  .create-scenario-btn,
  .empty-create-btn {
    width: 100%;
  }

  .filter-group {
    display: grid;
    gap: 8px;
  }

  .segmented-filter {
    overflow-x: auto;
  }

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

  .scenario-card-main {
    align-items: flex-start;
  }

  .scenario-card-meta {
    border-right: 0;
    border-top: 1px solid #e2e7ef;
    padding: 12px 0 0;
  }
}
