/* ===================================================================
   m-ui 设计系统
   令牌 → 基础 → 外壳 → 卡片 / 表格 → 控件 → 表单;后面是各页面自己的组件。
   原则:一种强调色;中性灰分三层(背景 / 面 / 次级面);数字用等宽数位(tabular-nums)而不是等宽字体,
   等宽字体只给地址、令牌、命令这类"要逐字看"的内容;控件统一 34px 高(手机 40px);状态靠柔和底色 + 文字色,不靠粗边框。
   =================================================================== */
:root {
  color-scheme: light;
  /* 中性色 */
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #f1f3f6;
  --text: #111827; --text-2: #374151; --muted: #6b7280; --faint: #9ca3af;
  --border: #e6e8ec; --border-strong: #d4d8de; --divider: #eef0f3;
  /* 强调色与状态色:-soft 是底色,-text 是放在底色上的文字色 */
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-soft: #eef4ff; --primary-text: #1d4ed8; --primary-ring: rgba(37, 99, 235, .18);
  --ok: #059669; --ok-soft: #e8f7f0; --ok-text: #047857;
  --warn: #d97706; --warn-soft: #fdf4e3; --warn-text: #b45309;
  --danger: #dc2626; --danger-soft: #fdeeee; --danger-text: #b91c1c;
  --info: #0891b2;
  /* 图表:下行用强调色,上行用同色系的浅色 */
  --chart-down: #2563eb; --chart-up: #93c5fd; --chart-grid: #eceef2;
  --nav-active: #eef1f5;
  --toast-bg: #111827; --toast-text: #f9fafb;
  --log-bg: #0d1117; --log-text: #c9d1d9;
  /* 形状与层次 */
  --radius: 12px; --radius-md: 10px; --radius-sm: 8px; --radius-xs: 6px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 6px -2px rgba(16, 24, 40, .05), 0 12px 24px -6px rgba(16, 24, 40, .12);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22), 0 4px 10px -4px rgba(16, 24, 40, .08);
  /* 字号:正文 14px,说明 13px,小字 12px */
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px;
  --ctl-h: 34px; --ctl-h-sm: 28px;
  /* 小数字框的宽度 = 要放下的位数 × 1ch + 这一截(左右内边距 .7rem×2、边框 2px、桌面浏览器数字框的上下箭头留 1.25rem),见 .ops-num */
  --num-x: calc(2.65rem + 2px);
  --sidebar-w: 204px;
  /* 内容区最宽:列表页随窗口放宽(fluid),表单类页面保持 1600 */
  --page-max: 1600px; --page-max-fluid: 2400px; --topbar-h: 3.75rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d11; --surface: #12151b; --surface-2: #161a21; --surface-3: #1c212a;
    --text: #e8eaef; --text-2: #c3c8d2; --muted: #8b93a3; --faint: #5e6676;
    --border: #232832; --border-strong: #303744; --divider: #1d222b;
    --primary: #3b82f6; --primary-hover: #60a5fa; --primary-soft: rgba(59, 130, 246, .14); --primary-text: #8ab4fb; --primary-ring: rgba(59, 130, 246, .3);
    --ok: #10b981; --ok-soft: rgba(16, 185, 129, .14); --ok-text: #5fd4a8;
    --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14); --warn-text: #f5c060;
    --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .15); --danger-text: #f59a9a;
    --chart-down: #3b82f6; --chart-up: #1e4a8f; --chart-grid: #1f242d;
    --nav-active: #1b2029;
    --toast-bg: #e8eaef; --toast-text: #111827;
    --log-bg: #0a0c10; --log-text: #c9d1d9;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 12px 28px -6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04);
    --shadow-lg: 0 28px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d11; --surface: #12151b; --surface-2: #161a21; --surface-3: #1c212a;
  --text: #e8eaef; --text-2: #c3c8d2; --muted: #8b93a3; --faint: #5e6676;
  --border: #232832; --border-strong: #303744; --divider: #1d222b;
  --primary: #3b82f6; --primary-hover: #60a5fa; --primary-soft: rgba(59, 130, 246, .14); --primary-text: #8ab4fb; --primary-ring: rgba(59, 130, 246, .3);
  --ok: #10b981; --ok-soft: rgba(16, 185, 129, .14); --ok-text: #5fd4a8;
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14); --warn-text: #f5c060;
  --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .15); --danger-text: #f59a9a;
  --chart-down: #3b82f6; --chart-up: #1e4a8f; --chart-grid: #1f242d;
  --nav-active: #1b2029;
  --toast-bg: #e8eaef; --toast-text: #111827;
  --log-bg: #0a0c10; --log-text: #c9d1d9;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 28px -6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04);
  --shadow-lg: 0 28px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ===== 基础 ===== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
/* 排版基准:rem 全部跟着 html 走。手机上手指要点,按钮和输入框留大一点(见文件末尾) */
html { font-size: 15px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-base)/1.55 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: var(--fs-xl); line-height: 1.3; }
h2 { font-size: var(--fs-md); line-height: 1.4; }
h3 { font-size: var(--fs-sm); line-height: 1.4; color: var(--text-2); }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a.btn:hover, #nav a:hover, a.stat:hover, a.support-float:hover { text-decoration: none; }
p { margin: 0; }
b, strong { font-weight: 600; }
::selection { background: var(--primary-ring); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: max(.88em, 12px); letter-spacing: -.01em; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; } /* IP、端口之类不能从中间折行 */
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); }
.subtitle { color: var(--muted); font-size: var(--fs-sm); margin-top: 1px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { display: block; width: 28px; height: 24px; object-fit: contain; }
.login-brand .logo { width: 40px; height: 34px; }
.support-btn { white-space: nowrap; color: var(--muted); }
.support-btn:hover { color: var(--text); }
/* 登录页右上角:帮助说明 + 建议 / 支持 */
.login-links { position: fixed; top: 1rem; right: 1rem; z-index: 3; display: flex; gap: .5rem; }
.support-float { display: inline-flex; align-items: center; gap: .4rem; height: 32px; font-size: var(--fs-sm); color: var(--text-2); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 0 .85rem; background: var(--surface); box-shadow: var(--shadow-xs); transition: color .15s, border-color .15s; }
.support-float:hover { color: var(--text); border-color: var(--border-strong); }
.support-btn svg, .support-float svg { flex: none; width: 15px; height: 15px; }
/* 很窄的屏幕上"帮助说明""建议 / 支持"只留图标、顶栏间距收紧,给页面标题让地方;标题再放不下就省略号收尾,不压到按钮上 */
@media (max-width: 560px) {
  #btn-help .help-label, #btn-support .support-label, #topbar-right .tb-label { display: none; }
  /* 只剩图标时和左边的菜单按钮一个样:图标 21px、一样的颜色和线宽(用户 11-24:原来 14px、偏灰,和旁边的金币、圣诞树比太小、不协调;
     又说「可以再大一点点 但是你要注意尺度 别…上面一栏被这几个按钮+两个活动图标占满了」)。
     按钮只收窄到 34px 宽(高度照样是能点准的 --ctl-h):图标大了,这一栏占的宽度反而比原来少,标题的地方不变挤 */
  #btn-help, #btn-support { width: 34px; height: var(--ctl-h); padding: 0; color: var(--text-2); }
  #btn-help svg, #btn-support svg { width: 21px; height: 21px; stroke-width: 1.8; }
  .main .topbar { gap: .4rem; } /* 比后面的 .topbar 基础规则更具体:这条写在前面也要生效 */
}
.topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title { display: flex; flex-wrap: wrap; align-items: center; }
.topbar-title > h1 { flex: 0 1 auto; min-width: 0; }
.topbar-title > .subtitle { flex: 1 0 100%; min-width: 0; }

/* ===== 登录 ===== */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; position: relative; isolation: isolate;
  background: radial-gradient(60rem 30rem at 50% -8rem, var(--primary-soft), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 24rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 2rem 1.9rem 1.7rem; display: flex; flex-direction: column; gap: 1rem; }
.login-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; margin-bottom: .1rem; }
.login-card h1 { font-size: var(--fs-base); color: var(--muted); font-weight: 400; margin-top: -.55rem; margin-bottom: .35rem; }
.login-card .btn.block { height: 40px; margin-top: .35rem; font-size: var(--fs-md); }
.login-card .field input { height: 40px; }
.login-card .err:empty { min-height: 0; }
/* 自签证书的说明(只在浏览器看到的是这台的自签证书时出现):一行结论,点开是解释 */
.login-tls { margin-top: -.2rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.login-tls > summary { padding: .5rem .7rem; cursor: pointer; list-style-position: inside; }
.login-tls > summary:hover { color: var(--text); }
.login-tls > p { margin: 0; padding: 0 .7rem .6rem; }

/* ===== 外壳:侧栏 + 顶栏 + 内容 ===== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 0 .75rem .75rem; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.brand { display: flex; align-items: center; gap: .55rem; height: var(--topbar-h); min-height: 3.75rem; padding: 0 .5rem; margin: 0 -.75rem .5rem; padding-left: 1.25rem; padding-right: 1rem; border-bottom: 1px solid var(--divider); font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; }
.brand-name { flex: 1; white-space: nowrap; }
#role-badge { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; }
/* 栏目排得紧一点(每项 30 高、13.5 的字、分组标题上下留白收小):十五六个栏目在 768 高的屏上不用滚,后面再加栏目也放得下。
   手机上仍是 42 高(见下面的窄屏规则),手指好点 */
#nav { display: flex; flex-direction: column; gap: 1px; flex: 1; min-height: 0; overflow-y: auto; margin: 0 -.25rem; padding: 0 .25rem .5rem; scrollbar-width: thin; }
.nav-group { padding: .7rem .6rem .25rem; font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: .02em; text-transform: uppercase; user-select: none; }
#nav a { display: flex; align-items: center; gap: .6rem; height: 30px; padding: 0 .6rem; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; font-size: 13.5px; transition: background .12s, color .12s; }
#nav a .ic { width: 17px; height: 17px; display: inline-flex; align-items: center; justify-content: center; color: var(--faint); flex: none; transition: color .12s; }
#nav a .ic svg { width: 16px; height: 16px; }
#nav a:hover { background: var(--surface-3); color: var(--text); }
#nav a:hover .ic { color: var(--muted); }
#nav a.active { background: var(--nav-active); color: var(--text); font-weight: 600; }
#nav a.active .ic { color: var(--primary); }
.sidebar-foot { display: flex; gap: .35rem; align-items: center; padding-top: .7rem; border-top: 1px solid var(--divider); }
.sidebar-foot select { width: auto; flex: 1; min-width: 0; height: var(--ctl-h-sm); padding-top: 0; padding-bottom: 0; font-size: var(--fs-sm); }
.sidebar-foot .btn { flex: none; }
.sidebar-foot #btn-logout { color: var(--muted); }
.sidebar-foot #btn-logout:hover { color: var(--danger-text); }
.sidebar-version { color: var(--faint); font-size: 11.5px; padding: .55rem .3rem 0; font-family: var(--mono); }
.main { min-width: 0; display: flex; flex-direction: column; }
/* 顶栏自己的最小高度用固定值:--topbar-h 是量顶栏实际高度写进去的(app.js),拿它当自己的最小高度,顶栏高过一次(手机上副标题折成两行)
   就再也缩不回去,换到没有副标题的页面、窗口拉宽以后还空着一截;Safari 还会每页报一次「ResizeObserver loop」 */
.topbar { display: flex; align-items: center; gap: .6rem; min-height: 3.75rem; padding: .55rem 1.5rem; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: var(--fs-lg); }
#topbar-right { display: flex; align-items: center; gap: .4rem; }
#topbar-right:empty { display: none; }
#btn-menu { display: none; }
main#page { padding: 1.25rem 1.5rem 2.5rem; max-width: var(--page-max); width: 100%; margin: 0 auto; }
main#page[data-layout="fluid"] { max-width: var(--page-max-fluid); }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(9, 12, 18, .45); backdrop-filter: blur(2px); z-index: 19; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--sidebar-w), 82vw); z-index: 20; transform: translateX(-100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .backdrop { display: block; }
  #btn-menu { display: inline-flex; margin-left: -.35rem; }
  #btn-menu svg { width: 21px; height: 21px; } /* 和手机上的「帮助说明」「建议 / 支持」一样大(见上面 560px 那段) */
  main#page { padding: 1rem .85rem 2rem; }
  .topbar { padding: .5rem .85rem; }
}

/* ===== 卡片与网格 ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow-xs); margin-bottom: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; min-height: var(--ctl-h-sm); }
.card-head h2 { flex: 1; }
.card > .hint:first-child, .card-head + .hint { margin-top: -.35rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 1000px) { .grid-3 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem .8rem; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.stat .k { color: var(--muted); font-size: var(--fs-sm); font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.stat .v { font-size: var(--fs-2xl); font-weight: 600; margin-top: .3rem; line-height: 1.15; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: var(--fs-xs); margin-top: .3rem; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: .85rem; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 1rem; }
.toolbar input[type=search] { max-width: 17rem; }
/* 工具栏里的分段按钮(线路页的协议筛选、用户页的状态筛选)放不下时自己折行,不把整页撑出横向滚动 */
.toolbar .seg { flex-wrap: wrap; max-width: 100%; }
.toolbar > .muted, .toolbar > .small { font-variant-numeric: tabular-nums; }
/* 用户页的工具栏:放得下就一行;放不下时「筛选」那一组整组落到第二行,搜索和「新增用户」留在第一行 ——
   不是哪个按钮挤不下就掉哪个(以前窄一点「新增用户」就自己掉到下一行的最左边)。按工具栏自己的宽度判断,不看窗口。 */
.tb-users { container: tbu / inline-size; }
.tb-users .tb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.tb-users .tb-filters > .muted { font-variant-numeric: tabular-nums; }
/* 搜索框的基准宽度取小的那个、再让它长到 17rem:换行是按基准宽度算的,基准取大了它不会先缩、而是直接把后面的按钮挤到下一行 */
.tb-users #user-q { flex: 10 1 9rem; min-width: 9rem; max-width: 17rem; }
@container tbu (max-width: 940px) {
  .tb-users .tb-filters { order: 5; flex: 1 1 100%; }
  .tb-users #user-q { flex: 10 1 9rem; max-width: 22rem; }
}
/* 英文的筛选按钮更长,早一点换成两行 */
@container tbu (max-width: 1060px) {
  :root:lang(en) .tb-users .tb-filters { order: 5; flex: 1 1 100%; }
  :root:lang(en) .tb-users #user-q { flex: 10 1 9rem; max-width: 22rem; }
}

/* ===== 表格 ===== */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
/* 中文名称每个字之间都能断行,自动列宽一挤就成了一字一行:名称列至少留约 6 个字,放不下整表横向滚动 */
table.grid td.primary-cell { min-width: 6.5em; }
.grid th, .grid td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.grid th { background: var(--surface-2); font-weight: 500; font-size: var(--fs-xs); color: var(--muted); letter-spacing: .02em; white-space: nowrap; position: sticky; top: 0; z-index: 2; border-bottom-color: var(--border); padding-top: .55rem; padding-bottom: .55rem; }
:lang(en) .grid th { text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.table-wrap > table.grid > thead > tr > th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
.table-wrap > table.grid > thead > tr > th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }
/* 英文表头是大写加字距,多词的("DURATION (DAYS)" 之类)很宽:英文界面里允许在空格处折行,窄窗口下表格不必横向滚动。中文表头不折(一字一行很难看) */
:lang(en) .grid:not(.ext-grid) th { white-space: normal; }
.grid tbody tr { transition: background .1s; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr.dragging { opacity: .4; }
.grid td.handle { cursor: grab; color: var(--faint); user-select: none; width: 1.5rem; padding-right: 0; }
.grid td.handle:hover { color: var(--muted); }
.grid td.actions { white-space: nowrap; text-align: right; width: 1%; }
table.grid:not(.cards):not(.rows2) > * > tr > :last-child { padding-right: var(--cell-end, 1.45rem); }
@media (min-width: 1500px) { table.grid:not(.cards):not(.rows2) > * > tr > :last-child { --cell-end: 2rem; } }
/* 行内操作:轻量按钮(无边框),悬停才有底色;主要信息不被一排边框按钮压住 */
.grid td.actions .btn, .grid td.actions details.menu > summary.btn { margin-left: .1rem; border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.grid td.actions .btn:hover, .grid td.actions details.menu[open] > summary.btn { background: var(--surface-3); color: var(--text); }
.grid td.actions .btn.danger { color: var(--danger-text); }
.grid td.actions .btn.danger:hover { background: var(--danger-soft); }
.grid .primary-cell { font-weight: 500; }
.grid .primary-cell > a, .grid .primary-cell a.name { color: var(--text); font-weight: 600; }
.grid .primary-cell > a:hover, .grid .primary-cell a.name:hover { color: var(--primary-text); text-decoration: none; }
/* 名字一行写完(连字符处不折成两行);实在太长才省略,全名在悬停提示里 */
.grid td.primary-cell > a, .grid td.primary-cell > .pname { display: inline-block; max-width: min(22em, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* 上游表多一列勾选框,从订阅里加来的上游名字又常常很长:名字最多 18 个字宽(来源那一行最多 21 个小字宽),全名在悬停 */
.grid.up-grid td.primary-cell > .pname { max-width: min(18em, 100%); }
.grid .sub-cell { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; margin-top: 2px; }
.grid td.num { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
/* 服务器等信息密集的表:不设最小宽度,长文本用省略号,不让整表出横向滚动条 */
table.grid.tight { min-width: 0; table-layout: fixed; }
.grid.tight th, .grid.tight td { padding: .55rem .65rem; }
.grid.tight td { word-break: break-word; }
.grid .ellip { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid.tight .btn.sm { padding: 0 .5rem; }
.btn.xs { height: auto; padding: .05rem .3rem; font-size: var(--fs-sm); line-height: 1.2; color: var(--muted); border-color: transparent; background: transparent; box-shadow: none; }
.btn.xs:hover { color: var(--text); background: var(--surface-3); }
/* 表格下方的分页条:上一页 · 页码 · 下一页,右侧选每页条数 */
.pager { display: flex; align-items: center; gap: .6rem; padding: .75rem .25rem 0; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
/* 真正为空时的引导(与"搜索无结果"分开):一句话说明 + 一个动作 */
.empty-guide { text-align: center; padding: 2.5rem 1rem; }
.empty-guide p { color: var(--muted); margin: 0 auto 1.1rem; max-width: 34rem; line-height: 1.65; }
/* 配置完成后的 Star 卡片:一行,轻量 */
.star-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.star-card .hint { margin: .15rem 0 0; }
.pager select { width: auto; height: var(--ctl-h-sm); padding: 0 1.6rem 0 .5rem; font-size: var(--fs-sm); }
/* 服务器表,三种排法(门槛写在表上的 data-fit,见 pages/nodes.js):
   宽:一行八列。连通 / 同步 / 数据面 / 在线 / 操作给定宽度,余下的平分给名称、地址、状态三列(定宽布局,内容再长也不撑表);
   中(.rows2):放不下一行时每台排成两行 —— 上面 名称 / 地址 / 状态 / 操作,下面 大陆连通 / 数据面(各带一个小列名);
   窄(.cards):每台一张卡片。
   以前名称、状态两列是「剩多少算多少」,窗口不到 1300 宽就被挤成一字一行、徽标压到旁边一列上 */
.grid.nodes .c-reach { width: 10.5rem; }
.grid.nodes .c-sync { width: 7.5rem; }
.grid.nodes .c-core { width: 12rem; }
.grid.nodes .c-online { width: 3.5rem; }
.grid.nodes .c-act { width: calc(11.2rem + var(--cell-end, 1.45rem)); }
:lang(en) .grid.nodes .c-act { width: calc(11.6rem + var(--cell-end, 1.45rem)); }
table.grid.nodes { min-width: 0; }
.grid.nodes .node-name { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.grid.nodes td.primary-cell { min-width: 0; }
table.grid.nodes.rows2, table.grid.nodes.rows2 tbody { display: block; }
table.grid.nodes.rows2 thead { display: none; }
table.grid.nodes.rows2 tr { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: .5rem 1rem; align-items: start; padding: .7rem 1.45rem .7rem .9rem; border-bottom: 1px solid var(--divider); }
table.grid.nodes.rows2 tr:last-child { border-bottom: none; }
table.grid.nodes.rows2 td { display: block; width: auto; min-width: 0; padding: 0; border: none; }
table.grid.nodes.rows2 td.c-p3 { display: none; }
table.grid.nodes.rows2 td.c-reach { grid-column: 1 / 3; grid-row: 2; }
table.grid.nodes.rows2 td.c-core { grid-column: 3 / 5; grid-row: 2; }
table.grid.nodes.rows2 td.c-reach::before, table.grid.nodes.rows2 td.c-core::before { content: attr(data-label); display: block; margin-bottom: .2rem; font-size: var(--fs-xs); color: var(--faint); }
table.grid.nodes.rows2 td.actions { justify-self: end; }
table.grid.nodes.rows2 tr.grp-row, table.grid.nodes.rows2 tr:has(> td[data-span]) { display: block; padding: 0; }
table.grid.nodes.rows2 tr.grp-row > td { padding: .4rem .9rem; }
table.grid.nodes.rows2 td[data-span] { padding: .6rem .9rem; }
/* ===== 表格按「自己能用的宽度」排版 =====
   不按窗口宽度:侧栏占不占地方、表格在页面里还是在抽屉 / 弹框里,能用的宽度差得很远(窗口 1000 宽、带侧栏时表格只有 740)。
   app.js 的 fitTables 量出每张表所在容器的宽度,按表上 data-fit 写的各档门槛给 <table> 加 class:
     .no-p3 / .no-p2  先藏 c-p3 列,再藏 c-p2 列(表头与单元格同名 class)
     .rows2           (服务器表)每台排成两行
     .cards           每行排成一张卡片;容器够宽时卡片并排几列
   键值表、连接列表不在此列(各有自己的窄屏排法)。 */
.grid.no-p3 .c-p3, .grid.no-p2 .c-p2 { display: none; }

/* 卡片:名称当标题(勾选框在它左边),其余每格一行 —— 左边列名(app.js 按表头补到 data-label)、右边内容;没有列名的(操作按钮)靠右。
   拖动排序的把手用不上,藏掉 */
.table-wrap:has(> table.grid.cards) { overflow: visible; max-height: none; background: transparent; border: none; box-shadow: none; }
table.grid.cards { display: block; min-width: 0; }
table.grid.cards thead { display: none; }
table.grid.cards tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19.5rem), 1fr)); gap: .7rem; align-items: stretch; }
table.grid.cards tr { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; min-width: 0; padding: .35rem 1rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
table.grid.cards tbody tr:hover { background: var(--surface); }
table.grid.cards tr.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
table.grid.cards td { display: block; flex: 1 1 100%; width: auto; min-width: 0; padding: .5rem 0; border: none; border-top: 1px solid var(--divider); text-align: right; word-break: break-word; }
table.grid.cards td::after { content: ''; display: table; clear: both; }
table.grid.cards td[data-label]::before { content: attr(data-label); float: left; font-family: var(--font); margin-right: .8rem; font-size: var(--fs-sm); line-height: 1.7; color: var(--muted); text-align: left; }
table.grid.cards td.handle { display: none; }
table.grid.cards td:has(> input[type=checkbox]:only-child) { order: -2; flex: 0 0 auto; padding-right: .65rem; border-top: none; }
table.grid.cards td:has(> input[type=checkbox]:only-child)::before { display: none; }
table.grid.cards td.primary-cell { order: -1; flex: 1 1 calc(100% - 2.6rem); padding: .55rem 0; border-top: none; text-align: left; font-size: var(--fs-md); font-weight: 600; }
table.grid.cards td.primary-cell::before { display: none; }
table.grid.cards td.actions { width: auto; margin-top: auto; padding-top: .6rem; }
table.grid.cards td.actions .btn, table.grid.cards td.actions details.menu > summary.btn { border-color: var(--border-strong); background: var(--surface); }
table.grid.cards .ellip { display: inline-block; max-width: 100%; vertical-align: bottom; }
table.grid.cards .sub-cell.ellip { display: block; }
table.grid.cards .cell-clip { display: inline; max-width: none; white-space: normal; overflow: visible; } /* 卡片里不截断:触屏点不出 title,上游名等要能看全 */
/* 占满一整行的:分段行(组名,一行小标题,不是卡片)、「没有数据」那一行 */
table.grid.cards tr.grp-row, table.grid.cards tr:has(> td[data-span]) { grid-column: 1 / -1; }
table.grid.cards tr.grp-row { margin: .35rem 0 -.2rem; padding: 0 .15rem; background: transparent; border: none; box-shadow: none; }
table.grid.cards tr.grp-row > td { padding: 0; background: transparent; border: none; text-align: left; }
table.grid.cards td[data-span] { text-align: center; border-top: none; }

@media (max-width: 700px) {
  .subtitle { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  /* 工具栏:占位的空白不再至少 12rem(会把按钮一个个挤到新行);开头的说明文字(修订号、提示)独占一行,按钮在下面靠右排在一起 */
  .toolbar .grow { min-width: 0; }
  .toolbar > .muted.small:first-child { flex-basis: 100%; }
  .toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
}

/* ===== 控件 ===== */
input, select, textarea { width: 100%; min-height: var(--ctl-h); padding: .4rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-base); line-height: 1.4; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s, background .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: color-mix(in srgb, var(--border-strong) 55%, var(--muted)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { background: var(--surface-2); color: var(--muted); box-shadow: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 1.9rem; background-image: var(--chev); background-repeat: no-repeat; background-position: right .6rem center; background-size: 12px; cursor: pointer; text-overflow: ellipsis; }
select[multiple] { background-image: none; padding-right: .7rem; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; box-shadow: none; accent-color: var(--primary); cursor: pointer; flex: none; vertical-align: -3px; }
input[type=file] { padding: .3rem .4rem; }
input[type=color] { padding: .15rem; width: 3rem; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
textarea { min-height: 5.5rem; font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.55; resize: vertical; }
textarea.code-area { min-height: 11rem; white-space: pre; overflow: auto; line-height: 1.5; tab-size: 2; }
.up-plans { margin-bottom: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--divider); }
.up-plans-title { margin-bottom: .4rem; font-size: var(--fs-sm); }
select.sm, input.sm { min-height: var(--ctl-h-sm); height: var(--ctl-h-sm); padding-top: 0; padding-bottom: 0; font-size: var(--fs-sm); }
select.sm { padding-right: 1.7rem; background-position: right .5rem center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: var(--ctl-h); padding: 0 .85rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: var(--fs-base); font-weight: 500; line-height: 1.2; box-shadow: var(--shadow-xs); transition: background .12s, border-color .12s, color .12s, box-shadow .12s; white-space: nowrap; text-decoration: none; user-select: none; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger-text); border-color: var(--border-strong); background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: var(--ctl-h-sm); padding: 0 .65rem; font-size: var(--fs-sm); gap: .3rem; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.icon { width: var(--ctl-h); padding: 0; }
.btn.icon.sm { width: var(--ctl-h-sm); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
details > summary.btn { list-style: none; }
details.menu > summary.btn::after { content: ""; width: 10px; height: 10px; margin-left: .05rem; background: currentColor; opacity: .55;
  -webkit-mask: var(--chev) center / 10px no-repeat; mask: var(--chev) center / 10px no-repeat; }
.seg { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; max-width: 100%; padding: 2px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.seg button { border: 1px solid transparent; background: transparent; height: calc(var(--ctl-h) - 6px); padding: 0 .7rem; border-radius: var(--radius-xs); font: inherit; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; color: var(--muted); white-space: nowrap; transition: color .12s, background .12s, box-shadow .12s; font-variant-numeric: tabular-nums; }
.seg button:hover:not(.active):not(:disabled) { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-xs); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; cursor: pointer; transition: background .18s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.row { display: flex; gap: .5rem; align-items: center; }
.row input { flex: 1; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1rem; }
.form-grid > .full, .form-grid label.full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field .label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.field .help { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.field .count { align-self: flex-end; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.field .count.over { color: var(--danger); font-weight: 600; }
.field.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; cursor: pointer; }
.field.check input { width: 16px; }
.field.check > span:not(.help) { font-size: var(--fs-base); color: var(--text); }
.field.check .help { flex-basis: 100%; padding-left: calc(16px + .55rem); }
/* 说明很长的勾选项:勾选框和文字同一行,文字自己换行(不整段掉到勾选框下面) */
.field.check.check-wrap { flex-wrap: nowrap; align-items: flex-start; }
.field.check.check-wrap > input { margin-top: .2rem; flex: none; }
.field.check.check-wrap > span { flex: 1; min-width: 0; }
.field.check.check-wrap .help { padding-left: 0; }
/* 落地页 logo(设置 → 订阅页、代理面板 我的账号):预览 + 上传 / 恢复默认,上传即生效,和上面的「保存」分开 */
.logo-field { display: flex; flex-direction: column; gap: .4rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--divider); }
.logo-field .label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.logo-field .help { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.logo-row { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem .85rem; }
.logo-preview { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-height: 54px; }
/* 按落地页的浅色、深色两种背景各画一块(颜色与 logo 尺寸照 sub/page.html),不跟面板自己的主题走 */
.logo-preview .lp { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-width: 6.5rem; min-height: 54px; padding: .45rem .7rem .35rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.logo-preview .lp[hidden] { display: none; }
.logo-preview .lp.light { background: #f6f7f9; color: #6b7280; }
.logo-preview .lp.dark { background: #0b0d11; color: #8b93a3; border-color: #232832; }
.logo-preview .lp img { display: block; height: 28px; width: auto; max-width: 160px; object-fit: contain; }
.logo-preview .lp img.custom { height: 32px; padding: 2px 4px; border-radius: 6px; max-width: 168px; box-sizing: border-box; }
.logo-preview .lp.dark img.custom { background: #f6f7f9; }
.logo-preview .lp figcaption { font-size: .68rem; line-height: 1; }
details.adv summary, details.ha-adv summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); margin-bottom: .5rem; user-select: none; }
details.adv summary:hover, details.ha-adv summary:hover { color: var(--text); }
.hint { color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; margin-top: .55rem; }
.err { color: var(--danger-text); font-size: var(--fs-sm); min-height: 1.2rem; }
.confirm-text { font-size: var(--fs-base); line-height: 1.65; padding: .25rem 0 .5rem; color: var(--text-2); }
.check-list { max-height: min(40vh, 18rem); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .3rem .75rem; background: var(--surface-2); }
.check-list label { display: flex; gap: .45rem; align-items: center; font-size: var(--fs-sm); min-height: 26px; cursor: pointer; }

/* 线路的分流规则:一行 = 序号 / 匹配方式 / 匹配内容 / 出口 / 排序删除;最后一行是"其余流量 → 线路的上游"。
   按编辑框自己的宽度排(容器查询),不看整个窗口 */
.rr-box { container-type: inline-size; }
#f-rr { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .95rem .65rem .75rem; margin-top: .55rem; background: var(--surface-2); }
#f-rr .hint { margin: .5rem 0 0; }
.rr-row { display: grid; grid-template-columns: 1.4rem 10rem minmax(0, 1fr) 9.5rem 5.4rem; gap: .5rem; align-items: start; padding: .5rem 0; border-top: 1px solid var(--border); }
.rr-head { padding: 0 0 .35rem; border-top: none; font-size: .74rem; font-weight: 500; color: var(--muted); }
.rr-no { display: flex; align-items: center; justify-content: center; min-height: 2.15rem; font-size: .78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.rr-row textarea { min-height: 2.15rem; resize: vertical; line-height: 1.35; }
.rr-row textarea.bad { border-color: var(--danger); }
.rr-err { grid-column: 3 / -1; margin-top: -.15rem; font-size: .76rem; color: var(--danger); }
/* 查应用域名得来的规则:匹配方式那格显示应用名,下面小字是匹配方式 */
.rr-type-cell { min-width: 0; }
.rr-name { display: flex; flex-direction: column; justify-content: center; min-height: 2.15rem; padding: .15rem .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); line-height: 1.25; }
.rr-name b { font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-name small { font-size: .7rem; color: var(--muted); }
/* "按规则分流"那一行右边的查应用域名:编辑框够宽时和勾选框同一行,窄了折到下面占满一行 */
.rr-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem 1rem; }
.rr-top > .field.check { flex: 1 1 15rem; min-width: 0; }
.rr-lookup { flex: 1 1 18rem; display: flex; gap: .4rem; align-items: center; min-width: 0; }
.rr-lookup[hidden] { display: none; }
.rr-lookup input { flex: 1 1 auto; min-width: 0; }
.rr-lookup .btn { flex: none; }
.rr-lookup-msg { margin: .45rem 0 0; font-size: .78rem; color: var(--muted); line-height: 1.55; }
.rr-lookup-msg button.link { border: 0; background: none; padding: 0 .15rem; font: inherit; color: var(--primary-text); text-decoration: underline; cursor: pointer; }
.rr-ops { display: flex; justify-content: flex-end; gap: .1rem; }
.rr-ops .btn { padding: .32rem .48rem; }
.rr-ops .btn:disabled { opacity: .3; }
.rr-rest { align-items: center; }
.rr-rest-label { font-size: .84rem; font-weight: 500; }
.rr-rest-to { padding: .42rem .65rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-empty { padding: .7rem 0; border-top: 1px solid var(--border); font-size: .82rem; color: var(--muted); text-align: center; }
.rr-add { width: 100%; margin-top: .35rem; padding: .45rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: transparent; color: var(--primary); font: inherit; font-size: .84rem; cursor: pointer; transition: background .15s, border-color .15s; }
.rr-add:hover { border-color: var(--primary); background: var(--primary-soft); }
@container (max-width: 640px) { /* 窄:第一行 序号 / 匹配方式 / 排序删除,下面匹配内容、问题、出口各占一行 */
  .rr-head { display: none; }
  .rr-row { grid-template-columns: 1.2rem minmax(0, 1fr) auto; grid-template-areas: "no type ops" ". val val" ". err err" ". to to"; }
  .rr-row > .rr-no { grid-area: no; }
  .rr-row > .rr-type, .rr-row > .rr-type-cell { grid-area: type; }
  .rr-row > .rr-ops { grid-area: ops; }
  .rr-row > .rr-values { grid-area: val; }
  .rr-row > .rr-to { grid-area: to; }
  .rr-row > .rr-err { grid-area: err; margin-top: 0; }
  .rr-rest { grid-template-columns: 1.2rem auto minmax(0, 1fr); grid-template-areas: none; }
  .rr-rest > .rr-no { grid-area: auto; }
  .rr-rest .muted { display: none; }
}

/* ===== 徽章与状态 ===== */
.badge { display: inline-flex; align-items: center; gap: .3rem; height: 22px; font-size: var(--fs-xs); font-weight: 500; line-height: 1; padding: 0 .55rem; border-radius: 999px; background: var(--surface-3); border: 1px solid transparent; color: var(--text-2); white-space: nowrap; vertical-align: middle; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); }
.badge.primary { background: var(--primary-soft); color: var(--primary-text); }
.badge.node { background: var(--warn-soft); color: var(--warn-text); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-right: .4rem; vertical-align: 1px; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: .4rem; min-width: 90px; }
.progress .bar { height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s; }
.progress.warn .bar { background: var(--warn); }
.progress.danger .bar { background: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; max-width: 100%; min-width: 0; } /* 不比所在的格子宽:里面很长的名字截断(见 .badge),不把整行撑出屏幕 */
.chip { display: inline-flex; align-items: center; min-height: 22px; font-size: var(--fs-xs); line-height: 1.35; padding: .1rem .5rem; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; font-size: var(--fs-sm); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.25rem; font-size: var(--fs-sm); align-items: baseline; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--text); font-variant-numeric: tabular-nums; } /* 地址之类的长串在窄屏上折行,不把页面撑出横向滚动 */

/* 菜单 */
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; cursor: pointer; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu .menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); min-width: 11rem; z-index: 30; padding: .3rem; display: flex; flex-direction: column; animation: mui-pop .12s ease-out; }
details.menu .menu-list.fixed { position: fixed; z-index: 60; }
details.menu .menu-list button { display: flex; align-items: center; gap: .5rem; text-align: left; border: none; background: transparent; min-height: 32px; padding: .35rem .65rem; border-radius: var(--radius-xs); font: inherit; font-size: var(--fs-sm); cursor: pointer; color: var(--text); white-space: nowrap; }
details.menu .menu-list button:hover { background: var(--surface-3); }
details.menu .menu-list button.danger { color: var(--danger-text); }
details.menu .menu-list button.danger:hover { background: var(--danger-soft); }
details.menu .menu-list button:disabled { color: var(--faint); cursor: default; background: transparent; }
details.menu .menu-list hr { border: none; border-top: 1px solid var(--divider); margin: .3rem -.3rem; }
@keyframes mui-pop { from { opacity: 0; transform: translateY(-3px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { details.menu .menu-list { animation: none; } }

/* ===== 抽屉 ===== */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w, 34rem), 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 40; transform: translateX(calc(100% + 24px)); transition: transform .2s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer.over { z-index: 60; }
.check-list.one-col { grid-template-columns: 1fr; }
/* 用户表单的外部节点:一行 = 左边「勾选 · 名字 · 类型 · 节点数」(名字太长省略号,全名在悬停),外部订阅右边一个「单独成组」小开关,
   没分给这个用户时变灰;分享链接没有开关,右边空着。行与行等高,开关一列对齐 */
.check-list.ext-list { grid-template-columns: minmax(0, 1fr); gap: .15rem; } /* 列能缩:名字再长也是省略号,不把开关挤到看不见的地方 */
.check-list .ext-pick { display: flex; align-items: center; gap: .9rem; min-height: 30px; min-width: 0; }
.check-list .ext-pick .ext-main { flex: 1 1 auto; min-width: 0; }
.ext-pick .ext-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext-pick .ext-meta { flex: none; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.check-list .ext-pick .ext-grp { flex: none; gap: .45rem; color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; }
.check-list .ext-pick .ext-grp:has(input:disabled) { color: var(--muted); cursor: default; }
tr.ext-hidden .primary-cell a { text-decoration: line-through; opacity: .55; }
.node-list { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.node-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; }
.node-row label { min-width: 0; }
.node-fam { width: auto; flex: none; padding: .1rem .3rem; font-size: .76rem; }
.field > select.node-fam { max-width: 12rem; }
.hint.warn { color: var(--warn, #b45309); }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }
button.chip { cursor: pointer; color: inherit; }
button.chip:hover { border-color: var(--primary); }
.ext-name { display: flex; align-items: center; gap: .35rem; font-weight: 600; }
.ext-name > span { min-width: 5em; }
.ext-url { max-width: 13rem; word-break: break-all; }
.ext-table > thead > tr > th, .ext-table > tbody > tr > td { padding-left: .55rem; padding-right: .55rem; }
@media (max-width: 720px) { .ext-url { max-width: none; } }
.cert-opts { display: flex; flex-direction: column; gap: .5rem; }
.cert-opt { display: flex; gap: .55rem; width: 100%; padding: .5rem .65rem; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.cert-opt:hover:not(:disabled) { border-color: var(--primary); }
.cert-opt:disabled { opacity: .6; cursor: default; }
.cert-opt.current { border-color: var(--primary); background: var(--primary-soft); }
.cert-opt-check { flex: 0 0 1rem; color: var(--primary); font-weight: 700; }
.cert-opt-main { flex: 1; min-width: 0; word-break: break-word; }
.cert-opt-sub { display: block; margin-top: .2rem; color: var(--muted); font-size: .8rem; }
.cert-opt-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
details.cert-log > summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none; }
details.cert-log > summary::-webkit-details-marker { display: none; }
details.cert-log > summary::after { content: "▾"; margin-left: auto; color: var(--muted); font-size: .8rem; }
details.cert-log[open] > summary { margin-bottom: .5rem; }
details.cert-log[open] > summary::after { content: "▴"; }
/* 证书页「正在使用」:线路默认 / 面板 / 订阅三格并排(窄了各占一行),每格上面是用途和「更换」,下面是哪张证书、还剩几天 */
.cu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.cu-tile { display: flex; flex-direction: column; gap: .2rem; min-width: 0; padding: .55rem .95rem .7rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.cu-tile.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.cu-tile.bad { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.cu-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: var(--ctl-h-sm); }
.cu-top .lb { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.cu-name { display: block; font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-name.off { color: var(--muted); font-weight: 500; }
.cu-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .5rem; min-height: 22px; }
.cu-grid + .hint { margin-top: .7rem; }
@media (max-width: 760px) { .cu-grid { grid-template-columns: minmax(0, 1fr); } }
/* 「添加证书」弹框:来源三选一 → 这种来源要填的 → 选项(开关行,两格并排)→ 添加后用于(三格并排) */
.ct-form { display: flex; flex-direction: column; gap: .9rem; }
.ct-form #c-source { align-self: flex-start; }
#c-form { display: flex; flex-direction: column; gap: .85rem; }
#c-form > .hint { margin: 0; }
#c-form .form-sec { margin: .35rem 0 -.25rem; padding-top: 0; border-top: none; font-size: var(--fs-base); color: var(--text); }
.ct-check { display: flex; align-items: flex-start; gap: .8rem; flex-wrap: wrap; }
.ct-check #c-precheck { flex: 1 1 18rem; min-width: 0; }
.ct-check #c-precheck:empty { display: none; }
.ct-check #c-precheck .hint { margin-top: .4rem; }
.ct-opts, .ct-uses { display: grid; gap: .5rem; align-items: stretch; }
.ct-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ct-uses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ct-opts .sw-row, .ct-uses .sw-row { align-items: flex-start; height: 100%; }
.ct-opts #c-renew-wrap .hint { margin-top: .35rem; }
@media (max-width: 760px) { .ct-opts, .ct-uses { grid-template-columns: minmax(0, 1fr); } }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.cert-pick-btn { width: 100%; justify-content: space-between; text-align: left; }
.drawer-head { display: flex; align-items: center; gap: .6rem; min-height: var(--topbar-h); padding: .6rem 1.1rem .6rem 1.35rem; border-bottom: 1px solid var(--border); }
.drawer-head h2 { flex: 1; font-size: var(--fs-lg); }
.drawer-body { padding: 1.1rem 1.35rem 2rem; overflow-y: auto; flex: 1; }
.drawer-body section { margin-bottom: 1.4rem; }
.drawer-body section + section { padding-top: 1.2rem; border-top: 1px solid var(--divider); }
.drawer-body h3 { margin-bottom: .65rem; font-size: var(--fs-base); color: var(--text); }
.drawer-body section > h3:not(:first-child), .drawer-body section > .ld-head:not(:first-child) { margin-top: 1.25rem; }
.drawer-body section > .row.wrap, .drawer-body section > .row { margin-top: .75rem; }
.drawer-body .kv { gap: .55rem 1.5rem; }
.sub-box { display: flex; align-items: center; gap: .6rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .7rem .45rem .75rem; margin-bottom: .5rem; }
.sub-box code { flex: 1; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text-2); word-break: break-all; }
.qr { display: block; width: 156px; height: 156px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; padding: 6px; margin: .6rem 0; }
.ip-list { display: flex; flex-direction: column; gap: .35rem; }
.ip-list .ip { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--divider); padding: .45rem .7rem; border-radius: var(--radius-sm); }

/* ===== 弹窗 / toast ===== */
.modal { position: fixed; inset: 0; background: rgba(9, 12, 18, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: mui-fade .14s ease-out; }
.modal-box { width: 100%; max-width: 36rem; max-height: 92vh; max-height: min(92vh, 64rem); max-height: min(92dvh, 64rem); display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0; box-shadow: var(--shadow-lg); animation: mui-rise .16s cubic-bezier(.2, .8, .2, 1); }
.modal-box.wide { max-width: min(56rem, 96vw); }
.modal-box.xl { max-width: min(76rem, 96vw); }
.modal-box > h2 { margin: 0; padding: 1.15rem 1.35rem .85rem; font-size: var(--fs-lg); flex: none; }
#modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 1.35rem .9rem; }
#modal-body > h3:first-child { margin-top: 0; }
#modal-err { flex: none; padding: 0 1.35rem; min-height: 0; }
#modal-err:not(:empty) { padding-top: .35rem; padding-bottom: .25rem; }
.modal-box h3 { margin: 1.1rem 0 .5rem; }
.modal-box h2 + h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin: 0; padding: .8rem 1.35rem; border-top: 1px solid var(--border); background: var(--surface-2); flex: none; }
/* 表单固定两栏(弹窗里一行四栏、每栏下面一段小字说明,读起来很累);手机上一栏 */
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }
/* 编辑框一页两栏:左边是按小标题分段的字段,右边整列给线路这类占地方的选择器;一屏看全。窄了上下排 */
.edit-2pane { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0 1.75rem; align-items: start; }
.edit-2pane > .pane { min-width: 0; }
.edit-2pane > .pane + .pane { padding-left: 1.75rem; border-left: 1px solid var(--divider); min-height: 100%; }
.edit-2pane .form-sec { margin: 1.1rem 0 .75rem; padding-top: 0; border-top: none; font-size: var(--fs-base); color: var(--text); }
.edit-2pane .pane > .form-sec:first-child { margin-top: 0; }
.edit-2pane .lp-body { max-height: min(48vh, 26rem); }
@media (max-width: 900px) {
  .edit-2pane { grid-template-columns: minmax(0, 1fr); }
  .edit-2pane > .pane + .pane { padding-left: 0; border-left: none; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--divider); }
}
/* 表单里的一行开关:左边名称和说明,右边开关(和设置页同一个样子) */
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.sw-row > div { min-width: 0; }
.sw-row b { display: block; font-weight: 500; }
.sw-row small { display: block; margin-top: .1rem; font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
/* 表单里的分段小标题 */
.form-sec { grid-column: 1 / -1; margin: .5rem 0 -.15rem; padding-top: .9rem; border-top: 1px solid var(--divider); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.form-sec:first-child { margin-top: 0; padding-top: 0; border-top: none; }
/* 危险操作的确认按钮:实心红,和旁边的「取消」一眼分得开 */
.modal-actions .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .12); }
.modal-actions .btn.danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); border-color: color-mix(in srgb, var(--danger) 88%, #000); }
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: .6rem; max-width: min(34rem, calc(100vw - 2rem)); background: var(--toast-bg); color: var(--toast-text); padding: .65rem 1rem; border-radius: var(--radius-md); z-index: 100; font-size: var(--fs-sm); font-weight: 500; line-height: 1.45; box-shadow: var(--shadow-lg); animation: mui-toast .18s cubic-bezier(.2, .8, .2, 1); }
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.toast.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(16, 185, 129, .25); }
.toast.err::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .25); }
.toast.warn::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
@keyframes mui-fade { from { opacity: 0; } }
@keyframes mui-rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes mui-toast { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { .modal, .modal-box, .toast { animation: none; } }

/* ===== 图表 ===== */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 190px; display: block; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .ylab, .chart .xlab { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .area.up { fill: var(--chart-up); opacity: .25; }
.chart .area.down { fill: var(--chart-down); opacity: .16; }
.chart .line.up { fill: none; stroke: var(--chart-up); stroke-width: 1.6; }
.chart .line.down { fill: none; stroke: var(--chart-down); stroke-width: 1.6; }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--toast-bg); color: var(--toast-text); padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: var(--fs-xs); line-height: 1.55; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: var(--shadow-md); z-index: 3; }
.chart-tip .tt { opacity: .65; margin-bottom: .2rem; }
.chart-tip .muted { color: inherit; opacity: .65; }
.chart-legend { display: flex; gap: 1rem; font-size: var(--fs-xs); color: var(--muted); margin-top: .35rem; }
.lg { display: inline-flex; align-items: center; }
.lg::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: .4rem; }
.lg.up::before { background: var(--chart-up); } .lg.down::before { background: var(--chart-down); }

/* 日志 */
pre.log { background: var(--log-bg); color: var(--log-text); font-family: var(--mono); font-size: 12px; padding: .8rem .95rem; border-radius: var(--radius-md); border: 1px solid rgba(255, 255, 255, .04); max-height: 320px; overflow: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; scrollbar-color: #30363d transparent; }
pre.log .warn { color: #e3b341; } pre.log .error { color: #ff7b72; } pre.log .debug { color: #6e7681; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .9rem; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: none; background: transparent; padding: .5rem .8rem; font: inherit; font-size: var(--fs-base); font-weight: 500; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .12s, border-color .12s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-color: var(--primary); }
.ua { color: var(--muted); font-size: var(--fs-xs); max-width: 26rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 日志页:三张表 / 一屏日志各有一条工具条;核心日志上面多一条「存下来的设置」 */
.lg-bar { align-items: center; }
.lg-bar input[type=search] { max-width: 16rem; }
.lg-opt { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
.lg-opt select { width: auto; }
.lg-sw { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.lg-core-set { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.2rem; margin-bottom: .8rem; padding: .6rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.lg-core-set .lg-note { flex: 1 1 18rem; min-width: 0; line-height: 1.5; }
pre.log.lg-core { max-height: calc(100vh - 21rem); min-height: 16rem; }
.lg-time { white-space: nowrap; }
.lg-cl { max-width: 22rem; }
.lg-client { font-weight: 500; }
.lg-client.raw, .lg-ua { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.lg-obj { color: var(--text-2); font-size: var(--fs-xs); max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid.cards .lg-obj, table.grid.cards .lg-cl { max-width: none; white-space: normal; overflow-wrap: anywhere; }
/* 日志表在窄屏上不拆成「一格一行」的卡片(一条日志要占六行,一屏只看得到两三条):每条压成两三行,连成一个列表 */
table.grid.cards.lg-rows tbody { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.grid.cards.lg-rows tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .75rem; align-items: baseline; padding: .6rem .85rem; border: 0; border-top: 1px solid var(--divider); border-radius: 0; box-shadow: none; }
table.grid.cards.lg-rows tr:first-child { border-top: 0; }
table.grid.cards.lg-rows td { display: block; flex: none; min-width: 0; padding: 0; border: 0; text-align: left; }
table.grid.cards.lg-rows td::before, table.grid.cards.lg-rows td::after { content: none; display: none; }
table.grid.cards.lg-sub td:nth-child(2) { grid-area: 1 / 1; font-weight: 600; }
table.grid.cards.lg-sub td:nth-child(6) { grid-area: 1 / 2; justify-self: end; }
table.grid.cards.lg-sub td:nth-child(4) { grid-area: 2 / 1; }
table.grid.cards.lg-sub td:nth-child(5) { grid-area: 2 / 2; justify-self: end; color: var(--text-2); font-size: var(--fs-sm); }
table.grid.cards.lg-sub td:nth-child(3) { grid-area: 3 / 1; color: var(--muted); font-size: var(--fs-xs); }
table.grid.cards.lg-sub td:nth-child(1) { grid-area: 3 / 2; justify-self: end; color: var(--muted); font-size: var(--fs-xs); }
table.grid.cards.lg-audit tr { grid-template-columns: auto minmax(0, 1fr) auto; }
table.grid.cards.lg-audit td:nth-child(2) { grid-area: 1 / 1 / 2 / 3; font-weight: 600; }
table.grid.cards.lg-audit td:nth-child(1) { grid-area: 1 / 3; justify-self: end; color: var(--muted); font-size: var(--fs-xs); }
table.grid.cards.lg-audit td:nth-child(3) { grid-area: 2 / 1; color: var(--muted); }
table.grid.cards.lg-audit td:nth-child(4) { grid-area: 2 / 2 / 3 / 4; }
table.grid.cards.lg-audit td:nth-child(5) { grid-area: 3 / 1 / 4 / 4; }
table.grid.cards.lg-audit td:nth-child(5):empty { display: none; }
table.grid.cards.lg-rows td[colspan] { grid-area: 1 / 1 / 2 / -1; justify-self: stretch; color: inherit; font-size: inherit; font-weight: 400; }

.grid tbody tr.selected { background: var(--primary-soft); }
.batch-bar { background: var(--surface); border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border)); border-radius: var(--radius-md); padding: .5rem .75rem; position: sticky; top: calc(var(--topbar-h) + .5rem); z-index: 4; box-shadow: var(--shadow-md); }

/* 运维页:一排状态小卡(和概览同款)、系统优化表(一行一项,列对齐)、WARP 和任务输出两张等高的卡并排 */
.alert-bar.ops-warn { margin: 0 0 1rem; }
.ops-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ops-stats .stat .v { font-size: var(--fs-xl); }
.ops-stats .stat .v .mono { font-size: var(--fs-lg); letter-spacing: 0; }
.ops-stats .stat .progress { margin-top: .5rem; min-width: 0; height: 4px; }
.ops-stats .ops-refresh { position: absolute; top: .55rem; right: .75rem; color: var(--muted); }
/* 五张小卡放不成一排时不留空位:中等宽度上面两张(主机、已运行)各占一半,下面三张用量各占三分之一;手机上主机占一整行,其余两两一排 */
@media (max-width: 1080px) {
  .ops-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ops-stats > .stat { grid-column: span 2; }
  .ops-stats > .stat:nth-child(-n+2) { grid-column: span 3; }
  .ops-stats > .stat:only-child { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .ops-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-stats > .stat, .ops-stats > .stat:nth-child(-n+2) { grid-column: span 1; }
  .ops-stats > .stat:first-child { grid-column: 1 / -1; }
}
.ops-table td { vertical-align: middle; }
.ops-table:not(.cards) th:nth-child(2) { width: 19%; }
.ops-table:not(.cards) th:nth-child(3) { width: 20.5rem; }
.ops-table:not(.cards) th:nth-child(4) { width: 5rem; }
.ops-ctl { flex-wrap: nowrap; }
table.grid.cards.ops-table .ops-ctl { flex-wrap: wrap; }
.ops-name { display: flex; align-items: flex-start; gap: .7rem; min-width: 0; }
.ops-name > div { min-width: 0; }
.ops-name b { font-weight: 500; }
.ops-name .sub-cell { white-space: normal; line-height: 1.55; max-width: 34rem; }
.ops-st { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--border-strong); color: transparent; font-size: 12px; }
.ops-st.ok { border-color: transparent; background: var(--ok-soft); color: var(--ok-text); }
.ops-st.info { border: none; width: 8px; height: 8px; margin: 7px 6px 0; background: var(--ok); }
.ops-st.info.warn { background: var(--warn); } .ops-st.info.bad { background: var(--danger); }
.ops-cur { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ops-cur .sub-cell { white-space: normal; max-width: 16rem; }
.ops-ctl { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .7rem; }
.ops-num { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.ops-num input { width: 5rem; height: var(--ctl-h-sm); }
/* 小数字框按最多要放下几位数定宽:Nch 跟着实际用的字体走(Linux、macOS 的数字比 Windows 的宽),再加 --num-x(内边距、边框、上下箭头);
   外面套 max() 不比原来的宽度窄,Windows 上看着和以前一样。11-22 在测试机上查到:Linux 的字体下「20480」在 5.6rem 的框里被裁掉 5px,
   同样定死宽度的数字框(下面的端口、备份留几份、套餐 / 服务器的重置天数、线路的握手端口、防火墙规则的小时数)一起按位数改 */
.ops-num input.w8 { width: max(7.5rem, calc(7ch + var(--num-x))); } .ops-num input.w5 { width: 4.25rem; }
/* 系统日志的上限(MB,最多 20480)和保留天数(最多 3650):Firefox 的数字框一直显示上下箭头,4.25rem 只剩 33px 放数字,默认的 200 都显示不全(11-21 火狐补测发现) */
.ops-num input.w6 { width: max(5.6rem, calc(5ch + var(--num-x))); }
.ops-chk { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-xs); color: var(--text-2); max-width: 20rem; cursor: pointer; }
table.grid.cards.ops-table .ops-ctl { justify-content: flex-end; }
table.grid.cards.ops-table .ops-name .sub-cell, table.grid.cards.ops-table .ops-cur .sub-cell { max-width: none; }
textarea.ops-sysctl { width: 100%; min-height: 19rem; margin: .7rem 0 .6rem; font-size: 12px; line-height: 1.6; }
.ops-sysctl-hint { margin: 0; }
.ops-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ops-pair > .card { margin: 0; display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 900px) { .ops-pair { grid-template-columns: minmax(0, 1fr); } }
.ops-warp .kv { margin-top: .8rem; align-items: center; }
.ops-warp .kv .sub-cell { margin-top: .2rem; font-size: var(--fs-xs); color: var(--muted); }
.ops-port { display: inline-flex; align-items: center; gap: .15rem; }
.ops-port input { width: max(6rem, calc(5ch + var(--num-x))); height: var(--ctl-h-sm); }
.ops-inline { margin-left: .6rem; }
.ops-warp-foot { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding-top: 1rem; }
.ops-warp .kv + .ops-warp-foot { border-top: 1px solid var(--divider); margin-top: 1rem; }
.ops-warp-foot .btn.end { margin-left: auto; }
.ops-out pre.log { flex: 1; min-height: 11rem; max-height: 22rem; margin: 0; }
.ops-idle { flex: 1; min-height: 6rem; display: grid; place-items: center; padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--muted); font-size: var(--fs-sm); text-align: center; line-height: 1.6; }

/* 快速开始 */
/* 概览「开始使用」(首次安装的指引,用户 11-23):三步,每步一行 —— 序号圈 / 一句话(下面一行小字)/ 这一步的按钮。
   下一步那一行带底色、按钮是主按钮;做完的打勾、字变淡、虚线框;卡片底下一行写「要当副机?」「用过 m-ui?」两条去路 */
.guide { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 0 0 3px var(--primary-soft); }
.guide-steps { margin: .7rem 0 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.guide-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .4rem .85rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.guide-steps li.now { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.guide-steps li.done { background: transparent; border-style: dashed; }
.guide-n { width: 1.75rem; height: 1.75rem; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--muted); font-weight: 650; font-size: var(--fs-sm); }
.guide-steps li.now .guide-n { background: var(--primary); color: #fff; }
.guide-steps li.done .guide-n { background: var(--ok-soft); color: var(--ok-text); }
.guide-t { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.guide-t b { font-weight: 600; font-size: var(--fs-base); color: var(--text); }
.guide-t span { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }
.guide-steps li.done .guide-t b { color: var(--muted); font-weight: 500; }
.guide-ok { font-size: var(--fs-sm); color: var(--ok-text); white-space: nowrap; }
.guide-foot { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: .75rem 0 0; font-size: var(--fs-sm); color: var(--muted); }
@media (max-width: 600px) {
  .guide-steps li { grid-template-columns: auto minmax(0, 1fr); }
  .guide-steps li > .btn, .guide-steps li > .guide-ok { grid-column: 2; justify-self: start; }
}
/* 可排序表头 */
.grid th.sortable { cursor: pointer; user-select: none; }
.grid th.sortable:hover { color: var(--text); }
.grid th.sorted { color: var(--primary-text); }

/* 备份页:通栏的「备份」(右上角两个按钮 + 备份表)→「定时备份」「还原」两张等高的卡并排 → 收起来的「换到新服务器」 */
.head-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.bk-main > .hint { margin-bottom: .85rem; }
.bk-none { margin: 0; padding: 1.4rem .9rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.bk-list .pname { max-width: 26rem; }
.bk-foot { margin: .7rem 0 0; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.bk-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.bk-pair > .card { margin: 0; display: flex; flex-direction: column; }
@media (max-width: 860px) { .bk-pair { grid-template-columns: minmax(0, 1fr); } }
/* 定时备份:一句话里嵌着钟点和份数两个小控件,字和控件在一条基线上;下面一行是 Telegram 的开关 */
.bk-line { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .5rem; margin: 0; font-size: var(--fs-base); }
.bk-line .nw { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.bk-line select { width: auto; min-width: 5.75rem; }
.bk-line input[type=number] { width: max(4.5rem, calc(3ch + var(--num-x))); text-align: center; } /* 留几份:最多 365 */
.bk-auto-body > .hint { margin: .45rem 0 0; font-size: var(--fs-xs); }
.bk-auto-body.off, .bk-tg.off { opacity: .55; }
.bk-fail { margin: 0 0 .7rem; padding: .45rem .7rem; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger-text); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.bk-tg { display: flex; align-items: flex-start; gap: .7rem; margin-top: auto; padding-top: .9rem; cursor: pointer; }
.bk-auto-body + .bk-tg { border-top: 1px solid var(--divider); margin-top: .9rem; }
.bk-tg .switch { flex: none; margin-top: 1px; }
.bk-tg .tx { min-width: 0; }
.bk-tg b { display: block; font-weight: 500; }
.bk-tg small { display: block; margin-top: .15rem; font-size: var(--fs-xs); line-height: 1.55; color: var(--muted); }
.bk-tg.off { cursor: default; }
.card.bk-restore > .hint { margin-top: -.35rem; }
/* 还原:一块虚线框占满卡里剩下的高度 —— 点它选文件,或者把文件拖进来 */
.bk-drop { flex: 1; min-height: 4.75rem; margin-top: .9rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; padding: .7rem;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: var(--fs-xs); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.bk-drop b { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.bk-drop:hover, .bk-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.bk-drop:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.alert-bar.bk-pending { margin: 0 0 1rem; }
details.bk-mig > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; list-style: none; user-select: none; }
details.bk-mig > summary::-webkit-details-marker { display: none; }
details.bk-mig > summary h2 { margin-bottom: .3rem; }
details.bk-mig > summary .hint { margin: 0; }
details.bk-mig > summary .i-chev { flex: none; color: var(--muted); transition: transform .15s; }
details.bk-mig[open] > summary .i-chev { transform: rotate(90deg); }
details.bk-mig[open] > summary { padding-bottom: .9rem; margin-bottom: .9rem; border-bottom: 1px solid var(--divider); }
/* 四步:左边一列带序号的圆点,用一条细线连起来 */
.bk-steps { margin: 1rem 0 0; padding: 0; list-style: none; display: grid; gap: 1.1rem; }
.bk-steps > li { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: .8rem; }
.bk-steps > li:not(:last-child)::before { content: ""; position: absolute; left: 12.5px; top: 28px; bottom: -1.1rem; width: 1px; background: var(--border); }
.bk-steps .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.bk-steps b { display: block; line-height: 26px; font-weight: 600; }
.bk-steps .hint { margin: .15rem 0 0; }
.bk-steps .sub-box { margin: .5rem 0 .35rem; }
.bk-dns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.bk-dns input { flex: 1 1 13rem; max-width: 21rem; }
#mig-result:not(:empty) { margin-top: .6rem; }

a.stat { color: inherit; text-decoration: none; display: block; }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat.bad .k::before, .stat.warn .k::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .45rem; vertical-align: 1px; }
.stat.bad .k::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.stat.bad .s { color: var(--danger-text); }

/* 流量排行 */
.top-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.top-row { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) minmax(3rem, 30%) auto; gap: .7rem; align-items: center; font-size: var(--fs-sm); min-height: 26px; }
.top-rank { color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; font-size: var(--fs-xs); }
.top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.top-bar div { height: 100%; background: var(--chart-down); border-radius: 999px; }
.top-val { min-width: 4.4em; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-2); } /* 定宽:每行各是一个格子,数字宽窄不一(22.8 GB / 7.4 GB)时前面的进度条会错开几个像素 */
@media (max-width: 700px) { .top-row { grid-template-columns: 1.6rem minmax(0, 1fr) auto; } .top-bar { display: none; } }

/* 顶部常驻警示(默认密码等) */
.alert-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem .9rem; margin: 1rem 1.5rem 0; padding: .6rem .9rem; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); color: var(--danger-text); border-radius: var(--radius-md); font-size: var(--fs-sm); font-weight: 500; line-height: 1.5; }
.alert-bar.warn { background: var(--warn-soft); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.alert-bar span { flex: 1; }
.alert-bar .btn { flex: none; }
@media (max-width: 900px) { .alert-bar { margin: .75rem .85rem 0; } }

/* 柱状流量图 */
.chart-summary { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: baseline; font-size: var(--fs-sm); margin: 0 0 .6rem; font-variant-numeric: tabular-nums; }
.chart-summary > span:first-child .num { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.015em; margin: 0 .2rem 0 .1rem; }
.chart-summary .chart-legend { margin-left: auto; }
svg.chart.bars { width: 100%; height: auto; display: block; }
svg.chart.bars .hit { fill: transparent; }
svg.chart.bars .seg.down { fill: var(--chart-down); }
svg.chart.bars .seg.up { fill: var(--chart-up); }
svg.chart.bars g.bar .seg { transition: opacity .12s; }
svg.chart.bars:hover g.bar:not(.hot) .seg { opacity: .5; }
svg.chart.bars g.bar.hot .hit { fill: var(--surface-3); }
svg.chart.bars .grid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
svg.chart.bars .ylab, svg.chart.bars .xlab { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }

/* 小标题(证书页「用在哪」)与代码块 */
.sub-title { font-size: .9rem; margin: 1rem 0 .4rem; }
pre.code { white-space: pre-wrap; word-break: break-all; }

/* 副机只读:由主机下发的页面隐藏增删改入口 */
.alert-bar.info { border-color: color-mix(in srgb, var(--primary) 28%, transparent); background: var(--primary-soft); color: var(--primary-text); margin: 0 0 1rem; }
.node-readonly [data-act$=".add"], .node-readonly [data-act$=".edit"], .node-readonly [data-act$=".del"], .node-readonly [data-act$=".delete"],
.node-readonly [data-act$=".bulk"], .node-readonly [data-act$=".batch"], .node-readonly [data-act$=".preset"], .node-readonly [data-act$=".plan"],
.node-readonly [data-act$=".reset"], .node-readonly [data-act$=".extend"], .node-readonly [data-act$=".renew"], .node-readonly [data-act$=".import"],
.node-readonly [data-act$=".toggle"], .node-readonly [data-act$=".clone"], .node-readonly [data-act$=".sort"], .node-readonly [data-act$=".refresh"],
.node-readonly .batch-bar, .node-readonly details.menu, .node-readonly input[type=checkbox].sel { display: none !important; }

/* 最近入站连接:一行一条,定宽列 + 省略号,不横向滚动(详见文件末尾「概况」) */
table.grid.conns { min-width: 0; table-layout: fixed; }
table.grid.conns th, table.grid.conns td { white-space: nowrap; padding: .38rem .7rem; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }

/* 在线设备:IP 右侧列出它正在使用的线路 */
.ip-list .ip { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.ip-lines { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }



/* 代理详情:一个用户两行(概要 + 订阅地址),不用表格也就没有横向滚动条 */
.rs-users { display: flex; flex-direction: column; gap: .35rem; }
.rs-u { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .35rem .5rem; }
.rs-u-head { display: flex; align-items: baseline; gap: .5rem; font-size: .82rem; }
.rs-u-head .rs-u-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-u-head .muted { font-size: .76rem; white-space: nowrap; }
.rs-u-sub { display: flex; align-items: center; gap: .4rem; margin-top: .25rem; }
.rs-u-sub code { flex: 1; min-width: 0; font-family: var(--mono); font-size: .72rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: .2rem .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-u .ip-list { margin-top: .25rem; }
.rs-u .ip-list .ip { font-size: .74rem; padding: .15rem .4rem; }
/* 线路标签紧凑些,36 条也就三四行 */
.rs-lines .chip { font-size: .72rem; padding: .1rem .4rem; }

/* 版本号旁的更新提示:平时不出现,有新版本才亮一个小箭头 */
.sidebar-version { display: flex; align-items: center; gap: .35rem; }
.update-dot { display: inline-flex; align-items: center; gap: .2rem; border: 1px solid var(--primary); background: transparent; color: var(--primary); border-radius: 999px; padding: 0 .35rem; height: 18px; cursor: pointer; line-height: 1; }
.update-dot svg { width: 12px; height: 12px; }
.update-dot:hover { background: var(--primary); color: #fff; }
.confirm-text { white-space: pre-line; }


/* 外部节点:展开面板 */
tr.ext-sub > td { padding: .25rem 1rem 1.1rem; background: var(--surface-2); }
.ext-panel { padding-top: .75rem; }
.ext-panel > .hint { margin-top: .75rem; }
.ext-tools input[type=search] { max-width: 16rem; }
.ext-grid th, .ext-grid td { padding: .45rem .65rem; font-size: var(--fs-sm); }
.ext-toggle { margin-left: -.35rem; color: var(--muted); }
/* 节点行:名字 + 悬停才出现的改名按钮;「输出」开关单独一列排在最右,整列对齐 */
.ext-node { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.ext-node > a { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-weight: 500; }
.ext-node > a:hover { color: var(--primary-text); text-decoration: none; }
.ext-node > .badge { flex: none; }
.ext-rename { flex: none; opacity: 0; transition: opacity .12s; }
tr:hover > td .ext-rename, .ext-rename:focus-visible { opacity: 1; }
@media (hover: none) { .ext-rename { opacity: 1; } }
.ext-grid .ext-out { width: 1%; white-space: nowrap; text-align: right; }
/* 一台服务器一列:定宽,名字长了省略(全名在悬停提示里)。列数由脚本按面板宽度定(shownCols),表格本身不设最小宽度、不出横向滚动条 */
table.grid.ext-grid { min-width: 0; }
.ext-grid th.srv, .ext-grid td.srv { width: 5.75rem; max-width: 5.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext-incl { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; cursor: pointer; }
/* 表格里的分段行(服务器按分组):一行小标题,不参与悬停高亮 */
.grid tbody tr.grp-row > td { padding: .4rem .75rem; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .02em; border-bottom: 1px solid var(--divider); }
.grid tbody tr.grp-row:hover { background: transparent; }
.grid tbody tr.grp-row .muted { font-weight: 400; margin-left: .25rem; }
.grp-rename { margin-left: .2rem; opacity: 0; transition: opacity .12s; }
tr.grp-row:hover .grp-rename, .grp-rename:focus-visible { opacity: 1; }
@media (hover: none) { .grp-rename { opacity: 1; } }
/* 分段按钮里的计数 */
.seg-n { margin-left: .15rem; font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.seg button.active .seg-n { color: var(--muted); }
/* 工具栏里的一个勾选项 */
.check-inline { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; cursor: pointer; }
/* 页面底部:不常看的说明(折着)和配置修订号这类 */
.page-foot { display: flex; align-items: flex-start; gap: 1rem; margin-top: .85rem; flex-wrap: wrap; }
details.howto { flex: 1 1 24rem; min-width: 0; font-size: var(--fs-sm); color: var(--muted); }
details.howto > summary { cursor: pointer; width: fit-content; color: var(--text-2); user-select: none; }
details.howto > summary:hover { color: var(--text); }
details.howto > p { margin-top: .45rem; line-height: 1.65; max-width: 62rem; }
.node-name { font-weight: 600; }
/* 页面开头的一段说明 + 右边的主按钮:说明自己折行,按钮不被挤到下一行 */
.toolbar.intro { align-items: flex-start; flex-wrap: nowrap; gap: 1.25rem; margin-bottom: 1rem; }
.page-hint { flex: 1; min-width: 0; max-width: 64rem; color: var(--muted); font-size: var(--fs-sm); line-height: 1.65; }
.toolbar.intro > .btn, .toolbar.intro > .row { flex: none; }
@media (max-width: 700px) { .toolbar.intro { flex-wrap: wrap; gap: .75rem; } .page-hint { flex-basis: 100%; } }
.grid.kv td:first-child { width: 11rem; white-space: nowrap; }
.ext-val { word-break: break-all; }
.ext-link { margin-top: .8rem; display: grid; gap: .3rem; }
.ext-results { padding-left: 1.2rem; }
.ext-results li { margin: .25rem 0; }

/* ===== 大陆连通检测 ===== */
/* 表格里的一格:整格可点,打开明细抽屉 */
button.reach-cell { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; border-radius: var(--radius-sm); }
button.reach-cell:hover .badge { filter: brightness(.97); }
button.reach-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sub-cell.link { color: var(--primary-text); }
.rc-row { display: flex; gap: .25rem; margin-top: .3rem; flex-wrap: wrap; }
.rc { display: inline-flex; align-items: baseline; gap: .2rem; font-size: .7rem; line-height: 1.5; padding: 0 .32rem; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.rc b { font-family: var(--mono); font-weight: 600; }
.rc.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.rc.weak { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.rc.down { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.spin { display: inline-block; width: .72rem; height: .72rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: mui-spin .8s linear infinite; }
@keyframes mui-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.reach-sum { white-space: nowrap; }
.ok-text { color: var(--ok); } .danger-text { color: var(--danger); } .warn-text { color: var(--warn); }
/* 抽屉:结论条 + 分运营商 + 历史 */
.reach-hero { border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm); padding: .6rem .85rem; margin-bottom: .8rem; }
.reach-hero .v { font-weight: 650; font-size: 1.02rem; margin-bottom: .2rem; }
.reach-hero p { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.reach-hero.ok { border-left-color: var(--ok); } .reach-hero.warn { border-left-color: var(--warn); } .reach-hero.danger { border-left-color: var(--danger); }
.reach-meta { margin-bottom: .2rem; }
.reach-g { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .65rem; margin-bottom: .4rem; }
.reach-g-head { display: flex; align-items: center; gap: .55rem; }
.reach-g-name { flex: 1; font-weight: 500; }
.reach-g details { margin-top: .3rem; }
.reach-g summary { cursor: pointer; color: var(--muted); font-size: .78rem; }
.reach-probes { list-style: none; margin: .35rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.reach-probes li { display: flex; justify-content: space-between; gap: .6rem; font-size: .78rem; }
.reach-probes li .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.reach-hist { display: flex; gap: 3px; flex-wrap: wrap; }
.reach-hist i { width: 13px; height: 13px; border-radius: 3px; background: var(--border-strong); }
.reach-hist i.ok { background: var(--ok); } .reach-hist i.warn { background: var(--warn); } .reach-hist i.danger { background: var(--danger); }
/* 导航"服务器"上的红点 */
#nav a.has-alert { position: relative; }
#nav a.has-alert::after { content: ""; position: absolute; right: .7rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
@media (max-width: 700px) { .reach-sum { display: none; } }

/* 手机:字和控件留大一点,手指好点 */
/* 手机上点输入框页面会被放大:iOS 对字号不到 16px 的输入控件一聚焦就放大整页。小号输入框(.sm、表格里的、各处自己定了字号的)
   也都提到 16px,所以这里用 !important 压过它们;按触屏 + 窄屏判断,平板横屏和桌面不受影响 */
@media (max-width: 700px), (pointer: coarse) and (max-width: 1024px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea { font-size: 16px !important; }
}
@media (max-width: 700px) {
  :root { --ctl-h: 40px; --ctl-h-sm: 32px; }
  input[type=checkbox], input[type=radio] { width: 18px; height: 18px; }
  #nav a { height: 42px; }
}

/* 换套餐:变更前后两栏(窄屏上下排)、变了的值加粗、影响提示;用户详情里的套餐记录 */
.pc-preview { margin-top: .7rem; border-top: 1px dashed var(--border); padding-top: .6rem; }
.pc-preview h3 { margin: 0 0 .35rem; font-size: .85rem; }
.pc-cols dd.chg { font-weight: 600; color: var(--primary-text); }
.pc-warn { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .8rem; line-height: 1.5; }
.pc-warn li.warn { color: var(--warn); }
.pc-warn li.bad, .pc-bad { color: var(--danger); font-weight: 500; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
/* 置灰但还能点的一格(线路表单里这个协议配不上的加密方式):点一下在下面写出原因,手机上没有悬停 */
.seg button.off { opacity: .45; cursor: not-allowed; }
.seg button.off:hover:not(.active) { color: var(--muted); }
.plan-ops { list-style: none; margin: 0; padding: 0; font-size: .8rem; }
.plan-ops li { padding: .35rem 0; border-bottom: 1px dashed var(--border); line-height: 1.5; }
.plan-ops li:last-child { border-bottom: none; }
@media (max-width: 700px) { .pc-cols { grid-template-columns: 1fr; } }
/* ===== 主机容灾:服务器列表的角色标签与小卡片、设为主机的确认框与进度、设置页 ===== */
button.role-chip { display: inline-flex; align-items: center; gap: .22rem; font: inherit; font-size: .72rem; line-height: 1.35; padding: .12rem .42rem .12rem .55rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; white-space: nowrap; vertical-align: middle; margin-right: .25rem; }
button.role-chip .caret { width: .8em; height: .8em; opacity: .7; }
/* 角色写得长(英文「Master · this server」)而格子窄时:省略,不伸到旁边一列上 */
button.role-chip { max-width: 100%; }
button.role-chip .rt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.role-chip:hover { filter: brightness(.96); }
button.role-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button.role-chip[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--primary-soft); }
button.role-chip.k-master { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
button.role-chip.k-standby { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
button.role-chip.k-lost { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.ha-pop { position: fixed; z-index: 70; width: min(22rem, calc(100vw - 1rem)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .75rem .9rem; font-size: .84rem; line-height: 1.55; }
.ha-pop:focus { outline: none; }
.ha-pop h4 { margin: 0 0 .3rem; font-size: .88rem; font-weight: 600; }
.ha-pop p { margin: .25rem 0; color: var(--text); }
.ha-pop p.muted { color: var(--muted); }
.ha-pop .actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.ha-pop .why { color: var(--warn); font-size: .78rem; margin-top: .35rem; }
.ha-pop .why:empty { display: none; }
.ha-plan { margin: .1rem 0 .7rem; padding-left: 1.15rem; line-height: 1.6; }
.ha-plan li { margin: .18rem 0; }
.ha-note { border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm); padding: .5rem .7rem; margin: .4rem 0 .7rem; font-size: .85rem; }
.ha-note ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.ha-note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.ha-note.bad { border-left-color: var(--danger); background: var(--danger-soft); }
.ha-note.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.ha-steps { list-style: none; padding: 0; margin: .6rem 0; display: grid; gap: .4rem; }
.ha-steps li { display: flex; align-items: center; gap: .55rem; color: var(--muted); }
.ha-steps li .ic { width: 1.1rem; text-align: center; }
.ha-steps li.done { color: var(--ok); }
.ha-steps li.cur { color: var(--text); font-weight: 500; }
.ha-steps li.fail { color: var(--danger); }
/* 主机容灾那张卡不走 set-rows(整块是说明 + 单选卡):宽屏(主栏放宽以后)卡片有一千多像素宽,说明文字一行近百个字、
   「备用台数」的下拉框拉成通栏。和别的卡一样排成两栏:左边是接任方式、备用台数和什么算失联,右边是接任时接管什么(连同 DNS 接口),
   下面的就绪检查分两列。不限宽、不留白(用户 N9:宽屏右边不要空着)。卡片本身是容器,只能按窗口宽度切(和主栏放宽同一个断点) */
@media (min-width: 1500px) {
  #ha-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 3rem; grid-auto-flow: row dense; align-items: start; }
  #ha-card > * { grid-column: 1 / -1; min-width: 0; }
  #ha-card > .ha-modes, #ha-card > .form-grid, #ha-card > .form-grid + p.hint { grid-column: 1; }
  #ha-card > #ha-scope-slot { grid-column: 2; grid-row: span 3; }
  #ha-card > #ha-scope-slot > .ha-sub:first-child { margin-top: .6rem; }
  #ha-card .ha-check { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 3rem; }
}
.ha-modes { margin: .6rem 0 .8rem; }
.ha-modes label { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .7rem; margin-bottom: .45rem; cursor: pointer; line-height: 1.5; }
.ha-modes label.sel { border-color: var(--primary); background: var(--primary-soft); }
.ha-modes input[type=radio] { width: auto; margin-top: .25rem; accent-color: var(--primary); }
.ha-sub { margin: .9rem 0 .4rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.ha-check { list-style: none; padding: 0; margin: .2rem 0 .6rem; display: grid; gap: .3rem; }
.ha-check li { display: grid; grid-template-columns: 1.2rem 1fr; gap: .35rem; font-size: .85rem; line-height: 1.5; }
.ha-check li .ic { font-weight: 700; text-align: center; }
.ha-check li.lv-ok .ic { color: var(--ok); }
.ha-check li.lv-warn .ic { color: var(--warn); }
.ha-check li.lv-bad .ic { color: var(--danger); }
.ha-check li.lv-info .ic { color: var(--muted); }
/* 简洁模式的就绪检查:一排圆点 + 计数;点开看全文(用户 11-21) */
.ha-dots { display: none; }
:root[data-concise] .ha-ready { display: none; }
:root[data-concise] .ha-dots { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .35rem 0 .75rem; }
.ha-dot { position: relative; flex: none; width: 13px; height: 13px; padding: 0; border: 0; border-radius: 50%; background: var(--ok); cursor: pointer; transition: box-shadow .12s, transform .12s; }
.ha-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.ha-dot.lv-warn { background: var(--warn); }
.ha-dot.lv-bad { background: var(--danger); }
.ha-dot.lv-info { background: var(--border-strong); }
.ha-dot:hover, .ha-dot[aria-expanded="true"] { transform: scale(1.15); box-shadow: 0 0 0 3px var(--primary-ring); }
.ha-dot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ha-dots-sum { margin-left: .3rem; font-size: var(--fs-xs); color: var(--muted); }
.ha-dots-sum.bad { color: var(--warn-text, var(--warn)); }
.ha-pause { gap: .4rem; flex-wrap: wrap; align-items: center; margin: .3rem 0 .6rem; }
.ha-adv summary { cursor: pointer; color: var(--muted); margin: .4rem 0; }
.field.check.inline { display: inline-flex; margin: 0 0 0 .6rem; }
.alert-bar.ha-info { border-color: color-mix(in srgb, var(--primary) 28%, transparent); background: var(--primary-soft); color: var(--primary-text); }
.alert-bar.ha-info a { text-decoration: underline; }
@media (max-width: 700px) { .ha-pop { font-size: .88rem; } }
/* 从卡片点「去设置」跳过来:标题和保存按钮别被吸顶的顶栏盖住 */
#ha-card { scroll-margin-top: 4.5rem; }
.ha-steps li.cur.warn { color: var(--warn); }
.ha-ack { margin: .2rem 0 .6rem; }
.ha-abandon { border-top: 1px solid var(--border); margin-top: .6rem; padding-top: .5rem; }
.ha-abandon .row { margin-top: .4rem; }
.fp { word-break: break-all; }
/* 「去 Cloudflare 创建 ↗」和下一行的手动步骤 */
.cf-link { display: flex; flex-direction: column; gap: .15rem; margin-top: .3rem; font-size: .8rem; line-height: 1.45; }
.cf-link a { color: var(--primary-text); text-decoration: underline; width: fit-content; }
.cf-link .cf-steps { color: var(--muted); }

/* ===================== 排版:大数据量下不溢出、不无限拉长 ===================== */
/* 顶部提示条和内容区同宽、左缘对齐;文字至多两行(手机三行),全文在 title;手机上按钮换到下一行 */
.main { --page-cur: var(--page-max); --page-pad: 1.5rem; }
.main:has(> #page[data-layout="fluid"]) { --page-cur: var(--page-max-fluid); }
@media (max-width: 900px) { .main { --page-pad: .85rem; } }
.main > .alert-bar { margin-left: max(var(--page-pad), calc((100% - var(--page-cur)) / 2 + var(--page-pad))); margin-right: max(var(--page-pad), calc((100% - var(--page-cur)) / 2 + var(--page-pad))); }
/* 只截重载失败、证书、大陆连通这三条(名单可能很长,全文在 title);更新回滚、容灾这类要看全文的不截 */
.main > :is(#reload-bar, #cert-bar, #reach-bar-top) > span:first-child { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
@media (max-width: 700px) {
  .main > .alert-bar { flex-direction: column; align-items: stretch; gap: .35rem; }
  .main > :is(#reload-bar, #cert-bar, #reach-bar-top) > span:first-child { -webkit-line-clamp: 3; }
  .main > .alert-bar > .row, .main > .alert-bar > .btn { align-self: flex-end; }
}
/* 主机容灾的顶部条:一次性提示最多同时露两条、其余折叠成「还有 N 条」,由 ha.js 的 haNotices 管(这里不按数量藏,藏了展开也看不到)。
   概况页上失联、写操作暂停这两条由「需要处理」那一行代替 */
.main:has(> #page[data-page="dashboard"]) > .alert-bar:is([data-ha="ha-lost"], [data-ha="ha-frozen"]) { display: none; }

/* 长表:表格自带限高滚动区,表头吸在区域顶部,横向滚动条始终在视口里;排成卡片 / 两行一台时不要内滚区,跟着页面滚。
   这里的高度只是页面刚画出来那一瞬间的估值:app.js 的 fitFill 随后按量出来的位置把框正好撑到窗口底(整页就不用再滚,
   只留表格里一条滚动条),窗口太矮时改成不限高、跟着整页滚。嵌在别处的(外部节点展开的面板)仍按这里的估值限高。 */
.table-wrap.fill { overflow: auto; max-height: max(18rem, calc(100vh - var(--topbar-h) - var(--fill-reserve, 7.5rem))); max-height: max(18rem, calc(100dvh - var(--topbar-h) - var(--fill-reserve, 7.5rem))); }
.table-wrap.fill:has(> table.grid.cards), .table-wrap.fill:has(> table.grid.rows2) { overflow: visible; max-height: none; }
/* 单元格里很长的一段(上游名):一行省略,全文在 title */
.cell-clip { display: inline-block; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.grid.no-p3 .cell-clip { max-width: 6.5rem; }
.pc-err { color: var(--danger); font-size: .85rem; padding: .5rem 0; }
.switch.sm { width: 28px; height: 16px; vertical-align: middle; }
.switch.sm span::before { width: 12px; height: 12px; }
.switch.sm input:checked + span::before { transform: translateX(12px); }
.grid-2.pc-cols { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .grid-2.pc-cols { grid-template-columns: 1fr; } }

/* chip 折叠:前 N 个 + 「+N」;展开后在原地限高滚动 */
.fold:not(.open) > .fold-x { display: none; }
.fold-x { display: contents; }
.chip.more { cursor: pointer; background: transparent; border-style: dashed; color: var(--primary-text); font: inherit; font-size: .76rem; line-height: inherit; }
/* 展开后限高滚动只在宽屏;手机上原地展开(内滚区和页面滚动抢手势) */
@media (min-width: 701px) { .chips.fold.open { max-height: 18rem; overflow-y: auto; align-content: flex-start; } }
td .chips { display: inline-flex; vertical-align: middle; }

/* 抽屉三档:默认 34rem;详情(用户 / 代理 / 线路)37rem;接口文档 46rem(大屏 56rem)。
   详情以前也是 46rem:在一千二三宽的窗口里占掉大半屏,里面的内容其实用不了这么宽,摊得又散又空 —— 用户看了说太宽、不好看。 */
.drawer.wide { --drawer-w: 37rem; }
.drawer.xl { --drawer-w: 46rem; }
@media (min-width: 1800px) { .drawer.xl { --drawer-w: 56rem; } }

/* 长勾选列表:筛选 / 全选 / 全不选 / 计数 */
.cl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin-bottom: .35rem; }
.cl-tools .cl-q { flex: 1 1 10rem; max-width: 16rem; }

/* 线路 × 服务器选择器:搜索 + 服务器筛选(可换行 / 下拉)+ 按线路分组的三态勾选 + 服务器 chip */
.lp-head { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; margin-bottom: .45rem; }
.lp-head .lp-q { flex: 1 1 12rem; max-width: 18rem; }
.lp-head select.lp-node { width: auto; max-width: 16rem; }
.lp-head .lp-only { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.lp-head .lp-count { white-space: nowrap; }
.lp-nodetabs { display: flex; flex-wrap: wrap; gap: .3rem; }
.lp-nodetabs button { border: 1px solid var(--border-strong); background: transparent; border-radius: var(--radius-sm); padding: .2rem .55rem; font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.lp-nodetabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.lp-nodetabs button.active .muted { color: inherit; opacity: .8; }
.lp-body { max-height: min(55vh, 30rem); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.lp-body > .check-list { max-height: none; border: none; background: transparent; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.lp-body > .hint { margin: 0; padding: .6rem .7rem; }
.lp-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .2rem .5rem; align-items: center; padding: .35rem .6rem; border-bottom: 1px solid var(--border); }
.lp-line:last-child { border-bottom: none; }
.lp-line > label { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .84rem; }
.lp-line .lp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lp-line .lp-n { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.lp-line .lp-x { display: inline-grid; place-items: center; width: 24px; height: 24px; border: none; border-radius: var(--radius-xs); background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.lp-line .lp-x:hover { background: var(--surface-3); color: var(--text); }
.lp-nodes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem; padding-left: 1.6rem; }
.lp-chip { font: inherit; font-size: .76rem; cursor: pointer; color: var(--muted); }
.lp-chip.on { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.lp-chip:disabled { cursor: default; opacity: .6; }
/* 中转入口的 chip:虚线边、前面一个 ⇄,和服务器的分得开(勾上以后也留着虚线) */
.lp-chip.lp-relay { border-style: dashed; }
.lp-chip.lp-relay.on { border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.lp-ric { margin-right: .28em; opacity: .7; font-size: .95em; }
.lp-via { margin-left: .35em; color: var(--muted); font-size: .92em; white-space: nowrap; }
.up-list-wrap > .check-list { max-height: min(55vh, 30rem); }

/* 外部节点展开面板:自身不把外表撑宽(contain),子表限高滚动、表头吸顶、前两列吸左 */
.ext-panel { contain: inline-size; scroll-margin-top: calc(var(--topbar-h) + .5rem); }
@supports not (contain: inline-size) { .ext-panel { width: 0; min-width: 100%; } }
.ext-tools { row-gap: .4rem; }
/* 「含已隐藏」「测速全部」靠右;放不下时整组折到下一行,还是靠右 */
.ext-tools .ext-acts { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-left: auto; }
/* 节点列表滚到头不带着整页走(用户 11-22「上面的操作按钮应该常驻 只是列表滚动」):列表框的高度见 app.js fitFill */
.ext-wrap { overscroll-behavior: contain; }
.ext-grid th.sortable { cursor: pointer; }
.ext-sum { display: flex; flex-direction: column; align-items: flex-start; gap: .05rem; line-height: 1.25; }
.ext-sum .sub { font-size: .72rem; color: var(--muted); white-space: nowrap; }
/* 汇总格本身是个按钮(点开看逐台延迟):去掉浏览器默认的灰底边框,悬停时下划线提示能点 */
button.ext-sum { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.ext-sum:hover .sub, button.ext-sum:hover .muted { text-decoration: underline; }
/* 手机卡片里其它值都靠右,汇总格也靠右 */
@media (max-width: 700px) { button.ext-sum { margin-left: auto; align-items: flex-end; text-align: right; } }
.ext-more { display: flex; justify-content: center; padding: .5rem; }
.ext-cols .menu-list { max-height: 60vh; overflow: auto; min-width: 14rem; }
.ext-cols .menu-list label { display: flex; align-items: center; gap: .4rem; padding: .25rem .5rem; font-size: .82rem; white-space: nowrap; }
@media (min-width: 701px) {
  .ext-grid > thead th { position: sticky; top: 0; z-index: 3; }
  .ext-grid > * > tr > :nth-child(1) { position: sticky; left: 0; z-index: 2; width: 2.4rem; min-width: 2.4rem; background: var(--surface); }
  .ext-grid > * > tr > :nth-child(2) { position: sticky; left: 2.4rem; z-index: 2; min-width: 13rem; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .ext-grid > thead > tr > :nth-child(-n+2) { z-index: 4; background: var(--surface-2); }
  .ext-grid > tbody > tr:hover > :nth-child(-n+2) { background: var(--surface-2); }
}
@media (max-width: 700px) { .ext-grid .srv, .ext-view { display: none !important; } }

/* 上游延迟列:服务器多时的汇总 */
.up-sum { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }

/* ===================== 概况 ===================== */
/* 栅格:最多 4 列,列数由容器宽度决定(不足 47rem 1 列、47rem 起 2 列、71rem 起 3 列、95rem 起 4 列);dense 回填换行留下的洞。
   同一行的卡片拉成一样高。大卡片(流量走势、最近入站连接)占两列,但都不跨行:跨两行时它的高度由旁边两张卡片定,
   生产上在线 15 人、排行 10 个、操作 10 条,图下面就空出一大块(把图拉长又变形、太高)—— 用户 N1。
   现在每一行放内容量相当的几张卡片,行高由它们自己定,数据多少都不留大块空白 */
.dash-grid { container-type: inline-size; display: grid; gap: 1rem; align-items: stretch; grid-auto-flow: row dense;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(23rem, calc((100% - 3rem) / 4))), 1fr)); }
.dash-grid > * { margin: 0; min-width: 0; }
.dash-grid > .span-all { grid-column: 1 / -1; }
@container (min-width: 47rem) { .dash-grid > .span-2 { grid-column: span 2; } }
/* 2 列:流量走势(两列);上游巡检 | 当前在线;最近入站连接(两列);流量排行 | 最近操作;数据面 | 核心日志。
   3 列:流量走势(两列)| 上游巡检;当前在线 | 最近入站连接(两列);流量排行 | 最近操作 | 数据面;核心日志整行。代理面板:当前在线 | 快到期 / 快用完 */
@container (min-width: 71rem) and (max-width: 94.99rem) {
  .dash-grid.rs > #dash-online-card { grid-row: span 2; }
  .dash-grid > .dash-log-card { grid-column: 1 / -1; }
}
/* 4 列:流量走势(两列)| 上游巡检 | 当前在线;最近入站连接(两列)| 流量排行 | 最近操作;数据面 | 核心日志(三列) */
@container (min-width: 95rem) {
  .dash-grid > .dash-log-card { grid-column: span 3; }
}
/* 3 列、4 列时流量走势和别的卡片同一行:当前在线人多(15 个长名字)时那一行比图高几十像素,图跟着补上这一截,
   只在 210~320 像素之间变(dashboard.js 的 chartHeight),不会被拉得过高、也不会变形。图绝对定位,不反过来撑高这一行 */
@container (min-width: 71rem) {
  .dash-grid > #dash-chart-card { display: flex; flex-direction: column; }
  .dash-grid > #dash-chart-card > #dash-chart { position: relative; flex: 1 1 auto; min-height: 15.75rem; }
  .dash-grid > #dash-chart-card > #dash-chart > .chart-wrap { position: absolute; inset: 0; }
}
/* 最近操作:两列及以上时能放几条显示几条(dashboard.js 的 fitAudit),列表本身不撑高这一行;放不下的整条藏起来 */
@container (min-width: 47rem) {
  .dash-grid > #dash-audit-card { display: flex; flex-direction: column; }
  .dash-grid > #dash-audit-card > #dash-audit { position: relative; flex: 1 1 auto; min-height: 9.5rem; overflow: hidden; }
  .dash-grid > #dash-audit-card > #dash-audit > .audit-list { position: absolute; inset: 0 0 auto 0; }
}
.audit-list > li[hidden] { display: none; }
/* 上游巡检全部正常:卡片正中一个轻量的圆形对勾,下面一句话和上次巡检的时间(用户 N8) */
#dash-health-card { display: flex; flex-direction: column; }
#dash-health { flex: 1 1 auto; display: flex; flex-direction: column; }
.hc-ok { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .65rem; min-height: 8rem; padding: .5rem 0 .25rem; text-align: center; }
.hc-txt { display: flex; flex-direction: column; align-items: center; gap: .35rem; max-width: 100%; }
.hc-txt > b { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.hc-ok-ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.hc-ok-ic > svg { width: 24px; height: 24px; }
/* 两列起(桌面):卡片和同一行的卡片等高,比手机上高出一截,圆标跟着大一号。用户 11-22:「手机端的大小合适 但是桌面端要偏小了点」
   (那次手机上「撑满半屏的对勾」是浏览器用了缓存里的旧样式,刷新就好了,见 web/server.go assetCache) */
@container (min-width: 47rem) {
  #dash-health .hc-ok-ic { width: 56px; height: 56px; }
  #dash-health .hc-ok-ic > svg { width: 30px; height: 30px; }
}
/* 故障不多时同一个版式:浅红的「!」,标题用危险色,下面一行一条不通的上游 */
.hc-bad .hc-ok-ic { background: var(--danger-soft); color: var(--danger); }
.hc-bad .hc-txt > b { color: var(--danger-text); }
.hc-bad-list { display: flex; flex-direction: column; align-items: center; gap: .3rem; max-width: 100%; margin: .1rem 0 .15rem; }
.hc-bad-nm { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.hc-bad-nm:hover { color: var(--primary-text); text-decoration: none; }
.hc-bad-nm > .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-bad-nm > .badge { flex: none; }
.dash-grid .card-head h2 { min-width: 0; }
/* 手机上标题按自己的宽度排,放不下时把右边的分段按钮 / 刷新换到下一行,不再把标题挤成一字一行 */
@media (max-width: 700px) { .dash-grid .card-head h2 { flex: 1 1 auto; } }
/* 统计条是网格里占整行的一项:2×3 / 3×2 / 一行 6 张,单数时最后一张占满一行 */
.dash-grid > .stats { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid > .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
@container (min-width: 40rem) { .dash-grid > .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash-grid > .stats > .stat:last-child:nth-child(odd) { grid-column: auto; } }
@container (min-width: 66rem) { .dash-grid > .stats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }
.stat { min-width: 0; }
.stat .k, .stat .v, .stat .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .k { display: block; }
.stat.warn .k::before { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.stat.warn .s { color: var(--warn-text); }
.stats.stale { opacity: .7; }
/* 三行共用一套列(subgrid):标签列按最长的标签定宽,英文的 Memory 不会压到进度条上,三条进度条照样对齐。
   不认识 subgrid 的浏览器丢掉后一条,用前一条的固定列宽(每行各自成网格,标签列定宽才能对齐) */
.meters { display: grid; grid-template-columns: max-content minmax(0, 1fr) 2.6rem; gap: .25rem .35rem; margin-top: .3rem; }
.meter { grid-column: 1 / -1; display: grid; grid-template-columns: 4.2em minmax(0, 1fr) 2.6rem; column-gap: .35rem; grid-template-columns: subgrid; align-items: center; font-size: .74rem; color: var(--muted); }
.meter .progress { margin: 0; min-width: 0; }
.meter > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
/* 卡片头的小字:人数、口径、过期徽章 */
.h-count, .scope { font-weight: 400; color: var(--muted); font-size: var(--fs-sm); margin-left: .4rem; font-variant-numeric: tabular-nums; }
.dash-stale { margin-left: .4rem; font-weight: 500; }
.card-foot { margin-top: .75rem; font-size: var(--fs-sm); display: flex; gap: .8rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.dash-err { color: var(--danger); font-size: .85rem; padding: .6rem 0; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.dash-err .msg { min-width: 0; overflow-wrap: anywhere; }
.dash-loading { color: var(--muted); font-size: .82rem; padding: .8rem 0; }
.row.wrap { flex-wrap: wrap; gap: .35rem; }
.help-tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: help; vertical-align: 1px; margin-left: .3rem; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.dash-q { width: 11rem; max-width: 100%; }
.seg.sm button { height: calc(var(--ctl-h-sm) - 6px); padding: 0 .55rem; font-size: var(--fs-xs); }

/* 需要处理:标题下面一行小标签,不是卡片 —— 每项一个小圆角条:圆点、一句话、涉及的名字、动作。没有要处理的这一行整个不出现。
   前两版都被用户否了(2026-11-17):最早每一项是一个带底色和边框的大框(卡片里又套框);改成细线分隔的列表后仍然是
   一整条通栏卡片 ——「现在还是很重 不要这种大横幅」。所以不要容器、不要通栏:事情少就是一行里的一两个小条。 */
.attn-strip { min-width: 0; padding: 0 .1rem; }
.attn-strip:has(> #dash-attn:empty) { display: none; }
/* 前面原来有「需要处理 2 项」几个字(用户 11-17:「这个其实是不需要的」):小条自己带着圆点和「去处理」,不用再报一遍标题 */
.attn-strip > #dash-attn { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; }
/* 一行放不下时(dashboard.js 的 fitAttn 量出来的):等宽的几列,能排几列排几列;每条里动作靠右,
   名字那一段先让位(放不下省略,悬停看全),那句话最后才省略。不让小条自己折行:长短不一地叠着,比整齐的几列难看 */
.attn-strip > #dash-attn.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(0, var(--attn-w, 100%))); justify-content: start; align-items: stretch; }
#dash-attn.cols .attn li { display: flex; max-width: none; }
#dash-attn.cols .attn .what { flex: 1 1 0; min-width: 0; overflow: hidden; }
#dash-attn.cols .attn .ttl { flex-shrink: 0; } /* 列宽是按「那句话放得全」算出来的:让位的只有名字 */
#dash-attn.cols.tight .attn .ttl { flex-shrink: 1; } /* 窄到连一句话都放不下(列宽已经是整行):那句话也只好省略 */
#dash-attn.cols .attn .names { flex: 0 1 auto; }
#dash-attn.cols .attn .acts { margin-left: auto; }
#dash-attn.cols > .card-foot, #dash-attn.cols > .attn-ignored { grid-column: 1 / -1; }
.attn { display: contents; list-style: none; margin: 0; padding: 0; }
.attn li { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; max-width: 100%; min-height: 1.85rem; padding: .1rem .8rem .1rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-xs); }
.attn li.info { border-style: dashed; background: transparent; }
.attn .sev { flex: none; width: .42rem; height: .42rem; border-radius: 50%; background: var(--faint); }
.attn li.bad .sev { background: var(--danger); }
.attn li.warn .sev { background: var(--warn); }
.attn .what { min-width: 0; display: flex; align-items: baseline; gap: .45rem; }
.attn .ttl { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .ttl b { font-weight: 600; color: var(--text); }
.attn li.info .ttl b { font-weight: 500; color: var(--text-2); }
.attn .parts { color: var(--muted); }
.attn .parts a { color: var(--primary-text); }
.attn .names { flex: 0 1 auto; min-width: 0; max-width: 14rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .names::before { content: '· '; color: var(--faint); }
.attn .acts { flex: none; display: flex; gap: .55rem; align-items: center; white-space: nowrap; padding-left: .1rem; }
.attn .acts a { font-weight: 500; }
.attn .acts .btn { height: auto; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; font-size: inherit; font-weight: 500; color: var(--primary-text); }
.attn .acts .btn:hover { background: none; text-decoration: underline; }
.attn .acts .btn.ghost { color: var(--muted); }
.attn-ignored { display: contents; }
.attn-ignored > .link-btn { line-height: 1.85rem; }
#dash-attn > .card-foot { margin: 0; }
.attn-ok { color: var(--ok); font-size: .85rem; font-weight: 500; }

@media (max-width: 700px) {
  /* 手机:每项占一整行、只一行 —— 圆点、一句话、名字(放不下省略)、动作靠右。
     试过让小条按内容宽度排、放不下在条里折行:标题挤在左边一窄列,条里折成两行,参差不齐(用户 11-17:「移动端的提醒排版差劲」) */
  .attn-strip > #dash-attn { gap: .35rem; }
  .attn li { display: flex; width: 100%; border-radius: .7rem; padding: .25rem .7rem .25rem .65rem; }
  .attn .what { flex: 1 1 0; overflow: hidden; }
  .attn .names { flex: 1 1 0; max-width: none; }
  .attn .acts { margin-left: auto; }
}

/* 「开始使用」三步都做完:「✓ 已经可以用了」和 Star 一行 */
.qs-done { display: flex; align-items: center; gap: .5rem .8rem; flex-wrap: wrap; }
.qs-ok > .i { color: var(--ok); }
.qs-done .grow { flex: 1; }

/* 当前在线:名字过长省略;展开 / 搜索结果在 18rem 里滚动 */
#dash-online .chip { display: inline-flex; align-items: center; max-width: 15rem; gap: .15rem; }
#dash-online .chip .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (min-width: 701px) { .chips.scroll { max-height: 18rem; overflow-y: auto; align-content: flex-start; } }

/* 上游巡检:一条上游一行 */
.up-bad { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.up-bad li { display: grid; grid-template-columns: minmax(0, max-content) auto; justify-content: start; gap: .5rem; align-items: center; font-size: .84rem; }
.up-bad .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--danger); }


/* 最近入站连接:定宽列,展开全部时限高滚动、表头吸顶;窄屏两行紧凑排 */
/* 百分比列合计不超过约 74%:后面「次数」「最近」两列是固定宽(4.2rem + 6.5rem),这张卡宽屏时只占两列(约 700 像素),合计超了「最近」会被挤成「刚…」 */
table.grid.conns col.c-ip { width: 28%; } table.grid.conns col.c-user { width: 20%; } table.grid.conns col.c-line { width: 25%; }
table.grid.conns col.c-cnt { width: 4.2rem; } table.grid.conns col.c-last { width: 6.5rem; }
table.grid.conns.srv col.c-ip { width: 24%; } table.grid.conns.srv col.c-user { width: 15%; } table.grid.conns.srv col.c-line { width: 20%; } table.grid.conns.srv col.c-srv { width: 15%; }
table.grid.conns .ipc { display: flex; align-items: center; gap: .3rem; min-width: 0; }
table.grid.conns .ipv { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
table.grid.conns .ipc .badge { flex: none; }
table.grid.conns tr.rej td { background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.conns-wrap.capped { max-height: 26rem; overflow: auto; }
.conns-tools { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; flex-wrap: wrap; }
@media (max-width: 700px) {
  table.grid.conns { table-layout: auto; display: block; }
  table.grid.conns colgroup, table.grid.conns thead { display: none; }
  table.grid.conns tbody { display: block; }
  table.grid.conns tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .05rem .55rem; padding: .4rem .6rem; border-bottom: 1px solid var(--border); }
  table.grid.conns td { display: block; padding: 0; border: none; max-width: 100%; }
  table.grid.conns td.ip { flex: 1 1 60%; min-width: 0; white-space: normal; }
  table.grid.conns td.last { margin-left: auto; color: var(--muted); }
  table.grid.conns td.user, table.grid.conns td.line, table.grid.conns td.srv, table.grid.conns td.cnt { font-size: .76rem; color: var(--muted); flex: 0 1 auto; min-width: 0; max-width: 46%; white-space: nowrap; }
}

/* 最近操作 / 代理名单:一行一条,省略号 + title */
.audit-list, .mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .32rem; font-size: .84rem; }
.audit-list li { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); gap: .6rem; }
.audit-list .when { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-list .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list li { display: flex; gap: .5rem; align-items: center; justify-content: space-between; min-width: 0; }
.mini-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 数据面:6 行,长的省略 */
.kv { grid-template-columns: auto minmax(0, 1fr); }
.kv dd.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
button.badge { cursor: pointer; font: inherit; font-size: .72rem; }

/* 核心日志:一直开着,和同一排的卡片(本机 · 数据面)一样高,日志在卡片里面滚。
   日志框自己不撑高度(绝对定位铺满一个弹性的格子,格子最少 11rem):同排有别的卡片就跟它一样高,自己占一整排时就是十来行。
   以前可以折起、展开后是固定 320px 高:比旁边的卡片长出一截 —— 用户 11-17:「没必要收起 展开后的长度也偏长 可以跟左边的数据面卡片一样的长度 并且日志里有滑条」 */
/* 卡片标题旁边的小链接(「全部记录 →」「完整日志 →」):以前在卡片最下面单独占一行,挪上来以后那一行的地方给内容用
   (用户 11-17:「可以在各自的卡片标题旁边 这样…可以显示的稍微多一点点数据」) */
.card-head h2 > .h-link { margin-left: .7rem; font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.dash-log-card { display: flex; flex-direction: column; }
.dash-logbox { position: relative; flex: 1 1 auto; min-height: 11rem; }
.dash-logbox > pre.log { position: absolute; inset: 0; max-height: none; }

/* 设置页:左边一列分区导航(吸在顶栏下面,跟着滚动高亮),右边一列分区卡片;卡片里一项设置一行 —— 左名称与说明,右控件,开关靠右 */
.settings { display: grid; grid-template-columns: 11.5rem minmax(0, 58rem); gap: 0 2rem; align-items: start; }
.set-nav { position: sticky; top: calc(var(--topbar-h) + 1.25rem); display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - var(--topbar-h) - 2.5rem); max-height: calc(100dvh - var(--topbar-h) - 2.5rem); overflow-y: auto; scrollbar-width: none; }
.set-nav a { display: block; padding: .42rem .75rem; border-radius: var(--radius-sm); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .12s, color .12s; }
.set-nav a:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.set-nav a.active { color: var(--text); background: var(--nav-active); font-weight: 600; }
/* 分组名(和侧栏的组名一个样子);第一组顶上不留空 */
.set-nav-g { padding: .75rem .75rem .25rem; font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: .02em; text-transform: uppercase; user-select: none; }
.set-nav-g:first-child { padding-top: .1rem; }
.set-nav-sep { height: 1px; margin: .55rem .75rem; background: var(--divider); }
.set-sec.flash { animation: sec-flash 2.6s ease; }
@keyframes sec-flash { 0%, 55% { box-shadow: 0 0 0 3px var(--primary-ring); } 100% { box-shadow: var(--shadow-xs); } }
.set-main { min-width: 0; }
.set-sec { scroll-margin-top: calc(var(--topbar-h) + 1rem); padding: 1.1rem 1.35rem 1.2rem; }
.set-sec > .card-head { margin-bottom: .6rem; }
.set-sec > .card-head h2 { display: flex; align-items: center; gap: .5rem; font-size: var(--fs-lg); }
.set-rows { display: flex; flex-direction: column; }
.set-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: .5rem 2rem; align-items: start; padding: .95rem 0; border-top: 1px solid var(--divider); }
.set-rows > .set-row:first-child { border-top: none; }
.set-row.bool { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.set-row.stack { grid-template-columns: minmax(0, 1fr); }
.set-label { display: block; font-size: var(--fs-base); font-weight: 500; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.set-help { margin-top: .25rem; font-size: var(--fs-xs); line-height: 1.65; color: var(--muted); overflow-wrap: anywhere; }
.set-ctl { min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.set-ctl input[type=number] { max-width: 10rem; }
.set-ctl textarea:not(.code-area) { font-family: inherit; font-size: var(--fs-base); }
.set-ctl .count { align-self: flex-end; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.set-ctl .count.over { color: var(--danger); font-weight: 600; }
.set-row.bool .set-ctl { align-items: flex-end; }
/* 宽屏(用户 N9:1920 宽时右边空着 600 像素):主栏放宽;卡片够宽时里面的设置排两列,长文本、代码框、勾选组这类整行的照旧占满。
   按卡片自己的宽度切(容器查询),窄窗口、侧栏展开时照旧一列 */
.set-sec { container-type: inline-size; }
@media (min-width: 1500px) { .settings { grid-template-columns: 11.5rem minmax(0, 84rem); } }
@container (min-width: 60rem) {
  .set-rows { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 3rem; }
  /* 第一行是两个半宽的格子时,第二个格子也是第一行,上面不画线;第一行占整行(比如页面伪装的总开关)时第二个格子在第二行,照常画线 */
  .set-rows > .set-row:first-child:not(.stack):not(.wide) + .set-row:not(.stack):not(.wide) { border-top: none; }
  .set-rows > .set-row.stack, .set-rows > .set-row.wide { grid-column: 1 / -1; }
  /* 半宽的格子里:输入类的标题和说明放上面、输入框放下面(左右分时说明挤成五六行,输入框旁边空一大块);开关类照旧左右排 */
  .set-rows > .set-row:not(.bool) { grid-template-columns: minmax(0, 1fr); gap: .55rem; align-content: start; }
}
.set-sec > .set-rows + .logo-field, .set-sec > .set-rows + .row { margin-top: .2rem; padding-top: .95rem; border-top: 1px solid var(--divider); }
/* 页面伪装(用户 N2):这一节下面的预览 —— 左边一个缩小的浏览器窗口(按 1024 宽排版再整体缩小,点了放大看),
   右边站名、换一个样子、开启后在哪些地方显示。卡片窄时上下排;并排时窗口和右边一栏一样高(露出的页面多一些,下面不留空) */
.set-sec > .set-rows + .camo-box { margin-top: .2rem; padding-top: 1rem; border-top: 1px solid var(--divider); }
.camo-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .85rem; }
.camo-head h3 { margin: 0; font-size: var(--fs-base); font-weight: 600; color: var(--text); }
.camo-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem 1.75rem; }
@container (min-width: 42rem) { .camo-grid { grid-template-columns: minmax(0, min(34rem, 54%)) minmax(0, 1fr); } }
.camo-win { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.camo-win:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.camo-hit { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: zoom-in; }
.camo-hit:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.camo-bar { display: flex; flex: none; align-items: center; gap: .3rem; height: 1.85rem; padding: 0 .65rem; background: var(--surface-3); border-bottom: 1px solid var(--border); }
.camo-bar > i { width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: var(--border-strong); }
.camo-url { flex: 0 1 18rem; min-width: 0; margin-left: .55rem; height: 1.2rem; line-height: 1.2rem; padding: 0 .7rem; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camo-shot { position: relative; display: block; flex: 1 0 auto; aspect-ratio: 16 / 10; overflow: hidden; background: #f7f8fa; }
.camo-shot iframe { position: absolute; left: 0; top: 0; width: 1024px; height: 1400px; border: 0; background: #fff; transform-origin: 0 0; transform: scale(var(--camo-s, .35)); pointer-events: none; }
.camo-name { font-size: var(--fs-md); font-weight: 650; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.camo-kind { margin-top: .15rem; font-size: var(--fs-xs); color: var(--muted); }
.camo-acts { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.camo-acts .i { margin-right: .3rem; }
.camo-note { margin: .5rem 0 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--faint); }
.camo-ph { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; font-size: var(--fs-xs); color: var(--text-2); }
.camo-ph::before { content: ""; flex: none; width: .4rem; height: .4rem; border-radius: 50%; background: var(--ok); }
.camo-ph.wait::before { background: var(--primary); }
.camo-ph.warn { color: var(--warn-text); }
.camo-ph.warn::before { background: var(--warn); }
.camo-ph.off::before { background: var(--faint); }
.camo-ph[title] { cursor: help; }
.camo-wh { margin: 1.1rem 0 .55rem; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: .02em; }
/* 开启后显示的地方:左边一列小标题(端口 / 线路 / 80·443),右边一排小标签,下面一行小字 */
.camo-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .55rem .9rem; margin: 0; }
.camo-dl dt { padding-top: .2rem; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.camo-dl dd { margin: 0; min-width: 0; }
.camo-dl small { display: block; margin-top: .25rem; font-size: var(--fs-xs); line-height: 1.5; color: var(--faint); }
.camo-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.camo-tag { display: inline-flex; align-items: center; gap: .35rem; height: 1.45rem; padding: 0 .55rem; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.camo-tag::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--ok); }
.camo-tag.off { color: var(--muted); }
.camo-tag.off::before { background: var(--border-strong); }
.camo-tag.warn { background: var(--warn-soft); color: var(--warn-text); }
.camo-tag.warn::before { background: var(--warn); }
.camo-tag.wait::before { background: var(--primary); }
.camo-tag[title] { cursor: help; }
.camo-foot { margin: .9rem 0 0; padding-top: .75rem; border-top: 1px dashed var(--divider); font-size: var(--fs-xs); line-height: 1.6; color: var(--faint); }
/* 页面伪装:宽屏两列时「跳转到」那一行(占整行)排在「伪装成」「80 / 443」两项后面;一列时紧跟在「伪装成」下面 */
@container (min-width: 60rem) { .set-rows > .set-row.camo-rd-row { order: 1; } }
.set-row.camo-rd-row .set-ctl input { max-width: 42rem; }
/* 跳转模式:窗口里画「有人打开 → 302 → 你的网站」 */
.camo-rdbody { flex: 1 0 auto; display: grid; align-content: center; gap: .65rem; min-height: 13rem; padding: 1.4rem 1.3rem; background: var(--surface-2); }
.camo-rdrow { display: grid; gap: .3rem; min-width: 0; }
.camo-rdk { font-size: var(--fs-xs); color: var(--muted); }
.camo-rdrow code { padding: .4rem .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-family: var(--mono); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.camo-rdrow code.muted { color: var(--faint); }
.camo-rdarrow { display: flex; align-items: center; gap: .4rem; padding-left: .7rem; color: var(--primary-text); font-size: var(--fs-xs); font-weight: 600; }
.camo-rdarrow .i { transform: rotate(90deg); }
.camo-target { font-family: var(--mono); overflow-wrap: anywhere; }
.camo-kind.danger-text { color: var(--danger-text); }
.set-row[hidden] { display: none; }
.camo-zoom { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.camo-zoom .camo-url { flex-basis: 24rem; }
.camo-zoom iframe { display: block; width: 100%; height: min(66vh, 44rem); height: min(66dvh, 44rem); border: 0; background: #fff; }
.camo-zoom-hint { margin-top: .6rem; }
/* 窄一点:导航横到上面,能左右滑;再窄(手机):一行里名称在上、控件在下,开关仍和名称同一行 */
@media (max-width: 1080px) {
  .settings { grid-template-columns: minmax(0, 1fr); }
  .set-nav-g, .set-nav-sep { display: none; } /* 导航横过来时不要组名 */
  .set-nav { position: static; flex-direction: row; max-height: none; overflow-x: auto; margin: 0 0 .9rem; padding-bottom: .15rem; }
  .set-nav a { flex: none; }
}
@media (max-width: 700px) {
  .set-sec { padding: 1rem 1rem 1.05rem; }
  .set-row { grid-template-columns: minmax(0, 1fr); gap: .5rem; padding: .85rem 0; }
  .set-ctl input[type=number] { max-width: none; }
}
.stat .s:empty::before { content: "\00a0"; }

/* 限时彩蛋的位置(见 js/xmas.js):空着不占位 */
.xmas-slot { display: inline-flex; align-items: center; }
.xmas-slot:empty { display: none; }

/* 线路详情:四格概要、可选服务器的流量图、各服务器一行一台(多了限高滚动)、在线用户与 IP(分页 + 折叠) */
.drawer-head h2 { min-width: 0; overflow-wrap: anywhere; }
.ld-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-bottom: .95rem; }
.ld-tile { display: flex; flex-direction: column; gap: .1rem; min-width: 0; padding: .5rem .65rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.ld-tile > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-tile .lb { font-size: .74rem; color: var(--muted); }
.ld-tile b { font-size: 1.05rem; }
/* 线路详情:测大陆连通 —— 一个地址一行(圆点、名字、地址、三家运营商的小标、结论),没有框也没有表头;解释在悬停里 */
.ld-reach { margin: 0 0 .9rem; }
.ld-reach-h { display: flex; align-items: baseline; gap: .55rem; margin-bottom: .15rem; color: var(--muted); font-size: .78rem; }
.ld-reach-h b { font-size: .84rem; font-weight: 600; color: var(--text); }
.ld-rrow { display: grid; grid-template-columns: 8px minmax(3.5rem, 9rem) minmax(0, 1fr) auto minmax(3.2rem, auto); align-items: center; column-gap: .6rem; min-height: 1.95rem; padding: .1rem 0; font-size: .84rem; }
.ld-rrow + .ld-rrow { border-top: 1px solid var(--divider); }
.ld-rrow .dot { margin: 0; }
.ld-rrow .dot.ok { background: var(--ok); } .ld-rrow .dot.warn { background: var(--warn); } .ld-rrow .dot.danger { background: var(--danger); }
.ld-rrow .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-rrow .ad { color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-rrow .cs { display: flex; gap: .25rem; }
.ld-rrow .vd { text-align: right; white-space: nowrap; font-weight: 500; }
.ld-rrow .vd.muted { font-weight: 400; }
.ld-rrow .vd[title] { cursor: help; }
.ld-reach .hint { margin: .35rem 0 0; }
.ld-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.drawer-body .ld-head h3 { margin: 0 auto 0 0; min-width: 0; }
.ld-head select { width: auto; max-width: 14rem; }
.ld-head input[type=search] { width: 14rem; max-width: 100%; }
.ld-slist { display: flex; flex-direction: column; gap: .15rem; }
.ld-slist.capped { max-height: 18rem; overflow-y: auto; }
.ld-srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(3rem, 18%) 5.4rem minmax(0, 11rem) 4.8rem; gap: .6rem; align-items: center; width: 100%; padding: .32rem .5rem; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; font: inherit; font-size: .84rem; color: inherit; text-align: left; }
button.ld-srow { cursor: pointer; }
button.ld-srow:hover { background: var(--surface-2); }
.ld-srow.on { border-color: var(--primary); background: var(--primary-soft); }
.ld-srow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ld-srow.bad .nm { color: var(--muted); font-weight: 400; }
.ld-srow.off .err { color: var(--muted); }
.ld-bar { display: block; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.ld-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.ld-srow .val { text-align: right; white-space: nowrap; }
.ld-srow .ud { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-srow .on-n { text-align: right; white-space: nowrap; color: var(--muted); font-size: .78rem; }
.ld-srow .err { grid-column: 2 / 5; color: var(--danger); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-olist { display: flex; flex-direction: column; }
.ld-olist.capped { max-height: 24rem; overflow-y: auto; }
.ld-orow { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: .25rem .7rem; align-items: start; padding: .32rem .2rem; border-bottom: 1px solid var(--border); font-size: .84rem; }
.ld-olist.srv .ld-orow { grid-template-columns: minmax(0, 10rem) minmax(0, 8rem) minmax(0, 1fr); }
.ld-orow .nm, .ld-orow .srv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.55rem; }
.ld-orow .srv { color: var(--muted); font-size: .78rem; }
.ld-orow .ips { min-width: 0; }
.ld-orow .ips .chip { font-size: .74rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) {
  .ld-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 测大陆连通:手机上地址落到名字下面一行 */
  .ld-rrow { grid-template-columns: 8px minmax(0, 1fr) auto auto; row-gap: 0; padding: .3rem 0; }
  .ld-rrow .ad { grid-column: 2 / -1; grid-row: 2; }
  .ld-srow { grid-template-columns: minmax(0, 1fr) auto auto; }
  .ld-srow .ld-bar, .ld-srow .ud { display: none; }
  .ld-srow.bad { grid-template-columns: minmax(0, 1fr) auto; }
  .ld-srow.bad .err { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .ld-slist.capped, .ld-olist.capped { max-height: none; overflow: visible; }
  .ld-orow, .ld-olist.srv .ld-orow { grid-template-columns: minmax(0, 1fr) auto; }
  .ld-orow .srv { max-width: 9rem; text-align: right; }
  .ld-orow .ips { grid-column: 1 / -1; }
  .ld-head select { max-width: 100%; }
}

/* 用户详情:顶上一排操作、四格概要(沿用线路详情的 .ld-sum)、订阅地址与二维码并排 */
.ud-acts { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.ud-acts .grow { flex: 1; }
.ld-tile .sub { font-size: var(--fs-xs); color: var(--muted); white-space: normal; }
.ld-tile .sub .progress { margin-top: .35rem; min-width: 0; }
.ld-tile .of { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); }
.ld-tile.warn .sub { color: var(--warn-text); } .ld-tile.bad .sub { color: var(--danger-text); }
.ud-sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .9rem; align-items: start; }
.ud-sub .qr { margin: 0; width: 124px; height: 124px; }
.ud-urls { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.ud-url { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .35rem .6rem .35rem .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ud-url .lb { flex: none; min-width: 3.2em; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.ud-url code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ud-url .btn { flex: none; }
.ud-kv { grid-template-columns: max-content minmax(0, 1fr); }
@media (max-width: 700px) { .ud-sub { grid-template-columns: minmax(0, 1fr); } .ud-sub .qr { justify-self: start; } }
/* 线路的中转入口(勾选才展开):一条一块 —— 第一行「入口 中转:端口 → 出口 地址:端口  暂停 删除」,第二行订阅节点名与要做的事 */
.fw-box { container-type: inline-size; }
#f-fw { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem .75rem .6rem; margin-top: .5rem; background: var(--surface-2); }
.fw-item { display: flex; flex-direction: column; gap: .3rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.fw-item:first-child { border-top: none; }
.fw-path { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .45rem; min-width: 0; }
.fw-no { flex: none; width: 1.4rem; text-align: center; font-size: .78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.fw-lab { flex: none; font-size: .74rem; color: var(--muted); white-space: nowrap; }
.fw-from { display: flex; gap: .35rem; flex: 0 1 auto; min-width: 0; }
.fw-from:has(> .fw-host:not([hidden])) { flex: 1 1 18rem; } /* 别处的中转:地址框占剩下的宽度 */
.fw-from select { flex: 0 1 11rem; min-width: 0; }
.fw-from input { flex: 1 1 8rem; min-width: 0; }
.fw-from > [hidden] { display: none; }
.fw-colon { color: var(--muted); }
.fw-port { flex: none; width: 5.6rem; }
.fw-arrow { flex: none; color: var(--muted); font-size: 1rem; }
.fw-exit { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; }
.fw-exit select { min-width: 0; }
.fw-exit-name { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-dest-wrap { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.fw-dest { border: 0; background: none; padding: 0; font: inherit; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; cursor: pointer; }
.fw-dest:not(:disabled):hover { color: var(--primary-text); }
.fw-dest:disabled { cursor: default; }
.fw-target { width: 9rem; padding: .2rem .4rem; font-family: var(--mono); font-size: .78rem; }
.fw-dest-wrap [hidden] { display: none; }
.fw-tail { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.fw-pause { display: flex; align-items: center; gap: .25rem; font-size: .8rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.fw-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.1rem; padding-left: 1.85rem; font-size: .8rem; min-width: 0; }
.fw-nn { display: inline-flex; align-items: baseline; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.fw-nn .lab { color: var(--muted); margin-right: .4rem; white-space: nowrap; }
.fw-nn b { font-weight: 500; overflow-wrap: anywhere; }
.fw-name { width: 8rem; min-width: 4rem; padding: 0 .2rem; font-size: .8rem; font-weight: 500; border: 0; border-bottom: 1px dashed var(--border-strong); border-radius: 0; background: transparent; }
.fw-name:focus { border-bottom-color: var(--primary); outline: none; box-shadow: none; }
.fw-todo { flex: 1 1 16rem; min-width: 0; color: var(--muted); }
.fw-note { padding-left: 1.85rem; font-size: .76rem; color: var(--warn); }
.fw-note.bad { color: var(--danger); }
.fw-note[hidden] { display: none; }
.fw-item.paused .fw-from, .fw-item.paused .fw-port, .fw-item.paused .fw-exit, .fw-item.paused .fw-dest-wrap, .fw-item.paused .fw-result { opacity: .5; }
.fw-foot { margin: .5rem 0 0; }
/* 展开后最上面的小图:用户 → 中转 → 出口 → 网站 */
.fw-flow { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .5rem 0 .15rem; }
.fw-flow-node { padding: .16rem .62rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .8rem; font-weight: 500; white-space: nowrap; }
.fw-flow-node.relay { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.fw-flow-node.exit { border-color: var(--ok); color: var(--ok); }
.fw-flow-arrow { color: var(--muted); }
.fw-flow-note { margin: .3rem 0 .15rem; }
.fw-paren[hidden], .fw-dest-port[hidden] { display: none; }
#f-fw-add { margin-top: .4rem; }
.fw-badge { font-size: .7rem; padding: .05rem .4rem; margin-left: .3rem; vertical-align: 1px; cursor: help; }
@container (max-width: 560px) { /* 窄:不缩进,暂停和删除不顶到最右 */
  .fw-result, .fw-note { padding-left: 0; }
  .fw-from { flex-basis: 100%; }
  .fw-tail { margin-left: 0; }
}
.ld-fw { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; margin: -.35rem 0 .95rem; min-width: 0; }
.ld-fw .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-fw .chip.off, .chip.off { opacity: .6; }
.ld-orow .ips .chip.via { border-color: var(--primary); color: var(--primary-text); }

/* 面板换到新地址(panelmove.js) */
.pm-mask { z-index: 90; }
.pm-box { max-width: 30rem; }
.pm-body { padding: 0 1.1rem .4rem; display: flex; flex-direction: column; gap: .55rem; }
.pm-url { font-size: .9rem; overflow-wrap: anywhere; }
.pm-state { display: flex; align-items: center; gap: .55rem; margin: 0; font-size: .86rem; color: var(--muted); }
.pm-state.warn-text { color: var(--warn); }
.pm-spin { flex: none; width: 1rem; height: 1rem; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: pm-spin .8s linear infinite; }
@keyframes pm-spin { to { transform: rotate(360deg); } }
.pm-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem 1rem; }

/* 主机容灾:接任时接管什么(两个选项沿用模式选择的样式);选了接管订阅才出现的 DNS 接口 */
.ha-dns-box { margin: .55rem 0 .2rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ha-dns-box[hidden] { display: none; }
.ha-dns-box > .hint:first-child { margin-top: 0; }
/* 「测试」按钮和「清掉凭据」:窄屏时勾选框换到下一行,不被 .row input 撑开 */
.ha-dns-act { column-gap: .9rem; }
.ha-dns-act .field.check { flex-wrap: nowrap; margin: 0; }
.ha-dns-act .field.check input { flex: none; }

/* 概览卡片头:标题不折行,后面的口径说明(全部服务器 · 按倍率计)放不下就省略,不把右边的分段按钮挤到下一行 */
@media (min-width: 701px) {
  .dash-grid .card-head { flex-wrap: nowrap; }
  .dash-grid .card-head h2 { display: flex; align-items: baseline; min-width: 0; white-space: nowrap; overflow: hidden; }
  .dash-grid .card-head h2 > .scope { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .dash-grid .card-head h2 > :is(.h-count, .badge, .help-tip) { flex: none; }
  .dash-grid .card-head > :not(h2) { flex: none; }
}

/* ===== 图标 =====
   用蒙版画的小线条图标:<i class="i i-pencil"></i>,颜色跟文字、大小跟字号。模板里不再写 ✎ ▸ ✕ 这类字符(各系统字体里粗细大小都不一样) */
.i { display: inline-block; width: 1.05em; height: 1.05em; flex: none; vertical-align: -.16em; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.i-pencil { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16v4Z'/%3E%3Cpath d='m13.5 6.5 4 4'/%3E%3C/svg%3E"); }
.i-chev { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9.5 6 6 6-6 6'/%3E%3C/svg%3E"); transition: transform .15s; }
.i-chev.open { transform: rotate(90deg); }
.i-x { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.i-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.i-refresh { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.5 12a7.5 7.5 0 1 1-2.2-5.3'/%3E%3Cpath d='M19.5 4.5v4h-4'/%3E%3C/svg%3E"); }
.i-copy { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8.5' y='8.5' width='11' height='11' rx='2'/%3E%3Cpath d='M15.5 8.5V6.5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h2'/%3E%3C/svg%3E"); }
.i-plus { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.i-star { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='m12 3.2 2.7 5.6 6.1.8-4.5 4.2 1.2 6-5.5-3-5.5 3 1.2-6L3.2 9.6l6.1-.8L12 3.2Z'/%3E%3C/svg%3E"); }
.i-arrow { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E"); }
.i-grip { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Ccircle cx='9' cy='6' r='1.6'/%3E%3Ccircle cx='15' cy='6' r='1.6'/%3E%3Ccircle cx='9' cy='12' r='1.6'/%3E%3Ccircle cx='15' cy='12' r='1.6'/%3E%3Ccircle cx='9' cy='18' r='1.6'/%3E%3Ccircle cx='15' cy='18' r='1.6'/%3E%3C/svg%3E"); }
.i-warn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 21 19.5H3L12 4Z'/%3E%3Cpath d='M12 10v4.5M12 17h.01'/%3E%3C/svg%3E"); }

/* ================= 线路页与线路编辑框 ================= */
.lines-grid td.primary-cell { white-space: nowrap; }
.lines-grid td.primary-cell > a { max-width: 18em; }
.ln-proto { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.lines-grid.cards td.primary-cell { white-space: normal; }

/* 表单栅格里占两栏的格子 */
.form-grid > .span-2 { grid-column: span 2; }
@media (max-width: 700px) { .form-grid > .span-2 { grid-column: auto; } }

/* 线路编辑框:通栏、从上到下(不分左右两栏:服务器多少、加密方式要填多少都不一定,两栏总有一边空着)。
   基本信息一行四栏,窄了两栏、手机一栏 */
.ln-form .form-sec { margin: 1.3rem 0 .7rem; padding-top: 0; border-top: none; font-size: var(--fs-base); color: var(--text); }
.ln-head { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.7fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .ln-head, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ln-head, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }
/* 菜单里「名字 + 一句说明」的项:名字在上、说明在下(线路的快速添加、新增上游) */
details.menu .menu-list button:has(> b + span) { flex-direction: column; align-items: flex-start; gap: .05rem; padding: .5rem .7rem; white-space: normal; }
details.menu .menu-list button > b { font-weight: 600; }
details.menu .menu-list button > b + span { font-size: var(--fs-xs); line-height: 1.45; }
details.menu .menu-list:has(button > b + span) { min-width: 17rem; }
/* 选择框式的下拉(设置页「现成模板」):收起时和面板里的下拉框一个样子(边框、圆角、右边的小箭头),写着现在是哪一套;
   展开的清单和框一样宽,每项一行名字、一行介绍,现在这一套前面打勾 */
details.menu.pick { display: block; max-width: 34rem; }
details.menu.pick > summary.pick-box { display: flex; align-items: center; gap: .55rem; min-height: var(--ctl-h); padding: .4rem 1.9rem .4rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface) var(--chev) no-repeat right .6rem center / 12px; box-shadow: var(--shadow-xs); font-size: var(--fs-base); line-height: 1.4; transition: border-color .15s, box-shadow .15s; }
details.menu.pick > summary.pick-box:hover { border-color: color-mix(in srgb, var(--border-strong) 55%, var(--muted)); }
details.menu.pick[open] > summary.pick-box, details.menu.pick > summary.pick-box:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.pick-k { flex: none; color: var(--muted); font-size: var(--fs-sm); }
.pick-k::after { content: ""; display: inline-block; width: 1px; height: .95em; margin-left: .55rem; vertical-align: -.12em; background: var(--border-strong); }
.pick-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
details.menu.pick .menu-list { left: 0; right: 0; top: calc(100% + 4px); min-width: 0; max-height: min(62vh, 26rem); overflow-y: auto; padding: .35rem; gap: 1px; scroll-margin: 1rem 0 5.5rem; } /* 绝对定位贴在框下面、和框一样宽(不走 ui.js 的固定定位);scroll-margin 的下边给底部的保存条留地方 */
details.menu.pick .menu-list button { position: relative; padding-left: 2rem; }
details.menu.pick .menu-list button > b + span { color: var(--muted); }
details.menu.pick .menu-list button.on { background: var(--primary-soft); }
details.menu.pick .menu-list button.on > b { color: var(--primary-text); }
details.menu.pick .menu-list button.on::before { content: ""; position: absolute; left: .7rem; top: .78rem; width: .5rem; height: .28rem; border-left: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: rotate(-45deg); }
.set-ctl > details.menu.pick { margin-bottom: .15rem; }
/* 工具栏里的小号选择框(上游页按来源筛选):和旁边的按钮一样高,宽度跟着字走;展开的清单每项一行 —— 左边名字、右边条数。
   筛着的时候(.on)边框和字换成强调色:一眼看得出现在列的不是全部 */
details.menu.pick.sm { display: inline-block; max-width: none; flex: none; }
details.menu.pick.sm > summary.pick-box { min-width: 6.6rem; padding: 0 1.75rem 0 .7rem; height: var(--ctl-h); min-height: 0; font-size: var(--fs-sm); box-shadow: none; }
details.menu.pick.sm.on > summary.pick-box { border-color: var(--primary); color: var(--primary-text); background-color: var(--primary-soft); }
details.menu.pick.sm .menu-list { left: auto; right: 0; min-width: max(100%, 11rem); }
details.menu.pick.sm .menu-list button { justify-content: space-between; gap: 1.2rem; }
details.menu.pick.sm .menu-list button > .pick-n { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
details.menu.pick.sm .menu-list button.on > .pick-name { color: var(--primary-text); font-weight: 600; }
details.menu.pick.sm .menu-list button.on::before { top: 50%; margin-top: -.28rem; }
details.menu.pick.sm .menu-list button.none > .pick-name { color: var(--muted); }
/* 上游页拖动排序:拖的时候把展开着的逐台明细(通栏)先藏起来;筛选着不能拖时小把手变淡、不是「抓手」光标 */
.grid tbody.sorting > tr.up-sub { display: none; }
.grid tbody.no-drag td.handle { cursor: default; opacity: .35; }
.grid tbody.no-drag td.handle:hover { color: var(--faint); }
/* 带说明文字的工具栏:右边的按钮靠右对齐(说明文字有最大宽度,不能指望它把按钮顶过去) */
.toolbar.intro > .btn, .toolbar.intro > .row, .toolbar.intro > details.menu { margin-left: auto; }
/* 代理详情:账号那一段的登录地址和下面的资料之间留点距离 */
.drawer-body .ud-url + .ud-kv { margin-top: .75rem; }
/* 规则编辑框:最上面一行选类型(右边是启用开关),下面三段 —— 什么时候限、限到多少、对谁生效 */
.rl-form .form-sec { margin: 1.3rem 0 .7rem; padding-top: 0; border-top: none; font-size: var(--fs-base); color: var(--text); }
.rl-top { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; margin-bottom: 1rem; }
.rl-top .hint { margin: 0; flex: 1 1 16rem; }
.rl-on { display: inline-flex; align-items: center; gap: .5rem; flex: none; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.rl-when { display: grid; grid-template-columns: minmax(0, 1fr) 9.5rem 9.5rem; gap: .9rem 1rem; align-items: end; }
.rl-limit { display: grid; grid-template-columns: 9.5rem 9.5rem minmax(0, 1fr); gap: .9rem 1rem; align-items: start; }
/* 「不超过用户自己的限速」:和输入框一样的一格,开关落在输入框那一行、说明在下面 */
.rl-tight { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.rl-tight-sp { visibility: hidden; font-size: var(--fs-sm); } /* 和左边两格的名称一样高:开关正好落在输入框那一行 */
.rl-sw { display: inline-flex; align-self: flex-start; align-items: center; gap: .6rem; min-height: var(--ctl-h); cursor: pointer; }
.rl-sw-t { font-size: var(--fs-base); color: var(--text); }
.rl-tight > .help { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.rl-form > .hint, .rl-form > div > .hint { margin-top: .5rem; }
/* 星期:七个可点的小块,选中的亮起来(里面仍是勾选框,键盘能用) */
.day-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.day-pill { position: relative; cursor: pointer; }
.day-pill input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.day-pill span { display: inline-grid; place-items: center; min-width: 2.4rem; height: var(--ctl-h); padding: 0 .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; transition: background .12s, border-color .12s, color .12s; }
.day-pill input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.day-pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
/* 规则弹框「忽略部分线路」:开关一行(和「不超过用户自己的限速」同一套),打开后下面是线路小块 ——
   和星期小块同一套样式,只是里面写线路名 + 协议,名字太长省略、悬停看全名;停用的线路虚线框 */
.rl-skip { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.rl-skip > .help { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.line-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.line-pill { max-width: 100%; }
.line-pill span { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; justify-content: flex-start; }
.line-pill span b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.line-pill span em { flex: none; font-style: normal; font-size: var(--fs-xs); opacity: .75; }
.line-pill.off span { border-style: dashed; }
@media (max-width: 700px) {
  .rl-when, .rl-limit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rl-when > .field:first-child, .rl-limit > .rl-tight { grid-column: 1 / -1; }
  .rl-tight-sp { display: none; } /* 占整行时上面不用留空位 */
}
/* 线路 / 用户选择器里按服务器(按代理)筛选的那排按钮:和别处的分段按钮同一个样子,不再是一排蓝色药丸 */
.lp-nodetabs { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 100%; padding: 2px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.lp-nodetabs button { height: calc(var(--ctl-h-sm) - 6px); padding: 0 .55rem; border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-xs); font-weight: 500; cursor: pointer; }
.lp-nodetabs button:hover:not(.active) { color: var(--text); }
.lp-nodetabs button.active { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-xs); }
.lp-nodetabs button.active .muted { color: inherit; opacity: .7; }
/* 套餐编辑框:通栏从上到下。名称与说明一行;六个数一行(窄了三个一行、手机两个一行);两个开关行并排 */
.pl-form .form-sec { margin: 1.3rem 0 .7rem; padding-top: 0; border-top: none; font-size: var(--fs-base); color: var(--text); }
.pl-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); }
.pl-nums { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pl-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: .5rem; margin-top: .9rem; }
.pl-opts .sw-row { background: var(--surface); align-items: center; }
.pl-every { display: inline-flex; align-items: center; gap: .4rem; flex: none; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.pl-every input { width: max(4.6rem, calc(4ch + var(--num-x))); } /* 每几天重置:按四位数留 */
.pl-form > .hint { margin-top: .5rem; }
@media (max-width: 900px) { .pl-nums { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .pl-head { grid-template-columns: minmax(0, 1fr); } .pl-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pl-opts .sw-row { flex-wrap: wrap; } }
/* 「启用」「分配给全部现有用户」:带一句说明的开关行,和下面几行可展开的分区同一个样子,连成一组 */
.ln-flags { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: .5rem; margin-top: 1.15rem; }
.ln-flags .sw-row { background: var(--surface); padding: .5rem .85rem; cursor: pointer; }
.ln-flags .sw-row:hover { background: var(--surface-2); }
.ln-flags .sw-row b { font-weight: 600; }
.ln-form .acc-list { margin-top: .5rem; }
.ln-tls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .85rem; }
.ln-tls .hint { margin: 0; flex: 1 1 14rem; }
.ln-combo-msg { margin: -.4rem 0 .85rem; }
.ln-hs { flex-wrap: wrap; }
.ln-hs > input:first-child { flex: 1 1 12rem; min-width: 0; }
.ln-hs > input[type=number] { flex: 0 0 max(5.2rem, calc(5ch + var(--num-x))); } /* 握手端口:最多 65535 */
.ln-adv-proto { margin-bottom: .9rem; }
.ln-one-fam { margin-top: 1rem; max-width: 24rem; }
.cert-pick-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cert-pick-btn .i { flex: none; color: var(--muted); }

/* 部署到服务器:一台一格、多列排开(几十台也只是几行),再多在框里滚动;有分组时按组分段,组名前的勾选框整组勾 */
.ln-srv-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .6rem; margin-bottom: .55rem; }
.ln-srv-head .grow { flex: 1; }
.ln-srv-q { width: 13rem; max-width: 100%; }
.ln-srv .node-list { display: block; max-height: min(38vh, 19.5rem); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: .3rem .35rem; }
.node-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: .35rem; }
/* 一台服务器一个有边框的小方块:勾上的整块着色,它的 IP 版本下拉在方块里面 —— 一眼看得出这个下拉是哪一台的
   (以前名字和下拉分在格子两头、之间没有边界,几列并排时下拉离隔壁那台的勾选框反而更近) */
.ln-srv .node-row { padding: .2rem .4rem .2rem .6rem; min-height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .12s, background .12s; }
.ln-srv .node-row:hover { border-color: var(--border-strong); }
.ln-srv .node-row:has(.node-cb:checked) { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); }
.ln-srv .node-row:has(.node-cb:disabled) label { cursor: default; }
.ln-srv .node-row label { display: flex; align-items: center; gap: .5rem; flex: 1 1 auto; min-width: 0; cursor: pointer; font-size: var(--fs-sm); }
.ln-srv .node-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln-srv .node-row label > .small { flex: none; }
.ln-srv .node-row select.node-fam { flex: none; width: auto; max-width: 8.2rem; height: 26px; min-height: 26px; padding-top: 0; padding-bottom: 0; font-size: var(--fs-xs); border-color: color-mix(in srgb, var(--primary) 30%, var(--border-strong)); box-shadow: none; }
.node-grp + .node-grp { margin-top: .3rem; padding-top: .3rem; border-top: 1px solid var(--divider); }
.node-grp-h { display: flex; align-items: center; gap: .5rem; width: fit-content; padding: .3rem .45rem; font-size: var(--fs-sm); cursor: pointer; }
.node-grp-h b { font-weight: 600; }
.node-grp-h .node-gn { font-variant-numeric: tabular-nums; }
.ln-srv > .hint { margin-top: .5rem; }
.b-nodes { margin-top: .8rem; }

/* 可展开的分区:收着时是一行(标题 + 现在的状态),展开后内容在下面。不常用的设置放这里:不占版面,也找得到 */
.acc-list { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.15rem; }
details.acc { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
details.acc > summary { display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; cursor: pointer; list-style: none; user-select: none; border-radius: var(--radius-sm); }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: var(--surface-2); }
details.acc[open] > summary { border-bottom: 1px solid var(--divider); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.acc-t { font-weight: 600; font-size: var(--fs-base); white-space: nowrap; }
.acc-s { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); color: var(--faint); }
.acc-s.on { color: var(--primary-text); font-weight: 500; }
details.acc > summary .i-chev { flex: none; color: var(--muted); transition: transform .15s; }
details.acc[open] > summary .i-chev { transform: rotate(90deg); }
.acc-b { padding: .85rem .85rem .95rem; }
.acc-lead { margin: 0 0 .7rem; }

/* 小的展开项(密钥、高级参数):默认的三角换成和别处一致的折线箭头 */
details.adv > summary, details.ha-adv > summary { list-style: none; display: inline-flex; align-items: center; gap: .35rem; }
details.adv > summary::-webkit-details-marker, details.ha-adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before, details.ha-adv > summary::before { content: ''; flex: none; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--chev) center / 12px no-repeat; mask: var(--chev) center / 12px no-repeat; transform: rotate(-90deg); transition: transform .15s; }
details.adv[open] > summary::before, details.ha-adv[open] > summary::before { transform: none; }

/* 中转入口:一个入口一张小卡 */
.fw-item, .fw-item:first-child { padding: .7rem 1rem .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); gap: .45rem; }
.fw-item + .fw-item { margin-top: .5rem; }
.fw-arrow, .fw-flow-arrow { flex: none; color: var(--muted); }
select.fw-mode { width: auto; max-width: 11.5rem; }
.fw-note.ok { color: var(--ok-text); }
.fw-note button.link { border: 0; background: none; padding: 0 .1rem; margin-left: .35rem; font: inherit; color: var(--primary-text); text-decoration: underline; cursor: pointer; }
/* 服务器页:已删除、下线通知还没送到的服务器(每台:名字 · 已试几次 · 不再通知) */
.decom-gone { margin-bottom: .8rem; }
.decom-gone .decom-item { white-space: nowrap; }
.decom-gone .decom-item .muted { margin-left: .2rem; }
.decom-gone .link-btn { margin-left: .4rem; color: var(--primary-text); }
.decom-gone .link-btn:hover { text-decoration: underline; }
.fw-only { margin-top: .9rem; }
.fw-dest .i { width: 12px; height: 12px; vertical-align: -1px; }
#f-fw-add { margin-top: .55rem; }
.rr-box > .rr-lookup { max-width: 36rem; margin-bottom: .65rem; }

/* 线路详情里的中转入口:一条一行 */
section.ld-fw { display: block; margin: 0 0 1.2rem; }
.ld-fwlist { display: flex; flex-direction: column; }
.ld-fwrow { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .42rem .1rem; border-bottom: 1px solid var(--divider); font-size: var(--fs-sm); }
.ld-fwrow:last-child { border-bottom: none; }
.ld-fwrow .from, .ld-fwrow .to { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-fwrow .i { color: var(--muted); }
.ld-fwrow.off .from, .ld-fwrow.off .to { opacity: .55; }
.ld-fwrow .st { justify-self: end; white-space: nowrap; }

/* ================= 设置页:底部的保存条 =================
   有没保存的改动时粘在内容区底边(滚到哪都在);一条深色的胶囊:左边「几处改动 + 改了哪几项」,右边 放弃 / 保存。
   点左边那段向上展开清单(原来 → 现在,可单独撤销)。颜色用提示条那一组(浅色主题是深底,深色主题是浅底),两种主题都醒目 */
.savebar { position: sticky; bottom: 1rem; z-index: 30; width: min(46rem, 100%); margin: 1.1rem auto 0; color: var(--toast-text); filter: drop-shadow(0 10px 22px rgba(15, 23, 42, .24)); animation: sb-in .18s ease-out; }
@keyframes sb-in { from { transform: translateY(10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .savebar { animation: none; } }
.sb-main { display: flex; align-items: center; gap: .45rem; padding: .4rem .45rem .4rem .35rem; background: var(--toast-bg); border-radius: 999px; }
.sb-sum { display: flex; align-items: center; gap: .55rem; flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 .65rem 0 .75rem; border: 0; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.sb-sum:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.sb-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .28); }
.sb-sum b { flex: none; font-weight: 600; white-space: nowrap; }
.sb-chips { display: flex; flex-wrap: wrap; gap: .3rem; min-width: 0; height: 1.5rem; overflow: hidden; align-items: center; } /* 放不下的标签折到下一行、整枚看不见,不会切掉半枚 */
.sb-more { flex: none; }
.sb-chip { flex: none; max-width: 9.5rem; padding: .08rem .5rem; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-sum .i-chev { flex: none; margin-left: auto; opacity: .7; transform: rotate(-90deg); }
.sb-sum[aria-expanded="true"] .i-chev { transform: rotate(90deg); }
.savebar .sb-discard { flex: none; background: transparent; border-color: transparent; box-shadow: none; color: inherit; opacity: .85; border-radius: 999px; }
.savebar .sb-discard:hover { background: color-mix(in srgb, currentColor 12%, transparent); opacity: 1; }
.savebar .btn.primary { flex: none; height: 34px; padding: 0 1.15rem; border-radius: 999px; }
.sb-list { margin: 0 .2rem .45rem; padding: .3rem; max-height: min(46vh, 22rem); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); }
.sb-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto; gap: .75rem; align-items: center; padding: .42rem .55rem; font-size: var(--fs-sm); }
.sb-row + .sb-row { border-top: 1px solid var(--divider); }
.sb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sb-name small { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.sb-diff { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.sb-diff s, .sb-diff b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-diff s { color: var(--muted); text-decoration-color: var(--faint); }
.sb-diff b { font-weight: 600; }
.sb-diff .i { flex: none; color: var(--faint); }
/* 保存条在的时候,提示条(同样在底部正中)往上让一让 */
body:has(.savebar:not([hidden])) .toast { bottom: 5.4rem; }
@media (max-width: 700px) {
  .savebar { bottom: .6rem; }
  .sb-chips, .sb-more { display: none; }
  .sb-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sb-diff { grid-column: 1 / -1; grid-row: 2; }
}

/* ================= 套餐页:一个套餐一张卡 =================
   套餐就那么几个,是拿来卖、拿来套用的"商品":名字 → 流量和时长两个大数 → 几项属性 → 几个人在用。不是十列的表格 */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(20.5rem, 1fr)); gap: 1rem; align-items: stretch; }
.plan-card { display: flex; flex-direction: column; min-width: 0; padding: 1.15rem 1.2rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; }
.plan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.pc-name { min-width: 0; }
.pc-name b { display: block; font-size: var(--fs-lg); font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-name span { display: block; margin-top: .15rem; font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-main { display: grid; grid-template-columns: 1fr 1fr; margin: 1rem 0; border: 1px solid var(--divider); border-radius: var(--radius-md); background: var(--surface-2); }
.pc-main > div { min-width: 0; padding: .8rem .95rem; }
.pc-main > div + div { border-left: 1px solid var(--divider); }
.pc-main b { display: block; font-size: 1.65rem; line-height: 1.15; font-weight: 700; letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-main b small { margin-left: .28rem; font-size: var(--fs-sm); font-weight: 500; letter-spacing: 0; color: var(--muted); }
.pc-main span { display: block; margin-top: .25rem; font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-attrs { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem 1rem; margin: 0 0 1rem; font-size: var(--fs-sm); }
.pc-attrs dt { color: var(--muted); white-space: nowrap; }
.pc-attrs dd { margin: 0; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-card > footer { display: flex; align-items: center; gap: .35rem; margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--divider); font-size: var(--fs-sm); }
.plan-card > footer .grow { flex: 1; }
.plan-empty { grid-column: 1 / -1; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ================= 规则页:一条规则一张横卡,读起来是一句话 ================= */
.i-clock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E"); }
.i-bolt { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 3 5 13.5h6L10 21l8-10.5h-6L13 3Z'/%3E%3C/svg%3E"); }
.rule-list { display: grid; gap: .7rem; }
.rule-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem 1.1rem; align-items: center; padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.rule-card.off { background: var(--surface-2); box-shadow: none; }
.rule-card.off .rc-main, .rule-card.off .rc-ic { opacity: .55; }
.rc-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 19px; }
.rc-ic.burst { background: var(--warn-soft); color: var(--warn-text); }
.rc-main { min-width: 0; }
.rc-title { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .55rem; }
.rc-title b { font-size: var(--fs-md); font-weight: 600; }
.rc-sentence { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .6rem; margin: .4rem 0 .35rem; font-size: var(--fs-base); line-height: 1.5; color: var(--text); }
.rc-sentence > .i { color: var(--faint); }
.rc-sentence b { font-weight: 650; font-variant-numeric: tabular-nums; }
.rc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; font-size: var(--fs-sm); color: var(--muted); }
.rc-meta b { font-weight: 500; color: var(--text-2); }
.rc-active { border: 0; background: none; padding: 0; font: inherit; color: var(--warn-text); font-weight: 500; cursor: pointer; }
.rc-active:hover { text-decoration: underline; }
.rc-acts { display: flex; align-items: center; gap: .35rem; }
.rc-acts .switch { margin-right: .5rem; }
@media (max-width: 700px) {
  .rule-card { grid-template-columns: auto minmax(0, 1fr); }
  .rc-acts { grid-column: 1 / -1; justify-content: flex-end; padding-top: .7rem; border-top: 1px solid var(--divider); }
  .rc-acts .switch { margin-right: auto; }
}

/* ================= 上游页:健康状态一格 =================
   每台服务器一个状态点(绿 = 通,红 = 不通,黄 = 数据过期,灰 = 还没测),后面一句结论;逐台明细点开看 */
/* 上游名字下面的来源一行(来自哪个外部订阅,一行、放不下省略号,点开看详情)和状态格里那句跟随的结论 */
.up-srcline { display: flex; align-items: center; gap: .3rem; max-width: min(21em, 100%); margin-top: 2px; padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); cursor: pointer; text-align: left; }
.up-srcline > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-srcline > .i { flex: none; font-size: 11px; }
.up-srcline:hover { color: var(--primary-text); }
.up-srcline.off { color: var(--faint); }
.up-srcline.off:hover { color: var(--primary-text); }
/* 「跟随外部节点」小框里的开关行:说明比较长,不加边框 */
#modal-body .up-follow-sw { margin: .9rem 0 0; }
/* 删上游被拦下时列出在用它的线路:一条一行,名字在左(长了省略),用法的小标签在右 */
.up-inuse { list-style: none; margin: .7rem 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 15.5rem; overflow: auto; }
.up-inuse li { display: flex; align-items: center; gap: .4rem; min-height: 2.2rem; padding: .25rem .7rem; font-size: var(--fs-sm); }
.up-inuse li + li { border-top: 1px solid var(--border); }
.up-inuse .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.up-inuse .grow { flex: 1; }
/* 外部 API 密钥的调用日志:上面一排设置(记不记、自动删除、条数、清空),下面一条一行 —— 大白话和结果一行,时间、来源 IP、失败原因一行;
   具体执行的请求在悬停提示里,手机上点一下那一行(它能拿到焦点)在下面展开 */
.alog-set { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1.1rem; padding: .1rem 0 .75rem; }
.alog-set label { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); cursor: pointer; }
.alog-set select { width: auto; }
.alog-set .alog-tot { margin-left: auto; } /* 条数和「清空日志」靠右;窄屏折到第二行时也靠右 */
.alog-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: min(56vh, 32rem); overflow: auto; }
.alog-row { padding: .55rem .8rem; outline: none; cursor: default; }
.alog-row + .alog-row { border-top: 1px solid var(--divider); }
.alog-row:hover, .alog-row:focus { background: var(--surface-2); }
.alog-main { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.alog-what { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.alog-main > .badge { flex: none; }
.alog-sub { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .9rem; margin-top: .2rem; min-width: 0; }
.alog-err { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--danger-text); }
.alog-raw { display: none; margin: .5rem 0 0; padding: .5rem .65rem; border-radius: var(--radius-xs); background: var(--surface); border: 1px solid var(--border); font: var(--fs-xs)/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--text-2); }
.alog-row:focus .alog-raw { display: block; }
.alog-more { display: flex; justify-content: center; padding: .7rem 0 0; }
.alog-empty { padding: 2rem 0; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
table.api-keys td.actions .btn.muted { color: var(--muted); }
/* 批量删除确认框里没删的那几条:名字一行,原因(哪几条线路在用 / 在哪个上游组里)另起一行 */
.up-inuse li.kept { flex-wrap: wrap; row-gap: 0; padding-block: .4rem; }
.up-inuse li.kept .why { flex-basis: 100%; min-width: 0; line-height: 1.5; }
.up-inuse .badge { flex: none; }
.up-inuse + .confirm-text { margin-top: .8rem; }
.up-srcline:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
.up-note { color: var(--muted); }
.up-note.ok { color: var(--ok-text); }
.up-note.warn { color: var(--warn-text); }
.sub-cell.up-note { max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#modal-body p.up-note { margin: .75rem 0 0; line-height: 1.6; }
table.grid.cards .sub-cell.up-note { white-space: normal; }
.hsum { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .55rem; min-height: 24px; }
.hdots { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; max-width: 13rem; }
.hd { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.hd.ok { background: var(--ok); }
.hd.bad { background: var(--danger); }
.hd.warn { background: var(--warn); }
.hd.busy { background: var(--primary); animation: hd-pulse 1s ease-in-out infinite; }
@keyframes hd-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .hd.busy { animation: none; } }
.hsum b { font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 结论 + 服务器名 + 箭头是一个整体:状态点多、要折行时整句一起下去(以前箭头是单独一项,会一个人掉到下一行) */
.hconc { display: inline-flex; align-items: center; gap: .55rem; min-width: 0; max-width: 100%; white-space: nowrap; }
/* 有明细可看的:整行是一个按钮,点、字、箭头点哪里都展开 */
button.hbtn { margin: -2px -6px; padding: 2px 6px; border: 0; border-radius: var(--radius-xs); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.hbtn:hover { background: var(--surface-3); }
button.hbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
button.hbtn .i { flex: none; color: var(--muted); font-size: 13px; }
.hname { min-width: 0; font-size: var(--fs-xs); color: var(--text-2); max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hsum b.ok { color: var(--ok-text); }
.hsum b.bad { color: var(--danger-text); }
.hsum b.warn { color: var(--warn-text); }
/* 展开的逐台明细:每台服务器固定一行 —— ● 服务器名  结果  多久前查的(上游组再多一格「→ 现在走的成员」)。
   被压缩的只有名字(省略号),别的都不折行:不管窗口多宽、有几台,一台永远只占一行。
   放在哪由排法决定(pages/upstreams.js 的 detailHTML 同一段 HTML 画两处,这里只露一处),不放在「状态」那一格里撑:
     表格排法:这一行下面的一条通栏(tr.up-sub,跨满整张表)。每栏至少 16.5rem,够宽就并排几栏 —— 三台一行排完,十几台也只占三四行;
     卡片排法:卡片自己里面、状态那一格下面(卡片至少 19.5rem 宽,够排一行)。
   以前明细画在「状态」那一格里。那一列多宽取决于窗口多宽、别的列占多少,880–1000 宽时只剩两百多像素:
   先是「检查于 11/17 02:20:00」被挤成一个字一行;改成按格宽分行后又成了每台三四行(名字、时间、报错各占一行)。
   用户三次截图指出 —— 根子是不该去赌那一格的宽度,所以现在的排法跟那一列多宽没有关系。
   一行里四格各有固定位置(名字那一格按这条上游里最长的名字估,最宽 10rem,见 detailHTML 的 --hname;结果 3.6rem 靠右;时间 4.5rem):
   多台上下排时结果对得齐,结果也紧挨着名字。
   三台以内(.few)在表格排法里总是并排成一行,用不着对齐,各格按内容收紧。
   故障原因不列出来(用户:「这不就是测试 ping 失败吗,至于非要明显列出吗」):鼠标停在那一行上看;
   触屏没有悬停,点一下那一行(它能拿到焦点)才在下面露出来。 */
.hdetail { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--hcol, 16.5rem)), 1fr)); gap: 0 1.75rem; font-size: var(--fs-xs); text-align: left; }
.hdetail.grp { --hcol: 26rem; } /* 上游组多一格,一栏要宽一点 */
.hdetail.busy { opacity: .5; }
.hitem { min-width: 0; border-radius: var(--radius-xs); }
.hitem.why { cursor: help; }
.hitem:focus { outline: none; }
.hitem:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.hrow { display: grid; grid-template-columns: 8px minmax(0, var(--hname, 10rem)) 3.6rem 4.5rem; justify-content: start; align-items: center; column-gap: .6rem; min-height: 1.75rem; white-space: nowrap; }
.hdetail.grp .hrow { grid-template-columns: 8px minmax(0, var(--hname, 10rem)) 3.6rem minmax(0, 9rem) 4.5rem; }
.hrow > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hrow > .hd { overflow: visible; }
.hrow .nm { color: var(--text); }
.hrow b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.hrow b.bad { color: var(--danger-text); }
.hrow b.warn { color: var(--warn-text); }
.hrow .hvia, .hrow .hwhen { color: var(--muted); }
.hwhy { display: none; margin: 0 0 .4rem calc(8px + .6rem); color: var(--danger-text); line-height: 1.5; white-space: normal; overflow-wrap: anywhere; cursor: text; }
.hitem:focus > .hwhy, .hitem:focus-within > .hwhy { display: block; }
/* 表格排法:通栏,和上面那一行连成一块(中间不画分隔线) */
tr.up-open > td { border-bottom-color: transparent; }
tr.up-sub > td { padding: .2rem .75rem .45rem; background: var(--surface-2); }
table.grid:not(.cards) .hdetail.in-card { display: none; }
.hdetail.few:not(.in-card) .hrow { grid-template-columns: 8px fit-content(10rem) auto auto; }
.hdetail.few.grp:not(.in-card) { --hcol: 22rem; }
.hdetail.few.grp:not(.in-card) .hrow { grid-template-columns: 8px fit-content(10rem) auto fit-content(11rem) auto; }
/* 卡片排法:明细在卡片里,通栏藏掉。卡片窄:名字占剩下的地方,结果和时间靠右对齐;
   上游组的那一格「→ 成员」比「多久前」要紧,时间让给它 */
table.grid.cards tr.up-sub { display: none; }
table.grid.cards .hdetail.in-card { clear: both; margin-top: .5rem; padding: .2rem .7rem; background: var(--surface-2); border: 1px solid var(--divider); border-radius: var(--radius-sm); }
.hdetail.in-card .hrow { grid-template-columns: 8px minmax(0, 1fr) 3.6rem 4.5rem; justify-content: stretch; }
.hdetail.in-card .hwhen { text-align: right; }
.hdetail.in-card.grp .hrow { grid-template-columns: 8px minmax(3rem, 1fr) 3.6rem fit-content(48%); }
.hdetail.in-card.grp .hwhen { display: none; }

/* ================= 节点页(pages/subnodes.js)=================
   一张表按线路分组,一行一个节点。倍率一格要一眼分得出「跟随服务器」(淡色,后面跟着这四个字)和单独设的(主色、加粗);
   没设的限速、容量是更淡的「不限」。输出开关摆在行里。停用的线路 / 服务器、暂停的入口整行变淡。 */
.sn-node { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.sn-node > .pname { min-width: 2.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* 挤的时候名字不折成两行(以前「CN2-GIA」会在连字符处折行);先缩后面的「→ 出口」 */
.sn-node > .badge { flex: none; }
.sn-to { flex: 1 1 0; width: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 400; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; } /* 宽度记 0、有地方才长出来:不然它不换行的整段宽度会把这一列撑宽,英文 1230 宽时表格比卡片宽、最后一列被截 */
.sn-own { color: var(--primary-text); font-weight: 600; }
.sn-follow { color: var(--text-2); white-space: nowrap; }
.sn-follow > span { color: var(--muted); font-size: var(--fs-xs); }
.sn-table .faint { color: var(--faint); }
/* 在线 / 容量:在线人数是实数,容量没设时后面跟一个淡色的「不限」;到了容量上限变成警示色 */
.sn-cap b { font-weight: 600; }
.sn-cap.full { color: var(--warn-text); }
.sn-table td.sn-out { width: 1%; white-space: nowrap; }
.sn-table .switch { vertical-align: middle; }
tr.sn-idle > td:not(.actions):not(.sn-out) { opacity: .6; }
/* 线路行(默认收起):箭头 + 线路名 + 协议 · 端口,下面一行是节点数;其余各列是这条线路的汇总。点开后底色和它的节点连成一块 */
.sn-table tr.sn-line { cursor: pointer; }
.sn-table tr.sn-line.open > td { background: var(--surface-3); }
.sn-table td.num { white-space: nowrap; }
/* 各列先占好展开以后要用的宽度:不然点开一条线路(节点行的「×1 · 跟随服务器」「0 / 不限」、开关、「设置」按钮比线路行的汇总宽),
   整张表的列会左右挪一下。线路行的汇总格子里放一个不占高度、看不见的占位(.sn-size,内容和节点行最宽的写法一样,跟着语言走);
   「全部」那一格和开关一样宽,最后一格放一个看不见的「设置」按钮 */
.sn-size { display: block; height: 0; overflow: hidden; visibility: hidden; white-space: nowrap; }
.sn-table tr.sn-line td.sn-out > span { display: inline-block; min-width: 2.25rem; }
.sn-table tr.sn-line .sn-size-btn { visibility: hidden; pointer-events: none; }
.sn-lhead { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.sn-ltog { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sn-ltog > .i-chev { width: 14px; height: 14px; color: var(--muted); }
.sn-ltog:hover > .i-chev, .sn-ltog[aria-expanded="true"] > .i-chev { color: var(--text-2); }
.sn-ltog[aria-expanded="true"] > .i-chev { transform: rotate(90deg); }
.sn-ltog > b { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn-ltog:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 3px; border-radius: 4px; }
.sn-lhead > .badge { flex: none; }
.sn-lsum, .sn-lfacts { padding-left: calc(14px + .45rem); }
/* 跑在哪几台:全部服务器时名字一长串,限个宽度省略掉(悬停看全),不然这一列把倍率、限速几列挤成竖排 */
/* 入口地址这一列(线路行的汇总、节点行的地址)最宽 16.5vw:各列占好展开后的宽度以后,1230 宽时要给第一列留够「协议 · 端口 · 几个节点 · 含几个中转」一行的地方;
   节点行的地址也按它封顶 —— 不封的话点开地址长的线路这一列会变宽,英文 1230 宽时整张表比卡片宽、「设置」按钮被截。截掉的全文在悬停提示里 */
.sn-table .sn-where { display: block; max-width: min(20rem, 16.5vw); color: var(--text-2); }
.sn-table td.c-p3 .ellip { max-width: min(20rem, 16.5vw); }
.sn-full, .sn-outn { color: var(--warn-text); font-weight: 500; }
.sn-full { font-size: var(--fs-xs); }
/* 节点行:缩进到线路名下面,和展开的线路行同一块底色;每条线路的最后一个节点下面一条实线,和下一条线路分开 */
.sn-table tr.sn-child > td { background: var(--surface-2); }
.sn-table tr.sn-child:hover > td { background: var(--surface-3); }
.sn-table tr.sn-child.selected > td { background: var(--primary-soft); }
.sn-table tr.sn-child > td.primary-cell { padding-left: calc(.75rem + 14px + .45rem + .9rem); }
.sn-table tr.sn-child.last > td { border-bottom-color: var(--border); }
/* 入口地址:够宽时是单独一列;那一列藏起来(窄窗口、卡片)时写在名字下面一行,不至于看不到 */
.sn-addr { display: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid.no-p3 .sn-addr, table.grid.cards .sn-addr { display: block; }
/* 卡片排法:地址已经在名字下面;没设的限速、容量(都是「不限」)不占行,一张卡只留有内容的 */
table.grid.cards.sn-table td.c-p3, table.grid.cards.sn-table td.sn-def { display: none; }
/* 节点页的工具栏:搜索 + 三个下拉(线路 / 服务器 / 类型)+ 一组状态筛选;下拉不抢地方,放不下整组折到下一行 */
.sn-bar > select.sm { width: auto; max-width: 11rem; }
/* 表头「线路 / 节点」后面的「全部展开 / 全部收起」:小号链接,不占工具栏 */
.sn-table th .sn-fold { margin-left: .6rem; font-size: var(--fs-xs); font-weight: 500; color: var(--primary-text); letter-spacing: 0; }
.sn-table th .sn-fold:hover { text-decoration: underline; }
.sn-lsum > span, .sn-lfacts > span { white-space: nowrap; }
/* 卡片排法(手机等):线路卡占满一行,只留名字、协议 · 端口 · 节点数和一行汇总(各汇总格不再一格一行);展开时整张卡上色,它的节点卡缩进一点跟在下面 */
.sn-lfacts { display: none; }
table.grid.cards.sn-table tr > td { background: transparent; }
table.grid.cards.sn-table tr.sn-line { grid-column: 1 / -1; }
table.grid.cards.sn-table tr.sn-line > td.num, table.grid.cards.sn-table tr.sn-line > td.sn-out, table.grid.cards.sn-table tr.sn-line > td.actions { display: none; }
table.grid.cards.sn-table tr.sn-line .sn-lfacts { display: block; margin-top: .3rem; color: var(--text-2); }
table.grid.cards.sn-table tr.sn-line.open { background: var(--surface-3); }
table.grid.cards.sn-table tr.sn-child { margin-left: .9rem; }
table.grid.cards.sn-table tr.sn-child > td.primary-cell { padding-left: 0; }
/* 设置 · 概览提醒(用户 N14):分三小块的一组勾选框,宽时并排,窄了自己折行 */
.mutes { display: grid; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); gap: 1rem 1.75rem; margin-top: .15rem; }
.mute-g { display: grid; gap: .45rem; align-content: start; }
.mute-h { margin-bottom: .1rem; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.mute-cb { display: flex; align-items: center; gap: .55rem; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.mute-cb input { margin: 0; flex: none; }
/* 批量设限速 / 容量:一行一项 —— 名字、「不改 / 设为 / 不限」、数值 */
.sn-brows { display: grid; gap: .6rem; }
.sn-brow { display: grid; grid-template-columns: minmax(0, 1fr) 7rem 8rem; gap: .6rem; align-items: center; }
.sn-brow > .label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.sn-brow > input:disabled { background: var(--surface-2); }
@media (max-width: 520px) { .sn-brow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sn-brow > .label { grid-column: 1 / -1; } }
.sn-who { margin: 0 0 1rem; font-size: var(--fs-md); }
.sn-extra { display: grid; gap: .85rem; margin-top: 1.15rem; }
.sn-extra > details.adv { margin: 0; }
.sn-extra > details.adv > summary { margin-bottom: 0; }
.sn-extra > details.adv[open] > summary { margin-bottom: .6rem; }
button.sn-reset { color: var(--muted); }
.node-readonly .sn-table td.actions, .node-readonly .sn-table .switch { pointer-events: none; opacity: .5; }

/* ---- 管理员页 / 代理「账号」页 ----
   账号与两步验证各一张小卡片并排:看一眼就知道现在是谁、上次从哪登录、两步验证开没开,改动都在弹框里做。 */
.adm-top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.adm-top > .card { margin: 0; display: flex; flex-direction: column; }
@media (max-width: 860px) { .adm-top { grid-template-columns: 1fr; } }
.card-acts { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: auto; padding-top: .95rem; }
.card-acts.end { justify-content: flex-end; margin-top: 1.1rem; padding-top: 0; }
.adm-who { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.adm-who > div { min-width: 0; }
.adm-ava { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 21px; }
.adm-who b { display: block; font-size: var(--fs-lg); line-height: 1.35; overflow-wrap: anywhere; }
.adm-who .sep { margin: 0 .4em; color: var(--faint); }
/* 登录账号卡片:名字下面三行(上次登录的时间、登录 IP、已登录设备),左边名目、右边值,三行的值对齐(排成一张小表);
   最后一行右边是「查看」小按钮。长的 IPv6 放不下就省略(悬停看全)。按钮跟在内容后面,不顶到卡片最下面:
   右边那张卡片(两步验证 + 通行密钥)更高的时候,多出来的空在卡片底部,不在名字和按钮中间(用户 11-29:「样式缺陷」) */
.adm-meta { display: table; width: 100%; margin-top: .9rem; border-collapse: collapse; font-size: var(--fs-sm); }
.adm-meta-row { display: table-row; }
.adm-meta-row > span { display: table-cell; vertical-align: middle; height: 2.5rem; padding: .25rem 0; border-top: 1px solid var(--divider); }
.adm-meta-k { width: 1%; padding-right: 1.4rem !important; color: var(--muted); white-space: nowrap; }
.adm-meta-v { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-meta-x { width: 1%; padding-left: .75rem !important; text-align: right; white-space: nowrap; }
#adm-acct > .card-acts { margin-top: 0; }
/* 两步验证 + 通行密钥同一张卡片:上面是两步验证(totp.js 画的),下面隔一条线是通行密钥 */
.adm-2fa > #adm-totp { display: flex; flex-direction: column; }
.adm-pk { margin-top: 1rem; padding-top: .95rem; border-top: 1px solid var(--divider); display: flex; flex-direction: column; flex: 1; }
.card-head.sub { margin-bottom: .55rem; min-height: 0; }
.card-head.sub h3 { flex: 1; font-size: var(--fs-md); font-weight: 600; }
.adm-pk-why { color: var(--muted); }
.adm-pk-list { display: flex; flex-direction: column; gap: .15rem; margin-top: .2rem; }
.adm-pk-row { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .3rem 0; }
.adm-pk-row > .i { color: var(--muted); font-size: 1.05rem; }
.adm-pk-row > div { flex: 1; min-width: 0; }
.adm-pk-row b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-pk-row .small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-pk .card-acts { padding-top: .75rem; }
/* 已登录设备(弹框里的列表):一行一台 —— 浏览器 · 系统、IP 和时间、右边踢出;当前这台底色不同 */
.adm-sess { display: flex; flex-direction: column; gap: .4rem; margin-top: .7rem; }
.adm-sess-main > b .ua { color: var(--text); font-size: var(--fs-base); max-width: none; }
.adm-sess-row { display: flex; align-items: center; gap: .8rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.adm-sess-row.cur { background: var(--surface-2); }
.adm-sess-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.adm-sess-main > b { font-weight: 500; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-sess-main > .small { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-sess-main .sep { margin: 0 .4em; color: var(--faint); }
/* 服务器页「检查更新 / 立即更新」:有可以更新的时按钮换成强调色的浅底 + 台数;弹框里一行一台 —— 名字在左,版本 / 状态靠右 */
.btn.nu-go { border-color: color-mix(in srgb, var(--primary) 45%, transparent); background: var(--primary-soft); color: var(--primary-text); }
.btn.nu-go:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 82%, var(--primary)); }
.nu-n { display: inline-flex; align-items: center; justify-content: center; min-width: 1.2rem; height: 1.2rem; padding: 0 .35rem; border-radius: 999px; background: var(--primary); color: #fff; font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.nu-list, .check-list.nu-list { display: flex; flex-direction: column; gap: .15rem; padding: .4rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.check-list.nu-list { max-height: min(46vh, 22rem); }
p.hint + .nu-list, p.hint + .check-list.nu-list { margin-top: .7rem; }
.nu-row { display: flex; align-items: center; gap: .7rem; min-height: 40px; padding: .4rem .65rem; border-radius: var(--radius-xs); min-width: 0; }
.check-list.nu-list > label.nu-row { min-height: 40px; font-size: var(--fs-base); }
.check-list.nu-list > label.nu-row:hover { background: var(--surface); }
.nu-name { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: .45rem; }
.nu-name > b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nu-name > .chip { flex: none; }
.nu-row.off .nu-name > b { font-weight: 400; color: var(--text-2); }
.nu-note { flex: none; max-width: 62%; font-size: var(--fs-sm); color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nu-note > small { display: block; font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; }
.nu-note.ok-text { color: var(--ok-text); } .nu-note.warn-text { color: var(--warn-text); } .nu-note.danger-text { color: var(--danger-text); }
.nu-ver { color: var(--muted); } .nu-ver > b { color: var(--primary-text); font-weight: 600; } .nu-arrow { color: var(--faint); margin: 0 .1em; }
.nu-mark { font-weight: 700; }
.nu-rest { margin-top: .7rem; }
.nu-rest > summary { cursor: pointer; width: fit-content; color: var(--muted); font-size: var(--fs-sm); margin-bottom: .5rem; }
.nu-rest > .nu-list { background: transparent; }
.nu-rest > summary:hover { color: var(--text); }
#nu-acts { margin-top: .7rem; }
/* 服务器页「Reality 握手目标」弹框:三选一的分段,下面是那一种的内容;扫描结果一行一个站点(点了选用) */
.rt-seg { margin: .75rem 0 .9rem; }
.rt-pane { min-height: 3.2rem; }
.rt-site > input { flex: 1 1 auto; min-width: 0; }
.rt-scan { margin-top: .8rem; }
.rt-scan > .row { gap: .6rem; align-items: center; }
.rt-scan > .row > .muted { min-width: 0; }
.rt-cands { display: flex; flex-direction: column; gap: .15rem; margin-top: .6rem; padding: .4rem; max-height: min(38vh, 17rem); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.rt-cand { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: .6rem; row-gap: .1rem; align-items: center; padding: .42rem .6rem; border: 1px solid transparent; border-radius: var(--radius-xs); background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0; }
.rt-cand:hover { background: var(--surface); }
.rt-cand.on { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.rt-dot { grid-column: 1; grid-row: 1 / span 2; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); }
.rt-cand.on > .rt-dot { border-color: var(--primary); background: radial-gradient(circle, var(--primary) 0 4px, var(--surface) 4.5px); }
.rt-cand > b { grid-column: 2; grid-row: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-cand > .badge { grid-column: 3; grid-row: 1 / span 2; }
.rt-meta { grid-column: 2; grid-row: 2; min-width: 0; color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rt-scan .link-btn { color: var(--primary-text); }
.rt-scan .link-btn:hover { text-decoration: underline; }
.rt-self > b { font-family: var(--mono); font-size: var(--fs-base); }
.rt-scope { margin-top: .9rem; }
.rt-warn { margin-top: .35rem; }
button.badge[data-act="node.reality"] { font-family: inherit; cursor: pointer; }
.ln-hs-nodes { margin-top: .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 设置页「巡检的服务器」:像下拉框的一个按钮(写着现在几台),点开小弹框勾选 */
.btn.pick-btn { justify-content: space-between; min-width: 9.5rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.btn.pick-btn > .i-chev { opacity: .55; }
#rn-list { margin-top: .7rem; }
#rn-list > label > .ellip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rn-list > label > .chip, #rn-list > label > .muted { flex: none; }
/* 登录日志:收着的一条,点开是时间 / IP / 浏览器三列;浏览器一格先写认出来的(Chrome 131 · Windows),后面跟原文,放不下省略、悬停看全 */
/* 登录日志在轻量弹窗里:上面一条 —— 左边共几条、右边「多久以后自动删除」的选择框(选了就保存);下面是表格。
   弹窗里的内容留一个最小高度:日志只有一两条时,选择框展开的清单也放得下 */
#adm-log-body { min-height: 17rem; }
.adm-log-bar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: .2rem 0 .7rem; }
/* 右边那张卡片比左边矮的时候,多出来的空在卡片底部,不在通行密钥的说明和按钮中间 */
.adm-pk > .card-acts { margin-top: 0; }
.adm-log-grid td { vertical-align: top; }
.adm-log-grid td.adm-ua { max-width: 0; width: 55%; }
.adm-log-grid td.adm-ua > .ua { display: block; max-width: none; color: var(--text); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-log-grid td.adm-ua > .ua-raw { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-log-grid tr.adm-log-fail > td:first-child { color: var(--danger-text); }
.adm-log-grid .badge { margin-left: .35rem; }
/* 登录页的「用通行密钥登录」:排在登录按钮下面,次要按钮的样子 */
.login-card .btn.block.login-pk { margin-top: -.35rem; gap: .45rem; font-size: var(--fs-base); }
.i-key { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4.2'/%3E%3Cpath d='M11.1 12.1 19.5 3.7M15.6 7.6l2.8 2.8M18.1 5.1l1.9 1.9'/%3E%3C/svg%3E"); }
.i-user { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8.4' r='3.7'/%3E%3Cpath d='M4.8 19.6c1-3.4 3.8-5.3 7.2-5.3s6.2 1.9 7.2 5.3'/%3E%3C/svg%3E"); }

/* 两步验证的设置弹框:左边二维码,右边两步(扫码 / 填验证码) */
.totp-setup { display: flex; gap: 1.3rem; align-items: flex-start; }
.totp-setup img.qr { width: 156px; height: 156px; margin: 0; flex: none; }
.totp-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.05rem; }
.totp-steps li { counter-increment: step; position: relative; padding-left: 2.15rem; display: flex; flex-direction: column; gap: .3rem; }
.totp-steps li::before { content: counter(step); position: absolute; left: 0; top: -.08rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); font-size: var(--fs-xs); font-weight: 600; }
.totp-steps .sub-box { margin: .15rem 0 0; }
.totp-code { max-width: 10.5rem; margin-top: .15rem; font-family: var(--mono); font-size: 1.15rem; letter-spacing: .32em; text-align: center; }
@media (max-width: 560px) { .totp-setup { flex-direction: column; align-items: center; } .totp-steps { width: 100%; } }

/* 外部 API 卡片:接口地址一行、密钥一张表 */
.api-off { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: .85rem; }
.api-url { display: flex; align-items: center; gap: .5rem; min-width: 0; margin-top: .9rem; padding: .4rem .7rem .4rem .8rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.api-url .lbl { flex: none; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.api-url code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-url .btn { flex: none; }
/* 窄屏:地址自己占一行、完整折行显示,两个按钮落到下一行靠右 */
@media (max-width: 560px) {
  .api-url { flex-wrap: wrap; justify-content: flex-end; padding: .55rem .6rem; }
  .api-url code { flex: 1 1 calc(100% - 5rem); white-space: normal; word-break: break-all; }
}
.api-keys-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 1.25rem 0 .6rem; min-height: var(--ctl-h-sm); }
.api-keys-head h3 { margin: 0; font-size: var(--fs-base); }
.api-keys-head .n { margin-left: .45rem; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.api-empty { padding: 1.6rem 1rem; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.api-empty p { margin: 0 0 .8rem; color: var(--muted); font-size: var(--fs-sm); }
table.api-keys td { vertical-align: middle; }
table.api-keys tr.off td:not(.actions) { opacity: .5; }
table.api-keys td.actions { white-space: nowrap; }
table.api-keys td.actions .switch { margin-right: .4rem; }
.key-tok { display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; }
.key-tok code, .key-ip { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.key-ipn { border-bottom: 1px dotted var(--border-strong); cursor: help; }
.chip.all { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); }

/* 新建 / 编辑一把密钥:名称 → 密钥 → 权限(两列勾选,勾上的整格着色)→ 允许的来源 */
.ak-form { display: flex; flex-direction: column; gap: .85rem; }
.ak-sec { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin: .3rem 0 -.3rem; font-size: var(--fs-sm); }
.ak-sec b { font-weight: 600; color: var(--text-2); }
.ak-quick { display: inline-flex; gap: .95rem; }
.ak-quick .link-btn { color: var(--primary-text); font-size: var(--fs-xs); }
.ak-quick .link-btn:hover { text-decoration: underline; }
.ak-tok { margin: 0; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .6rem; }
.perm-item { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .12s, background .12s; }
.perm-item:hover { border-color: var(--border-strong); }
.perm-item:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-soft); }
.perm-item input { margin-top: .18rem; flex: none; }
.perm-item > span { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.perm-item b { font-weight: 600; font-size: var(--fs-sm); }
.perm-item small { font-size: var(--fs-xs); line-height: 1.4; }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }
#ak-from { align-self: flex-start; }
#ak-ipbox { display: flex; flex-direction: column; gap: .45rem; }
#ak-ipbox[hidden] { display: none; }
#ak-ips { width: 100%; min-height: 4.6rem; font-family: var(--mono); font-size: 12.5px; }
.ak-you { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); }
#ak-ipbox .hint { margin: 0; }

/* 接口文档(右侧抽屉):每个接口两行 —— 方法 + 路径 + 需要的权限,下面一行说明 */
.doc-how .kv { margin-top: .75rem; align-items: center; }
.doc-how .sub-box { margin: 0; }
.doc-how > .hint { margin-top: 0; }
.ep-list { display: flex; flex-direction: column; }
.ep { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) auto; gap: .15rem .8rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--divider); }
.ep:first-child { border-top: none; padding-top: .1rem; }
.ep:last-child { padding-bottom: 0; }
.ep-m { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.ep-m.get { color: var(--ok-text); }
.ep-m.post { color: var(--primary-text); }
.ep-m.put { color: var(--warn-text); }
.ep-m.del { color: var(--danger-text); }
.ep-p { font-family: var(--mono); font-size: 12.5px; color: var(--text); overflow-wrap: anywhere; }
.ep-d { grid-column: 2 / -1; font-size: var(--fs-sm); color: var(--muted); line-height: 1.55; }
.ep-perm { justify-self: end; padding: 0 .4rem; border: 1px solid var(--border); border-radius: var(--radius-xs); font-size: var(--fs-xs); line-height: 1.6; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .ep { grid-template-columns: 4.6rem minmax(0, 1fr); } .ep-perm { grid-column: 2; order: 3; justify-self: start; margin-top: .15rem; } .ep-d { grid-column: 2; } }
.doc-note { margin: 0 0 1.1rem; }
.doc-ex-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.doc-ex-head h3 { flex: 1; margin: 0; }
.doc-ex-head select { width: auto; max-width: 12rem; }
pre.doc-ex { max-height: none; }

/* 代理「账号」页:我的额度五格(比详情抽屉里的四格多一格限速);订阅页的两个开关并排 */
.acct-sum { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 0; }
/* 五格排不满一行时,第一格(已用流量,带进度条)占两格:3 列时 2+1 / 3,2 列时整行 / 2 / 2,不留空位 */
@media (max-width: 1100px) { .acct-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); } .acct-sum > :first-child { grid-column: span 2; } }
@media (max-width: 640px) { .acct-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } .acct-sum > :first-child { grid-column: 1 / -1; } }
.acct-sw { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: .85rem 0 1rem; }
@media (max-width: 760px) { .acct-sw { grid-template-columns: 1fr; } }

/* ---- 新增 / 编辑服务器 ----
   三段:叫什么、归哪组、流量怎么算(一行四格)→ 怎么连上它的面板(地址、令牌并排,证书校验一个开关行)→ 订阅里给用户哪个地址 */
.nd-form .form-sec { margin: 1.3rem 0 .7rem; padding-top: 0; border-top: none; font-size: var(--fs-base); color: var(--text); }
.nd-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(0, .8fr); gap: .8rem 1rem; align-items: start; }
.nd-link { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; align-items: start; }
.nd-link > .sw-row { grid-column: 1 / -1; }
.nd-link .hint { margin-top: .35rem; }
.nd-addr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; }
.nd-addr select { width: auto; }
.nd-enabled { margin-top: 1rem; }
/* 服务器的流量额度:名称一格里的用量条(可点,打开编辑框里的那一段),编辑框里的「流量额度与到期」 */
.nq { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .7rem; max-width: 100%; margin-top: .3rem; padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); text-align: left; cursor: pointer; }
.nq-meter { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; max-width: 100%; }
.nq-meter .nq-bar { flex: 0 1 56px; width: auto; min-width: 28px; } /* 列窄的时候先缩这根条,数字不折不截 */
.nq:hover .nq-txt, .nq:hover .nq-exp { color: var(--text-2); }
.nq:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.nq-bar { flex: none; width: 56px; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.nq-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.nq.warn .nq-bar > i, .nq-bar.warn > i { background: var(--warn); }
.nq.full .nq-bar > i, .nq-bar.full > i { background: var(--danger); }
.nq-txt, .nq-exp { white-space: nowrap; font-variant-numeric: tabular-nums; }
.nq.full .nq-txt, .nq.full .nq-exp { color: var(--danger-text); }
.nq.warn .nq-exp { color: var(--warn-text); }

.nq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr); gap: .8rem 1rem; align-items: start; }
.nq-cycle { display: flex; align-items: center; gap: .45rem; }
.nq-cycle select { flex: 1 1 6.5rem; width: auto; min-width: 0; }
.nq-cyc { display: inline-flex; flex: none; align-items: center; gap: .35rem; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.nq-cyc[hidden] { display: none; }
.nq-cyc input { width: max(4.4rem, calc(4ch + var(--num-x))); } /* 每几天重置最多 3650;每月几号和它同宽 */
.nq-use { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem; margin: 0 0 .9rem; font-size: var(--fs-sm); }
.nq-use .nq-bar { width: 150px; height: 6px; }
.nq-use-txt { flex: 1 1 15rem; min-width: 0; font-variant-numeric: tabular-nums; }
.alert-bar.nq-alert { margin: 0 0 .9rem; }
.grid .sub-cell.nq-note { white-space: normal; line-height: 1.45; max-width: 15rem; }
.hint.conns-why { margin: 0 0 .55rem; }
table.grid.rows2 .sub-cell.nq-note, table.grid.cards .sub-cell.nq-note { max-width: none; }
.sw-row.nq-auto { margin-top: .9rem; }
@media (max-width: 760px) { .nq-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .nd-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .nd-link { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .nd-top, .nd-addr { grid-template-columns: minmax(0, 1fr); } .nd-addr select { width: 100%; } }

/* ---- 概况:能点开的那一格数字(流量)---- */
button.stat { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
button.stat:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-go { position: absolute; top: .85rem; right: .8rem; color: var(--faint); font-size: 14px; transition: color .15s, transform .15s; }
button.stat:hover .stat-go { color: var(--primary); transform: translateX(2px); }

/* ---- 流量明细弹框(traffic.js)----
   范围 → 四个数 → 三栏排行。每行:名次、名字、数值、占比,下面一条细条(深色下行、浅色上行;长度按这一栏最大的算) */
.tb-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .85rem; }
.tb-sum { margin-bottom: 1rem; }
.tb-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; align-items: start; }
.tb-cols.one { grid-template-columns: minmax(0, 34rem); }
.tb-col { min-width: 0; }
.tb-col > h3 { display: flex; align-items: baseline; gap: .45rem; margin: 0 0 .5rem; padding-bottom: .45rem; border-bottom: 1px solid var(--divider); font-size: var(--fs-base); color: var(--text); }
.tb-col > h3 .muted { font-size: var(--fs-xs); font-weight: 400; }
.tb-list { list-style: none; margin: 0; padding: 0; }
.tb-row { display: grid; grid-template-columns: 1.3rem minmax(0, 1fr) auto 2.6rem; column-gap: .5rem; align-items: baseline; padding: .42rem 0 .5rem; }
.tb-row + .tb-row { border-top: 1px solid var(--divider); }
.tb-rank { font-size: var(--fs-xs); color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; }
.tb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
a.tb-name:hover { color: var(--primary-text); text-decoration: none; }
.tb-tag { margin-left: .25rem; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.tb-val { font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-share { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.tb-bar { grid-column: 2 / -1; height: 5px; margin-top: .32rem; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.tb-bar > i { display: block; height: 100%; border-radius: 3px; background: color-mix(in srgb, var(--primary) 34%, var(--surface)); overflow: hidden; }
.tb-bar > i > b { display: block; height: 100%; background: var(--primary); }
.tb-row.rest .tb-bar > i { background: color-mix(in srgb, var(--muted) 30%, var(--surface)); }
.tb-row.rest .tb-bar > i > b { background: var(--muted); }
.tb-none { margin: 0; padding: 1.4rem 0; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.tb-legend { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .45rem; margin-top: 1rem; }
.tb-key { display: inline-block; width: 14px; height: 5px; border-radius: 3px; background: var(--primary); }
.tb-key.up { margin-left: .5rem; background: color-mix(in srgb, var(--primary) 34%, var(--surface)); }
.tb-legend .sep { margin: 0 .25rem; color: var(--faint); }
@media (max-width: 980px) { .tb-cols { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; } }

/* ---- 防火墙页(pages/fw.js):三张通栏的卡,各一张表;开关在标题右边,展开的明细是行下面的一条通栏 ---- */
.wall-page > .card:last-child { margin-bottom: 0; }
.wall-page .card-head h2 { white-space: nowrap; } /* 窄屏上标题自己一行,开关和按钮折到下一行,不把标题挤成两行 */
.wall-tools { display: flex; align-items: center; gap: .6rem; margin-left: auto; } /* 开关和按钮是一组:要折行一起折 */
.wall-page table.grid th { white-space: nowrap; }
.wall-page .card > .hint + .table-wrap { margin-top: .75rem; }
.wall-sw { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; white-space: nowrap; }
.wall-pbtn { display: inline-flex; align-items: baseline; gap: .4rem; max-width: 100%; white-space: nowrap; font-size: inherit; }
.wall-pbtn b { font-weight: 600; font-variant-numeric: tabular-nums; }
.wall-pbtn .i { align-self: center; font-size: 11px; color: var(--faint); }
.wall-pbtn:hover b { color: var(--primary-text); }
.wall-pbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
table.wall-srv td.actions { white-space: nowrap; }
.wall-detail { display: grid; gap: .3rem; padding: .35rem 0 .2rem; font-size: var(--fs-xs); text-align: left; }
.wall-dports { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .7rem; }
.wall-dl { flex: none; color: var(--muted); }
.wall-dports .chips { gap: .25rem; }
.wall-dports .chip { min-height: 20px; padding: 0 .4rem; background: var(--surface); }
.wall-dline { margin: 0; line-height: 1.6; color: var(--text-2); }
.wall-dline.ok { color: var(--ok-text); }
.wall-dline.warn { color: var(--warn-text); }
.wall-dline.bad { color: var(--danger-text); }
.wall-dmeta { margin: 0; color: var(--faint); }
/* 卡片排法(窄屏):明细跟在这一张卡的下面,占一整行 */
table.grid.cards tr.wall-sub { display: block; grid-column: 1 / -1; margin-top: -.35rem; padding: .3rem .9rem .5rem; background: var(--surface-2); }
table.grid.cards tr.wall-sub > td { padding: 0; border: none; background: transparent; text-align: left; }

/* 规则表:类型的小标签 + 备注在第一格;端口、来源各列前两样,多的收成 +N */
.wall-kindcell { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; }
.wall-kindcell .badge { flex: none; }
.wall-note { min-width: 0; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 400; color: var(--muted); }
.wall-fb { display: none; font-weight: 400; }
.wall-fb > span { display: none; }
.grid.no-p2 .wall-fb:has(.wall-fb-p2), .grid.no-p3 .wall-fb:has(.wall-fb-p3) { display: block; }
.grid.no-p2 .wall-fb-p2, .grid.no-p3 .wall-fb-p3 { display: inline; }
.grid.no-p2.no-p3 .wall-fb-p2 + .wall-fb-p3::before, .grid.no-p2 .wall-fb-p2 + .wall-fb-p3::before { content: ' · '; color: var(--faint); }
.grid:not(.no-p2) .wall-fb-p2 + .wall-fb-p3::before { content: none; }
.wall-quick[hidden] { display: none; }
.wall-few { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 .25rem; max-width: 100%; }
.wall-it { max-width: 13.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-sep { margin-left: -.2rem; color: var(--faint); }
.wall-more { padding: 0 .35rem; border-radius: 999px; background: var(--surface-3); font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.wall-proto { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
table.wall-rtable tr.is-off td:not(.actions):not(:has(.switch)) { opacity: .5; }
table.wall-rtable td.actions, table.wall-btable td.actions, table.wall-atable td.actions { white-space: nowrap; }
.wall-starter { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .5rem; padding: .15rem 0 .1rem; font-size: var(--fs-sm); }
.wall-none { margin: .2rem 0 .1rem; color: var(--muted); font-size: var(--fs-sm); }
.wall-bar { margin: .7rem 0 .65rem; }
.wall-bar .wall-q { width: 12rem; max-width: 100%; }
/* 黑名单表:「原因」那一列吃掉剩下的宽度、放不下省略(悬停看全);时间和按钮各按内容宽、不折行 ——
   英文里原因是一长句,不这样它会把后面几列挤成一个词一行、把「更多」挤出框外 */
table.wall-btable td { white-space: nowrap; }
table.wall-btable td.wall-whycell { width: 100%; max-width: 0; }
.wall-why { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid.cards.wall-btable td { white-space: normal; }
table.grid.cards.wall-btable td.wall-whycell { width: auto; max-width: none; }
table.grid.cards .wall-why, table.grid.cards .wall-note, table.grid.cards .wall-it { max-width: 100%; white-space: normal; }
/* 卡片排法:是默认值的那几行(全部服务器、一直有效)不占地方 */
table.grid.cards td.wall-def { display: none; }

/* 规则弹框:三种做法并排三张可点的小卡(手机上叠成三行),选中的那张描边 */
.wall-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.wall-kind { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: .6rem .7rem .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.wall-kind:hover { border-color: var(--border-strong); }
.wall-kind.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.wall-kind input { position: absolute; opacity: 0; pointer-events: none; }
.wall-kind:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.wall-kind-t { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.wall-kind-t b { font-size: var(--fs-sm); font-weight: 600; min-width: 0; }
.wall-kind small { font-size: var(--fs-xs); line-height: 1.5; color: var(--muted); }
.wall-form textarea { min-height: 4.6rem; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; resize: vertical; }
.wall-quick { display: flex; flex-wrap: wrap; gap: .3rem; }
.wall-quick .chip.more { min-height: 22px; }
.wall-exp { flex-wrap: wrap; }
.wall-exp select { flex: 1 1 9rem; min-width: 0; }
.wall-hours { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--text-2); }
.wall-hours input { width: max(5.5rem, calc(5ch + var(--num-x))); flex: none; } /* 小时数:最多 87600 */
.wall-scope .node-list[hidden] { display: none; }
.wall-scope > .hint { margin-top: 0; }
.wall-scope > .hint:empty { display: none; }
.wall-scope .ln-srv-head { margin-bottom: .45rem; }
.wall-promote { margin-top: .9rem; }
@media (max-width: 640px) {
  .wall-kinds { grid-template-columns: minmax(0, 1fr); }
  .wall-kind { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; }
  .wall-kind small { flex: 1 1 100%; }
}
/* 副机上只能看:开关不能点,按钮收起 */
.node-readonly .wall-page .switch { pointer-events: none; opacity: .5; }
.node-readonly .wall-page .card-head .btn, .node-readonly .wall-page td.actions, .node-readonly .wall-page .wall-bar .btn, .node-readonly .wall-page .wall-starter .btn { display: none !important; }

/* ---- 流量奖励(js/reward.js)----
   两部分。顶栏那枚金币 + 小气泡:跟面板走(用面板的令牌)。
   点开的「活动页」:自己的一套样子,要轻 —— 白底、留白、细线;金色只在金币和钱数上,紫绿只在 Solana 的小标和页头一抹很淡的晕色里。
   它自己的颜色都收在 .rw-ov 的 --rw-* 里;面板切到深色时换成一套同样克制的深色。
   版式按活动页自己的宽度排(@container rw),不看窗口宽度:侧栏开着、浏览器窗格很窄时都一样。三档:宽(> 720)、中(≤ 720)、窄(≤ 540)。 */
.rw-slot { position: relative; display: inline-flex; align-items: center; }
.rw-slot:empty { display: none; }
/* 金币右上角的积分数字是探出去的:和右边的圣诞树之间多留一点,别挨在一起 */
.rw-slot:not(:empty) + .xmas-slot:not(:empty) { margin-left: .45rem; }
.rw-coin { position: relative; width: 30px; height: 32px; padding: 0; margin: 0 .05rem; border: 0; background: none; cursor: pointer; flex: none; display: inline-grid; place-items: center; border-radius: 50%; transition: transform .22s cubic-bezier(.3, 1.5, .5, 1), filter .22s ease; }
.rw-coin:hover { transform: translateY(-1.5px) rotate(-6deg) scale(1.07); filter: drop-shadow(0 3px 6px rgba(226, 144, 10, .38)); }
.rw-coin:active { transform: scale(.94); }
.rw-coin:focus-visible { outline: 2px solid #e3a31a; outline-offset: 2px; }
.rw-coin-svg { width: 27px; height: 28px; display: block; overflow: visible; }
.rw-coin.pop .rw-coin-svg { animation: rw-flip 1.1s cubic-bezier(.3, .7, .2, 1); }
@keyframes rw-flip { 0% { transform: rotateY(0) scale(1); } 45% { transform: rotateY(360deg) scale(1.22); } 100% { transform: rotateY(720deg) scale(1); } }
.rw-n { position: absolute; top: -2px; right: -6px; min-width: 15px; height: 15px; padding: 0 3.5px; border-radius: 99px; background: #e8970c; color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.rw-coin.pop .rw-n { animation: rw-bump .7s cubic-bezier(.3, 1.6, .5, 1) .5s both; }
@keyframes rw-bump { 0% { transform: scale(.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
/* 提醒收起以后留在金币右下角的小点(还没登记地址) */
.rw-dot { position: absolute; right: -1px; bottom: 1px; width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, #9945ff, #14f195); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
/* 轻提醒:金币下面的小气泡 */
.rw-tip { position: absolute; top: calc(100% + 11px); right: -6px; z-index: 40; width: min(19rem, calc(100vw - 1.5rem)); padding: .75rem .85rem .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); animation: rw-tip-in .28s cubic-bezier(.2, .8, .2, 1); }
.rw-tip::before { content: ""; position: absolute; top: -6px; right: 15px; width: 10px; height: 10px; background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg); }
.rw-tip-t { display: flex; align-items: flex-start; gap: .5rem; font-size: var(--fs-sm); line-height: 1.5; color: var(--text-2); }
.rw-tip-t .rw-chain { flex: none; margin-top: .22rem; }
.rw-tip-a { display: flex; gap: .4rem; margin-top: .6rem; padding-left: 1.4rem; }
@keyframes rw-tip-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .rw-tip { position: fixed; top: calc(var(--topbar-h) + 4px); right: .75rem; }
  .rw-tip::before { display: none; }
}
.rw-chain { width: 15px; height: 12px; flex: none; }
.rw-chain.trx { width: 13px; height: 13px; }
/* 设置页:从别处跳过来的那一行闪一下 */
.set-row.flash { animation: set-flash 2.6s ease; border-radius: var(--radius-sm); }
@keyframes set-flash { 0%, 55% { background: var(--primary-soft); box-shadow: 0 0 0 .6rem var(--primary-soft); } 100% { background: transparent; box-shadow: 0 0 0 .6rem transparent; } }

/* ---- 活动页 ---- */
html.rw-lock { overflow: hidden; }
.rw-ov {
  --rw-bg: #ffffff; --rw-soft: #f6f7f9; --rw-soft2: #eff1f4; --rw-hover: #f8f9fb;
  --rw-ink: #0f172a; --rw-ink2: #334155; --rw-mute: #64748b; --rw-faint: #94a3b8;
  --rw-line: #edf0f3; --rw-line2: #e2e6eb;
  --rw-gold-t: #b45309; --rw-gold-soft: #fff6df; --rw-gold-line: #f6dfa4;
  --rw-don: #7c6cf2; --rw-don-t: #5b47d6; --rw-don-soft: #f1effe; /* 捐赠这一路钱的颜色(订单是金色):色条、小方块、逐笔入账里的小标 */
  --rw-num: linear-gradient(180deg, #f5a70c 0%, #d97a06 100%);
  --rw-ok: #059669; --rw-ok-soft: #ecfdf5; --rw-bad: #c2410c; --rw-bad-soft: #fff4ed;
  --rw-inv: #0f172a; --rw-inv-t: #ffffff;
  --rw-wash: radial-gradient(46% 78% at 88% 6%, rgba(251, 191, 36, .2), transparent 62%), radial-gradient(42% 70% at 4% 0%, rgba(153, 69, 255, .09), transparent 62%), radial-gradient(36% 60% at 52% -6%, rgba(20, 241, 149, .08), transparent 62%);
  --rw-shadow: 0 32px 72px -24px rgba(15, 23, 42, .34), 0 4px 14px -6px rgba(15, 23, 42, .1);
  --rw-card: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 26px -16px rgba(15, 23, 42, .16);
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem;
  background: rgba(15, 23, 42, .34); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: rw-fade .2s ease both;
}
.rw-ov[hidden] { display: none; }
.rw-ov.out { animation: rw-fade .18s ease reverse both; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rw-ov {
    --rw-bg: #111318; --rw-soft: #171a21; --rw-soft2: #1d212a; --rw-hover: #161920;
    --rw-ink: #f1f3f7; --rw-ink2: #c5cad4; --rw-mute: #8e96a6; --rw-faint: #646c7b;
    --rw-line: #20242d; --rw-line2: #2b303b;
    --rw-gold-t: #f5c563; --rw-gold-soft: rgba(245, 180, 60, .11); --rw-gold-line: rgba(245, 180, 60, .28); --rw-don: #a394ff; --rw-don-t: #c5bbff; --rw-don-soft: rgba(140, 120, 255, .15);
    --rw-num: linear-gradient(180deg, #ffe08a 0%, #f2a71f 100%);
    --rw-ok: #4fd1a1; --rw-ok-soft: rgba(79, 209, 161, .1); --rw-bad: #f59a6b; --rw-bad-soft: rgba(245, 154, 107, .11);
    --rw-inv: #f1f3f7; --rw-inv-t: #111318;
    --rw-wash: radial-gradient(46% 78% at 88% 6%, rgba(251, 191, 36, .13), transparent 62%), radial-gradient(42% 70% at 4% 0%, rgba(153, 69, 255, .12), transparent 62%), radial-gradient(36% 60% at 52% -6%, rgba(20, 241, 149, .06), transparent 62%);
    --rw-shadow: 0 32px 72px -24px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .06);
    --rw-card: 0 0 0 1px rgba(255, 255, 255, .05);
    background: rgba(3, 5, 9, .58);
  }
}
:root[data-theme="dark"] .rw-ov {
  --rw-bg: #111318; --rw-soft: #171a21; --rw-soft2: #1d212a; --rw-hover: #161920;
  --rw-ink: #f1f3f7; --rw-ink2: #c5cad4; --rw-mute: #8e96a6; --rw-faint: #646c7b;
  --rw-line: #20242d; --rw-line2: #2b303b;
  --rw-gold-t: #f5c563; --rw-gold-soft: rgba(245, 180, 60, .11); --rw-gold-line: rgba(245, 180, 60, .28); --rw-don: #a394ff; --rw-don-t: #c5bbff; --rw-don-soft: rgba(140, 120, 255, .15);
  --rw-num: linear-gradient(180deg, #ffe08a 0%, #f2a71f 100%);
  --rw-ok: #4fd1a1; --rw-ok-soft: rgba(79, 209, 161, .1); --rw-bad: #f59a6b; --rw-bad-soft: rgba(245, 154, 107, .11);
  --rw-inv: #f1f3f7; --rw-inv-t: #111318;
  --rw-wash: radial-gradient(46% 78% at 88% 6%, rgba(251, 191, 36, .13), transparent 62%), radial-gradient(42% 70% at 4% 0%, rgba(153, 69, 255, .12), transparent 62%), radial-gradient(36% 60% at 52% -6%, rgba(20, 241, 149, .06), transparent 62%);
  --rw-shadow: 0 32px 72px -24px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .06);
  --rw-card: 0 0 0 1px rgba(255, 255, 255, .05);
  background: rgba(3, 5, 9, .58);
}
@keyframes rw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rw-rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.rw-sheet { position: relative; width: min(58rem, 100%); max-height: min(93vh, 60rem); max-height: min(93dvh, 60rem); display: flex; flex-direction: column; overflow: hidden; color: var(--rw-ink); background: var(--rw-bg); border-radius: 22px; box-shadow: var(--rw-shadow); font-size: var(--fs-base); line-height: 1.5; animation: rw-rise .28s cubic-bezier(.2, .8, .2, 1) both; }
/* 页头一抹很淡的晕色:固定在页头,内容从它上面滚过去;最上面一道很细的彩线 */
.rw-sheet::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 21rem; background: var(--rw-wash); pointer-events: none; }
.rw-sheet::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, #9945ff, #14f195 45%, #fbbf24); opacity: .85; pointer-events: none; }
.rw-scroll { position: relative; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--rw-line2) transparent; }
.rw-in-w { container: rw / inline-size; --rw-px: 2.25rem; padding: 2rem var(--rw-px) 1.6rem; }
.rw-x { position: absolute; top: .9rem; right: .9rem; z-index: 3; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--rw-bg) 70%, transparent); color: var(--rw-mute); cursor: pointer; transition: background .15s, color .15s; }
.rw-x:hover { background: var(--rw-soft2); color: var(--rw-ink); }
.rw-x svg { width: 17px; height: 17px; }
.rw-ov button:focus-visible, .rw-ov a:focus-visible { outline: 2px solid #e8a41a; outline-offset: 2px; }
.rw-ov .mono { font-family: var(--mono); font-size: max(.9em, 12px); letter-spacing: -.01em; }
.rw-sp { flex: 1; }
.rw-k { display: flex; align-items: center; gap: .4rem; color: var(--rw-mute); font-size: var(--fs-xs); font-weight: 500; }
.rw-hint { margin: 0; color: var(--rw-mute); font-size: var(--fs-xs); line-height: 1.6; text-wrap: pretty; }
.rw-h { margin: 1.7rem 0 .7rem; font-size: var(--fs-md); font-weight: 650; color: var(--rw-ink); letter-spacing: -.005em; }
.rw-pane > .rw-h:first-child { margin-top: .3rem; }

/* 头部:左边说明 + 奖池 + 入口,右边大金币(跨整列) */
.rw-hero { display: grid; grid-template-columns: minmax(0, 1fr) 13.5rem; grid-template-areas: "hd art" "lead art" "pool art" "acts art"; column-gap: 1.5rem; align-items: start; }
.rw-hd { grid-area: hd; min-width: 0; }
.rw-kicker { display: inline-flex; align-items: center; gap: .45rem; color: var(--rw-gold-t); font-size: var(--fs-xs); line-height: 1.5; }
.rw-kicker b { font-weight: 650; letter-spacing: .02em; }
.rw-kicker i { font-style: normal; color: var(--rw-mute); padding-left: .5rem; border-left: 1px solid var(--rw-line2); }
.rw-spark { font-size: 12px; color: #f0a316; animation: rw-twinkle 3.2s ease-in-out infinite; }
@keyframes rw-twinkle { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.18) rotate(18deg); } }
.rw-slogan { margin: .55rem 0 0; font-size: 1.85rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; color: var(--rw-ink); }
.rw-lead { grid-area: lead; margin: .4rem 0 0; max-width: 34rem; color: var(--rw-ink2); font-size: var(--fs-sm); line-height: 1.65; text-wrap: balance; }
.rw-pool { grid-area: pool; margin-top: 1.35rem; min-width: 0; }
.rw-pool-k { display: flex; align-items: center; gap: .35rem; color: var(--rw-mute); font-size: var(--fs-sm); }
.rw-stale { display: inline-grid; color: var(--rw-bad); cursor: help; }
.rw-stale svg { width: 14px; height: 14px; }
.rw-pool-v { display: flex; align-items: baseline; gap: .5rem; }
.rw-pool-v b { font-size: 3.4rem; font-weight: 700; line-height: 1.08; letter-spacing: -.04em; font-variant-numeric: tabular-nums; background: var(--rw-num); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rw-pool-v span { font-size: var(--fs-sm); font-weight: 650; color: var(--rw-gold-t); letter-spacing: .05em; }
/* 还取不到奖池数据:一个淡淡的占位,不拿金色的大横杠吓人 */
.rw-pool-v b.na { background: none; color: var(--rw-faint); font-size: 2rem; font-weight: 500; letter-spacing: 0; }
.rw-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.rw-chip { display: inline-flex; align-items: center; min-height: 24px; padding: .1rem .6rem; border-radius: 99px; background: var(--rw-soft); color: var(--rw-ink2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rw-chip.gold { background: var(--rw-gold-soft); color: var(--rw-gold-t); font-weight: 600; }
.rw-acts { grid-area: acts; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.1rem; margin-top: 1.15rem; }
.rw-cd { display: inline-flex; align-items: baseline; gap: .22rem; color: var(--rw-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rw-cd:empty { display: none; }
.rw-cd-k { color: var(--rw-mute); font-size: var(--fs-xs); margin-right: .3rem; }
.rw-cd b { font-size: var(--fs-md); font-weight: 650; }
.rw-cd i { font-style: normal; font-size: var(--fs-xs); color: var(--rw-mute); margin-right: .3rem; }
.rw-cd i.c { margin: 0 .02rem; color: var(--rw-faint); }
/* 大金币 */
.rw-hero-r { grid-area: art; align-self: center; display: grid; justify-items: center; gap: .65rem; }
.rw-art { position: relative; width: 9.25rem; height: 9.75rem; display: grid; place-items: center; }
.rw-art .rw-coin-svg { width: 8.6rem; height: auto; filter: drop-shadow(0 10px 14px rgba(120, 130, 150, .28)); animation: rw-float 5.5s ease-in-out infinite; }
.rw-art.lit .rw-coin-svg { filter: drop-shadow(0 12px 16px rgba(217, 134, 8, .3)); }
.rw-art-sh { position: absolute; bottom: -.15rem; left: 22%; right: 22%; height: .55rem; border-radius: 50%; background: radial-gradient(closest-side, rgba(15, 23, 42, .2), transparent); animation: rw-shadow 5.5s ease-in-out infinite; }
@keyframes rw-float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes rw-shadow { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.82); opacity: .6; } }
/* 金币旁边的几颗星光(灌上金色之后才亮) */
.rw-art > i { position: absolute; width: 12px; height: 12px; opacity: 0; background: #f6b93b; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.rw-art.lit > i { animation: rw-star 3.4s ease-in-out infinite; }
.rw-art > i.s1 { top: 6%; left: 4%; }
.rw-art > i.s2 { top: 22%; right: 0; width: 8px; height: 8px; animation-delay: 1.1s; }
.rw-art > i.s3 { bottom: 20%; left: -2%; width: 7px; height: 7px; animation-delay: 2.1s; }
@keyframes rw-star { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 45%, 55% { opacity: .95; transform: scale(1) rotate(45deg); } }
.rw-art-c { display: grid; justify-items: center; gap: .05rem; text-align: center; }
.rw-art-c b { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rw-art-c small { font-size: .62em; font-weight: 600; margin-left: .08em; color: var(--rw-mute); }
.rw-art-c span { color: var(--rw-mute); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 我的:一条 */
.rw-me { margin-top: 1.5rem; padding: .95rem 1.15rem; border-radius: 16px; background: var(--rw-bg); border: 1px solid var(--rw-line); box-shadow: var(--rw-card); }
.rw-me-row { display: grid; grid-template-columns: auto auto minmax(9rem, 1fr) auto; grid-template-areas: "pts tfc grow addr"; align-items: center; column-gap: 1.5rem; }
.rw-me-c { display: grid; gap: .2rem; min-width: 0; }
.rw-me-c.pts { grid-area: pts; } .rw-me-c.tfc { grid-area: tfc; } .rw-me-c.grow { grid-area: grow; } .rw-me-c.addr { grid-area: addr; }
.rw-me-c.tfc, .rw-me-c.grow, .rw-me-c.addr:not(.cta) { padding-left: 1.5rem; border-left: 1px solid var(--rw-line); }
.rw-me-v { display: flex; align-items: baseline; gap: .5rem; min-height: 1.75rem; }
.rw-me-v b { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rw-me-v em { font-style: normal; color: var(--rw-mute); font-size: var(--fs-xs); white-space: nowrap; }
.rw-me-v em.q { cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--rw-mute) 60%, transparent); text-underline-offset: 3px; }
.rw-pc { color: var(--rw-ink2); font-variant-numeric: tabular-nums; }
.rw-bar { height: 6px; margin: .42rem 0 .3rem; border-radius: 99px; background: var(--rw-soft2); overflow: hidden; }
.rw-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #fcd34d, #f59e0b); transition: width .8s cubic-bezier(.2, .7, .2, 1); }
.rw-me-s { color: var(--rw-mute); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rw-addr-v { display: flex; align-items: center; gap: .2rem; min-height: 1.75rem; }
.rw-addr-v code { margin-right: .2rem; font-size: var(--fs-base); color: var(--rw-ink); white-space: nowrap; }
.rw-addr-v .rw-link { margin-left: .4rem; }
.rw-me-h { margin-top: .7rem; padding-top: .65rem; border-top: 1px dashed var(--rw-line2); }
.rw-bind { margin-top: .85rem; padding-top: .85rem; border-top: 1px dashed var(--rw-line2); display: grid; gap: .45rem; }
.rw-bind-r { display: flex; gap: .45rem; }
.rw-bind-r .rw-in { flex: 1; min-width: 0; }
.rw-in { width: 100%; height: 36px; padding: 0 .75rem; border: 1px solid var(--rw-line2); border-radius: 10px; background: var(--rw-bg); color: var(--rw-ink); font: inherit; font-size: var(--fs-sm); outline: none; transition: border-color .15s, box-shadow .15s; }
.rw-in::placeholder { color: var(--rw-faint); font-family: var(--font); letter-spacing: 0; }
.rw-in:focus { border-color: #f0b02e; box-shadow: 0 0 0 3px var(--rw-gold-soft); }
.rw-bind-err { color: var(--rw-bad); font-size: var(--fs-xs); line-height: 1.45; }
.rw-bind-err:empty { display: none; }
.rw-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 36px; padding: 0 1rem; border: 1px solid var(--rw-line2); border-radius: 11px; background: var(--rw-bg); color: var(--rw-ink2); font: inherit; font-size: var(--fs-sm); font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, filter .15s, transform .1s, box-shadow .15s; }
.rw-btn:hover:not(:disabled) { background: var(--rw-soft); }
.rw-btn:active:not(:disabled) { transform: translateY(1px); }
.rw-btn:disabled { opacity: .45; cursor: not-allowed; }
.rw-btn svg { width: 15px; height: 15px; flex: none; }
.rw-btn.ink { border-color: transparent; background: var(--rw-inv); color: var(--rw-inv-t); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .2); }
.rw-btn.ink:hover:not(:disabled) { background: var(--rw-inv); filter: brightness(1.18); }
.rw-btn.gold { border-color: var(--rw-gold-line); background: var(--rw-gold-soft); color: var(--rw-gold-t); font-weight: 600; }
.rw-btn.gold:hover:not(:disabled) { background: var(--rw-gold-soft); border-color: #eebf55; filter: brightness(1.02); }
.rw-btn.sm { height: 28px; padding: 0 .65rem; font-size: var(--fs-xs); border-radius: 8px; gap: .3rem; }
.rw-btn.sm svg { width: 13px; height: 13px; }
.rw-link { display: inline-flex; align-items: center; gap: .25rem; padding: 0; border: 0; background: none; color: var(--rw-gold-t); font: inherit; font-size: var(--fs-xs); font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.rw-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.rw-link svg { width: 12px; height: 12px; }
.rw-link.in { display: inline; font-size: inherit; white-space: normal; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--rw-gold-t) 45%, transparent); text-underline-offset: 3px; }
.rw-ib { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--rw-mute); cursor: pointer; text-decoration: none; flex: none; transition: background .15s, color .15s; }
.rw-ib:hover { background: var(--rw-soft2); color: var(--rw-ink); }
.rw-ib svg { width: 14px; height: 14px; }
.rw-ib.sm { width: 22px; height: 22px; }
.rw-ib.sm svg { width: 12.5px; height: 12.5px; }
.rw-note { display: flex; align-items: flex-start; gap: .45rem; margin-top: .7rem; padding: .5rem .75rem; border-radius: 10px; font-size: var(--fs-xs); line-height: 1.6; color: var(--rw-ink2); background: var(--rw-soft); }
.rw-note svg { flex: none; width: 15px; height: 15px; margin-top: .12rem; }
.rw-note.ok { background: var(--rw-ok-soft); } .rw-note.ok svg { color: var(--rw-ok); }
.rw-note.bad { background: var(--rw-bad-soft); } .rw-note.bad svg { color: var(--rw-bad); }

/* 四页 */
.rw-tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 1.6rem; margin: 1.6rem calc(var(--rw-px) * -1) 1.2rem; padding: .35rem var(--rw-px) 0; border-bottom: 1px solid var(--rw-line); background: color-mix(in srgb, var(--rw-bg) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); overflow-x: auto; scrollbar-width: none; }
.rw-tabs::-webkit-scrollbar { display: none; }
.rw-tabs button { position: relative; flex: none; padding: .6rem .05rem .7rem; border: 0; background: none; color: var(--rw-mute); font: inherit; font-size: var(--fs-base); font-weight: 550; cursor: pointer; white-space: nowrap; transition: color .15s; }
.rw-tabs button:hover { color: var(--rw-ink); }
.rw-tabs button.active { color: var(--rw-ink); font-weight: 650; }
.rw-tabs button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--rw-ink); }
.rw-pane { min-height: 14rem; }
.rw-empty { padding: 2.4rem 1rem; text-align: center; color: var(--rw-mute); font-size: var(--fs-sm); }

/* 奖池从哪来:一张小清单。一路钱一行(小图标、叫什么、一句怎么算的,右边「+ 多少」),最后一行金色的合计带「= 当前奖池」。
   一眼看下来就是「这两样加起来 = 当前奖池」;订单金、捐赠紫,和下面逐笔入账里的小标是同一套颜色。 */
.rw-src { border: 1px solid var(--rw-line2); border-radius: 16px; overflow: hidden; }
.rw-src-row, .rw-src-sum { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; column-gap: .9rem; align-items: center; padding: .9rem 1.15rem; }
.rw-src-row + .rw-src-row { border-top: 1px solid var(--rw-line); }
.rw-src-i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; }
.rw-src-i svg { width: 19px; height: 19px; }
.rw-src-i.ord { background: var(--rw-gold-soft); color: var(--rw-gold-t); }
.rw-src-i.don { background: var(--rw-don-soft); color: var(--rw-don-t); }
.rw-src-t { display: grid; gap: .1rem; min-width: 0; }
.rw-src-t b { font-size: var(--fs-base); font-weight: 600; color: var(--rw-ink); }
.rw-src-t span { color: var(--rw-mute); font-size: var(--fs-xs); line-height: 1.6; text-wrap: pretty; }
.rw-src-t .rw-link.in { color: var(--rw-ink2); text-decoration-color: color-mix(in srgb, var(--rw-mute) 55%, transparent); }
.rw-src-t .rw-link.in:hover { color: var(--rw-gold-t); }
.rw-src-v { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--rw-ink); }
.rw-src-v i { margin-right: .3rem; font-style: normal; font-weight: 500; color: var(--rw-faint); }
.rw-src-sum { padding-top: .85rem; padding-bottom: .85rem; background: var(--rw-gold-soft); border-top: 1px solid var(--rw-gold-line); }
.rw-src-eq { font-size: var(--fs-xl); font-weight: 600; line-height: 1; text-align: center; color: var(--rw-gold-t); }
.rw-src-st { font-size: var(--fs-base); font-weight: 650; color: var(--rw-gold-t); }
.rw-src-sv { display: flex; align-items: baseline; gap: .35rem; white-space: nowrap; }
.rw-src-sv b { font-size: var(--fs-xl); font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; background: var(--rw-num); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rw-src-sv i { font-style: normal; font-size: var(--fs-xs); font-weight: 650; color: var(--rw-gold-t); }
/* 链的小圆标(逐笔入账、等到账的地址那一行) */
.rw-chain-i, .rw-ci { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--rw-soft); }
.rw-ci { width: 24px; height: 24px; }
.rw-ci .rw-chain { width: 12px; height: 10px; } .rw-ci .rw-chain.trx { width: 11px; height: 11px; }
/* 入账明细 */
.rw-led-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .9rem; margin: 1.7rem 0 .5rem; }
.rw-led-head .rw-h { margin: 0; }
.rw-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.rw-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--rw-soft); }
.rw-seg button { display: inline-flex; align-items: center; gap: .3rem; height: 24px; padding: 0 .6rem; border: 0; border-radius: 7px; background: transparent; color: var(--rw-mute); font: inherit; font-size: var(--fs-xs); font-weight: 550; cursor: pointer; white-space: nowrap; transition: color .15s, background .15s; }
.rw-seg button:hover { color: var(--rw-ink); }
.rw-seg button.active { background: var(--rw-bg); color: var(--rw-ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.rw-seg .rw-chain { width: 12px; height: 10px; } .rw-seg .rw-chain.trx { width: 11px; height: 11px; }
.rw-list { transition: opacity .15s; }
.rw-list.busy { opacity: .55; }
.rw-row { display: grid; align-items: center; column-gap: .9rem; min-height: 44px; padding: .3rem .5rem; border-bottom: 1px solid var(--rw-line); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.rw-row:not(.head):hover { background: var(--rw-hover); }
.rw-row.head { min-height: 30px; color: var(--rw-faint); font-size: var(--fs-xs); font-weight: 500; }
.rw-row > span { min-width: 0; }
.rw-row .r { text-align: right; justify-content: flex-end; }
.rw-led .rw-row { grid-template-columns: minmax(11rem, 1.3fr) minmax(6.5rem, 1.1fr) 6rem minmax(4.4rem, .6fr) minmax(7.2rem, .8fr); }
.rw-brd .rw-row { grid-template-columns: 2rem minmax(10rem, 1.3fr) 5.4rem minmax(8rem, 1fr) 6.2rem; }
.rw-dnr .rw-row { grid-template-columns: 2rem minmax(10rem, 1.6fr) 4.4rem 6.2rem minmax(7.4rem, .7fr); }
.c-time { color: var(--rw-mute); white-space: nowrap; }
.c-from, .rw-row .c-addr { display: flex; align-items: center; gap: .45rem; min-width: 0; } /* 只管奖励榜单的行:服务器页的地址列也叫 c-addr,被排成 flex 就撑不满整行高(底下露一块) */
.c-kind { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.c-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rw-ink); font-weight: 550; }
.rw-a { padding: .1rem .3rem; margin: 0 -.3rem; border: 0; border-radius: 6px; background: none; color: var(--rw-ink); font-size: var(--fs-sm); cursor: copy; white-space: nowrap; }
.rw-a:hover { background: var(--rw-soft2); }
.c-amt { color: var(--rw-mute); white-space: nowrap; }
.c-cnt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .35rem; white-space: nowrap; }
.c-cnt small { display: none; flex-basis: 100%; color: var(--rw-faint); font-size: 11px; line-height: 1.3; }
.c-cnt b { font-weight: 650; color: var(--rw-ink); }
.c-cnt i { font-style: normal; color: var(--rw-faint); font-size: 11px; }
.rw-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 .45rem; border-radius: 6px; background: var(--rw-soft); color: var(--rw-ink2); font-size: 11px; font-weight: 550; white-space: nowrap; flex: none; }
.rw-tag.ord { background: var(--rw-gold-soft); color: var(--rw-gold-t); }
.rw-tag.don { background: var(--rw-don-soft); color: var(--rw-don-t); }
.rw-tag.me { background: var(--rw-inv); color: var(--rw-inv-t); font-weight: 650; }
.rw-tag.bad { background: var(--rw-bad-soft); color: var(--rw-bad); }
/* 少见的两种入账:人工确认发放的订单(一个不抢眼的小标),订单取消后作废的(整行淡下去、金额划掉、写「不计入」) */
.rw-tag.man, .rw-tag.off { background: none; box-shadow: inset 0 0 0 1px var(--rw-line2); color: var(--rw-mute); font-weight: 500; cursor: help; }
.rw-row.void .c-amt, .rw-row.void .c-from .rw-a { color: var(--rw-faint); text-decoration: line-through; }
.rw-row.void .c-time, .rw-row.void .rw-tag.ord { opacity: .6; }
.c-cnt b.none { color: var(--rw-faint); font-weight: 500; cursor: help; }
.c-nofrom { color: var(--rw-faint); }
.rw-pager { display: flex; align-items: center; gap: .5rem; padding: .75rem .5rem 0; color: var(--rw-mute); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.rw-pager .pg { min-width: 3.2rem; text-align: center; color: var(--rw-ink2); }
/* 积分榜 */
.rw-brd-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: .3rem 0 .5rem; }
.rw-brd-head .rw-in { width: min(16rem, 100%); height: 34px; }
.c-rank { color: var(--rw-faint); text-align: center; }
.rw-medal { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-style: normal; font-size: 11px; font-weight: 700; color: #4a3200; background: linear-gradient(160deg, #ffe69a, #eda91a); }
.rw-medal.m2 { color: #2f3540; background: linear-gradient(160deg, #f3f5f8, #b9c0cc); }
.rw-medal.m3 { color: #4a2a10; background: linear-gradient(160deg, #f5cfa8, #c98549); }
.c-pts { white-space: nowrap; }
.c-pts b { font-weight: 650; }
.c-pts i { display: none; font-style: normal; color: var(--rw-mute); font-size: var(--fs-xs); margin-left: .25rem; }
.c-share { display: flex; align-items: center; gap: .6rem; }
.rw-meter { flex: 1; height: 5px; border-radius: 99px; background: var(--rw-soft2); overflow: hidden; min-width: 2rem; }
.rw-meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #fcd34d, #f59e0b); }
.c-share em { flex: none; width: 3.4rem; text-align: right; font-style: normal; color: var(--rw-mute); font-size: var(--fs-xs); }
.c-val { color: var(--rw-ink2); white-space: nowrap; }
.rw-row.me { background: var(--rw-gold-soft); border-radius: 10px; border-bottom-color: transparent; }
.rw-row.me:hover { background: var(--rw-gold-soft); }
.rw-row.out .rw-a, .rw-row.out .c-pts b { color: var(--rw-faint); text-decoration: line-through; }
/* 被剔除的那一行:原因占「占比 + 约值」两栏,写不下就折行,不截断(触屏上没有悬停可看) */
.rw-brd .c-why { grid-column: 4 / -1; color: var(--rw-bad); font-size: var(--fs-xs); line-height: 1.45; padding: .15rem 0; overflow-wrap: anywhere; }

/* 捐赠 */
.rw-dn { padding: 1.1rem 1.25rem 1.15rem; border: 1px solid var(--rw-line2); border-radius: 16px; background: var(--rw-bg); box-shadow: var(--rw-card); }
.rw-dn-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.rw-dn-h h3 { display: flex; align-items: center; gap: .45rem; margin: 0; font-size: var(--fs-md); font-weight: 650; }
.rw-dn-h h3 svg { width: 17px; height: 17px; color: #e8970c; flex: none; }
.rw-dn-lead { margin: .35rem 0 0; color: var(--rw-ink2); font-size: var(--fs-sm); line-height: 1.65; text-wrap: pretty; }
.rw-dn-lead.ok { display: flex; align-items: flex-start; gap: .5rem; }
.rw-dn-lead.ok svg { flex: none; width: 18px; height: 18px; margin-top: .15rem; color: var(--rw-ok); }
.rw-dn-form { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: .65rem; align-items: end; margin-top: .9rem; }
.rw-f { display: grid; gap: .3rem; min-width: 0; }
.rw-amt { position: relative; display: block; }
.rw-amt .rw-in { padding-right: 3.3rem; font-variant-numeric: tabular-nums; }
.rw-amt i { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--rw-faint); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .03em; pointer-events: none; }
.rw-dn-quick { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .6rem; }
.rw-dn-quick > span { color: var(--rw-mute); font-size: var(--fs-xs); margin-right: .25rem; }
.rw-dn-quick button { height: 26px; min-width: 2.6rem; padding: 0 .6rem; border: 1px solid var(--rw-line2); border-radius: 99px; background: var(--rw-bg); color: var(--rw-ink2); font: inherit; font-size: var(--fs-xs); font-weight: 550; font-variant-numeric: tabular-nums; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.rw-dn-quick button:hover { background: var(--rw-gold-soft); border-color: var(--rw-gold-line); color: var(--rw-gold-t); }
.rw-dn .rw-bind-err { margin-top: .5rem; }
.rw-dn > .rw-hint { margin-top: .7rem; }
.rw-dn-timer { display: inline-flex; align-items: center; gap: .35rem; height: 28px; padding: 0 .7rem; border-radius: 99px; background: var(--rw-gold-soft); color: var(--rw-gold-t); font-variant-numeric: tabular-nums; flex: none; }
.rw-dn-timer svg { width: 14px; height: 14px; }
.rw-dn-timer b { font-size: var(--fs-sm); font-weight: 650; }
.rw-dn-pay { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.25rem; align-items: start; margin-top: .95rem; }
.rw-dn-steps { display: grid; gap: .95rem; min-width: 0; }
.rw-dn-step { display: grid; gap: .4rem; min-width: 0; }
.rw-dn-step .rw-k i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--rw-ink); color: var(--rw-bg); font-style: normal; font-size: 11px; font-weight: 700; }
.rw-dn-amt { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; }
.rw-dn-amt b { font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; background: var(--rw-num); -webkit-background-clip: text; background-clip: text; color: transparent; user-select: all; }
.rw-dn-amt > span { font-size: var(--fs-xs); font-weight: 650; color: var(--rw-gold-t); letter-spacing: .05em; margin-right: .4rem; }
.rw-dn-amt .rw-btn { align-self: center; }
.rw-dn-addr { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 12px; background: var(--rw-soft); min-width: 0; }
.rw-dn-addr .rw-chain-i { width: 26px; height: 26px; background: var(--rw-bg); }
.rw-dn-addr code { min-width: 0; font-size: var(--fs-sm); line-height: 1.45; word-break: break-all; user-select: all; }
.rw-dn-btns { display: flex; flex-wrap: wrap; gap: .4rem; }
.rw-dn-qr { display: grid; justify-items: center; gap: .35rem; }
.rw-dn-qr img { display: block; width: 120px; height: 120px; padding: 6px; border-radius: 10px; background: #fff; border: 1px solid var(--rw-line2); image-rendering: pixelated; } /* 图本身不带白边:这 6px 就是扫码要的静区 */
.rw-dn-qr span { color: var(--rw-mute); font-size: 11px; }
.rw-dn-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-top: .95rem; }
.rw-dn-live { display: inline-flex; align-items: center; gap: .45rem; color: var(--rw-mute); font-size: var(--fs-xs); }
.rw-dn-live i { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; animation: rw-pulse 1.6s ease-in-out infinite; }
@keyframes rw-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .45); } 50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); } }
/* 捐赠榜 */
.c-dname { display: grid; grid-template-columns: minmax(0, 10.5rem) minmax(2rem, 1fr); align-items: center; gap: .9rem; min-width: 0; }
.c-dname b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.c-dcnt { color: var(--rw-mute); white-space: nowrap; }
.c-dsum { white-space: nowrap; }
.c-dsum b { font-weight: 650; }
.c-dsum i { font-style: normal; color: var(--rw-faint); font-size: 11px; margin-left: .3rem; }
/* 规则 */
.rw-rules { list-style: none; margin: .1rem 0 0; padding: 0; }
.rw-rules li { display: flex; gap: .9rem; padding: .8rem .1rem; border-bottom: 1px solid var(--rw-line); }
.rw-rules li > i { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--rw-ink); color: var(--rw-bg); font-style: normal; font-size: var(--fs-xs); font-weight: 700; margin-top: .05rem; }
.rw-rules b { display: block; font-size: var(--fs-base); font-weight: 650; }
.rw-rules span { display: block; margin-top: .15rem; color: var(--rw-ink2); font-size: var(--fs-sm); line-height: 1.65; text-wrap: pretty; }
.rw-priv { margin-top: 1.3rem; padding: 1rem 1.15rem; border-radius: 14px; background: var(--rw-soft); }
.rw-priv .rw-h { margin: 0 0 .45rem; font-size: var(--fs-sm); }
.rw-priv ul { margin: 0 0 .6rem; padding-left: 1.1rem; display: grid; gap: .25rem; color: var(--rw-ink2); font-size: var(--fs-sm); line-height: 1.6; }

/* 中等宽度(活动页自己 ≤ 720):金币小一号,「我的」分两行,算式两列 */
@container rw (max-width: 720px) {
  .rw-hero { grid-template-columns: minmax(0, 1fr) 9.5rem; column-gap: 1rem; }
  .rw-art { width: 7.4rem; height: 7.8rem; } .rw-art .rw-coin-svg { width: 6.8rem; }
  .rw-pool-v b { font-size: 2.9rem; }
  .rw-me-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pts tfc addr" "grow grow grow"; row-gap: .95rem; }
  .rw-me-c.grow { padding-left: 0; border-left: 0; }
  .rw-led .rw-row { grid-template-columns: minmax(10rem, 1.2fr) minmax(5.5rem, 1fr) 5.6rem minmax(6.6rem, .8fr); }
  .rw-led .c-amt { display: none; }
  .rw-led .c-cnt i { display: none; }
  .rw-led .c-cnt small { display: block; }
  .rw-led .rw-row.head > :nth-child(4) { display: none; }
  .rw-brd .rw-row { grid-template-columns: 1.8rem minmax(9rem, 1.2fr) 4.6rem minmax(6rem, 1fr) 5.6rem; }
  .rw-dnr .rw-row { grid-template-columns: 1.8rem minmax(8rem, 1.5fr) 3.8rem 5.6rem minmax(6.6rem, .7fr); }
  .c-dname { grid-template-columns: minmax(0, 7.5rem) minmax(2rem, 1fr); gap: .6rem; }
}
/* 窄(活动页自己 ≤ 540,手机):头部金币缩到标题右边,各块上下叠,表格每条两行 */
@container rw (max-width: 540px) {
  .rw-hero { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "hd art" "lead lead" "pool pool" "acts acts"; column-gap: .75rem; }
  .rw-hero-r { align-self: start; gap: 0; margin-right: 2.35rem; }
  .rw-art { width: 4.6rem; height: 4.8rem; } .rw-art .rw-coin-svg { width: 4.2rem; }
  .rw-art > i.s1 { top: 0; left: -6%; } .rw-art > i.s3 { display: none; }
  .rw-art-c { display: none; } /* 百分比和「还差多少」下面「我的」那一条里就有 */
  .rw-slogan { font-size: 1.5rem; }
  .rw-kicker { flex-wrap: wrap; row-gap: 0; }
  .rw-pool { margin-top: 1.1rem; }
  .rw-pool-v b { font-size: 2.6rem; }
  .rw-acts { gap: .7rem 1rem; }
  .rw-me { padding: .9rem .95rem; }
  .rw-me-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "pts tfc" "grow grow" "addr addr"; row-gap: .9rem; column-gap: 1rem; }
  .rw-me-c.tfc { padding-left: 1rem; }
  .rw-me-c.addr:not(.cta) { padding-left: 0; border-left: 0; padding-top: .85rem; border-top: 1px dashed var(--rw-line2); }
  .rw-me-c.addr.cta .rw-btn { width: 100%; }
  .rw-me-v em { white-space: normal; }
  .rw-bind-r { flex-wrap: wrap; } .rw-bind-r .rw-in { flex-basis: 100%; } .rw-bind-r .rw-btn { flex: 1; }
  .rw-tabs { gap: 1.25rem; }
  .rw-src-row, .rw-src-sum { grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: .7rem; padding: .8rem .9rem; }
  .rw-src-row { align-items: start; }
  .rw-src-i { width: 34px; height: 34px; border-radius: 11px; }
  .rw-src-v { font-size: var(--fs-md); padding-top: .05rem; }
  .rw-src-sv b { font-size: var(--fs-lg); }
  .rw-led-head { margin-top: 1.4rem; }
  .rw-row { column-gap: .6rem; padding: .6rem .25rem; row-gap: .25rem; min-height: 0; }
  .rw-row.head { display: none; }
  .rw-led .rw-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "from from cnt" "kind time cnt"; }
  .rw-led .c-from { grid-area: from; } .rw-led .c-cnt { grid-area: cnt; align-self: center; justify-content: flex-end; } .rw-led .c-kind { grid-area: kind; padding-left: calc(24px + .45rem); }
  .rw-led .c-time { grid-area: time; font-size: var(--fs-xs); }
  .rw-led .c-cnt small { text-align: right; }
  .rw-brd .rw-row { grid-template-columns: 1.7rem minmax(0, 1fr) auto; grid-template-areas: "rank addr pts" "rank share val"; }
  .rw-brd .c-rank { grid-area: rank; align-self: start; padding-top: .1rem; } .rw-brd .c-addr { grid-area: addr; flex-wrap: wrap; row-gap: .25rem; } .rw-brd .c-pts { grid-area: pts; }
  .rw-brd .c-pts i { display: inline; }
  .rw-brd .c-share { grid-area: share; } .rw-brd .c-val { grid-area: val; font-size: var(--fs-xs); color: var(--rw-mute); }
  .rw-brd .c-share em { width: auto; }
  .rw-brd .c-why { grid-area: share; grid-column: 2 / -1; padding: 0; }
  .rw-brd-head .rw-in { width: 100%; }
  .rw-dnr .rw-row { grid-template-columns: 1.7rem minmax(0, 1fr) auto; grid-template-areas: "rank name sum" "rank cnt time"; }
  .rw-dnr .c-rank { grid-area: rank; align-self: start; padding-top: .1rem; } .rw-dnr .c-dname { grid-area: name; } .rw-dnr .c-dsum { grid-area: sum; }
  .rw-dnr .c-dcnt { grid-area: cnt; text-align: left; font-size: var(--fs-xs); } .rw-dnr .c-time { grid-area: time; text-align: right; font-size: var(--fs-xs); }
  .rw-dnr .c-dname { grid-template-columns: minmax(0, 1fr); } .rw-dnr .c-dname .rw-meter { display: none; }
  .rw-pager { padding-left: .25rem; padding-right: .25rem; }
  .rw-dn { padding: 1rem .95rem 1.05rem; }
  .rw-dn-form { grid-template-columns: minmax(0, 1fr); }
  .rw-dn-form .rw-btn { width: 100%; }
  .rw-dn-pay { grid-template-columns: minmax(0, 1fr); }
  .rw-dn-qr { justify-self: center; order: 2; }
  .rw-dn-amt b { font-size: 1.75rem; }
  .rw-rules li { gap: .7rem; }
}
/* 窗口本身很窄(手机):活动页贴底、占满宽 */
@media (max-width: 640px) {
  .rw-ov { padding: 0; place-items: end stretch; }
  .rw-sheet { width: 100%; max-height: 95vh; max-height: 95dvh; border-radius: 22px 22px 0 0; animation-name: rw-up; }
  .rw-in-w { --rw-px: 1.1rem; padding-top: 1.5rem; padding-bottom: 1.25rem; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .rw-in-w { --rw-px: 1.6rem; }
}
@keyframes rw-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .rw-ov, .rw-sheet, .rw-art .rw-coin-svg, .rw-art-sh, .rw-art > i, .rw-spark, .rw-tip, .rw-dn-live i, .rw-coin.pop .rw-coin-svg, .rw-coin.pop .rw-n, .set-row.flash, .set-sec.flash { animation: none !important; }
  .rw-bar i { transition: none; }
}
/* ---- 流量奖励:完 ---- */
/* 线路编辑框:走 IPv6 时摆在外面的那句提醒、HTTPUpgrade 的兼容说明 */
.v6-need { margin: 0 0 .45rem; }
.form-grid > .tr-note { grid-column: 1 / -1; margin: -.2rem 0 0; }

/* ===== 简洁模式与「?」说明(用户 11-21,见 js/qhelp.js) =====
   模板里标了 .xp 的是功能说明;挂上「?」的(.has-qh)在简洁模式下藏起来,「?」露出来。没挂上「?」的说明照常显示 */
.qh { display: none; position: relative; flex: none; width: 18px; height: 18px; margin: 0 0 0 .3rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--faint); vertical-align: -3px; cursor: pointer; place-items: center; transition: color .12s, background .12s; }
.qh::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; } /* 点的范围比图标大一圈 */
.qh svg { display: block; width: 15px; height: 15px; }
.qh:hover, .qh[aria-expanded="true"] { color: var(--primary); }
.qh[aria-expanded="true"] { background: var(--primary-soft); }
.qh:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
:root[data-concise] .qh:not([hidden]), .qh.qh-always:not([hidden]) { display: inline-grid; }
/* 详细模式(除了两种模式都只在「?」里的那几处)和没有内容的「?」一律藏住:「某某 span { display: … }」这类宽泛的样式(权限卡片里就有)不能把它带出来 */
:root:not([data-concise]) .qh:not(.qh-always), .qh[hidden] { display: none !important; }
:root[data-concise] .xp:not([data-qh-none]), .xp.xp-always:not([data-qh-none]) { display: none !important; } /* 先藏;找不到标题挂「?」的(data-qh-none)照常显示 */
.topbar-title > .qh { margin-left: .4rem; }
/* 顶栏标题后面的「?」露着时,标题最多占「整行减去『?』」(18px + .4rem):太长就显示省略号,「?」不换到第二排把顶栏撑高 */
:root[data-concise] .topbar-title > h1:has(+ .qh:not([hidden])) { max-width: calc(100% - 1.6rem); }
/* 弹窗标题长到正好占满一行时,「?」不单独掉到第二行(设置页伪装站预览的标题带着随机站名,手机宽度上碰到过):
   有「?」的标题排成一行两格,字在自己那一格里折行,「?」留在第一行的末尾 */
#modal-title:has(> .qh:not([hidden])) { display: flex; align-items: baseline; }
#modal-title > .qh { align-self: center; }
.qh-glue { white-space: nowrap; } /* 标签的最后一个词和「?」不分开(见 qhelp.js 的 glue) */
.qh-tip { position: fixed; z-index: 85; max-width: min(24rem, calc(100vw - 16px)); padding: .6rem .8rem; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); font-weight: 400; line-height: 1.6; text-align: left; white-space: normal; overflow-wrap: anywhere; animation: qh-in .12s ease-out; }
.qh-tip[hidden] { display: none; }
.qh-tip::before { content: ""; position: absolute; left: calc(var(--qh-x, 16px) - 5px); width: 9px; height: 9px; background: var(--surface); border: 1px solid var(--border); transform: rotate(45deg); }
.qh-tip[data-side="below"]::before { top: -5.5px; border-right: 0; border-bottom: 0; }
.qh-tip[data-side="above"]::before { bottom: -5.5px; border-left: 0; border-top: 0; }
.qh-p + .qh-p { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--divider); }
.qh-tip a { color: var(--primary-text); }
@keyframes qh-in { from { opacity: 0; transform: translateY(-3px); } }

/* 设置 → 界面:两项都是左边名称和说明、右边控件 */
.ui-ctl { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .45rem .75rem; }
/* 开关行的「.set-row.bool .set-ctl { align-items: flex-end }」管的是竖排时靠右;这里控件是横排,它就成了「靠下」,「全部显示」比按钮低一截 —— 改回垂直居中 */
.set-row.ui-row .set-ctl { align-items: center; }
/* 手机宽度的详细模式:这两行右边的控件(「全部显示 + 选择栏目」、详细 / 简洁)比开关宽得多,和说明并排时说明被挤成很窄的一列、
   五六行(11-21 第五遍补测发现),改成说明在上、控件在下靠左。简洁模式只剩标题,并排正好,不动 */
@media (max-width: 560px) {
  :root:not([data-concise]) .set-row.ui-row { grid-template-columns: minmax(0, 1fr); }
  :root:not([data-concise]) .set-row.ui-row .set-ctl { justify-content: flex-start; }
}
.ui-nav-sum { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.ui-nav-btn { gap: .4rem; }
.ui-nav-btn svg { flex: none; width: 15px; height: 15px; }
/* 选栏目的浮层:和侧栏一样的分组、图标;去掉勾的变灰,一眼看出侧栏会少哪几项 */
.np-pop { position: fixed; z-index: 70; width: min(33rem, calc(100vw - 16px)); padding: .65rem .7rem .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: qh-in .12s ease-out; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 0 .5rem .45rem; margin-bottom: .35rem; border-bottom: 1px solid var(--divider); }
.np-head b { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.np-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .1rem .4rem; }
.np-g.np-top { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: .4rem; }
.np-h { padding: .45rem .5rem .2rem; font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: .02em; text-transform: uppercase; user-select: none; }
.np-item { display: flex; align-items: center; gap: .55rem; min-height: 32px; padding: .2rem .5rem; border-radius: var(--radius-xs); font-size: var(--fs-sm); color: var(--text); cursor: pointer; user-select: none; transition: background .1s; }
.np-item:hover { background: var(--surface-3); }
.np-ic { display: grid; place-items: center; flex: none; width: 16px; height: 16px; color: var(--muted); }
.np-ic svg { width: 16px; height: 16px; }
.np-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-item:has(input:not(:checked)) .np-t { color: var(--faint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--faint) 60%, transparent); }
.np-item:has(input:not(:checked)) .np-ic { opacity: .45; }
.np-item.locked { cursor: default; }
.np-item.locked:hover { background: transparent; }
.np-item.locked input { cursor: default; }
.np-lock { display: grid; place-items: center; flex: none; margin-left: auto; color: var(--faint); }
.np-lock svg { width: 13px; height: 13px; }
.np-foot { margin: .55rem .45rem 0; font-size: var(--fs-xs); line-height: 1.5; color: var(--muted); }
@media (max-width: 560px) {
  .np-body, .np-g.np-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .qh-tip, .np-pop { animation: none; } }
/* 简洁模式的排版(用户 11-21「隐藏文字之后 有的区域是不是可以稍微改善排版 变得简洁紧凑一点 同时要注意整体页面的视觉排版」):
   对比过三档 —— 只藏文字 / 适度收紧 / 更紧凑,定的是适度收紧:说明收起来以后行距、卡片下边距收一点,
   设置项的名称和控件垂直居中(详细模式下名称下面有说明,靠上对齐才对;简洁模式只剩一行名称,靠上就和输入框里的字错开了),
   (规则弹框里和输入框并排的那格开关另改成开关 + 名称并排、落在输入框那一行,见 .rl-tight) */
.set-sec > .card-head h2 > .qh { margin-left: -.2rem; } /* 这个标题是弹性布局、自带 .5rem 间距 */
:root[data-concise] .set-row { padding: .68rem 0; align-items: center; }
:root[data-concise] .set-sec { padding-bottom: 1rem; }
:root[data-concise] .set-sec > .card-head { margin-bottom: .35rem; }
:root[data-concise] .sw-row { padding-top: .55rem; padding-bottom: .55rem; }
:root[data-concise] .form-grid { row-gap: .75rem; }
:root[data-concise] .card-head { margin-bottom: .65rem; }
