/* ============================================================
   Nebula API — Design System
   ============================================================ */
:root {
  --bg: #070912;
  --bg-soft: #0b0f1d;
  --panel: rgba(19, 23, 40, 0.72);
  --panel-solid: #111629;
  --panel-hover: rgba(31, 38, 64, 0.8);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1fb;
  --text-soft: #a8b0cb;
  --text-dim: #6f7793;
  --brand: #7c5cff;
  --brand-2: #22d3ee;
  --brand-glow: rgba(124, 92, 255, 0.35);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.8);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --sidebar: 232px;
}

html[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --panel-hover: #f2f4fa;
  --border: rgba(16, 24, 40, 0.08);
  --border-strong: rgba(16, 24, 40, 0.16);
  --text: #131629;
  --text-soft: #4d566e;
  --text-dim: #8b93a8;
  --brand: #5b3df5;
  --brand-2: #0891b2;
  --brand-glow: rgba(91, 61, 245, 0.18);
  --shadow: 0 18px 40px -24px rgba(16, 24, 40, 0.35);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(800px 480px at 88% 4%, rgba(34, 211, 238, 0.12), transparent 62%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; color: var(--text-soft); }
code, pre, .mono { font-family: var(--mono); }
::selection { background: var(--brand-glow); }

/* ---------- 通用 ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-soft); }
.dim { color: var(--text-dim); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }

.gradient-text {
  background: linear-gradient(100deg, #b9a6ff 0%, #7c5cff 38%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 550;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-hover); border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, #7c5cff, #5b3df5);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 30px -12px var(--brand-glow);
}
.btn.primary:hover { box-shadow: 0 14px 36px -12px var(--brand-glow); filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { color: var(--danger); border-color: rgba(248, 113, 113, .35); }
.btn.danger:hover { background: rgba(248, 113, 113, .12); border-color: var(--danger); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.card.tight { padding: 14px 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title h3 { margin: 0; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; color: var(--text-soft); font-weight: 550; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--text-dim); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.hint { font-size: 12px; color: var(--text-dim); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: rgba(124, 92, 255, .14); color: #b9a6ff;
  border: 1px solid rgba(124, 92, 255, .25);
}
.badge.success { background: rgba(52, 211, 153, .13); color: var(--success); border-color: rgba(52, 211, 153, .28); }
.badge.warning { background: rgba(251, 191, 36, .13); color: var(--warning); border-color: rgba(251, 191, 36, .28); }
.badge.danger { background: rgba(248, 113, 113, .13); color: var(--danger); border-color: rgba(248, 113, 113, .28); }
.badge.neutral { background: rgba(148, 163, 184, .13); color: var(--text-soft); border-color: var(--border-strong); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 550; color: var(--text-dim);
  font-size: 12px; padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
html[data-theme="light"] tbody tr:hover { background: rgba(16, 24, 40, .025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  height: 64px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -0.03em; font-size: 16px; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, #7c5cff, #22d3ee);
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 800;
  box-shadow: 0 6px 18px -6px var(--brand-glow);
}
.topnav { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
.topnav a {
  padding: 7px 12px; border-radius: 9px; color: var(--text-soft);
  font-size: 13.5px; font-weight: 500; transition: all .16s;
}
.topnav a:hover { color: var(--text); background: var(--panel-hover); }
.topnav a.active { color: var(--text); background: var(--panel-hover); }

/* ---------- 侧栏（控制台） ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
}
.sidebar .brand { padding: 4px 8px 18px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-soft); font-weight: 500; font-size: 13.5px;
  transition: all .16s;
}
.side-link:hover { background: var(--panel-hover); color: var(--text); }
.side-link.active {
  background: linear-gradient(135deg, rgba(124, 92, 255, .22), rgba(34, 211, 238, .1));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .28);
}
.side-link .ico { width: 18px; text-align: center; opacity: .9; }
.side-group { margin: 14px 12px 6px; font-size: 11px; letter-spacing: .08em; color: var(--text-dim); text-transform: uppercase; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin-top: 3px; }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.stat .value { font-size: 25px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 30px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--text-soft); text-align: center; }
.auth-foot a { color: var(--brand); font-weight: 550; }

/* ---------- 落地页 ---------- */
.hero { padding: 84px 0 60px; text-align: center; position: relative; }
.hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.1; letter-spacing: -0.035em; margin-bottom: 18px; }
.hero p.lead { font-size: 17px; max-width: 660px; margin: 0 auto 28px; color: var(--text-soft); }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 16px; font-size: 12.5px; color: var(--text-dim); }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px; border-radius: 999px; font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--border-strong); color: var(--text-soft);
  margin-bottom: 22px;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section-head h2 { font-size: 30px; margin-bottom: 10px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feature { padding: 22px; transition: transform .18s, border-color .18s; }
.feature:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.feature .ico {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(124, 92, 255, .22), rgba(34, 211, 238, .12));
  border: 1px solid rgba(124, 92, 255, .22); font-size: 17px; margin-bottom: 14px;
}
.feature h3 { font-size: 15.5px; margin-bottom: 6px; }
.feature p { font-size: 13px; margin: 0; color: var(--text-soft); }
.price-table td { font-size: 13px; }
.code-block {
  background: #05070f; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; position: relative;
}
html[data-theme="light"] .code-block { background: #0b0f1d; }
.code-block pre { margin: 0; color: #d6ddf5; font-size: 12.5px; line-height: 1.75; }
.code-block .tok-key { color: #7dd3fc; }
.code-block .tok-str { color: #a5f3b0; }
.code-block .tok-com { color: #6b7794; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  padding: 6px 13px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
  border: 1px solid transparent; color: var(--text-dim); background: transparent;
}
.tab.active { background: var(--panel-hover); border-color: var(--border-strong); color: var(--text); }
.footer { border-top: 1px solid var(--border); padding: 34px 0; margin-top: 40px; color: var(--text-dim); font-size: 13px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 24px; }
.footer h4 { font-size: 12.5px; color: var(--text-soft); margin-bottom: 10px; }
.footer a { display: block; padding: 3px 0; color: var(--text-dim); }
.footer a:hover { color: var(--text); }
.faq-item { border-bottom: 1px solid var(--border); padding: 16px 0; }
.faq-item summary { cursor: pointer; font-weight: 550; list-style: none; display: flex; justify-content: space-between; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { margin: 10px 0 0; font-size: 13px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; }
.toast {
  min-width: 240px; max-width: 380px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); font-size: 13px;
  animation: toast-in .22s ease;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.success { border-color: rgba(52, 211, 153, .4); }
.toast.error { border-color: rgba(248, 113, 113, .45); }
.toast .t-ico { flex: 0 0 auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(3, 5, 12, .68);
  backdrop-filter: blur(4px); z-index: 9000;
  display: grid; place-items: center; padding: 20px;
  animation: fade-in .16s ease;
}
.modal {
  width: 100%; max-width: 460px; background: var(--panel-solid);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow);
  animation: modal-in .2s cubic-bezier(.2, .8, .3, 1);
}
.modal.wide { max-width: 620px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 10px; }
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-hover) 50%, var(--panel) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 14px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 密钥展示 ---------- */
.keybox {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--mono); font-size: 12.5px; word-break: break-all;
}
.keybox .k { flex: 1; min-width: 0; }

/* ---------- 图表 ---------- */
.chart { width: 100%; height: 200px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; }
.chart .dot { fill: var(--brand); }
.chart .bar { fill: var(--brand); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); }

/* ---------- 工具类 ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.copy-btn { cursor: pointer; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .main { padding: 18px 16px 60px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
    transform: translateX(-100%); transition: transform .24s ease;
    background: var(--bg-soft);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .topnav { display: none; }
  .mobile-only { display: inline-flex !important; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
.mobile-only { display: none; }
@media (max-width: 640px) {
  .hero { padding: 52px 0 40px; }
  .card { padding: 16px; }
  .stat .value { font-size: 21px; }
  table { font-size: 12.5px; }
  thead th, tbody td { padding: 9px 8px; }
}
