/* ══════════════════════════════════════════════════════════════════════════
   我的vpn · 设计系统
   01 Tokens  02 Reset  03 Typography  04 Layout  05 Components  06 Motion
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 01 · Tokens ───────────────────────────────────────────────────────── */
:root {
  /* 字体 */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Display", "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", "Cascadia Mono", monospace;

  /* 字阶（14px 基准，正文行高 1.7 适配中文） */
  --t-xs: 11.5px;   --lh-xs: 16px;
  --t-sm: 12.5px;   --lh-sm: 18px;
  --t-base: 14px;   --lh-base: 22px;
  --t-md: 15px;     --lh-md: 24px;
  --t-lg: 17px;     --lh-lg: 26px;
  --t-xl: 20px;     --lh-xl: 28px;
  --t-2xl: 25px;    --lh-2xl: 33px;
  --t-3xl: 33px;    --lh-3xl: 40px;
  --t-display: 44px; --lh-display: 52px;

  /* 字重 */
  --w-regular: 400; --w-medium: 500; --w-semibold: 600; --w-bold: 700;

  /* 间距（4px 基准） */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px;

  /* 圆角 */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-2xl: 26px; --r-pill: 999px;

  /* 动效 */
  --ease: cubic-bezier(.22, .68, .28, 1);
  --ease-emph: cubic-bezier(.18, .78, .24, 1.02);
  --dur-fast: 120ms; --dur-base: 190ms; --dur-slow: 320ms;

  /* 尺寸 */
  --sidebar-w: 262px; --topbar-h: 66px; --content-max: 1360px;

  color-scheme: light;
}

/* 浅色主题 */
:root, [data-theme="light"] {
  --canvas: #f4f5f6;
  --surface: #ffffff;
  --surface-subtle: #f8f9fa;
  --surface-inset: #f0f1f3;
  --surface-hover: #f2f3f5;
  --sidebar: #fafbfb;
  --rail-shadow: 1px 0 0 0 #e5e7ea;

  --line: #e1e4e8;
  --line-soft: #eceef1;
  --line-strong: #d0d4da;

  --text-strong: #171c22;
  --text: #333b45;
  --text-muted: #5f6873;
  --text-faint: #7e8792;
  --text-inverse: #ffffff;

  /* 无彩石墨阶：不再指定品牌色，强调色由 --accent 一处控制 */
  --brand-50: #f3f4f6;  --brand-100: #e7e9ed;  --brand-200: #d0d4da;
  --brand-300: #a9b0ba; --brand-400: #7f8893;  --brand-500: #5b6470;
  --brand-600: #3c444e; --brand-700: #282f38;  --brand-800: #171c22;

  --accent: #222831;
  --accent-hover: #10151b;
  --accent-soft: #eceef1;
  --accent-ring: rgba(34, 40, 49, .20);
  --on-accent: #ffffff;
  --brand-mark-fg: #ffffff;

  --amber: #8a5a06;  --amber-soft: #fdf2e0;  --amber-line: #efd9ae;
  --violet: #574b9e; --violet-soft: #efedfa; --violet-line: #d7d1f3;
  --sky: #1d5c86;    --sky-soft: #e9f1f8;    --sky-line: #c5dae9;
  --danger: #a8361e; --danger-soft: #fcedea; --danger-line: #f2cec7;
  /* 连接/在线使用蓝灰语义色，避免绿色主导界面 */
  --success: #2b5f86; --success-soft: #eaf2f8; --success-line: #c8dcec;

  --series-tx: #2b3a49;
  --series-rx: #4c5fa6;
  --chart-grid: #e7eaee;
  --chart-axis: #8b949e;
  --chart-area: rgba(43, 58, 73, .14);

  --shadow-xs: 0 1px 2px rgba(20, 26, 34, .05);
  --shadow-sm: 0 1px 2px rgba(20, 26, 34, .06), 0 2px 6px -2px rgba(20, 26, 34, .08);
  --shadow-md: 0 2px 4px -1px rgba(20, 26, 34, .07), 0 10px 24px -8px rgba(20, 26, 34, .16);
  --shadow-lg: 0 4px 10px -4px rgba(20, 26, 34, .14), 0 26px 50px -16px rgba(20, 26, 34, .28);
  --ring: 0 0 0 3px var(--accent-ring);
  --ring-danger: 0 0 0 3px rgba(168, 54, 30, .24);
}

/* 深色主题 */
[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0e1114;
  --surface: #171b20;
  --surface-subtle: #1c2127;
  --surface-inset: #12161b;
  --surface-hover: #20262d;
  --sidebar: #12161a;
  --rail-shadow: 1px 0 0 0 #242a31;

  --line: #2b323a;
  --line-soft: #21272e;
  --line-strong: #363e47;

  --text-strong: #eef0f3;
  --text: #c9d0d8;
  --text-muted: #939daa;
  --text-faint: #727d89;
  --text-inverse: #12161b;

  --brand-50: #1b2027;  --brand-100: #232a32;  --brand-200: #313a44;
  --brand-300: #4a5561; --brand-400: #6b7683;  --brand-500: #97a1ad;
  --brand-600: #b8c0ca; --brand-700: #d2d8df;  --brand-800: #e9edf1;

  --accent: #dfe4ea;
  --accent-hover: #f2f4f7;
  --accent-soft: #232a32;
  --accent-ring: rgba(210, 216, 223, .32);
  --on-accent: #141920;
  --brand-mark-fg: #141920;

  --amber: #e5ac5e;  --amber-soft: #2b2314;  --amber-line: #4a3a1e;
  --violet: #a99bf0; --violet-soft: #1f1c33;  --violet-line: #332e54;
  --sky: #7cb8e0;    --sky-soft: #142430;     --sky-line: #24405a;
  --danger: #f08871; --danger-soft: #2c1916;  --danger-line: #4d2b23;
  --success: #86bce4; --success-soft: #142736; --success-line: #24445b;

  --series-tx: #c8d2dd;
  --series-rx: #8fa2e8;
  --chart-grid: #252c34;
  --chart-axis: #79838f;
  --chart-area: rgba(200, 210, 221, .16);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 8px -2px rgba(0, 0, 0, .55);
  --shadow-md: 0 2px 6px -1px rgba(0, 0, 0, .5), 0 12px 28px -10px rgba(0, 0, 0, .7);
  --shadow-lg: 0 6px 14px -6px rgba(0, 0, 0, .6), 0 30px 60px -20px rgba(0, 0, 0, .8);
}

/* ── 02 · Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: var(--lh-base);
  font-weight: var(--w-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
svg { display: block; }
h1, h2, h3, h4 { font-weight: var(--w-semibold); line-height: 1.25; color: var(--text-strong); }
p { line-height: var(--lh-base); }
[hidden] { display: none !important; }
table { border-collapse: separate; border-spacing: 0; }
::selection { background: var(--accent-ring); color: var(--text-strong); }

/* 焦点：统一的可视焦点环（替换原生 outline） */
:focus { outline: none; }
/* 复合输入框由外层 :focus-within 显示焦点，内部不重复绘制。 */
:focus-visible:not(.field__input):not(.search__input) { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* 自定义滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* ── 03 · Typography primitives ────────────────────────────────────────── */
.eyebrow {
  display: block; font-size: var(--t-xs); font-weight: var(--w-bold);
  letter-spacing: .08em; color: var(--text-faint);
}
.mono { font-family: var(--font-mono); font-size: .92em; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; }

/* ── 04 · Layout ───────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  gap: var(--s-6); padding: var(--s-5) var(--s-3);
  background: var(--sidebar); box-shadow: var(--rail-shadow); z-index: 20;
}
.sidebar__top { display: flex; flex-direction: column; gap: var(--s-5); }
.sidebar__group {
  font-size: 10.5px; font-weight: var(--w-bold); letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-faint); padding-left: var(--s-3);
}
.sidebar__bottom { display: flex; flex-direction: column; gap: var(--s-2); }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px var(--s-2); }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(150deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 2px 6px -1px rgba(11, 63, 55, .38), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.brand__mark svg { width: 20px; height: 20px; fill: none; stroke: var(--brand-mark-fg); stroke-width: 1.9; stroke-linecap: round; }
.brand__mark circle { fill: var(--brand-mark-fg); }
.brand__text { display: flex; flex-direction: column; font-size: 15px; font-weight: var(--w-bold); letter-spacing: .01em; color: var(--text-strong); line-height: 1.15; }
.brand__sub { font-size: 10px; font-weight: var(--w-medium); letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 40px; padding: 0 var(--s-3); border-radius: var(--r-md);
  font-size: var(--t-base); font-weight: var(--w-medium); color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__item::before {
  content: ""; position: absolute; left: -12px; top: 50%; translate: 0 -50%;
  width: 3px; height: 0; border-radius: 0 3px 3px 0; background: var(--accent);
  transition: height var(--dur-base) var(--ease-emph);
}
.nav__item:hover { background: var(--surface-hover); color: var(--text); }
.nav__item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: var(--w-semibold); }
.nav__item.is-active::before { height: 20px; }
.nav__icon { opacity: .9; }
.nav__text { flex: 1; text-align: left; }
.nav__badge {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  display: grid; place-items: center; font-size: 11px; font-weight: var(--w-bold);
  background: var(--surface-inset); color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.nav__item.is-active .nav__badge { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

.server-chip {
  display: flex; align-items: center; gap: 9px; padding: 10px var(--s-3);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.server-chip__body { display: flex; flex-direction: column; min-width: 0; }
.server-chip__body strong { font-size: var(--t-sm); font-weight: var(--w-semibold); color: var(--text-strong); }
.server-chip__body small { font-size: var(--t-xs); color: var(--text-muted); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px var(--s-2);
  border-radius: var(--r-lg); transition: background var(--dur-fast) var(--ease);
}
.account:hover { background: var(--surface-hover); }
.account__body { display: flex; flex-direction: column; flex: 1; min-width: 0; text-align: left; }
.account__body strong { font-size: var(--t-sm); font-weight: var(--w-semibold); color: var(--text-strong); }
.account__body small { font-size: var(--t-xs); color: var(--text-muted); }
.account__chevron { width: 15px; height: 15px; color: var(--text-faint); transition: rotate var(--dur-base) var(--ease); }
.menu.is-open .account__chevron { rotate: 180deg; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--r-pill);
  background: linear-gradient(150deg, var(--brand-500), var(--brand-700)); color: var(--on-accent);
  font-size: var(--t-sm); font-weight: var(--w-bold); letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

/* 顶栏 */
.shell__main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: 0 var(--s-8); background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line-soft);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--t-base); color: var(--text-muted); min-width: 0; }
.crumbs__sep { width: 14px; height: 14px; rotate: -90deg; opacity: .6; }
.crumbs__current { font-size: var(--t-md); font-weight: var(--w-semibold); color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs__root { white-space: nowrap; }
.topbar__right { display: flex; align-items: center; gap: var(--s-2); }
.live { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line-soft); box-shadow: var(--shadow-xs); }
.live__text { font-size: var(--t-sm); color: var(--text-muted); white-space: nowrap; }
.live__text b { font-weight: var(--w-semibold); color: var(--text); font-variant-numeric: tabular-nums; }
.live.is-stale { border-color: var(--amber-line); background: var(--amber-soft); }
.live.is-stale .live__text { color: var(--amber); }

/* 内容区 */
.content {
  flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: var(--s-8) var(--s-8) var(--s-10);
  display: flex; flex-direction: column; gap: var(--s-6); min-width: 0;
}
.view { display: flex; flex-direction: column; gap: var(--s-6); }
.stack-md { display: flex; flex-direction: column; gap: var(--s-5); }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page-head__text { display: flex; flex-direction: column; gap: 6px; }
.page-head__title { font-size: var(--t-2xl); line-height: var(--lh-2xl); letter-spacing: -.02em; }
.page-head__desc { font-size: var(--t-base); color: var(--text-muted); }
.page-foot {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-2);
  padding-top: var(--s-5); border-top: 1px solid var(--line-soft);
  font-size: var(--t-sm); color: var(--text-faint);
}
.page-foot__sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

/* ── 05 · Components ───────────────────────────────────────────────────── */

/* 卡片 */
.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs); overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.card--flush { overflow: hidden; }
.card--form { padding: var(--s-6); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-6); flex-wrap: wrap; }
.card__head--stack { flex-direction: column; gap: 4px; padding: 0 0 var(--s-5); border-bottom: 1px solid var(--line-soft); margin-bottom: var(--s-5); }
.card__title { font-size: var(--t-md); font-weight: var(--w-semibold); letter-spacing: -.01em; }
.card__desc { font-size: var(--t-sm); color: var(--text-muted); }
.card__meta { font-size: var(--t-sm); color: var(--text-faint); }
.card__tools { display: flex; align-items: center; gap: var(--s-2); }
.card__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-3) var(--s-6) var(--s-4); border-top: 1px solid var(--line-soft);
  font-size: var(--t-sm); color: var(--text-muted); flex-wrap: wrap;
}
.card__foot-right { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--text-faint); }
.card__foot-sep { opacity: .5; }
.fineprint { padding: 0 var(--s-6) var(--s-5); font-size: var(--t-xs); line-height: 1.7; color: var(--text-faint); }

/* 按钮 */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 var(--s-4); border-radius: var(--r-md);
  font-size: var(--t-base); font-weight: var(--w-semibold); letter-spacing: -.005em; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease), translate var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn__icon { width: 16px; height: 16px; transition: translate var(--dur-base) var(--ease-emph); }
.btn:hover .btn__icon:last-child { translate: 3px 0; }
.btn:active { translate: 0 1px; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn--primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn--ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--line-strong); }
.btn--quiet { background: var(--surface-inset); color: var(--text); }
.btn--quiet:hover { background: var(--surface-hover); }
.btn--danger { background: var(--danger); color: var(--on-accent, #fff); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .btn--danger { color: #2a0f0a; }
.btn--danger:hover { filter: brightness(1.06); }
.btn--lg { height: 46px; padding: 0 var(--s-5); font-size: var(--t-md); border-radius: var(--r-lg); }
.btn--sm { height: 32px; padding: 0 var(--s-3); font-size: var(--t-sm); border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btn:disabled, .btn.is-busy { opacity: .62; pointer-events: none; }
/* 加载态：自定义 spinner */
.btn.is-busy::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; opacity: .9;
  animation: spin .7s linear infinite;
}
.btn.is-busy .btn__icon { opacity: 0; }
.btn.is-busy--inline::after { position: static; margin-left: 2px; }

/* 图标按钮 */
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-md);
  color: var(--text-muted); background: transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-strong); }
.icon-btn--soft { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.icon-btn--soft:hover { border-color: var(--line-strong); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.icon-btn:disabled { opacity: .5; pointer-events: none; }

/* 弹出菜单 */
.menu { position: relative; }
.menu__panel {
  position: absolute; z-index: 40; min-width: 184px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: pop var(--dur-base) var(--ease-emph) both;
}
.menu__panel--right { top: calc(100% + 8px); right: 0; }
.menu__panel--up { bottom: calc(100% + 8px); left: 0; }
.menu__label { padding: 6px 10px 8px; font-size: var(--t-xs); font-weight: var(--w-bold); letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: var(--t-base); color: var(--text); text-align: left;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.menu__item .icon { width: 16px; height: 16px; opacity: .75; }
.menu__item:hover, .menu__item.is-active { background: var(--surface-hover); color: var(--text-strong); }
.menu__item[aria-checked="true"] { color: var(--accent); font-weight: var(--w-semibold); }
.menu__item[aria-checked="true"] .icon { opacity: 1; }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* 自定义下拉框 */
.select { position: relative; }
.select__trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: var(--t-base); color: var(--text); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.select__trigger:hover { border-color: var(--line-strong); }
.select.is-open .select__trigger { border-color: var(--accent); box-shadow: var(--ring); }
.select__value { font-weight: var(--w-medium); white-space: nowrap; }
.select__chevron { width: 15px; height: 15px; color: var(--text-faint); transition: rotate var(--dur-base) var(--ease); }
.select.is-open .select__chevron { rotate: 180deg; }
.select__panel {
  position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; min-width: 168px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); animation: pop var(--dur-base) var(--ease-emph) both;
}
.select__option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--r-sm);
  font-size: var(--t-base); color: var(--text); text-align: left;
  transition: background var(--dur-fast) var(--ease);
}
.select__option::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: transparent; }
.select__option:hover { background: var(--surface-hover); }
.select__option.is-selected { color: var(--accent); font-weight: var(--w-semibold); }
.select__option.is-selected::after {
  background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); scale: .62;
}

/* 分段控件 */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-inset); border-radius: var(--r-md); }
.segmented__item {
  height: 28px; padding: 0 12px; border-radius: var(--r-xs); font-size: var(--t-sm); font-weight: var(--w-semibold);
  color: var(--text-muted); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.segmented__item:hover { color: var(--text); }
.segmented__item.is-active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }

/* 筛选 chip */
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line);
  font-size: var(--t-sm); font-weight: var(--w-medium); color: var(--text-muted); box-shadow: var(--shadow-xs);
  transition: all var(--dur-fast) var(--ease);
}
.chip span { font-variant-numeric: tabular-nums; font-size: var(--t-xs); padding: 1px 5px; border-radius: var(--r-pill); background: var(--surface-inset); }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: var(--w-semibold); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.chip.is-active span { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; }

/* 输入控件 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__control {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 13px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.field__control:hover { border-color: var(--line-strong); }
.field__control:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.field__icon { width: 17px; height: 17px; color: var(--text-faint); transition: color var(--dur-fast) var(--ease); }
.field__control:focus-within .field__icon { color: var(--accent); }
.field__body { position: relative; flex: 1; height: 44px; min-width: 0; }
.field__input {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 16px 0 2px;
  border: 0; background: none; outline: none; font-size: var(--t-md); color: var(--text-strong);
}
.field__input::placeholder { color: transparent; }
.field__label {
  position: absolute; left: 0; top: 12px; font-size: var(--t-md); line-height: 20px; color: var(--text-muted);
  transform-origin: 0 0; pointer-events: none;
  transition: transform var(--dur-base) var(--ease-emph), color var(--dur-fast) var(--ease);
}
.field__input:focus + .field__label, .field__input:not(:placeholder-shown) + .field__label {
  transform: translateY(-10px) scale(.78); color: var(--accent); font-weight: var(--w-semibold);
}
.field__input:not(:focus):not(:placeholder-shown) + .field__label { color: var(--text-faint); }
.field__action {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--text-faint);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.field__action:hover { background: var(--surface-inset); color: var(--text); }
.field__action .icon { width: 17px; height: 17px; }
.field[data-invalid="true"] .field__control { border-color: var(--danger); box-shadow: var(--ring-danger); }
.field[data-invalid="true"] .field__icon { color: var(--danger); }

.form-message {
  display: flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--danger);
  animation: shake var(--dur-slow) var(--ease);
}
.form-message--inline { padding-left: 2px; }
.form { display: flex; flex-direction: column; gap: var(--s-4); }
.form__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); padding-top: var(--s-2); }

/* 搜索 */
.search {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 11px; min-width: 240px;
  background: var(--surface-inset); border: 1.5px solid transparent; border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.search:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: var(--ring); }
.search__icon { width: 16px; height: 16px; color: var(--text-faint); }
.search:focus-within .search__icon { color: var(--accent); }
.search__input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--t-base); color: var(--text-strong); }
.search__input::placeholder { color: var(--text-faint); }
.search__input::-webkit-search-cancel-button { display: none; }
.search__clear { display: grid; place-items: center; width: 22px; height: 22px; border-radius: var(--r-pill); color: var(--text-muted); background: var(--surface-inset); }
.search__clear:hover { background: var(--line); color: var(--text-strong); }
.search__clear .icon { width: 13px; height: 13px; }

/* 工具条 */
.toolbar {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-4) var(--s-6); border-bottom: 1px solid var(--line-soft);
}
.toolbar .select { margin-left: auto; }

/* 状态点 */
.pulse { position: relative; display: inline-grid; place-items: center; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--success); opacity: .5; animation: halo 2.4s var(--ease) infinite;
}
.pulse--idle { background: var(--line-strong); }
.pulse--idle::after { border-color: var(--line-strong); animation: none; opacity: 0; }
.pulse--warn { background: var(--amber); }
.pulse--warn::after { border-color: var(--amber); }

/* 徽标 */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: var(--w-semibold); white-space: nowrap;
  background: var(--surface-inset); color: var(--text-muted);
}
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--online, .pill--ok { background: var(--success-soft); color: var(--success); }
.pill--offline { background: var(--surface-inset); color: var(--text-muted); }
.pill--disabled { background: var(--amber-soft); color: var(--amber); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }

/* 指标卡 */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.metric {
  position: relative; overflow: hidden; padding: var(--s-5) var(--s-5) var(--s-4);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: var(--s-3);
  transition: box-shadow var(--dur-base) var(--ease), translate var(--dur-base) var(--ease);
}
.metric::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background: radial-gradient(120% 90% at 100% 0%, var(--tone-wash), transparent 62%);
}
.metric:hover { box-shadow: var(--shadow-md); translate: 0 -2px; }
.metric__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); position: relative; }
.metric__label { font-size: var(--t-sm); font-weight: var(--w-semibold); color: var(--text-muted); letter-spacing: -.005em; }
.metric__value {
  position: relative; font-size: 30px; line-height: 1.1; font-weight: var(--w-bold); letter-spacing: -.03em;
  color: var(--text-strong); font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
.metric__value-sub { font-size: 17px; font-weight: var(--w-medium); color: var(--text-faint); letter-spacing: -.01em; margin-left: 6px; }
.metric__foot { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); min-height: 34px; }
.metric__hint { font-size: var(--t-xs); color: var(--text-faint); }
.metric__chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: var(--w-bold); font-variant-numeric: tabular-nums;
  background: var(--tone-soft); color: var(--tone); white-space: nowrap;
}
.metric__chip--quiet { background: var(--surface-inset); color: var(--text-faint); font-weight: var(--w-medium); }
.metric__chip--live { background: var(--success-soft); color: var(--success); }
.metric__chip--live .pulse { width: 6px; height: 6px; }
.metric__chip--live .pulse::after { inset: -3px; }
.metric__chip .icon { width: 12px; height: 12px; }
.metric__chip[data-trend="up"] { background: var(--danger-soft); color: var(--danger); }
.metric__chip[data-trend="down"] { background: var(--success-soft); color: var(--success); }
.metric__chip[data-trend="flat"] { background: var(--surface-inset); color: var(--text-faint); }

.metric[data-tone="brand"] { --tone: var(--accent); --tone-soft: var(--accent-soft); --tone-wash: rgba(34, 40, 49, .09); }
.metric[data-tone="sky"] { --tone: var(--sky); --tone-soft: var(--sky-soft); --tone-wash: rgba(29, 92, 134, .09); }
.metric[data-tone="violet"] { --tone: var(--violet); --tone-soft: var(--violet-soft); --tone-wash: rgba(87, 75, 158, .09); }
.metric[data-tone="amber"] { --tone: var(--amber); --tone-soft: var(--amber-soft); --tone-wash: rgba(138, 90, 6, .09); }
[data-theme="dark"] .metric[data-tone="brand"] { --tone-wash: rgba(210, 216, 223, .13); }
[data-theme="dark"] .metric[data-tone="sky"] { --tone-wash: rgba(124, 184, 224, .1); }
[data-theme="dark"] .metric[data-tone="violet"] { --tone-wash: rgba(169, 155, 240, .1); }
[data-theme="dark"] .metric[data-tone="amber"] { --tone-wash: rgba(229, 172, 94, .1); }

.spark { width: 118px; height: 34px; flex: none; }
.spark polyline { vector-effect: non-scaling-stroke; }

/* 双向条 */
.duobar { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.duobar li { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 8px; }
.duobar__key { display: inline-flex; align-items: center; gap: 3px; font-size: var(--t-xs); color: var(--text-faint); font-style: normal; }
.duobar__key .icon { width: 11px; height: 11px; }
.duobar em { font-style: normal; font-size: var(--t-xs); font-family: var(--font-mono); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 6px; border-radius: var(--r-pill); background: var(--surface-inset); overflow: hidden; }
.bar b { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: var(--r-pill); background: var(--tone); transition: width var(--dur-slow) var(--ease-emph); }
.duobar li:first-child .bar b { background: var(--series-rx); opacity: .9; }

/* 设备点阵 */
.dots { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.dots i { width: 8px; height: 8px; border-radius: 3px; background: var(--line-strong); }
.dots i[data-state="online"] { background: var(--success); }
.dots i[data-state="idle"] { background: var(--line-strong); }
.dots i[data-state="off"] { background: var(--amber); opacity: .55; }

/* 进度条 */
.budget { padding: var(--s-5) var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); }
.budget__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.budget__title { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-base); font-weight: var(--w-semibold); color: var(--text-strong); }
.budget__title .icon { width: 16px; height: 16px; color: var(--amber); }
.budget__value { font-size: var(--t-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.budget__value b { color: var(--text-strong); font-weight: var(--w-semibold); }
.budget__note { font-size: var(--t-xs); color: var(--text-faint); }
.progress { position: relative; height: 9px; border-radius: var(--r-pill); background: var(--surface-inset); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .05); }
.progress__fill {
  display: block; height: 100%; width: 0; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand-500), var(--brand-300));
  transition: width var(--dur-slow) var(--ease-emph);
}
.progress[data-level="high"] .progress__fill { background: linear-gradient(90deg, var(--danger), #d4694f); }
.progress[data-level="mid"] .progress__fill { background: linear-gradient(90deg, var(--amber), #d9a54f); }

/* 图表 */
.split { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(300px, 1fr); gap: var(--s-5); align-items: start; }
.card--chart { display: flex; flex-direction: column; }
.chart { position: relative; padding: var(--s-5) var(--s-4) var(--s-2); }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart__grid line { stroke: var(--chart-grid); stroke-dasharray: 3 5; }
.chart__axis text { font-size: 11px; fill: var(--chart-axis); font-family: var(--font-mono); }
.chart__cursor { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart__hit { fill: transparent; }
.chart__line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart__line[data-series="rx"] { stroke-dasharray: 5 4; }
.chart__dot { stroke: var(--surface); stroke-width: 2; }
.chart__tip {
  position: absolute; z-index: 5; min-width: 148px; padding: 10px 12px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); font-size: var(--t-sm);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.chart__tip[data-open="false"] { opacity: 0; transform: translateY(4px) scale(.98); }
.chart__tip-day { display: block; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--text-faint); margin-bottom: 4px; }
.chart__tip-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chart__tip-row i { display: inline-flex; align-items: center; gap: 6px; font-style: normal; color: var(--text-muted); }
.chart__tip-row b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-strong); }
.legend { display: inline-flex; gap: var(--s-2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: var(--r-pill); font-size: var(--t-sm); color: var(--text-muted); transition: background var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
.legend__item:hover { background: var(--surface-hover); }
.legend__item[aria-pressed="false"] { opacity: .45; }
.legend__swatch { width: 12px; height: 4px; border-radius: 2px; background: var(--series-tx); }
.legend__swatch[data-swatch="rx"] { background: var(--series-rx); }

/* 服务器参数表 */
.card--server { display: flex; flex-direction: column; }
.spec { padding: 0 var(--s-6); display: flex; flex-direction: column; }
.spec__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.spec__row:last-child { border-bottom: 0; }
.spec dt { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--text-muted); }
.spec dt .icon { width: 15px; height: 15px; color: var(--text-faint); }
.spec dd { font-size: var(--t-sm); font-weight: var(--w-semibold); color: var(--text-strong); text-align: right; word-break: break-all; }
.spec--tight { padding: 0; }

/* 时间线 */
.timeline { padding: var(--s-3) var(--s-6) var(--s-5); display: flex; flex-direction: column; }
.timeline__item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 10px 0; }
.timeline__rail { position: relative; display: grid; place-items: center; height: 22px; }
.timeline__rail::before { content: ""; position: absolute; top: 22px; bottom: -22px; width: 1.5px; background: var(--line); }
.timeline__item:last-child .timeline__rail::before { display: none; }
.timeline__node { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline__item:not(:first-child) .timeline__node { background: var(--line-strong); box-shadow: 0 0 0 3px var(--surface-inset); }
.timeline__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timeline__action { font-size: var(--t-base); font-weight: var(--w-semibold); color: var(--text-strong); }
.timeline__detail { font-size: var(--t-sm); color: var(--text-muted); word-break: break-word; }
.timeline__time { font-size: var(--t-xs); color: var(--text-faint); white-space: nowrap; padding-top: 3px; }

/* 数据表 */
.table__scroll { overflow-x: auto; }
.grid { width: 100%; min-width: 760px; }
.grid thead th {
  padding: 11px var(--s-4); text-align: left; font-size: var(--t-xs); font-weight: var(--w-bold);
  letter-spacing: .06em; color: var(--text-faint); background: var(--surface-subtle);
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
.grid tbody td { padding: 12px var(--s-4); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grid__row:last-child td { border-bottom: 0; }
.grid__row { transition: background var(--dur-fast) var(--ease); }
.grid__row:hover { background: var(--surface-subtle); }
.col-device { width: 26%; } .col-state { width: 16%; } .col-ip { width: 15%; }
.col-usage { width: 22%; } .col-total { width: 11%; } .col-act { width: 10%; }

.cell-device { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-device__badge {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: var(--r-md);
  background: var(--surface-inset); color: var(--text-muted);
}
.grid__row:hover .cell-device__badge { background: var(--accent-soft); color: var(--accent); }
.cell-device__badge .icon { width: 17px; height: 17px; }
.cell-device__text { display: flex; flex-direction: column; min-width: 0; }
.cell-device__name { font-size: var(--t-base); font-weight: var(--w-semibold); color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-device__meta { font-size: var(--t-xs); color: var(--text-faint); }
.cell-ip { color: var(--text); }
.cell-total { color: var(--text-muted); font-weight: var(--w-medium); }
.cell-sub { display: block; margin-top: 4px; padding-left: 13px; font-size: var(--t-xs); color: var(--text-faint); }

.usage { display: flex; flex-direction: column; gap: 5px; }
.usage__bars { display: flex; flex-direction: column; gap: 3px; }
.usage__bars b { display: block; height: 4px; border-radius: 2px; width: 0; transition: width var(--dur-slow) var(--ease-emph); }
.usage__up { background: var(--series-rx); }
.usage__down { background: var(--series-tx); }
.usage__text { font-size: var(--t-xs); color: var(--text-muted); }

.actions { display: flex; align-items: center; gap: 6px; opacity: .55; transition: opacity var(--dur-fast) var(--ease); }
.grid__row:hover .actions, .actions:focus-within { opacity: 1; }
.table__note { padding: 12px var(--s-6); border-top: 1px solid var(--line-soft); font-size: var(--t-xs); color: var(--text-faint); background: var(--surface-subtle); }
.table-filters { padding: var(--s-8) var(--s-6); text-align: center; color: var(--text-muted); font-size: var(--t-base); }

/* 空状态 */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-16) var(--s-6) var(--s-12); text-align: center; }
.empty__art { display: grid; place-items: center; width: 116px; height: 96px; color: var(--text-faint); opacity: .55; }
.empty__art svg { width: 96px; height: 72px; }
.empty__title { font-size: var(--t-lg); }
.empty__desc { font-size: var(--t-base); color: var(--text-muted); max-width: 380px; }

/* 提示条 */
.alert {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px var(--s-4);
  border-radius: var(--r-lg); border: 1px solid var(--info-line, var(--line));
  background: var(--info-soft, var(--surface-subtle)); font-size: var(--t-base);
  animation: slide-down var(--dur-base) var(--ease-emph) both;
}
.alert__icon { width: 17px; height: 17px; margin-top: 2px; color: var(--info, var(--text-muted)); }
.alert__text { flex: 1; color: var(--text); }
.alert__close { display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--text-muted); }
.alert__close:hover { background: rgba(0, 0, 0, .06); color: var(--text-strong); }
.alert__close .icon { width: 14px; height: 14px; }
.alert[data-tone="info"] { --info: var(--sky); --info-soft: var(--sky-soft); --info-line: var(--sky-line); }
.alert[data-tone="warn"] { --info: var(--amber); --info-soft: var(--amber-soft); --info-line: var(--amber-line); }
.alert[data-tone="bad"] { --info: var(--danger); --info-soft: var(--danger-soft); --info-line: var(--danger-line); }

/* 外观选择 */
.theme-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.theme-option { position: relative; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-option__preview {
  display: flex; flex-direction: column; gap: 4px; padding: 10px; height: 74px;
  border: 1.5px solid var(--line); border-radius: var(--r-md); background: #f4f6f6; overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.theme-option__preview i { display: block; height: 8px; border-radius: 3px; background: #dfe5e5; }
.theme-option__preview i:first-child { width: 64%; background: var(--brand-500); }
.theme-option__preview i:nth-child(2) { width: 88%; }
.theme-option__preview i:last-child { width: 46%; }
[data-preview="dark"] { background: #0d1719; }
[data-preview="dark"] i { background: #223437; }
[data-preview="system"] { background: linear-gradient(115deg, #f4f6f6 52%, #0d1719 52%); }
[data-preview="system"] i:nth-child(2) { background: linear-gradient(90deg, #dfe5e5 52%, #223437 52%); }
.theme-option__label { font-size: var(--t-sm); font-weight: var(--w-medium); color: var(--text-muted); text-align: center; }
.theme-option:hover .theme-option__preview { border-color: var(--line-strong); }
.theme-option input:checked + .theme-option__preview { border-color: var(--accent); box-shadow: var(--ring); }
.theme-option input:focus-visible + .theme-option__preview { border-color: var(--accent); box-shadow: var(--ring); }
.theme-option input:checked ~ .theme-option__label { color: var(--accent); font-weight: var(--w-semibold); }

/* 密码强度 */
.strength { display: flex; align-items: center; gap: 10px; padding-left: 2px; }
.strength__bars { display: flex; gap: 4px; flex: 1; }
.strength__bars b { flex: 1; height: 4px; border-radius: var(--r-pill); background: var(--surface-inset); transition: background var(--dur-base) var(--ease); }
.strength__label { font-size: var(--t-xs); color: var(--text-faint); white-space: nowrap; }
.strength[data-level="1"] { --s-color: var(--danger); --s-word: "强度偏低"; }
.strength[data-level="2"] { --s-color: var(--amber); --s-word: "强度一般"; }
.strength[data-level="3"] { --s-color: var(--sky); --s-word: "强度良好"; }
.strength[data-level="4"] { --s-color: var(--success); --s-word: "强度很高"; }
.strength[data-level="1"] b:nth-child(-n+1) { background: var(--s-color); }
.strength[data-level="2"] b:nth-child(-n+2) { background: var(--s-color); }
.strength[data-level="3"] b:nth-child(-n+3) { background: var(--s-color); }
.strength[data-level="4"] b { background: var(--s-color); }
.strength[data-level="1"] .strength__label::after,
.strength[data-level="2"] .strength__label::after,
.strength[data-level="3"] .strength__label::after,
.strength[data-level="4"] .strength__label::after { content: var(--s-word); }
.strength[data-level="1"] .strength__label, .strength[data-level="2"] .strength__label,
.strength[data-level="3"] .strength__label, .strength[data-level="4"] .strength__label { color: var(--s-color); font-weight: var(--w-semibold); font-size: 0; line-height: 12px; }
.strength[data-level="1"] .strength__label::after, .strength[data-level="2"] .strength__label::after,
.strength[data-level="3"] .strength__label::after, .strength[data-level="4"] .strength__label::after { font-size: var(--t-xs); }

/* 对话框 */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, #0b0e12 52%, transparent);
  backdrop-filter: blur(3px); animation: fade var(--dur-base) var(--ease) both;
}
.dialog-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--s-5); pointer-events: none; }
.dialog {
  pointer-events: auto; width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg); animation: dialog-in var(--dur-slow) var(--ease-emph) both;
}
.dialog__head { display: flex; align-items: flex-start; gap: 13px; padding: var(--s-5) var(--s-5) var(--s-4); }
.dialog__glyph {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--accent);
}
.dialog--danger .dialog__glyph { background: var(--danger-soft); color: var(--danger); }
.dialog__glyph .icon { width: 20px; height: 20px; }
.dialog__titles { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dialog__title { font-size: var(--t-lg); letter-spacing: -.015em; }
.dialog__desc { font-size: var(--t-sm); color: var(--text-muted); }
.dialog__close { margin-left: auto; }
.dialog__body { padding: 0 var(--s-5) var(--s-5); }
.dialog__body:empty { display: none; }
.dialog__foot {
  display: flex; justify-content: flex-end; gap: 10px; padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--line-soft); background: var(--surface-subtle);
}

/* Toast */
.toasts { position: fixed; z-index: 70; right: var(--s-5); bottom: var(--s-5); display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast {
  position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 11px;
  padding: 13px var(--s-4); border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: toast-in var(--dur-slow) var(--ease-emph) both;
}
.toast.is-leaving { animation: toast-out var(--dur-base) var(--ease) both; }
.toast__glyph { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: var(--r-pill); background: var(--success-soft); color: var(--success); }
.toast[data-tone="info"] .toast__glyph { background: var(--sky-soft); color: var(--sky); }
.toast[data-tone="warn"] .toast__glyph { background: var(--amber-soft); color: var(--amber); }
.toast[data-tone="bad"] .toast__glyph { background: var(--danger-soft); color: var(--danger); }
.toast__text { flex: 1; font-size: var(--t-base); color: var(--text); padding-top: 2px; }
.toast__glyph .icon { width: 15px; height: 15px; }
.toast__close { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-sm); color: var(--text-faint); }
.toast__close:hover { background: var(--surface-inset); color: var(--text-strong); }
.toast__close .icon { width: 13px; height: 13px; }
.toast__timer { position: absolute; left: 0; bottom: 0; height: 2.5px; background: var(--accent); animation: countdown var(--dur-toast, 4200ms) linear both; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 80; padding: 5px 9px; border-radius: var(--r-xs); pointer-events: none;
  background: var(--text-strong); color: var(--canvas);
  font-size: var(--t-xs); font-weight: var(--w-medium); letter-spacing: .01em; white-space: nowrap;
  box-shadow: var(--shadow-md); opacity: 0; transform: translateY(3px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.tooltip[data-open="true"] { opacity: 1; transform: translateY(0); }

/* ── 登录页 ────────────────────────────────────────────────────────────── */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); min-height: 100vh; background: var(--canvas); }
.auth__hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  gap: var(--s-10); padding: var(--s-10) var(--s-12); color: #dceaea;
  background: radial-gradient(120% 100% at 12% 0%, #252c34 0%, #161b21 48%, #0b0e12 100%);
}
.auth__grid {
  position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(80% 70% at 30% 20%, #000 0%, transparent 78%);
  mask-image: radial-gradient(80% 70% at 30% 20%, #000 0%, transparent 78%);
}
.auth__hero-body { position: relative; display: flex; flex-direction: column; gap: var(--s-6); max-width: 560px; }
.brand--hero { color: #fff; }
.brand--hero .brand__mark { background: linear-gradient(150deg, #8e99a6, #3c444e); box-shadow: 0 6px 18px -6px rgba(160, 175, 190, .35); }
.brand--hero .brand__text { color: #fff; }
.brand--hero .brand__sub { color: rgba(220, 234, 234, .55); }
.auth__title { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.16; letter-spacing: -.03em; font-weight: var(--w-bold); color: #fff; }
.auth__lead { font-size: var(--t-lg); line-height: 1.75; color: rgba(220, 234, 234, .72); max-width: 440px; }
.auth__points { display: flex; flex-direction: column; gap: 12px; }
.auth__points li { display: flex; align-items: center; gap: 11px; font-size: var(--t-base); color: rgba(220, 234, 234, .8); }
.auth__points .icon { width: 17px; height: 17px; color: #b6c0cc; opacity: .9; }
.auth__foot { position: relative; display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); letter-spacing: .06em; color: rgba(220, 234, 234, .45); }
.auth__foot .icon { width: 14px; height: 14px; }

.auth__panel { display: grid; place-items: center; padding: var(--s-10) var(--s-8); }
.auth-card {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-8); border-radius: var(--r-2xl); background: var(--surface);
  border: 1px solid var(--line-soft); box-shadow: var(--shadow-md);
  animation: rise var(--dur-slow) var(--ease-emph) both;
}
.auth-card__title { font-size: var(--t-2xl); letter-spacing: -.025em; }
.auth-card__desc { font-size: var(--t-base); color: var(--text-muted); margin-top: -6px; }
.auth-card .field__control { height: 54px; }
.auth-card__note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--t-xs); color: var(--text-faint); }
.auth-card__note .icon { width: 13px; height: 13px; }

/* ── 06 · Motion & Responsive ──────────────────────────────────────────── */
@keyframes spin { to { rotate: 360deg; } }
@keyframes halo { 0% { scale: .6; opacity: .7; } 70% { scale: 1.5; opacity: 0; } 100% { opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(.96); } }
@keyframes countdown { from { width: 100%; } to { width: 0; } }
@keyframes shake {
  0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); }
}

@media (max-width: 1240px) {
  :root { --content-max: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1040px) {
  :root { --sidebar-w: 82px; }
  .content { padding: var(--s-6) var(--s-6) var(--s-8); gap: var(--s-5); }
  .topbar { padding: 0 var(--s-6); }
  .sidebar { padding: var(--s-4) 12px; align-items: stretch; }
  .brand { justify-content: center; padding: 0; }
  .brand__text, .sidebar__group, .nav__text, .server-chip__body, .account__body, .account__chevron, .server-chip { display: none; }
  .nav { align-items: center; }
  .nav__item { justify-content: center; width: 46px; height: 46px; padding: 0; align-self: center; }
  .nav__item::before { left: -12px; }
  .nav__badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 10px; background: var(--accent); color: var(--on-accent); }
  .nav__item.is-active .nav__badge { background: var(--accent); color: var(--on-accent); }
  .sidebar__bottom { align-items: center; }
  .account { justify-content: center; width: 46px; height: 46px; padding: 0; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__hero { padding: var(--s-8); gap: var(--s-8); }
}
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; gap: var(--s-3);
    padding: 10px var(--s-4); border-bottom: 1px solid var(--line-soft); z-index: 30;
    box-shadow: none; background: color-mix(in srgb, var(--canvas) 88%, transparent);
    backdrop-filter: blur(14px);
  }
  .sidebar__top { flex: 1; flex-direction: row; align-items: center; gap: var(--s-3); overflow: hidden; }
  .sidebar__bottom { flex-direction: row; align-items: center; gap: var(--s-2); }
  .brand { flex: none; }
  .nav { flex-direction: row; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav__item { width: auto; height: 38px; padding: 0 12px; flex: none; }
  .nav__item::before { display: none; }
  .nav__badge { position: static; }
  .account { width: 38px; height: 38px; }
  .topbar { display: none; }
  .content { padding: var(--s-4) var(--s-4) var(--s-8); gap: var(--s-4); }
  .metrics { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .card__head { padding: var(--s-4) var(--s-4); }
  .card__foot { padding: var(--s-3) var(--s-4) var(--s-4); }
  .card--form { padding: var(--s-4); }
  .fineprint { padding: 0 var(--s-4) var(--s-4); }
  .spec { padding: 0 var(--s-4); }
  .timeline { padding: var(--s-2) var(--s-4) var(--s-4); }
  .toolbar { padding: var(--s-3) var(--s-4); }
  .toolbar .search { min-width: 100%; order: 3; }
  .toolbar .select { margin-left: auto; }
  .page-head { align-items: flex-start; flex-direction: column; gap: var(--s-3); }
  .page-head__title { font-size: var(--t-xl); }
  .toasts { right: var(--s-3); left: var(--s-3); bottom: var(--s-3); width: auto; }
  .dialog-layer { padding: var(--s-3); }
  .auth__hero { display: none; }
  .auth__panel { padding: var(--s-6) var(--s-4); min-height: 100vh; align-items: center; }
  .auth-card { padding: var(--s-6) var(--s-5); box-shadow: var(--shadow-sm); }
  .actions { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .metric:hover { translate: none; }
}
/* 客户端导入 */
.import-picker, .import-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; }
.import-picker { position: relative; z-index: 1; overflow: visible; }
.import-muted { color: var(--text-muted); font-size: var(--t-sm); margin-top: 5px; line-height: 1.7; }
.import-select { flex: 0 1 380px; min-width: 0; }
.import-select > button { width: 100%; justify-content: space-between; }
#import-peer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#import-peer-options { width: max-content; max-width: min(420px, 80vw); max-height: 320px; overflow-y: auto; }
#import-peer-options button { min-height: 40px; height: auto; overflow-wrap: anywhere; }
.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.import-client { min-width: 0; padding: 28px; }
.import-client__head { display: flex; align-items: center; gap: 12px; }
.import-client__head h2 { margin: 0; font-size: var(--t-lg); color: var(--text-strong); }
.import-client__head .pill { margin-left: auto; flex: none; }
.import-app-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: var(--r-lg); background: var(--accent-soft); color: var(--accent); }
.import-app-icon .icon { width: 25px; height: 25px; }
.import-client__desc { color: var(--text-muted); margin: 22px 0 18px; line-height: 1.8; }
.import-client > .btn--primary { display: flex; width: 100%; justify-content: space-between; }
.import-label { display: block; color: var(--text-muted); font-size: var(--t-sm); margin: 24px 0 8px; }
.import-copy { display: flex; gap: 8px; }
.import-copy input { min-width: 0; width: 100%; border: 1px solid var(--line); background: var(--surface-inset); color: var(--text-muted); border-radius: var(--r-md); padding: 10px 12px; font-size: var(--t-xs); }
.import-copy .btn { flex: none; }
.import-steps { list-style: decimal; padding-left: 20px; margin: 24px 0 14px; color: var(--text); line-height: 1.9; }
.import-steps li { padding-left: 4px; margin-top: 8px; }
.import-help { color: var(--text-muted); font-size: var(--t-sm); line-height: 1.8; margin-bottom: 20px; }
.import-scan { display: flex; align-items: center; gap: 20px; margin-top: 24px; padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface-subtle); }
.import-qr { flex: 0 0 180px; width: 180px; background: #fff; border-radius: 8px; overflow: hidden; }
.import-qr svg { display: block; width: 100%; height: auto; }
.import-scan .btn { margin-top: 12px; }
.import-footer { align-items: flex-start; margin-bottom: 0; }
.import-footer > div:first-child { max-width: 680px; }
.import-footer__actions { display: flex; flex-wrap: wrap; gap: 10px; flex-shrink: 0; max-width: 100%; }
.import-empty { text-align: center; padding: 70px 24px; }
.import-empty > .icon { width: 36px; height: 36px; margin-bottom: 16px; color: var(--accent); }
.import-empty h2 { font-size: var(--t-lg); }
.import-status { padding: 18px 24px; color: var(--text-muted); }
@media (max-width: 1240px) { .import-footer { flex-direction: column; } .import-scan { flex-direction: column; align-items: flex-start; } }
@media (max-width: 900px) { .import-grid { grid-template-columns: minmax(0, 1fr); } .import-scan { flex-direction: row; align-items: center; } }
@media (max-width: 720px) {
  .import-picker { align-items: stretch; flex-direction: column; padding: 20px; }
  .import-select { flex: auto; }
  .import-client { padding: 20px; }
  .import-scan { flex-direction: column; align-items: center; text-align: center; }
  .import-footer { padding: 20px; }
}
@media print { .sidebar, .topbar, .toasts, .tooltip, #import-content { display: none !important; } }
/* ── 账号与家宽出口 · 结构化卡片 ──────────────────────────────────────── */
#view-accounts { gap: var(--s-5); }

.egress-strip {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border: 1px solid var(--line-soft);
  border-radius: var(--r-md); background: var(--surface-inset);
  font-size: var(--t-base); color: var(--text); line-height: 1.6;
}
.egress-strip .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--text-muted); flex: none; }

.group { display: flex; flex-direction: column; gap: 12px; }
.group__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4);
  padding-bottom: 11px; border-bottom: 1px solid var(--line);
}
.group__title {
  display: flex; align-items: center; gap: 9px;
  font-size: var(--t-lg); font-weight: var(--w-semibold); letter-spacing: -.01em;
}
.group__count {
  display: inline-grid; place-items: center; min-width: 21px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--surface-inset); color: var(--text-muted);
  font-size: var(--t-xs); font-weight: var(--w-bold); font-variant-numeric: tabular-nums;
}
.group__desc { font-size: var(--t-sm); color: var(--text-muted); margin-top: 5px; }

.network-list { display: grid; gap: 12px; }
.network-card { padding: 0; overflow: hidden; }
.network-card__top { display: flex; align-items: center; gap: 12px; padding: 15px 18px; }
.network-card__mark {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface-subtle); color: var(--text-muted);
}
.network-card__mark .icon { width: 19px; height: 19px; }
.network-card__id { flex: 1; min-width: 0; }
.network-card__id h3 {
  font-size: var(--t-md); font-weight: var(--w-semibold); color: var(--text-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.network-card__id p {
  font-size: var(--t-sm); color: var(--text-muted); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.network-card__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.network-card__grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-soft); background: var(--surface-subtle);
}
.network-card__grid > div { padding: 11px 18px 13px; border-right: 1px solid var(--line-soft); min-width: 0; }
.network-card__grid > div:last-child { border-right: 0; }
.network-card__grid dt {
  font-size: var(--t-xs); font-weight: var(--w-semibold); letter-spacing: .03em;
  color: var(--text-faint); margin-bottom: 5px;
}
.network-card__grid dd {
  font-size: var(--t-sm); font-weight: var(--w-semibold); color: var(--text-strong);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.45;
}
.network-card__note {
  padding: 10px 18px 12px; border-top: 1px solid var(--line-soft);
  font-size: var(--t-sm); color: var(--text-muted); line-height: 1.65;
}
.network-empty {
  display: flex; flex-direction: column; gap: 5px; align-items: center;
  padding: 34px 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface-subtle); text-align: center;
}
.network-empty strong { font-size: var(--t-md); color: var(--text-strong); }
.network-empty span { font-size: var(--t-sm); color: var(--text-muted); }
.network-footnote {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 15px; border-radius: var(--r-md); background: var(--surface-inset);
  font-size: var(--t-sm); color: var(--text-muted); line-height: 1.7;
}
.network-footnote .icon { width: 15px; height: 15px; margin-top: 3px; flex: none; }
.btn--text-danger { background: transparent; color: var(--danger); box-shadow: none; }
.btn--text-danger:hover { background: var(--danger-soft); }

/* 旧版说明文字（保留兼容） */
.network-note { color: var(--text-muted); line-height: 1.7; }
.network-field-label { display: block; font-size: 13px; margin: 0 0 8px; color: var(--text-muted); }
.network-choices { display: flex; flex-wrap: wrap; gap: 8px; max-height: 140px; overflow-y: auto; padding: 3px; }
.dialog { max-height: calc(100dvh - 40px); overflow-y: auto; }

@media (max-width: 1100px) {
  .network-card__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .network-card__grid > div:nth-child(2n) { border-right: 0; }
  .network-card__grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 720px) {
  .group__head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .network-card__top { flex-wrap: wrap; padding: 14px; }
  .network-card__actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; padding-top: 2px; }
  .network-card__grid { grid-template-columns: minmax(0, 1fr); }
  .network-card__grid > div { border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 10px 14px; }
  .network-card__grid > div:last-child { border-bottom: 0; }
  .network-card__note { padding: 10px 14px 12px; }
}
