:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-weak: #e6fffb;
  --danger: #b91c1c;
  --warning: #b45309;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef7f5;
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  padding: 34px;
  background: #fff;
  border: 1px solid #dbe7e4;
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, .08);
}

.auth-title {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0;
}

.auth-subtitle {
  margin: 0 0 26px;
  color: var(--muted);
}

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

.sidebar {
  background: #101827;
  color: #dbeafe;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #14b8a6;
  color: #fff;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav a {
  padding: 10px 12px;
  border-radius: 7px;
  color: #b9c8dc;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.main {
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar strong {
  font-size: 16px;
}

.content {
  padding: 24px 28px 40px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-title {
  margin: 0;
  font-size: 24px;
}

.page-desc {
  margin: 4px 0 0;
  color: var(--muted);
}

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

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.1;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

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

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

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

label {
  color: #374151;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .14);
}

.btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 13px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn.danger {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff5f5;
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: #4b5563;
  background: #f9fafb;
  font-weight: 700;
  white-space: nowrap;
}

td {
  color: #1f2937;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
}

.status.ok {
  background: var(--accent-weak);
  color: #0f766e;
}

.status.off {
  background: #f3f4f6;
  color: #6b7280;
}

.status.warn {
  background: #fff7ed;
  color: var(--warning);
}

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

.code {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
}

.json-preview {
  max-width: 420px;
  max-height: 80px;
  overflow: auto;
  font-size: 12px;
  color: #475569;
  background: #f8fafc;
  padding: 8px;
  border-radius: 6px;
}

.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

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

  .sidebar {
    position: static;
  }

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

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