:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #d8dee9;
  --text: #172033;
  --muted: #5b667a;
  --accent: #007c89;
  --good: #12805c;
  --warn: #b7791f;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* 顶部操作区按钮和外链按钮共用同一组视觉样式，便于现场顺手跳转。 */
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-decoration: none;
}

.link-button:hover {
  background: rgba(0, 124, 137, 0.08);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 22px auto;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric,
section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  min-height: 86px;
  padding: 14px;
}

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

.value {
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 24px;
  font-weight: 650;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  background: var(--warn);
}

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

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

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

section h2 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 650;
}

dl {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 4px 16px 12px;
}

dt,
dd {
  min-height: 36px;
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f7;
}

dt {
  color: var(--muted);
}

dd {
  overflow-wrap: anywhere;
  font-family: Consolas, "Cascadia Mono", monospace;
}

.empty {
  color: var(--muted);
  font-family: inherit;
}

.jog-panel {
  grid-column: 1 / -1;
}

.jog-content {
  padding: 16px;
}

.jog-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.jog-settings label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.jog-settings input {
  min-height: 36px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.jog-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(64px, 1fr));
  gap: 8px;
}

.jog-button {
  min-height: 44px;
  padding: 0 8px;
  font-weight: 650;
  touch-action: none;
  user-select: none;
}

.jog-button.active {
  filter: brightness(0.88);
}

.jog-status {
  min-height: 24px;
  margin-top: 12px;
  color: var(--muted);
  font-family: Consolas, "Cascadia Mono", monospace;
}

.jog-status.error {
  color: var(--bad);
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary,
  .grid {
    grid-template-columns: 1fr;
  }

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

  dl {
    grid-template-columns: 1fr;
  }

  dt {
    border-bottom: 0;
    padding-bottom: 2px;
  }

  dd {
    padding-top: 2px;
  }
}
