:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d3d7dd;
  --text: #1c1f23;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #185fa5;
  --accent-soft: #e6f1fb;
  --ok: #1d9e75;
  --ok-soft: #e1f5ee;
  --warn: #a0680f;
  --warn-soft: #faeeda;
  --danger: #a32d2d;
  --danger-soft: #fcebeb;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* 带 class 的元素（比如 .input-row{display:flex}）会盖掉 hidden 的默认 display:none，
   这里统一兜住，否则 hidden 属性形同虚设 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 顶部 ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand h1 { font-size: 17px; margin: 0; font-weight: 600; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.tagline {
  margin: 6px 0 0 19px;
  color: var(--muted);
  font-size: 12.5px;
}

.tagline .back {
  margin-left: 10px;
  color: var(--accent);
  text-decoration: none;
}

.tagline .back:hover { text-decoration: underline; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}

/* ---------- 状态条 ---------- */

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip b { color: var(--text); font-weight: 500; }
.chip.is-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.is-ok b { color: var(--ok); }
.chip.is-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.is-warn b { color: var(--warn); }

/* ---------- 首页功能卡片 ---------- */

.hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.hub-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, transform 0.12s;
}

.hub-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-card p { margin: 0; color: var(--muted); font-size: 13px; }

.hub-card .hub-meta { margin-top: 8px; font-size: 12px; color: var(--faint); }

a.hub-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.hub-card.is-placeholder {
  border-style: dashed;
  background: transparent;
  color: var(--faint);
}

.hub-card.is-placeholder h3 { color: var(--faint); font-weight: 500; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 400;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}

.card[hidden] { display: none; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-head h2 { font-size: 15px; margin: 0; font-weight: 600; }

.hint { color: var(--muted); font-size: 12.5px; }
.dim { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ---------- 按钮与输入 ---------- */

button {
  font-family: inherit;
  font-size: 13.5px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

button:hover { background: var(--surface-2); border-color: var(--faint); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #14508c; border-color: #14508c; }
button:disabled { opacity: 0.55; cursor: default; }
button.mini { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }

input[type="text"],
input[type="password"],
input:not([type]) {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
}

textarea {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
  width: 100%;
  min-height: 130px;
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 0; }

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.input-row input { flex: 1 1 320px; }

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar input { flex: 1 1 200px; }

.token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.token-row input {
  flex: 1 1 280px;
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ---------- 提示条 ---------- */

.notice {
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 14px;
}

.notice.err { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

.loading { color: var(--muted); font-size: 13px; padding: 10px 0; }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- 向导 ---------- */

.wiz-step, .step-title { font-weight: 600; }
.step-title { margin: 14px 0 6px; font-size: 13px; }

.adv { margin-top: 12px; }
.adv summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }

.adv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.adv-row label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.adv-row input { flex: 1; font-family: var(--mono); font-size: 12.5px; }

.col-list {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.col-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) 60px 52px minmax(120px, 1.6fr) 150px;
  gap: 10px;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.col-row:last-child { border-bottom: none; }
.col-row:hover { background: var(--surface-2); }

.col-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
}

.col-type, .col-fill { color: var(--muted); font-size: 12px; }
.col-sample { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.key-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
}

.preview-wrap { margin-top: 14px; }

.preview-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.preview-wrap th,
.preview-wrap td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.preview-wrap th { background: var(--surface-2); color: var(--muted); font-weight: 500; }

.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.preset-label {
  font-size: 12px;
  color: var(--muted);
}

.preset-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 320px;
}

.preset-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.preset-chip .preset-text {
  border: none;
  border-radius: 0;
  padding: 5px 13px;
  font-size: 12.5px;
  background: transparent;
  color: var(--text);
}

.preset-chip .preset-text:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.preset-chip .preset-del {
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 5px 10px;
  font-size: 11px;
  background: transparent;
  color: var(--faint);
}

.preset-chip .preset-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.param-field input { font-family: var(--mono); }

.table-wrap.nested {
  border: 1px solid var(--border);
  background: var(--surface);
}

.table-wrap.nested table { font-size: 12.5px; }

details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
}

th.kv-key {
  width: 220px;
  text-align: left;
  vertical-align: top;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
}

.format-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

pre.sample {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  overflow: auto;
  max-height: 320px;
  white-space: pre;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 16px 6px 0;
  font-size: 13px;
  cursor: pointer;
}

.wiz-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.wiz-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 240px;
  font-size: 12px;
  color: var(--muted);
}

.wiz-form input { font-size: 13px; }

/* ---------- 接口清单 ---------- */

.doc-list { display: flex; flex-direction: column; gap: 8px; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 13px;
  font-size: 13px;
}

.doc-item .method {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}

.doc-item .path { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.doc-item .path a { color: var(--accent); text-decoration: none; }
.doc-item .path a:hover { text-decoration: underline; }
.doc-item .desc { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.doc-item button { margin-left: 4px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

@media (max-width: 720px) {
  .col-row { grid-template-columns: 1fr 1fr; }
  .col-sample { display: none; }
}
