@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --ink: #15202b;
  --muted: #667788;
  --line: #d9e1ea;
  --line-strong: #c5d0dc;
  --panel: #ffffff;
  --panel-soft: #f7f9fb;
  --bg: #e8eef3;
  --accent: #0f766e;
  --accent-soft: #d9f3ef;
  --accent-ink: #0b4f49;
  --danger: #c24141;
  --danger-soft: #fde8e8;
  --warn: #b5791f;
  --ok: #1f7a4d;
  --ok-soft: #e5f6ec;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(21, 32, 43, .04), 0 12px 28px rgba(21, 32, 43, .06);
  --sidebar-w: 248px;
  font-family: "Outfit", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  line-height: 1.45;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 420px at -5% -10%, rgba(15, 118, 110, .10), transparent 55%),
    radial-gradient(700px 380px at 105% 0%, rgba(37, 99, 140, .08), transparent 50%),
    linear-gradient(180deg, #f4f7fa 0%, var(--bg) 100%);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}
textarea { resize: vertical; min-height: 88px; }
button {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: .01em;
}
button:hover { background: #0d6861; }
button:active { transform: translateY(1px); }
button.secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
button.secondary:hover { background: var(--panel-soft); border-color: #b7c4d2; }
button.danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}
button.danger:hover { background: #a83434; }
button.ghost {
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: rgba(255,255,255,.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand {
  padding: 8px 10px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #129286, #0b4f49);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.brand strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.nav {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 12px;
  scrollbar-width: thin;
}
.nav .group-title {
  margin: 14px 10px 6px;
  color: #8a97a8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #3d4d5c;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 10px;
  position: relative;
}
.nav button:hover {
  background: rgba(15, 118, 110, .06);
  color: var(--ink);
}
.nav button.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-color: rgba(15, 118, 110, .18);
  font-weight: 600;
}
.nav button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar-foot {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sidebar-foot .hint {
  margin: 0 0 10px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.main {
  padding: 28px 32px 48px;
  max-width: 1120px;
  animation: fadeIn .22s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 52ch;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 650;
}
.card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
  color: #334455;
}
.card-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.section-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 16px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #ffffff, #f7fafb);
  border: 1px solid var(--line);
}
.stat .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.stat .value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  word-break: break-word;
  line-height: 1.2;
}
.stat .value.sm { font-size: 15px; font-weight: 600; }

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.grid-2 {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > span {
  color: #5d6d7c;
  font-size: 12px;
  font-weight: 600;
}
.field.full { grid-column: 1 / -1; }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  user-select: none;
}
.switch input {
  appearance: none;
  width: 40px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: #c9d4df;
  border: none;
  position: relative;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(21,32,43,.06);
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
  box-shadow: 0 1px 3px rgba(21,32,43,.18);
}
.switch input:checked {
  background: var(--accent);
}
.switch input:checked::after {
  transform: translateX(16px);
}
.switch input:focus {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .16);
}
.switch span { font-size: 14px; font-weight: 500; }

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.form-grid .field.full,
.form-grid .full { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.form-actions .field {
  flex: 1 1 220px;
  min-width: 200px;
}
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.form-footer .section-note { margin: 0; flex: 1; min-width: 200px; }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.muted { color: var(--muted); }
.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: -.01em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-soft);
  color: #405060;
  border: 1px solid var(--line);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #c6e8d3; }
.badge.warn { background: #fff4df; color: var(--warn); border-color: #f0ddb0; }
.badge.off { background: #eef2f6; color: #738292; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 12px;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}
th {
  color: #6a7a8a;
  font-weight: 650;
  font-size: 12px;
  background: var(--panel-soft);
  position: sticky;
  top: 0;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(15, 118, 110, .03); }
td input, td select {
  width: 100%;
  padding: 8px 10px;
  background: #fff;
}

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #f5f8fb);
  font-size: 14px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: "";
  position: absolute;
  inset: -20% auto auto -10%;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15,118,110,.18), transparent 65%);
  pointer-events: none;
}
.login-wrap::after {
  content: "";
  position: absolute;
  right: -8%;
  bottom: -18%;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,140,.14), transparent 65%);
  pointer-events: none;
}
.login-card {
  width: min(420px, 100%);
  position: relative;
  z-index: 1;
  padding: 28px 26px 24px;
}
.login-card .brand-mark { margin-bottom: 14px; }
.login-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -.02em;
}
.login-actions { margin-top: 18px; }
.login-actions button { width: 100%; padding: 12px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 12px 14px;
  border-radius: 10px;
  display: none;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 500;
  max-width: min(360px, calc(100vw - 32px));
}
.toast.show {
  display: block;
  animation: toastIn .18s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .nav .group-title { grid-column: 1 / -1; }
  .stats, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
}
