@font-face { font-family: Poppins; src: url(fonts/Poppins-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Poppins; src: url(fonts/Poppins-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: Poppins; src: url(fonts/Poppins-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Lora; src: url(fonts/Lora-400.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }

/* Windows 的系统 emoji 字体没有国旗字形，会把 🇺🇸 渲染成 "US"。
   这个字体只接管区域指示符（unicode-range 限定），其它 emoji 不受影响。
   字体来源：country-flag-emoji-polyfill（MIT），底层图形来自 Twemoji（CC-BY 4.0）。 */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url(fonts/TwemojiCountryFlags.woff2) format("woff2");
  font-display: swap;
  unicode-range: U+1F1E6-1F1FF;
}

:root {
  --paper: #faf9f5; --ink: #141413; --mid: #b0aea5;
  --line: #e8e6dc; --line-strong: #d1cfc5;
  --orange: #d97757; --blue: #6a9bcc; --green: #788c5d;

  --bg: var(--paper); --fg: var(--ink);
  --surface: #f5f4ed; --border: var(--line); --muted: #87867f;

  --sans: Poppins, "PingFang SC", "Microsoft YaHei", Arial, "Twemoji Country Flags", sans-serif;
  --serif: Lora, "Songti SC", "Noto Serif SC", Georgia, "Twemoji Country Flags", serif;

  color-scheme: light;
}
/* 跟随系统；带 data-theme 时以下面两条为准（手动切换覆盖） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg:#141413; --fg:#faf9f5; --surface:#1d1c1b; --border:#33322f; --muted:#a5a29a;
    --line:#2a2927; --line-strong:#3d3c38; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg:#141413; --fg:#faf9f5; --surface:#1d1c1b; --border:#33322f; --muted:#a5a29a;
  --line:#2a2927; --line-strong:#3d3c38; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--serif); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .sans { font-family: var(--sans); font-weight: 600; letter-spacing: -0.015em; margin: 0; }
a { color: var(--orange); text-decoration: none; }
label { font-family: var(--sans); font-weight: 500; font-size: 13px; display: block; margin-bottom: 8px; }
input, select, button { font-family: inherit; }

.login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 880px) { .login { grid-template-columns: 1fr; } }
.login-left { padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 44px; }
.login-left .mark { font-family: var(--sans); font-weight: 600; font-size: 16px; }
.login-right { border-left: 1px solid var(--border); display: grid; place-items: center; padding: 48px; }
@media (max-width: 880px) { .login-right { border-left: 0; border-top: 1px solid var(--border); } }
.login-form { width: 100%; max-width: 320px; }
.login-form h1 { font-size: 26px; margin-bottom: 32px; }

.nodes { list-style: none; margin: 0; padding: 0; max-width: 400px; width: 100%; }
.nodes li { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-top: 1px solid var(--border); }
.nodes li:last-child { border-bottom: 1px solid var(--border); }
.nodes .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.nodes .city { font-family: var(--sans); font-weight: 500; font-size: 17px; }
.nodes .mult { margin-left: auto; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nodes li.on .mult { color: var(--c); }

.field { margin-bottom: 20px; }
.field input, .field select {
  width: 100%; font-family: var(--serif); font-size: 15px; color: var(--fg);
  background: transparent; border: 0; border-bottom: 1px solid var(--line-strong);
  padding: 8px 0; outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--orange); }
.field input::placeholder { color: var(--mid); }
.field select { appearance: none; }
.field option { background: var(--bg); color: var(--fg); }

.btn { font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer;
  border-radius: 8px; padding: 10px 16px; border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s; }
.btn-fill { background: var(--fg); color: var(--bg); }
.btn-fill:hover { background: var(--orange); color: #fff; }
.btn-wide { width: 100%; }
.btn-line { background: transparent; border-color: var(--line-strong); color: var(--fg); }
.btn-line:hover { border-color: var(--orange); color: var(--orange); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-danger { color: var(--orange); }

.shell { max-width: 880px; margin: 0 auto; padding: 0 28px 96px; }
.shell-wide { max-width: 1080px; }
.top { display: flex; align-items: baseline; justify-content: space-between;
  padding: 28px 0 20px; border-bottom: 1px solid var(--border); }
.top .mark { font-family: var(--sans); font-weight: 600; font-size: 16px; }
.top .who { display: flex; gap: 16px; align-items: baseline; font-family: var(--sans); font-size: 14px; color: var(--muted); }
.top .who b { font-weight: 500; color: var(--fg); }

.big { font-size: 44px; margin: 52px 0 0; font-variant-numeric: tabular-nums; cursor: pointer; user-select: none; }
.big:hover { opacity: .75; }
.meta-line { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 10px;
  font-family: var(--sans); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.split { display: flex; gap: 3px; height: 10px; margin-top: 32px; border-radius: 3px; overflow: hidden; background: var(--line); }
.split span { display: block; height: 100%; }

.stations { display: flex; gap: 8px; margin-top: 36px; }
.stations > div { flex: 1; min-width: 0; }
.stations .city { font-family: var(--sans); font-weight: 500; font-size: 15px; }
.stations .mult { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stations .use { font-family: var(--sans); font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stations .warn { color: var(--orange); }

h2 { display: flex; align-items: baseline; gap: 10px; font-size: 17px; margin: 52px 0 14px; }

/* 订阅卡：链接一行、三个动作一行 */
.subcard { border: 1px solid var(--border); border-radius: 10px; padding: 16px 16px 14px; margin-top: 16px; }
.subcard input { width: 100%; border: 0; background: transparent; padding: 0 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  color: var(--muted); letter-spacing: -.01em; text-overflow: ellipsis; outline: none; }
.subacts { display: flex; gap: 8px; flex-wrap: wrap; }
.subacts .btn { white-space: nowrap; }

/* 用量提醒横幅（浅底 + 小标签） */
.banner { display: flex; align-items: center; gap: 11px; padding: 12px 14px;
  margin: 0 0 28px; border-radius: 10px; background: var(--surface);
  font-family: var(--sans); font-size: 13px; line-height: 1.5; }
.banner .tag { flex: none; font-size: 10.5px; letter-spacing: .07em; color: var(--orange);
  border: 1px solid rgba(217, 119, 87, .35); border-radius: 4px; padding: 2px 6px; }
.banner b { color: var(--orange); font-weight: 600; }
.banner .muted { color: var(--muted); }
.banner .x { margin-left: auto; flex: none; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 14px; line-height: 1; padding: 4px; }
.banner .x:hover { color: var(--fg); }

/* ---------- 头部：主数字 + 预测 ---------- */
.hero { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero .big { margin: 34px 0 0; }
.hero .forecast { margin: 0; }
.meta-line { margin-top: 14px; }

/* ---------- 节点明细（同时充当图例） ---------- */
.nodes4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 22px; }
.nodes4 .n { display: flex; flex-direction: column; gap: 7px; }
.nodes4 .nhead { display: flex; align-items: center; justify-content: flex-start; gap: 7px;
  font-family: var(--sans); font-size: 12.5px; }
.nodes4 .nhead i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.nodes4 .val { display: flex; align-items: baseline; gap: 8px; }
.nodes4 .val b { font-family: var(--serif); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.nodes4 .val span { font-family: var(--sans); font-size: 11px; color: var(--muted); }

/* ---------- 章节标题 + 行内统计 ---------- */
h2.row { justify-content: space-between; gap: 20px; }
.inline-stats { display: flex; gap: 16px; font-family: var(--sans); font-size: 11px; color: var(--muted); }
.inline-stats b { font-family: var(--serif); font-size: 13px; font-weight: 500; color: var(--fg); margin-left: 4px; }
/* 30 天用量柱状 */
.usage { margin-top: 18px; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 88px;
  border-bottom: 1px solid var(--border); padding-bottom: 1px; margin-top: 16px; }
.bars i { flex: 1; min-width: 3px; background: var(--orange); border-radius: 2px 2px 0 0; }
.bars i.z { background: var(--line); }
.axis { display: flex; justify-content: space-between; margin-top: 8px;
  font-family: var(--sans); font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.stats { display: flex; margin-top: 24px; font-family: var(--sans); }
.stats div { position: relative; padding-left: 30px; margin-left: 30px; }
.stats div:first-child { padding-left: 0; margin-left: 0; }
.stats div + div::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 1px; background: var(--border); }
.stats b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 500;
  line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stats span { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted); letter-spacing: .05em; }

/* 预测行 */
.forecast { font-family: var(--serif); font-size: 13.5px; color: var(--muted); margin: 13px 0 0; }
.forecast b { color: var(--fg); font-weight: 500; }

h2 .sub { font-family: var(--sans); font-size: 11.5px; font-weight: 400; color: var(--muted); margin-left: 8px; }

/* 二维码浮层 */
.qr-modal { position: fixed; inset: 0; background: rgba(20, 20, 19, .48); display: none;
  align-items: center; justify-content: center; padding: 24px; z-index: 100; }
.qr-modal.show { display: flex; }
.qr-panel { background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 30px 26px 26px; text-align: center; max-width: 314px; width: 100%; }
.qr-panel h3 { font-family: var(--sans); font-size: 15px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
.qr-panel p { font-family: var(--serif); font-size: 12.5px; color: var(--muted); margin: 0 0 20px; }
.qr-panel .qr { width: 208px; height: 208px; margin: 0 auto; color: var(--fg); }
.qr-panel .qr svg { width: 100%; height: 100%; display: block; }
.qr-panel .btn { margin-top: 22px; width: 100%; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { font-family: var(--sans); font-weight: 500; font-size: 12px; color: var(--muted);
  text-align: left; padding: 0 28px 10px 0; white-space: nowrap; }
th:last-child, td:last-child { padding-right: 0; white-space: nowrap; }
th.n, td.n { text-align: right; }
td { padding: 13px 28px 13px 0; border-top: 1px solid var(--border); font-size: 15px;
  vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 1px solid var(--border); }
td .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

.tabs { display: flex; gap: 22px; margin: 34px 0 6px; border-bottom: 1px solid var(--border); }
.tabs button { font-family: var(--sans); font-size: 14px; background: none; border: 0;
  color: var(--muted); padding: 0 0 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--orange); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 16px; }
.toolbar h2 { margin: 0; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.warn { color: var(--orange); }
.hint { font-size: 13px; color: var(--muted); font-family: var(--sans); }

.modal-mask { position: fixed; inset: 0; background: rgba(20,20,19,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; }
.modal h3 { font-family: var(--sans); font-size: 18px; margin: 0 0 22px; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.check { display: flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 14px; }
.check input { width: auto; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); font-family: var(--sans); font-size: 13px;
  padding: 10px 18px; border-radius: 8px; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .2s; }
.toast.show { opacity: 1; }
tr.sel td { color: var(--orange); }
tr.sel td:first-child { font-weight: 500; }
tr.sel td:first-child::before { content: "● "; font-size: 9px; vertical-align: middle; }
tr.off td:not(:last-child) { color: var(--muted); text-decoration: line-through; }

td input[type="number"] { width: 74px; text-align: right; font-family: var(--serif); font-size: 15px;
  color: var(--fg); background: transparent; border: 0; border-bottom: 1px solid transparent;
  padding: 3px 0; outline: none; font-variant-numeric: tabular-nums; transition: border-color .15s; }
/* 只在悬停整行或聚焦时才显示输入框底线，平时保持干净的表格 */
tbody tr:hover td input[type="number"],
td input[type="number"]:focus { border-bottom-color: var(--line-strong); }
td input[type="number"]:focus { border-color: var(--orange); }

.prefs { display: flex; gap: 26px; margin-top: 22px; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.prefs label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; }
.prefs select { font-family: var(--sans); font-size: 13px; color: var(--fg); background: transparent;
  border: 0; border-bottom: 1px solid var(--line-strong); padding: 3px 2px; outline: none; cursor: pointer; }
.prefs select:focus { border-color: var(--orange); }

/* ---------- 移动端适配 ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { padding: 0 16px 64px; }

  .nodes4 { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  h2.row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .inline-stats { gap: 14px; }
  .bars { gap: 3px; height: 56px; }
  .subacts .btn { flex: 1; }
  .banner { font-size: 12.5px; gap: 8px; }

  .top { flex-wrap: wrap; gap: 8px 14px; padding: 20px 0 14px; }
  .top .who { gap: 12px; font-size: 13px; }

  .big { font-size: 34px; margin-top: 32px; }
  .meta-line { gap: 8px 18px; font-size: 12px; }

  .prefs { gap: 18px; margin-top: 18px; }
  .prefs label { font-size: 12px; }

  .split { margin-top: 24px; }

  .stations { flex-wrap: wrap; gap: 14px 12px; margin-top: 26px; }
  .stations > div { flex: 1 1 44%; min-width: 44%; }

  h2 { margin: 36px 0 12px; font-size: 16px; }

  /* 表格在窄屏内部横向滚动，不再撑破页面 */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  th, td { padding-right: 14px; }
  td { white-space: normal; font-size: 14px; }
  td .actions { justify-content: flex-end; }
  td:last-child, th:last-child { padding-right: 0; }

  /* 管理端表格列多：保持单行、内部横向滑动，避免「永 / 久」这种断字 */
  #tab-users th, #tab-users td,
  #tab-nodes th, #tab-nodes td,
  #tab-relays th, #tab-relays td,
  #tab-online th, #tab-online td { white-space: nowrap; }
  #tab-users td, #tab-nodes td, #tab-relays td, #tab-online td { font-size: 13px; padding: 11px 14px 11px 0; }
  #tab-users .btn-sm, #tab-nodes .btn-sm, #tab-relays .btn-sm { padding: 6px 9px; font-size: 12px; }
  #tab-users td .actions, #tab-relays td .actions { gap: 4px; }
  #tab-users th:last-child, #tab-users td:last-child { padding-right: 4px; }

  .tabs { gap: 16px; overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .toolbar { flex-wrap: wrap; gap: 10px; align-items: center; }

  .modal { padding: 22px; }
  .login { min-height: auto; }
  /* 手机上先给登录框，节点列表放后面，不用先滚过一屏 */
  .login-right { order: -1; border-top: 0; border-bottom: 1px solid var(--border); padding: 36px 24px; }
  .login-left { padding: 28px 24px 48px; gap: 24px; }
  .login-left .mark { font-size: 15px; }
  .nodes { max-width: none; }
  .nodes li { padding: 14px 0; gap: 12px; }
  .login-form { max-width: none; }
  .login-form h1 { font-size: 22px; margin-bottom: 24px; }
  .nodes .city { font-size: 16px; }
}

/* ---------- 登录页品牌图形 ---------- */
.brand { display: flex; flex-direction: column; gap: 14px; }
.brand-mark { width: 176px; height: 176px; display: block; }
.brand-mark .ring { fill: none; stroke: var(--fg); stroke-width: 30; }
.brand-mark .arc {
  fill: none; stroke: var(--orange); stroke-width: 30;
  transform-origin: 256px 256px;
  animation: brand-spin 16s linear infinite;
}
@keyframes brand-spin { to { transform: rotate(360deg); } }
.brand-word { font-family: var(--sans); font-weight: 600; font-size: 26px; letter-spacing: -.01em; }
.brand-sub { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.login-left { gap: 34px; }

@media (max-width: 760px) {
  .brand { gap: 10px; }
  .brand-mark { width: 116px; height: 116px; }
  .brand-word { font-size: 21px; }
  .login-left { gap: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark .arc { animation: none; }
}

/* ---------- 细节打磨 ---------- */
/* 主题切换按钮（登录页浮在右上角） */
.theme-fab { position: fixed; top: 18px; right: 18px; z-index: 30; font-size: 15px; line-height: 1;
  background: var(--bg); }

/* 用量条图例 */
.bar-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px;
  font-family: var(--sans); font-size: 12px; color: var(--muted); }
.bar-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.bar-legend .lg i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.bar-legend .lg b { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--fg); opacity: .75; }

/* 复制按钮的完成态 */
.btn.done { border-color: var(--green); color: var(--green); }

/* 空状态 */
.empty-row td { padding: 40px 0 !important; border-top: 1px solid var(--border); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted); }
.empty-title { font-family: var(--sans); font-size: 14px; }
.empty-hint { font-family: var(--sans); font-size: 12px; opacity: .8; }

/* 开关（替代复选框） */
.switch { display: inline-flex; vertical-align: middle; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong);
  position: relative; display: block; transition: background .18s ease; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .18s ease; box-shadow: 0 1px 2px rgba(20, 20, 19, .28); }
.switch input:checked + .track { background: var(--orange); }
.switch input:checked + .track .knob { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--orange); outline-offset: 2px; }
.switch:hover .track { filter: brightness(.95); }
.switch input:disabled + .track { opacity: .45; cursor: not-allowed; }

/* 复选框跟随主题色，别用浏览器默认蓝 */
input[type="checkbox"] { accent-color: var(--orange); cursor: pointer; }

/* 表格行悬停 */
tbody tr:hover td { background: var(--surface); }
tbody tr.sel:hover td { background: transparent; }

/* 键盘焦点可见 */
.btn:focus-visible, select:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px;
}
.hide { display: none !important; }

/* ---------- 账号 ---------- */
.acct { border: 1px solid var(--border); border-radius: 10px; margin-top: 16px; overflow: hidden; }
.acct .row { display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center;
  padding: 14px 16px; border-top: 1px solid var(--border); cursor: pointer;
  transition: background .12s; }
.acct .row:hover { background: var(--surface); }
.acct .row:first-child { border-top: 0; }
.acct .k { font-family: var(--sans); font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.acct .v { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct .v.dim { color: var(--muted); letter-spacing: .12em; }
.acct .link { background: none; border: 0; padding: 2px 0; cursor: pointer;
  font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.acct .link:hover { color: var(--orange); }
.acct .link:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 3px; }

/* ---------- 服务器余量 ---------- */
.caps { margin-top: 12px; }
.cap { display: grid; grid-template-columns: 1fr 150px 44px 108px; align-items: center; gap: 14px;
  padding: 11px 0; border-top: 1px solid var(--border); }
.cap:first-child { border-top: 0; }
.cname { font-family: var(--sans); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cname .prov { color: var(--muted); font-size: 11.5px; margin-left: 8px; }
.cbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: 3px; transition: width .3s; }
.cpct { font-family: var(--sans); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.cnum { font-family: var(--sans); font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cap-sum { margin-top: 10px; font-family: var(--sans); font-size: 11px; color: var(--muted); text-align: right; }
.cap-tip { margin: 12px 0 0; font-family: var(--serif); font-size: 13.5px; color: var(--orange); }
.cap-tip b { font-weight: 600; }

/* 窄屏：flex 换行，任何宽度都不会撑破页面 */
@media (max-width: 760px) {
  .cap { display: flex; flex-wrap: wrap; align-items: baseline;
    gap: 4px 10px; padding: 13px 0; }
  .cname { flex: 1 1 auto; min-width: 0; font-size: 13px; }
  .cname .prov { display: none; }
  .cpct { flex: 0 0 auto; font-size: 12px; }
  .cnum { flex: 0 0 auto; font-size: 11px; }
  .cbar { flex: 1 0 100%; order: 3; height: 5px; margin-top: 6px; }

  /* 中转表：手机上改成「入口 → 出口  倍率  开关」一行 */
  .relays thead { display: none; }
  .relays, .relays tbody { display: block; width: 100%; }
  /* 入口 / 箭头 / 出口 / 倍率 / 开关：五个元素等距分布，互不贴靠 */
  .relays tr { display: grid; grid-template-columns: minmax(0, auto) auto auto auto auto;
    justify-content: space-between; align-items: center; gap: 12px;
    padding: 13px 0; border-top: 1px solid var(--border); }
  .relays tr::before { content: "→"; color: var(--muted); grid-column: 2; grid-row: 1; }
  .relays td { display: block; padding: 0; border: 0; white-space: nowrap; }
  .relays td:nth-child(1) { grid-column: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .relays td:nth-child(2) { grid-column: 3; }
  .relays td:nth-child(3) { grid-column: 4; min-width: 30px; text-align: right; }
  .relays td:nth-child(4) { grid-column: 5; }
}

/* 用户可用节点勾选 */
.perms { display: flex; flex-wrap: wrap; gap: 9px 20px; margin-top: 8px; }
.perms .perm { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer;
  white-space: nowrap; flex: 0 0 auto; }
.perms .perm input[type="checkbox"] { width: auto; flex: none; margin: 0; padding: 0;
  border: 0; border-bottom: 0; background: none; }
.perms .perm i { font-style: normal; font-size: 11px; color: var(--muted); }

/* 极窄屏（≤400px）：按钮收紧、顶栏压缩，避免折行和挤压 */
.sm-only { display: none; }
@media (max-width: 400px) {
  .top { padding: 16px 0 12px; }
  .top .mark { font-size: 14px; }
  .top .who { gap: 8px; font-size: 12px; }
  .top .who .btn-sm { padding: 5px 8px; font-size: 12px; }

  .subacts { gap: 6px; }
  .subacts .btn { flex: 1 1 0; min-width: 0; padding: 8px 6px; font-size: 12px; }
  .lg-only { display: none; }
  .sm-only { display: inline; }

  .hero .forecast { font-size: 12px; }
  .meta-line { font-size: 11.5px; gap: 6px 14px; }
  h2 .sub { font-size: 10.5px; }
  .inline-stats { font-size: 10px; gap: 12px; }
  .inline-stats b { font-size: 12px; }
}

/* 管理端：窄屏下每行变成一张卡片，不再横向滑动 */
@media (max-width: 620px) {
  #adminView table.tbl { display: block; }
  #adminView table.tbl thead { display: none; }
  #adminView table.tbl tbody { display: block; }
  #adminView table.tbl tr { display: block; padding: 14px 0; border-top: 1px solid var(--border); }
  #adminView table.tbl tr:last-child { border-bottom: 1px solid var(--border); }
  #adminView table.tbl td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 4px 0; border: 0; font-size: 13.5px; white-space: nowrap; text-align: left;
  }
  #adminView table.tbl td::before {
    content: attr(data-label); font-family: var(--sans); font-size: 12px;
    color: var(--muted); flex: none;
  }
  /* 第一格当标题：用户名 / 节点名 / 入口 */
  #adminView table.tbl td:first-child { display: block; padding: 0 0 6px; font-size: 15px; }
  #adminView table.tbl td:first-child::before { display: none; }
  /* 最后一格是操作按钮 */
  #adminView table.tbl td:last-child { padding-top: 10px; }
  #adminView table.tbl td:last-child::before { display: none; }
  #adminView table.tbl td .actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  #adminView table.tbl tr.empty td { justify-content: center; color: var(--muted); }
  #adminView table.tbl tr.empty td::before { display: none; }

  /* 其它表格仍可横向滑动（备用） */
  table { scrollbar-width: thin; }
  table::-webkit-scrollbar { height: 4px; }
  table::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  table::-webkit-scrollbar-track { background: transparent; }
}

/* 登录页极窄屏：主题按钮不压住标题 */
@media (max-width: 520px) {
  .login-right { padding-top: 62px; }
  .theme-fab { top: 14px; right: 14px; padding: 4px 9px; font-size: 13px; }
}

/* 浏览器自动填充时不要出现深蓝底 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-text-fill-color: var(--fg);
  transition: background-color 9999s ease-out;
}

/* 后台用户列表：搜索框 */
.listbar { margin: 0 0 14px; }
.listbar input {
  width: 100%; box-sizing: border-box;
  font-family: var(--sans); font-size: 14px; color: var(--fg);
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; outline: none; transition: border-color .15s;
}
.listbar input::placeholder { color: var(--muted); }
.listbar input:focus { border-color: var(--orange); }

/* 手机端：用户卡片压成三行，一屏能看更多人 */
@media (max-width: 620px) {
  #tab-users table.tbl tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 14px; padding: 13px 0;
  }
  #tab-users table.tbl td { display: block; padding: 1px 0; font-size: 12.5px; line-height: 1.7; }
  #tab-users table.tbl td::before {
    content: attr(data-label) " "; color: var(--muted); font-size: 12px;
  }
  #tab-users table.tbl td:nth-child(1) {
    grid-row: 1; grid-column: 1; font-size: 15px; padding: 0 0 3px;
  }
  #tab-users table.tbl td:nth-child(1)::before { display: none; }
  #tab-users table.tbl td:nth-child(1) .hint { display: none; }
  #tab-users table.tbl td:nth-child(6) {
    grid-row: 1; grid-column: 2; text-align: right; padding: 0;
  }
  #tab-users table.tbl td:nth-child(6)::before { display: none; }
  #tab-users table.tbl td:nth-child(7) {
    grid-row: 4; grid-column: 1 / -1; padding-top: 9px;
  }
  #tab-users table.tbl td:nth-child(7)::before { display: none; }
  #tab-users table.tbl td .actions { justify-content: flex-start; gap: 8px; }
  #tab-users table.tbl tr.hide { display: none; }
}
