/* API 接入页。颜色只用 tokens.css 变量（UI 门禁）。 */
[hidden] { display: none !important; }
body { background: var(--canvas); color: var(--text-primary); }
.ah-app { margin: 0 auto; padding: 20px 16px 64px; max-width: 1280px; display: flex; flex-direction: column; gap: 14px; }
.ah-head h1 { margin: 0 0 6px; font-size: 22px; }
.ah-head p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.6; }

.ah-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.ah-card h2 { margin: 0 0 10px; font-size: 16px; }
.ah-card h2 small { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.ah-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ah-card-head h2 { margin: 0; }

.ah-btn { border: 1px solid var(--border-control); background: var(--surface); color: var(--text-primary); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ah-btn:hover { border-color: var(--accent); }
.ah-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.ah-btn.primary:hover { background: var(--accent-hover); }
.ah-btn.danger { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--text-on-accent); }
.ah-btn:disabled { opacity: .55; cursor: default; }
.ah-btn.sm { padding: 3px 8px; font-size: 12px; }

/* 平台卡 */
.ah-platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ah-pf { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; font: inherit; color: inherit; }
.ah-pf:hover { border-color: var(--accent-soft-border); }
.ah-pf.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ah-pf b { font-size: 15px; }
.ah-pf span { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.ah-pf.slot { border-style: dashed; background: transparent; cursor: default; color: var(--text-muted); }
.ah-pf.slot b { color: var(--text-secondary); font-weight: 500; }

.ah-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--n-400); margin-right: 6px; vertical-align: 1px; }
.ah-dot.ok { background: var(--success-fg); }
.ah-dot.bad { background: var(--danger-fg); }

/* 连接状态 */
.ah-status .ah-card-head h2 { display: flex; align-items: center; gap: 8px; }
.ah-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 16px; margin: 0; }
.ah-status-grid div { min-width: 0; }
.ah-status-grid dt { color: var(--text-muted); font-size: 12px; }
.ah-status-grid dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.ah-status-grid code, .ah-detail code { font-family: var(--font-mono); font-size: 12px; }
.ah-status .ah-err { margin-top: 10px; border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-fg); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.ah-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ah-cred { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; align-items: end; }
.ah-cred label { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.ah-cred input { border: 1px solid var(--border-control); border-radius: 8px; padding: 7px 10px; font-family: var(--font-mono); font-size: 12px; background: var(--surface); min-width: 0; }
.ah-cred p { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--text-muted); }

/* 左列表 + 右详情 */
.ah-work { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 14px; align-items: start; }
.ah-list { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; position: sticky; top: 10px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 20px); }
.ah-list input { border: 1px solid var(--border-control); border-radius: 8px; padding: 7px 10px; background: var(--surface); font-size: 13px; }
.ah-list-body { overflow-y: auto; min-height: 0; }
.ah-sec { font-size: 12px; color: var(--text-muted); padding: 10px 6px 4px; display: flex; justify-content: space-between; }
.ah-api { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: transparent; padding: 7px 8px; border-radius: 6px; font-size: 13px; text-align: left; color: var(--text-primary); cursor: pointer; }
.ah-api:hover { background: var(--surface-hover); }
.ah-api.on { background: var(--surface-selected); color: var(--selection-fg); font-weight: 500; }
.ah-api span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ah-api em { flex: none; display: inline-flex; gap: 4px; font-style: normal; }
.ah-h { flex: none; font-style: normal; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 4px; font-weight: 500; display: inline-block; }
.ah-h.ok { background: var(--success-bg); color: var(--success-fg); }
.ah-h.param { background: var(--a-50); color: var(--a-700); }
.ah-h.denied, .ah-h.broken { background: var(--danger-bg); color: var(--danger-fg); }
.ah-h.untested { background: var(--neutral-bg); color: var(--neutral-fg); }
.ah-health { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.ah-hf { flex: none; display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ah-hf button { flex: 1; border: 0; border-left: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); padding: 5px 0; font-size: 12px; cursor: pointer; }
.ah-hf button:first-child { border-left: 0; }
.ah-hf button { white-space: nowrap; padding-left: 2px; padding-right: 2px; }
.ah-hf small { margin-left: 2px; font-size: 10px; opacity: .8; }
.ah-hf button.on { background: var(--accent); color: var(--text-on-accent); }
.ah-kind { flex: none; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 4px; font-weight: 500; }
.ah-kind.read { background: var(--info-bg); color: var(--info-fg); }
.ah-kind.write { background: var(--danger-bg); color: var(--danger-fg); }
.ah-kind.internal, .ah-kind.ref { background: var(--neutral-bg); color: var(--neutral-fg); }

.ah-detail { display: flex; flex-direction: column; gap: 12px; }
/* 2026-10-01 接口名 + 下面的「测试请求 / 请求参数 / 返回字段」往下翻也吸在顶上：名字贴顶，标签的 top 由 api-hub.js 按名字的实际高度写 */
.ah-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 8px 0; margin: -8px 0; }
.ah-title h2 { margin: 0; font-size: 18px; }
.ah-endpoint { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ah-method { font-family: var(--font-mono); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--accent-soft-bg); color: var(--accent-soft-fg); }
.ah-endpoint code { background: var(--surface-sunken); padding: 2px 8px; border-radius: 4px; overflow-wrap: anywhere; }
.ah-endpoint a { color: var(--accent); font-size: 12px; margin-left: auto; }
.ah-desc { margin: 0; color: var(--text-secondary); font-size: 13px; }

.ah-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); position: sticky; z-index: 3; background: var(--surface); }
.ah-tabs button { border: 0; background: transparent; padding: 8px 12px; font-size: 13px; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.ah-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* 测试台 */
.ah-console { display: flex; flex-direction: column; gap: 10px; }
.ah-console textarea { width: 100%; min-height: 180px; resize: vertical; border: 1px solid var(--border-control); border-radius: 8px; padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; background: var(--surface-sunken); tab-size: 2; }
.ah-console textarea.bad { border-color: var(--danger-fg); }
.ah-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ah-bar label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }
.ah-bar .grow { flex: 1; }
.ah-hint { font-size: 12px; color: var(--text-muted); }
.ah-warn { border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-fg); border-radius: 8px; padding: 8px 12px; font-size: 13px; line-height: 1.6; }
.ah-warn label { color: var(--danger-fg); font-weight: 500; }
.ah-note { border: 1px solid var(--neutral-border); background: var(--neutral-bg); color: var(--neutral-fg); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
/* 参数来源：示例里每个参数从哪个接口取的 */
.ah-src { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.ah-src b { font-weight: 600; color: var(--text-primary); }
.ah-src ul { margin: 4px 0 0; padding-left: 18px; }
.ah-src li { margin: 2px 0; }
.ah-src a, .ah-table a[data-goto] { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.ah-result { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ah-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; font-size: 13px; background: var(--surface-raised); border-bottom: 1px solid var(--border); }
.ah-result-head.ok { background: var(--success-bg); color: var(--success-fg); border-bottom-color: var(--success-border); }
.ah-result-head.bad { background: var(--danger-bg); color: var(--danger-fg); border-bottom-color: var(--danger-border); }
.ah-result-head .grow { flex: 1; }
.ah-result details { border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
.ah-result summary { padding: 6px 12px; cursor: pointer; color: var(--text-secondary); }
.ah-pre { margin: 0; padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 520px; overflow: auto; background: var(--surface); }
.ah-pre .k { color: var(--b-700); }
.ah-pre .s { color: var(--g-700); }
.ah-pre .n { color: var(--a-700); }
.ah-pre .z { color: var(--text-muted); }

/* 参数表 */
.ah-table-wrap { overflow-x: auto; }
.ah-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ah-table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ah-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.ah-table td.nm { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.ah-table td.ty { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.ah-table td.ex { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); max-width: 180px; overflow-wrap: anywhere; }
.ah-table td.ds { color: var(--text-secondary); min-width: 220px; }
.ah-req { color: var(--danger-fg); font-size: 12px; white-space: nowrap; }
.ah-ind { display: inline-block; color: var(--text-disabled); }
.ah-table .ok { color: var(--success-fg); }
.ah-table .bad { color: var(--danger-fg); }
.ah-table tr.write td:first-child { box-shadow: inset 3px 0 0 var(--danger-fg); }

.ah-rules dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.ah-rules dt { font-family: var(--font-mono); color: var(--text-secondary); }
.ah-rules dd { margin: 0; color: var(--text-secondary); }

.ah-empty { color: var(--text-muted); font-size: 13px; padding: 24px 8px; text-align: center; }
.ah-msg { border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-fg); border-radius: 10px; padding: 10px 14px; font-size: 14px; }

@media (max-width: 860px) {
  .ah-work { grid-template-columns: minmax(0, 1fr); }
  .ah-list { position: static; max-height: 320px; }
  .ah-endpoint a { margin-left: 0; }
}

/* 老板 10-04 可视化：「可用性」下面一根占比条（能用 / 需参数 / 不能用 / 未测）；测试记录的成功失败换成全站状态牌 */
.ah-hstack { margin-top: 6px; max-width: 280px; }
.ah-table td .sqv-pill { height: 20px; padding: 0 7px; }
