/* ==========================================================
   VPS 导航 · datafa.st 风格主题
   暖米底 + 亮翠绿主色 + 大圆角卡片 + 细边无阴影
   ========================================================== */

:root {
  --bg:         #faf7f3;   /* 暖米底 */
  --bg-alt:     #f3ede2;   /* 分区底 */
  --surface:    #ffffff;   /* 卡片 */
  --surface-2:  #f7f3ec;   /* 次级面 */
  --border:     #e7e0d2;   /* 暖色细边 */
  --border-strong: #d9d0bd;
  --text:       #17181b;   /* 深近黑 */
  --text-2:     #3a3f46;
  --muted:      #6b7280;
  --brand:      #16a34a;   /* 主翠绿 */
  --brand-hover:#15803d;
  --brand-soft: #dcfce7;   /* 翠绿浅底 */
  --danger:     #dc2626;
  --warning:    #d97706;
  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --shadow-sm:  0 1px 2px rgba(20,20,20,.04);
  --shadow-md:  0 4px 20px rgba(20,20,20,.06);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  background: rgba(250, 247, 243, .85);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 8px;
}
.actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Hero（紧凑版） ---------- */
.hero {
  text-align: center;
  padding: 32px 24px 20px;
  max-width: 820px; margin: 0 auto;
}
.hero h1 {
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.2; letter-spacing: -0.02em;
  font-weight: 800; margin: 0 0 8px;
  color: var(--text);
}
.hero h1 .highlight {
  background: linear-gradient(180deg, transparent 65%, var(--brand-soft) 65%);
  padding: 0 4px;
}
.hero-sub {
  font-size: 14px; color: var(--muted);
  max-width: 560px; margin: 0 auto 16px;
}
.hero-search {
  display: flex; align-items: center; gap: 8px;
  max-width: 520px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 4px 4px 4px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.hero-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.hero-search svg { flex: none; color: var(--muted); }
.hero-search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 8px 4px; font-size: 14px; color: var(--text);
}

/* ---------- 分类导航（药丸） ---------- */
.catnav {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 8px 24px 32px; max-width: 1100px; margin: 0 auto;
}
.catnav a {
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; color: var(--text-2); font-weight: 500;
  transition: all .15s;
}
.catnav a:hover { border-color: var(--brand); color: var(--brand-hover); }

/* ---------- 内容区 ---------- */
.content { padding: 8px 32px 60px; max-width: 1200px; margin: 0 auto; }
.cat-section { margin-bottom: 44px; scroll-margin-top: 88px; }
.cat-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 18px;
}
.cat-title .count {
  color: var(--muted); font-size: 13px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 999px;
}

/* ---------- 卡片 ---------- */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px; background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card-head { display: flex; align-items: center; gap: 12px; }
.card-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 18px; overflow: hidden;
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; }
.card-title {
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
  color: var(--text);
}
.card-desc {
  color: var(--muted); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.specs { display: flex; flex-wrap: wrap; gap: 6px; }
.spec {
  font-size: 12px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 7px; font-weight: 500;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag {
  font-size: 11px; color: var(--brand-hover);
  background: var(--brand-soft);
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(22,163,74,.15);
  font-weight: 500;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 40px 20px; border-top: 1px solid var(--border);
  margin-top: 40px;
}
.loading, .empty { color: var(--muted); text-align: center; padding: 60px; }

/* ---------- 按钮 ---------- */
.btn, .btn-ghost, .btn-danger {
  cursor: pointer; border-radius: 999px;
  padding: 9px 18px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(22,163,74,.15);
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--text-2); color: var(--text); background: var(--surface-2); }
.btn-danger {
  background: transparent; border-color: transparent; color: var(--danger);
}
.btn-danger:hover { background: rgba(220,38,38,.08); }

/* ==========================================================
   管理后台
   ========================================================== */

/* 登录 */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, var(--brand-soft) 0, transparent 40%),
    radial-gradient(circle at 80% 90%, #fef3c7 0, transparent 40%),
    var(--bg);
}
.login-card {
  width: 380px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow-md);
}
.login-card h1 {
  margin: 0 0 6px; font-size: 24px; font-weight: 800;
  letter-spacing: -0.02em;
}
.login-card .subtitle {
  color: var(--muted); font-size: 14px; margin: 0 0 24px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 500;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text); outline: none;
  font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.msg { font-size: 13px; min-height: 20px; margin: 6px 0 0; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--brand-hover); }

/* 后台外框 */
.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 32px 32px 60px; }
.admin-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.admin-head h1 {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
  margin: 0;
}
.admin-head > div { display: flex; gap: 10px; }

/* Tabs */
.tabs {
  display: inline-flex; gap: 4px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 4px; border-radius: 999px;
}
.tabs button {
  cursor: pointer; padding: 8px 18px; font-size: 14px; font-weight: 500;
  border: 0; background: transparent; color: var(--text-2);
  border-radius: 999px; transition: all .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--brand); color: #fff; }

/* Toolbar */
.toolbar {
  display: flex; justify-content: flex-end; margin-bottom: 14px;
}

/* Table */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table tr:last-child td { border-bottom: 0; }
.table th {
  color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2);
}
.table tbody tr:hover { background: var(--surface-2); }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 6px 12px; font-size: 13px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 15, 15, .5);
  display: none; place-items: center;
  z-index: 60; padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-mask.show { display: grid; }
.modal {
  width: 520px; max-width: 100%; max-height: 90vh; overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal h2 {
  margin: 0 0 20px; font-size: 20px; font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px;
}

/* ---------- 浮动提交按钮 (FAB) ---------- */
.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  background: var(--brand); color: #fff;
  border: 0; cursor: pointer;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(22,163,74,.35), 0 2px 4px rgba(22,163,74,.2);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.fab:hover {
  background: var(--brand-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(22,163,74,.4), 0 3px 6px rgba(22,163,74,.25);
}
.fab:active { transform: translateY(0); }

.modal-lead {
  color: var(--muted); font-size: 14px;
  margin: -8px 0 20px;
}
.field label .opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.field label .req { color: var(--danger); }
#turnstile-box { min-height: 65px; }

/* 后台"待审核"状态徽章 */
.pill {
  display: inline-block; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.pill.pending  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.pill.approved { background: var(--brand-soft); color: var(--brand-hover); border: 1px solid rgba(22,163,74,.15); }
.pill.rejected { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .hero { padding: 48px 16px 32px; }
  .content { padding: 8px 16px 40px; }
  .admin-wrap { padding: 20px 16px 40px; }
  .catnav { padding: 8px 16px 24px; }
  .admin-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .fab { right: 16px; bottom: 16px; padding: 10px 16px; }
}
