:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d8dee8;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #047857;
  --blue: #2563eb;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

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

.login-box h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #10201f;
  color: #e5f5f2;
  padding: 18px 14px;
  overflow-y: auto;
}

.brand {
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.brand span {
  color: #9fc7c1;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.nav button {
  color: #dbeafe;
  background: transparent;
  border-radius: 6px;
  text-align: left;
  padding: 11px 10px;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.content {
  min-width: 0;
}

.topbar {
  min-height: 64px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.page {
  padding: 22px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

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

.card .value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
}

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

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

.panel-title h3 {
  margin: 0;
  font-size: 16px;
}

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

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

.field label {
  color: var(--muted);
  font-size: 12px;
}

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

textarea {
  resize: vertical;
}

.btn {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 13px;
  background: #e5e7eb;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn.primary {
  background: var(--brand);
  color: white;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.danger {
  background: #fee2e2;
  color: var(--danger);
}

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

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  font-size: 13px;
  white-space: nowrap;
}

th {
  background: #f3f6f8;
  color: #374151;
  position: sticky;
  top: 0;
}

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

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

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

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

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

.badge.blue {
  background: #dbeafe;
  color: var(--blue);
}

.message {
  margin: 10px 0;
  color: var(--danger);
  font-size: 13px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.mobile-menu {
  display: none;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 10px;
  }

  .brand {
    display: none;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    margin-top: 0;
  }

  .nav button {
    flex: 0 0 auto;
  }

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

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

  .topbar {
    position: static;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .cards,
  .form-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    flex: 1 1 100%;
  }

  .btn {
    width: 100%;
  }
}
