:root {
  --bg: #f5f7f8;
  --card: #ffffff;
  --text: #1f2a30;
  --muted: #6b7c85;
  --primary: #0f9d76;
  --primary-d: #0b7d5e;
  --accent: #2b7de9;
  --border: #e3e8ea;
  --danger: #e0483b;
  --ok: #0f9d76;
  --shadow: 0 6px 22px rgba(20, 40, 50, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Nav */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), #34c79a); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; }
.nav-links { display: flex; gap: 14px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f1c4c0; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* Hero */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 { font-size: 40px; margin: 0 0 12px; letter-spacing: -0.5px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 680px; margin: 0 auto 24px; }
.badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.badge { background: #eafaf3; color: var(--primary-d); border: 1px solid #cdeede; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }

/* Sections */
.section { padding: 28px 0; }
.section h2 { font-size: 24px; margin: 0 0 4px; }
.section .sub { color: var(--muted); margin: 0 0 18px; }

/* Cards / grid */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .desc { font-size: 13px; color: var(--muted); margin: 8px 0; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #eef2f4; color: var(--muted); margin-right: 6px; }
.tag.free { background: #eafaf3; color: var(--primary-d); }
.tag.warn { background: #fff3e0; color: #b9650b; border: 1px solid #ffe0b2; }
.tag.ok { background: #eafaf3; color: var(--primary-d); border: 1px solid #cdeede; }

/* Modal */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 30, 35, .45); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-mask.open { display: flex; }
.modal { background: var(--card); width: 380px; max-width: 92vw; border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { flex: 1; text-align: center; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600; background: #f1f4f5; color: var(--muted); }
.tab.active { background: var(--primary); color: #fff; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* 目录卡片复制按钮行 */
.copy-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px dashed var(--border); }
.copy-row .btn { flex: 1; min-width: 92px; }

/* Dashboard */
.panel { margin-bottom: 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.key-box { font-family: ui-monospace, Menlo, Consolas, monospace; background: #f1f4f5; padding: 8px 10px; border-radius: 8px; font-size: 13px; word-break: break-all; }

/* 上游密钥申请入口 */
.signup-area { margin-top: 12px; padding: 12px 14px; background: #f7fbfa; border: 1px dashed #bfe3d8; border-radius: 10px; }
.signup-cur { font-size: 13px; color: var(--text); }
.signup-chips-title { font-size: 12px; margin-top: 8px; }
.signup-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.signup-chip { display: inline-block; font-size: 12px; padding: 5px 10px; background: #fff; border: 1px solid var(--border); border-radius: 999px; color: var(--primary-d); font-weight: 600; }
.signup-chip:hover { border-color: var(--primary); text-decoration: none; background: #eafaf3; }

/* 上游密钥测试结果 */
.test-result { font-size: 13px; padding: 8px 10px; border-radius: 8px; line-height: 1.6; }
.test-result.testing { background: #f1f4f5; color: var(--muted); }
.test-result.ok { background: #eafaf3; color: var(--primary-d); border: 1px solid #cdeede; }
.test-result.fail { background: #fdecea; color: var(--danger); border: 1px solid #f1c4c0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px){ .stats { grid-template-columns: repeat(2,1fr);} }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.stat .n { font-size: 26px; font-weight: 700; color: var(--primary-d); }
.stat .l { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 16px 0; }
code.inline { background:#f1f4f5; padding:2px 6px; border-radius:6px; font-size:13px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2a30; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; }
.toast.show { opacity: 1; }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0 30px; }
