:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --border: #e5e7eb;
  --text: #1f2328;
  --text-dim: #656d76;
  --text-faint: #8b949e;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-soft: #eff4ff;
  --sidebar: #161b22;
  --sidebar-text: #c9d1d9;
  --sidebar-active: #1f6feb;
  --success: #1a7f37;
  --success-soft: #dafbe1;
  --danger: #cf222e;
  --danger-soft: #ffebe9;
  --warn: #9a6700;
  --warn-soft: #fff8c5;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(27, 31, 36, 0.08), 0 1px 2px rgba(27, 31, 36, 0.06);
}

html[data-theme='dark'] {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --text-faint: #6e7681;
  --brand: #4493f8;
  --brand-hover: #58a6ff;
  --brand-soft: #121d2f;
  --sidebar: #010409;
  --success: #3fb950;
  --success-soft: #12261e;
  --danger: #f85149;
  --danger-soft: #2d1418;
  --warn: #d29922;
  --warn-soft: #2b2412;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }

code, pre, .mono {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.sidebar .brand .logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #4493f8, #8957e5);
  display: grid; place-items: center;
  font-size: 14px;
}

.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .12s;
}
.sidebar a.nav-item:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar a.nav-item.active { background: var(--sidebar-active); color: #fff; }
.sidebar .nav-icon { width: 16px; text-align: center; opacity: .9; }
.sidebar .nav-sep { height: 1px; background: rgba(255,255,255,.09); margin: 10px 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 600; font-size: 16px; }
.topbar .sub { color: var(--text-dim); font-size: 12.5px; }
.topbar .spacer { flex: 1; }

.content { padding: 20px 22px 60px; max-width: 1400px; width: 100%; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { color: var(--text-dim); font-size: 12.5px; margin-bottom: 6px; }
.stat .value { font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.stat .hint { color: var(--text-faint); font-size: 12px; margin-top: 4px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 10px 20px; font-size: 14.5px; }
.btn-block { width: 100%; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text-dim); font-weight: 500; }
.field .help { color: var(--text-faint); font-size: 12px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
select { cursor: pointer; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.checkbox input { width: auto; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-dim); font-weight: 500; font-size: 12.5px; background: var(--panel-2); white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .mono { word-break: break-all; }

.empty { padding: 44px 16px; text-align: center; color: var(--text-faint); }

.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--text-dim); font-size: 13px; }
.pager .spacer { flex: 1; }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge.ok { background: var(--success-soft); border-color: transparent; color: var(--success); }
.badge.err { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge.brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); }

.pill { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-dim); }

/* ---------------- 提示 ---------------- */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.info { background: var(--brand-soft); color: var(--brand); border-color: rgba(37,99,235,.25); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--success-soft); color: var(--success); }

.toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  padding: 10px 15px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
  font-size: 13px;
  max-width: 380px;
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left: 3px solid var(--success); }
.toast.err { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  z-index: 300;
  padding: 20px;
}
.modal {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0,0,0,.28);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal.wide { max-width: 780px; }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; align-items: center; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; }

/* ---------------- 代码块 ---------------- */
.code-block {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
}
.endpoint {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.endpoint .spacer { flex: 1; }

/* ---------------- 图表 ---------------- */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 8px; }
.chart .bar { flex: 1; min-width: 3px; background: var(--brand); border-radius: 3px 3px 0 0; opacity: .85; position: relative; }
.chart .bar:hover { opacity: 1; }
.chart-legend { display: flex; justify-content: space-between; color: var(--text-faint); font-size: 11.5px; margin-top: 6px; }

/* ---------------- 模型广场 ---------------- */
.market-hero { padding: 54px 22px 30px; max-width: 1180px; margin: 0 auto; }
.market-hero .eyebrow { font-size: 12px; letter-spacing: 3px; color: var(--text-faint); font-weight: 600; margin-bottom: 16px; text-transform: uppercase; }
.market-hero h1 { font-size: 46px; line-height: 1.06; letter-spacing: -1.5px; margin-bottom: 16px; }
.market-hero .lead { font-size: 15px; color: var(--text-dim); margin-bottom: 24px; max-width: 520px; }
.market-hero .hero-cta { margin-bottom: 34px; }

.market-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.market-bar .chip {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.market-bar .chip:hover { background: var(--panel-2); }
.market-bar .chip.active { background: var(--text); color: var(--panel); font-weight: 600; }
.market-bar .count { color: var(--text-faint); font-size: 12.5px; margin-left: 4px; white-space: nowrap; }
.market-bar .spacer { flex: 1; min-width: 8px; }
.market-bar input[type=search] { width: 230px; border-radius: 999px; }

.market-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1020px) { .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) {
  .market-grid { grid-template-columns: 1fr; }
  .market-hero h1 { font-size: 31px; letter-spacing: -0.8px; }
  .market-bar input[type=search] { width: 100%; }
}

.model-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.model-card .vendor {
  align-self: flex-start;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 15px;
}
.model-card .model-name { font-size: 21px; font-weight: 700; letter-spacing: -0.4px; word-break: break-all; margin-bottom: 9px; line-height: 1.25; }
.model-card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 17px; }
.model-card .mode { color: var(--text-dim); font-size: 13px; }
.model-card .desc { color: var(--text-faint); font-size: 12.5px; margin-bottom: 15px; line-height: 1.5; }

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.price-grid.single { grid-template-columns: 1fr; }
.price-cell { background: var(--panel-2); border-radius: 11px; padding: 10px 12px; }
.price-cell .k { font-size: 11.5px; color: var(--text-faint); margin-bottom: 5px; }
.price-cell .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.price-cell .v.free { color: var(--success); }
.unpriced { background: var(--panel-2); border-radius: 11px; padding: 15px 16px; color: var(--text-faint); font-size: 13px; margin-top: auto; }
.market-note { max-width: 1180px; margin: 0 auto; padding: 6px 22px 60px; color: var(--text-faint); font-size: 12.5px; line-height: 1.7; }

/* ---------------- 落地页 ---------------- */
.hero { padding: 64px 22px 40px; max-width: 1080px; margin: 0 auto; text-align: center; }
.hero h1 { font-size: 38px; letter-spacing: -1px; margin-bottom: 14px; }
.hero p.lead { font-size: 16px; color: var(--text-dim); max-width: 620px; margin: 0 auto 26px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.nav-public {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; max-width: 1080px; margin: 0 auto;
}
.nav-public .spacer { flex: 1; }
.nav-public .brand { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.nav-public .brand .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg,#4493f8,#8957e5); display: grid; place-items: center; color: #fff; font-size: 14px; }
.section { max-width: 1080px; margin: 0 auto; padding: 34px 22px; }
.section h2 { text-align: center; margin-bottom: 26px; font-size: 24px; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature .icon { font-size: 22px; margin-bottom: 10px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--text-dim); font-size: 13.5px; margin: 0; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 30px 28px; }
.auth-card .brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; font-size: 17px; font-weight: 600; }
.auth-card .brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg,#4493f8,#8957e5); display: grid; place-items: center; color: #fff; }

.doc { max-width: 860px; }
.doc h2 { margin-top: 26px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc h3 { margin-top: 20px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }
.doc code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12.5px; }
.mono-sm { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.break-all { word-break: break-all; }
.row { display: flex; align-items: center; gap: 9px; }
.row.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
