:root {
  --bg-a: #f5f8ff;
  --bg-b: #eefbf9;
  --text: #10243e;
  --muted: #5e718a;
  --line: #d7e2ef;
  --card: #ffffff;
  --blue: #1473e6;
  --teal: #0f9d8a;
  --green: #16a34a;
  --orange: #c57a00;
  --red: #d43838;
  --shadow: 0 8px 24px rgba(16, 36, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "Times New Roman", serif;
  background: radial-gradient(1200px 700px at 10% -10%, #dce9ff 0%, transparent 55%),
    radial-gradient(1000px 600px at 110% 0%, #d6f9f2 0%, transparent 55%),
    linear-gradient(145deg, var(--bg-a), var(--bg-b));
  line-height: 1.5;
}

.appHeader {
  padding: 22px 20px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.titleWrap h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.titleWrap p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.endpoint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.refreshBar {
  margin: 0 20px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.heartbeat {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 rgba(15, 157, 138, 0.5);
  animation: pulse 1.8s infinite;
}

.heartbeat.warn {
  background: var(--orange);
  box-shadow: none;
  animation: none;
}

.heartbeat.err {
  background: var(--red);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 157, 138, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(15, 157, 138, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 157, 138, 0);
  }
}

.refreshText {
  font-weight: 700;
}

.refreshMeta {
  color: var(--muted);
  font-size: 13px;
}

.refreshError {
  grid-column: 1 / -1;
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
}

.dashboardGrid {
  padding: 0 20px 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.cardHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.cardHead h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.badge,
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: #f6f9ff;
}

.badge.running {
  border-color: #83c8ff;
  background: #eaf5ff;
  color: var(--blue);
}

.badge.idle {
  border-color: #9ad9c9;
  background: #e9faf5;
  color: var(--teal);
}

.badge.failed {
  border-color: #f2b3b3;
  background: #fff0f0;
  color: var(--red);
}

.chip.danger {
  color: var(--red);
  background: #fff1f1;
  border-color: #f4c2c2;
}

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

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

.metrics3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fcfdff;
}

.metric .k {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.metric .v {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
}

.metric .v.ok {
  color: var(--green);
}

.metric .v.bad {
  color: var(--red);
}

.pretext {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.6;
}

.triggerBtn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1a9fd8);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.triggerBtn:hover {
  transform: translateY(-1px);
}

.triggerBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.triggerBtn.loading::after {
  content: "...";
  margin-left: 6px;
  letter-spacing: 2px;
}

.hint {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.progressRow {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.progressTrack {
  margin-top: 8px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #eaf1fb;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2f8fff, #32c1b8);
  transition: width 0.4s ease;
}

.failureList,
.logList {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.failureItem,
.logItem {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fcfdff;
}

.failureItem {
  border-left: 4px solid var(--red);
}

.logItem.info {
  border-left: 4px solid var(--blue);
}

.logItem.warn {
  border-left: 4px solid var(--orange);
}

.logItem.error {
  border-left: 4px solid var(--red);
}

.failureTitle,
.logLine {
  font-size: 16px;
  line-height: 1.6;
  font-weight: 700;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.failureMeta,
.logMeta,
.empty {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

details > summary {
  cursor: pointer;
  font-weight: 700;
}

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

.advancedCol h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.tableWrap {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 7px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f9ff;
  position: sticky;
  top: 0;
}

@media (max-width: 980px) {
  .titleWrap h1 {
    font-size: 34px;
  }

  .titleWrap p {
    font-size: 16px;
  }

  .cardHead h2 {
    font-size: 24px;
  }

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

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

  .wide {
    grid-column: auto;
  }

  .metrics3,
  .metrics4,
  .advancedWrap {
    grid-template-columns: 1fr;
  }

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

  .refreshMeta {
    grid-column: 1 / -1;
  }
}
