/* ==========================================================================
   xpanel — 内嵌管理面板样式
   纯原生 CSS，无构建步骤、无外部字体 / 图片 / CDN 依赖。
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-soft: #0a1020;
  --bg-elevated: #0d1526;
  --bg-elevated-2: #121c31;
  --surface: rgba(14, 22, 39, 0.82);
  --surface-solid: #0f182b;
  --surface-strong: rgba(13, 21, 38, 0.96);
  --surface-hover: rgba(148, 163, 184, 0.065);
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #edf3ff;
  --text-secondary: #b6c3da;
  --muted: #7f8da6;
  --faint: #5c6980;
  --accent: #5b8cff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(91, 140, 255, 0.14);
  --accent-border: rgba(91, 140, 255, 0.34);
  --success: #2dd4a7;
  --success-soft: rgba(45, 212, 167, 0.11);
  --warning: #f5b759;
  --warning-soft: rgba(245, 183, 89, 0.11);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.11);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.11);
  --chart-up: #22d3ee;
  --chart-down: #818cf8;
  --chart-hover: rgba(255, 255, 255, 0.035);
  --control-bg: rgba(8, 13, 24, 0.66);
  --table-head: rgba(8, 13, 24, 0.42);
  --topbar-bg: rgba(7, 11, 20, 0.78);
  --token-bg: #050911;
  --token-text: #a8c8ff;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.52);
  --radius-xs: 7px;
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --duration: 160ms;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-soft: #eef2f9;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #f5f8fd;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-strong: rgba(255, 255, 255, 0.97);
  --surface-hover: rgba(15, 23, 42, 0.045);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #10192b;
  --text-secondary: #394861;
  --muted: #66758e;
  --faint: #8491a7;
  --accent: #3568f0;
  --accent-2: #7c4dff;
  --accent-soft: rgba(53, 104, 240, 0.09);
  --accent-border: rgba(53, 104, 240, 0.28);
  --success: #0f9f7a;
  --success-soft: rgba(15, 159, 122, 0.09);
  --warning: #b9780c;
  --warning-soft: rgba(185, 120, 12, 0.09);
  --danger: #dc3d5a;
  --danger-soft: rgba(220, 61, 90, 0.08);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.08);
  --chart-up: #0891b2;
  --chart-down: #6366f1;
  --chart-hover: rgba(15, 23, 42, 0.035);
  --control-bg: #ffffff;
  --table-head: rgba(15, 23, 42, 0.025);
  --topbar-bg: rgba(247, 250, 255, 0.82);
  --token-bg: #f4f7ff;
  --token-text: #1f4fc4;
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 30px 90px rgba(15, 23, 42, 0.14);
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(91, 140, 255, 0.13), transparent 60%),
    radial-gradient(820px 520px at 102% -4%, rgba(139, 92, 246, 0.1), transparent 58%),
    linear-gradient(180deg, rgba(8, 13, 24, 0.15), transparent 36%);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(53, 104, 240, 0.1), transparent 60%),
    radial-gradient(820px 520px at 102% -4%, rgba(124, 77, 255, 0.07), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 40%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  display: block;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #fff;
  background: rgba(91, 140, 255, 0.42);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ---------- 通用工具 ---------- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-success {
  color: var(--success);
}

.nowrap {
  white-space: nowrap;
}

.truncate {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon.is-spinning {
  animation: spin 0.85s linear infinite;
}

/* ---------- 启动 / 加载 / 提示 ---------- */
.app-root {
  min-height: 100vh;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--muted);
}

.boot-text {
  font-size: 13px;
  letter-spacing: 0.02em;
}

.noscript {
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  color: #ffd3da;
  background: #2a1118;
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

.spinner--lg {
  width: 22px;
  height: 22px;
  border-width: 2.5px;
  color: var(--accent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 140% 0;
  }
  100% {
    background-position: -40% 0;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    var(--border) 20%,
    var(--border-strong) 38%,
    var(--border) 56%
  );
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.skeleton-label {
  width: 45%;
  height: 10px;
}

.skeleton-value {
  width: 62%;
  height: 27px;
  margin-top: 17px;
}

.skeleton-sub {
  width: 82%;
  height: 9px;
  margin-top: 14px;
}

.skeleton-line {
  height: 10px;
  width: 100%;
}

.skeleton-card {
  min-height: 132px;
}

/* ---------- 按钮与图标按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--bg-elevated-2);
  font-size: 13px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  transition:
    background var(--duration) ease,
    border-color var(--duration) ease,
    color var(--duration) ease,
    opacity var(--duration) ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
}

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(91, 140, 255, 0.22);
}

.btn-primary:hover:not(:disabled) {
  border-color: transparent;
  background: linear-gradient(135deg, #6b98ff, #976dff);
}

.btn-danger {
  color: #ffdbe1;
  border-color: rgba(251, 113, 133, 0.3);
  background: var(--danger-soft);
}

[data-theme="light"] .btn-danger {
  color: #c0203d;
}

.btn-danger:hover:not(:disabled) {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.18);
}

.btn-ghost {
  color: var(--text-secondary);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: transparent;
  background: var(--surface-hover);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  gap: 5px;
  border-radius: 8px;
  font-size: 12px;
}

.btn-icon {
  width: 38px;
  padding: 0;
}

.btn-label {
  display: inline-block;
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn-primary .icon,
.btn-danger .icon {
  color: currentColor;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition:
    background var(--duration) ease,
    color var(--duration) ease,
    border-color var(--duration) ease;
}

.icon-button:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border);
}

.icon-button:disabled {
  opacity: 0.5;
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

/* ---------- 品牌标记 ---------- */
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  box-shadow:
    0 6px 18px rgba(91, 140, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-mark--lg {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.brand-mark--lg svg {
  width: 28px;
  height: 28px;
}

/* ---------- 应用骨架 / 顶栏 ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 1440px;
  height: 64px;
  margin: 0 auto;
  padding: 0 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  border-radius: 10px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-name em {
  font-style: normal;
  color: var(--accent);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 11px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    color var(--duration) ease,
    background var(--duration) ease,
    border-color var(--duration) ease;
}

.nav-link .icon {
  width: 17px;
  height: 17px;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.nav-link.is-active .icon {
  color: var(--accent);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

.admin-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 220px;
  padding: 4px 10px 4px 4px;
  margin-right: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.admin-avatar {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, #436ff2, #9b64ff);
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.admin-name {
  max-width: 130px;
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-role {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--border);
}

.main-content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 28px 26px;
  color: var(--faint);
  font-size: 11.5px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.footer-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
}

.footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 16px;
}

/* ---------- 页面标题 ---------- */
.page {
  animation: fadeUp 0.26s ease both;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.page-heading {
  min-width: 0;
}

.page-title {
  font-size: 27px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.page-description {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

/* ---------- 卡片 / 面板 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.022),
    0 10px 28px rgba(0, 0, 0, 0.07);
}

.panel {
  padding: 21px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-title .icon {
  color: var(--muted);
}

.panel-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-meta {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: color var(--duration) ease;
}

.link-arrow:hover {
  color: var(--accent);
}

.link-arrow .icon {
  width: 13px;
  height: 13px;
}

/* ---------- 统计卡片 ---------- */
.stats-wrap {
  margin-bottom: 16px;
}

.stat-grid {
  display: grid;
  gap: 13px;
}

.stat-grid + .stat-grid {
  margin-top: 13px;
}

.stat-grid--users {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-grid--traffic {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  --tone: var(--accent);
  --tone-soft: var(--accent-soft);
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 17px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.022);
  transition: border-color var(--duration) ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -56px;
  right: -42px;
  width: 140px;
  height: 140px;
  pointer-events: none;
  background: radial-gradient(circle, var(--tone-soft), transparent 68%);
  opacity: 0.95;
}

.stat-card:hover {
  border-color: var(--border-strong);
}

.stat-card--success {
  --tone: var(--success);
  --tone-soft: var(--success-soft);
}

.stat-card--danger {
  --tone: var(--danger);
  --tone-soft: var(--danger-soft);
}

.stat-card--warning {
  --tone: var(--warning);
  --tone-soft: var(--warning-soft);
}

.stat-card--info {
  --tone: var(--info);
  --tone-soft: var(--info-soft);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.stat-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--tone);
  background: var(--tone-soft);
  border-radius: 9px;
}

.stat-icon .icon {
  width: 16px;
  height: 16px;
}

.stat-value {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  color: var(--text);
  font-size: 28px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.stat-value--bytes {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.stat-sub {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.stat-sub .icon {
  width: 11px;
  height: 11px;
}

.stat-sub-up {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--chart-up);
}

.stat-sub-down {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--chart-down);
}

/* ---------- 流量图表 ---------- */
.chart-panel {
  padding: 20px 21px 12px;
  margin-bottom: 16px;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 4px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.chart-meta {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--text-secondary);
  font-size: 11.5px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2.5px;
}

.legend-swatch--up {
  background: var(--chart-up);
}

.legend-swatch--down {
  background: var(--chart-down);
}

.chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0 0;
}

.chart-svg {
  display: block;
  width: 100%;
  min-width: 650px;
  height: auto;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 6;
  vector-effect: non-scaling-stroke;
}

.chart-axis-line {
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-tick {
  stroke: var(--border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-axis-text {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 10.5px;
}

.chart-bar {
  outline: none;
}

.chart-hit {
  fill: transparent;
  transition: fill 0.12s ease;
}

.chart-bar:hover .chart-hit {
  fill: var(--chart-hover);
}

.chart-seg--down {
  fill: var(--chart-down);
}

.chart-seg--up {
  fill: var(--chart-up);
}

.chart-bar:hover .chart-seg {
  filter: brightness(1.18);
}

.chart-empty-label {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.chart-loading {
  display: grid;
  place-items: center;
  min-height: 245px;
  color: var(--muted);
  font-size: 12.5px;
  gap: 9px;
}

/* ---------- Dashboard 列表 ---------- */
.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 16px;
}

.dashboard-panel {
  min-height: 270px;
}

.health-list,
.audit-list {
  display: flex;
  flex-direction: column;
  max-height: 356px;
  overflow-y: auto;
  margin: 0 -7px -4px;
  padding: 0 7px 4px;
}

.health-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 9px;
  transition: background var(--duration) ease;
}

.health-row:last-child {
  border-bottom-color: transparent;
}

.health-row:hover {
  background: var(--surface-hover);
}

.health-dot {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--surface-hover);
}

.health-dot--ok {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.health-dot--error {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.health-dot--pending {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.health-main {
  min-width: 0;
}

.health-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.health-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-addr {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-error {
  margin-top: 3px;
  overflow: hidden;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
  white-space: nowrap;
}

.health-meta strong {
  color: var(--text-secondary);
  font-weight: 550;
}

.audit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 9px;
  transition: background var(--duration) ease;
}

.audit-row:last-child {
  border-bottom-color: transparent;
}

.audit-row:hover {
  background: var(--surface-hover);
}

.audit-main {
  min-width: 0;
}

.audit-target {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-actor {
  color: var(--text-secondary);
}

.audit-time {
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
  white-space: nowrap;
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 11px;
  margin-bottom: 14px;
}

.toolbar-spacer {
  flex: 1;
}

.search-field {
  position: relative;
  flex: 1 1 300px;
  max-width: 390px;
  min-width: 210px;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 35px;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  transition:
    border-color var(--duration) ease,
    box-shadow var(--duration) ease;
}

.search-input::placeholder {
  color: var(--faint);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-field {
  display: flex;
  align-items: center;
  gap: 7px;
}

.filter-label {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.toolbar-meta {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

/* ---------- 表格 ---------- */
.table-card {
  overflow: hidden;
}

.table-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.table-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
  min-width: 0;
}

.table-heading h2 {
  font-size: 14px;
  font-weight: 600;
}

.table-count {
  color: var(--muted);
  font-size: 11.5px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table--users {
  min-width: 1040px;
}

.data-table--nodes {
  min-width: 1120px;
}

.data-table--audit {
  min-width: 830px;
}

.data-table th {
  padding: 10px 14px;
  color: var(--muted);
  background: var(--table-head);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--duration) ease;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .cell {
  min-width: 0;
}

.cell-primary {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-primary--muted {
  color: var(--text-secondary);
  font-weight: 500;
}

.cell-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.cell-sub--danger {
  color: var(--danger);
}

.cell-sub--warning {
  color: var(--warning);
}

.cell-mono {
  display: block;
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-nowrap {
  white-space: nowrap;
}

.cell-time {
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-time--muted {
  color: var(--muted);
  font-size: 11.5px;
}

.status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.status-reason {
  max-width: 190px;
  overflow: hidden;
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.node-error {
  max-width: 210px;
  overflow: hidden;
  color: var(--danger);
  font-size: 10.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-last-ok {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.node-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.node-count .icon {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.public-address {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.public-address code {
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-address small {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2.5px 8px;
  color: var(--muted);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-dot {
  width: 5.5px;
  height: 5.5px;
  flex: 0 0 auto;
  background: currentColor;
  border-radius: 50%;
}

.badge--success {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(45, 212, 167, 0.22);
}

.badge--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.22);
}

.badge--warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(245, 183, 89, 0.22);
}

.badge--info {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(56, 189, 248, 0.22);
}

.badge--muted {
  color: var(--muted);
  background: var(--surface-hover);
  border-color: var(--border);
}

.badge--online {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(56, 189, 248, 0.22);
}

.badge--online .badge-dot {
  animation: onlinePulse 1.9s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

.action-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  color: var(--text-secondary);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.5;
  white-space: nowrap;
}

.action-badge--success {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(45, 212, 167, 0.2);
}

.action-badge--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.2);
}

.action-badge--info {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(56, 189, 248, 0.2);
}

.action-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.action-code {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.detail-text {
  display: -webkit-box;
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ---------- 流量配额单元格 ---------- */
.usage-cell {
  min-width: 168px;
  max-width: 220px;
}

.usage-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.usage-used {
  color: var(--text);
  font-weight: 600;
}

.usage-sep,
.usage-quota {
  color: var(--muted);
}

.usage-pct {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.progress {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
  transition: width 0.3s ease;
}

.progress-fill--warning {
  background: linear-gradient(90deg, #f5b759, #f59e0b);
}

.progress-fill--danger {
  background: linear-gradient(90deg, #fb7185, #f43f5e);
}

.progress--unlimited {
  background-image: repeating-linear-gradient(
    45deg,
    var(--border) 0 3px,
    transparent 3px 7px
  );
}

.usage-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

/* ---------- 行内操作 ---------- */
.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 7px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    color var(--duration) ease,
    background var(--duration) ease,
    border-color var(--duration) ease;
}

.btn-action .icon {
  width: 13px;
  height: 13px;
}

.btn-action:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border);
}

.btn-action--danger {
  color: var(--danger);
}

.btn-action--danger:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.22);
}

.btn-action:disabled {
  opacity: 0.45;
}

/* ---------- 分页 - ---------- */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-height: 55px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.pager-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.pager-info {
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 29px;
  height: 29px;
  padding: 0 7px;
  color: var(--text-secondary);
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  transition:
    background var(--duration) ease,
    border-color var(--duration) ease,
    color var(--duration) ease;
}

.pager-btn .icon {
  width: 13px;
  height: 13px;
}

.pager-btn:hover:not(:disabled):not(.is-active) {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.pager-btn.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.pager-btn:disabled {
  opacity: 0.38;
}

.pager-ellipsis {
  padding: 0 2px;
  color: var(--faint);
  font-size: 11px;
}

/* ---------- 加载 / 空状态 / 错误 ---------- */
.table-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  color: var(--muted);
  font-size: 12.5px;
}

.table-loading .spinner {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.state-wrap {
  padding: 16px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 46px 22px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 3px;
  color: var(--text-secondary);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.empty-icon .icon {
  width: 21px;
  height: 21px;
}

.empty-title {
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 550;
}

.empty-desc {
  max-width: 380px;
  font-size: 11.5px;
  line-height: 1.65;
}

.empty-action {
  margin-top: 7px;
}

.error-state {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  color: var(--text-secondary);
  background: var(--danger-soft);
  border: 1px solid rgba(251, 113, 133, 0.22);
  border-radius: 12px;
}

.error-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--danger);
  background: rgba(251, 113, 133, 0.12);
  border-radius: 9px;
}

.error-body {
  flex: 1;
  min-width: 0;
}

.error-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.error-message {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.error-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.loading-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 260px;
  color: var(--muted);
  font-size: 12.5px;
}

.loading-panel .spinner {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 7px;
}

.skeleton-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skeleton-list-row .skeleton:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.skeleton-list-row .skeleton:nth-child(2) {
  flex: 1;
  height: 11px;
}

.skeleton-list-row .skeleton:last-child {
  width: 62px;
  height: 9px;
}

/* ---------- 表单元素 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
}

.required-mark {
  color: var(--danger);
  font-weight: 600;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.form-hint code {
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-hover);
  border-radius: 4px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  height: 39px;
  padding: 0 11px;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  transition:
    border-color var(--duration) ease,
    box-shadow var(--duration) ease,
    background var(--duration) ease;
}

.textarea {
  height: auto;
  min-height: 82px;
  padding: 10px 11px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input:disabled,
.select:disabled {
  opacity: 0.55;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237f8da6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.input[type="datetime-local"],
.input[type="date"] {
  font-variant-numeric: tabular-nums;
}

.input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}

.input-with-action {
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.input-with-action .input {
  flex: 1;
}

.input-with-action .btn {
  flex: 0 0 auto;
  height: 39px;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  margin-bottom: 15px;
  color: #ffc3cd;
  background: var(--danger-soft);
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

[data-theme="light"] .form-alert {
  color: #b31f3b;
}

.form-alert .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.fieldset {
  min-width: 0;
  margin: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.fieldset legend {
  padding: 0 6px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
}

.fieldset-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.meta-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 11px 13px;
  margin-bottom: 16px;
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.meta-item strong {
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 开关 ---------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  background: var(--control-bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition:
    background var(--duration) ease,
    border-color var(--duration) ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--muted);
  border-radius: 50%;
  transition:
    transform var(--duration) ease,
    background var(--duration) ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  background: #fff;
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.switch-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- 节点选择器 ---------- */
.node-picker {
  padding: 10px;
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.node-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.node-picker-info {
  color: var(--muted);
  font-size: 10.5px;
}

.node-picker-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.node-picker-actions .btn-action {
  height: 25px;
  padding: 0 6px;
  font-size: 10.5px;
}

.selected-count {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.node-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: 188px;
  overflow-y: auto;
  padding: 2px;
}

.node-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background var(--duration) ease,
    border-color var(--duration) ease;
}

.node-option:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.node-option input {
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.node-option-body {
  min-width: 0;
}

.node-option-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-option-meta {
  margin-top: 1px;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-picker-empty,
.node-picker-error {
  padding: 14px 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

.node-picker-error {
  color: var(--danger);
  text-align: left;
}

.node-picker-error .btn {
  margin-top: 8px;
}

.node-missing-hint {
  margin: 7px 2px 0;
  color: var(--warning);
  font-size: 10px;
  line-height: 1.5;
}

/* ---------- 模态框 ---------- */
body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 5, 11, 0.7);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.17s ease;
}

[data-theme="light"] .modal-overlay {
  background: rgba(22, 32, 50, 0.36);
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.988);
  transition: transform 0.19s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal--sm {
  width: min(440px, 100%);
}

.modal--lg {
  width: min(710px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}

.modal-heading {
  min-width: 0;
}

.modal-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  margin: -3px -4px 0 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition:
    color var(--duration) ease,
    background var(--duration) ease;
}

.modal-close:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

.modal-close .icon {
  width: 17px;
  height: 17px;
}

.modal-body {
  min-height: 0;
  padding: 18px 22px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  padding: 14px 22px;
  background: var(--table-head);
  border-top: 1px solid var(--border);
}

.modal-footer--split {
  justify-content: space-between;
}

.modal-note {
  color: var(--muted);
  font-size: 10.5px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-form .fieldset {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form .fieldset .form-grid {
  gap: 14px;
}

.confirm-body {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 11px;
}

.confirm-icon--danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-icon .icon {
  width: 19px;
  height: 19px;
}

.confirm-text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.confirm-text strong {
  color: var(--text);
  font-weight: 600;
}

.confirm-details {
  margin-top: 9px;
  padding: 9px 11px;
  color: var(--muted);
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.6;
}

/* ---------- 一次性 Token ---------- */
.token-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.token-block + .token-block {
  margin-top: 15px;
}

.token-label {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 550;
}

.copy-row {
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.token-value {
  flex: 1;
  min-width: 0;
  min-height: 39px;
  padding: 9px 11px;
  overflow-wrap: anywhere;
  color: var(--token-text);
  background: var(--token-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  user-select: all;
}

.token-value--multiline {
  font-size: 11px;
}

.copy-row .btn {
  flex: 0 0 auto;
}

.secret-warning {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  margin-bottom: 16px;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(245, 183, 89, 0.24);
  border-radius: 9px;
  font-size: 11.5px;
  line-height: 1.6;
}

.secret-warning .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.token-warning-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.token-warning-item {
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* ---------- 订阅链接 / 二维码 ---------- */
.sub-dialog {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sub-dialog-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sub-dialog-user > .icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--accent);
}

.sub-dialog-user-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sub-dialog-user-body strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sub-dialog-user-body .cell-sub {
  overflow-wrap: anywhere;
}

.sub-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.sub-qr {
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  padding: 10px;
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sub-qr-img {
  display: block;
  width: 160px;
  height: 160px;
}

.sub-qr-block {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.sub-qr-hint {
  flex: 1 1 180px;
  min-width: 160px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

@media (max-width: 520px) {
  .sub-qr {
    width: 150px;
    height: 150px;
  }
  .sub-qr-img {
    width: 130px;
    height: 130px;
  }
  .sub-qr-hint {
    flex-basis: 100%;
    min-width: 0;
  }
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(365px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
  animation: toastIn 0.2s ease both;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateX(10px);
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: -1px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--surface-hover);
}

.toast-icon .icon {
  width: 14px;
  height: 14px;
}

.toast--success .toast-icon {
  color: var(--success);
  background: var(--success-soft);
}

.toast--error .toast-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast--warning .toast-icon {
  color: var(--warning);
  background: var(--warning-soft);
}

.toast--info .toast-icon {
  color: var(--info);
  background: var(--info-soft);
}

.toast-message {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: -1px -3px 0 2px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.toast-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.toast-close .icon {
  width: 13px;
  height: 13px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- 登录页 ---------- */
.login-page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px;
  isolation: isolate;
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(20px);
}

.login-page::before {
  top: -140px;
  left: -100px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(91, 140, 255, 0.16), transparent 68%);
}

.login-page::after {
  right: -160px;
  bottom: -180px;
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent 68%);
}

.login-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  width: min(980px, 100%);
  overflow: hidden;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 590px;
  padding: 42px;
  overflow: hidden;
  color: #eef4ff;
  background:
    radial-gradient(circle at 18% 8%, rgba(91, 140, 255, 0.3), transparent 44%),
    radial-gradient(circle at 92% 86%, rgba(139, 92, 246, 0.24), transparent 46%),
    linear-gradient(155deg, #0c1730 0%, #080d18 78%);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 76%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 76%);
}

.login-visual::after {
  content: "";
  position: absolute;
  top: 40%;
  right: -110px;
  width: 340px;
  height: 340px;
  pointer-events: none;
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 50%;
  box-shadow:
    0 0 0 42px rgba(139, 92, 246, 0.035),
    0 0 0 88px rgba(139, 92, 246, 0.022);
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.login-visual-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-visual-copy {
  margin-top: auto;
  margin-bottom: 24px;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 4px 9px;
  color: #b9cdff;
  background: rgba(91, 140, 255, 0.11);
  border: 1px solid rgba(91, 140, 255, 0.25);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
}

.login-kicker .badge-dot {
  background: #6e9bff;
  box-shadow: 0 0 8px #6e9bff;
}

.login-headline {
  max-width: 400px;
  margin: 18px 0 13px;
  font-size: 34px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.login-lede {
  max-width: 385px;
  color: rgba(211, 223, 247, 0.62);
  font-size: 13px;
  line-height: 1.75;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 28px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(230, 238, 255, 0.78);
  font-size: 12.5px;
}

.login-feature-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: #9ab8ff;
  background: rgba(91, 140, 255, 0.12);
  border: 1px solid rgba(91, 140, 255, 0.16);
  border-radius: 8px;
}

.login-feature-icon .icon {
  width: 13px;
  height: 13px;
}

.login-visual-foot {
  margin-top: 34px;
  padding-top: 16px;
  color: rgba(195, 210, 240, 0.34);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 46px 42px;
  background: var(--surface-solid);
}

.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-heading {
  color: var(--text);
  font-size: 24px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.03em;
}

.login-form-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.login-error {
  margin-top: 18px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 26px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field .form-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.login-field .input {
  height: 42px;
  font-size: 13.5px;
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  transform: translateY(-50%);
}

.password-toggle:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.password-toggle .icon {
  width: 16px;
  height: 16px;
}

.login-submit {
  width: 100%;
  height: 43px;
  margin-top: 5px;
  font-size: 13.5px;
}

.login-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 22px;
  padding-top: 17px;
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  line-height: 1.65;
}

.login-note .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  flex: 0 0 auto;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1240px) {
  .topbar-inner {
    gap: 16px;
    padding: 0 22px;
  }

  .main-content {
    padding: 24px 22px;
  }

  .app-footer {
    padding-right: 22px;
    padding-left: 22px;
  }

  .stat-grid--users {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .dashboard-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .health-list,
  .audit-list {
    max-height: none;
  }

  .login-headline {
    font-size: 30px;
  }

  .login-visual {
    padding: 34px;
  }

  .login-form-panel {
    padding: 38px 32px;
  }
}

@media (max-width: 900px) {
  .login-card {
    grid-template-columns: minmax(0, 1fr);
    width: min(440px, 100%);
  }

  .login-visual {
    display: none;
  }

  .login-mobile-brand {
    display: flex;
  }

  .login-form-panel {
    padding: 36px 30px;
  }

  .login-page {
    padding: 22px;
  }

  .stat-grid--users {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-grid--traffic {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card {
    padding: 15px;
  }

  .stat-value {
    font-size: 25px;
  }

  .stat-value--bytes {
    font-size: 21px;
  }
}

@media (max-width: 860px) {
  .table-wrap {
    overflow: visible;
    padding: 8px;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .data-table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    margin-bottom: 9px;
    overflow: hidden;
    background: var(--control-bg);
    border: 1px solid var(--border);
    border-radius: 11px;
  }

  .data-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .data-table tbody tr:hover {
    background: var(--control-bg);
  }

  .data-table td {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-height: 35px;
    padding: 8px 12px;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }

  .data-table tbody tr td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    flex: 0 0 76px;
    padding-top: 2px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 500;
    text-align: left;
  }

  .data-table td[data-label=""] {
    display: block;
  }

  .data-table td[data-label=""]::before {
    display: none;
  }

  .data-table .cell {
    flex: 1;
    min-width: 0;
    text-align: right;
  }

  .data-table .status-cell,
  .data-table .node-status-cell {
    align-items: flex-end;
  }

  .data-table .action-cell {
    align-items: flex-end;
  }

  .truncate,
  .cell-primary,
  .cell-mono,
  .status-reason,
  .node-error,
  .public-address code,
  .public-address small,
  .detail-text {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .cell-time,
  .node-last-ok {
    white-space: normal;
  }

  .usage-cell {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .table-card-head,
  .table-foot {
    padding-right: 13px;
    padding-left: 13px;
  }

  .pager-group {
    justify-content: center;
  }

  .pager-info {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    gap: 8px 12px;
    padding: 9px 15px 0;
  }

  .brand {
    order: 0;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .brand-mark svg {
    width: 18px;
    height: 18px;
  }

  .brand-name {
    font-size: 16px;
  }

  .topbar-actions {
    order: 1;
    gap: 3px;
  }

  .admin-chip {
    max-width: 160px;
    margin-right: 1px;
  }

  .admin-role {
    display: none;
  }

  .admin-name {
    max-width: 92px;
  }

  .topbar-divider {
    display: none;
  }

  .main-nav {
    order: 2;
    width: 100%;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 1 0 auto;
    justify-content: center;
    height: 34px;
    padding: 0 10px;
  }

  .main-content {
    padding: 18px 15px;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 15px 22px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    margin-bottom: 17px;
  }

  .page-title {
    font-size: 23px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .stat-grid--users {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-grid--traffic {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .stat-grid + .stat-grid {
    margin-top: 10px;
  }

  .stat-card {
    min-height: 113px;
    padding: 14px;
    border-radius: var(--radius);
  }

  .stat-value {
    margin-top: 10px;
    font-size: 23px;
  }

  .stat-value--bytes {
    font-size: 20px;
  }

  .stat-sub {
    margin-top: 6px;
    font-size: 10px;
  }

  .chart-panel {
    padding: 16px 14px 5px;
    border-radius: var(--radius);
  }

  .chart-svg {
    min-width: 610px;
  }

  .chart-head {
    margin-bottom: 9px;
  }

  .chart-toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    padding: 16px;
  }

  .dashboard-columns {
    gap: 11px;
  }

  .toolbar {
    padding: 9px;
    gap: 8px;
  }

  .search-field {
    flex: 1 1 100%;
    max-width: none;
  }

  .filter-field {
    flex: 1 1 auto;
  }

  .filter-field .select {
    flex: 1;
    min-width: 130px;
  }

  .toolbar-meta {
    margin-left: auto;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 15px;
  }

  .modal-header {
    padding: 17px 16px 0;
  }

  .modal-body {
    padding: 15px 16px 17px;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .modal-title {
    font-size: 16.5px;
  }

  .modal-footer .btn {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .node-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .toast-root {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .login-page {
    padding: 14px;
  }

  .login-form-panel {
    padding: 30px 22px;
  }

  .login-heading {
    font-size: 22px;
  }

  .health-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .health-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: left;
  }

  .audit-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .audit-time {
    display: none;
  }

  .audit-target {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .copy-row {
    flex-direction: column;
  }

  .copy-row .btn {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .admin-chip {
    max-width: 122px;
    padding-right: 7px;
  }

  .admin-name {
    max-width: 62px;
  }

  .topbar-actions .icon-button {
    width: 32px;
    height: 32px;
  }

  .nav-link {
    gap: 5px;
    padding: 0 8px;
    font-size: 12px;
  }

  .nav-link .icon {
    width: 15px;
    height: 15px;
  }

  .stat-grid--users {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-grid--traffic {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-card {
    min-height: 104px;
  }

  .page-actions .btn {
    font-size: 12px;
  }

  .row-actions {
    gap: 1px;
  }

  .btn-action {
    padding: 0 5px;
    font-size: 10.5px;
  }

  .btn-action .icon {
    width: 12px;
    height: 12px;
  }

  .login-form-panel {
    padding: 26px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   运行时补充样式（组件细节与响应式修正）
   ========================================================================== */

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.logout-btn {
  height: 34px;
  padding: 0 9px;
  color: var(--muted);
}

.logout-btn:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.2);
}

.logout-btn .icon {
  width: 15px;
  height: 15px;
}

.switch {
  position: relative;
}

.footer-brand .brand-mark {
  width: 21px;
  height: 21px;
  border-radius: 7px;
  box-shadow: none;
}

.footer-brand .brand-mark svg {
  width: 12px;
  height: 12px;
}

.filter-input {
  width: 228px;
  flex: 0 1 228px;
  height: 38px;
}

.filter-field--action {
  flex: 0 1 auto;
}

.audit-toolbar .toolbar-spacer {
  flex: 1 1 12px;
}

.login-form .login-error {
  margin-bottom: 0;
}

body.is-login {
  overflow-x: hidden;
}

.login-page {
  overflow-x: clip;
}

.node-picker .btn-action[disabled] {
  opacity: 0.4;
}

.node-picker .node-option input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.data-table td[data-label=""] .cell {
  min-width: 0;
}

@media (max-width: 900px) {
  .logout-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .logout-btn .btn-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .filter-input {
    width: 100%;
    flex: 1 1 auto;
  }

  .filter-field--action {
    flex: 1 1 100%;
  }

  .audit-time {
    display: block;
    grid-column: 2;
    padding-top: 2px;
    color: var(--muted);
    font-size: 10px;
    text-align: left;
  }

  .topbar-actions .logout-btn {
    width: 32px;
    height: 32px;
  }
}

/* ==========================================================================
   节点配置中心 v2 / 公网 Agent
   ========================================================================== */

.agent-endpoint {
  padding: 17px 18px;
  margin-bottom: 16px;
}

.agent-endpoint-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.agent-endpoint-head .panel-subtitle {
  max-width: 720px;
}

.agent-endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.agent-endpoint-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.agent-endpoint-item--full {
  grid-column: 1 / -1;
}

.agent-endpoint-label {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.agent-endpoint-value {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

code.agent-endpoint-value {
  word-break: break-all;
}

.agent-endpoint-value-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.agent-endpoint-value-row .agent-endpoint-value {
  flex: 1;
  min-width: 0;
}

.agent-endpoint-value-row .btn {
  flex: 0 0 auto;
}

.agent-endpoint-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.agent-endpoint--disabled {
  border-style: dashed;
}

.agent-endpoint--disabled .agent-endpoint-note {
  color: var(--text-secondary);
}

/* ---------- 连接模式选择 ---------- */
.mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 11px 12px;
  background: var(--control-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition:
    background var(--duration) ease,
    border-color var(--duration) ease;
}

.mode-option:hover {
  border-color: var(--border-strong);
}

.mode-option.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.mode-option.is-disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.mode-option input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: inherit;
}

.mode-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mode-option-title {
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.mode-option.is-selected .mode-option-title {
  color: var(--text);
}

.mode-option-desc {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

/* ---------- 表单提示块 ---------- */
.form-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text-secondary);
  background: var(--info-soft);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 9px;
  font-size: 11.5px;
  line-height: 1.6;
}

.form-note .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 auto;
  color: var(--info);
}

.form-note--warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(245, 183, 89, 0.24);
}

.form-note--warning .icon {
  color: var(--warning);
}

.inbound-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- 节点列表：模式 / 入站 ---------- */
.node-mode-cell,
.inbound-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.inbound-addr {
  overflow: hidden;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbound-tag {
  max-width: 170px;
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions--nodes {
  gap: 2px;
}

/* ---------- Agent 凭证 / Dashboard 警告 ---------- */
.agent-command-value {
  white-space: pre-wrap;
  word-break: break-all;
}

.health-warning {
  margin-top: 4px;
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .data-table .node-mode-cell,
  .data-table .inbound-cell {
    align-items: flex-end;
  }
}

@media (max-width: 760px) {
  .agent-endpoint {
    padding: 15px;
  }

  .agent-endpoint-grid,
  .mode-options {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- 修改密码按钮（v0.2 安全更新） -------------------------------------- */
.password-btn {
  height: 34px;
  padding: 0 9px;
  color: var(--muted);
}

.password-btn:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-soft, rgba(91, 140, 255, 0.12));
  border-color: rgba(91, 140, 255, 0.2);
}

.password-btn .icon {
  width: 15px;
  height: 15px;
}

@media (max-width: 900px) {
  .password-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .password-btn .btn-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar-actions .password-btn {
    width: 32px;
    height: 32px;
  }
}

