:root {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --line-soft: #edf0f5;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #c2413b;
  --danger-soft: #fff1f0;
  --ok: #11805a;
  --ok-soft: #edfdf5;
  --warn: #a35c00;
  --warn-soft: #fff7e8;
  --shadow: 0 14px 34px rgba(30, 41, 59, 0.08);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(30, 41, 59, 0.05);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h1,
.topbar p,
h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 20px;
  line-height: 1.25;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.auth-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-row input {
  width: min(300px, 42vw);
  margin-top: 0;
}

main {
  width: min(1360px, calc(100vw - 32px));
  margin: 24px auto 56px;
}

.status {
  min-height: 32px;
  color: var(--muted);
  margin-bottom: 14px;
}

.status span {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 6px 10px;
  overflow-wrap: anywhere;
}

.status .warn {
  border-color: #f1c46b;
  background: var(--warn-soft);
}

.status .off {
  border-color: #efb2ad;
  background: var(--danger-soft);
}

.band,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.band {
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.panel {
  padding: 18px;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.section-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h2,
.panel-head h2,
.panel > h2 {
  font-size: 16px;
  line-height: 1.3;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.metric {
  position: relative;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-alt);
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.metric:nth-child(2)::before {
  background: var(--ok);
}

.metric:nth-child(3)::before {
  background: #7c3aed;
}

.metric:nth-child(4)::before {
  background: #0f766e;
}

.metric:nth-child(5)::before {
  background: var(--warn);
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1.05;
}

.metric span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

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

input,
select,
button {
  min-height: 38px;
  border-radius: 7px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px 10px;
  margin-top: 5px;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 650;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

button:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: white;
  color: var(--accent);
}

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

button.danger:hover {
  border-color: #a8322d;
  background: #a8322d;
}

form button {
  margin-top: 14px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

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

th {
  color: var(--muted);
  background: var(--surface-alt);
  font-weight: 700;
  font-size: 12px;
}

tbody tr:hover td {
  background: #fbfdff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

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

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 650;
  border: 1px solid var(--line);
  background: white;
}

.pill.ok {
  border-color: #a7e8c7;
  background: var(--ok-soft);
}

.pill.off {
  border-color: #efb2ad;
  background: var(--danger-soft);
}

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

.off {
  color: var(--danger);
}

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

.license-output {
  border: 1px solid #b8cff8;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.license-output code {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

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

  .auth-row {
    justify-content: flex-start;
  }

  .auth-row input {
    width: 100%;
  }

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

  table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100vw - 20px, 1360px);
    margin-top: 14px;
  }

  .topbar {
    padding: 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .topbar h1 {
    font-size: 17px;
  }
}
