/* Chain Master Control — clean static UI */
:root {
  --bg: #0b1017;
  --panel: #131a24;
  --card: #171f2c;
  --line: #2a3548;
  --wire: #6b7c94;
  --text: #e7eef8;
  --muted: #8b98ab;
  --accent: #4c8dff;
  --ok: #3ecf8e;
  --bad: #f07178;
  --warn: #e6b450;
  --vps-bg: #1a2332;
  --vps-b: #5a6f8c;
  --node-bg: #122e36;
  --node-b: #2ec4b6;
  --hy2-bg: #241f38;
  --hy2-b: #9b8afb;
  --egress-bg: #2e1a28;
  --egress-b: #e879b0;
  --pool: #1c2838;
  --pool-b: #3d5270;
  --radius: 12px;
  --radius-sm: 8px;
  --side-w: minmax(280px, 360px);
  --nodes-w: minmax(260px, 1fr);
  --main-w: minmax(300px, 1.15fr);
  --cell-w: 150px;
  --cell-h: 46px;
  --vps-w: 120px;
  --conn: 28px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: var(--text);
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.55rem;
}
button { cursor: pointer; }
button:hover { filter: brightness(1.07); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.ghost { background: transparent; }
button.mini {
  font-size: 0.72rem;
  padding: 0.28rem 0.48rem;
  border-radius: 7px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.hint { color: var(--muted); font-size: 0.78rem; margin: 0 0 0.5rem; line-height: 1.4; }
.security-ban-list { display: grid; gap: 0.4rem; }
.security-ban-row { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #0d131c; }
.security-ban-row code { color: var(--warn); font-weight: 650; }
.security-ban-row button { margin-left: auto; }
.security-jail { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: rgba(8,13,20,.35); }
.security-jail-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .65rem .75rem; background: rgba(255,255,255,.025); }
.security-jail-head div { display: grid; gap: .2rem; }
.security-jail-head span { color: var(--muted); font-size: .72rem; }
.status-pill { padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 99px; white-space: nowrap; }
.security-jail .security-ban-row { border-width: 1px 0 0; border-radius: 0; }
.security-jail .empty-state { padding: .6rem .75rem; margin: 0; border-top: 1px solid var(--line); }
.security-custom-block { margin: .8rem 0; padding-top: .75rem; border-top: 1px solid var(--line); }
.security-subhead { display: grid; gap: .2rem; margin-bottom: .55rem; }
.security-subhead strong { font-size: .88rem; }
.security-subhead span { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.security-custom-groups { display: grid; gap: .55rem; }
.meta-editor { margin-top: 0.65rem; }
.meta-editor h3 { margin: 0; font-size: 0.9rem; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.5rem; }
.meta-grid .opt:last-child { grid-column: 1 / -1; }
.meta-actions { margin: 0.65rem 0 0; }
.meta-actions .hint { margin: 0; }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.w-sm { width: 3.6rem; }

/* header */
.top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}
.brand { font-weight: 700; white-space: nowrap; }
.brand span { color: var(--accent); }
.top-meta { color: var(--muted); font-size: 0.78rem; min-width: 8rem; }
.tabs {
  display: flex;
  gap: 0.25rem;
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  margin-left: auto;
}
.tab {
  border: none;
  background: transparent;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}
.tab.active {
  background: var(--accent);
  color: #fff;
}
.top-actions { display: flex; gap: 0.35rem; }

.help-bar {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.82rem;
  line-height: 1.5;
  color: #c5d0de;
}
.help-bar h3 { margin: 0.35rem 0 0.15rem; font-size: 0.88rem; color: var(--node-b); }
.help-bar ul { margin: 0.15rem 0 0.35rem 1.1rem; padding: 0; }
.login-card {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #111b29;
}
.login-card h3 { margin: 0 0 0.35rem; color: var(--node-b); font-size: 0.9rem; }
.login-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.login-row input { min-width: 150px; flex: 1 1 160px; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  max-width: 360px;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* shell: full browser width until 70% of *screen* (JS sets max-width) */
.page-shell {
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
}

.view { display: none; }
.view.active { display: block; }
.embedded-topology {
  margin-top: 0.85rem;
  clear: both;
}
.embedded-topology .topo-wrap {
  margin-bottom: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.75rem;
}
.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.sec-head h2, .card > h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
}
.sec-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ===== YAML layout: fluid 3-col, fill available width ===== */
.yaml-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.2fr) minmax(300px, 1fr);
  gap: 0.75rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
  margin: 0;
}
.yaml-main {
  min-width: 0;
  width: 100%;
}
.yaml-nodes {
  min-width: 0;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.6rem;
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 72px);
  overflow: auto;
}

/* mini topology picker */
.mini-topo {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.mini-vps {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d131c;
  overflow: hidden;
}
.mini-vps-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  align-items: center;
  padding: 0.32rem 0.4rem;
  background: var(--vps-bg);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  color: var(--muted);
}
.mini-vps-head .reg {
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.mini-vps-head .role { text-transform: uppercase; }
.mini-vps-head .ip { font-variant-numeric: tabular-nums; }
.mini-vps-head .nm { color: var(--text); font-weight: 600; }
.mini-nodes { display: flex; flex-direction: column; }
.mini-node {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.32rem 0.4rem;
  border-bottom: 1px solid #1a2433;
  cursor: grab;
  font-size: 0.72rem;
}
.mini-node:last-child { border-bottom: none; }
.mini-node:hover { background: #121a26; }
.mini-node.active { outline: 1px solid var(--accent); outline-offset: -1px; }
.mini-node.in-pool { border-left: 2px solid var(--ok); }
.mini-node .mini-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.mini-node .link {
  all: unset;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-node .link:hover { color: var(--accent); }
.mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.64rem;
}
.mini-meta .ip { font-variant-numeric: tabular-nums; }
.mini-meta .tag {
  padding: 0.02rem 0.28rem;
  border-radius: 999px;
  background: #1a2433;
}
.mini-meta .tag.pool { color: var(--ok); }
.filter-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}
.filter-row select { width: 5.5rem; flex: 0 0 auto; }
.filter-row input { flex: 1; min-width: 0; }

.node-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d131c;
  cursor: grab;
  user-select: none;
  font-size: 0.76rem;
}
.pick-item:active { cursor: grabbing; }
.pick-item.in-pool { border-color: var(--accent); opacity: 0.9; }
.pick-item .tag {
  font-size: 0.62rem;
  color: var(--muted);
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: #1a2433;
  flex-shrink: 0;
}
.pick-item .nm {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-weight: 600;
  overflow: hidden;
}
.pick-item .nm a,
.pick-item button.link {
  all: unset;
  cursor: pointer;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-item .nm a:hover,
.pick-item button.link:hover {
  text-decoration-color: var(--accent);
  color: var(--accent);
}
.pick-item .ip-sub {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pool-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  min-height: 48px;
}
.pool-card {
  background: var(--pool);
  border: 1px dashed var(--pool-b);
  border-radius: var(--radius);
  padding: 0.55rem;
  min-height: 110px;
  transition: border-color .15s, background .15s;
}
.pool-card.drag-over {
  border-style: solid;
  border-color: var(--accent);
  background: #1a2a40;
}
.pool-card .pool-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}
.pool-card .pool-head input {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  font-size: 0.8rem;
  padding: 0.28rem 0.4rem;
}
.pool-card .pool-type {
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.pool-drop {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.pool-drop:empty::after {
  content: "拖入节点";
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 0.6rem 0;
  border: 1px dashed var(--line);
  border-radius: 7px;
}
.pool-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.4rem;
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.72rem;
  cursor: grab;
}
.pool-chip .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  word-break: break-all;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pool-chip button {
  font-size: 0.65rem;
  padding: 0.12rem 0.3rem;
  flex-shrink: 0;
}

.opts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.4rem 0.55rem;
}
.yaml-opts.compact {
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.55rem;
}
.opts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  align-items: flex-end;
  margin-bottom: 0.4rem;
}
.opts-row:last-child { margin-bottom: 0; }
.opts-row.flags {
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px dashed var(--line);
  margin-top: 0.15rem;
  padding-top: 0.4rem;
}
.opt {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 5.5rem;
}
.opt.grow { flex: 1 1 140px; min-width: 8rem; }
.opt.tight { min-width: 5rem; max-width: 10rem; }
.opt.check {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0;
  color: var(--text);
  font-size: 0.8rem;
}
.flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--text);
  white-space: nowrap;
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d131c;
}
.flag input { accent-color: var(--accent); }
.opts-more {
  flex: 1 1 100%;
  font-size: 0.72rem;
  color: var(--muted);
}
.opts-more summary {
  cursor: pointer;
  user-select: none;
  color: var(--accent);
  margin: 0.15rem 0;
}
.opt input, .opt select { width: 100%; font-size: 0.76rem; }
.with-rand { display: flex; gap: 0.3rem; }
.with-rand input { flex: 1; min-width: 0; }

.yaml-out.compact { padding: 0.5rem 0.6rem; margin-bottom: 0; }
.code.yaml {
  margin: 0;
  overflow: auto;
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.68rem;
  white-space: pre;
  line-height: 1.35;
  color: #c8d4e4;
}
/* 默认 = 原「展开」高度；完全展开 = 接近全屏 */
.code.yaml.medium {
  max-height: min(42vh, 420px);
}
.code.yaml.full {
  max-height: min(85vh, 900px);
}

.apply-status {
  margin-top: 0.5rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d131c;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #c5d0de;
  max-height: 220px;
  overflow: auto;
}
.apply-status:empty { display: none; }
.apply-status .ok { color: var(--ok); }
.apply-status .bad { color: var(--bad); }
.apply-status .warn { color: var(--warn); }
.apply-status ul { margin: 0.25rem 0 0.35rem 1.1rem; padding: 0; }
.apply-status h4 { margin: 0.35rem 0 0.15rem; font-size: 0.78rem; color: var(--accent); }

/* side panel */
.side-panel {
  min-width: 0;
  width: 100%;
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.node-panel { padding: 0.7rem 0.75rem 0.9rem; }
.panel-empty {
  color: var(--muted);
  text-align: center;
  padding: 1.2rem 0.6rem;
  font-size: 0.84rem;
  line-height: 1.45;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.panel-head h3 {
  margin: 0;
  font-size: 0.9rem;
  word-break: break-all;
  font-weight: 650;
}
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.panel-actions button { font-size: 0.7rem; padding: 0.28rem 0.42rem; }

.meta-static {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.6rem;
  padding: 0.5rem;
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
}
.meta-static .mi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meta-static .mi b {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.meta-static .mi span { word-break: break-all; line-height: 1.3; }

.field-group-title {
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0.55rem 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 650;
}
.edit-list { display: flex; flex-direction: column; gap: 0.45rem; }
.edit-row { display: flex; flex-direction: column; gap: 0.18rem; }
.edit-row label {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.edit-row label .badge {
  font-size: 0.58rem;
  padding: 0.05rem 0.28rem;
  border-radius: 999px;
  background: #1a2433;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.edit-row label .badge.fixed { color: var(--warn); }
.edit-row label .badge.rand { color: var(--ok); }
.edit-row label .badge.edit { color: var(--accent); }
.edit-ctrl { display: flex; gap: 0.3rem; align-items: stretch; }
.edit-ctrl input,
.edit-ctrl select {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  padding: 0.38rem 0.42rem;
}
.edit-ctrl button.mini { flex: 0 0 auto; white-space: nowrap; }
.edit-row.readonly input,
.edit-row.readonly select {
  opacity: 0.75;
  pointer-events: none;
}
.save-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.7rem 0 0.45rem;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  padding: 0.45rem 0 0.1rem;
}
.hint-tiny {
  font-size: 0.66rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
  line-height: 1.4;
}
.panel-yaml {
  margin-top: 0.3rem;
  max-height: 180px;
  overflow: auto;
  font-size: 0.68rem;
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
  font-family: ui-monospace, Consolas, monospace;
}

/* ===== Topology + GSAP/SVG wires ===== */
.topo-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 1.25rem;
  overflow-x: auto;
}
.topo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.9rem;
}
.topo-head h1 { margin: 0; font-size: 0.95rem; font-weight: 650; }
.topo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.topo-legend .lg { display: inline-flex; align-items: center; gap: 0.28rem; }
.topo-legend i {
  width: 8px; height: 8px; border-radius: 999px; display: inline-block;
}

.topo-graph {
  position: relative;
  width: max-content;
  min-width: 100%;
}
.topo-wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.topo-wires path {
  fill: none;
  stroke: var(--wire);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}
.topo-blocks {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.vps-block {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
}
.vps-rail {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding-right: 0;
}
.vps-card {
  width: var(--vps-w);
  min-height: 72px;
  border: 1px solid var(--vps-b);
  background: var(--vps-bg);
  border-radius: var(--radius);
  padding: 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.vps-card .region {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.vps-card .role { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }
.vps-card .ip {
  font-size: 0.7rem;
  color: #d5deea;
  margin-top: 4px;
  word-break: break-all;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.vps-card .name {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* bus spacer — wires drawn in SVG */
.vps-bus {
  width: 12px;
  flex: 0 0 12px;
  align-self: stretch;
}

.paths-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  justify-content: center;
  padding: 0.15rem 0;
}

.path-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1.25rem; /* room for SVG short segments between cells */
}

.tcell {
  width: var(--cell-w);
  height: var(--cell-h);
  flex: 0 0 var(--cell-w);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.45rem;
  cursor: pointer;
  background: #182230;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.tcell:hover { border-color: #6b7f9a; }
.tcell.active {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}
.tcell .nm {
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tcell .sub {
  font-size: 0.62rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.tcell.node { background: var(--node-bg); border-color: var(--node-b); }
.role-direct { --role-color: #58a6ff; }
.role-chain { --role-color: #bc8cff; }
.tcell.role-direct, .tcell.role-chain { border-color: var(--role-color); }
.role-tag, .warp-tag { display:inline-block; padding:1px 4px; border-radius:4px; font-size:.58rem; margin-left:3px; color:#07111d; background:var(--role-color,#7d8ea3); }
.role-tag.role-direct { background:#58a6ff; }
.role-tag.role-chain { background:#bc8cff; }
.role-tag.role-landing { background:#3fb950; }
.role-tag.role-relay { background:#d2a8ff; }
.warp-tag { background:#39d353; color:#06220c; }
.server-role { border:1px solid var(--role-color,#7d8ea3); color:#e6edf3; background:#111923; border-radius:4px; padding:2px 5px; }
.role-unset { --role-color: #7d8ea3; }
.role-direct { --role-color: #58a6ff; }
.role-landing { --role-color: #3fb950; }
.role-relay { --role-color: #d2a8ff; }
.ops-grid-v2 { grid-template-columns: 1.15fr 0.95fr; align-items: start; }
.add-vps-card .add-vps-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0 0.55rem;
}
.add-vps-card .add-tab {
  border: 1px solid var(--line);
  background: #101826;
  color: #c9d5e4;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.74rem;
  cursor: pointer;
}
.add-vps-card .add-tab.on {
  border-color: var(--accent);
  background: #122033;
  color: #e6edf3;
}
.add-pane.hidden { display: none; }
.hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.deploy-target {
  margin: 0.2rem 0 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #101826;
  border: 1px solid var(--line);
  font-size: 0.78rem;
}
.linked-peers {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.linked-peer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.38rem 0.45rem;
  border-radius: 8px;
  background: #101826;
  border: 1px solid #1c2a3d;
  font-size: 0.74rem;
}
.linked-peer.land { border-left: 3px solid #3fb950; }
.linked-peer.relay { border-left: 3px solid #d2a8ff; }
.linked-peer .nm { font-weight: 600; min-width: 5rem; }
.linked-peer .ip { color: var(--muted); font-variant-numeric: tabular-nums; flex: 1; }
.linked-peer .danger,
button.mini.danger {
  border-color: #f8514966;
  color: #ffb1ab;
  background: #2a1416;
}
button.mini.danger:hover { border-color: #f85149; color: #fff; }
button.mini.primary {
  border-color: #388bfd66;
  color: #9ecbff;
  background: #0f1c2c;
}
button.mini.primary:hover { border-color: #58a6ff; color: #fff; }
.linked-peer button { margin-left: auto; }
.ops-col h2 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.role-legend { display:flex; flex-wrap:wrap; gap:0.35rem; margin:0.35rem 0 0.55rem; }
.role-legend .rl {
  font-size: 0.68rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #d8e2ee;
}
.rl-unset { border-color:#7d8ea3; color:#9fb0c3; }
.rl-direct { border-color:#58a6ff; color:#9ecbff; background:#0f1c2c; }
.rl-landing { border-color:#3fb950; color:#8dffb0; background:#0f2316; }
.rl-relay { border-color:#d2a8ff; color:#e8d4ff; background:#1c1428; }
.server-board { display:flex; flex-direction:column; gap:0.45rem; max-height: 420px; overflow:auto; }
.server-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--role-color, #7d8ea3);
  border-radius: 10px;
  background: linear-gradient(180deg, #101826 0%, #0d131c 100%);
  padding: 0.55rem 0.65rem;
  display:flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
  box-sizing: border-box;
  position: relative;
}
.server-card.selected {
  /* full closed border — not just left accent */
  border: 2px solid var(--role-color, var(--accent));
  border-left-width: 4px;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--role-color, var(--accent)) 40%, transparent),
    0 0 12px color-mix(in srgb, var(--role-color, var(--accent)) 18%, transparent);
  background: linear-gradient(180deg, #142033 0%, #0e1622 100%);
}
.server-card.role-landing.selected { --role-color: #3fb950; }
.server-card.role-relay.selected { --role-color: #d2a8ff; }
.server-card.role-direct.selected { --role-color: #58a6ff; }
.server-card.role-unset.selected { --role-color: #7d8ea3; }
.server-card.busy-lock { opacity: 0.72; pointer-events: none; }
.server-card .sc-actions { cursor: default; pointer-events: auto; }
.deploy-busy-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #e3b34166;
  background: #2a2210;
  color: #f0d78c;
  font-size: 0.78rem;
}
.deploy-busy-banner.hidden { display: none; }
.deploy-busy-banner .spin,
.node-apply-busy .spin {
  width: 14px;
  height: 14px;
  border: 2px solid #f0d78c55;
  border-top-color: #f0d78c;
  border-radius: 50%;
  animation: cm-spin 0.7s linear infinite;
  flex: 0 0 auto;
}
@keyframes cm-spin { to { transform: rotate(360deg); } }
.node-apply-busy {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #e3b34166;
  background: #2a2210;
  color: #f0d78c;
  font-size: 0.76rem;
}
.node-apply-busy.hidden { display: none; }
.node-panel.is-applying { opacity: 0.85; }
.node-apply-result {
  margin: 0.45rem 0 0.2rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  font-size: 0.76rem;
  line-height: 1.4;
}
.node-apply-result.hidden { display: none; }
.node-apply-result.ok {
  border: 1px solid #3fb95066;
  background: #0f2316;
  color: #8dffb0;
}
.node-apply-result.err {
  border: 1px solid #f8514966;
  background: #2a1416;
  color: #ffb1ab;
}
.node-apply-result .tiny { font-size: 0.68rem; opacity: 0.9; }
.meta-editor .auto-hint {
  font-style: normal;
  font-size: 0.62rem;
  color: #7d8ea3;
  border: 1px solid #2a3545;
  border-radius: 4px;
  padding: 0 0.25rem;
  margin-left: 0.2rem;
}
.meta-editor .warn.tiny { display:block; margin: 0.25rem 0 0.15rem; font-size: 0.7rem; color: #e3b341; }
.status-config-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.special-days-card { overflow: hidden; }
.special-days-head,
.special-day-row {
  display: grid;
  grid-template-columns: 72px 105px minmax(105px, .7fr) 78px 125px minmax(150px, 1fr) auto;
  gap: .45rem;
  align-items: center;
  min-width: 820px;
}
.special-days-head {
  padding: 0 .35rem .35rem;
  color: var(--muted);
  font-size: .68rem;
}
.special-days-list { display: grid; gap: .45rem; overflow-x: auto; padding-bottom: .2rem; }
.special-day-row {
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0d1520;
}
.special-day-row input,
.special-day-row select { width: 100%; min-width: 0; }
.special-day-row [data-special-field="date"] { font-variant-numeric: tabular-nums; }
.special-day-row [data-special-field="emoji"] { text-align: center; }
.special-day-row [data-special-field="emoji"]:disabled { opacity: .42; }
.panel-media-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: end;
  margin: .7rem 0;
}
.panel-media-toolbar .opt { min-width: 190px; margin: 0; }
.panel-media-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 31px;
  padding: .28rem .55rem;
  color: var(--text);
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: .72rem;
  cursor: pointer;
  overflow: hidden;
}
.panel-media-picker.ghost { background: transparent; }
.panel-media-picker:hover { filter: brightness(1.07); }
.panel-media-picker:has(input:disabled) { opacity: .55; cursor: wait; }
.panel-media-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.panel-media-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.panel-media-group { min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: #0d1520; padding: .55rem; }
.panel-media-group h3 { margin: 0 0 .45rem; font-size: .78rem; }
.panel-media-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .4rem; align-items: center; padding: .35rem 0; border-top: 1px solid rgba(255,255,255,.045); }
.panel-media-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
@media (max-width: 920px) { .panel-media-list { grid-template-columns: 1fr; } }
body.deploy-busy .peer-pick,
body.deploy-busy .linked-peer button,
body.deploy-busy #btnApplyLinks,
body.deploy-busy #btnDeploy,
body.deploy-busy #deployRole {
  cursor: not-allowed;
}
.role-gate-hint {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #58a6ff55;
  background: #0f1c2c;
  color: #9ecbff;
  font-size: 0.74rem;
  line-height: 1.45;
}
.role-gate-hint.hidden { display: none; }
.role-gate-hint b { color: #e6edf3; }
.server-card .sc-top { display:flex; flex-wrap:wrap; gap:0.35rem; align-items:center; }
.server-card .sc-name { font-weight: 650; font-size: 0.86rem; }
.server-card .sc-host { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.76rem; }
.server-card .sc-meta { display:flex; flex-wrap:wrap; gap:0.3rem; align-items:center; font-size:0.72rem; color:var(--muted); }
.server-card .sc-links { display:flex; flex-wrap:wrap; gap:0.28rem; }
.link-chip {
  display:inline-flex;
  align-items:center;
  gap:0.25rem;
  font-size:0.66rem;
  padding:0.12rem 0.4rem;
  border-radius:999px;
  border:1px solid var(--line);
  background:#121a26;
  color:#d5e0ee;
}
.link-chip.land { border-color:#2ea04355; color:#8dffb0; }
.link-chip.relay { border-color:#a371f755; color:#e8d4ff; }
.link-chip .dir { opacity:0.7; }
.server-card .sc-actions { display:flex; flex-wrap:wrap; gap:0.3rem; }
.server-card .sc-actions button { font-size:0.7rem; padding:0.22rem 0.45rem; }
.server-relations {
  margin-top: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem 0.65rem;
  background: linear-gradient(180deg, #0d141f 0%, #0a1018 100%);
  min-height: 2.5rem;
  overflow: hidden;
}
.server-relations h3 { margin:0; font-size:0.8rem; color:#c9d5e4; }
.srel-head {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  justify-content:space-between;
  gap:0.35rem 0.75rem;
  margin-bottom:0.45rem;
}
.srel-stats { font-size:0.68rem; color:var(--muted); font-variant-numeric: tabular-nums; }
.srel-graph {
  position: relative;
  width: 100%;
  min-height: 120px;
}
.srel-wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.srel-wires path,
.srel-wire {
  fill: none;
  stroke: #7c8eaa;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
  vector-effect: non-scaling-stroke;
}
.srel-wire.wire-0 { stroke: #d2a8ff; }
.srel-wire.wire-1 { stroke: #58a6ff; }
.srel-wire.wire-2 { stroke: #3fb950; }
.srel-wire.wire-3 { stroke: #e3b341; }
.srel-wire.wire-4 { stroke: #f778ba; }
.srel-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.srel-chain-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 28px minmax(120px, 1fr);
  gap: 0.35rem;
  align-items: start;
  min-height: 96px;
}
.srel-bus { align-self: stretch; }
.srel-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.srel-col-title {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.1rem;
}
.srel-col-nodes {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.srel-node {
  appearance: none;
  border: 1px solid var(--role-color, var(--line));
  background: linear-gradient(180deg, #152033 0%, #101826 100%);
  color: #e6edf3;
  border-radius: 10px;
  padding: 0.42rem 0.5rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15) inset;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.srel-node:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.srel-node.selected {
  border: 2px solid var(--role-color, var(--accent));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--role-color, var(--accent)) 40%, transparent),
    0 0 10px color-mix(in srgb, var(--role-color, var(--accent)) 20%, transparent);
}
.srel-wire.dim { opacity: 0.18; }
.srel-wire.hot { opacity: 1; stroke-width: 2.6; filter: drop-shadow(0 0 3px rgba(210,168,255,0.35)); }
.srel-node.role-relay { --role-color: #d2a8ff; }
.srel-node.role-landing { --role-color: #3fb950; }
.srel-node.role-direct { --role-color: #58a6ff; }
.srel-node.role-unset { --role-color: #7d8ea3; }
.srel-role {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--role-color, #9fb0c3);
}
.srel-reg {
  font-size: 0.62rem;
  color: #9ecbff;
  letter-spacing: 0.03em;
}
.srel-name {
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.srel-ip {
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.srel-st {
  font-size: 0.6rem;
  color: #8dffb0;
  text-transform: uppercase;
}
.srel-node.err .srel-st { color: #ff7b72; }
.srel-node.run .srel-st { color: #e3b341; }
.srel-direct-row {
  border-top: 1px dashed #1c2a3d;
  padding-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.srel-direct-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.srel-direct-track .srel-node {
  min-width: 118px;
  max-width: 180px;
  flex: 1 1 118px;
}
.srel-empty-chain { margin: 0.2rem 0; }
.srel-foot { margin: 0.45rem 0 0; }
.rel-row {
  display:flex;
  flex-wrap:wrap;
  gap:0.35rem;
  align-items:center;
  font-size:0.74rem;
  padding:0.22rem 0;
  border-bottom:1px solid #152033;
}
.rel-row:last-child { border-bottom:0; }
.rel-arrow { color:#7d8ea3; }
@media (max-width: 720px) {
  .srel-chain-row {
    grid-template-columns: 1fr;
  }
  .srel-bus { display: none; }
}
.bind-panel {
  margin: 0.45rem 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d131c;
  padding: 0.5rem;
}
.bind-panel.hidden { display:none; }
.bind-head { display:flex; flex-direction:column; gap:0.15rem; margin-bottom:0.4rem; }
.bind-head strong { font-size:0.82rem; }
.peer-pick-list {
  display:flex;
  flex-direction:column;
  gap:0.35rem;
  max-height: 240px;
  overflow:auto;
}
.peer-pick {
  display:flex;
  flex-wrap:wrap;
  gap:0.35rem 0.5rem;
  align-items:center;
  padding:0.4rem 0.45rem;
  border:1px solid transparent;
  border-radius:8px;
  background:#101826;
  font-size:0.74rem;
}
.peer-pick:hover { background:#121f30; }
.peer-pick.on { border-color: var(--accent); background:#122033; }
.peer-pick .nm { font-weight:600; min-width:5.5rem; }
.peer-pick .ip { color:var(--muted); font-variant-numeric: tabular-nums; }
.peer-pick .role-pill {
  font-size:0.64rem;
  border-radius:999px;
  padding:0.08rem 0.35rem;
  border:1px solid var(--role-color,#7d8ea3);
  color:#e6edf3;
}
.peer-pick .warn { color: var(--warn); font-size:0.66rem; }
.manual-land { margin-top:0.45rem; color:var(--muted); font-size:0.74rem; }
.manual-land summary { cursor:pointer; }
.manual-land .row { margin-top:0.4rem; }
.register-row input { min-width: 0; }
@media (max-width: 980px) {
  .ops-grid-v2 { grid-template-columns: 1fr; }
}
.tcell.hy2 { background: var(--hy2-bg); border-color: var(--hy2-b); }
.tcell.egress {
  width: 78px;
  flex: 0 0 78px;
  background: var(--egress-bg);
  border-color: var(--egress-b);
  text-align: center;
  align-items: center;
}
.tcell.missing { opacity: 0.65; border-style: dashed; }

/* connector between cells */
/* legacy CSS wire (unused when SVG active) */
.tlink {
  width: var(--conn);
  height: 2px;
  background: var(--wire);
  flex: 0 0 var(--conn);
  border-radius: 1px;
}

/* ===== Ops ===== */
.ops-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.one-click .install-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}
.one-click .w-reg { width: 4.5rem; }
.relay-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-end;
  width: 100%;
}
.install-cmd {
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: #0a0f16;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  color: #d6e4ff;
  user-select: all;
}
.hint.tiny { font-size: 0.72rem; margin-top: 0.4rem; }
.advanced-ssh > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  padding: 0.15rem 0;
  color: var(--text);
}
.advanced-ssh > summary::-webkit-details-marker { display: none; }
.advanced-ssh[open] > summary { margin-bottom: 0.55rem; color: var(--muted); }
.advanced-ssh .ops-grid { margin-top: 0.35rem; }
.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.list { display: flex; flex-direction: column; gap: 0.3rem; }
.item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d131c;
  font-size: 0.78rem;
}
.item .tag {
  font-size: 0.66rem;
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  background: #1a2433;
  color: var(--muted);
}
.item .tag.ok { color: var(--ok); }
.item .tag.err { color: var(--bad); }
.item .tag.run { color: var(--warn); }
.item button { font-size: 0.7rem; padding: 0.22rem 0.4rem; }

.job-log {
  margin: 0;
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
  background: #0d131c;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c5d0de;
}
.job-log:empty::before {
  content: "部署 / Export 后日志显示在这里";
  color: var(--muted);
}

/* multi-landing picker */
.land-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 220px;
  overflow: auto;
  margin: 0.35rem 0 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0d131c;
}
.land-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: center;
  padding: 0.35rem 0.4rem;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 0.74rem;
}
.land-pick:hover { background: #121a26; }
.land-pick.on {
  border-color: var(--accent);
  background: #122033;
}
.land-pick .nm { font-weight: 600; flex: 1; min-width: 6rem; }
.land-pick .ip { color: var(--muted); font-variant-numeric: tabular-nums; }
.land-pick input[type="password"],
.land-pick input.land-pass {
  width: 8.5rem;
  font-size: 0.72rem;
  padding: 0.22rem 0.35rem;
}
.land-pick .tag { font-size: 0.64rem; color: var(--muted); }

@media (max-width: 1100px) {
  .yaml-layout {
    grid-template-columns: 1fr 1fr;
  }
  .side-panel { grid-column: 1 / -1; max-height: 50vh; }
}
@media (max-width: 720px) {
  .yaml-layout { grid-template-columns: 1fr; }
  .yaml-nodes, .yaml-main, .side-panel {
    position: relative;
    top: 0;
    max-height: none;
  }
  .ops-grid { grid-template-columns: 1fr; }
}
/* Keep the operator views tabbed at every viewport size. The old mobile
   single-page override hid the tabs and forced Topology/Deploy into the YAML
   flow, which made the lower topology cover short YAML layouts. */
.tabs { display: flex; }
@media (max-width: 720px) {
  .top { overflow-x: auto; }
  .tabs { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; flex: 0 0 auto; }
}
/* Node editing exposes exactly remote apply and randomized reinstall. */
.panel-actions button:not([data-aid="reinstall"]),
.act-legend, #btnSaveLocal, #btnCopyYaml,
.panel-yaml + .field-group-title, #yamlPreview { display: none !important; }
/* Server inventory cards expose pick/export/delete for the redesigned deploy flow. */

/* 2026-07 control-center design system */
:root {
  --bg: #080d14;
  --panel: #0f1722;
  --card: #131d2a;
  --line: #263448;
  --line-strong: #3a4b63;
  --text: #edf3fb;
  --muted: #96a5b9;
  --accent: #4f8cff;
  --accent-hover: #6a9dff;
  --ok: #41d39a;
  --bad: #ff6b78;
  --warn: #f0b95c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
  font-size: 14px;
}
html { color-scheme: dark; }
body {
  background:
    radial-gradient(circle at 12% -10%, rgba(79, 140, 255, .13), transparent 34rem),
    radial-gradient(circle at 92% 5%, rgba(65, 211, 154, .07), transparent 30rem),
    var(--bg);
}
button, input, select, textarea { min-height: 36px; transition: border-color .16s, background .16s, opacity .16s, transform .16s; }
button { font-weight: 600; }
button:hover:not(:disabled) { filter: none; border-color: var(--line-strong); transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { cursor: wait; opacity: .5; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.danger, button.mini.danger { color: #ffdce0; border-color: rgba(255,107,120,.55); background: rgba(255,107,120,.1); }
button.danger:hover:not(:disabled) { background: rgba(255,107,120,.18); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(79, 140, 255, .32);
  outline-offset: 2px;
  border-color: var(--accent);
}
.top {
  padding: .7rem clamp(.75rem, 2vw, 1.5rem);
  background: rgba(15, 23, 34, .92);
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
}
.brand { display: grid; line-height: 1.05; gap: .18rem; }
.brand strong { font-size: .95rem; letter-spacing: .01em; }
.brand span { color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .13em; }
.top-meta { min-width: 0; }
.tabs { border-radius: 12px; padding: 4px; background: #09111c; }
.tab { min-height: 34px; padding-inline: .9rem; }
.tab.active { box-shadow: 0 5px 16px rgba(79,140,255,.25); }
.page-shell { width: min(100%, 1720px); max-width: 1720px; padding: 1rem clamp(.7rem, 2vw, 1.5rem) 2rem; }
.card, .yaml-nodes, .yaml-main, .side-panel, .topo-wrap {
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.sec-head { min-height: 38px; }
.sec-head h2, .section-title { font-size: .92rem; letter-spacing: .01em; }
.hint { font-size: .79rem; line-height: 1.55; }
.login-card { width: min(100% - 2rem, 900px); margin: 1rem auto 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.login-row label { flex: 1 1 170px; display: grid; gap: .25rem; color: var(--muted); font-size: .72rem; }
.login-row label input { width: 100%; }
.inline-field { display: flex; gap: .5rem; align-items: center; color: var(--muted); font-size: .75rem; }
.inline-field input { min-width: 240px; }
.compact-field { display: grid; gap: .25rem; min-width: 110px; flex: 1 1 140px; color: var(--muted); font-size: .72rem; }
.compact-field input { width: 100%; }
.toast { background: rgba(19,29,42,.97); border-color: var(--line-strong); box-shadow: 0 18px 50px rgba(0,0,0,.42); }
.view[role="tabpanel"] { outline: none; }
.job-log { min-height: 180px; }
.server-card.selected, .mini-node.selected { box-shadow: 0 0 0 2px rgba(79,140,255,.35), var(--shadow); }

@media (max-width: 1180px) {
  .yaml-layout { grid-template-columns: minmax(250px,.8fr) minmax(360px,1.2fr); }
  .side-panel { grid-column: 1 / -1; position: relative; top: auto; max-height: none; }
  .ops-grid-v2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { font-size: 14px; }
  .top { position: relative; }
  .top-meta { order: 4; width: 100%; }
  .top-actions { margin-left: auto; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tab { flex: 1 0 auto; }
  .page-shell { padding-inline: .65rem; }
  .yaml-layout { grid-template-columns: 1fr; }
  .yaml-nodes, .yaml-main, .side-panel { position: relative; top: auto; max-height: none; }
  .sec-head { align-items: flex-start; }
  .sec-actions { justify-content: flex-start; }
  .inline-field { align-items: stretch; flex-direction: column; width: 100%; }
  .inline-field input { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
