/* API 管理系统 - 全局样式（响应式） */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --muted: #909399;
  --line: #e5e7eb;
  --bg: #f5f7fb;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(15, 23, 42, .06);
  --header-h: 62px;
  --safe-top: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
.boot-loading { padding: 120px 0; text-align: center; color: var(--muted); }

/* ---------- 公共布局 ---------- */
.public-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.public-body { flex: 1; }
.site-header {
  position: sticky; top: 0; z-index: 100;
  padding-top: var(--safe-top);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: var(--header-h); display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); white-space: nowrap; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2563eb, #06b6d4); color: #fff; font-size: 15px; font-weight: 700;
}
.nav-links { display: flex; gap: 22px; flex: 1; }
.nav-links a { color: var(--ink-2); font-size: 14px; }
.nav-links a.active, .nav-links a:hover { color: var(--brand); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-user { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.avatar-dot {
  width: 30px; height: 30px; border-radius: 50%; background: #e0ecff; color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 24px 20px calc(24px + var(--safe-bottom)); }
.site-footer-inner { max-width: 1200px; margin: 0 auto; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; }

/* ---------- 首页 ---------- */
.hero {
  background: radial-gradient(1000px 400px at 50% -100px, #dbeafe 0%, rgba(219, 234, 254, 0) 70%), #f8fbff;
  border-bottom: 1px solid var(--line);
  padding: 64px 20px 56px;
}
.hero-inner { max-width: 900px; margin: 0 auto; text-align: center; }
.hero-tag {
  display: inline-block; padding: 5px 14px; border-radius: 999px; font-size: 12px;
  color: var(--brand); background: #e8f0ff; margin-bottom: 18px;
}
.hero h1 { margin: 0 0 14px; font-size: 40px; line-height: 1.2; letter-spacing: -.5px; }
.hero p { color: var(--ink-2); font-size: 16px; margin: 0 auto 26px; max-width: 620px; line-height: 1.7; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; justify-content: center; gap: 48px; margin-top: 40px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 24px; color: var(--ink); }
.hero-stats span { color: var(--muted); font-size: 13px; margin-top: 2px; }

.section { max-width: 1200px; margin: 0 auto; padding: 48px 20px 8px; }
.section > h2 { font-size: 24px; margin: 0 0 6px; }
.section-desc { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.plan-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow);
}
.plan-card.recommend { border-color: var(--brand); }
.plan-badge {
  position: absolute; top: -10px; right: 18px; background: var(--brand); color: #fff;
  font-size: 11px; padding: 2px 10px; border-radius: 999px;
}
.plan-name { font-size: 17px; font-weight: 600; }
.plan-price { margin: 14px 0 4px; font-size: 32px; font-weight: 700; color: var(--ink); }
.plan-price small { font-size: 14px; font-weight: 400; color: var(--muted); }
.plan-origin { color: var(--muted); font-size: 13px; text-decoration: line-through; min-height: 18px; }
.plan-meta { color: var(--ink-2); font-size: 13px; line-height: 1.9; margin: 14px 0 8px; }
.plan-feats { margin: 0 0 18px; padding: 0; list-style: none; flex: 1; }
.plan-feats li { font-size: 13px; color: var(--ink-2); line-height: 2; }
.plan-feats li::before { content: "✓"; color: #16a34a; margin-right: 8px; }

.group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.group-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  transition: .2s; cursor: pointer;
}
.group-card:hover { border-color: #bfdbfe; box-shadow: var(--shadow); transform: translateY(-2px); }
.group-card h4 { margin: 0 0 6px; font-size: 15px; }
.group-card p { margin: 0; color: var(--muted); font-size: 13px; min-height: 20px; }
.group-count { margin-top: 12px; font-size: 12px; color: var(--brand); }

.cta-band { max-width: 1200px; margin: 48px auto; padding: 0 20px; }
.cta-inner {
  background: linear-gradient(120deg, #1d4ed8, #0ea5e9); border-radius: 16px;
  color: #fff; padding: 40px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.cta-inner h3 { margin: 0 0 8px; font-size: 22px; }
.cta-inner p { margin: 0; opacity: .85; font-size: 14px; }

/* ---------- 登录 / 注册 ---------- */
.auth-wrap { min-height: calc(100vh - var(--header-h)); min-height: calc(100dvh - var(--header-h)); display: flex; align-items: center; justify-content: center; padding: 32px 16px calc(32px + var(--safe-bottom)); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 32px; border: 1px solid var(--line); }
.auth-card h2 { margin: 0 0 4px; font-size: 22px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.auth-footer { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row .el-input { flex: 1; }
.captcha-img { width: 120px; height: 40px; border-radius: 4px; cursor: pointer; border: 1px solid var(--line); object-fit: cover; background: #f5f7fa; }
.code-row { display: flex; gap: 10px; }
.code-row .el-input { flex: 1; }

/* ---------- 文档 ---------- */
.page-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 20px 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.api-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; cursor: pointer;
  transition: .15s; margin-bottom: 12px;
}
.api-card:hover { border-color: #bfdbfe; box-shadow: var(--shadow); }
.api-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-card-name { font-weight: 600; font-size: 15px; }
.api-path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--ink-2); }
.api-card-desc { color: var(--muted); font-size: 13px; margin-top: 8px; }
.method-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #e8f0ff; color: var(--brand); }
.method-tag.POST { background: #e7f8ef; color: #15803d; }
.method-tag.PUT { background: #fff5e6; color: #c2740a; }
.method-tag.DELETE { background: #ffecec; color: #d03050; }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 20px; align-items: start; width: 100%; }
.doc-layout > * { min-width: 0; }
.doc-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.doc-panel h3 { margin: 0 0 14px; font-size: 16px; }
.doc-panel h4 { margin: 22px 0 10px; font-size: 14px; color: var(--ink-2); }
.doc-title { font-size: 22px; margin: 0 0 10px; }
.doc-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.doc-pre {
  background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap;
  word-break: break-word; overflow-wrap: anywhere;
  box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0;
  /* 宽度铺满面板、高度随内容自适应，不出现横向滚动或内层纵向滚动 */
  max-height: none; overflow-x: hidden; overflow-y: visible;
}
/* 示例代码位于 el-tabs 内：禁止超长内容把 tabs 头部撑宽（右上角会被裁掉） */
.doc-panel .el-tabs,
.doc-panel .el-tabs__content,
.doc-panel .el-tab-pane { min-width: 0; max-width: 100%; }
.doc-panel .el-tabs__content { overflow: hidden; }
.doc-text { line-height: 1.85; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.text-danger { color: #e5484d; }
.code-head { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.code-head .el-button + .el-button { margin-left: 0; }
.code-inline { background: #f1f5f9; border-radius: 4px; padding: 1px 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.debug-panel { position: sticky; top: 82px; }
.debug-result { margin-top: 12px; }
.param-rows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.param-row { display: flex; gap: 8px; align-items: center; width: 100%; }
.param-row .el-input { flex: 1; min-width: 0; }
.param-row .el-input:first-child { flex: 0 0 38%; }
.param-row .el-button { flex: 0 0 auto; padding: 0 4px; }
.param-actions { display: flex; gap: 8px; }
.doc-side-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }

/* ---------- 控制台 ---------- */
.console-shell { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.console-side {
  background: linear-gradient(180deg, #0f172a 0%, #111c33 100%);
  color: #cbd5e1; min-height: 100vh; min-height: 100dvh;
}
.console-brand { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; color: #fff; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.08); }
.console-side .el-menu { border-right: 0; background: transparent; }
.console-main { min-width: 0; }
.console-topbar {
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 20px 0;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 90;
}
.console-topbar .spacer { flex: 1; }
.console-body { padding: 22px; }
.mobile-menu-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px; line-height: 1;
  cursor: pointer; color: var(--ink); border: 1px solid var(--line); background: #f8fafc;
  transition: .15s; flex: 0 0 auto;
}
.mobile-menu-btn:active { background: #eef2f7; }
.menu-drawer .el-drawer__body { padding: 0; background: #0f172a; display: flex; flex-direction: column; }

/* 侧边菜单 */
.side-menu {
  --el-menu-item-height: 44px;
  --el-menu-bg-color: transparent;
  --el-menu-text-color: #cbd5e1;
  --el-menu-hover-bg-color: rgba(255,255,255,.06);
  --el-menu-active-color: #fff;
  padding: 10px 10px 16px;
}
.side-menu .el-menu-item {
  margin: 2px 0; border-radius: 9px; padding-left: 38px !important;
  position: relative; font-size: 14px; transition: background .18s, color .18s;
}
.side-menu .el-menu-item::before {
  content: ""; position: absolute; left: 19px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: rgba(203,213,225,.4);
  transition: .18s;
}
.side-menu .el-menu-item:hover { color: #fff; }
.side-menu .el-menu-item.is-active {
  color: #fff; font-weight: 600;
  background: linear-gradient(90deg, rgba(37,99,235,.55), rgba(37,99,235,.12));
}
.side-menu .el-menu-item.is-active::before { background: #93c5fd; box-shadow: 0 0 0 4px rgba(147,197,253,.16); }
.menu-drawer .side-menu { flex: 1; overflow-y: auto; }
.drawer-foot { padding: 12px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid rgba(255,255,255,.08); display: flex; gap: 18px; }
.drawer-foot a { color: #94a3b8; font-size: 13px; }
.drawer-foot a:active { color: #fff; }

.page-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat-card .value small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.stat-card .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 15px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .el-input, .toolbar .el-select { width: 200px; }
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap .el-table { min-width: 640px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.pager { display: flex; justify-content: flex-end; margin-top: 14px; }
.chart-box { width: 100%; height: 300px; }
.empty-tip { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.inline-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.key-box {
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 10px 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all;
}
.key-box-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.key-box-url { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; word-break: break-all; }
.key-box-row > .el-button { flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.quota-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }

/* 支付跳转过渡层 */
.pay-jump-mask {
  position: fixed; inset: 0; z-index: 3000; padding: 20px;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.pay-jump-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
  padding: 28px 24px calc(24px + var(--safe-bottom)); text-align: center;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .35);
}
.pay-jump-spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid #dbeafe; border-top-color: var(--brand);
  animation: pay-spin .9s linear infinite;
}
@keyframes pay-spin { to { transform: rotate(360deg); } }
.pay-jump-ok {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  background: #dcfce7; color: #16a34a; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.pay-jump-card h3 { margin: 0 0 8px; font-size: 17px; }
.pay-jump-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.pay-jump-actions { display: flex; gap: 10px; }
.pay-jump-btn {
  flex: 1; display: block; padding: 11px 12px; border-radius: 10px; font-size: 14px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.pay-jump-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.pay-jump-btn:active { opacity: .85; }
.pay-jump-hint { margin: 14px 0 0 !important; font-size: 12px !important; }

/* 支付结果 */
.result-wrap { max-width: 560px; margin: 0 auto; padding: 60px 20px; }
.result-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 40px 28px; text-align: center; box-shadow: var(--shadow); }
.result-icon { font-size: 46px; }
.result-card h2 { margin: 12px 0 6px; font-size: 22px; }
.result-card p { color: var(--muted); font-size: 13px; margin: 0 0 20px; word-break: break-all; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  /* 平板竖屏与小笔记本：先降为单列，避免右栏把接口内容压得过窄 */
  .doc-layout { grid-template-columns: 1fr; }
  .debug-panel { position: static; }
}
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .site-header-inner { gap: 10px; padding: 0 14px; }
  .brand { font-size: 16px; }
  .nav-actions { gap: 6px; }
  .nav-actions .btn-register { display: none; }
  .nav-user-name { display: none; }
  .hero { padding: 42px 16px 36px; }
  .hero h1 { font-size: 27px; }
  .hero p { font-size: 14px; }
  .hero-stats { gap: 26px; margin-top: 28px; }
  .hero-stats b { font-size: 20px; }
  .section { padding: 32px 14px 4px; }
  .section > h2 { font-size: 20px; }
  .cta-inner { padding: 28px 22px; }
  .page-wrap { padding: 18px 14px 40px; }
  .doc-panel { padding: 18px; }
  .console-body { padding: 14px; }
  .console-topbar { padding: var(--safe-top) 14px 0; gap: 10px; }
  .console-topbar > .el-button { display: none; }
  .console-topbar .page-title-inline { font-weight: 600; font-size: 15px; color: var(--ink); }
  .console-brand { padding: 0 16px; }
  .menu-drawer .el-drawer { max-width: 78vw; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 21px; }
  .panel { padding: 14px; }
  .toolbar .el-input, .toolbar .el-select { width: 100%; }
  .toolbar > * { flex: 1 1 140px; }
  .auth-card { padding: 24px 20px; }
  .plan-grid { grid-template-columns: 1fr; }
  .site-footer-inner { flex-direction: column; }
  .chart-box { height: 240px; }
  .table-wrap .el-table { min-width: 560px; }
  .result-wrap { padding: 32px 14px; }
  .result-card { padding: 30px 18px; }
  .el-dialog { width: calc(100vw - 28px) !important; max-width: 480px; margin-top: 9vh !important; }
  .el-dialog__body { padding: 16px 18px; }
  .el-message-box { width: calc(100vw - 44px) !important; max-width: 420px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  /* 文档详情：窄屏单列后再压缩内边距与字号，避免内容被裁切 */
  .doc-panel { padding: 14px; }
  .doc-title { font-size: 19px; }
  .doc-pre { font-size: 11.5px; padding: 12px 12px; }
  .doc-panel h4 { margin: 18px 0 8px; }
  .doc-panel .el-tabs__item { padding: 0 9px !important; font-size: 13px; }
  .doc-panel .el-table { font-size: 12px; }
  .table-wrap .el-table { min-width: 480px; }
  /* 参数行：窄屏改为两行，参数名独占一行 */
  .param-row { flex-wrap: wrap; gap: 6px; }
  .param-row .el-input { flex: 1 1 100%; }
  .param-row .el-input:first-child { flex: 1 1 100%; }
  .param-row .el-button { margin-left: auto; }
  .debug-panel .el-form-item { margin-bottom: 14px; }
  .toolbar .el-date-editor { width: 100% !important; flex: 1 1 100%; }
  .key-box { font-size: 12px; }
}
@media (max-width: 480px) {
  .doc-panel { padding: 12px; }
  .doc-title { font-size: 17px; }
  .doc-pre { font-size: 11px; padding: 10px; }
  .doc-panel .el-tabs__item { padding: 0 7px !important; font-size: 12px; }
  .table-wrap .el-table { min-width: 420px; }
  .page-wrap { padding: 14px 10px 32px; }
}
