/* TomoriNet · 安全控制中心 — Quantum Aurora / Abyssal Slate 界面体系
   零外部依赖，严格兼容 Content-Security-Policy: style-src 'self'（无任何内联样式）。 */

:root {
  color-scheme: dark;

  /* 核心深海石板色阶 */
  --bg: #050811;
  --bg-elevated: #090e1c;
  --surface-1: #0c1324;
  --surface-2: #111a30;
  --surface-3: #17223d;
  --field-bg: #070c18;

  /* 精致发光边线 */
  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(148, 163, 184, 0.22);
  --line-soft: rgba(148, 163, 184, 0.07);

  /* 文字色阶（保留 --ink 满足服务端资产自检断言） */
  --ink: #f1f5f9;
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;

  /* 极光青 + 靛蓝双主色 */
  --accent: #14b8a6;
  --accent-hover: #2dd4bf;
  --accent-indigo: #6366f1;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --accent-line: rgba(45, 212, 191, 0.36);
  --accent-text: #5eead4;
  --focus: #38bdf8;

  /* 语义状态色 */
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --ok-soft: rgba(16, 185, 129, 0.14);
  --warn-soft: rgba(245, 158, 11, 0.14);
  --danger-soft: rgba(244, 63, 94, 0.14);

  /* 字体与圆角尺度 */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sidebar-w: 272px;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 14px 34px rgba(2, 6, 23, 0.52);

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 460px at 14% -8%, rgba(20, 184, 166, 0.11), transparent 62%),
    radial-gradient(860px 480px at 88% -6%, rgba(99, 102, 241, 0.12), transparent 60%),
    var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

* { scrollbar-width: thin; scrollbar-color: #24324d transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #24324d; border-radius: 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 300;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #041311;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus-visible { top: 14px; }

/* ═══════════════ 品牌标识与通用按钮 ═══════════════ */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.24), rgba(99, 102, 241, 0.28));
  border: 1px solid rgba(94, 234, 212, 0.32);
  box-shadow: 0 0 22px rgba(20, 184, 166, 0.18);
  overflow: hidden;
}
.brand-image { width: 26px; height: 26px; display: block; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.18; }
.brand-copy strong { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.brand-copy small { font-size: 10px; letter-spacing: 0.1em; color: var(--accent-text); font-weight: 600; margin-top: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-tall { height: 42px; font-size: 14px; }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; }

.btn-primary {
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  color: #031517;
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.24);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--line-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: rgba(94, 234, 212, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--line);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.09);
  color: var(--text-1);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.34);
}
.btn-danger-soft:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.24);
  color: #ffe4e6;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
}
.icon-btn:hover { color: var(--text-1); border-color: var(--line-strong); }

/* ═══════════════ 登录页双栏布局 ═══════════════ */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 520px) 1fr;
}

.login-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 40px;
  background: rgba(9, 14, 28, 0.88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.sec-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}
.sec-pill .icon { width: 13px; height: 13px; }

.login-card-wrap {
  width: 100%;
  max-width: 410px;
  margin: 24px auto;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  color: var(--accent-text);
}
.cipher-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.login-lede {
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: -6px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}
.label-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}
.label-hint[data-kind="ok"] { color: var(--ok); }
.label-hint[data-kind="warn"] { color: var(--warn); }

.field input,
.select select,
.search-box input,
.token-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--field-bg);
  color: var(--text-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder,
.search-box input::placeholder { color: var(--text-3); }
.field input:focus,
.select select:focus,
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
  outline: none;
}

.security-promises {
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(12, 19, 36, 0.78);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.promise-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 9px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}
.promise-item .icon { color: var(--accent-text); margin-top: 2px; }
.promise-item strong { color: var(--text-1); }

.login-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-3);
}

.login-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 42px;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 48%, rgba(20, 184, 166, 0.14), transparent 58%),
    radial-gradient(circle at 75% 24%, rgba(99, 102, 241, 0.16), transparent 50%),
    #040711;
}

.showcase-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 2;
}
.showcase-badges { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.showcase-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent-text);
}
.showcase-proto {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
}
.showcase-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
}

.showcase-stage {
  flex: 1;
  min-height: 360px;
  position: relative;
  display: grid;
  place-items: center;
}
.art-canvas {
  width: 100%;
  height: 100%;
  max-height: 580px;
  display: block;
}

.showcase-foot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  z-index: 2;
}
.showcase-stat {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(12, 19, 36, 0.76);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.showcase-stat span { font-size: 11px; color: var(--text-3); }
.showcase-stat strong { font-size: 12.5px; color: var(--text-1); }

/* ═══════════════ 控制台框架与导航栏 ═══════════════ */
.console-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  background: rgba(8, 13, 26, 0.94);
  border-right: 1px solid var(--line);
  z-index: 90;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.sidebar-close { display: none; }

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 4px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.nav-group-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 8px 6px;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.nav-item:hover {
  background: rgba(148, 163, 184, 0.07);
  color: var(--text-1);
}
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.16), rgba(99, 102, 241, 0.1));
  color: #f8fafc;
  border-color: rgba(45, 212, 191, 0.3);
}
.nav-item.is-active .icon { color: var(--accent-text); }

.posture-card {
  margin-top: auto;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--line);
}
.posture-card .nav-group-title { padding: 0 0 8px; }
.posture-list { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-2); }
.posture-list li { display: flex; align-items: center; gap: 8px; }
.dot-ok, .dot-warn {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.dot-ok { background: var(--ok); box-shadow: 0 0 8px rgba(16, 185, 129, 0.65); }
.dot-warn { background: var(--warn); box-shadow: 0 0 8px rgba(245, 158, 11, 0.65); }

.sidebar-session {
  padding: 14px 12px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #041514;
  background: linear-gradient(135deg, #2dd4bf, #818cf8);
  flex: none;
}
.session-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.session-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta span { font-size: 11px; color: var(--text-3); }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.state-dot.is-live { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.session-timers {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-2);
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--field-bg);
  border: 1px solid var(--line-soft);
}
.session-timers strong { color: var(--accent-text); }

.sidebar-backdrop { display: none; }

/* ═══════════════ 主工作区与顶栏 ═══════════════ */
.workspace { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(5, 8, 17, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.menu-btn { display: none; }
.topbar-heading h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-heading p { font-size: 12px; color: var(--text-2); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sync-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  font-size: 12px;
}
.sync-label { color: var(--text-3); }
.sync-badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-2);
}
.sync-badge[data-kind="success"] { background: var(--ok-soft); color: #34d399; }
.sync-badge[data-kind="busy"] { background: var(--accent-soft); color: var(--accent-text); }
.sync-badge[data-kind="error"] { background: var(--danger-soft); color: #fda4af; }

#refreshButton.is-busy .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.content {
  padding: 24px 28px 42px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.section-block { display: flex; flex-direction: column; gap: 18px; }

/* ═══════════════ 核心指标 Bento ═══════════════ */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(17, 26, 48, 0.85), rgba(12, 19, 36, 0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.metric-icon-box {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.metric-icon-box.is-cyan { background: rgba(56, 189, 248, 0.14); color: #38bdf8; }
.metric-icon-box.is-indigo { background: rgba(99, 102, 241, 0.16); color: #818cf8; }
.metric-icon-box.is-emerald { background: rgba(16, 185, 129, 0.16); color: #34d399; }

.metric-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.metric-sub { font-size: 11.5px; color: var(--text-3); }

/* ═══════════════ 面板与全球节点地图 ═══════════════ */
.panel {
  border-radius: var(--radius-lg);
  background: rgba(12, 19, 36, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.panel-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.panel-head-actions, .map-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.meta-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.topology-stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: #050913;
  aspect-ratio: 2 / 1;
  max-height: 410px;
  user-select: none;
}
.world-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.world-svg.is-panning { cursor: grabbing; }
.world-svg.is-picking { cursor: crosshair; }

.map-graticule line {
  stroke: rgba(148, 163, 184, 0.08);
  stroke-width: 0.7;
}
.map-graticule line.is-equator {
  stroke: rgba(45, 212, 191, 0.22);
  stroke-dasharray: 4 4;
  stroke-width: 0.9;
}
.map-land {
  fill: #13203b;
  stroke: #2c4570;
  stroke-width: 0.85;
  stroke-linejoin: round;
}
.map-hub-dot { fill: rgba(148, 163, 184, 0.36); }
.map-hub-label {
  fill: rgba(148, 163, 184, 0.52);
  font-size: 8.5px;
  font-family: var(--font-sans);
  pointer-events: none;
}
.map-link-arc {
  fill: none;
  stroke: rgba(45, 212, 191, 0.34);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}
.map-node-group { cursor: pointer; }
.map-node-halo {
  fill: rgba(20, 184, 166, 0.22);
  stroke: rgba(45, 212, 191, 0.55);
  stroke-width: 1.1;
}
.map-node-core { fill: #5eead4; }
.map-node-label {
  fill: #f8fafc;
  font-size: 10px;
  font-weight: 600;
  paint-order: stroke;
  stroke: #050913;
  stroke-width: 2.6px;
}

.map-legend {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(5, 9, 19, 0.82);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-2);
  pointer-events: none;
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.lg-active { background: #2dd4bf; box-shadow: 0 0 8px #2dd4bf; }
.lg-hub { background: #64748b; }
.lg-pick { width: 7px; height: 7px; border: 1.4px solid #818cf8; border-radius: 50%; display: inline-block; }

/* ═══════════════ 一次性密钥保险箱 ═══════════════ */
.token-vault {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.11), rgba(20, 184, 166, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.42);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.token-vault-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.token-title { font-size: 15px; margin-top: 6px; }
.token-note { font-size: 12.5px; color: #cbd5e1; margin-top: 3px; }
.token-actions { display: flex; gap: 8px; }
.token-input {
  height: auto;
  padding: 10px 12px;
  font-size: 12.5px;
  resize: none;
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
}

/* ═══════════════ 双栏工作面板 ═══════════════ */
.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.search-box {
  position: relative;
  flex: 1;
}
.search-box .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-box input { padding-left: 34px; }

.select { position: relative; }
.select select { appearance: none; padding-right: 32px; cursor: pointer; }
.select-compact { width: 142px; }
.select-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.inline-form {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--accent-line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.inline-form-head h3 { font-size: 14px; font-weight: 700; }
.inline-form-head p { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field-wide { grid-column: 1 / -1; }

.inline-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.inline-form-actions { display: flex; gap: 8px; }
.field-hint { font-size: 11.5px; color: var(--text-3); max-width: 340px; }

/* 开关与标签 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.15s ease, background 0.15s ease;
}
.switch input:checked + .switch-track {
  background: rgba(20, 184, 166, 0.34);
  border-color: var(--accent);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
  background: #5eead4;
}
.switch-danger input:checked + .switch-track {
  background: rgba(244, 63, 94, 0.34);
  border-color: var(--danger);
}
.switch-danger input:checked + .switch-track .switch-thumb { background: #fda4af; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-text { font-size: 12.5px; color: var(--text-1); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid var(--line);
}
.badge .icon { width: 12px; height: 12px; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.badge-ok { background: var(--ok-soft); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.badge-warn { background: var(--warn-soft); color: #fcd34d; border-color: rgba(245, 158, 11, 0.34); }
.badge-danger { background: var(--danger-soft); color: #fda4af; border-color: rgba(244, 63, 94, 0.34); }

/* ═══════════════ 账户列表与手风琴权限编辑 ═══════════════ */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.user-row.is-open { border-color: var(--accent-line); }

.user-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  text-align: left;
}
.user-head:not(.user-head-static):hover { background: rgba(148, 163, 184, 0.05); }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 13.5px; }
.user-sub { font-size: 11.5px; color: var(--text-2); }
.user-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chevron { color: var(--text-3); transition: transform 0.16s ease; }
.user-row.is-open .chevron { transform: rotate(180deg); color: var(--accent-text); }

.user-perms {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(7, 12, 24, 0.55);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.perm-block { display: flex; flex-direction: column; gap: 8px; }
.perm-block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.perm-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.perm-quick-btns { display: flex; gap: 6px; }
.perm-switches { display: flex; gap: 18px; flex-wrap: wrap; }

.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip-ui {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  transition: all 0.14s ease;
}
.chip-check { width: 13px; height: 13px; opacity: 0.25; }
.chip input:checked + .chip-ui {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #f0fdfa;
}
.chip input:checked + .chip-ui .chip-check { opacity: 1; color: var(--accent-text); }

.sec-ops-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.sec-ops-row input {
  flex: 1;
  min-width: 160px;
  height: 31px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--field-bg);
  font-size: 12px;
}

.user-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ═══════════════ 节点卡片网格 ═══════════════ */
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.node-item {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}
.node-item.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}
.node-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.node-item-name { font-weight: 700; font-size: 14px; }
.node-item-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-2);
}
.node-kv-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(7, 12, 24, 0.58);
  border: 1px solid var(--line-soft);
}
.node-kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
}
.node-kv dt { color: var(--text-3); flex: none; }
.node-kv dd {
  color: var(--text-1);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* ═══════════════ 流量审计表格 ═══════════════ */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 280px));
  gap: 12px;
}
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
thead th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  background: rgba(7, 12, 24, 0.65);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cell-account { font-weight: 600; }
.cell-node { display: inline-flex; align-items: center; gap: 7px; }
.cell-node code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--field-bg);
  color: var(--text-2);
}
.traffic-bar-wrap { width: 150px; display: flex; flex-direction: column; gap: 4px; }
.bar-svg { width: 100%; height: 6px; display: block; border-radius: 3px; overflow: hidden; }
.bar-track { fill: #0b1325; }
.bar-tx { fill: #818cf8; }
.bar-rx { fill: #2dd4bf; }
.traffic-empty td { text-align: center; padding: 28px; color: var(--text-3); }

/* ═══════════════ 状态反馈、骨架与响应式 ═══════════════ */
.inline-msg { font-size: 12px; color: var(--danger); min-height: 0; }
.inline-msg:empty { display: none; }
.inline-msg[data-kind="success"] { color: var(--ok); }
.inline-msg[data-kind="muted"] { color: var(--text-2); }

.panel-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-3);
}
.panel-foot .icon { width: 14px; height: 14px; color: var(--accent-text); }

.empty-state {
  padding: 28px 18px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  text-align: center;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-state .icon { width: 24px; height: 24px; color: var(--text-3); }
.empty-state p { font-size: 12px; color: var(--text-3); max-width: 320px; }

.skeleton-row {
  height: 52px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: pulseBg 1.3s ease-in-out infinite;
}
@keyframes pulseBg { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.content-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  font-size: 11.5px;
  color: var(--text-3);
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #10192e;
  border: 1px solid var(--accent-line);
  box-shadow: var(--shadow-card);
  font-size: 12.5px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast .icon { color: var(--ok); }
.toast[data-kind="error"] { border-color: rgba(244, 63, 94, 0.45); }
.toast[data-kind="error"] .icon { color: var(--danger); }
.toast[data-kind="info"] .icon { color: var(--accent-text); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }

@media (max-width: 1120px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-showcase { display: none; }
  .login-pane { border-right: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .console-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-close, .menu-btn { display: inline-grid; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.66);
    z-index: 80;
  }
  body.nav-open .sidebar-backdrop { display: block; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 32px; }
  .field-grid, .filter-bar { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr; }
  .sync-label { display: none; }
}
