:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e0ea;
  --text: #18202b;
  --muted: #667085;
  --accent: #1463ff;
  --accent-soft: #e8f0ff;
  --danger: #b42318;
  --warn: #b54708;
  --success: #0c7a43;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(18, 33, 56, 0.08);
}

.login-brand p {
  margin-top: 8px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-status {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 650;
}

h2 {
  font-size: 17px;
  font-weight: 650;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

#statusText {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.auth,
.actions,
.section-head,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth {
  flex-wrap: wrap;
  justify-content: flex-end;
}

main {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 18px 20px 36px;
}

.band {
  margin: 0 0 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.probe-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.metric.compact {
  min-height: 0;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 700;
}

.metric-value.compact {
  font-size: 18px;
  line-height: 1.35;
}

.metric-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

th {
  background: #f0f4fa;
  color: #394150;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

input,
select,
textarea,
button {
  min-height: 36px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  min-width: 82px;
  padding: 7px 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button.primary,
form button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.danger {
  color: var(--danger);
}

code {
  display: inline-block;
  padding: 2px 6px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  color: #243042;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-btn {
  min-width: 56px;
  min-height: 28px;
  padding: 4px 8px;
}

.status {
  display: inline-block;
  min-width: 72px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  text-align: center;
}

.status.healthy,
.status.success,
.status.enabled,
.status.ready {
  color: var(--success);
  border-color: #8fd8b2;
}

.status.cooldown,
.status.failed,
.status.disabled {
  color: var(--danger);
  border-color: #f1a8a1;
}

.status.degraded,
.status.running {
  color: var(--warn);
  border-color: #ffd39b;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
}

.grid-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.grid-form .wide {
  grid-column: 1 / -1;
}

.grid-form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
}

.grid-form .check input {
  width: 18px;
  min-height: 18px;
}

.thumb {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #eef2f7;
}

.probe-history-wrap {
  margin-top: 14px;
}

.probe-output {
  display: grid;
  gap: 8px;
}

.probe-links {
  display: grid;
  gap: 6px;
}

.probe-links a {
  color: var(--accent);
  text-decoration: none;
}

.probe-links a:hover {
  text-decoration: underline;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar > * {
  width: auto;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.api-docs {
  display: grid;
  gap: 16px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.doc-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.doc-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.doc-card p,
.doc-card li {
  color: #394150;
  line-height: 1.55;
}

.doc-card ul {
  margin: 10px 0 0 18px;
  padding: 0;
}

.doc-card pre {
  overflow: auto;
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f4f7fb;
  color: #243042;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .auth {
    justify-content: flex-start;
  }

  .stats-grid,
  .probe-meta-grid,
  .doc-grid,
  .grid-form {
    grid-template-columns: 1fr;
  }
}
