:root {
  --bg: #eef3f6;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: #ccfbf1;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --radius: 18px;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  --sider: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ===== 登录 ===== */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(45, 212, 191, 0.35), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(14, 165, 233, 0.18), transparent 55%),
    linear-gradient(165deg, #f0fdfa 0%, #eef2ff 48%, #f8fafc 100%);
}
.login-panel {
  position: relative;
  width: min(440px, 100%);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 40px 36px 28px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2dd4bf, #0d9488);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.28);
}
.brand-mark.sm { width: 40px; height: 40px; font-size: 18px; border-radius: 14px; }
.login-brand h1 { font-size: 24px; line-height: 1.2; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.login-form label { display: block; margin-bottom: 16px; }
.login-form label span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.login-form input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  outline: none;
}
.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 64px; }
.pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 13px;
}
.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.login-foot {
  margin-top: 18px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

/* ===== 按钮 ===== */
.btn-primary, .btn-soft, .btn-ghost, .btn-danger, .btn-link {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  transition: 0.15s ease;
}
.btn-primary {
  background: linear-gradient(135deg, #2dd4bf, #0d9488);
  color: #fff;
  padding: 12px 18px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.25);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-block { width: 100%; height: 48px; }
.btn-soft {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
}
.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  padding: 10px 14px;
  width: 100%;
}
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 8px 12px;
  font-size: 13px;
}
.btn-link {
  background: transparent;
  color: var(--primary);
  padding: 4px 8px;
  font-size: 13px;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* ===== 布局 ===== */
.shell { min-height: 100vh; display: flex; }
.sider {
  width: var(--sider);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0f766e 0%, #115e59 55%, #134e4a 100%);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sider-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 22px;
}
.sider-brand strong { display: block; font-size: 16px; }
.sider-brand span { font-size: 12px; opacity: 0.7; }
.sider-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  text-align: left;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.82);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.sider-foot { padding-top: 12px; display: grid; gap: 10px; }
.admin-chip {
  background: rgba(0,0,0,0.18);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main { flex: 1; min-width: 0; padding: 28px 32px 48px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  gap: 16px;
}
.topbar h2 { font-size: 24px; margin-bottom: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.stat-card .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}
.stat-card .label { margin-top: 6px; color: var(--muted); font-size: 13px; }

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}
.toolbar.wrap { flex-wrap: wrap; }
.toolbar input, .toolbar select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  min-width: 160px;
}
.toolbar input { flex: 1; min-width: 220px; }

.table-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: auto;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  vertical-align: middle;
}
th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
.route-cell { max-width: 280px; line-height: 1.45; }
.empty-row td { text-align: center; color: var(--muted); padding: 36px 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.warn { background: #ffedd5; color: #9a3412; }
.badge.info { background: #e0f2fe; color: #075985; }
.badge.muted { background: #f1f5f9; color: #64748b; }

.config-wrap { display: grid; gap: 16px; padding-bottom: 80px; }
.config-group {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 20px 22px;
}
.config-group h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.config-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px 18px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.config-item:last-child { border-bottom: none; }
.config-item .meta .title { font-size: 14px; font-weight: 600; }
.config-item .meta .hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.config-item input[type="text"],
.config-item input[type="number"],
.config-item textarea {
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.config-item textarea { min-height: 88px; resize: vertical; }
.switch {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: #cbd5e1;
  position: relative;
  cursor: pointer;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: 0.15s ease;
}
.switch.on::after { left: 23px; }

.sticky-actions {
  position: sticky;
  bottom: 16px;
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.card-form {
  max-width: 480px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 24px;
}
.card-form h3 { margin-bottom: 8px; }
.card-form label { display: block; margin: 14px 0; font-size: 13px; color: var(--muted); }
.card-form input {
  display: block;
  width: 100%;
  margin-top: 8px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sider {
    width: 100%;
    height: auto;
    position: relative;
  }
  .sider-nav { flex-direction: row; flex-wrap: wrap; }
  .config-item { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
}
