:root {
  --bg: #0c1018;
  --bg-2: #111826;
  --card: #161d2b;
  --line: rgba(232, 214, 176, 0.14);
  --text: #f3eee4;
  --muted: #97a0b0;
  --gold: #d4b483;
  --gold-2: #f0d7a8;
  --good: #5ee0a8;
  --wait: #e7c15a;
  --bad: #ff8080;
  --grok: #7dd3fc;
  --cursor: #c4b5fd;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: "IBM Plex Sans", "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212, 180, 131, 0.14), transparent 55%),
    radial-gradient(900px 500px at 110% 0%, rgba(94, 224, 168, 0.08), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; line-height: 1.55; }
.err { color: var(--bad); font-size: 13px; margin: 8px 0 0; }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #1a2233, #141a27);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px 28px 28px;
  box-shadow: var(--shadow);
}
.kicker {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 11px;
  margin: 0 0 10px;
}
.login-card h1 { margin: 0; font-size: 42px; letter-spacing: 0.12em; }
.sub { color: var(--muted); margin: 8px 0 28px; }
.login-card label, .card label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.login-card input, .card input, .card select, .group input[type="text"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 6px;
  background: #0d131e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.login-card input:focus, .card input:focus, .card select:focus {
  border-color: var(--gold);
}
.login-card button, .add-acc, .row-btns button, .ghost, .group .save {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
}
.login-card button, .add-acc, .group .save, .row-btns button:not(.ghost) {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1408;
  font-weight: 650;
}
.login-card button:hover, .add-acc:hover { filter: brightness(1.05); }

.app {
  min-height: 100dvh;
  display: grid;
  /* minmax(0,…) 是必须的：群里的模型下拉框选项名很长，1fr 会被它撑破 */
  grid-template-columns: 260px minmax(0, 1fr);
}
.rail {
  border-right: 1px solid var(--line);
  background: rgba(12, 16, 24, 0.72);
  backdrop-filter: blur(16px);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1408; font-weight: 800;
}
.brand strong { display: block; font-size: 18px; }
.brand em { font-style: normal; color: var(--muted); font-size: 12px; }
/* 两列。工具独占下一整行，不要再按 25% 去挤，挤完会掉到半宽、菜单从栏中间掉下来。 */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  position: relative;
  z-index: 4;
}
.page-nav a {
  min-width: 0;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 2px;
  font-weight: 650;
  font-size: 12.5px;
  white-space: nowrap;
}
.page-nav a.on { color: #1a1408; background: var(--gold); border-color: var(--gold); }
/* 文件、搬家、路由、服务器收在「工具」里。帐台不放进去。 */
.nav-fold > summary::-webkit-details-marker { display: none; }
.nav-fold > summary::marker { content: none; }
.nav-fold > summary::after {
  content: "";
  display: inline-block;
  margin-left: 4px;
  vertical-align: 1px;
  border-width: 4px 3.5px 0;
  border-style: solid;
  border-color: currentColor transparent transparent;
}
.nav-fold[open] > summary::after {
  vertical-align: 2px;
  border-width: 0 3.5px 4px;
  border-color: transparent transparent currentColor;
}
.nav-sub {
  position: absolute;
  z-index: 41;
  top: calc(100% + 6px);
  right: 0;
  min-width: 132px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: #121826;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}
.nav-sub a {
  flex: none;
  max-width: none;
  width: auto;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  border-color: transparent;
}
.nav-sub a:hover { color: var(--text); background: #1b2638; }
.nav-sub a.on { color: #1a1408; background: var(--gold); border-color: var(--gold); }
.page-nav > .nav-fold {
  grid-column: 1 / -1;
  min-width: 0;
  position: relative;
}
.page-nav > .nav-fold > .nav-sub {
  left: 0;
  right: 0;
  min-width: 0;
}
.page-nav > .nav-fold > summary {
  list-style: none;
  display: block;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 2px;
  font-weight: 650;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.page-nav > .nav-fold.on > summary {
  color: #1a1408;
  background: var(--gold);
  border-color: var(--gold);
}
#nav-shade {
  position: fixed;
  inset: 0;
  z-index: 7;
  background: transparent;
}
.add-acc { width: 100%; }
.acc-list { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow: auto; }
.acc-item {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
}
.acc-item:hover { background: #182132; }
.acc-item.active { background: #1b2638; border-color: var(--line); }
.acc-item b { display: block; }
.acc-item small { color: var(--muted); }
.rail-foot button {
  width: 100%;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}

.main { padding: 24px 28px 48px; max-width: 1180px; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.top h2 { margin: 0; font-size: 28px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost {
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  width: auto !important;
}
.ghost.danger { color: var(--bad) !important; border-color: rgba(255,128,128,.35) !important; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 16px; margin-bottom: 16px; }
.card {
  background: linear-gradient(180deg, rgba(22, 29, 43, 0.96), rgba(16, 22, 34, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.status-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 650;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--good); background: rgba(94,224,168,.1); }
.pill.wait { color: var(--wait); background: rgba(231,193,90,.12); }
.pill.bad { color: var(--bad); background: rgba(255,128,128,.12); }
.qr-box { margin-top: 14px; text-align: center; }
.qr-box img {
  width: min(260px, 100%);
  background: #fff;
  padding: 12px;
  border-radius: 16px;
}
.seg { display: flex; background: #0d131e; border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  border-radius: 11px; padding: 10px; cursor: pointer; font-weight: 650;
}
.seg button.on { background: #223049; color: var(--text); }
.cursor-box { margin-top: 8px; }
.quota-box { margin: 12px 0 4px; }
.quota-title {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 650; margin-bottom: 8px;
}
.tiny-btn { width: auto !important; padding: 4px 10px !important; font-size: 12px !important; }
.quota-row { margin: 0 0 10px; }
.quota-row:last-child { margin-bottom: 0; }
.quota-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 1.4; }
.quota-head b { font-weight: 650; }
.quota-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.quota-bar {
  height: 8px; background: #0d131e; border: 1px solid var(--line);
  border-radius: 99px; overflow: hidden; margin-top: 6px;
}
.quota-bar > i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; }
.quota-bar.warn > i { background: var(--wait); }
.quota-bar.hot > i { background: var(--bad); }
.row-btns { display: flex; gap: 8px; }
.row-btns button { width: auto; flex: 1; white-space: nowrap; }

.groups-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.groups { display: grid; gap: 12px; margin-top: 14px; }
.group {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #121926;
}
.group-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.group h4 { margin: 0 0 4px; font-size: 16px; }
.jid { font-size: 11px; color: var(--muted); word-break: break-all; }
.role {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0;
}
.role button, .skill {
  border: 1px solid var(--line);
  background: #0d131e;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}
.role button.on { color: #1a1408; background: var(--gold); border-color: var(--gold); font-weight: 700; }
.skills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.skill.on { color: #082016; background: var(--good); border-color: var(--good); font-weight: 700; }
.group-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.group-grid label { min-width: 0; }
.group .save { width: auto; padding: 10px 16px; }
.now-model { margin-top: 6px; color: var(--gold); font-size: 12px; font-weight: 650; }
.model-pick { max-width: 100%; }

.host-card { margin-bottom: 16px; }
.host-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.host-head h3 { margin: 0; }
.host-meta { margin: 6px 0 0; }
.host-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin: 12px 0 12px;
}
.host-stat { background: #121926; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.host-stat span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.host-stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.host-stat.hot b { font-size: 22px; }
.host-stat small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.host-bar {
  height: 6px; background: #0d131e; border: 1px solid var(--line);
  border-radius: 99px; overflow: hidden; margin-top: 6px;
}
.host-bar > i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; }
.host-bar.warn > i { background: var(--wait); }
.host-bar.hot > i { background: var(--bad); }
.host-svcs { display: flex; flex-wrap: wrap; gap: 6px; }
.host-svc {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #0d131e; color: var(--muted);
  border-radius: 999px; padding: 5px 10px; font-size: 12px;
}
.host-svc::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.host-svc.ok { color: var(--text); }
.host-svc.ok::before { background: var(--good); }
.host-svc.bad { color: var(--bad); }
.host-svc.bad::before { background: var(--bad); }

.bench-card { margin-bottom: 16px; }
.bench-top {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
  margin: 12px 0 14px;
}
.bench-img {
  width: 100%;
  border-radius: 12px;
  background: #0d131e;
  border: 1px solid var(--line);
}
.bench-opts .chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 14px 8px 0;
  color: var(--text);
  font-size: 13px;
}
.bench-opts .chk input, .chk input { width: auto; margin: 0; accent-color: var(--gold); }
.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.bench-table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--line); border-radius: 12px; }
.bench-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bench-table th, .bench-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.bench-table th { position: sticky; top: 0; background: #182132; z-index: 1; font-weight: 650; color: var(--muted); }
.bench-table td.wrap { white-space: normal; max-width: 180px; word-break: break-all; }
.mark-ok { color: var(--good); font-weight: 700; }
.mark-mid { color: var(--wait); font-weight: 700; }
.mark-bad { color: var(--bad); font-weight: 700; }
.mark-fail { color: var(--muted); }

.migrate-form label { margin-bottom: 12px; }

.ts-join { margin-top: 12px; }
.ts-join-note { line-height: 1.6; }
.ts-join-msg { margin-top: 10px; line-height: 1.6; }
.ts-join-url {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: #0d131e;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ts-join-url a {
  flex: 1;
  min-width: 0;
  color: var(--gold);
  font-size: 13px;
  word-break: break-all;
}
.ts-join-url button { width: auto; flex: 0 0 auto; }
.migrate-log {
  margin-top: 14px;
  max-height: 420px;
  overflow: auto;
  background: #0d131e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d7deea;
}
.migrate-hint p { margin: 4px 0; }

/* ── Tailscale 路由页 ── */
.ts-side { display: flex; flex-direction: column; gap: 10px; }
.ts-side-item {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.ts-side-item b { font-size: 14px; font-variant-numeric: tabular-nums; }
.ts-auto { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); }
.ts-auto input { width: auto; margin: 0; }

.ts-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.ts-stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-width: 0; }
.ts-stat b {
  font-size: 20px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ts-stat small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-stat-live b { color: var(--good); font-variant-numeric: tabular-nums; }

/* 出口怎么选的说明条 */
.ts-note {
  margin: 14px 0 0; padding: 12px 14px; line-height: 1.7; font-size: 13px;
  color: var(--muted); border: 1px solid var(--line); border-radius: 12px;
  background: #0d131e; border-left: 3px solid var(--gold);
}
.ts-note b { color: var(--text); }
.ts-note code {
  background: #161d2b; border-radius: 5px; padding: 1px 5px; font-size: 12px;
}

.exit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 0;
}
#exit-grid { grid-template-columns: minmax(280px, 560px); }
.exit-card { display: flex; flex-direction: column; gap: 10px; }
.exit-card h3 { margin: 2px 0 0; font-size: 22px; }
.exit-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.exit-id { margin: 0; color: var(--muted); font-size: 12px; word-break: break-all; }
.exit-rows { display: flex; flex-direction: column; gap: 8px; }
.exit-rows > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 10px; background: #0d131e;
  font-size: 13px;
}
.exit-rows span { color: var(--muted); }
.exit-rows b { font-weight: 650; text-align: right; }
@media (max-width: 900px) {
  .exit-grid { grid-template-columns: 1fr; }
}

/* 按设备分流 */
.split-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.split-head h3 { margin: 0; }
.split-head-act { display: flex; align-items: center; gap: 10px; }
.split-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.split-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; background: #0d131e; cursor: pointer; margin: 0;
}
.split-row.on { border-color: rgba(212, 180, 131, 0.45); background: #131a28; }
.split-row input { width: auto; margin: 0; accent-color: var(--gold); flex: 0 0 auto; }
.split-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.split-name {
  width: 100%; background: transparent; border: 1px solid transparent;
  color: var(--text); font-size: 14px; font-weight: 650;
  border-radius: 8px; padding: 2px 6px; margin: 0; outline: none;
}
.split-name:hover { border-color: var(--line); }
.split-name:focus { border-color: var(--gold); background: #0d131e; }
.split-who code { background: #161d2b; border-radius: 5px; padding: 1px 5px; font-size: 11px; }
.split-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.split-add { display: flex; gap: 8px; flex-wrap: wrap; }
.split-add input {
  flex: 1; min-width: 160px;
  background: #0d131e; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 12px; outline: none;
}
.split-add input:focus { border-color: var(--gold); }
.split-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.split-foot p { flex: 1; min-width: 200px; margin: 0; }
.split-foot button {
  border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer;
  font-weight: 700; color: #1a1408; background: var(--gold);
}
.split-foot button:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 900px) {
  .split-list { grid-template-columns: 1fr; }
}

/* sing-box：手机卡、流量三格、家宽和点名分开 */
.box-remote { margin: 8px 0 0; word-break: break-all; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.box-remote code { font-size: 13px; }
.dxb-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.dxb-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dxb-block h4 { margin: 0 0 6px; font-size: 15px; font-weight: 650; }
.dxb-named { margin: 0; }
.dxb-named > summary {
  cursor: pointer; font-size: 15px; font-weight: 650; color: var(--text); list-style: none;
}
.dxb-named > summary::-webkit-details-marker { display: none; }
.dxb-named > summary::before { content: "▸ "; color: var(--muted); }
.dxb-named[open] > summary::before { content: "▾ "; }
.dxb-named > summary + .cn-intro { margin-top: 8px; }
#box-router { margin-top: 12px; }
#box-router:empty { display: none; }
.dxb-router-name { font-size: 18px; font-weight: 700; }
.dxb-block .cn-intro { margin-top: 0; }
.dxb-fields {
  display: grid;
  grid-template-columns: minmax(140px, 1.5fr) 88px minmax(100px, 1fr) minmax(100px, 1fr);
  gap: 8px;
  margin-top: 10px;
}
#box-card .dxb-fields label { margin: 0; font-size: 12px; color: var(--muted); }
#box-card .dxb-fields input { margin-top: 4px; }
.dxb-exit-acts { margin-top: 10px; }
.dxb-exit-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.dxb-exit {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px 12px;
  background: #0d131e;
}
.dxb-sub { margin: 14px 0 0; font-size: 14px; font-weight: 700; }
.dxb-exit-open { margin-top: 12px; }
.dxb-exit-msg { margin: 8px 0 0; }
#box-card .dxb-exit .dxb-fields,
#box-exit-new .dxb-fields { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
#box-card .dxb-add select,
#box-card select.dxb-via {
  width: auto;
  max-width: 100%;
  margin-top: 0;
  padding: 8px 10px;
  font-size: 14px;
}
#box-card select.dxb-via { padding: 6px 8px; font-size: 13px; }
.dxb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dxb-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 6px 8px 6px 12px; background: #101722;
}
.dxb-chip b { font-size: 14px; font-weight: 650; word-break: break-all; }
.dxb-chip-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.dxb-chip .ghost { padding: 4px 10px; }
.dxb-chips > p { width: 100%; margin: 0; }
.dxb-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
#box-card > .split-head h3 { font-size: 22px; }
#box-card > .split-head #box-stat { color: var(--gold-2); font-size: 13px; }
.dxb-phone {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 14px;
  background: #101722;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dxb-phone.on {
  border-color: rgba(94, 224, 168, 0.45);
  background: linear-gradient(180deg, rgba(94, 224, 168, 0.07), #101722 46%);
}
.dxb-phone.wait { border-color: rgba(231, 193, 90, 0.5); }
.dxb-phone.off { opacity: 0.72; }
.dxb-phone-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dxb-phone-top .dxb-acts { margin-left: auto; }
#box-card .dxb-phone-top input {
  flex: 1; min-width: 140px; width: auto; margin: 0;
  background: transparent; border: 1px solid transparent;
  font-size: 18px; font-weight: 700; padding: 2px 6px;
}
#box-card .dxb-phone-top input:hover { border-color: var(--line); }
#box-card .dxb-phone-top input:focus { border-color: var(--gold); background: #0d131e; }
.dxb-phone-now { font-size: 12px; color: var(--muted); }
.dxb-phone-pin {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}
.dxb-phone-pin label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.dxb-phone-pin p { margin: 0; }
.dxb-phone-url {
  font-size: 12px; color: var(--muted); word-break: break-all;
  background: #0d131e; border-radius: 8px; padding: 6px 8px;
}
.dxb-phone-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.dxb-phone-stat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: baseline;
  background: #161d2b;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.dxb-phone-k { grid-column: 1 / -1; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; color: var(--muted); }
.dxb-phone-lab { font-size: 12px; color: var(--muted); }
.dxb-phone-stat b { font-size: 26px; font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.05; }
.dxb-phone-stat small { font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dxb-phone-stat small.is-zero { color: var(--muted); }
.dxb-phone-stat.sg { border-color: rgba(125, 211, 252, 0.45); }
.dxb-phone-stat.sg .dxb-phone-k,
.dxb-phone-stat.sg small { color: var(--grok); }
.dxb-phone-stat.home { border-color: rgba(212, 180, 131, 0.55); }
.dxb-phone-stat.home .dxb-phone-k,
.dxb-phone-stat.home small { color: var(--gold-2); }
.dxb-phone-stat.gz { border-color: rgba(248, 113, 113, 0.5); }
.dxb-phone-stat.gz .dxb-phone-k,
.dxb-phone-stat.gz small { color: #f0a8a0; }
.dxb-phone-stat small.is-zero { color: var(--muted); }
.dxb-block-head #box-exit-result { margin: 0; }
.dxb-legacy { margin-top: 16px; }
.dxb-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.3fr) minmax(120px, 0.9fr) auto;
  gap: 8px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #0d131e;
}
.dxb-row.wait { border-color: rgba(231, 193, 90, 0.5); }
.dxb-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dxb-who input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  border-radius: 8px;
  padding: 2px 6px;
  margin: 0;
  outline: none;
}
.dxb-who input:hover { border-color: var(--line); }
.dxb-who input:focus { border-color: var(--gold); background: #101722; }
.dxb-who code { font-size: 11px; color: var(--muted); word-break: break-all; }
.dxb-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.dxb-flow { grid-column: 1 / -1; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.dxb-flow p { margin: 0; }
.dxb-old { margin-top: 12px; }
.dxb-old summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.dxb-old-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dxb-old-list code { font-size: 12px; }
.dxb-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.dxb-go {
  border: 0;
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
  color: #1a1408;
  background: var(--gold);
  white-space: nowrap;
}
.dxb-go:disabled, .dxb-acts .ghost:disabled { opacity: 0.6; cursor: default; }
#box-exit { margin-top: 14px; }
#box-exit-port { flex: 0 0 96px; min-width: 88px; }
#box-exit-result { margin: 8px 0 0; }
.dxb-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dxb-add input {
  flex: 1;
  min-width: 140px;
  background: #0d131e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
}
.dxb-add input:focus { border-color: var(--gold); }
.dxb-add select {
  background: #0d131e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
}
.dxb-add select:focus { border-color: var(--gold); }
@media (max-width: 900px) {
  .dxb-row { grid-template-columns: 1fr; }
  .dxb-acts { justify-content: flex-start; }
  .dxb-fields { grid-template-columns: 1fr 1fr; }
  .dxb-phone-stats { grid-template-columns: 1fr; }
  .dxb-phone-stat b { font-size: 22px; }
  .dxb-phone-top .dxb-acts { margin-left: 0; }
}

/* 各台机器实时对比 */
.ts-hosts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ts-host {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: #0d131e; display: flex; flex-direction: column; gap: 10px;
}
.ts-host.ts-stale { opacity: 0.6; }
.ts-host-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ts-nic {
  display: flex; flex-direction: column; gap: 3px;
  background: #161d2b; border-radius: 10px; padding: 8px 10px;
}
.ts-nic-rate { font-size: 17px; font-variant-numeric: tabular-nums; }
.ts-nic span { line-height: 1.6; }
/* 今天的量，得比「累计」显眼一点 */
.ts-usage { color: var(--text); font-variant-numeric: tabular-nums; }
.ts-days-wrap { display: flex; flex-direction: column; gap: 5px; padding: 0 2px; }
.ts-days { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.ts-days i {
  flex: 1; min-width: 6px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--gold), #6b5320);
}
.ts-days i.zero { background: var(--line); }
.ts-host-foot { line-height: 1.6; }
.ts-hosts-foot { margin: 10px 0 0; }

/* 手机上用的节点卡，桌面隐藏 */
.ts-list { display: none; flex-direction: column; gap: 10px; }
.ts-node {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; background: #0d131e;
  display: flex; flex-direction: column; gap: 8px;
}
.ts-node.ts-off { opacity: 0.55; }
.ts-node-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ts-node-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-node-name b { font-size: 15px; }
.ts-node-sub {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 12px; line-height: 1.5; word-break: break-all;
}
.ts-node-live {
  font-size: 15px; font-variant-numeric: tabular-nums;
  padding: 8px 10px; border-radius: 10px; background: #161d2b;
}
.ts-node-foot {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  justify-content: space-between;
}

.ts-table td { vertical-align: top; }
.ts-table tr.ts-off { opacity: 0.5; }
.ts-ip { font-size: 12px; color: var(--muted); }
.ts-conn { font-size: 12px; }
.ts-direct { color: var(--good); }
.ts-relay { color: var(--wait); }
.ts-self { color: var(--gold); }
.ts-offline, .ts-idle { color: var(--muted); }
.ts-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted); font-weight: 600;
}
.ts-tag.gold { color: var(--gold); border-color: rgba(212, 180, 131, 0.4); }
.ts-tag.cyan { color: var(--grok); border-color: rgba(125, 211, 252, 0.35); }
.ts-link {
  background: transparent; border: 0; padding: 0; cursor: pointer;
  color: var(--gold); font-weight: 650; font-size: 13px; text-decoration: underline dotted;
}
.ts-foot { margin: 10px 0 0; }
.ts-detail-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.ts-route-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.ts-route-head input {
  flex: 1; background: #0d131e; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 12px; outline: none;
}
.ts-route-head input:focus { border-color: var(--gold); }
.ts-route-box {
  max-height: 380px; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  background: #0d131e;
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
}
.ts-cidr {
  font-size: 12px; color: #d7deea;
  background: #182132; border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 8px;
}
.ts-more { width: 100%; padding: 6px 2px 2px; }
.ts-warn { color: var(--wait); }

@media (max-width: 900px) {
  .host-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bench-top { grid-template-columns: 1fr; }
  .bench-img { max-width: 240px; }
  .ts-side { display: none; }

  /* 八列表格在手机上只能左右拖，换成一台一张卡 */
  .ts-table-wrap { display: none; }
  .ts-list { display: flex; }

  .ts-hosts { grid-template-columns: 1fr; }
  .ts-nic-rate { font-size: 16px; }

  .ts-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ts-stat { padding: 12px; }
  .ts-stat b { font-size: 17px; }
  /* 实时流量是最想盯的，手机上占满一行 */
  .ts-stat-live { grid-column: 1 / -1; }
  .ts-stat-live b { font-size: 22px; }

  .top-actions { width: 100%; justify-content: space-between; align-items: center; }
  .ts-auto { flex: 0 0 auto; }

  .ts-route-head { flex-wrap: wrap; }
  .ts-route-head input { flex: 1 1 100%; font-size: 16px; }
  .ts-route-box { max-height: 260px; padding: 8px; }
  .ts-cidr { font-size: 11px; padding: 2px 6px; }
  .ts-detail-btns button { flex: 1; }
  .ts-foot { display: none; }
}

/* 老 iPhone SE 那种 320 宽的，统计卡才堆成一列 */
@media (max-width: 340px) {
  .ts-cards { grid-template-columns: 1fr; }
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #223049; color: var(--text); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 999px; z-index: 20;
}

body:not(.in-app) .mobile-bar { display: none !important; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); align-content: start; }

  /* 侧栏压成一条顶栏：左边招牌，右边加号和退出，账号在第二行横滑 */
  .rail {
    position: sticky; top: 0; z-index: 5;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: calc(9px + env(safe-area-inset-top, 0px)) 12px 9px;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px;
  }
  .brand { flex: 1; min-width: 0; gap: 8px; }
  .mark { width: 32px; height: 32px; border-radius: 11px; font-size: 15px; }
  .brand strong { font-size: 16px; }
  .brand em { display: none; }
  /* 四个入口交给底栏，顶上不再重复一排 */
  .page-nav { display: none; }
  .add-acc, .rail-foot button {
    flex: none; width: auto;
    padding: 8px 12px; font-size: 13px; border-radius: 11px;
  }
  .acc-list {
    /* order 放最后，招牌／加号／退出才留在同一行 */
    order: 1; flex: 1 0 100%;
    flex-direction: row; gap: 6px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .acc-list::-webkit-scrollbar { display: none; }
  .acc-item {
    flex: none; min-width: 0; white-space: nowrap;
    background: #131b28; border-color: var(--line);
    border-radius: 999px; padding: 7px 13px;
  }
  .acc-item b { display: inline; font-size: 13px; }
  .acc-item small { font-size: 11px; margin-left: 6px; }
  .acc-item.active { background: var(--gold); border-color: var(--gold); color: #1a1408; }
  .acc-item.active small { color: rgba(26, 20, 8, 0.75); }

  .wide-only { display: none; }

  .main { padding: 14px 12px calc(80px + env(safe-area-inset-bottom, 0px)); }
  .top { flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .top h2 { font-size: 22px; }
  /* 顶上账号条已经说清楚了，这句说明手机上就别占一行 */
  #acc-sub { display: none; }
  .top .top-actions { width: auto; justify-content: flex-start; }
  .top .top-actions button { flex: 0 0 auto; padding: 9px 16px; font-size: 13px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .group-grid { grid-template-columns: minmax(0, 1fr); }
  .group .save { width: 100%; }
  .card { padding: 14px; border-radius: 16px; }
  /* 标题和按钮别在一行里挤，按钮整排放到下面一行 */
  .groups-head { flex-wrap: wrap; row-gap: 10px; }
  .groups-head .row-btns { flex: 1 0 100%; }
  .seg button { font-size: 12.5px; padding: 9px 4px; }
  .role button, .skill { padding: 7px 12px; font-size: 12.5px; }

  /* 七列表格在手机上只能左右拖，换成一个模型一张卡 */
  .bench-table-wrap { max-height: none; border: 0; border-radius: 0; overflow: visible; }
  .bench-table, .bench-table tbody, .bench-table tr, .bench-table td { display: block; width: 100%; }
  .bench-table thead { display: none; }
  .bench-table tr {
    display: flex; flex-direction: column;
    border: 1px solid var(--line); border-radius: 14px;
    background: #0d131e; padding: 10px 12px; margin-bottom: 10px;
  }
  .bench-table td {
    display: flex; justify-content: space-between; gap: 12px;
    border: 0; padding: 3px 0; white-space: normal; word-break: break-all;
    text-align: right;
  }
  .bench-table td::before {
    content: attr(data-label);
    color: var(--muted); flex: none; text-align: left;
  }
  .bench-table td.wrap { max-width: none; }
  .bench-table td.bench-model {
    order: -1; display: block; text-align: left;
    font-size: 14px; font-weight: 650; padding-bottom: 6px;
  }
  .bench-table td.bench-model::before { content: none; }

  .mobile-bar { display: flex !important; }
}

@media (max-width: 360px) {
  .login-card { padding: 28px 20px 22px; }
  .login-card h1 { font-size: 34px; }
  .add-acc { padding: 8px 10px; font-size: 12px; }
}

.mobile-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(18, 24, 38, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  gap: 6px; z-index: 8;
}
.mobile-bar > a,
.mobile-bar > button,
.mobile-bar > .nav-fold > summary {
  flex: 1; min-width: 0;
  text-align: center; text-decoration: none; white-space: nowrap;
  color: var(--muted) !important;
  background: transparent !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px;
  padding: 10px 4px !important;
  font-size: 13px; font-weight: 650;
  cursor: pointer;
}
.mobile-bar > .nav-fold {
  flex: 1;
  min-width: 0;
  position: relative;
}
.mobile-bar > .nav-fold > summary {
  flex: none;
  width: 100%;
  display: block;
  list-style: none;
  user-select: none;
}
.mobile-bar > a.on,
.mobile-bar > .nav-fold.on > summary {
  color: #1a1408 !important;
  background: var(--gold) !important;
  border-color: var(--gold) !important;
}
.mobile-bar .nav-sub {
  top: auto;
  left: auto;
  right: 0;
  width: max-content;
  max-width: min(220px, 70vw);
  bottom: calc(100% + 8px);
}

/* 底栏别再用 position:fixed。手机一滚动，系统会把钉死的栏顶到屏幕中间。 */
@media (max-width: 900px) {
  body.in-app:not(.chat-page) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: 100svh;
    overflow: hidden;
  }
  body.in-app:not(.chat-page) .app {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
  body.in-app:not(.chat-page) .rail {
    position: relative;
    top: auto;
    flex: none;
  }
  body.in-app:not(.chat-page) .main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
  }
  body.in-app:not(.chat-page) .mobile-bar {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    flex: none;
  }
}

.chat-app {
  height: 100dvh;
  height: var(--app-h, 100dvh);
  min-height: 0;
  overflow: hidden;
}
.chat-app .main, .chat-main {
  max-width: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.chat-side { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.chat-side label { margin: 0; }
.chat-top {
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.chat-back { display: none; }
.chat-top-copy { min-width: 0; }
.chat-top h2 { margin: 0 0 4px; font-size: 24px; }
.chat-top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-top-actions select {
  min-width: 220px;
  background: #0d131e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
}
.process {
  background: #0d131e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  max-height: 180px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.proc { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.proc.tool { color: var(--gold); }
.proc.result { color: var(--good); }
.proc.think { color: #9aa7c2; }
.proc.event { color: var(--muted); }
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-log.drop { outline: 2px dashed var(--gold); outline-offset: -8px; }
.chat-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  max-width: 360px;
  line-height: 1.7;
}
.bubble {
  max-width: min(720px, 92%);
  background: #161d2b;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.bubble.user {
  align-self: flex-end;
  background: linear-gradient(180deg, #243044, #1b2638);
}
.bubble.assistant { align-self: flex-start; }
.bubble header {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--gold);
  font-size: 12px;
  margin-bottom: 6px;
}
.bubble-text { line-height: 1.65; word-break: break-word; overflow-wrap: anywhere; }
.bubble-text pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  background: #0d131e;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}
.bubble-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.bubble-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.file-thumb { max-width: 100%; }
.file-thumb img { max-width: min(220px, 100%); max-height: 160px; border-radius: 12px; display: block; }
.file-video { max-width: min(280px, 100%); border-radius: 12px; }
.bubble-files audio { max-width: 100%; }
.file-chip, .pend-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
  background: #0d131e;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}
.chat-err { color: var(--bad); font-size: 13px; margin-top: 8px; }
.typing {
  color: var(--wait);
  font-size: 12px;
}
.typing::after { content: "…"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.chat-form {
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(12, 16, 24, 0.88);
  backdrop-filter: blur(16px);
}
.chat-attach { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  font-size: 16px;
  line-height: 1.45;
  min-height: 46px;
  max-height: 160px;
  background: #0d131e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
.chat-input-row textarea:focus { border-color: var(--gold); }
.icon-btn { width: 46px !important; min-width: 46px; padding: 12px 0 !important; }
.chat-input-row #btn-send { width: auto !important; padding: 12px 20px; }
body.chat-page .mobile-bar { display: none !important; }

/* 手机竖屏，以及横过来高度不够的大屏手机，都走紧凑聊天页 */
@media (max-width: 900px), (hover: none) and (max-height: 560px) {
  html.chat-page, body.chat-page {
    overflow: hidden;
    overscroll-behavior: none;
    width: 100%;
    max-width: 100%;
    height: var(--app-h, 100dvh);
    touch-action: manipulation;
  }
  .chat-app {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    grid-template-rows: unset;
    position: fixed;
    top: var(--app-t, 0px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: var(--app-h, 100dvh);
  }
  .chat-app .rail { display: none !important; }
  .chat-main {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: auto;
  }

  .chat-top {
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 8px;
  }
  .chat-top-copy { display: none; }
  .chat-back {
    display: inline-flex;
    align-items: center;
    flex: none;
    color: var(--gold);
    text-decoration: none;
    font-weight: 650;
    font-size: 14px;
    padding: 8px 2px 8px 0;
    white-space: nowrap;
  }
  .chat-back::before { content: "‹ "; font-size: 18px; line-height: 1; }
  .chat-top-actions {
    flex: 1;
    min-width: 0;
    width: auto;
    gap: 6px;
    flex-wrap: nowrap;
  }
  /* iOS 上表单字号小于 16px 会自动放大整页，所以这里不能省 */
  .chat-top-actions select {
    min-width: 0;
    flex: 1;
    max-width: 100%;
    padding: 9px 8px;
    font-size: 16px;
  }
  .chat-top-actions #btn-new {
    flex: none;
    white-space: nowrap;
    padding: 9px 10px;
    font-size: 14px;
  }

  .chat-log { padding: 10px 12px 8px; gap: 10px; }
  .bubble { max-width: 92%; padding: 10px 12px; }
  .process { max-height: 28vh; font-size: 11.5px; }
  .chat-empty { max-width: 100%; padding: 0 16px; }

  .chat-form {
    flex: none;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .chat-input-row { gap: 6px; }
  .chat-input-row textarea { max-height: 28vh; }
  .icon-btn { width: 44px !important; min-width: 44px; }
  .chat-input-row #btn-send { padding: 12px 14px; white-space: nowrap; }

  body.chat-page .toast {
    bottom: auto;
    top: calc(10px + var(--app-t, 0px) + env(safe-area-inset-top, 0px));
    max-width: calc(100vw - 24px);
    text-align: center;
  }

  /* 键盘起来：顶栏先收掉，输入条贴在键盘上沿 */
  body.kb-open .chat-top { display: none; }
  body.kb-open .chat-form { padding-bottom: 8px; }
}

/* 国内分流主备：谁在扛那批国内路由 */
#moon-card { margin-top: 16px; }
.moon-peers { display: flex; flex-wrap: wrap; gap: 6px; }
.moon-peer {
  font-size: 12px; line-height: 1.4;
  background: #161d2b; border-radius: 8px; padding: 4px 8px;
  color: var(--text);
}
.moon-peer.off { opacity: .55; }
.moon-peer b { font-weight: 650; margin-right: 4px; }

.cn-intro { margin: 0 0 10px; line-height: 1.7; }
.cn-pair {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
/* 国内只剩广州一台，卡片别拉成整行宽 */
.cn-pair.cn-single { grid-template-columns: minmax(240px, 420px); }
.cn-node {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; background: #0d131e;
  display: flex; flex-direction: column; gap: 7px;
}
.cn-node.on { border-color: rgba(94,224,168,.55); background: #0e1720; }
.cn-node.ts-off { opacity: .55; }
.cn-node-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cn-node-top b { font-size: 15px; }
.cn-node-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.cn-node-route {
  font-size: 14px; padding: 8px 10px; border-radius: 10px; background: #161d2b;
  font-variant-numeric: tabular-nums;
}
.cn-node-note { line-height: 1.5; }
.cn-btns { margin-top: 12px; }
.cn-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.cn-msg { margin: 10px 0 0; line-height: 1.6; }
.cn-events { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.cn-ev { font-size: 12px; line-height: 1.6; color: var(--muted); }
.cn-ev.switch, .cn-ev.up { color: var(--text); }
.cn-ev.reject { color: var(--bad); }

/* 跨境这一段：自动 / 强制走 v6 DERP */
.derp-now { margin-bottom: 12px; }
.derp-rows { display: flex; flex-direction: column; gap: 12px; }
.derp-row {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; background: #0d131e;
  display: flex; flex-direction: column; gap: 9px;
}
.derp-name { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.derp-name .muted { font-weight: 400; }
.derp-line {
  font-size: 15px; padding: 10px 12px; border-radius: 10px; background: #161d2b;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
  font-variant-numeric: tabular-nums;
}
.derp-warn { margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--bad); }
.derp-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.derp-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-align: left; padding: 12px 14px; border-radius: 12px;
  background: #161d2b; border: 1px solid #263148; color: var(--text); cursor: pointer;
}
.derp-opt b { font-size: 15px; }
.derp-opt small { font-size: 12px; line-height: 1.5; color: var(--muted); font-weight: 400; }
.derp-opt.on { border-color: var(--gold); background: #1d2333; }
.derp-opt.on b { color: var(--gold); }
.derp-opt:disabled { opacity: .55; cursor: default; }
.derp-foot { margin: 10px 0 0; line-height: 1.7; }
@media (max-width: 620px) {
  .derp-pick { grid-template-columns: 1fr; }
}

.pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pick-card {
  background: #0d131e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.pick-card.skip { border-style: dashed; }
.pick-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pick-top b { font-size: 15px; }
.pick-addr {
  margin: 4px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pick-card p { margin: 4px 0 8px; line-height: 1.55; }
.pick-card .ghost { width: auto; }
.pick-k {
  margin: 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 650;
}
.leader-box { margin-top: 4px; }
.leader-box[hidden] { display: none; }
.leader-row {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.6fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}
.leader-row label { margin-bottom: 0; }
.leader-row .ghost { padding: 12px 10px; white-space: nowrap; }
#leader-add { margin-top: 8px; width: auto; }
.copy-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 12px;
  margin-top: 8px;
}
.copy-form.cols-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.copy-form.cols-5 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.copy-form[hidden], #form-copy[hidden], #form-solo[hidden], .knife-grid[hidden], .exit-box[hidden] { display: none; }
.exit-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.card .exit-pick input[type="radio"] { width: auto; padding: 0; margin: 0; accent-color: var(--gold); }
.form-kicker {
  margin: 16px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 650;
}
.knife-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.knife {
  min-width: 0;
  background: #0d131e;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px 0;
}
.knife > span {
  display: block;
  font-size: 12px;
  color: var(--gold);
  font-weight: 650;
}
.knife label { margin-bottom: 8px; }
.solo-skip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 2px 0 0;
}
.card .solo-skip input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0;
  accent-color: var(--gold);
}
#solo-rules { margin: 4px 0 0; }
.key-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
}
.key-row label { flex: 1; margin-bottom: 0; }
.key-row button { width: auto; margin-bottom: 14px; }
.copy-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 4px 0 8px;
}
#copy-stats, #arb-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#arb-card { margin-top: 8px; }
.copy-switches { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.copy-open-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.coin-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.coin-text { min-width: 0; text-align: left; }
.add-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  border-radius: 4px;
  background: var(--gold, #e0b15a);
  color: #1a1408;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
}
.coin-icon {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none;
  background: #1b2433; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.copy-open-row:last-child { border-bottom: 0; }
.pnl-up { color: #137a45; font-weight: 650; }
.pnl-down { color: #b42318; font-weight: 650; }
.host-stat b, .host-stat small { overflow-wrap: anywhere; }
.copy-run { margin: 10px 0 6px; max-width: 480px; }
.copy-run button.on { box-shadow: none; }
#copy-settings { margin-top: 8px; }
.solo-hit { align-items: flex-start; }
.solo-hit .hit-no { color: var(--bad); }
#copy-start.on {
  background: linear-gradient(180deg, #8ff0c8, #5ee0a8);
  color: #082016;
  box-shadow: none;
}
.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 12px;
}
.pay-card {
  background: #121926;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 0;
}
.pay-card.ok { border-color: rgba(94, 224, 168, .4); }
.pay-card.wait { border-color: rgba(231, 193, 90, .5); }
.pay-card.bad { border-color: rgba(255, 128, 128, .5); }
.pay-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.pay-head h3 { margin: 0; font-size: 15px; }
.pay-head .plan { display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-top: 2px; }
.pay-headline { margin: 8px 0 0; font-size: 13px; line-height: 1.45; }
.pay-card.ok .pay-headline { color: var(--good); }
.pay-card.wait .pay-headline { color: var(--wait); }
.pay-card.bad .pay-headline { color: var(--bad); }
.pay-lines { margin-top: 8px; display: grid; gap: 4px; }
.pay-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  line-height: 1.45;
}
.pay-line span { color: var(--muted); flex: 0 0 auto; }
.pay-line b { font-weight: 550; text-align: right; overflow-wrap: anywhere; }
.bench-table.solo .copy-only { display: none; }
@media (max-width: 800px) {
  .copy-form, .copy-form.cols-4, .copy-form.cols-5 { grid-template-columns: 1fr 1fr; }
  .knife-grid { grid-template-columns: 1fr 1fr; }
  .leader-row { grid-template-columns: 1fr; }
  .pay-grid { grid-template-columns: 1fr; }
  .key-row { flex-direction: column; align-items: stretch; }
  .key-row button { width: 100%; margin-bottom: 0; }
}

.num-up { color: var(--good); font-variant-numeric: tabular-nums; }
.num-down { color: var(--bad); font-variant-numeric: tabular-nums; }

/* 底栏四个：帐台、欧易、聊天、工具。文件那些在工具里，字不用再挤小。 */

/* 欧易页手机上不要把几百只币摊成一长页 */
.okx-tabs { display: none; }
.okx-board-tools { display: none; }
@media (max-width: 900px) {
  .okx-page #okx-sub { display: none; }
  .okx-page .host-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .okx-page .host-stat { padding: 8px 6px; }
  .okx-page .host-stat b, .okx-page .host-stat.hot b { font-size: 14px; }
  .okx-page .host-stat small { display: none; }
  .okx-page .copy-run { max-width: none; flex-wrap: wrap; }
  .okx-page .copy-run button { flex: 1 1 42%; }
  .okx-tabs {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 6;
    margin: 8px 0 10px;
    background: rgba(12, 16, 24, 0.94);
  }
  .okx-page .okx-pane { display: none; }
  .okx-page.tab-home .okx-pane[data-pane="home"],
  .okx-page.tab-board .okx-pane[data-pane="board"],
  .okx-page.tab-pos .okx-pane[data-pane="pos"],
  .okx-page.tab-set .okx-pane[data-pane="set"] { display: block; }
  .okx-board-tools { display: flex; margin: 0 0 8px; }
  .okx-board-tools button { flex: 0 0 auto; padding: 8px 14px; }
  .okx-page .bench-table-wrap {
    max-height: calc(100dvh - 380px);
    min-height: 220px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
  }
  .okx-page .bench-table { display: table; width: 100%; font-size: 13px; }
  .okx-page .bench-table thead { display: table-header-group; }
  .okx-page .bench-table tbody { display: table-row-group; }
  .okx-page .bench-table tr {
    display: table-row;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    margin: 0;
  }
  .okx-page .bench-table th,
  .okx-page .bench-table td {
    display: table-cell;
    width: auto;
    padding: 7px 8px;
    text-align: left;
    white-space: nowrap;
    word-break: normal;
    border-bottom: 1px solid var(--line);
  }
  .okx-page .bench-table td::before { content: none; }
  .okx-page .bench-table .ph { display: none; }
}
