:root {
  --bg: #f6f8fb;
  --panel: #fff;
  --line: #d9dee8;
  --text: #182033;
  --muted: #667085;
  --primary: #1769e0;
  --primary-dark: #1157bd;
  --ok: #17864d;
  --off: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  min-height: 72px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

#subtitle,
.muted {
  color: var(--muted);
}

main {
  padding: 20px 24px 32px;
  display: grid;
  gap: 16px;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.on {
  background: var(--ok);
}

.dot.off {
  background: var(--off);
}

.panel,
.toolbar,
.summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, max-content) minmax(160px, 220px) minmax(280px, 1fr);
  align-items: end;
  gap: 12px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metric {
  display: grid;
  gap: 2px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
}

.section-head,
.tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scenario-list {
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.scenario {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 9px;
}

.scenario.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(23, 105, 224, 0.12);
}

.scenario .title {
  font-weight: 800;
}

.scenario .meta {
  color: var(--muted);
  font-size: 12px;
}

.selected {
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  padding: 10px;
  margin-bottom: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toggle {
  display: inline-flex;
  align-items: center;
  grid-auto-flow: column;
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 13px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button.primary:hover {
  background: var(--primary-dark);
}

.runner {
  display: grid;
  gap: 12px;
  align-content: start;
}

pre {
  min-height: 96px;
  max-height: 300px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  white-space: pre-wrap;
}

.tabbar {
  justify-content: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tabbar button.active {
  color: #fff;
  background: var(--text);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 520px;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f0f3f8;
  font-size: 12px;
}

td {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .topbar,
  .workspace,
  .toolbar,
  .summary,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
