/* 后台管理样式（与前台同一套红色主题） */
:root {
  --theme: #FF2442;
  --theme-dark: #D91A37;
  --theme-light: #FFE8EC;
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --text-1: #1A1A1A;
  --text-2: #666666;
  --text-3: #999999;
  --border: #E8E8E8;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0, 0, 0, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(255, 36, 66, .08), transparent),
    radial-gradient(600px 300px at 90% 100%, rgba(255, 36, 66, .06), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 32px 28px;
  text-align: center;
  animation: rise .4s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--theme);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.login-card h1 { font-size: 20px; margin-top: 14px; }
.login-sub { color: var(--text-3); font-size: 13px; margin: 4px 0 24px; }

.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  border-color: var(--theme);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, .12);
}

.login-tip { font-size: 12px; color: var(--text-3); margin-top: 16px; }

/* ---------- 后台主界面 ---------- */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}
.admin-brand .brand-mark { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }

.admin-header-right { display: flex; gap: 8px; }

.admin-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
  animation: rise .4s ease both;
}
.card:nth-child(2) { animation-delay: .05s; }
.card:nth-child(3) { animation-delay: .1s; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.card-head h2 { font-size: 16px; }
.card-desc { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.card-desc a { color: var(--theme); text-decoration: none; }

.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
}
.badge-on  { background: #E8F8EE; color: #0CA678; }
.badge-off { background: #FFF1F0; color: var(--theme); }

.field-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) {
  .field-grid { grid-template-columns: repeat(3, 1fr); }
}

.field-hint { font-size: 12px; color: var(--text-3); margin: 4px 0 14px; }

.btn {
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 8px;
  transition: all .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--theme); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--theme-dark); }
.btn-ghost {
  background: #fff;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--theme); border-color: var(--theme); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

.msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.ok  { color: #0CA678; }
.msg.bad { color: var(--theme); }

.env-list { list-style: none; }
.env-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-2);
}
.env-list li:last-child { border-bottom: none; }
.env-list b.ok { color: #0CA678; }
.env-list b.bad { color: var(--theme); }
.env-list b.warn { color: #E8A300; }

/* ---------- 数据库错误页 ---------- */
.error-page {
  max-width: 520px;
  margin: 15vh auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px;
  text-align: center;
}
.error-page h1 { font-size: 18px; margin-bottom: 12px; }
.error-page p { font-size: 14px; color: var(--text-2); margin-bottom: 8px; word-break: break-all; }
.error-page .tip { color: var(--text-3); font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(0, 0, 0, .82);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 999;
  max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
