:root {
  --bg: #eef3fa;
  --card: #ffffff;
  --text: #172033;
  --muted: #5f6b82;
  --line: #d9e2ef;
  --blue: #2457c5;
  --blue-dark: #1b449c;
  --green: #147a4b;
  --green-bg: #e8f7ef;
  --red: #b42318;
  --red-bg: #fdecea;
  --amber: #9a5b00;
  --amber-bg: #fff4dc;
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 32px;
  background: #0f1b33;
  color: #fff;
}

.brand { font-size: 24px; font-weight: 700; }
.subbrand { color: #b8c6dd; font-size: 14px; margin-top: 3px; }
.machine { color: #b8c6dd; font-size: 14px; text-align: right; display: flex; align-items: center; gap: 12px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 80px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(23, 32, 51, 0.08);
  margin-bottom: 22px;
  overflow: hidden;
}

.cardhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 26px 26px 0;
  flex-wrap: wrap;
}
.cardhead h2 { margin: 0 0 6px; }
.cardhead .lead { margin: 0 0 14px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }

.login { max-width: 620px; margin: 40px auto; padding: 26px; }
.login .fieldrow input { flex: 1 1 240px; }

.step { display: flex; gap: 22px; padding: 26px; }
.stepnum {
  flex: 0 0 54px;
  height: 54px;
  border-radius: 50%;
  background: #e7eefc;
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepbody { flex: 1; min-width: 0; }
h2 { font-size: 26px; margin: 0 0 8px; }
h3 { font-size: 21px; margin: 0 0 8px; }
p.lead { color: var(--muted); margin: 0 0 18px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

.fieldrow {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin: 12px 0;
}
.fieldrow label { flex: 0 0 auto; color: var(--muted); font-size: 14px; }
.fieldrow input { flex: 1 1 280px; min-width: 220px; }
.fieldrow.compact { margin: 0 0 14px; }
.fieldrow.compact label { display: flex; flex-direction: column; gap: 6px; }
.fieldrow.compact select { min-width: 170px; }

input, select {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36, 87, 197, 0.14); }

button {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  background: #e7eefc;
  color: var(--blue-dark);
  font-weight: 600;
}
button:hover { filter: brightness(0.97); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--blue); color: #fff; }
button.danger { background: var(--red-bg); color: var(--red); }
button.ghost { background: #f2f5fa; color: var(--text); }
button.small { padding: 7px 12px; font-size: 14px; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

.divider { height: 1px; background: var(--line); margin: 22px 0; }

.statusline {
  margin: 14px 0;
  padding: 13px 16px;
  border-radius: 12px;
  background: #f2f6fc;
  color: var(--muted);
}
.statusline.ok { background: var(--green-bg); color: var(--green); }
.statusline.err { background: var(--red-bg); color: var(--red); }

.badge { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.badge.fast { background: var(--green-bg); color: var(--green); }
.badge.slow { background: var(--red-bg); color: var(--red); }
.badge.neutral { background: #eef2f8; color: var(--muted); }
.badge.online { background: var(--green-bg); color: var(--green); }
.badge.offline { background: #eef2f8; color: var(--muted); }
.badge.queue { background: var(--amber-bg); color: var(--amber); }
.badge.run { background: #e7eefc; color: var(--blue-dark); }

.runners { display: grid; gap: 12px; padding: 4px 26px 24px; }
.runner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: #fbfcfe;
}
.runner-main { min-width: 0; }
.runner-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 19px; font-weight: 700; }
.runner-meta { color: var(--muted); font-size: 14px; margin-top: 4px; word-break: break-word; }
.runner-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.runner-side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.runner-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: #9aa6ba; display: inline-block; }
.dot.online { background: #1f9d63; box-shadow: 0 0 0 3px rgba(31, 157, 99, 0.14); }
.dot.offline { background: #9aa6ba; }

.settings { margin: 0 26px 26px; }
.settings summary { cursor: pointer; font-weight: 700; color: var(--blue-dark); }
.settingsgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.settingsgrid label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.settingsgrid .wide { grid-column: 1 / -1; }
.settingsgrid .check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }

.code {
  background: #0f1b33;
  color: #dbe6f7;
  border-radius: 13px;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.chartbox { padding: 6px 26px 26px; position: relative; }
.chartbox canvas { width: 100%; height: auto; display: block; }

.history { display: grid; gap: 10px; padding: 4px 26px 26px; }
.historyrow {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 130px;
  gap: 14px;
  align-items: center;
  padding: 15px 17px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  cursor: pointer;
}
.historyrow:hover { border-color: #b9c8e8; background: #f4f8ff; }
.history-scenario { font-weight: 700; }
.history-date { color: var(--muted); font-size: 13px; }
.history-total { font-size: 20px; font-weight: 700; }
.history-mode { color: var(--muted); font-size: 14px; }
.history-status { font-size: 13px; color: var(--muted); }

.schedules { display: grid; gap: 10px; padding: 4px 26px 26px; }
.schedule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 18px;
  background: #fbfcfe;
}
.schedule-name { font-size: 18px; font-weight: 700; }
.schedule-meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.schedule-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; }
.check input { width: 18px; height: 18px; }

.empty { color: var(--muted); background: #f7f9fd; border-radius: 13px; padding: 18px; margin: 4px 26px 26px; }
.notice { border-radius: 14px; padding: 18px 20px; margin-bottom: 22px; }
.notice.error { background: var(--red-bg); color: var(--red); }
.notice.warn { background: var(--amber-bg); color: var(--amber); }
.notice h2 { color: inherit; margin-bottom: 6px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 51, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 18px;
  z-index: 20;
  overflow: auto;
}
.modalcard {
  position: relative;
  background: #fff;
  border-radius: 18px;
  width: min(980px, 100%);
  padding: 28px;
  box-shadow: 0 30px 80px rgba(15, 27, 51, 0.35);
}
.modalclose {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 28px;
  line-height: 1;
  padding: 4px 10px;
  background: transparent;
  color: var(--muted);
}
.bigresult { font-size: 46px; font-weight: 800; line-height: 1.1; margin: 8px 0; }
.bigresult small { font-size: 16px; font-weight: 600; color: var(--muted); display: block; margin-top: 6px; }
.compare { border-radius: 13px; padding: 14px 16px; margin: 16px 0; background: #f2f6fc; }
.compare.fast { background: var(--green-bg); color: var(--green); }
.compare.slow { background: var(--red-bg); color: var(--red); }
.compare.warn { background: var(--amber-bg); color: var(--amber); }
.metricsgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.metric { background: #f7f9fd; border-radius: 13px; padding: 14px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.tablewrap { overflow-x: auto; margin: 12px 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: #f7f9fd; }
tr.muted td { color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
.warnlist { margin: 12px 0; padding-left: 20px; color: var(--amber); }
.detailsbox { background: #f7f9fd; border-radius: 13px; padding: 16px; margin-top: 18px; }
.detailsbox dl { display: grid; grid-template-columns: 220px 1fr; gap: 7px 16px; margin: 0; }
.detailsbox dt { color: var(--muted); }
.detailsbox dd { margin: 0; word-break: break-word; }
.modalactions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.scenarios, .presets { padding: 6px 24px 12px; }
.scenario, .preset {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.scenario:last-child, .preset:last-child { border-bottom: none; }
.scenario-name { font-weight: 700; }
.scenario-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.scenario-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.checklist { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 6px; }
.fieldlabel { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  min-height: 120px;
  resize: vertical;
}
.artifactlist { margin: 8px 0 0; padding-left: 20px; }
.artifactlist a { color: var(--blue); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0f1b33;
  color: #fff;
  padding: 13px 20px;
  border-radius: 12px;
  z-index: 30;
  max-width: 90vw;
  pointer-events: none;
}

@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 18px; }
  .machine { text-align: left; }
  .cardhead { padding: 20px 18px 0; }
  .step { padding: 18px; gap: 14px; }
  .stepnum { flex-basis: 42px; height: 42px; font-size: 19px; }
  h2 { font-size: 22px; }
  .runners, .history, .schedules { padding-left: 18px; padding-right: 18px; }
  .settings { margin-left: 18px; margin-right: 18px; }
  .empty { margin-left: 18px; margin-right: 18px; }
  .chartbox { padding-left: 18px; padding-right: 18px; }
  .historyrow { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metricsgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settingsgrid { grid-template-columns: 1fr; }
  .detailsbox dl { grid-template-columns: 1fr; }
  .runner { flex-direction: column; align-items: stretch; }
  .runner-side { align-items: flex-start; }
  .runner-actions { justify-content: flex-start; }
  .schedule { flex-direction: column; align-items: stretch; }
  .schedule-actions { justify-content: flex-start; }
  .login { margin: 20px 14px; padding: 18px; }
}
