/* apipool 控制台/落地页样式
 *
 * 版式参考公开的 API 中转站控制台（顶部导航 + 分栏首屏 + 深色侧栏 + 卡片式控制台），
 * 视觉元素全部自绘：无第三方字体、无图片、无 CDN。
 * 主题：data-theme="light" | "dark"；颜色一律走变量。
 */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f2f4f8;
  --surface-raised: #ffffff;
  --ink: #0f1319;
  --muted: #697386;
  --line: #e5e8ef;
  --line-strong: #d3d9e4;
  --brand: #2f6bff;
  --brand-strong: #1f54d6;
  --brand-soft: #edf2ff;
  --brand-border: #cfdcff;
  --primary: #11151c;
  --primary-hover: #232a35;
  --primary-ink: #ffffff;
  --header-bg: rgba(246, 247, 251, 0.86);
  --sidebar: #0d1117;
  --sidebar-ink: #98a3b5;
  --sidebar-label: #7c8798;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fdf3e2;
  --ok: #0d7a52;
  --ok-soft: #e7f6ef;
  --chart-1: #2f6bff;
  --tooltip-bg: #0b0f16;
  --tooltip-ink: #f7f9fc;
  --tooltip-border: rgba(255, 255, 255, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.06);
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #0a0d13;
  --surface: #11151d;
  --surface-soft: #171c26;
  --surface-raised: #151a23;
  --ink: #e8edf5;
  --muted: #94a0b4;
  --line: #222a36;
  --line-strong: #2f3a49;
  --brand: #6f9bff;
  --brand-strong: #9bb8ff;
  --brand-soft: #16233d;
  --brand-border: #27406b;
  --primary: #e9eef7;
  --primary-hover: #ffffff;
  --primary-ink: #0b0f16;
  --header-bg: rgba(10, 13, 19, 0.84);
  --sidebar: #06090e;
  --sidebar-ink: #94a0b4;
  --sidebar-label: #7c8798;
  --danger: #ff8a80;
  --danger-soft: #2a1514;
  --warn: #f2c879;
  --warn-soft: #2a2110;
  --ok: #7ddbb2;
  --ok-soft: #10241c;
  --chart-1: #6f9bff;
  --tooltip-bg: #e9eef7;
  --tooltip-ink: #0b0f16;
  --tooltip-border: rgba(11, 15, 22, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 40px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.app-body {
  display: block;
}

main {
  flex: 1;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

p {
  margin: 0 0 10px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-soft);
  border-radius: 6px;
  padding: 0.12em 0.4em;
  overflow-wrap: anywhere;
}

pre code {
  background: transparent;
  padding: 0;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.hint-error {
  color: var(--danger);
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ------------------------------------------------------------------ 通用 */

.page-wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

@media (min-width: 1360px) {
  .page-wrap {
    max-width: 1300px;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-dark {
  background: var(--primary);
  color: var(--primary-ink);
}

.btn-dark:hover {
  background: var(--primary-hover);
  color: var(--primary-ink);
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-strong);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--ink);
  background: var(--surface);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.btn-light {
  background: #ffffff;
  color: #11151c;
}

.btn-light:hover {
  background: #eef1f7;
  color: #11151c;
}

.btn-outline-light {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-side {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.btn-side:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.btn-small {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.icon-btn:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.theme-toggle .icon-dark {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-light {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-dark {
  display: inline-flex;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.chip-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 600;
}

.pill-dark {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* ------------------------------------------------------------------ 顶栏 */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2f6bff, #8fb3ff);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
}

.brand-name {
  letter-spacing: -0.02em;
}

.brand-sub {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav a {
  color: var(--muted);
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: 999px;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--surface-soft);
  text-decoration: none;
}

.site-nav a.is-active {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.nav-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 移动端站点导航：桌面隐藏；<=960px 用汉堡折叠，避免落地页在手机上没有任何导航入口。 */
.site-menu {
  display: none;
  position: relative;
}

.site-menu summary {
  list-style: none;
  cursor: pointer;
}

.site-menu summary::-webkit-details-marker {
  display: none;
}

.site-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 200px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.site-menu-panel a {
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ink);
  font-size: 13.5px;
}

.site-menu-panel a:hover {
  background: var(--surface-soft);
  text-decoration: none;
}

.site-menu-panel a.is-active {
  color: var(--brand);
  font-weight: 600;
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.balance-chip:hover {
  text-decoration: none;
  border-color: var(--line-strong);
}

.balance-chip strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  width: 180px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.nav-search input {
  border: 0;
  padding: 0;
  min-height: 0;
  height: 100%;
  background: transparent;
  font-size: 13px;
}

.nav-search input:focus-visible {
  outline: none;
}

.nav-search:focus-within {
  border-color: var(--brand);
}

/* ------------------------------------------------------------------ 落地页 */

.hero-band {
  padding: 62px 0 40px;
  background:
    radial-gradient(900px 460px at 82% 12%, var(--brand-soft), transparent 68%),
    radial-gradient(600px 320px at 8% 96%, var(--surface-soft), transparent 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 44px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  flex: none;
}

.hero-copy h1 {
  margin: 20px 0 18px;
  font-size: clamp(38px, 4.4vw, 60px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.accent {
  color: var(--brand);
}

.lede {
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.75;
  max-width: 52ch;
  margin: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-points {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
}

.hero-points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-points .icon {
  width: 16px;
  height: 16px;
  color: var(--brand);
}

.hero-visual {
  position: relative;
  min-height: 440px;
  display: grid;
  place-items: center;
}

.gauge {
  width: min(100%, 440px);
  height: auto;
  font-family: var(--font);
  filter: drop-shadow(0 24px 48px rgba(47, 107, 255, 0.14));
}

.gauge-plate {
  fill: var(--surface);
}

.gauge-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
}

.gauge-tick {
  stroke: var(--line-strong);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.gauge-tick-major {
  stroke: var(--muted);
  stroke-width: 2;
}

.gauge-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 12;
}

.gauge-track-inner {
  stroke-width: 1;
  stroke-dasharray: 2 7;
}

.gauge-arc {
  fill: none;
  stroke: url(#gaugeStroke);
  stroke-width: 12;
  stroke-linecap: round;
}

.gauge-orb {
  fill: var(--brand);
}

.gauge-orb-soft {
  fill: var(--line-strong);
}

.gauge-title {
  fill: var(--ink);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1.5px;
}

.gauge-sub {
  fill: var(--brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
}

.gauge-foot {
  fill: var(--muted);
  font-size: 8.5px;
  letter-spacing: 2px;
}

.float-card {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  font-size: 12px;
}

.float-card-api {
  right: 0;
  bottom: 48px;
  width: 214px;
  transform: rotate(-2deg);
}

.float-card-mini {
  left: 0;
  top: 42px;
  width: 184px;
}

.float-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  margin-bottom: 8px;
}

.float-code {
  display: block;
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--ink);
}

.float-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px;
  color: var(--muted);
}

.float-code-strong {
  color: var(--brand);
  font-weight: 700;
}

.float-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--surface-soft);
  overflow: hidden;
  margin-bottom: 8px;
}

.float-bar > span {
  display: block;
  height: 100%;
  width: 68%;
  border-radius: 99px;
  background: var(--brand);
}

.float-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.mini-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.mini-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.proto-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-top: 34px;
}

.proto-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}

.proto-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.proto-name {
  font-weight: 700;
  font-size: 15px;
}

.proto-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.proto-note {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.feature-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 56px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 14px;
}

.feature-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.auth-band {
  padding-top: 56px;
  padding-bottom: 48px;
}

.auth-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 30px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.auth-cta h2 {
  margin: 12px 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.auth-cta p {
  margin: 0;
  max-width: 560px;
  font-size: 14px;
}

.auth-cta .eyebrow {
  margin-bottom: 0;
}

.auth-cta .btn {
  flex: none;
}

/* 登录 / 注册合并弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 18, 0.56);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(5, 10, 20, 0.35);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.modal-head .hint {
  margin: 0;
}

.modal-close {
  flex: none;
  width: 34px;
  height: 34px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface-soft);
  border-radius: 999px;
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab:hover {
  color: var(--ink);
}

.auth-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.auth-tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.auth-submit {
  width: 100%;
  min-height: 44px;
}

.auth-foot {
  margin: 14px 0 0;
  font-size: 11.5px;
  text-align: center;
}

body.modal-open {
  overflow: hidden;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack > * {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 12.5px;
  color: var(--muted);
}

.field.grow {
  flex: 1 1 240px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

.cta-band {
  padding-bottom: 72px;
}

.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 36px 40px;
  border-radius: 22px;
  background: var(--primary);
  color: var(--primary-ink);
}

.cta-inner h2 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -0.03em;
  color: inherit;
}

.cta-inner p {
  margin: 0;
  color: inherit;
  opacity: 0.7;
  font-size: 14px;
}

.cta-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ 页脚 */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 0;
  background: var(--surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand .brand {
  font-size: 14px;
}

.footer-brand .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  font-size: 12.5px;
}

.footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

/* ------------------------------------------------------------ 控制台骨架 */

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  z-index: 30;
  transition: padding 180ms ease;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  color: #ffffff;
}

.side-brand:hover {
  text-decoration: none;
  color: #ffffff;
}

.side-brand-text strong {
  display: block;
  font-size: 14.5px;
  line-height: 1.2;
}

.side-brand-text small {
  color: var(--sidebar-ink);
  font-size: 11px;
}

.side-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 2px;
}

.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-label {
  margin: 0 0 4px;
  padding: 0 10px;
  color: var(--sidebar-label);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--sidebar-ink);
  font-size: 13.5px;
  text-decoration: none;
}

.side-link .icon {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  text-decoration: none;
}

.side-link.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.side-link.is-active .icon {
  color: #8fb3ff;
  opacity: 1;
}

.side-link.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.side-link .chip {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  color: #b9c3d3;
  font-size: 10px;
  padding: 1px 6px;
}

.side-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-user {
  font-size: 12px;
  color: var(--sidebar-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-foot #logout {
  justify-content: flex-start;
}

.side-foot #logout .icon {
  width: 15px;
  height: 15px;
}

/* 折叠态：220px → 64px，仅图标；悬停 / 键盘聚焦显示高对比 tooltip。
 * 只在桌面宽度生效，移动端仍走 264px 抽屉，不继承折叠状态。 */
@media (min-width: 961px) {
  html.sidebar-collapsed .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  html.sidebar-collapsed .sidebar {
    padding: 18px 8px;
    overflow: visible;
  }

  html.sidebar-collapsed .side-brand {
    justify-content: center;
    padding: 4px 0 18px;
  }

  html.sidebar-collapsed .side-brand-text,
  html.sidebar-collapsed .side-label,
  html.sidebar-collapsed .side-link-label,
  html.sidebar-collapsed .side-link .chip,
  html.sidebar-collapsed .side-user,
  html.sidebar-collapsed .side-foot-label {
    display: none;
  }

  html.sidebar-collapsed .side-nav {
    overflow: visible;
    gap: 10px;
  }

  html.sidebar-collapsed .side-group {
    gap: 4px;
  }

  html.sidebar-collapsed .side-link {
    justify-content: center;
    padding: 10px 0;
  }

  html.sidebar-collapsed .side-link .icon {
    width: 18px;
    height: 18px;
  }

  html.sidebar-collapsed .side-foot {
    align-items: center;
    gap: 6px;
  }

  html.sidebar-collapsed .side-foot #logout {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  html.sidebar-collapsed .sidebar [data-tip] {
    position: relative;
  }

  html.sidebar-collapsed .sidebar [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 60;
    padding: 6px 10px;
    border: 1px solid var(--tooltip-border);
    border-radius: 8px;
    background: var(--tooltip-bg);
    color: var(--tooltip-ink);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-4px, -50%);
    transition: opacity 120ms ease, transform 120ms ease;
  }

  html.sidebar-collapsed .sidebar [data-tip]:hover::after,
  html.sidebar-collapsed .sidebar [data-tip]:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

.sidebar-toggle {
  flex: none;
}

.sidebar-toggle .icon {
  transition: transform 160ms ease;
}

html.sidebar-collapsed .sidebar-toggle .icon {
  transform: scaleX(-1);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 28px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.menu-btn {
  display: none;
}

.topbar-title {
  min-width: 0;
}

.topbar-title .crumb {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.topbar-title h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 200px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.topbar-search input {
  border: 0;
  padding: 0;
  min-height: 0;
  height: 100%;
  background: transparent;
  font-size: 13px;
}

.topbar-search input:focus-visible {
  outline: none;
}

.topbar-search:focus-within {
  border-color: var(--brand);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.app-message {
  margin: 16px 28px 0;
}

.announce {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 28px 0;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}

.announce p {
  margin: 0;
}

.announce .chip {
  flex: none;
}

.app-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 28px 56px;
}

.page-intro {
  margin: 0 0 18px;
}

.page-intro p {
  margin: 0;
  font-size: 13.5px;
}

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(6, 9, 14, 0.5);
  border: 0;
}

/* ------------------------------------------------------------ 余额黑卡 */

.balance-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 28px;
  border-radius: 22px;
  background:
    radial-gradient(700px 320px at 88% -10%, rgba(47, 107, 255, 0.5), transparent 62%),
    linear-gradient(135deg, #0e1219 0%, #151b26 58%, #101a2e 100%);
  color: #f7f9fc;
  box-shadow: 0 20px 44px rgba(10, 16, 30, 0.26);
}

.balance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.balance-label {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12.5px;
}

.balance-value {
  margin: 0;
  font-size: clamp(32px, 3.6vw, 46px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.balance-unit {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 500;
}

.balance-sub {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11.5px;
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.balance-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.balance-cell span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11.5px;
}

.balance-cell strong {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-cell small {
  color: rgba(255, 255, 255, 0.38);
  font-size: 10.5px;
}

.balance-cell-chart {
  justify-content: space-between;
}

.spark {
  height: 54px;
}

.spark-svg {
  display: block;
  width: 100%;
  height: 54px;
}

.spark-bar {
  fill: rgba(255, 255, 255, 0.82);
}

.spark-bar.is-empty {
  fill: rgba(255, 255, 255, 0.16);
}

/* ---------------------------------------------------------------- 卡片 */

.card {
  margin-bottom: 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.card-muted {
  background: var(--surface-soft);
  box-shadow: none;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
}

.card-head .hint {
  margin: 0;
}

.data-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

/* 窄屏表格提示：滚动阴影之外再给一句明确文案，避免只露出 "acti" 这类被裁切的列。 */
.scroll-hint {
  display: none;
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 11.5px;
}

/* 明细折叠：参考站把 371 行表直接铺在概览里，这里默认收起长表，先给结论。 */
.fold {
  padding: 0;
}

.fold-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}

.fold-summary::-webkit-details-marker {
  display: none;
}

.fold-title {
  font-size: 16px;
  font-weight: 600;
}

.fold-hint {
  margin: 0;
}

.fold-cue {
  margin-left: auto;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 600;
}

.fold-cue::after {
  content: "＋";
  margin-left: 6px;
}

.fold[open] .fold-cue::after {
  content: "－";
}

.fold-summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.fold[open] .fold-summary {
  border-bottom: 1px solid var(--line);
}

.fold .table-wrap {
  margin: 0;
  border: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.page-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.page-grid-2 .card {
  margin-bottom: 18px;
  height: 100%;
}

/* -------------------------------------------------------------- 分段控件 */

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.seg-btn {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

/* ------------------------------------------------------------ 指标与图表 */

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.metric span {
  color: var(--muted);
  font-size: 11.5px;
}

.metric strong {
  font-size: 20px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.metric-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.metric-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.metric-tab {
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.metric-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.chart-box {
  height: 250px;
}

.chart-box-lg {
  height: 320px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.chart-tick {
  fill: var(--muted);
  font-size: 10px;
  font-family: var(--font);
}

.chart-bar {
  fill: var(--brand);
  opacity: 0.85;
}

.chart-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: var(--brand);
  opacity: 0.12;
}

.chart-dot {
  fill: var(--brand);
}

.chart-empty {
  fill: var(--muted);
  font-size: 12px;
  font-family: var(--font);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.stat-card-flat {
  background: var(--surface-soft);
  border-color: transparent;
  box-shadow: none;
}

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
}

.stat-card strong {
  font-size: 24px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card small {
  color: var(--muted);
  font-size: 11px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.quick-card {
  display: block;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  transition: transform 160ms ease, border-color 160ms ease;
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  text-decoration: none;
  color: var(--ink);
}

.quick-kicker {
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.quick-card h3 {
  margin: 6px 0 4px;
  font-size: 15px;
}

.quick-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- 表单 */

.row-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid.tight {
  gap: 12px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kv {
  margin: 0 0 12px;
  display: grid;
  gap: 12px;
}

.kv > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.kv dt {
  color: var(--muted);
  font-size: 12.5px;
}

.kv dd {
  margin: 0;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.key-reveal {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed var(--brand-border);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}

.key-reveal-title {
  margin: 0 0 10px;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
}

.key-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#new-key-value {
  flex: 1 1 260px;
  padding: 9px 12px;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.theme-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.theme-choice.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.theme-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
}

.theme-dot-light {
  background: #ffffff;
}

.theme-dot-dark {
  background: #10151d;
}

/* ---------------------------------------------------------------- 表格 */

/* 表格容器：窄屏可横向滚动，并用“滚动阴影”提示还有列被遮住
 * （参考站的表格在 390px 下直接裁切，没有任何可滚动提示）。 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(15, 19, 25, 0.16), transparent) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(15, 19, 25, 0.16), transparent) right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 16px 100%, 16px 100%;
  background-attachment: local, local, scroll, scroll;
}

.table-wrap:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-soft);
}

td.empty-cell {
  padding: 28px 14px;
  text-align: center;
}

.amount-in {
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.amount-out {
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.link {
  font-weight: 600;
}

/* ---------------------------------------------------------------- 提示条 */

.message {
  margin-bottom: 18px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}

.message-ok {
  background: var(--ok-soft);
  border-color: var(--ok-soft);
  color: var(--ok);
}

.message-error {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
  color: var(--danger);
}

.message-warn {
  background: var(--warn-soft);
  border-color: var(--warn-soft);
  color: var(--warn);
}

.message-info {
  background: var(--brand-soft);
  border-color: var(--brand-soft);
  color: var(--brand-strong);
}

/* ------------------------------------------------------------ 模型广场 */

.models-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.filter-panel {
  position: sticky;
  top: 86px;
  margin-bottom: 0;
  padding: 0;
  overflow: hidden;
}

/* 筛选面板本身是可折叠 details：移动端默认收起，避免三个筛选组把模型列表挤到首屏以下。 */
.filter-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 16px 18px;
  list-style: none;
  cursor: pointer;
}

.filter-head::-webkit-details-marker {
  display: none;
}

.filter-head:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  border-radius: var(--radius);
}

.filter-title {
  font-size: 16px;
  font-weight: 600;
}

.filter-head .chip {
  margin-left: auto;
}

.filter-head::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 140ms ease;
}

.filter-panel[open] .filter-head::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.filter-body {
  padding: 0 18px 18px;
}

.filter-actions {
  margin: 2px 0 10px;
}

.filter-actions .btn {
  width: 100%;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12.5px;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--brand);
}

.models-main {
  min-width: 0;
}

.models-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px 18px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.model-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
}

.model-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.model-title {
  min-width: 0;
}

.model-vendor {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 190px;
}

.model-title h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 15.5px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.model-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.model-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

.model-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.model-meta dt {
  color: var(--muted);
  flex: none;
}

.model-meta dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.model-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.model-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- 文档 */

.doc {
  max-width: 1080px;
  padding-top: 30px;
  padding-bottom: 64px;
}

.doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.doc-head h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.doc-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.toc {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px;
}

.toc a {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12.5px;
}

.toc a:hover {
  color: var(--ink);
  text-decoration: none;
}

.doc .card {
  scroll-margin-top: 88px;
}

.snippet {
  margin: 0 0 16px;
}

.snippet figcaption {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #0f141b;
  color: #e8efe9;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.plain-list li + li {
  margin-top: 6px;
}

/* ---------------------------------------------------------------- 管理 */

.admin-main {
  padding-top: 30px;
  padding-bottom: 64px;
}

.stats {
  display: grid;
  gap: 14px;
}

.health-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1180px) {
  .hero-grid {
    gap: 28px;
  }

  .hero-copy h1 {
    font-size: clamp(36px, 4.6vw, 52px);
  }

  .balance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-search {
    width: 160px;
  }

  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .site-nav {
    display: none;
  }

  .site-menu {
    display: block;
  }

  .nav-search {
    display: none;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .hero-band {
    padding-top: 44px;
  }

  .hero-visual {
    min-height: 400px;
    padding-bottom: 56px;
  }

  .proto-band,
  .feature-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-cta {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 24px 22px;
  }

  .auth-cta h2 {
    font-size: 24px;
  }

  .page-grid-2 {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 264px;
    height: 100vh;
    transform: translateX(-102%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
  }

  body.nav-open .sidebar {
    transform: none;
  }

  .menu-btn {
    display: inline-grid;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-topbar {
    padding: 12px 16px;
  }

  .topbar-search {
    display: none;
  }

  .app-content,
  .app-message {
    padding-left: 16px;
    padding-right: 16px;
  }

  .app-message {
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 15px;
    padding-right: 15px;
  }

  .announce {
    margin-left: 16px;
    margin-right: 16px;
  }

  .models-layout {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    position: static;
  }

  .check-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .page-wrap {
    padding: 0 16px;
  }

  .nav-inner {
    height: 60px;
    gap: 10px;
  }

  .brand-sub,
  .balance-chip {
    display: none;
  }

  .nav-tools {
    gap: 6px;
  }

  .hero-band {
    padding: 32px 0 28px;
  }

  .hero-copy h1 {
    font-size: clamp(30px, 8.4vw, 38px);
    margin: 16px 0 14px;
  }

  .lede {
    font-size: 14.5px;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .hero-visual {
    min-height: 330px;
    padding-bottom: 60px;
  }

  .float-card-mini {
    display: none;
  }

  .float-card-api {
    right: 0;
    bottom: 4px;
    width: 188px;
    padding: 12px 14px;
  }

  .proto-band,
  .feature-band {
    grid-template-columns: 1fr;
    padding-top: 28px;
  }

  .auth-band {
    padding-top: 44px;
  }

  /* 移动端弹窗：12px 边距 + 内部滚动；输入框 16px，避免 iOS 聚焦时自动放大。
   * --modal-max 由 landing.js 依据 visualViewport 写入，软键盘弹出后仍保证按钮可达。 */
  .modal {
    padding: 12px;
  }

  .modal-panel {
    padding: 20px;
    border-radius: 18px;
    max-height: var(--modal-max, calc(100dvh - 24px));
  }

  .modal-head h2 {
    font-size: 20px;
  }

  .modal-head .modal-close {
    width: 40px;
    height: 40px;
  }

  .auth-tab {
    min-height: 44px;
  }

  #auth-email,
  #auth-password {
    font-size: 16px;
  }

  .models-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .models-toolbar .hint {
    align-self: flex-end;
  }

  .auth-card,
  .card {
    padding: 18px;
    border-radius: 16px;
  }

  .fold {
    padding: 0;
  }

  .scroll-hint {
    display: block;
  }

  .filter-panel {
    padding: 0;
  }

  .fold-summary {
    padding: 16px 18px;
    flex-wrap: wrap;
  }

  .fold-hint {
    flex: 1 1 100%;
    order: 3;
  }

  .cta-inner {
    padding: 26px 22px;
  }

  .cta-inner h2 {
    font-size: 22px;
  }

  .balance-card {
    padding: 20px;
    border-radius: 18px;
  }

  .balance-head {
    flex-direction: column;
    margin-bottom: 18px;
  }

  .balance-value {
    font-size: 34px;
  }

  .balance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .balance-cell-chart {
    grid-column: 1 / -1;
  }

  .balance-cell-wide {
    grid-column: 1 / -1;
  }

  .metric strong {
    font-size: 17px;
  }

  .stat-card strong {
    font-size: 20px;
  }

  .app-topbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar-title h1 {
    font-size: 17px;
  }

  .topbar-title .crumb {
    display: none;
  }

  .topbar-right {
    gap: 6px;
  }

  .app-content {
    padding: 16px 12px 48px;
  }

  .app-message {
    margin-left: 12px;
    margin-right: 12px;
  }

  .announce {
    margin: 10px 12px 0;
    font-size: 11.5px;
  }

  .app-message.message {
    margin-bottom: 12px;
  }

  .avatar,
  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .balance-chip-app {
    display: inline-flex;
    height: 34px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  .model-grid {
    grid-template-columns: 1fr;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-box {
    height: 220px;
  }

  .chart-box-lg {
    height: 240px;
  }

  .card-head {
    gap: 10px;
  }

  .doc-head {
    flex-direction: column;
  }

  .doc-head h1 {
    font-size: 24px;
  }

  .row-form .btn,
  .row-form .field {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .brand-name {
    font-size: 15px;
  }

  .site-header .btn-small {
    padding: 0 12px;
  }

  .balance-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-row,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .hero-points {
    font-size: 12.5px;
  }

  .topbar-right .theme-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
