/* 数联 API —— 深色设计系统
   规则参考 unslop（CC BY 4.0, @heydamir）：一套冷调深色中性色 + 朱砂单一强调色，
   4px 网格，发丝线分层，不用渐变 / 光晕 / emoji */
:root {
  color-scheme: dark;
  --page: #07080d; --card: #0c0e15; --raised: #141822; --sunk: #0a0c12; --hover: #181c27;
  --ink: #eef0f5; --ink-2: #a3a9b8; --mute: #7a8296;
  --line: rgba(238, 240, 245, .08); --line-2: rgba(238, 240, 245, .14); --line-3: rgba(238, 240, 245, .22);
  --accent: #d9472f; --accent-hi: #ef5b42; --accent-text: #f28470; --accent-soft: rgba(217, 71, 47, .12);
  --pos: #4cc38a; --neg: #e5484d; --warn: #e2a33d;
  --r-sm: 6px; --r: 8px; --r-card: 12px; --r-panel: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  /* 兼容旧变量名 */
  --bg: var(--page); --brand: var(--ink); --brand-ink: var(--page); --ok: var(--pos); --bad: var(--neg); --accent-ink: var(--accent-text);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--page); }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 14px/20px var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: rgba(217, 71, 47, .35); color: #fff; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; transition: text-decoration-color 150ms var(--ease), color 150ms var(--ease); }
a:hover { text-decoration-color: currentColor; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
code { background: var(--raised); border: 1px solid var(--line); padding: 0 6px; border-radius: 4px; color: var(--ink); }
pre { background: var(--sunk); color: #d6dae3; border: 1px solid var(--line); padding: 16px; border-radius: var(--r); overflow-x: auto; margin: 8px 0; line-height: 20px; }
pre code { background: none; border: 0; padding: 0; }
.num, td.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: 0; color: var(--ink); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--mute); } .dim { color: var(--ink-2); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .sp { flex: 1; }
.eyebrow { font: 500 12px/16px var(--mono); color: var(--accent-text); margin: 0 0 16px; }

/* ---------- 按钮 / 表单 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--raised); color: var(--ink); font: 500 14px/1 var(--sans); cursor: pointer; text-decoration: none;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease); white-space: nowrap; }
.btn:hover { background: var(--hover); border-color: var(--line-3); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #07080d; }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { color: #f0777a; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--raised); color: var(--ink); }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: 400 14px/20px var(--sans); color: var(--ink); padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--sunk); width: 100%; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
input, select { height: 36px; }
select option { background: var(--card); }
input::placeholder, textarea::placeholder { color: var(--mute); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--line-3); box-shadow: 0 0 0 3px rgba(238, 240, 245, .06); }
input:disabled { color: var(--ink-2); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
label { display: block; margin: 16px 0 8px; color: var(--ink-2); font-size: 13px; }

/* ---------- 卡片 / 网格 / 表格 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px 24px; margin-bottom: 16px; }
.card h3 { margin: 0 0 16px; font-size: 15px; line-height: 20px; }
.card-h { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; } .card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; } .grid > .card { margin-bottom: 0; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; } .split > .card { margin-bottom: 0; }
@media (max-width: 960px) { .g4, .g3 { grid-template-columns: 1fr 1fr; } .split { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }
.stat .k { color: var(--ink-2); font-size: 13px; } .stat .v { font-size: 28px; line-height: 32px; font-weight: 500; margin-top: 8px; font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px; height: 40px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--mute); font-weight: 400; font-size: 13px; height: 36px; }
tr:last-child td { border-bottom: 0; }
table tr:hover td { background: rgba(238, 240, 245, .02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; background: var(--raised); color: var(--ink-2); border: 1px solid var(--line); }
.tag.ok { background: rgba(76, 195, 138, .1); color: var(--pos); border-color: rgba(76, 195, 138, .2); }
.tag.bad { background: rgba(229, 72, 77, .1); color: #f0777a; border-color: rgba(229, 72, 77, .22); }
.tag.warn { background: rgba(226, 163, 61, .1); color: var(--warn); border-color: rgba(226, 163, 61, .22); }
.empty { color: var(--mute); padding: 32px 0; text-align: center; }

/* ---------- 应用外壳（控制台 / 后台） ---------- */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sb { background: var(--page); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px; }
.wm { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px; font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; }
.seal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; flex: none; }
.sb .sec { font-size: 12px; line-height: 16px; color: var(--mute); padding: 24px 10px 8px; }
.side { display: flex; flex-direction: column; gap: 2px; }
.side a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r); color: var(--ink-2); text-decoration: none; position: relative;
  transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.side a svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--mute); transition: color 150ms var(--ease); }
.side a:hover { background: var(--raised); color: var(--ink); }
.side a.on { background: var(--raised); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.side a.on svg { color: var(--accent-text); }
.side a .badge { margin-left: auto; font-size: 12px; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.sb-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0; display: flex; align-items: center; gap: 8px; }
.sb-foot .who { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; }
.ph { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(7, 8, 13, .85);
  backdrop-filter: saturate(140%) blur(8px); -webkit-backdrop-filter: saturate(140%) blur(8px); position: sticky; top: 0; z-index: 5; }
.ph h1 { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
.content { padding: 24px 32px 64px; max-width: 1440px; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sb { position: static; height: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; }
  .sb .sec, .sb-foot .who { display: none; }
  .sb .side { flex: none; flex-direction: row; }
  .sb .wm { flex: none; }
  .side a { white-space: nowrap; }
  .sb-foot { flex: none; margin: 0 0 0 8px; border: 0; padding: 0; }
  .ph { padding: 0 16px; height: 56px; } .content { padding: 16px 16px 48px; }
}

/* ---------- 余额 / 汇总条 ---------- */
.bal { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0; padding: 0; }
.bal > div { padding: 20px 24px; }
.bal > div + div { border-left: 1px solid var(--line); }
.bal .k { color: var(--ink-2); font-size: 13px; }
.bal .big { font-size: 32px; line-height: 40px; font-weight: 500; margin: 8px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.bal .v { font-size: 24px; line-height: 32px; font-weight: 500; margin-top: 8px; font-variant-numeric: tabular-nums; }
.runway { height: 4px; border-radius: 2px; background: var(--raised); margin: 12px 0 8px; overflow: hidden; }
.runway i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 400ms var(--ease); }
@media (max-width: 760px) { .bal { grid-template-columns: 1fr 1fr; } .bal > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); } .bal > div:nth-child(2) { border-left: 0; } }

/* ---------- 图表 ---------- */
.chart2 { position: relative; height: 280px; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: 1fr 24px; }
.chart2 .y { grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--mute); text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
.chart2 .plot { grid-row: 1; position: relative; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid var(--line-2);
  background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 25%; }
.chart2 .plot > div { flex: 1; min-width: 2px; background: #2a3040; border-radius: 2px 2px 0 0; position: relative; transition: background-color 150ms var(--ease); }
.chart2 .plot > div:last-child { background: var(--accent); }
.chart2 .plot > div:hover { background: #3c4458; }
.chart2 .plot > div:last-child:hover { background: var(--accent-hi); }
.chart2 .plot > div.zero, .chart2 .plot > div.zero:last-child { background: var(--raised); height: 2px !important; }
.chart2 .plot > div:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #07080d;
  font-size: 12px; line-height: 16px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; font-variant-numeric: tabular-nums; }
.chart2 .x { grid-column: 2; display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); padding-top: 8px; font-variant-numeric: tabular-nums; }
.toplist { list-style: none; margin: 0; padding: 0; }
.toplist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toplist li:last-child { border-bottom: 0; }
.toplist .p { font: 12px/16px var(--mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist .n { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.toplist .bar { grid-column: 1 / -1; height: 2px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.toplist .bar i { display: block; height: 100%; background: var(--line-3); }

/* ---------- 其它组件 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; height: 36px; padding: 0 12px; cursor: pointer; font: 400 14px var(--sans); color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 150ms var(--ease), border-color 150ms var(--ease); }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }
.keybox { background: var(--accent-soft); border: 1px solid rgba(217, 71, 47, .3); padding: 16px; border-radius: var(--r); word-break: break-all; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; color: var(--ink-2); }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #07080d; padding: 10px 16px; border-radius: var(--r);
  z-index: 99; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); font-size: 14px; animation: tin 220ms var(--ease); }
.toast.err { background: var(--neg); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translate(-50%, -8px); } }
.list-plain { margin: 0; padding-left: 20px; line-height: 28px; color: var(--ink-2); }
.pager { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- 官网顶栏 / 页脚 ---------- */
header.top { position: sticky; top: 0; z-index: 20; background: rgba(7, 8, 13, .8); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); }
header.top .wrap { display: flex; align-items: center; height: 60px; gap: 32px; }
header.top .logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
header.top .logo::before { content: "数"; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; }
header.top nav { display: flex; gap: 24px; flex: 1; }
header.top nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
header.top nav a:hover, header.top nav a.on { color: var(--ink); }
@media (max-width: 720px) { header.top nav { display: none; } header.top .wrap { gap: 8px; } header.top .logo { margin-right: auto; } }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 32px 0; }
.layout .side { position: sticky; top: 92px; align-self: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .layout .side { position: static; flex-direction: row; overflow-x: auto; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { border: 1px solid var(--line-2); color: var(--ink-2); padding: 0 10px; height: 26px; display: inline-flex; align-items: center; border-radius: 6px; font-size: 13px; }
section.blk { padding: 96px 0; border-top: 1px solid var(--line); }
section.blk h2 { font-size: 32px; line-height: 40px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 12px; }
section.blk .sub { color: var(--ink-2); font-size: 16px; line-height: 26px; margin: 0 0 40px; max-width: 40rem; }
.auth-box { max-width: 400px; margin: 96px auto; }
footer { color: var(--mute); padding: 48px 0; font-size: 13px; border-top: 1px solid var(--line); }
footer a { color: var(--ink-2); text-decoration: none; } footer a:hover { color: var(--ink); }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.chart div { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.ep { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px; background: var(--card); }
.ep[open] { border-color: var(--line-2); }
.ep summary { padding: 10px 16px; cursor: pointer; display: flex; gap: 12px; align-items: center; list-style: none; }
.ep summary::-webkit-details-marker { display: none; }
.ep .m { font: 500 12px var(--mono); padding: 2px 8px; border-radius: 4px; background: var(--raised); color: var(--ink-2); min-width: 48px; text-align: center; }
.ep .m.POST { background: var(--accent-soft); color: var(--accent-text); }
.ep .body { padding: 0 16px 16px; }
@media (max-width: 720px) { .tabs { flex-wrap: nowrap; overflow-x: auto; } .tabs button { flex: none; } }
.tabs .tab-g { display: inline-flex; align-items: center; height: 36px; padding: 0 4px 0 12px; font-size: 12px; color: var(--mute); }
.tabs .tab-g:first-child { padding-left: 0; }
