:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --panel: #ffffff;
  --text: #182026;
  --muted: #687782;
  --line: #d8e0e5;
  --blue: #1c5fb8;
  --red: #c93131;
  --green: #16784c;
  --amber: #9b6a13;
  --shadow: 0 12px 34px rgba(29, 43, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell,
.debug-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.panel,
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

.stats-grid,
.workspace-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

.workspace-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.stat {
  padding: 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.panel {
  margin-top: 16px;
  padding: 18px;
}

.workspace-grid .panel {
  margin-top: 0;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.icon-button,
.secondary-button,
.primary-button,
.small-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 13px;
  background: #fff;
  color: var(--text);
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

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

.small-button {
  min-height: 32px;
  padding: 0 10px;
}

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

.scenario-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.scenario-form .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  min-height: 128px;
  padding: 10px 11px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(28, 95, 184, 0.14);
}

.list {
  display: grid;
  gap: 10px;
}

.row-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

.row-title {
  min-width: 0;
}

.row-title strong,
.row-title span {
  display: block;
  overflow-wrap: anywhere;
}

.row-title span,
.meta-line {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pending {
  background: #fff3d7;
  color: var(--amber);
}

.status-running,
.status-busy {
  background: #e4f0ff;
  color: var(--blue);
}

.status-passed,
.status-online {
  background: #e5f5ee;
  color: var(--green);
}

.status-failed {
  background: #fde8e8;
  color: var(--red);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(460px, calc(100% - 36px));
  border-radius: 8px;
  background: #182026;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.debug-body {
  background: var(--bg);
}

.debug-table {
  background: #fff;
  border: 1px solid var(--line);
}

.debug-table th {
  width: 220px;
}

@media (max-width: 980px) {
  .stats-grid,
  .workspace-grid,
  .scenario-form {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-shell,
  .debug-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 10px;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 23px;
  }
}
