/* 算力中转站 · 全站样式
   令牌沿用 Harness 设计规范：暖象牙底 + 墨炭字 + 陶土强调；浅深两套同时成立。
   字号：界面 11–15，标题/大数字 16 / 18 / 22 / 28；圆角 2 / 4 / 6 / 8 / 12 / 16 / 24 / 999；数字一律 tabular-nums。
   控件高度三档：sm 24–26 / 默认 32 / lg 40，同一行里的按钮、输入框、分段控件等高。
   衬线只用于首屏大标题（.display），其余标题、控件一律无衬线。
   只有浮层（菜单、抽屉、确认框、登录卡）用玻璃，阅读区保持不透明。 */
:root {
  --bg: #F8F3ED; --surface: #FFFFFF; --sunk: #F2ECE4;
  --line: #E8E1D9; --line-2: #D8CEC5;
  --ink: #262421; --ink-2: #49423C; --mute: #6A625A; --faint: #736A62;
  --accent: #9E4931; --accent-hover: #843C29; --accent-soft: #C2765A; --accent-bg: #F8EAE1;
  --on-accent: #FFFFFF; --sel-line: #B77058; --disabled: #DDD3C9;
  --red-bg: #FDEBEC; --red: #9F2F2D;
  --green-bg: #EDF3EC; --green: #346538;
  --yellow-bg: #FBF3DB; --yellow: #956400;
  --blue-bg: #E1F3FE; --blue: #1F6C9F;
  --gray-bg: #EFEAE4; --gray: #8A8178;
  --hover: rgba(38, 36, 33, .045);
  --shadow: rgba(108, 67, 38, .06); --shadow-lg: rgba(108, 67, 38, .11);
  --mask: rgba(38, 30, 24, .18);
  --g-bg: rgba(255, 255, 255, .80); --g-edge: rgba(113, 81, 53, .12); --g-hi: rgba(255, 255, 255, .9);
  --g-blur: saturate(1.6) blur(20px);
  --sans: "SF Pro Text", "PingFang SC", "Helvetica Neue", "Hiragino Sans GB", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, monospace;
  --r: 8px; --r-lg: 12px; --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #201D1A; --surface: #292521; --sunk: #322C27;
  --line: #43392F; --line-2: #605044;
  --ink: #F5EEE5; --ink-2: #E0D4C7; --mute: #BCAE9F; --faint: #A89A8B;
  --accent: #EEA47E; --accent-hover: #F4B393; --accent-soft: #D98D68; --accent-bg: #402E24;
  --on-accent: #1A1410; --sel-line: #A47659; --disabled: #3E3630;
  --red-bg: #3A1F1E; --red: #F0918B;
  --green-bg: #1D2D21; --green: #8FC79A;
  --yellow-bg: #33291A; --yellow: #E2B862;
  --blue-bg: #172937; --blue: #82B9E0;
  --gray-bg: #38322C; --gray: #9C9084;
  --hover: rgba(255, 255, 255, .05);
  --shadow: rgba(0, 0, 0, .35); --shadow-lg: rgba(0, 0, 0, .5);
  --mask: rgba(0, 0, 0, .45);
  --g-bg: rgba(44, 39, 34, .82); --g-edge: rgba(235, 210, 186, .12); --g-hi: rgba(255, 242, 226, .08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink-2); font: 13px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--sunk); border-radius: 4px; padding: 1px 6px; }
.num { font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.t12 { font-size: 12px; }
.hint { font-size: 12px; color: var(--faint); }
a.hint:hover { color: var(--accent); }
.faint { color: var(--faint); }
.sp { flex: 1; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sel-line); outline-offset: 2px; }

/* ---------------------------------------------------------------- 顶栏 */
.top {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; align-items: center; gap: 24px;
  padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
/* 标识：陶土色线条 M（一条线路经中转站分流），不做实心底块。
   mark.png 只提供形状（透明度），颜色取 --accent，浅深主题自动切换 */
.logo i {
  width: 24px; height: 18px; flex: none; background: var(--accent);
  -webkit-mask: url(/static/mark.png) center / contain no-repeat; mask: url(/static/mark.png) center / contain no-repeat;
}
.nav { display: flex; gap: 4px; }
.nav a { color: var(--mute); padding: 6px 12px; border-radius: var(--r); font-size: 13px; transition: background .15s var(--ease), color .15s var(--ease); }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--sunk); font-weight: 500; }
.bal {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 13px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--accent-bg); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; cursor: pointer; border: 0; font-size: 13px;
}

/* ---------------------------------------------------------------- 布局 */
.page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card + .card, .grid + .card, .card + .grid { margin-top: 16px; }
.card-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 28px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .g4, .g3 { grid-template-columns: 1fr; } .top { gap: 12px; padding: 0 12px; } .nav a { padding: 6px 8px; } .page { padding: 16px 12px; } }

.kpi { padding: 16px; }
.kpi .k { color: var(--mute); font-size: 12px; }
.kpi .v { color: var(--ink); font-size: 28px; font-weight: 600; line-height: 1.3; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--faint); font-size: 12px; margin-top: 4px; }
.kpi.warn { background: var(--yellow-bg); border-color: transparent; }
.kpi.warn .s { color: var(--yellow); }

/* ---------------------------------------------------------------- 控件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 500 13px var(--sans); cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn:hover { background: var(--sunk); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--mute); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; height: 40px; font-size: 14px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 14px; }

input, select, textarea {
  height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); font: 13px var(--sans); min-width: 0;
}
textarea { height: auto; padding: 8px 10px; font-family: var(--mono); font-size: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sel-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--mute); }
.field input, .field select, .field textarea { width: 100%; }
.form { display: grid; gap: 12px; }
.form.cols { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { height: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 12px; }

.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--sunk); border-radius: 12px; }
.seg button {
  border: 0; background: transparent; color: var(--mute); height: 24px; padding: 0 12px; border-radius: 8px;
  font: 500 12px var(--sans); cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.seg button:hover { color: var(--ink); }
/* 外框 4 + 按钮 24 = 32，和默认按钮、输入框等高；.lg 为 40 */
.seg.lg button { height: 32px; font-size: 13px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg button:disabled:hover { color: var(--mute); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px var(--shadow), 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- 表格 */
.tbl-wrap { overflow-x: auto; margin: 0 -16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--mute); font-size: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--hover); }
td.r, th.r { text-align: right; }
tr.detail td { background: var(--sunk); font-size: 12px; color: var(--mute); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv b { font-weight: 400; color: var(--mute); }

/* ---------------------------------------------------------------- 徽标 / 状态 */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11px; background: var(--sunk); color: var(--mute); white-space: nowrap; }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--gray); flex: none; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--yellow); } .dot.down { background: var(--red); }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mute); }

.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 20px; }
.hours i { border-radius: 2px; background: var(--gray-bg); }
.hours i.ok { background: var(--green); } .hours i.warn { background: var(--yellow); } .hours i.down { background: var(--red); }
.hours-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }

/* 柱状图 */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b i { width: 100%; max-width: 36px; background: var(--accent-soft); border-radius: 4px 4px 2px 2px; min-height: 2px; transition: height .2s var(--ease); }
.bars .b i.cost2 { background: var(--line-2); }
.bars .b span { font-size: 11px; color: var(--faint); white-space: nowrap; }
.bars .b em { font-style: normal; font-size: 11px; color: var(--mute); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--mute); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

.rank { display: grid; gap: 8px; }
.rank .row { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 13px; }
.rank .bar { grid-column: 1 / -1; height: 4px; background: var(--sunk); border-radius: 2px; overflow: hidden; }
.rank .bar i { display: block; height: 100%; background: var(--accent-soft); }

/* ---------------------------------------------------------------- 模型卡片 */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color .15s var(--ease), box-shadow .2s var(--ease);
}
.mcard:hover { border-color: var(--line-2); box-shadow: 0 4px 16px var(--shadow); }
.mcard .hd { display: flex; align-items: center; gap: 8px; }
.mcard .nm { font-size: 15px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .id { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.mcard .desc { font-size: 12px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.mcard .ft { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }

/* ---------------------------------------------------------------- 空状态 */
.empty { text-align: center; padding: 40px 16px; }
.empty h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--mute); margin: 0 0 16px; }
.empty .acts { display: inline-flex; gap: 8px; }
.empty.sm { padding: 24px 16px; color: var(--mute); }

/* ---------------------------------------------------------------- 浮层：菜单、抽屉、确认框、提示 */
.menu {
  position: absolute; z-index: 40; min-width: 180px; padding: 4px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 32px var(--shadow-lg), 0 2px 6px var(--shadow);
}
.menu a, .menu button {
  display: flex; width: 100%; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 0; background: none;
  color: var(--ink-2); font: 13px var(--sans); border-radius: 8px; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--hover); color: var(--ink); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; }
.menu .seg { margin: 4px 6px; display: flex; }
.menu .seg button { flex: 1; justify-content: center; height: 24px; }

dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink-2);
  width: min(520px, calc(100vw - 32px)); box-shadow: 0 16px 48px var(--shadow-lg);
}
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: var(--mask); }
dialog .dh { display: flex; align-items: center; padding: 16px 16px 0; }
dialog .db { padding: 16px; max-height: 70vh; overflow: auto; }
dialog .df { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
dialog .warn-text { color: var(--red); font-size: 12px; }

.drawer-mask { position: fixed; inset: 0; z-index: 50; background: var(--mask); opacity: 0; transition: opacity .2s var(--ease); }
.drawer-mask.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(560px, 100vw); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -12px 0 32px var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .2s var(--ease);
}
.drawer.open { transform: none; }
.drawer .dh { display: flex; align-items: center; gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer .db { padding: 16px; overflow: auto; flex: 1; }
pre.code {
  background: var(--sunk); border-radius: 8px; padding: 12px; overflow: auto; font: 12px/1.6 var(--mono); color: var(--ink); margin: 8px 0 0; white-space: pre;
}

.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 80; transform: translate(-50%, 8px); opacity: 0;
  padding: 8px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px;
  transition: opacity .2s var(--ease), transform .2s var(--ease); pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }

.keybox { display: flex; gap: 8px; align-items: center; background: var(--sunk); border-radius: 8px; padding: 8px 8px 8px 12px; }
.keybox code { background: none; padding: 0; flex: 1; word-break: break-all; color: var(--ink); }
.strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice { background: var(--accent-bg); color: var(--ink-2); border-radius: 12px; padding: 12px 16px; font-size: 13px; }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .menu, dialog { background: var(--g-bg); -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur); border-color: var(--g-edge); }
  dialog::backdrop, .drawer-mask { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
}

/* ---------------------------------------------------------------- 登录页 / 首页：见 fx.css */
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.err-line { color: var(--red); font-size: 12px; min-height: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* 协议页 + 公共页页脚 */
.legal { max-width: 760px; padding-bottom: 48px; }
.legal h1 { margin: 8px 0 4px; }
.legal .meta { font-size: 12px; color: var(--faint); margin: 0 0 24px; }
.legal h2 { margin: 32px 0 8px; }
.legal p, .legal li { line-height: 1.8; margin: 8px 0; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal b { color: var(--ink); font-weight: 600; }
.legal .todo { color: var(--faint); }
.lg-tbl { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.lg-tbl th, .lg-tbl td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; line-height: 1.6; }
.lg-tbl th { background: var(--sunk); color: var(--ink); font-weight: 600; }
.site-foot { max-width: 1180px; margin: 0 auto; padding: 24px; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); }
.site-foot a { color: var(--mute); }
.site-foot a:hover { color: var(--accent); }
.agree { margin: 0; text-align: center; }
@media (max-width: 560px) { .site-foot { padding: 16px 12px; } .lg-tbl th, .lg-tbl td { padding: 6px 8px; } }
