:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e0ea;
  --muted: #667085;
  --text: #172033;
  --brand: #1769e0;
  --brand-dark: #0f55bd;
  --danger: #b42318;
  --success: #067647;
  --warning: #b54708;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--brand);
  text-decoration: none;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: #101828;
  color: #f8fafc;
  padding: 22px 16px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 28px;
}

.nav a,
.logout-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  color: #d0d5dd;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.nav a:hover,
.logout-button:hover {
  background: #1d2939;
  color: #ffffff;
}

.main {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

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

.band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 26px;
  line-height: 1.2;
  margin-top: 8px;
}

.stat .stat-id,
.stat-id {
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

.button:hover,
button.button:hover {
  background: var(--brand-dark);
  color: #fff;
}

.button.secondary {
  background: #fff;
  color: var(--brand);
}

.button.secondary:hover {
  background: #eef4ff;
}

.alert {
  border-radius: 6px;
  padding: 11px 12px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert.success {
  color: var(--success);
  background: #ecfdf3;
  border-color: #abefc6;
}

.alert.error {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecdca;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.form-grid.compact {
  grid-template-columns: minmax(260px, 420px) auto;
  align-items: end;
}

.actions-row {
  display: flex;
  flex-direction: row;
  align-items: end;
}

.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.checkline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
}

.checkline input {
  width: auto;
  min-height: auto;
}

label {
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 150px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

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

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

th {
  color: #475467;
  font-weight: 700;
  background: #f8fafc;
}

.snippet {
  max-width: 520px;
  color: #344054;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: #344054;
  background: #f8fafc;
}

.badge.ok {
  color: var(--success);
  border-color: #abefc6;
  background: #ecfdf3;
}

.badge.warn {
  color: var(--warning);
  border-color: #fedf89;
  background: #fffaeb;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.login-box h1 {
  margin: 0 0 18px;
  font-size: 22px;
}

pre.json {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1220;
  color: #d6e2ff;
  padding: 14px;
  font-size: 13px;
}

.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .grid.stats,
  .grid.two,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.compact {
    grid-template-columns: 1fr;
  }

  .band {
    overflow-x: auto;
  }
}
