/* ==========================================================================
   站点门户样式 —— 与地图应用 / 管理后台同源的浅色设计语言
   覆盖：首页、API 文档、JS SDK、个人中心、商户认证、登录注册
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #1c2024;
  --text-2: #5b6470;
  --text-3: #8a929c;
  --brand: #1f6feb;
  --brand-dark: #1858bd;
  --brand-soft: #e8f1fe;
  --accent: #d33a2c;
  --success: #12805c;
  --success-soft: #e6f5ef;
  --warn: #b8730a;
  --warn-soft: #fdf3e3;
  --danger: #c0392b;
  --danger-soft: #fdeceb;
  --purple: #6b4fbb;
  --purple-soft: #f0ecfb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, 0.14);
  --radius: 8px;
  --radius-lg: 12px;
  --nav-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

code, pre, .mono { font-family: var(--mono); }

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.88em;
  color: #b3286b;
}

pre {
  background: #1c2024;
  color: #e6edf3;
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ==========================================================================
   导航
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; }

.nav-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #f0703a);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.nav-links { display: flex; gap: 4px; flex: 1 1 auto; }

.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-links a.active { background: var(--brand-soft); color: var(--brand-dark); }

.nav-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

/* ==========================================================================
   按钮 / 表单
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #b52f22; border-color: #b52f22; }

.btn-danger { color: var(--danger); border-color: #f0c4c0; background: var(--danger-soft); }
.btn-danger:hover { background: #fbdedc; }

.btn-lg { height: 42px; padding: 0 22px; font-size: 15px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="url"], input[type="tel"],
select, textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 76px; line-height: 1.6; }

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1 1 0; min-width: 0; }

.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-2); }
.check-row input { margin-top: 3px; }

/* ==========================================================================
   容器 / 卡片
   ========================================================================== */

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card + .card { margin-top: 16px; }

.card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}
.card-desc { margin: 0 0 16px; font-size: 13px; color: var(--text-2); }

.section { padding: 40px 0; }
.section-head { margin-bottom: 22px; }
.section-head h2 { margin: 0 0 6px; font-size: 22px; }
.section-head p { margin: 0; color: var(--text-2); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .nav-links { display: none; }
}

/* ==========================================================================
   标签 / 徽章
   ========================================================================== */

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.tag-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #c7dcfb; }
.tag-success { background: var(--success-soft); color: var(--success); border-color: #bfe5d6; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb8; }
.tag-danger { background: var(--danger-soft); color: var(--danger); border-color: #f0c4c0; }
.tag-purple { background: var(--purple-soft); color: var(--purple); border-color: #ddd3f3; }

.method {
  display: inline-block;
  min-width: 52px;
  text-align: center;
  padding: 1px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--text-3);
}
.method-get { background: #12805c; }
.method-post { background: #1f6feb; }
.method-put { background: #b8730a; }
.method-delete { background: #c0392b; }

/* ==========================================================================
   首页
   ========================================================================== */

.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(1000px 380px at 15% -10%, rgba(31, 111, 235, 0.09), transparent 60%),
    radial-gradient(700px 320px at 88% 0%, rgba(211, 58, 44, 0.07), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  margin: 0 0 14px;
  font-size: 38px;
  line-height: 1.28;
  letter-spacing: -0.4px;
}
.hero .lead { margin: 0 0 26px; font-size: 16.5px; color: var(--text-2); max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }

.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 44px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.stat-num { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { font-size: 12.5px; color: var(--text-3); }

@media (max-width: 620px) {
  .hero { padding: 44px 0 36px; }
  .hero h1 { font-size: 27px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.18s;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-ico {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 17px; margin-bottom: 12px;
}
.feature-card h3 { margin: 0 0 6px; font-size: 15px; }
.feature-card p { margin: 0; font-size: 13px; color: var(--text-2); }

.steps { counter-reset: s; }
.step {
  position: relative;
  padding-left: 44px;
  padding-bottom: 22px;
}
.step::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.step h4 { margin: 3px 0 4px; font-size: 14.5px; }
.step p { margin: 0; font-size: 13px; color: var(--text-2); }

.cta-band {
  background: linear-gradient(120deg, #1c2024, #2d3540);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 34px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-band h2 { margin: 0 0 6px; font-size: 21px; }
.cta-band p { margin: 0; opacity: 0.78; font-size: 14px; }
.cta-band .btn-primary { background: #fff; color: #1c2024; border-color: #fff; }
.cta-band .btn-primary:hover { background: #e9edf2; }

/* ==========================================================================
   文档 / SDK 页（左目录 + 右内容）
   ========================================================================== */

.doc-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 28px 0 60px;
}

.doc-side {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  max-height: calc(100vh - var(--nav-h) - 40px);
  overflow-y: auto;
  font-size: 13px;
}
.doc-side h4 {
  margin: 16px 0 6px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.doc-side h4:first-child { margin-top: 0; }
.doc-side a {
  display: block;
  padding: 4px 10px;
  border-left: 2px solid transparent;
  color: var(--text-2);
}
.doc-side a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.doc-side a.active { border-left-color: var(--brand); color: var(--brand-dark); font-weight: 600; }

@media (max-width: 860px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-side { display: none; }
}

.doc-sec { scroll-margin-top: calc(var(--nav-h) + 16px); margin-bottom: 40px; }
.doc-sec h2 { font-size: 20px; margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc-sec h3 { font-size: 15.5px; margin: 24px 0 8px; }
.doc-sec p { color: var(--text-2); }

.api-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 18px;
}
.api-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.api-path { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.api-body { padding: 16px; }
.api-body p { margin: 0 0 10px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
table.tbl th, table.tbl td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.tbl th { background: var(--surface-2); font-weight: 600; color: var(--text-2); font-size: 12.5px; }
table.tbl td code { font-size: 12px; }
table.tbl tr:last-child td { border-bottom: none; }

.try-box { background: var(--surface-2); border-top: 1px solid var(--border); padding: 14px 16px; }
.try-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.try-row input, .try-row select { width: auto; min-width: 150px; flex: 1 1 150px; }

/* ==========================================================================
   个人中心
   ========================================================================== */

.console-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 28px 0 60px;
}

.console-side {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
}
.console-side button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
}
.console-side button:hover { background: var(--surface-2); color: var(--text); }
.console-side button.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

@media (max-width: 860px) {
  .console-layout { grid-template-columns: minmax(0, 1fr); }
  .console-side { position: static; display: flex; overflow-x: auto; }
  .console-side button { width: auto; white-space: nowrap; }
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 800px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi-num { font-size: 22px; font-weight: 700; }
.kpi-label { font-size: 12px; color: var(--text-3); }

.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 8px; }
.bar-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.bar {
  width: 100%;
  background: var(--brand);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.bar-empty { background: var(--border); }
.bar-label { font-size: 10px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-val { font-size: 10.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-title { font-weight: 600; font-size: 13.5px; }
.list-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; word-break: break-all; }
.list-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.key-secret {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--warn-soft);
  border: 1px dashed #e0b96f;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 10px 0;
  word-break: break-all;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ==========================================================================
   登录 / 注册
   ========================================================================== */

.auth-page {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  place-items: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 8px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  font-weight: 500;
}
.auth-tabs button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm); }
.auth-title { margin: 0 0 4px; font-size: 19px; }
.auth-sub { margin: 0 0 20px; font-size: 13px; color: var(--text-2); }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-2); text-align: center; }

/* ==========================================================================
   商户认证
   ========================================================================== */

.pick-map {
  height: 260px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}
.pick-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.m-status { display: inline-flex; align-items: center; gap: 4px; }

.timeline { font-size: 13px; color: var(--text-2); }
.timeline .tl-item { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline .tl-item::before {
  content: '';
  position: absolute;
  left: -5px; top: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}
.timeline .tl-item.done { border-left-color: var(--success); }
.timeline .tl-item.done::before { background: var(--success); }

/* ==========================================================================
   Toast / 提示
   ========================================================================== */

#toastHost {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 8px;
  background: #1c2024;
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.18s ease-out;
  max-width: 90vw;
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warn); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid;
}
.alert-info { background: var(--brand-soft); border-color: #c7dcfb; color: var(--brand-dark); }
.alert-warn { background: var(--warn-soft); border-color: #f0dcb8; color: var(--warn); }
.alert-err { background: var(--danger-soft); border-color: #f0c4c0; color: var(--danger); }
.alert-ok { background: var(--success-soft); border-color: #bfe5d6; color: var(--success); }

/* ==========================================================================
   页脚
   ========================================================================== */

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 40px;
}
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--text-2); }
