/*
 * subagg —— Web 管理界面样式
 *
 * 沿用原型的深色配色与布局。零构建：没有预处理器、没有打包器，
 * 浏览器直接加载这一个文件。
 *
 * 相对原型的一处关键修正：地区色标原先硬编码了 .r-HK ~ .r-UK 共七个类，
 * 出现第八个地区就没有样式。现在改为由 JS 按地区码哈希出色相，
 * 通过 --region-hue 变量注入（见 app.js 的 regionHue）。
 */

:root {
  --bg: #f4f6f8; --s1: #fff; --s2: #eef1f5; --s3: #e2e7ee; --s4: #d7dee8;
  --border: #c7d0db; --accent: #4f46e5; --accent-fg: #4338ca;
  --adim: rgb(79 70 229 / .12); --text: #1f2328; --text2: #4a5560; --text3: #656e78;
  --ok: #238636; --ok-fg: #116329; --warn: #9a6700; --warn-fg: #7d4e00; --danger: #cf222e; --danger-fg: #b42318;
  --row-hover: #f8fafc; --inset: #f8fafc; --disabled-o: .55; --overlay: rgb(0 0 0 / .42);
  --vless-rgb: 99 102 241; --vmess-rgb: 63 185 80; --trojan-rgb: 210 153 34; --ss-rgb: 248 81 73;
  --ssr-rgb: 236 72 153; --hysteria-rgb: 56 189 248; --tuic-rgb: 168 85 247; --muted-rgb: 125 133 144;
  /*
   * 产品主色（橙）。**不是 --accent 的别名**：--accent 是靛蓝，用在表单聚焦、
   * chip 选中这类"系统交互"上；橙色是工作台外壳的品牌色，用在激活态标签页、
   * 主按钮、以及 IX 页那些"被标记的行/胶囊"上。两者语义不同，不能互相顶替。
   * --brand-rgb 让半透明底走 rgb(var(--brand-rgb) / .12)，与协议色同一写法。
   */
  --brand: #ea580c; --brand-fg: #c2410c; --brand-rgb: 234 88 12;
  --r: 8px; --r2: 12px; color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d1117; --s1: #161b22; --s2: #1c2128; --s3: #262c36; --s4: #30363d;
  --border: #30363d; --accent: #6366f1; --accent-fg: #a5b4fc; --adim: rgb(99 102 241 / .18);
  --text: #e6edf3; --text2: #7d8590; --text3: #484f58; --ok: #3fb950; --ok-fg: #7ee787;
  --warn: #d29922; --warn-fg: #e3b341; --danger: #f85149; --danger-fg: #ffa198;
  --row-hover: rgb(22 27 34 / .7); --inset: #0d1117; --disabled-o: .45; --overlay: rgb(0 0 0 / .65);
  /* 深色下橙色必须调亮：#ea580c 在 #161b22 上只有 2.6:1，读不清。 */
  --brand: #fb923c; --brand-fg: #fdba74; --brand-rgb: 251 146 60; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

button { cursor: pointer; border: none; font: inherit; outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
input, select, textarea { font: inherit; }
a { color: var(--accent-fg); }

/* ── topbar ─────────────────────────────────────── */
.topbar {
  height: 50px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: var(--s1);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-weight: 700; font-size: 15px; letter-spacing: -.4px;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-tag {
  font-size: 11px; color: var(--text3); font-weight: 400;
  -webkit-text-fill-color: var(--text3); margin-left: 4px;
}
.spacer { flex: 1; }
.sync-btn {
  background: var(--accent); color: #fff;
  padding: 5px 14px; border-radius: var(--r);
  font-weight: 500; font-size: 12px;
  transition: opacity .15s;
}
.sync-btn:hover { background: var(--accent-fg); }
.sync-btn:disabled { opacity: .45; cursor: default; }
.last-sync { font-size: 11px; color: var(--text3); }
.icon-btn {
  background: transparent; color: var(--text3);
  padding: 4px 8px; border-radius: 6px; font-size: 13px;
}
.icon-btn:hover { background: var(--s3); color: var(--text); }

/* ── layout ─────────────────────────────────────── */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ── sidebar ────────────────────────────────────── */
.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--s1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px;
}
.sb-title {
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .8px;
}
.add-btn {
  background: var(--s3); color: var(--text2);
  padding: 3px 10px; border-radius: 6px; font-size: 11px;
  border: 1px solid var(--border);
}
.add-btn:hover { background: var(--border); color: var(--text); }
.sub-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.sub-item {
  padding: 9px 10px; border-radius: var(--r); cursor: pointer;
  margin-bottom: 3px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  position: relative;
}
.sub-item:hover { background: var(--s2); }
.sub-item.active { background: var(--s2); border-color: var(--accent); }
.sub-item.errored { border-left: 2px solid var(--danger); }
.sub-item.disabled { opacity: var(--disabled-o); }
.sub-name {
  font-weight: 500; font-size: 13px; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
}
.sub-meta { display: flex; align-items: center; gap: 6px; }
.sub-nc { font-size: 11px; color: var(--text3); white-space: nowrap; }
.sub-bar { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.sub-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transition: width .3s;
}
.sub-fill.danger { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.sub-rem { font-size: 11px; color: var(--text2); white-space: nowrap; }
.sub-err {
  font-size: 10px; color: var(--danger); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub-actions {
  position: absolute; top: 6px; right: 6px;
  display: none; gap: 3px;
}
.sub-item:hover .sub-actions { display: flex; }

.sb-foot { padding: 10px 14px; border-top: 1px solid var(--border); }
.tot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tot-cell { background: var(--s2); border-radius: 6px; padding: 7px 9px; }
.tot-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.tot-val { font-size: 13px; font-weight: 600; margin-top: 1px; }

/* ── main ───────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tabs {
  display: flex; flex-shrink: 0;
  padding: 0 18px; gap: 2px;
  background: var(--s1); border-bottom: 1px solid var(--border);
}
.tab {
  padding: 13px 14px; color: var(--text2); cursor: pointer;
  border-bottom: 2px solid transparent; font-weight: 500;
  transition: color .12s, border-color .12s; user-select: none;
  background: transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-fg); border-bottom-color: var(--accent); }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--s3); color: var(--text2);
  font-size: 10px; padding: 1px 5px; border-radius: 8px; margin-left: 5px;
}
.tab-body { flex: 1; overflow-y: auto; padding: 18px; }
.pane { display: none; }
.pane.active { display: block; }

/* ── filter bar ─────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  background: var(--s2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px 11px;
  color: var(--text); font-size: 12px; width: 190px;
  transition: border-color .12s;
}
.search:focus { outline: none; border-color: var(--accent); }
.search::placeholder { color: var(--text3); }
.chip-group { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--s2); color: var(--text2);
  transition: all .12s; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on { background: var(--adim); border-color: var(--accent); color: var(--accent-fg); }
.vr { width: 1px; height: 20px; background: var(--border); }
.fsumm { margin-left: auto; font-size: 11px; color: var(--text3); }

/* ── node table ─────────────────────────────────── */
.ntable { width: 100%; border-collapse: collapse; }
.ntable th {
  text-align: left; padding: 7px 11px;
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ntable td { padding: 8px 11px; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); vertical-align: middle; }
.ntable tr:hover td { background: var(--row-hover); }
.ntable td.pick-cell, .ntable th.pick-cell { width: 32px; padding-right: 0; }
.nname { font-weight: 500; }
.nbadge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
}
.t-vless     { background: rgb(var(--vless-rgb) / .2); color: var(--accent-fg); }
.t-vmess     { background: rgb(var(--vmess-rgb) / .2); color: var(--ok-fg); }
.t-trojan    { background: rgb(var(--trojan-rgb) / .2); color: var(--warn-fg); }
.t-ss        { background: rgb(var(--ss-rgb) / .2); color: var(--danger-fg); }
.t-ssr       { background: rgb(var(--ssr-rgb) / .2); color: var(--accent-fg); }
.t-hysteria2 { background: rgb(var(--hysteria-rgb) / .2); color: var(--accent-fg); }
.t-tuic      { background: rgb(var(--tuic-rgb) / .2); color: var(--accent-fg); }

/*
 * 地区色标。色相由 JS 按地区码哈希得出并写入 --region-hue，
 * 因此任意地区都有稳定且互相区分的配色，不再受硬编码列表限制。
 */
.rtag {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
  background: hsl(var(--region-hue, 220) 70% 60% / .16);
  color: hsl(var(--region-hue, 220) 75% 76%);
}
.rtag.unknown { background: rgb(var(--muted-rgb) / .15); color: var(--text2); }

.nmono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; color: var(--text2); }
.nsrc  { font-size: 11px; color: var(--text3); }
.nact  { opacity: 0; text-align: right; white-space: nowrap; }
tr:hover .nact { opacity: 1; }
.icobtn {
  background: var(--s3); border: 1px solid var(--border);
  color: var(--text2); padding: 2px 7px; border-radius: 5px;
  font-size: 11px; cursor: pointer;
}
.icobtn:hover { color: var(--text); }
.icobtn.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ── profile cards ──────────────────────────────── */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pcard {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 15px;
  transition: border-color .15s;
}
.pcard:hover { border-color: var(--accent); }
.pcard-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.picon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; background: var(--s3);
}
.pinfo-name { font-weight: 600; margin-bottom: 2px; }
.pinfo-desc { font-size: 11px; color: var(--text2); }
.ptags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 11px; }
.ptag {
  padding: 2px 8px; border-radius: 10px; font-size: 10px;
  background: var(--s2); color: var(--text2); border: 1px solid var(--border);
}
.ptag.accent {
  background: rgb(var(--vless-rgb) / .1); color: var(--accent-fg);
  border-color: rgb(var(--vless-rgb) / .25);
}
.pfoot { display: flex; align-items: center; gap: 8px; }
.pcount { font-size: 11px; color: var(--text3); }
.genbtn {
  margin-left: auto; background: var(--accent); color: #fff;
  padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 500;
}
.genbtn:hover { opacity: .84; }
.shared-badge {
  font-size: 10px; background: rgb(var(--vmess-rgb) / .15); color: var(--ok-fg);
  border: 1px solid rgb(var(--vmess-rgb) / .3); padding: 2px 7px; border-radius: 10px;
  white-space: nowrap;
}

/* ── traffic cards ──────────────────────────────── */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tcard {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 16px;
}
.tcard-name {
  font-weight: 600; font-size: 14px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tcard-fmt { font-size: 10px; color: var(--text3); font-weight: 400; white-space: nowrap; }
.donut-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.donut { position: relative; width: 78px; height: 78px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-pct { font-size: 14px; font-weight: 700; }
.donut-sub { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; }
.tstats { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.trow { display: flex; justify-content: space-between; align-items: center; }
.tkey { font-size: 11px; color: var(--text2); }
.tval { font-size: 12px; font-weight: 500; }
.pbar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.pfill { height: 100%; border-radius: 3px; transition: width .4s; }
.f-ok   { background: linear-gradient(90deg, var(--ok),     #34d399); }
.f-warn { background: linear-gradient(90deg, var(--warn),   #fbbf24); }
.f-bad  { background: linear-gradient(90deg, var(--danger), #f87171); }
.exp-ok   { color: var(--ok);     font-size: 11px; }
.exp-warn { color: var(--warn);   font-size: 11px; }
.exp-bad  { color: var(--danger); font-size: 11px; }

/* ── friends ────────────────────────────────────── */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fcard {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 15px;
}
.fcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.fname { font-weight: 600; }
.fsince { font-size: 11px; color: var(--text3); }
.frefresh { margin-left: auto; text-align: right; font-size: 11px; color: var(--text3); }
.fstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.fstat { background: var(--s2); border-radius: 6px; padding: 7px 9px; text-align: center; }
.fstat-val { font-size: 15px; font-weight: 600; }
.fstat-lbl { font-size: 10px; color: var(--text3); margin-top: 1px; }
.fnote {
  font-size: 11px; color: var(--text3); line-height: 1.55;
  background: var(--s2); border-radius: 6px; padding: 8px;
  border-left: 3px solid var(--border); margin-top: 10px;
}
.faction { display: flex; gap: 6px; margin-top: 11px; }
.fabtn {
  flex: 1; padding: 5px 4px; text-align: center;
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text2); font-size: 11px; cursor: pointer;
}
.fabtn:hover { background: var(--s3); color: var(--text); }
.warn-box {
  background: rgb(var(--trojan-rgb) / .12); border: 1px solid rgb(var(--trojan-rgb) / .25);
  border-radius: var(--r); padding: 9px 13px; margin-bottom: 14px;
  font-size: 12px; color: var(--warn-fg); line-height: 1.55;
}
.token-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  background: var(--s2); border-radius: 6px; padding: 6px 8px; margin-bottom: 5px;
}
.token-url {
  flex: 1 1 100%; min-width: 0; padding: 6px 8px;
  background: var(--s1); border: 1px solid var(--border); border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px; line-height: 1.55; color: var(--text2);
  overflow-wrap: anywhere; white-space: normal; user-select: all;
}
.token-actions { display: flex; flex: 1 1 100%; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.token-actions .field-hint { margin-right: auto; }
.token-row.revoked .token-url { text-decoration: line-through; color: var(--text3); }
.token-row.dead .token-url { text-decoration: line-through; color: var(--text3); }

/* ── modal ──────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: var(--overlay); backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 22px;
  width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto;
}
.modal.wide { width: 860px; }
.modal.profile-editor {
  width: min(1440px, calc(100vw - 32px)); height: min(900px, calc(100vh - 32px));
  max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border-radius: 16px;
  --pe-accent: #f97316; --pe-ink: #1f2328; --pe-muted: #68717c; --pe-card: #fff;
  --pe-canvas: #f6f6f3; --pe-line: #e1e2de; --pe-soft: #f0f1ee;
}
.profile-editor-page {
  min-height: calc(100vh - 176px); overflow: hidden; border: 1px solid #e1e2de; border-radius: 16px;
  --pe-accent: #f97316; --pe-ink: #1f2328; --pe-muted: #68717c; --pe-card: #fff;
  --pe-canvas: #f6f6f3; --pe-line: #e1e2de; --pe-soft: #f0f1ee;
}
.profile-editor-page .pe-shell { min-height: calc(100vh - 176px); }
.pe-shell { height: 100%; display: flex; flex-direction: column; background: var(--pe-canvas); color: var(--pe-ink); }
.pe-header { height: 76px; flex: 0 0 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 26px; background: var(--pe-card); border-bottom: 1px solid var(--pe-line); }
.pe-brand, .pe-header-actions, .pe-card-head, .pe-picker-toolbar, .pe-role-title { display: flex; align-items: center; }
.pe-brand { gap: 14px; min-width: 0; }
.pe-brand h1 { font-size: 18px; letter-spacing: 0; margin-top: 2px; }
.pe-kicker { color: var(--pe-accent); font-size: 10px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.pe-back { width: 34px; height: 34px; border: 1px solid var(--pe-line); border-radius: 8px; background: var(--pe-card); color: var(--pe-muted); font-size: 18px; }
.pe-back:hover { border-color: var(--pe-accent); color: var(--pe-accent); }
.pe-header-actions { gap: 10px; }
.pe-status { color: var(--pe-muted); font-size: 11px; white-space: nowrap; }
.pe-status i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #22c55e; }
.pe-header .btn-pri { background: var(--pe-accent); color: #fff; }
.pe-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 180px minmax(0, 1fr) 300px; }
.pe-rail { padding: 24px 14px; background: #202124; color: #fff; }
.pe-rail-label { padding: 0 10px 12px; color: #9ca3af; font-size: 10px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; }
.pe-rail-item { display: flex; align-items: center; gap: 9px; padding: 11px 10px; margin-bottom: 4px; border-radius: 8px; color: #aeb4bc; font-size: 12px; }
.pe-rail-item b { width: 22px; color: #7d858f; font-size: 10px; }
.pe-rail-item em { margin-left: auto; color: #777e87; font-size: 10px; font-style: normal; }
.pe-rail-item.active { background: rgb(249 115 22 / .16); color: #fff; }
.pe-rail-item.active b { color: #fb923c; }
.pe-rail-note { margin: 34px 10px 0; padding-top: 16px; border-top: 1px solid #35383e; color: #9ca3af; font-size: 11px; line-height: 1.65; }
.pe-rail-note strong { display: block; margin-bottom: 5px; color: #e5e7eb; }
.pe-main { min-width: 0; overflow: auto; padding: 26px; }
.pe-inspector { min-width: 0; overflow: auto; padding: 26px 22px; background: #fff; border-left: 1px solid var(--pe-line); }
.pe-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.pe-icon-input { flex: 0 0 58px; text-align: center; }
.pe-icon-input .input { height: 52px; padding: 0; text-align: center; background: #fff; border-color: var(--pe-line); font-size: 22px; }
.pe-icon-input small, .pe-inspector-section small, .pe-chain-options small { display: block; margin-top: 6px; color: var(--pe-muted); font-size: 10px; line-height: 1.45; }
.pe-hero-fields { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr); gap: 12px; }
.pe-main .field { margin-bottom: 0; }
.pe-main .field-label, .pe-inspector .field-label { color: var(--pe-muted); }
.pe-main .input, .pe-main .select, .pe-inspector .input, .pe-inspector .select { background: #fff; border-color: var(--pe-line); color: var(--pe-ink); }
.pe-title-input { font-size: 16px; font-weight: 650; }
.pe-card { margin-bottom: 16px; padding: 20px; background: var(--pe-card); border: 1px solid var(--pe-line); border-radius: 12px; box-shadow: 0 2px 8px rgb(31 35 40 / .03); }
.pe-card-head { justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.pe-card h2, .pe-inspector h2 { margin-top: 3px; font-size: 15px; letter-spacing: 0; }
.pe-card p, .pe-inspector p { margin-top: 5px; color: var(--pe-muted); font-size: 11px; line-height: 1.5; }
.pe-count-pill { padding: 6px 10px; border: 1px solid #fed7aa; border-radius: 999px; background: #fff7ed; color: #c2410c; font-size: 11px; white-space: nowrap; }
.pe-filter-grid, .pe-advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pe-filter-block { min-width: 0; padding: 14px; background: var(--pe-soft); border-radius: 10px; }
.pe-filter-block .chip-group { gap: 6px; }
.profile-editor .chip, .profile-editor-page .chip { background: #fff; border-color: #d5d9d4; color: #56616c; }
.profile-editor .chip:hover, .profile-editor .chip.on, .profile-editor-page .chip:hover, .profile-editor-page .chip.on { border-color: var(--pe-accent); color: #c2410c; background: #fff7ed; }
/*
 * --pe-* 只定义在 .modal.profile-editor / .profile-editor-page 上，而 IX 页也用
 * .pe-switch / .pe-empty —— 在那里 var(--pe-accent) 是**无效值**，整条声明被丢掉：
 * 打开的开关和关闭的开关长得一模一样（真实存在过的 bug，看着像状态没保存）。
 * 所以这几处都带上主题变量兜底，编辑器内仍优先用它自己的橙。
 */
.pe-switch { display: inline-flex; align-items: center; gap: 8px; color: var(--pe-muted, var(--text2)); font-size: 11px; white-space: nowrap; }
.pe-switch input { position: absolute; opacity: 0; pointer-events: none; }
.pe-switch span { position: relative; display: block; width: 34px; height: 20px; border-radius: 999px; background: var(--s4); transition: background .15s; }
/* 滑块恒为白：它靠位置而不是对比度表达状态，两个主题下都得是一颗看得见的实心球。 */
.pe-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgb(0 0 0 / .2); }
.pe-switch input:checked + span { background: var(--pe-accent, var(--brand)); }
.pe-switch input:checked + span::after { transform: translateX(14px); }
.pe-role-summary { display: grid; grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 18px; }
.pe-role { min-width: 0; padding: 12px; border: 1px solid var(--pe-line); border-radius: 9px; background: #fafaf8; }
.pe-role-title { gap: 7px; color: var(--pe-ink); font-size: 12px; }
.pe-role-title b { color: var(--pe-accent); }
.pe-role-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.pe-role-dot.entry { background: #6366f1; }
.pe-role-dot.landing { background: #16a34a; }
.pe-route-arrow { color: #a3a8ae; text-align: center; font-size: 20px; }
.pe-chip-list { display: flex; flex-wrap: wrap; gap: 5px; min-height: 28px; margin-top: 9px; }
.pe-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 4px 6px 4px 8px; border-radius: 5px; background: #fff; border: 1px solid var(--pe-line); color: #4b5563; font-size: 10px; }
.pe-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-chip button { padding: 0 2px; background: transparent; color: #9ca3af; font-size: 14px; line-height: 1; }
.pe-chip button:hover { color: #dc2626; }
.pe-picker-toolbar { justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.pe-picker-toolbar strong { display: block; font-size: 12px; }
.pe-picker-toolbar span { display: block; margin-top: 3px; color: var(--pe-muted); font-size: 10px; }
.pe-search { max-width: 260px; }
.pe-picker-toolbar .pe-pick-mode { width: 220px; max-width: 100%; }
.pe-candidate-list { max-height: 330px; overflow: auto; border: 1px solid var(--pe-line); border-radius: 9px; }
.pe-candidate { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--pe-line); }
.pe-candidate:last-child { border-bottom: 0; }
.pe-candidate:hover { background: #fffaf5; }
.pe-candidate-main { min-width: 0; }
.pe-node-name, .pe-node-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-node-name { color: var(--pe-ink); font-size: 11px; font-weight: 600; }
.pe-node-meta { margin-top: 3px; color: var(--pe-muted); font-size: 10px; }
.pe-candidate-actions { display: flex; flex: 0 0 auto; gap: 5px; }
.pe-add-btn { padding: 5px 8px; border: 1px solid var(--pe-line); border-radius: 6px; background: #fff; color: #64748b; font-size: 10px; }
.pe-add-btn:hover, .pe-add-btn.selected { border-color: var(--pe-accent); color: #c2410c; background: #fff7ed; }
.pe-empty { color: var(--pe-muted, var(--text2)); font-size: 10px; }
.pe-empty-large { padding: 35px; text-align: center; }
.pe-chain-options { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 12px; align-items: end; margin-top: 14px; }
.pe-chain-name-preview { display: block; margin-top: 7px; color: var(--pe-muted); font-size: 10px; line-height: 1.45; }
.pe-chain-name-preview b { color: var(--text); font-family: "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.pe-direct { padding-bottom: 8px; white-space: nowrap; }
.pe-subhead { margin-bottom: 8px; color: var(--pe-muted); font-size: 11px; font-weight: 700; }
.pe-advanced-grid > div { min-width: 0; padding: 14px; border-radius: 9px; background: var(--pe-soft); }
.pe-inspector-head { padding-bottom: 20px; border-bottom: 1px solid var(--pe-line); }
.pe-inspector-section { padding: 18px 0; border-bottom: 1px solid var(--pe-line); }
.pe-inspector .select, .pe-inspector .input { margin-top: 6px; }
.pe-label-gap { margin-top: 14px; }
.pe-exclude-toggle { padding: 16px 0; color: var(--pe-ink); }
.pe-selected-note { margin-top: 18px; padding: 10px; border-radius: 8px; background: #fff7ed; color: #9a3412; font-size: 10px; }
.pe-selected-note .mini-btn { float: right; padding: 2px 6px; }
@media (max-width: 1100px) {
  .pe-layout { grid-template-columns: 150px minmax(0, 1fr); }
  .pe-inspector { grid-column: 2; border-top: 1px solid var(--pe-line); border-left: 0; }
}
@media (max-width: 760px) {
  .modal.profile-editor { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .profile-editor-page, .profile-editor-page .pe-shell { min-height: calc(100vh - 132px); border-radius: 0; }
  .pe-header { padding: 0 14px; }
  .pe-status { display: none; }
  .pe-layout { display: block; overflow: auto; }
  .pe-rail { display: none; }
  .pe-main, .pe-inspector { padding: 16px; overflow: visible; }
  .pe-hero-fields, .pe-filter-grid, .pe-advanced-grid, .pe-chain-options { grid-template-columns: 1fr; }
  .pe-role-summary { grid-template-columns: 1fr; }
  .pe-route-arrow { transform: rotate(90deg); }
  .pe-picker-toolbar { align-items: stretch; flex-direction: column; }
  .pe-search { max-width: none; }
}

/* ── product workbench shell ─────────────────────── */
body { background: #f7f7f4; color: #202124; }
.layout { min-height: 100%; }
.sidebar { width: 238px; background: #202124; border-right: 0; color: #e5e7eb; }
.brand-lockup { display: flex; align-items: center; gap: 9px; height: 68px; padding: 0 20px; border-bottom: 1px solid #34363b; }
.brand-mark { color: #f97316; font-size: 25px; line-height: 1; transform: rotate(45deg); }
.sidebar .logo { background: none; color: #f97316; -webkit-text-fill-color: initial; font-size: 18px; letter-spacing: 0; }
.sidebar .logo-tag { color: #a7adb5; -webkit-text-fill-color: initial; font-size: 10px; margin-left: 0; }
.side-nav { padding: 17px 12px 8px; }
.side-nav-label { padding: 0 12px 8px; color: #7f858e; font-size: 10px; font-weight: 700; letter-spacing: .8px; }
.side-nav-label-spaced { margin-top: 20px; }
.side-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 4px; padding: 10px 12px; border-radius: 7px; background: transparent; color: #aeb4bd; text-align: left; font-size: 12px; }
.side-nav-item span { width: 16px; color: #858b94; text-align: center; font-size: 14px; }
.side-nav-item b { margin-left: auto; min-width: 21px; padding: 2px 5px; border-radius: 999px; background: #36383d; color: #b9bec6; font-size: 10px; text-align: center; }
.side-nav-item:hover { background: #2c2f34; color: #fff; }
.side-nav-item.active { background: rgb(249 115 22 / .16); color: #fb923c; }
.side-nav-item.active span { color: #fb923c; }
.side-nav-item.active b { background: #f97316; color: #fff; }
.sidebar-source { min-height: 0; flex: 1; padding: 16px 12px 8px; border-top: 1px solid #34363b; }
.sidebar-source-head { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 9px; color: #8e959f; font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }
.side-add { width: 22px; height: 22px; border-radius: 6px; background: #36383d; color: #e5e7eb; font-size: 15px; }
.side-add:hover { background: #f97316; color: #fff; }
.sidebar .sub-list { padding: 0; }
.sidebar .sub-item { color: #d2d6dc; }
.sidebar .sub-item:hover, .sidebar .sub-item.active { background: #2b2e33; border-color: #4a4d53; }
.sidebar .sub-name { font-size: 11px; }
.sidebar .sub-nc, .sidebar .sub-rem { color: #858b94; }
.sidebar .sub-bar { background: #3a3d43; }
.sidebar .tot-cell { background: #2b2e33; }
.sb-foot { padding: 14px 16px 18px; border-top: 1px solid #34363b; }
.sidebar-foot-title { margin-bottom: 10px; color: #9ba1aa; font-size: 10px; font-weight: 700; }
.sidebar .tot-grid { grid-template-columns: 1fr 1fr; }
.sidebar .tot-lbl { color: #818792; }
.sidebar .tot-val { color: #f3f4f6; }
.main { background: #f7f7f4; }
.topbar { height: 68px; padding: 0 28px; background: #fff; border-bottom: 1px solid #e7e6e1; }
.page-context { display: flex; align-items: center; gap: 13px; }
.context-icon { color: #30343a; font-size: 20px; }
.page-context h1 { color: #202124; font-size: 18px; letter-spacing: 0; }
.page-context p { margin-top: 2px; color: #7a8088; font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.system-health { color: #4b5563; font-size: 11px; }
.system-health i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #16a34a; }
.topbar .last-sync { color: #858a91; }
.topbar .icon-btn { color: #535861; }
.user-pill { display: flex; align-items: center; gap: 6px; color: #4b5057; font-size: 11px; }
.user-pill b { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; border-radius: 50%; background: #202124; color: #fff; font-size: 11px; }
.user-pill b.has-image { background-position: center; background-size: cover; color: transparent; }
.user-pill > span { display: grid; gap: 1px; }
.user-pill strong { color: inherit; font-size: 11px; font-weight: 600; }
.user-pill small { color: #858a91; font-size: 9px; }
.tabs { height: 50px; padding: 0 28px; gap: 25px; background: #fff; border-bottom: 1px solid #e7e6e1; }
.tab { padding: 16px 0 13px; color: #767c84; border-bottom: 2px solid transparent; font-size: 12px; }
.tab.active { color: #c2410c; border-bottom-color: #f97316; }
.tab-badge { display: none; }
.tab-body { padding: 25px 28px 38px; background: #f7f7f4; }
.page-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-actions h2 { color: #202124; font-size: 20px; letter-spacing: 0; }
.page-actions p { margin-top: 4px; color: #7a8088; font-size: 11px; }
.page-action-buttons { display: flex; gap: 8px; }
.page-action-buttons .btn-sec, .page-actions .btn-sec { background: #fff; border-color: #dddcd6; color: #4b5057; }
.page-action-buttons .btn-pri, .page-actions .btn-pri { background: #f97316; color: #fff; }
.node-stats { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 11px; margin-bottom: 18px; }
.node-stat-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 13px; background: #fff; border: 1px solid #e7e5df; border-radius: 10px; }
.node-stat-card > div { min-width: 0; flex: 1; }
.node-stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: #fff1e8; color: #ea580c; font-size: 20px; }
.node-stat-card.tone-vless .node-stat-icon { background: #f0edff; color: #6366f1; }.node-stat-card.tone-vmess .node-stat-icon { background: #edf8ef; color: #16a34a; }.node-stat-card.tone-trojan .node-stat-icon { background: #fff5e3; color: #d97706; }.node-stat-card.tone-ss .node-stat-icon { background: #eaf8ff; color: #0284c7; }.node-stat-card.tone-other .node-stat-icon { background: #f0f1f3; color: #6b7280; }
.node-stat-label, .node-stat-card small { display: block; color: #7b8188; font-size: 9px; }
.node-stat-card strong { display: block; margin-top: 2px; color: #202124; font-size: 17px; line-height: 1.1; }
.node-stat-card small { margin-top: 4px; color: #87909a; line-height: 1.4; overflow-wrap: anywhere; }
.redesigned-filter { display: grid; grid-template-columns: minmax(220px, 1.8fr) repeat(5, minmax(104px, .72fr)) auto minmax(116px, max-content); align-items: center; gap: 8px; padding: 10px; margin-bottom: 13px; background: #fff; border: 1px solid #e7e5df; border-radius: 10px; }
.search-wrap { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 0 10px; background: #fafaf8; border: 1px solid #e1e0da; border-radius: 7px; color: #90969d; }
.search-wrap .search { width: 100%; padding: 7px 0; border: 0; background: transparent; }
.search-wrap .search:focus { border: 0; }
.redesigned-filter .filter-select { width: 100%; min-width: 0; padding: 7px 10px; background: #fafaf8; border-color: #e1e0da; color: #555b63; }
.filter-reset { padding: 7px 10px; border: 1px solid #e1e0da; border-radius: 7px; background: #fff; color: #676d75; font-size: 11px; }
.filter-reset:hover { border-color: #f97316; color: #c2410c; }
.redesigned-filter .fsumm { margin-left: auto; color: #8b9198; }
.node-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.node-list-card, .node-detail { background: #fff; border: 1px solid #e7e5df; border-radius: 10px; }
.node-list-card { min-width: 0; overflow: hidden; }
.table-scroll { overflow: auto; }
.ntable { min-width: 980px; }
.ntable th { padding: 12px 10px; background: #fafaf8; color: #777e86; border-bottom-color: #e7e5df; font-size: 9px; }
.ntable td { padding: 12px 10px; border-bottom-color: #efeee9; color: #4b5057; }
.ntable tr { cursor: pointer; }
.ntable tr:hover td, .ntable tr.selected td { background: #fffaf5; }
.ntable tr.selected td:first-child { box-shadow: inset 3px 0 #f97316; }
.nname { display: block; max-width: 220px; overflow: hidden; color: #30343a; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }
.node-fingerprint { display: block; margin-top: 3px; color: #a0a5ab; font-family: monospace; font-size: 9px; }
.port-cell { color: #535960; font-family: monospace; font-size: 11px; }
.latency-cell { color: #9aa0a7; font-family: monospace; font-size: 11px; }.latency-cell.is-online { color: #16a34a; font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; font-size: 9px; white-space: nowrap; }.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }.status-pill.online { color: #16803c; background: #eaf8ee; }.status-pill.offline { color: #c24136; background: #fff0ef; }.status-pill.unknown { color: #7c838c; background: #f0f1f2; }
.row-actions { white-space: nowrap; }.icon-action { width: 25px; height: 25px; margin-left: 3px; border-radius: 5px; background: transparent; color: #727881; font-size: 14px; }.icon-action:hover { background: #fff1e8; color: #c2410c; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; color: #878d94; font-size: 10px; }.pagination { display: flex; align-items: center; gap: 4px; }.pagination button, .pagination select { min-width: 26px; height: 26px; border: 1px solid #e4e3dd; border-radius: 5px; background: #fff; color: #60666d; font-size: 10px; }.pagination button.current { border-color: #f97316; color: #c2410c; }.pagination select { padding: 0 5px; }
.node-detail { min-height: 560px; padding: 20px; }.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 520px; color: #889098; text-align: center; }.detail-empty-icon { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: 12px; border-radius: 50%; background: #f0f1ee; color: #a0a6ad; font-size: 24px; }.detail-empty strong { color: #4b5057; font-size: 13px; }.detail-empty span { margin-top: 5px; font-size: 10px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }.detail-kicker { color: #f97316; font-size: 9px; font-weight: 800; letter-spacing: 1px; }.detail-head h2 { margin-top: 5px; color: #202124; font-size: 15px; line-height: 1.4; }.detail-actions { display: flex; gap: 6px; margin: 16px 0; }.detail-actions .btn-sec { flex: 1; padding: 6px 5px; background: #fff; border-color: #e0dfd9; color: #60666d; font-size: 10px; }.detail-section { padding: 17px 0; border-top: 1px solid #ecebe6; }.detail-section h3 { margin-bottom: 12px; color: #30343a; font-size: 12px; }.detail-section dl { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 10px 8px; margin: 0; font-size: 10px; }.detail-section dt { color: #8a9097; }.detail-section dd { margin: 0; overflow: hidden; color: #40464e; text-align: right; text-overflow: ellipsis; white-space: nowrap; }.detail-code { font-family: monospace; }.detail-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }.detail-metrics > div { padding: 12px; border-radius: 8px; background: #fafaf8; }.detail-metrics span, .detail-metrics strong { display: block; }.detail-metrics span { color: #8b9198; font-size: 10px; }.detail-metrics strong { margin-top: 7px; color: #4b5057; font-size: 17px; }.detail-metrics .metric-ok { color: #16803c; }.detail-note p { color: #8b9198; font-size: 10px; line-height: 1.65; }
.modal.node-detail-modal { width: min(760px, calc(100vw - 32px)); padding: 24px; }
.node-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.node-modal-head h2 { margin-top: 4px; color: #202124; font-size: 20px; line-height: 1.35; }
.node-modal-head p { margin-top: 5px; color: #7b8188; font-size: 11px; }
.node-modal-close { width: 32px; height: 32px; border: 1px solid #e1e0da; border-radius: 7px; background: #fff; color: #68717c; font-size: 20px; line-height: 1; }
.node-modal-close:hover { border-color: #f97316; color: #c2410c; }
.node-modal-actions { display: flex; align-items: center; gap: 8px; padding: 18px 0; margin-top: 18px; border-top: 1px solid #ecebe6; border-bottom: 1px solid #ecebe6; }
.node-modal-actions .status-pill { margin-right: auto; }
.node-modal-actions .btn-sec { background: #fff; border-color: #dddcd6; color: #4b5057; }
.node-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 18px; }
.node-detail-grid > div { min-width: 0; padding: 12px; border-radius: 8px; background: #fafaf8; }
.node-detail-grid span, .node-detail-grid strong { display: block; }
.node-detail-grid span { color: #858b93; font-size: 10px; }
.node-detail-grid strong { margin-top: 6px; overflow: hidden; color: #30343a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.node-modal-note { margin-top: 16px; color: #7b8188; font-size: 11px; line-height: 1.6; }
.latency-history { margin-top: 20px; padding-top: 18px; border-top: 1px solid #ecebe6; }
.latency-history-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.latency-history-head h3 { margin-top: 3px; color: #30343a; font-size: 14px; }
.latency-history-head > span { color: #858b93; font-size: 10px; }
.latency-history-summary { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 8px; color: #7b8188; font-size: 10px; }
.latency-history-summary b { color: #16803c; font-size: 13px; }
.latency-chart { display: block; width: 100%; height: 132px; overflow: visible; }
.latency-chart line { stroke: #ecebe6; stroke-width: 1; }.latency-chart polyline { fill: none; stroke: #f97316; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.latency-chart-labels { display: flex; justify-content: space-between; color: #8b9198; font-size: 9px; }
.latency-history-empty { padding: 24px 12px; margin-top: 12px; border-radius: 8px; background: #fafaf8; color: #858b93; font-size: 11px; text-align: center; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 1000px; }
.settings-card { padding: 20px; background: #fff; border: 1px solid #e7e5df; border-radius: 12px; }
.settings-card-wide { grid-column: 1 / -1; }
.settings-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.settings-kicker { color: #f97316; font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.settings-card h2 { margin-top: 4px; color: #202124; font-size: 16px; }
.settings-copy { margin: 14px 0; color: #747b83; font-size: 12px; line-height: 1.65; }
.settings-list { display: grid; grid-template-columns: 1fr auto; gap: 9px 16px; padding: 14px 0; margin: 14px 0; border-top: 1px solid #ecebe6; border-bottom: 1px solid #ecebe6; font-size: 12px; }
.settings-list dt { color: #747b83; }.settings-list dd { margin: 0; color: #30343a; font-weight: 700; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option { display: grid; grid-template-columns: 26px 1fr; gap: 0 8px; padding: 12px; border: 1px solid #e1e0da; border-radius: 9px; background: #fff; color: #5e6670; text-align: left; }
.theme-option span { grid-row: 1 / span 2; align-self: center; font-size: 20px; }.theme-option b { font-size: 12px; }.theme-option small { margin-top: 2px; color: #8b9198; font-size: 10px; }.theme-option.active { border-color: #f97316; background: #fff7ed; color: #9a3412; }

/* Keep the subscription list inside the sidebar instead of letting it cover the resource summary. */
.sidebar-source { display: flex; flex-direction: column; overflow: hidden; }
.sidebar .sub-list { flex: 1; min-height: 0; overflow-y: auto; }
.sb-foot { flex: 0 0 auto; }

/* The profile editor is a normal page. It uses the dashboard layout instead of a nested product shell. */
.profile-editor-page { min-height: 0; overflow: visible; border: 0; border-radius: 0; }
.profile-editor-page .pe-shell { min-height: 0; height: auto; display: block; background: transparent; }
.profile-editor-page .pe-header { height: auto; min-height: 0; padding: 0 0 18px; background: transparent; border: 0; }
.profile-editor-page .pe-header .pe-kicker, .profile-editor-page .pe-status, .profile-editor-page .pe-rail { display: none; }
.profile-editor-page .pe-brand h1 { font-size: 20px; }
.profile-editor-page .pe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.profile-editor-page .pe-main { overflow: visible; padding: 0; }
.profile-editor-page .pe-inspector { align-self: start; overflow: visible; padding: 20px; background: #fff; border: 1px solid var(--pe-line); border-radius: 12px; }
.profile-editor-page .pe-card { box-shadow: none; }

@media (max-width: 1100px) {
  .profile-editor-page .pe-layout { grid-template-columns: 1fr; }
  .profile-editor-page .pe-inspector { grid-column: auto; }
}
@media (max-width: 760px) {
  .node-modal-actions { flex-wrap: wrap; }.node-modal-actions .status-pill { width: 100%; }.node-detail-grid, .settings-grid { grid-template-columns: 1fr; }.settings-card-wide { grid-column: auto; }
  .latency-history-head { align-items: flex-start; flex-direction: column; }
  .profile-editor-page .pe-header { align-items: flex-start; flex-direction: column; }.profile-editor-page .pe-header-actions { width: 100%; justify-content: flex-end; }.profile-editor-page .pe-layout { display: block; }.profile-editor-page .pe-main, .profile-editor-page .pe-inspector { padding: 0; background: transparent; border: 0; }.profile-editor-page .pe-inspector { margin-top: 16px; }
}
.pane .pgrid, .pane .tgrid, .pane .fgrid { padding-top: 4px; }
@media (max-width: 1180px) { .node-stats { grid-template-columns: repeat(3, 1fr); }.node-workspace { grid-template-columns: 1fr; }.node-detail { display: none; } }
@media (max-width: 1180px) { .redesigned-filter { grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(104px, 1fr)); }.redesigned-filter .fsumm { grid-column: 1 / -1; margin-left: 0; } }
@media (max-width: 760px) { .sidebar { width: 62px; }.brand-lockup { justify-content: center; padding: 0; }.brand-lockup > div:last-child, .side-nav-label, .side-nav-item:not(.active) b, .side-nav-item { font-size: 0; }.side-nav-item { justify-content: center; padding: 11px 0; }.side-nav-item span { font-size: 16px; }.sidebar-source, .sb-foot { display: none; }.topbar { padding: 0 14px; }.topbar-actions .system-health, .topbar-actions .last-sync, .user-pill span { display: none; }.tab-body { padding: 16px 12px; }.node-stats { grid-template-columns: repeat(2, 1fr); }.page-actions { align-items: flex-start; flex-direction: column; }.redesigned-filter { grid-template-columns: 1fr; align-items: stretch; }.search-wrap, .redesigned-filter .filter-select { width: 100%; }.redesigned-filter .fsumm { margin-left: 0; }.node-stats { gap: 7px; }.node-stat-card { padding: 9px; }.node-stat-card strong { font-size: 15px; } }
.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.modal-sub { font-size: 12px; color: var(--text2); margin-bottom: 14px; }
.modal-url {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px; color: var(--text2); word-break: break-all;
  margin-bottom: 10px; user-select: all;
}
.modal-hint { font-size: 11px; color: var(--text3); margin-bottom: 16px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.btn-sec {
  background: var(--s2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 16px; border-radius: var(--r); font-size: 13px;
}
.btn-sec:hover { background: var(--s3); }
.btn-pri {
  background: var(--accent); color: #fff;
  padding: 7px 16px; border-radius: var(--r); font-size: 13px; font-weight: 500;
}
.btn-pri:hover { opacity: .84; }
.btn-danger {
  background: transparent; border: 1px solid rgba(248, 81, 73, .4);
  color: var(--danger); padding: 7px 16px; border-radius: var(--r); font-size: 13px;
}
.btn-danger:hover { background: rgb(var(--ss-rgb) / .12); }

/* ── forms ──────────────────────────────────────── */
.field { margin-bottom: 13px; }
.field-label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text2);
  margin-bottom: 5px;
}
.field-hint { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.5; }
.input, .select, .textarea {
  width: 100%; background: var(--s2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 7px 11px; color: var(--text); font-size: 12px;
  transition: border-color .12s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.textarea { min-height: 64px; resize: vertical; font-family: "SFMono-Regular", Consolas, monospace; }
.manual-node-uri { min-height: 124px; line-height: 1.6; overflow-wrap: anywhere; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text2); }
.checkbox-row input { accent-color: var(--accent); }

/* ── rule editor ────────────────────────────────── */
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rule-section {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px; background: var(--s2);
}
.rule-section-title {
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .7px; margin-bottom: 9px;
}
.expr-row { display: flex; gap: 5px; margin-bottom: 5px; align-items: center; }
.expr-row .select { width: 88px; flex-shrink: 0; }
.expr-row .input { flex: 1; }
.mini-btn {
  background: var(--s3); border: 1px solid var(--border); color: var(--text2);
  padding: 4px 9px; border-radius: 6px; font-size: 11px;
}
.mini-btn:hover { color: var(--text); }
.preview-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px; font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px; color: var(--text2); line-height: 1.5;
  max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.stat-line {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 11px; color: var(--text2); margin-bottom: 10px;
}
.stat-line b { color: var(--text); font-weight: 600; }
.stat-line .drop { color: var(--warn); }

/* ── login gate ─────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: 300;
  background:
    radial-gradient(circle at 18% 18%, rgb(var(--brand-rgb) / .12), transparent 30%),
    radial-gradient(circle at 82% 80%, rgb(var(--vless-rgb) / .1), transparent 34%),
    var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.gate.hidden { display: none; }
.gate-box {
  width: 440px; max-width: calc(100vw - 32px);
  background: var(--s1); border: 1px solid var(--border);
  border-radius: 18px; padding: 34px;
  box-shadow: 0 24px 70px rgb(31 35 40 / .14);
}
.gate-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.gate-brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; background: rgb(var(--brand-rgb) / .14); color: var(--brand); font-size: 28px; line-height: 1; transform: rotate(45deg); }
.gate-kicker { display: block; color: var(--brand-fg); font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.gate-title {
  color: var(--text); font-size: 24px; font-weight: 750; line-height: 1.15; letter-spacing: -.5px;
}
.gate-sub { max-width: 34em; color: var(--text2); font-size: 14px; margin-bottom: 12px; line-height: 1.7; }
.gate-access { display: flex; align-items: center; gap: 7px; margin-bottom: 22px; color: var(--text2); font-size: 11px; }
.gate-access i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgb(var(--vmess-rgb) / .12); }
.gate-err { font-size: 12px; color: var(--danger); margin-top: 10px; min-height: 18px; }
.google-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 46px; padding: 0 14px;
  border: 1px solid #747775; border-radius: 8px;
  background: #fff; color: #1f1f1f;
  font: 500 14px/20px Arial, sans-serif; text-decoration: none;
}
.google-login:hover { background: #f8fafd; box-shadow: 0 1px 2px rgba(60,64,67,.22); }
.google-login:focus-visible { outline: 2px solid #1a73e8; outline-offset: 2px; }
.google-login.disabled { pointer-events: none; opacity: .55; }
.google-login img { width: 18px; height: 18px; object-fit: contain; }
.dev-login { margin-top: 12px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--r); }
.dev-login[hidden] { display: none; }
.dev-login strong { font-size: 11px; color: var(--warn); }
.dev-login p { margin: 3px 0 9px; color: var(--text2); font-size: 10px; }
.dev-login .btn-sec { width: 100%; margin-top: 8px; }
.gate-links { display: flex; justify-content: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--text2); }
.gate-links a { color: var(--text2); }

/* ── toast ──────────────────────────────────────── */
.toasts {
  position: fixed; bottom: 18px; right: 18px; z-index: 400;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--s2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 10px 14px;
  font-size: 12px; max-width: 420px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  animation: toast-in .18s ease-out;
}
.toast.ok    { border-left-color: var(--ok); }
.toast.warn  { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── misc ───────────────────────────────────────── */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.sec-title { font-size: 14px; font-weight: 700; }
.sec-act { font-size: 12px; color: var(--accent); cursor: pointer; background: transparent; }
.sec-act:hover { opacity: .8; }
.empty {
  text-align: center; padding: 48px 20px; color: var(--text3); font-size: 13px;
  line-height: 1.8;
}
.empty b { color: var(--text2); }
.err-box {
  background: rgb(var(--ss-rgb) / .08); border: 1px solid rgb(var(--ss-rgb) / .25);
  border-radius: var(--r); padding: 9px 13px; margin-bottom: 12px;
  font-size: 12px; color: var(--danger-fg); line-height: 1.55;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── 二维码弹窗 ────────────────────────────────────────
   .qr-canvas 必须恒为白底、不跟随主题变量：暗色模式下静区被"吃掉"
   会直接导致扫不出来。SVG 自身也画了白色背景矩形，这里是双保险。 */
.qr-modal .qr-canvas {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  width: 300px;
  height: 300px;
  margin: 4px auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
}
.qr-modal .qr-canvas svg { display: block; width: 100%; height: 100%; }
.qr-loading { font-size: 12px; color: #667; }
.qr-meta { font-size: 11px; color: var(--text3); text-align: center; margin-bottom: 10px; }
.qr-dense-warn {
  font-size: 11px;
  color: var(--warn, #b4690e);
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.6;
}
.qr-error {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.7;
  padding: 18px 14px;
  background: var(--s2);
  border-radius: 10px;
  margin-bottom: 14px;
}

/* ── IX 中转 ────────────────────────────────────────
   沿用 .settings-card / .ntable / .pbar 那一套（同一个产品的浅色卡片语言），
   只补 IX 特有的：线路配额条、状态徽章、映射表的行内错误。 */
.ix-body { display: flex; flex-direction: column; gap: 16px; max-width: 1240px; }
.ix-provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 16px; }
.ix-provider-card .ix-provider-url { margin-top: 5px; color: var(--text2); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; overflow-wrap: anywhere; }
.ix-switch-row { display: flex; flex-wrap: wrap; gap: 20px; padding: 14px 0 4px; }
.ix-switch-row .pe-switch b { color: var(--text); font-size: 11px; font-weight: 700; }
.ix-section-title { margin: 4px 0 9px; color: var(--text2); font-size: 10px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; }
.ix-line { padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--inset); }
.ix-line-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; color: var(--text2); font-size: 11px; }
.ix-line-head b { color: var(--text); font-size: 12px; }
.ix-line-tag { padding: 1px 6px; border-radius: 999px; background: rgb(var(--brand-rgb) / .14); color: var(--brand-fg); font-size: 9px; font-weight: 700; }
.ix-line-entry { font-family: "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.ix-quota { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/*
 * 配额数字用 *-fg 变体而不是 --ok / --warn / --danger 本体：本体是给实心底
 * 与进度条填充用的中间调，直接当文字放在卡片底上，深色主题下只有 3 点几比一。
 */
.ix-quota.q-ok { color: var(--ok-fg); }
.ix-quota.q-warn { color: var(--warn-fg); }
.ix-quota.q-bad { color: var(--danger-fg); }
.ix-line-note { margin-top: 6px; color: var(--danger-fg); font-size: 10px; line-height: 1.5; }
.ix-unavail { margin: 6px 0 0 18px; font-size: 11px; line-height: 1.75; }
.ix-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.ix-card-actions .btn-sec { background: var(--s1); border-color: var(--border); color: var(--text); }
.ix-card-actions .btn-sec, .ix-card-actions .btn-danger { padding: 6px 12px; font-size: 12px; }
.ix-map-card { padding: 20px; background: var(--s1); border: 1px solid var(--border); border-radius: 12px; }
.ix-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ix-card-head h2 { margin-top: 4px; color: var(--text); font-size: 16px; }
.ix-card-head p { margin-top: 5px; color: var(--text2); font-size: 11px; line-height: 1.6; }
.ix-count-pill { padding: 6px 10px; border: 1px solid rgb(var(--brand-rgb) / .38); border-radius: 999px; background: rgb(var(--brand-rgb) / .14); color: var(--brand-fg); font-size: 11px; white-space: nowrap; }
/* 卡片里的通用说明文字。--text3 在深色下只有约 1.9:1，这一格必须读得清。 */
.ix-provider-card .field-hint { color: var(--text2); }
.ix-latency-note { line-height: 1.7; }
.ix-table { min-width: 1220px; }
.ix-table tr { cursor: default; }
/*
 * 孤儿行用**品牌橙**而不是 --warn：这一页 --warn 已经被"已挂起"和 UDP"未知"
 * 占了，再挤进来就把三个不同处置方式的状态压成同一个颜色。橙色同时也是
 * `.ntable tr.selected` 那条 inset 竖条的颜色，语义一致：这一行被标记了。
 */
.ix-table tr.is-orphan td { background: rgb(var(--brand-rgb) / .1); }
.ix-table tr.is-orphan td:first-child { box-shadow: inset 3px 0 var(--brand); }
.ix-mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; color: var(--text2); overflow-wrap: anywhere; }
.ix-row-name { display: block; color: var(--text); font-size: 11px; font-weight: 650; }
/*
 * 副标题行（指纹、孤儿计数、"点同步拉真实值"）。刻意用 --text2 而不是 --text3：
 * 深色下 --text3 是 #484f58，在 --s1 上只有约 1.9:1，纯装饰级——而这几行都带
 * 可操作信息。层级靠 9px + 等宽区分，不靠把字压到看不见。
 */
.ix-row-fp { display: block; margin-top: 3px; color: var(--text2); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; overflow-wrap: anywhere; }
.ix-row-err { margin-top: 5px; max-width: 260px; color: var(--danger-fg); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.ix-state { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.ix-state i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ix-badge { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; }
/*
 * 徽章底色沿用 .t-* / .shared-badge / .rtag.unknown 那套 rgb(var(--*-rgb) / a)
 * 半透明写法：同一条规则在两个主题下都成立，不必写两份。
 */
.ix-state.s-active, .ix-badge.s-active { color: var(--ok-fg); background: rgb(var(--vmess-rgb) / .16); }
.ix-state.s-pending, .ix-badge.s-pending { color: var(--text2); background: rgb(var(--muted-rgb) / .16); }
.ix-state.s-error, .ix-badge.s-error { color: var(--danger-fg); background: rgb(var(--ss-rgb) / .16); }
.ix-state.s-suspended, .ix-badge.s-suspended { color: var(--warn-fg); background: rgb(var(--trojan-rgb) / .16); }
/*
 * 孤儿要能在一屏表格里被一眼扫到，所以是唯一一个实心底色的徽章。
 * 前景用 --bg（浅色主题下近白、深色主题下近黑）——实心底上的反色文字必须
 * 跟着主题翻转，写死 #fff 在深色的亮橙底上只有 1.7:1。
 */
.ix-state.s-orphan, .ix-badge.s-orphan { color: var(--bg); background: var(--brand); }
/* 节点表的「中转」格可能同时出现状态徽章与"不转 UDP"徽章 */
.ix-badge + .ix-badge { margin-left: 4px; }
/*
 * 端口级 UDP 三态。沿用 .ix-state 的胶囊语言，只换配色语义：
 * 转发=绿、不转发=红、未知=琥珀。**未知刻意不用灰**——灰在这套界面里读作
 * "没这回事"，而这里要读作"该去同步一次"；同时也必须和红色的"不转发"分开，
 * 否则又变回把未知伪装成事实。
 */
.ix-udp { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; cursor: help; }
.ix-udp i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ix-udp.u-on { color: var(--ok-fg); background: rgb(var(--vmess-rgb) / .16); }
.ix-udp.u-off, .ix-badge.u-off { color: var(--danger-fg); background: rgb(var(--ss-rgb) / .16); }
.ix-udp.u-unknown { color: var(--warn-fg); background: rgb(var(--trojan-rgb) / .16); }
.ix-udp-cell { white-space: nowrap; }
.ix-udp-note { line-height: 1.7; }
.ix-udp-note .btn-sec { display: block; margin-top: 9px; padding: 6px 12px; background: var(--s1); border-color: var(--border); color: var(--text); font-size: 12px; }
.ix-traffic { color: var(--text2); font-size: 10px; line-height: 1.6; white-space: nowrap; }
.ix-row-actions { white-space: nowrap; }
.ix-row-actions .icobtn { margin-left: 4px; background: var(--s1); border-color: var(--border); color: var(--text2); }
.ix-row-actions .icobtn:hover { border-color: var(--brand); color: var(--brand-fg); }
.ix-row-actions .icobtn.danger:hover { border-color: var(--danger); color: var(--danger); }
/* "待分配" / "—" 是占位但仍要读得清，同样避开深色下形同隐形的 --text3。 */
.ix-cell-none { color: var(--text2); }
.ix-auth-group[hidden] { display: none; }
@media (max-width: 760px) { .ix-provider-grid { grid-template-columns: 1fr; } }

/* ── 2026-08-27 workspace UI pass ─────────────────────────── */
/* The sidebar is the desktop primary navigation. Keep the tab strip as the labelled mobile fallback. */
@media (min-width: 761px) {
  .tabs { display: none; }
  .redesigned-filter {
    position: sticky; top: 0; z-index: 12;
    box-shadow: 0 8px 20px rgb(31 35 40 / .06);
  }
}

.btn-pri, .genbtn, .sync-btn { background: var(--brand); color: #fff; }
.pcard { box-shadow: 0 1px 2px rgb(31 35 40 / .04); }
.pcard:hover { border-color: var(--brand); box-shadow: 0 7px 20px rgb(31 35 40 / .08); }
.fgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 560px)); }
.fcard { min-width: 0; }
.fabtn { min-height: 32px; }
.tcard .empty { min-height: 116px; border-radius: 9px; background: var(--s2); }
.ix-provider-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 720px)); }
.settings-card-wide .settings-copy { max-width: 680px; }

/* Keep the only commit controls visible while long node pickers scroll. */
.profile-editor-page .pe-header {
  position: sticky; top: 0; z-index: 20;
  margin: -25px -28px 20px; padding: 18px 28px;
  background: color-mix(in srgb, var(--s1) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.profile-editor-page .pe-header-actions { flex-wrap: wrap; justify-content: flex-end; }

/* Product shell dark theme. The previous switch changed state but left the workspace light. */
[data-theme="dark"] body,
[data-theme="dark"] .main,
[data-theme="dark"] .tab-body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .topbar,
[data-theme="dark"] .tabs,
[data-theme="dark"] .node-stat-card,
[data-theme="dark"] .node-list-card,
[data-theme="dark"] .node-detail,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .ix-map-card { background: var(--s1); border-color: var(--border); }
[data-theme="dark"] .topbar,
[data-theme="dark"] .tabs { border-bottom-color: var(--border); }
[data-theme="dark"] .page-context h1,
[data-theme="dark"] .page-actions h2,
[data-theme="dark"] .node-stat-card strong,
[data-theme="dark"] .nname,
[data-theme="dark"] .detail-head h2,
[data-theme="dark"] .detail-section h3,
[data-theme="dark"] .node-modal-head h2,
[data-theme="dark"] .latency-history-head h3,
[data-theme="dark"] .settings-card h2,
[data-theme="dark"] .settings-list dd { color: var(--text); }
[data-theme="dark"] .page-context p,
[data-theme="dark"] .page-actions p,
[data-theme="dark"] .node-stat-label,
[data-theme="dark"] .node-stat-card small,
[data-theme="dark"] .detail-section dt,
[data-theme="dark"] .detail-note p,
[data-theme="dark"] .node-modal-head p,
[data-theme="dark"] .node-modal-note,
[data-theme="dark"] .latency-history-head > span,
[data-theme="dark"] .latency-history-summary,
[data-theme="dark"] .settings-copy,
[data-theme="dark"] .settings-list dt,
[data-theme="dark"] .theme-option small { color: var(--text2); }
[data-theme="dark"] .topbar .icon-btn,
[data-theme="dark"] .user-pill,
[data-theme="dark"] .filter-reset,
[data-theme="dark"] .port-cell,
[data-theme="dark"] .detail-actions .btn-sec,
[data-theme="dark"] .node-modal-actions .btn-sec { color: var(--text2); }
[data-theme="dark"] .user-pill small,
[data-theme="dark"] .topbar .last-sync { color: var(--text3); }
[data-theme="dark"] .user-pill b { background: var(--s3); color: var(--text); }

[data-theme="dark"] .redesigned-filter,
[data-theme="dark"] .search-wrap,
[data-theme="dark"] .redesigned-filter .filter-select,
[data-theme="dark"] .filter-reset,
[data-theme="dark"] .detail-actions .btn-sec,
[data-theme="dark"] .node-modal-close,
[data-theme="dark"] .node-modal-actions .btn-sec,
[data-theme="dark"] .theme-option,
[data-theme="dark"] .ix-card-actions .btn-sec,
[data-theme="dark"] .ix-row-actions .icobtn { background: var(--s1); border-color: var(--border); }
[data-theme="dark"] .search-wrap,
[data-theme="dark"] .redesigned-filter .filter-select,
[data-theme="dark"] .ntable th,
[data-theme="dark"] .detail-metrics > div,
[data-theme="dark"] .node-detail-grid > div,
[data-theme="dark"] .latency-history-empty,
[data-theme="dark"] .theme-option.active { background: var(--s2); }
[data-theme="dark"] .ntable th,
[data-theme="dark"] .ntable td,
[data-theme="dark"] .detail-section,
[data-theme="dark"] .node-modal-actions,
[data-theme="dark"] .latency-history,
[data-theme="dark"] .settings-list { border-color: var(--border); }
[data-theme="dark"] .ntable td { color: var(--text2); }
[data-theme="dark"] .ntable tr:hover td,
[data-theme="dark"] .ntable tr.selected td { background: var(--row-hover); }
[data-theme="dark"] .node-fingerprint { color: var(--text3); }
[data-theme="dark"] .status-pill.online { color: var(--ok-fg); background: rgb(var(--vmess-rgb) / .16); }
[data-theme="dark"] .status-pill.offline { color: var(--danger-fg); background: rgb(var(--ss-rgb) / .16); }
[data-theme="dark"] .status-pill.unknown { color: var(--text2); background: rgb(var(--muted-rgb) / .16); }
[data-theme="dark"] .theme-option { color: var(--text2); }
[data-theme="dark"] .theme-option.active { border-color: var(--brand); color: var(--brand-fg); }

[data-theme="dark"] .profile-editor-page {
  --pe-ink: var(--text); --pe-muted: var(--text2); --pe-card: var(--s1);
  --pe-canvas: var(--bg); --pe-line: var(--border); --pe-soft: var(--s2);
}
[data-theme="dark"] .profile-editor-page .pe-header { background: color-mix(in srgb, var(--s1) 94%, transparent); }
[data-theme="dark"] .profile-editor-page .pe-inspector,
[data-theme="dark"] .profile-editor-page .pe-card,
[data-theme="dark"] .profile-editor-page .pe-icon-input .input,
[data-theme="dark"] .profile-editor-page .input,
[data-theme="dark"] .profile-editor-page .select,
[data-theme="dark"] .profile-editor-page .chip,
[data-theme="dark"] .profile-editor-page .pe-role,
[data-theme="dark"] .profile-editor-page .pe-chip,
[data-theme="dark"] .profile-editor-page .pe-add-btn { background: var(--s1); border-color: var(--border); color: var(--text2); }
[data-theme="dark"] .profile-editor-page .pe-filter-block,
[data-theme="dark"] .profile-editor-page .pe-advanced-grid > div { background: var(--s2); }
[data-theme="dark"] .profile-editor-page .pe-candidate:hover,
[data-theme="dark"] .profile-editor-page .chip:hover,
[data-theme="dark"] .profile-editor-page .chip.on,
[data-theme="dark"] .profile-editor-page .pe-add-btn:hover,
[data-theme="dark"] .profile-editor-page .pe-add-btn.selected { background: rgb(var(--brand-rgb) / .14); border-color: var(--brand); color: var(--brand-fg); }
[data-theme="dark"] .profile-editor-page .pe-count-pill,
[data-theme="dark"] .profile-editor-page .pe-selected-note { background: rgb(var(--brand-rgb) / .14); border-color: rgb(var(--brand-rgb) / .38); color: var(--brand-fg); }

@media (max-width: 760px) {
  .topbar { height: 60px; padding: 0 12px; }
  .page-context { gap: 8px; }
  .context-icon, .page-context p { display: none; }
  .page-context h1 { font-size: 16px; white-space: nowrap; }
  .topbar-actions { gap: 6px; }
  .icon-btn { min-width: 34px; min-height: 34px; }
  .tabs { height: 46px; gap: 18px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 14px 0 11px; }
  .page-actions { gap: 12px; margin-bottom: 16px; }
  .page-action-buttons { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .page-action-buttons > button { flex: 1 0 auto; white-space: nowrap; }
  .pgrid, .tgrid, .fgrid, .ix-provider-grid { grid-template-columns: 1fr; }
  .pcard, .tcard, .fcard, .settings-card, .ix-map-card { padding: 14px; }
  .faction { flex-wrap: wrap; }
  .fabtn { min-width: calc(50% - 3px); }
  .profile-editor-page .pe-header {
    top: 0; margin: -16px -12px 16px; padding: 14px 12px;
    align-items: stretch; gap: 12px;
  }
  .profile-editor-page .pe-header-actions { justify-content: flex-start; gap: 7px; }
  .profile-editor-page .pe-header-actions .btn-danger { margin-right: auto; }
  .profile-editor-page .pe-hero { align-items: flex-start; }
  .profile-editor-page .pe-card { padding: 16px; }
  .pe-card-head { align-items: flex-start; }
  .pe-candidate { align-items: flex-start; }
  .pe-candidate-actions { flex-wrap: wrap; justify-content: flex-end; }
  .gate-box { padding: 26px 22px; }
}
