:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --soft: #f7f8fa;
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0d9488;
  --accent-2: #ccfbf1;
  --accent-dark: #0f766e;
  --bad: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --info: #2563eb;
  --pastel-red: #fee2e2;
  --pastel-blue: #dbeafe;
  --pastel-green: #dcfce7;
  --pastel-yellow: #fef3c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04);
  --mono: "Cascadia Mono", "SF Mono", Consolas, ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.auth-pending .app-shell,
body.auth-pending .auth-gate {
  visibility: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 360px at 20% 0%, rgba(13, 148, 136, 0.12), transparent 55%),
    var(--bg);
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-eyebrow {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-card h1 {
  margin: 0;
  font-size: 1.65rem;
}

.auth-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-card input {
  min-height: 42px;
}

.auth-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--bad);
  font-size: 0.9rem;
}

button,
input,
textarea,
select {
  font: inherit;
  min-width: 0;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
  touch-action: manipulation;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease, transform .12s ease;
}

button:hover {
  border-color: var(--line-strong);
  background: var(--soft);
  box-shadow: var(--shadow-soft);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  outline-offset: 1px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: none;
}

button.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

#deleteSelectedBtn,
#deleteFailedBtn,
#clearNodesBtn,
#clearAssignBtn {
  border-color: color-mix(in srgb, var(--bad) 28%, white);
  color: var(--bad);
  background: var(--pastel-red);
}

#deleteSelectedBtn:hover,
#deleteFailedBtn:hover,
#clearNodesBtn:hover,
#clearAssignBtn:hover {
  border-color: color-mix(in srgb, var(--bad) 40%, white);
  background: #fecaca;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.app-sticky-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-top: -8px;
  padding-top: 8px;
  padding-bottom: 1px;
  background: transparent;
}

.hero {
  position: relative;
  top: auto;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.08);
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 1 auto;
}

.hero-mark {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 750;
  text-wrap: balance;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 750;
}

.summary,
.panel-copy {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.45;
}

.summary {
  margin: 2px 0 0;
  font-size: 12px;
}

.status-grid {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.status-grid article {
  min-width: 78px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.status-grid span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

label span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.status-grid strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 750;
  font-family: var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  align-items: center;
}

.top-actions .icon-btn {
  width: 32px;
  min-width: 32px;
  padding: 0;
  color: var(--muted);
}

.top-actions .icon-btn:hover {
  color: var(--ink);
}

.engine-switch {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 24px;
  min-height: 24px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #c7cbd1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.engine-switch:hover {
  border: 0;
  background: #b8bdc5;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.engine-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  transition: transform 180ms cubic-bezier(.22, .61, .36, 1);
}

.engine-switch.on,
.engine-switch.on:hover {
  background: #34c759;
  box-shadow: inset 0 0 0 1px rgba(24, 118, 59, 0.08);
}

.engine-switch.on .engine-switch-knob {
  transform: translateX(18px);
}

.status-grid span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

svg.mi {
  flex: 0 0 auto;
  opacity: 0.85;
}

.section-head h2 {
  font-size: 14px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-head h2 .ico,
.tool-section header strong .ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-2);
  color: var(--accent);
  flex: 0 0 auto;
}

.tool-section header strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.2;
}

.overview-metric span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tone-ok {
  color: var(--ok);
}

.tone-bad {
  color: var(--bad);
}

.tone-warn {
  color: var(--warn);
}

.tone-info {
  color: var(--info);
}

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

.tabs {
  position: relative;
  top: auto;
  z-index: 1;
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.tab {
  min-width: 78px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0 14px;
  gap: 6px;
}

.tab:hover {
  background: var(--soft);
  border-color: transparent;
  color: var(--ink);
  box-shadow: none;
}

.tab.active {
  border-color: transparent;
  background: var(--ink);
  color: #fff;
  box-shadow: none;
}

.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
  min-height: min(64dvh, 720px);
  overflow: hidden;
}

.panel.active {
  display: flex;
  flex-direction: column;
}

.panel > .section-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--soft));
  align-items: center;
}

.panel > :not(.section-head) {
  /* body content gets padding via panel-body or first content blocks */
}

#test > .import-block,
#test > .node-test-overview,
#test > .node-filter-bar,
#test > #nodeTable,
#assign > #assignTable,
#dashboard > .dashboard-tools,
#dashboard > #quickResult,
#dashboard > #doctorResult,
#dashboard > #portsTable,
#dashboard > #exportOutput,
#dashboard > #validationResults {
  margin-left: 16px;
  margin-right: 16px;
}

#test > .import-block { margin-top: 12px; }
#test > .test-options {
  width: auto;
  min-width: 0;
  margin: 0 16px 10px;
}

#test > .node-test-overview { margin-top: 0; margin-bottom: 10px; }
#test > .node-filter-bar { margin-top: 0; margin-bottom: 10px; }
#test > #nodeTable { margin-bottom: 16px; }
#assign > #assignTable { margin: 12px 16px 16px; }
#dashboard > .dashboard-tools { margin: 12px 16px 14px; }
#dashboard > #portsTable { margin: 0 16px 16px; }
#dashboard > #quickResult,
#dashboard > #doctorResult { margin: 0 16px 10px; }
#dashboard > #exportOutput,
#dashboard > #validationResults { margin: 0 16px 16px; }

.split,
.section-head {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.section-head {
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
  margin-bottom: 0;
  align-items: center;
  gap: 12px;
}

.section-head h2 {
  font-size: 14px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-head .panel-copy {
  margin-top: 2px;
  font-size: 11.5px;
}

.actions,
.input-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

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

.local-check-result {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(100%, 360px);
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-check-result span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.local-check-targets {
  display: inline-flex;
  gap: 4px;
  flex: 0 0 auto;
}

.local-check-targets b {
  border-radius: 999px;
  padding: 2px 5px;
  background: var(--accent-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.local-check-targets .pass {
  background: var(--pastel-green);
  color: var(--ok);
}

.local-check-targets .warn,
.local-check-targets .challenge {
  background: var(--pastel-yellow);
  color: var(--warn);
}

.local-check-targets .fail,
.local-check-targets .err {
  background: var(--pastel-red);
  color: var(--bad);
}

.local-check-result.ok {
  border-color: #d9e4d7;
  background: var(--pastel-green);
  color: var(--ok);
}

.local-check-result.bad {
  border-color: #f5d8d9;
  background: var(--pastel-red);
  color: var(--bad);
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
}

button.ghost:hover {
  background: var(--soft);
  border-color: transparent;
  color: var(--ink);
  box-shadow: none;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 2px;
}

.test-control-panel {
  display: flex;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-end;
  align-items: center;
}

.test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
}

.test-actions button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.test-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
}

.target-option {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 10px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.target-option input {
  width: auto;
  margin: 0;
}

.target-option small {
  color: var(--muted);
}

.test-options {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
}

.test-options > summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.test-options > summary::-webkit-details-marker {
  display: none;
}

.test-options > summary::after {
  content: "展开";
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}

.test-options[open] > summary::after {
  content: "收起";
}

.test-options-body {
  display: grid;
  gap: 8px;
  padding: 0 11px 11px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  justify-items: start;
}

.test-options-body .inline-field.wide {
  width: 100%;
}

.test-options-body .inline-field.wide input {
  width: min(100%, 420px);
}

.node-test-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin: 0 0 12px;
}

.health {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  display: grid;
  place-items: center;
  padding: 8px;
  min-width: 96px;
  box-shadow: var(--shadow-soft);
}

.ring {
  --p: 0;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 58%, transparent 59%),
    conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0);
  display: grid;
  place-items: center;
  text-align: center;
}

.ring strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: -0.03em;
}

.ring small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.node-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.node-filter-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 0.875rem;
}
.node-filter-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}
.node-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}
.node-filter-tab {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.node-filter-tab:hover {
  background: #fff;
  color: var(--ink);
  border-color: transparent;
  box-shadow: none;
}
.node-filter-tab.active {
  background: #fff;
  border-color: transparent;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.node-filter-count {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  font-family: var(--mono);
}

.overview-metric,
.overview-target {
  min-height: 0;
  flex: 1 1 90px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 8px 10px;
  box-shadow: var(--shadow-soft);
}

.overview-metric {
  min-width: 88px;
  max-width: 140px;
}

.overview-target {
  flex: 1 1 220px;
  min-width: 0;
  max-width: none;
}

.overview-metric span,
.overview-target span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.overview-metric strong,
.overview-target strong {
  display: block;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 750;
  font-family: var(--mono);
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-metric.ok strong { color: var(--ok); }
.overview-metric.bad strong { color: var(--bad); }
.overview-metric.testing strong { color: var(--warn); }

.overview-metric .spark {
  display: block;
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.overview-metric .spark i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.overview-metric.ok .spark i { background: var(--ok); }
.overview-metric.bad .spark i { background: var(--bad); }
.overview-metric.testing .spark i { background: var(--warn); }

.proto {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--pastel-blue);
  color: var(--info);
  border: 1px solid color-mix(in srgb, var(--info) 16%, white);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-family: var(--mono);
}

.proto.ss { background: #f3e8ff; color: #7c3aed; border-color: #e9d5ff; }
.proto.trojan { background: #ffe4e6; color: #e11d48; border-color: #fecdd3; }
.proto.hysteria2,
.proto.hysteria { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.proto.vmess { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.proto.tuic { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.proto.anytls { background: #ecfccb; color: #3f6212; border-color: #bef264; }
.proto.other { background: var(--soft); color: var(--muted); border-color: var(--line); }

.latency-visual {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.latency-bar {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.latency-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
}

.latency-visual.latency-mid .latency-bar i { background: var(--warn); }
.latency-visual.latency-slow .latency-bar i { background: var(--bad); }

.geoip-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 180px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.flag {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, #94a3b8, #64748b);
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.flag.hk { background: linear-gradient(180deg, #ef4444 40%, #fff 40% 60%, #ef4444 60%); }
.flag.jp { background: radial-gradient(circle at 50% 50%, #ef4444 28%, #fff 29%); }
.flag.us { background: repeating-linear-gradient(180deg, #ef4444 0 2px, #fff 2px 4px); }
.flag.tw { background: linear-gradient(180deg, #1d4ed8 50%, #ef4444 50%); }
.flag.sg { background: linear-gradient(180deg, #ef4444 50%, #fff 50%); }
.flag.de { background: linear-gradient(180deg, #111 33%, #ef4444 33% 66%, #facc15 66%); }
.flag.kr { background: linear-gradient(180deg, #fff 33%, #ef4444 33% 66%, #1d4ed8 66%); }
.flag.gb,
.flag.uk { background: linear-gradient(135deg, #1d4ed8, #fff 40%, #ef4444); }
.flag.cn { background: #ef4444; }

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.input-row input {
  flex: 1;
}

input,
textarea,
select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink);
  padding: 7px 10px;
  box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, white);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  box-shadow: none;
  vertical-align: middle;
}

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

textarea {
  min-height: 156px;
  resize: vertical;
}

.inline-field {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.inline-field input {
  width: 120px;
}

.inline-field.wide input {
  width: min(320px, 56vw);
}

.notice {
  position: fixed;
  z-index: 80;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  width: min(440px, calc(100vw - 32px));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
  pointer-events: none;
  transform: translate(-50%, 0) scale(1);
  transform-origin: bottom center;
  transition: opacity 180ms cubic-bezier(.23, 1, .32, 1), transform 180ms cubic-bezier(.23, 1, .32, 1), visibility 0s linear;
}

.notice.hidden {
  display: block;
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, 12px) scale(.98);
  transition: opacity 150ms ease-out, transform 150ms ease-out, visibility 0s linear 150ms;
}

.notice.ok {
  border-color: color-mix(in srgb, var(--ok) 25%, white);
  color: var(--ok);
  background: color-mix(in srgb, var(--pastel-green) 70%, white);
}

.notice.bad {
  border-color: color-mix(in srgb, var(--bad) 25%, white);
  color: var(--bad);
  background: color-mix(in srgb, var(--pastel-red) 70%, white);
}

.quick-result {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 9px 11px;
  font-size: 13px;
}

.quick-result span,
.notice {
  overflow-wrap: anywhere;
}

.quick-result.ok {
  border-color: #d9e4d7;
}

.quick-result.bad {
  border-color: #f5d8d9;
  color: var(--bad);
}

.doctor-result {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 12px;
}

.doctor-result span {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doctor-result .ok {
  border-color: #d9e4d7;
  background: var(--pastel-green);
  color: var(--ok);
}

.doctor-result .warn {
  border-color: #efe2bd;
  background: var(--pastel-yellow);
  color: var(--warn);
}

.doctor-result .fail {
  border-color: #f5d8d9;
  background: var(--pastel-red);
  color: var(--bad);
}

.engine-health {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  grid-column: 1 / -1;
}

.engine-health span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.engine-health strong {
  color: var(--ink);
  font-family: var(--mono);
}

.engine-health .eh-status {
  font-weight: 700;
  color: var(--ink);
}

.engine-health.ok .eh-status { color: var(--ok); }
.engine-health.bad .eh-status,
.engine-health.bad .eh-issue { color: var(--bad); font-weight: 700; }
.engine-health.idle .eh-status { color: var(--muted); }

.engine-health.ok {
  border-color: color-mix(in srgb, var(--ok) 22%, white);
  background: color-mix(in srgb, var(--pastel-green) 55%, white);
}

.engine-health.bad {
  border-color: color-mix(in srgb, var(--bad) 22%, white);
  background: color-mix(in srgb, var(--pastel-red) 55%, white);
}

.dashboard-tools {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(170px, .58fr) minmax(300px, 1fr);
  gap: 0;
  margin: 0 0 14px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfcfd);
  box-shadow: var(--shadow-soft);
}

.tool-section {
  display: grid;
  align-content: start;
  grid-column: auto;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
  box-shadow: none;
  grid-template-rows: auto 1fr;
}

.tool-section:nth-child(3) {
  border-right: 0;
}

.notice.info {
  border-color: color-mix(in srgb, var(--info) 20%, white);
  color: #1e40af;
  background: color-mix(in srgb, var(--pastel-blue) 72%, white);
}

@media (prefers-reduced-motion: reduce) {
  .notice,
  .notice.hidden {
    transition: none;
    transform: translate(-50%, 0);
  }
}

.tool-section.wide {
  grid-column: auto;
}

.tool-section header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.tool-section header span {
  display: none;
}

.tool-section header strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 1.2;
}

.engine-tool {
  grid-template-rows: auto auto 1fr;
}

.engine-tool .engine-health {
  min-height: 28px;
  margin: 0 0 7px;
  border: 0;
  border-radius: 9px;
  padding: 5px 8px;
  background: var(--soft);
  box-shadow: none;
}

.engine-tool .engine-health.ok {
  background: color-mix(in srgb, var(--pastel-green) 58%, white);
}

.engine-tool .engine-health.bad {
  background: color-mix(in srgb, var(--pastel-red) 58%, white);
}

.engine-version-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  align-self: end;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.engine-version-head {
  display: grid !important;
  min-width: 0;
  flex: 1 1 120px;
  gap: 2px !important;
  margin: 0 !important;
}

.engine-version-head strong {
  font-size: 12px;
}

.tool-section .engine-version-head span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

.engine-version-block .actions {
  flex: 0 0 auto;
  gap: 4px;
}

.engine-version-block .actions button {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 11px;
}

.doctor-tool .ico {
  background: #ecfdf3;
  color: #16803d;
}

.ai-tool .ico {
  background: #fff7ed;
  color: #c45b08;
}

.target-tool .ico {
  background: #eef2ff;
  color: #4f46e5;
}

.engine-tool .ico {
  background: #eaf8ef;
  color: #218647;
}

.doctor-tool .actions,
.ai-tool .actions,
.target-tool .actions {
  align-self: start;
}

.tool-state,
.tool-progress {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  min-height: 26px;
  border-radius: 7px;
  padding: 3px 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-state.ok { background: var(--pastel-green); color: var(--ok); }
.tool-state.warn { background: var(--pastel-yellow); color: #8a5a00; }
.tool-state.bad,
.tool-progress.bad { background: var(--pastel-red); color: var(--bad); }

.ai-tool .actions {
  display: grid;
  grid-template-columns: minmax(108px, 1fr) auto auto auto;
  align-items: end;
  justify-content: stretch;
  gap: 6px;
}

.ai-tool .inline-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.ai-tool .tool-progress {
  grid-column: 1 / -1;
}

.ai-tool .inline-field select {
  min-width: 96px;
}

.target-tool .actions {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(130px, .35fr) auto;
  align-items: end;
}

.target-tool {
  grid-column: 1 / -1;
  grid-template-columns: 132px minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  border-top: 1px solid var(--line);
  border-right: 0;
  padding-block: 9px;
}

.target-tool > header {
  margin: 0;
}

.target-tool .actions {
  align-self: center;
}

.target-tool .inline-field {
  min-width: 0;
  white-space: nowrap;
}

.target-tool .inline-field.wide {
  width: 100%;
}

.target-tool .inline-field input,
.target-tool .inline-field select {
  width: 100%;
}

.tool-section.wide .actions {
  display: flex;
  flex-wrap: wrap;
  grid-template-columns: none;
  align-items: end;
}

.tool-section.wide .inline-field.wide {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 4px;
  width: min(100%, 100%);
  flex: 1 1 180px;
}

.tool-section.wide .inline-field.wide input {
  width: 100%;
}

.tool-section.wide .inline-field:not(.wide) {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  gap: 4px;
  width: auto;
  flex: 0 1 140px;
}

.subscription-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.subscription-tools .inline-field input {
  width: 82px;
}

.import-block {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.import-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.import-strip label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  margin: 0;
}

.import-strip .subscription-tools {
  align-items: end;
}

.import-more {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.import-more > summary {
  cursor: pointer;
  list-style: none;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.import-more > summary::-webkit-details-marker {
  display: none;
}

.import-more > summary::after {
  content: "展开";
  color: var(--faint);
  font-weight: 500;
  font-size: 11px;
}

.import-more[open] > summary::after {
  content: "收起";
}

.import-more-body {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.import-more-body textarea {
  min-height: 96px;
}

.import-more-body .primary {
  width: fit-content;
}

.hidden {
  display: none;
}

.table-card {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: break-word;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

th:first-child,
td:first-child {
  width: 42px;
  text-align: center;
}

#assignTable th:first-child,
#assignTable td:first-child {
  width: 68px;
}

.assign-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 24px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.assign-select-all input {
  margin: 0;
  accent-color: var(--accent);
}

th:first-child input[type="checkbox"],
td:first-child input[type="checkbox"] {
  display: inline-block;
}

tbody tr:hover {
  background: #f8fafc;
}

td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

code {
  display: inline-block;
  max-width: 360px;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: middle;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.copyable {
  cursor: copy;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  border-radius: 4px;
}

.copyable:hover {
  color: var(--accent-dark);
  background: var(--accent-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge.ok {
  background: var(--pastel-green);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 18%, white);
  width: max-content;
}

.badge.bad {
  background: var(--pastel-red);
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 18%, white);
}

.badge.idle {
  background: var(--soft);
  color: var(--muted);
  border-color: var(--line);
}

.badge.testing {
  background: var(--pastel-yellow);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 20%, white);
}

.latency-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 54px;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
  font-family: var(--mono);
  font-size: 12px;
}

.latency-fast {
  background: var(--pastel-green);
  color: var(--ok);
}

.latency-mid {
  background: var(--pastel-yellow);
  color: var(--warn);
}

.latency-slow {
  background: var(--pastel-red);
  color: var(--bad);
}

.latency-unknown {
  background: var(--soft);
  color: var(--muted);
  font-weight: 650;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.table-actions button {
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;
  white-space: nowrap;
}

button[data-remove-port] {
  border-color: rgba(180, 35, 24, 0.22);
  color: var(--bad);
  background: var(--pastel-red);
}

button[data-remove-port]:hover {
  border-color: rgba(180, 35, 24, 0.42);
  background: #f9dddd;
}

.empty {
  padding: 36px 20px;
  color: var(--muted);
  text-align: center;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.empty strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.empty span {
  max-width: 36ch;
  font-size: 12.5px;
  line-height: 1.45;
}

.port-input {
width: 120px;
max-width: 100%;
}

.port-input.port-busy {
border-color: var(--bad, #e53935);
background: rgba(229, 57, 53, 0.06);
}

.port-hint {
display: block;
font-size: 11px;
color: var(--bad, #e53935);
margin-top: 2px;
line-height: 1.3;
}

.validation-results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.proxy-admin-inline,
.proxy-admin-mini-targets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.proxy-admin-inline {
  max-width: 260px;
  font-size: 12px;
  overflow: hidden;
}

.proxy-admin-inline > span:not(.badge):not(.proxy-admin-mini-targets) {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-admin-inline.local {
  margin-top: 5px;
  border-top: 1px dashed rgba(121, 134, 120, 0.24);
  padding-top: 5px;
}

.proxy-admin-mini-targets b {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 700;
  background: white;
}

.proxy-admin-mini-targets .pass {
  color: var(--ok);
}

.proxy-admin-mini-targets .warn {
  color: var(--warn);
}

.proxy-admin-mini-targets .fail,
.proxy-admin-mini-targets .err {
  color: var(--bad);
}

.export-output {
  width: 100%;
  margin-top: 10px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.validation-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  overflow: auto;
}

.validation-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.validation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 9px 10px 10px;
}

.target-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 7px;
  font-size: 12px;
  color: var(--muted);
  background: #f7f8f7;
}

.target-chip b {
  color: var(--ink);
}

.target-chip.ok {
  border-color: #bddcc9;
  background: #edf7f1;
}

.target-chip.bad {
  border-color: #edc4bf;
  background: #fff1ef;
}

.target-chip small {
  color: var(--muted);
}

.result-preview {
  max-width: 420px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  color: var(--muted);
}

#nodeTable table {
  min-width: 1080px;
  table-layout: fixed;
}

#nodeTable th,
#nodeTable td {
  overflow-wrap: normal;
  word-break: normal;
}

#nodeTable th {
  white-space: nowrap;
}

#nodeTable th:nth-child(1) { width: 42px; }
#nodeTable th:nth-child(2) { width: 170px; }
#nodeTable th:nth-child(3) { width: 68px; }
#nodeTable th:nth-child(4) { width: 235px; }
#nodeTable th:nth-child(5) { width: 70px; }
#nodeTable th:nth-child(6) { width: 92px; }
#nodeTable th:nth-child(7) { width: 120px; }
#nodeTable th:nth-child(8) { width: 175px; }
#nodeTable th:nth-child(9) { width: 173px; }

#nodeTable td:nth-child(1),
#nodeTable td:nth-child(3),
#nodeTable td:nth-child(4),
#nodeTable td:nth-child(5),
#nodeTable td:nth-child(6),
#nodeTable td:nth-child(7),
#nodeTable td:nth-child(8),
#nodeTable td:nth-child(9) {
  white-space: nowrap;
}

#nodeTable .node-identity strong,
#nodeTable .node-identity small,
#nodeTable .server-address,
#nodeTable .node-target-result,
#nodeTable .geoip-chip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#nodeTable .node-identity strong {
  font-size: 12px;
}

#nodeTable .node-identity small {
  margin-top: 4px;
  font-size: 10px;
}

#nodeTable .server-address {
  line-height: 1.45;
}

#nodeTable .node-target-result {
  max-width: none;
  color: var(--muted);
}

#nodeTable .geoip-chip {
  display: inline-flex;
}

#portsTable table {
  min-width: 1100px;
  table-layout: fixed;
}

#portsTable th,
#portsTable td {
  overflow-wrap: normal;
  word-break: normal;
}

#portsTable th {
  white-space: nowrap;
}

#portsTable th:nth-child(1) { width: 54px; }
#portsTable th:nth-child(2) { width: 120px; }
#portsTable th:nth-child(3) { width: 68px; }
#portsTable th:nth-child(4) { width: 68px; }
#portsTable th:nth-child(5) { width: 92px; }
#portsTable th:nth-child(6) { width: 68px; }
#portsTable th:nth-child(7) { width: 146px; }
#portsTable th:nth-child(8) { width: 124px; }
#portsTable th:nth-child(9) { width: 158px; }
#portsTable th:nth-child(10) { width: 92px; }
#portsTable th:nth-child(11) { width: 120px; }

#portsTable td:nth-child(1),
#portsTable td:nth-child(3),
#portsTable td:nth-child(4),
#portsTable td:nth-child(5),
#portsTable td:nth-child(6),
#portsTable td:nth-child(8),
#portsTable td:nth-child(10) {
  white-space: nowrap;
}

#portsTable td:nth-child(2) {
  overflow-wrap: anywhere;
}

#portsTable .result-preview {
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

#portsTable .proxy-admin-inline {
  max-width: 100%;
}

#portsTable .proxy-admin-inline.local {
  display: grid;
  justify-items: start;
  gap: 4px;
  margin: 0;
  border-top: 0;
  padding-top: 0;
}

#portsTable .proxy-admin-mini-targets {
  flex-wrap: nowrap;
  gap: 3px;
}

#portsTable .proxy-admin-mini-targets b {
  padding: 1px 4px;
  font-size: 10px;
}

#portsTable .geoip-chip {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-command {
  min-height: 28px;
  padding-inline: 8px;
  white-space: nowrap;
  font-size: 11px;
}

#portsTable .table-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

#portsTable .table-actions button {
  min-height: 27px;
  padding-inline: 5px;
  font-size: 11px;
}

@media (max-width: 860px) {
  .dashboard-tools {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .tool-section,
  .tool-section:last-child {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, var(--soft));
    box-shadow: var(--shadow-soft);
  }

  .target-tool .actions {
    grid-template-columns: 1fr;
  }

  .target-tool {
    grid-template-columns: 1fr;
  }

  .target-tool > header {
    margin-bottom: 10px;
  }

  .app-shell {
    width: min(100% - 16px, 760px);
    padding: 12px 0 28px;
  }

  .hero {
    flex-wrap: wrap;
    align-items: start;
    margin-bottom: 8px;
  }

  .hero-brand {
    align-items: flex-start;
    width: 100%;
  }

  .status-grid {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .split,
  .section-head,
  .dashboard-tools,
  .import-strip {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tool-section,
  .tool-section:nth-child(3),
  .tool-section.wide {
    grid-column: 1 / -1;
  }

  .tool-section.wide .actions {
    grid-template-columns: 1fr;
  }

  .tool-section.wide .inline-field.wide,
  .tool-section.wide .inline-field:not(.wide) {
    grid-template-columns: 1fr;
  }

  .section-head {
    margin-bottom: 10px;
  }

  .actions {
    justify-content: stretch;
  }

  .tool-section header {
    display: block;
  }

  .tool-section header span {
    display: block;
    max-width: none;
    margin-top: 4px;
    text-align: left;
  }

  .test-control-panel {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
  }

  .test-options {
    width: 100%;
  }

  .test-targets,
  .test-actions {
    justify-content: flex-start;
  }

  .test-actions > button {
    flex: 1 1 140px;
  }

  .actions > button,
  .actions > label,
  .actions > select {
    flex: 1 1 160px;
  }

  .inline-field {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .inline-field input,
  .inline-field.wide input {
    width: 100%;
  }

  .input-row {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .input-row input,
  .input-row button {
    flex: initial;
  }

  .quick-result {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .table-card {
    margin-inline: -2px;
    border-radius: var(--radius-sm);
  }

  table {
    min-width: 820px;
  }

  th,
  td {
    padding: 8px 9px;
  }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .dashboard-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .tool-section,
  .tool-section:last-child {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, var(--soft));
    box-shadow: var(--shadow-soft);
  }

  .tool-section,
  .tool-section:nth-child(3),
  .tool-section.wide {
    grid-column: auto;
  }

  .dashboard-tools .target-tool {
    grid-column: 1 / -1;
  }

  .tool-section.wide .actions {
    display: flex;
    flex-wrap: wrap;
  }

  .proxy-admin-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 10px);
    padding-top: 6px;
  }

  .hero {
    gap: 8px;
    padding: 10px;
  }

  .hero-brand {
    gap: 12px;
  }

  .hero-mark {
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: 22px;
    line-height: 1;
  }

  h2 {
    font-size: 18px;
  }

  .summary,
  .panel-copy {
    margin: 5px 0 0;
    font-size: 12px;
    line-height: 1.3;
  }

  .panel-copy {
    display: none;
  }

  .status-grid {
    gap: 5px;
  }

  .status-grid article {
    padding: 6px 5px;
  }

  .status-grid span {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .status-grid strong {
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 7px -5px 9px;
    padding: 5px;
    background: rgba(247, 249, 247, 0.96);
    backdrop-filter: blur(10px);
  }

  .tab {
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 44px;
  }

  .panel {
    padding: 10px;
  }

  .node-test-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .node-test-overview .health {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .overview-target {
    grid-column: 1 / -1;
  }

  .test-options-body .target-option {
    flex: 1 1 120px;
    justify-content: center;
    min-height: 40px;
  }

  .test-targets {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .test-targets > span {
    width: 100%;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .tool-section.wide .actions,
  .proxy-admin-controls {
    grid-template-columns: 1fr;
  }

  .actions > button,
  .actions > label {
    min-width: 0;
    width: 100%;
  }

  .ai-tool .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-tool .inline-field,
  .ai-tool .tool-progress {
    grid-column: 1 / -1;
  }

  .actions > .inline-field.wide,
  .actions > .inline-field {
    grid-column: 1 / -1;
  }

  button {
    min-height: 44px;
    padding-inline: 8px;
    font-size: 13px;
  }

  input,
  textarea,
  select {
    min-height: 44px;
    padding: 7px 8px;
    font-size: 13px;
  }

  input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 0;
  }

  .input-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  textarea {
    min-height: 112px;
  }

  .table-card,
  .validation-card {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table {
    display: block;
    min-width: 0;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 7px;
    width: 100%;
  }

  tr {
    display: grid;
    gap: 0;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    padding: 4px 0;
    overflow: hidden;
  }

  tbody tr:hover {
    background: white;
  }

  td {
    display: grid;
    grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
    gap: 7px;
    align-items: start;
    min-width: 0;
    border-bottom: 0;
    padding: 5px 9px;
    font-size: 13px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.4;
  }

  td[data-label="选择"],
  td[data-label="使用"],
  td[data-label="操作"],
  td[data-label="curl"] {
    grid-template-columns: 1fr;
  }

  td[data-label="选择"]::before,
  td[data-label="使用"]::before {
    margin-bottom: 3px;
  }

  td[data-label="操作"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  td[data-label="操作"]::before {
    grid-column: 1 / -1;
  }

  td[data-label="操作"] button {
    width: 100%;
    min-height: 32px;
    padding-inline: 6px;
  }

  td[data-label="操作"] .table-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  td[data-label="curl"] code,
  code {
    width: 100%;
    max-width: 100%;
  }

  .mono,
  .result-preview,
  td small,
  td strong,
  td span {
    min-width: fit-content;
    overflow-wrap: anywhere;
  }

  .port-input {
    width: 100%;
  }

  .empty {
    padding: 18px 10px;
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  td[data-label="操作"] {
    grid-template-columns: 1fr;
  }

  td[data-label="操作"] .table-actions {
    grid-template-columns: 1fr;
  }
}

/* Monitoring and pool management */
.monitor-head { align-items: center; }

.range-switch,
.entity-switch,
.run-subtabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.range-switch button,
.entity-switch button,
.run-subtab {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.range-switch button.active,
.entity-switch button.active,
.run-subtab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .10);
}

.traffic-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }

.traffic-kpis article,
.traffic-chart-card,
.traffic-event-card,
.pool-manager,
.traffic-drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.traffic-kpis article { padding: 12px 14px; }
.traffic-kpis span,
.traffic-kpis small { display: block; color: var(--muted); font-size: 12px; }
.traffic-kpis strong { display: block; margin: 4px 0; font-family: var(--mono); font-size: 20px; letter-spacing: -.04em; color: var(--ink); }
.traffic-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, .8fr); gap: 12px; margin-bottom: 14px; }
.traffic-chart-card,
.traffic-event-card { min-height: 245px; padding: 13px; }
.traffic-chart-card header,
.traffic-event-card header,
.pool-manager-head,
.pool-editor header,
.traffic-drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.traffic-chart { height: 170px; margin-top: 12px; overflow: hidden; }
.traffic-chart svg { display: block; width: 100%; height: 100%; }
.traffic-grid path { stroke: #edf1f5; stroke-width: 1; }
.traffic-line { fill: none; stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.traffic-line.download { stroke: #2563eb; }
.traffic-line.upload { stroke: #c65a09; }
.traffic-legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.traffic-legend span { display: inline-flex; align-items: center; gap: 5px; }
.traffic-legend i { width: 13px; height: 3px; border-radius: 2px; }
.traffic-legend .download { background: #2563eb; }
.traffic-legend .upload { background: #c65a09; }
.traffic-events { display: grid; gap: 7px; margin-top: 10px; }
.traffic-events article { display: grid; gap: 2px; padding: 8px 9px; border-radius: 7px; background: var(--soft); font-size: 12px; }
.traffic-events strong { color: var(--ink); font-size: 12px; }
.traffic-events span,
.traffic-events small { color: var(--muted); }
.traffic-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0 8px; }
.traffic-detail-head .inline-field { min-width: 245px; }
.traffic-detail-head input { min-height: 32px; }
.traffic-table td small { display: block; margin-top: 3px; color: var(--muted); }
.traffic-drawer { margin-top: 12px; padding: 12px 14px; }
.traffic-drawer-head > div { display: grid; gap: 2px; }
.traffic-drawer-head span { color: var(--muted); font-size: 12px; }
.traffic-drawer-kpis { display: flex; gap: 16px; margin: 12px 0; font-size: 13px; color: var(--muted); }
.traffic-drawer-kpis b { margin-left: 5px; color: var(--ink); font-family: var(--mono); }
.traffic-drawer-chart { padding: 10px; border-radius: 7px; background: var(--soft); color: var(--muted); font-size: 12px; }

.run-subtabs { margin-bottom: 12px; }
.pool-manager { padding: 14px; }
.pool-manager-head { margin-bottom: 12px; }
.pool-manager-head > div { display: grid; gap: 3px; }
.pool-manager-head .muted { font-size: 12px; }
.pool-router-notice { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; font-size: 12px; color: var(--muted); background: var(--soft); }
.pool-router-notice.ok { color: var(--ok); background: var(--pastel-green); border-color: #cfe5d7; }
.pool-router-notice.warn { color: #8a5a00; background: var(--pastel-yellow); border-color: #edddb7; }
.pool-router-notice.bad { color: var(--bad); background: var(--pastel-red); border-color: #edd0cb; }
.pool-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.pool-card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.pool-card header,
.pool-card footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.pool-card header > div { display: flex; align-items: baseline; gap: 8px; }
.pool-card header span.mono { color: var(--muted); font-size: 12px; }
.pool-card p { margin: 0; color: var(--muted); font-size: 12px; }
.pool-card footer { justify-content: flex-start; }
.pool-card footer button { min-height: 30px; font-size: 12px; }
.pool-member-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pool-member-chips span { padding: 3px 6px; border: 1px solid #cfe5d7; border-radius: 6px; color: var(--ok); background: var(--pastel-green); font-size: 11px; }
.pool-member-chips span.draining { color: #8a5a00; background: var(--pastel-yellow); border-color: #edddb7; }
.pool-member-chips span.unhealthy { color: var(--bad); background: var(--pastel-red); border-color: #edd0cb; }
.pool-member-chips span.member-overflow { border-color: var(--line); color: var(--muted); background: var(--soft); }
.pool-editor { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border: 1px solid #cfdbea; border-radius: 9px; background: #fbfdff; }
.pool-manager.hidden,
.pool-editor.hidden,
.traffic-drawer.hidden { display: none; }
.pool-editor-fields { display: grid; grid-template-columns: 1.5fr .7fr 1fr .7fr; gap: 10px; align-items: end; }
.pool-editor label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.pool-editor input,
.pool-editor select { min-height: 34px; }
.pool-editor .check-field { display: flex; min-height: 34px; align-items: center; }
.pool-members { display: grid; gap: 5px; }
.pool-members-head { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.pool-members h3 { margin: 0; font-size: 13px; }
.pool-members-head > span { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.pool-member-search { margin-left: auto; }
.pool-member-search input { width: min(220px, 45vw); min-height: 30px !important; }
.pool-member-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.pool-member-actions button { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.pool-member-list { display: grid; gap: 5px; max-height: 460px; overflow: auto; padding-right: 2px; }
.pool-member-row { display: grid !important; grid-template-columns: auto minmax(120px, 1fr) minmax(100px, 1fr) 68px auto; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.pool-member-check { display: flex !important; align-items: center; gap: 7px; min-width: 0; color: var(--ink) !important; }
.pool-member-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-member-row small { color: var(--muted); font-weight: 400; }
.pool-member-row input[type="number"] { min-height: 28px; }
.pool-member-row .pool-drain-toggle { display: flex; align-items: center; gap: 4px; font-size: 11px; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 900px) {
  .traffic-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .traffic-layout { grid-template-columns: 1fr; }
  .pool-editor-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .monitor-head,
  .traffic-detail-head,
  .pool-manager-head { align-items: stretch; flex-direction: column; }
  .range-switch { width: 100%; overflow-x: auto; }
  .range-switch button { flex: 1 0 auto; }
  .traffic-kpis { grid-template-columns: 1fr 1fr; gap: 7px; }
  .traffic-kpis article { padding: 10px; }
  .traffic-kpis strong { font-size: 17px; }
  .traffic-detail-head .inline-field { min-width: 0; width: 100%; }
  .pool-editor-fields { grid-template-columns: 1fr; }
  .pool-member-search { order: 4; width: 100%; margin-left: 0; }
  .pool-member-search input { width: 100%; }
  .pool-member-row { grid-template-columns: auto 1fr 60px; }
  .pool-member-row small { grid-column: 2 / -1; }
  .pool-member-row .pool-drain-toggle { grid-column: 2 / -1; }
}

/* Dense operating surfaces added for traffic and node-pool workflows. */
.monitor-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.traffic-kpis {
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.traffic-kpis article {
  min-height: 78px;
  padding: 11px 14px;
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.traffic-kpis article:last-child { border-right: 0; }
.traffic-kpis strong { margin: 2px 0; font-size: 19px; letter-spacing: 0; }
.traffic-layout { grid-template-columns: minmax(0, 2.15fr) minmax(290px, .85fr); gap: 14px; }
.traffic-chart-card,
.traffic-event-card {
  min-height: 268px;
  padding: 14px 16px 12px;
  border-radius: 8px;
  box-shadow: none;
}

.traffic-chart-card header > div { display: grid; gap: 2px; }
.traffic-chart-card header strong,
.traffic-event-card header strong { font-size: 14px; }
.traffic-live { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 11px; }
.traffic-live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.traffic-chart { height: 190px; margin-top: 8px; }
.traffic-grid path { stroke: #e9eef3; stroke-dasharray: 2 3; }
.traffic-area { stroke: none; }
.traffic-area.download { fill: rgba(37, 99, 235, .11); }
.traffic-area.upload { fill: rgba(198, 90, 9, .09); }
.traffic-line { stroke-width: 2.5; }
.traffic-axis text { fill: #8a98aa; font: 10px var(--mono); }
.traffic-legend { padding-top: 2px; }
.traffic-events { gap: 0; margin-top: 9px; }
.traffic-events article {
  position: relative;
  gap: 2px;
  padding: 9px 0 9px 12px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.traffic-events article:last-child { border-bottom: 0; }
.traffic-events article::before { content: ""; position: absolute; top: 15px; left: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.traffic-events strong { font-weight: 750; }
.traffic-events span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traffic-table { border-radius: 8px; box-shadow: none; }
.traffic-table-more { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.traffic-table-more button { min-height: 29px; padding: 0 9px; font-size: 12px; }

.node-view-tabs {
  display: inline-flex;
  gap: 2px;
  margin: 14px 0 10px;
  padding: 3px;
  border-bottom: 0;
  border-radius: 8px;
  background: #e9eef2;
}

.node-action-menu { position: relative; }
.node-action-menu > summary,
.node-setup > summary {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
}

.node-action-menu > summary::-webkit-details-marker,
.node-setup > summary::-webkit-details-marker { display: none; }
.node-action-menu > summary::after,
.node-setup > summary::after { content: "⌄"; margin-left: 6px; color: var(--faint); }
.node-action-menu[open] > summary { border-color: var(--accent); color: var(--accent-dark); }
.node-action-menu > div {
  position: absolute;
  z-index: 10;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 6px;
  width: 244px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}
.node-action-menu > div button { min-height: 30px; padding: 0 8px; font-size: 12px; }
#test > .node-setup { margin: 10px 16px 0; }
.node-setup { border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.node-setup > summary { display: flex; justify-content: space-between; width: 100%; min-height: 34px; border: 0; border-radius: 7px; background: transparent; }
.node-setup > summary::after { content: "展开"; margin-left: auto; font-size: 11px; font-weight: 500; }
.node-setup[open] > summary { border-bottom: 1px solid var(--line); border-radius: 7px 7px 0 0; color: var(--ink); }
.node-setup[open] > summary::after { content: "收起"; }
.node-setup .import-strip { margin: 10px 10px 8px; }
.node-setup .import-more { margin: 0 10px 10px; }
.node-test-overview { display: block; margin: 0 0 8px; }
.node-health-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  min-height: 46px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
}
.node-health-line > div { display: inline-flex; align-items: baseline; gap: 5px; padding: 0 12px; border-right: 1px solid var(--line); }
.node-health-line > div:first-child { padding-left: 0; }
.node-health-line b,
.node-health-line strong { color: var(--ink); font: 750 15px var(--mono); }
.node-health-line .node-health-primary strong { font-size: 18px; }
.node-health-line .ok { color: var(--ok); }
.node-health-line .bad { color: var(--bad); }
.node-health-line .warn { color: var(--warn); }
.node-health-line span,
.node-health-line small { color: var(--muted); font-size: 11px; }
.node-health-line .node-health-quality { margin-left: auto; border-right: 0; }
.node-health-line .node-health-quality i { color: var(--muted); font-size: 11px; font-style: normal; }
.node-health-line > small { margin-left: 12px; }

.node-view-tab {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12px;
}

.node-view-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.node-workspace { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.node-collections { position: sticky; top: 126px; display: grid; gap: 6px; min-width: 0; padding: 10px 0; border-right: 1px solid var(--line); }
.node-collections > header { display: flex; justify-content: space-between; align-items: baseline; padding: 0 10px 5px 2px; color: var(--muted); font-size: 12px; }
.node-collections > header strong { color: var(--ink); font-size: 13px; }
.node-collection-item,
.node-create-group { justify-content: flex-start; width: calc(100% - 10px); min-height: 32px; margin-right: 10px; border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: var(--muted); font-size: 12px; }
.node-collection-item:hover,
.node-collection-item.active { background: var(--accent-2); color: #115e59; }
.node-create-group { margin-top: 4px; border: 1px dashed #b8c8d4; color: #32606c; }
.node-create-group:hover { border-color: var(--accent); color: var(--accent-dark); background: #f0fdfa; }
.node-group-list { display: grid; gap: 3px; max-height: calc(100dvh - 300px); overflow: auto; padding-right: 8px; }
.node-group-item { border-bottom: 1px solid #edf1f4; }
.node-group-item summary { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 42px; padding: 4px 10px 4px 2px; cursor: pointer; list-style: none; }
.node-group-item summary::-webkit-details-marker { display: none; }
.node-group-item summary > span { display: grid; min-width: 0; gap: 1px; }
.node-group-item summary b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 12px; }
.node-group-item summary small,
.node-group-item summary i { color: var(--muted); font-size: 10px; font-style: normal; }
.node-group-item summary i { flex: 0 0 auto; text-align: right; }
.node-group-item-body { display: grid; gap: 5px; padding: 0 8px 8px 2px; color: var(--muted); font-size: 11px; }
.node-group-item-body > div { display: flex; gap: 5px; }
.node-group-item-body button { min-height: 27px; padding: 0 7px; font-size: 11px; }
.node-group-empty { padding: 7px 8px 8px 2px; color: var(--muted); font-size: 11px; }
.node-group-form { display: grid; gap: 7px; width: calc(100% - 10px); padding: 8px; border: 1px solid #b7d9d5; border-radius: 7px; background: #f6fffd; }
.node-group-form.hidden { display: none; }
.node-group-form label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.node-group-form input,
.node-group-form select { min-height: 30px; }
.node-group-form > div { display: flex; gap: 5px; }
.node-group-form button { min-height: 28px; padding: 0 8px; font-size: 11px; }
.node-workspace-main { min-width: 0; }
.node-workspace-main .node-test-overview { margin-top: 0; }
.node-workspace-main .node-filter-bar { margin-top: 0; }
.node-page-size { margin-left: auto; }
.node-page-size select { min-height: 32px; color: var(--muted); font-size: 12px; }
.node-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.node-pagination > div { display: inline-flex; align-items: center; gap: 7px; }
.node-pagination button { min-height: 30px; padding: 0 9px; font-size: 12px; }
.node-pagination strong { min-width: 52px; text-align: center; color: var(--ink); font-family: var(--mono); font-size: 12px; }
.group-manager-list,
.source-list { display: grid; gap: 8px; }
.group-manager-row,
.source-row { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.group-manager-row summary { display: grid; grid-template-columns: minmax(160px, 1.6fr) repeat(3, minmax(80px, .55fr)); gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; list-style: none; }
.group-manager-row summary::-webkit-details-marker { display: none; }
.group-manager-row summary > div { display: grid; gap: 2px; }
.group-manager-row summary strong { font-size: 13px; }
.group-manager-row summary span { color: var(--muted); font-size: 11px; }
.group-manager-row summary b { color: var(--ink); font: 700 14px var(--mono); }
.group-manager-detail { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 14px; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.group-manager-detail > div { display: flex; gap: 6px; margin-left: auto; }
.group-manager-detail button { min-height: 29px; padding: 0 9px; font-size: 12px; }
.source-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(80px, .45fr) minmax(110px, .65fr) auto; gap: 12px; align-items: center; padding: 12px 14px; }
.source-row > div { display: grid; gap: 3px; min-width: 0; }
.source-row strong { font-size: 13px; }
.source-row .mono { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.source-row b { font: 700 14px var(--mono); }
.source-row span { color: var(--muted); font-size: 11px; }
.source-row > div:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.source-row button { min-height: 29px; padding: 0 8px; font-size: 11px; }

.pool-editor-fields { grid-template-columns: minmax(140px, 1.4fr) minmax(92px, .55fr) minmax(160px, 1fr) minmax(110px, .65fr) auto; }
.pool-policy-hint { margin: -2px 0 0; color: var(--muted); font-size: 12px; }

/* Node management is a workbench: commands stay in the title bar, while the
   collection and the current page keep distinct, readable surfaces. */
.test-control-panel .node-setup {
  position: relative;
  width: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.test-control-panel .node-setup > summary {
  display: inline-flex;
  width: auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.test-control-panel .node-setup > summary::after {
  content: "⌄";
  margin-left: 6px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}

.test-control-panel .node-setup[open] > summary {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--accent-dark);
  background: #f0fdfa;
}

.node-setup-popover {
  position: absolute;
  z-index: 25;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: min(620px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}

.node-setup[open] > .node-setup-popover { display: grid; gap: 9px; }
.node-setup-popover .import-strip { margin: 0; border-radius: 7px; }
.node-setup-popover .import-more { margin: 0; }
.node-setup-popover .test-options-body { padding: 0; border: 0; }
.node-setup-test-options .node-setup-popover { width: min(560px, calc(100vw - 48px)); }

#test .node-view-tabs {
  display: flex;
  width: auto;
  margin: 0;
  padding: 0 16px;
  gap: 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

#test .node-view-tab {
  position: relative;
  min-height: 42px;
  padding: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 12px;
}

#test .node-view-tab:hover,
#test .node-view-tab.active {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

#test .node-view-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
}

#test .node-workspace {
  grid-template-columns: 212px minmax(0, 1fr);
  gap: 18px;
  margin: 16px;
  align-items: start;
}

#test .node-collections {
  position: sticky;
  top: 122px;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
}

#test .node-collections > header { padding: 0 1px 6px; }
#test .node-collection-item,
#test .node-create-group { width: 100%; margin-right: 0; }
#test .node-group-list { max-height: calc(100dvh - 330px); padding-right: 0; }
#test .node-group-item summary { padding: 5px 1px; }
#test .node-group-item-body { padding: 0 1px 8px; }
#test .node-group-empty { padding: 7px 1px 8px; }
#test .node-group-form { width: 100%; }

#test .node-workspace-main { min-width: 0; }
#test .node-health-line {
  min-height: 38px;
  margin-bottom: 11px;
  padding: 0 2px 10px;
  gap: 0;
}

#test .node-health-line > div { padding: 0 10px; }
#test .node-health-line > div:first-child { padding-left: 0; }
#test .node-health-line b,
#test .node-health-line strong { font-size: 14px; }
#test .node-health-line .node-health-primary strong { font-size: 17px; }
#test .node-health-line > small { margin-left: 10px; }

#test .node-filter-bar {
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 12px;
}

#test .node-filter-bar input[type="search"] { min-width: 180px; }
#test .node-filter-tabs { flex: 0 0 auto; }
#test .node-filter-tab { min-height: 28px; padding: 4px 9px; }
#test .node-page-size { flex: 0 0 auto; }
#test .node-filter-count { flex: 0 0 auto; }

#test .node-data-table { min-width: 760px; table-layout: fixed; }
#test .node-data-table th:nth-child(1) { width: 42px; }
#test .node-data-table th:nth-child(2) { width: 24%; }
#test .node-data-table th:nth-child(3) { width: 72px; }
#test .node-data-table th:nth-child(4) { width: 25%; }
#test .node-data-table th:nth-child(5) { width: 112px; }
#test .node-data-table th:nth-child(6) { width: 132px; }
#test .node-data-table th:nth-child(7) { width: 16%; }
#test .node-data-table td { padding-block: 10px; }
#test .node-data-table td:nth-child(3),
#test .node-data-table td:nth-child(4),
#test .node-data-table td:nth-child(5),
#test .node-data-table td:nth-child(6),
#test .node-data-table td:nth-child(7) { white-space: normal; }
#test .node-health-cell { display: table-cell; }
#test .node-health-cell > div { margin-bottom: 4px; }
#test .node-health-cell .latency-visual { gap: 5px; font-size: 11px; }
#test .node-health-cell .latency-bar { width: 34px; }
#test .node-egress-cell { display: table-cell; }
#test .node-egress-cell > .mono { display: block; margin-bottom: 4px; }
#test .node-egress-cell .geoip-chip { width: max-content; max-width: 100%; }
#test .node-data-table .node-target-result { display: table-cell; }

@media (max-width: 900px) {
  #test .node-workspace { grid-template-columns: 190px minmax(0, 1fr); gap: 12px; margin: 12px; }
  #test .node-filter-bar { flex-wrap: wrap; }
  #test .node-filter-bar input[type="search"] { flex-basis: 100%; }
}

@media (max-width: 680px) {
  .test-control-panel .test-actions { justify-content: flex-end; }
  .test-control-panel .node-setup-popover {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: min(74dvh, 620px);
    overflow: auto;
  }
  #test .node-view-tabs { padding-inline: 12px; gap: 16px; }
  #test .node-workspace { grid-template-columns: 1fr; margin: 12px; }
  #test .node-collections { position: static; border-bottom: 1px solid var(--line); }
  #test .node-filter-bar { gap: 7px; }
  #test .node-filter-tabs { overflow-x: auto; max-width: 100%; }
  #test .node-filter-count { margin-left: auto; }
}

@media (max-width: 900px) {
  .traffic-kpis article:nth-child(2) { border-right: 0; }
  .traffic-kpis article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .node-workspace { grid-template-columns: 190px minmax(0, 1fr); gap: 12px; }
  .source-row { grid-template-columns: minmax(160px, 1fr) repeat(2, minmax(80px, .55fr)); }
  .source-row > div:last-child { grid-column: 1 / -1; justify-content: flex-start; }
  .pool-editor-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .traffic-kpis { grid-template-columns: 1fr 1fr; }
  .traffic-kpis article:nth-child(odd) { border-right: 1px solid var(--line); }
  .traffic-kpis article:nth-child(even) { border-right: 0; }
  .node-workspace { grid-template-columns: 1fr; }
  .node-collections { position: static; max-height: none; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .node-group-list { max-height: 180px; }
  .node-view-tabs { width: 100%; overflow-x: auto; }
  .node-view-tab { flex: 1 0 auto; }
  .group-manager-row summary { grid-template-columns: 1fr 1fr; }
  .group-manager-row summary > div:first-child { grid-column: 1 / -1; }
  .source-row { grid-template-columns: 1fr 1fr; }
  .source-row > div:first-child { grid-column: 1 / -1; }
  .traffic-table-more { align-items: flex-start; flex-direction: column; }
  .node-action-menu { position: static; }
  .node-action-menu > div { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .test-actions { width: 100%; }
  .node-action-menu { width: 100%; }
  .node-action-menu > summary { width: 100%; }
  .node-health-line { gap: 7px 0; }
  .node-health-line > div { padding: 0 8px; }
  .node-health-line > div:first-child { padding-left: 0; }
  .node-health-line .node-health-quality { margin-left: 0; }
  .node-health-line > small { width: 100%; margin-left: 0; }
}
