:root {
  color-scheme: light;
  --bg: #edf0ec;
  --panel: #fffdf8;
  --panel-strong: #f8f3e7;
  --ink: #1d2522;
  --muted: #6b746f;
  --line: #d8d1c3;
  --nav: #17211d;
  --nav-soft: #24342e;
  --teal: #16756f;
  --teal-dark: #0d5955;
  --amber: #b75f16;
  --red: #b3261e;
  --green: #087443;
  --shadow: 0 18px 45px rgba(38, 45, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(23, 33, 29, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 33, 29, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  min-height: 38px;
  padding: 0 15px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

button:hover {
  background: var(--teal-dark);
  box-shadow: 0 8px 18px rgba(13, 89, 85, 0.18);
  transform: translateY(-1px);
}

button.secondary {
  background: #ebe4d7;
  color: var(--ink);
}

button.secondary:hover {
  background: #ded4c4;
  box-shadow: none;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.danger {
  background: var(--red);
}

button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fffefa;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 117, 111, 0.12);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: white;
  padding: 22px 16px;
  box-shadow: 12px 0 35px rgba(23, 33, 29, 0.16);
}

.brand,
.login-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: #d9a441;
  color: #17211d;
  font-weight: 900;
}

.brand-mark.large {
  width: 52px;
  height: 52px;
  font-size: 19px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: #aebdb6;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  color: #dce6df;
  text-align: left;
  min-height: 42px;
  padding: 0 12px;
}

.nav::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.nav.active,
.nav:hover {
  background: var(--nav-soft);
  box-shadow: none;
  transform: none;
}

.nav.active::after {
  background: #d9a441;
}

.side-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #aebdb6;
  font-size: 12px;
  padding: 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #44c179;
  box-shadow: 0 0 0 4px rgba(68, 193, 121, 0.14);
}

.main {
  min-width: 0;
  padding: 30px;
  overflow-x: auto;
}

.login-page {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.login-heading {
  margin-bottom: 24px;
}

.login h1,
.toolbar h1,
.login-card h1 {
  margin: 0;
  font-size: 26px;
}

.login-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 13px;
}

.primary-action {
  width: 100%;
  margin-top: 4px;
}

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

.toolbar h1 {
  font-size: 30px;
  line-height: 1.15;
}

.kicker {
  margin-bottom: 6px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.api-label {
  max-width: min(760px, 80vw);
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(38, 45, 40, 0.08);
}

.stat {
  position: relative;
  min-height: 116px;
  padding: 17px 16px;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--teal);
}

.stat.warning::before {
  background: var(--amber);
}

.stat.danger::before {
  background: var(--red);
}

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

.stat .value {
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
}

.stat .hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.table-card {
  overflow: hidden;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
}

.table-title {
  font-weight: 800;
}

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

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #ebe4d7;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fffaf0;
  color: #4a554f;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: #fbf7ee;
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  background: #ece7dc;
  color: #4c514d;
}

.badge.ok {
  color: var(--green);
  background: #dff4e7;
}

.badge.warn {
  color: var(--amber);
  background: #fff0d8;
}

.badge.danger {
  color: var(--red);
  background: #fde3df;
}

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

.error {
  color: var(--red);
  min-height: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

@media (max-width: 880px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .main {
    padding: 18px;
  }

  .toolbar {
    flex-direction: column;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}
