:root {
  /* ---- Palette (DomainPro light) ---- */
  --bg: #f5f6f3;
  --bg-grad-a: #eef2f0;
  --bg-grad-b: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #fafbf9;
  --surface-3: #f1f3ef;
  --border: rgba(20, 40, 35, 0.10);
  --border-2: rgba(20, 40, 35, 0.18);
  --accent: #1f7a64;
  --accent-2: #2c9c80;
  --accent-soft: #e6f2ee;
  --accent-soft-2: #d3ece4;
  --text-1: #16201d;
  --text-2: #5a635e;
  --text-3: #97a09a;
  --success: #1a9e6e;
  --success-soft: #e4f6ec;
  --danger: #d8463a;
  --danger-soft: #fbe9e7;
  --warn: #b87a14;
  --warn-soft: #fbeed5;
  --mono: "SF Mono", "JetBrains Mono", "Consolas", "Menlo", monospace;

  /* ---- Radius ---- */
  --r-pill: 999px;
  --r-xl: 18px;
  --r-l: 14px;
  --r-m: 10px;
  --r-s: 8px;

  /* ---- Elevation ---- */
  --sh-sm: 0 1px 2px rgba(20,40,35,.05), 0 1px 3px rgba(20,40,35,.04);
  --sh-md: 0 4px 14px rgba(20,40,35,.07), 0 2px 6px rgba(20,40,35,.05);
  --sh-lg: 0 18px 48px rgba(20,40,35,.14), 0 6px 18px rgba(20,40,35,.08);
  --sh-accent: 0 8px 22px rgba(31,122,100,.32);

  /* ---- Type ---- */
  --fz-xs: 11.5px;
  --fz-sm: 12.5px;
  --fz: 13px;
  --fz-md: 14px;
  --fz-lg: 15px;
  --fz-xl: 17px;
  --fz-2xl: 21px;

  --t-fast: 140ms cubic-bezier(.4,0,.2,1);
  --t: 220ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 520px at 50% -180px, var(--bg-grad-a), transparent 70%),
    linear-gradient(180deg, var(--bg-grad-b), var(--bg) 38%);
  background-attachment: fixed;
  color: var(--text-1);
  font-size: var(--fz);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
code {
  font-family: var(--mono);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent);
}

/* ============ Header ============ */
.site-header {
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 0.5px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { max-width: 1000px; margin: 0 auto; padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: 11px;
  display: grid; place-items: center; color: #fff; font-size: 16px;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  box-shadow: var(--sh-accent);
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--text-2); margin-top: -2px; }
.admin-link {
  color: var(--text-2); text-decoration: none; font-size: 13px;
  padding: 8px 16px; border: 0.5px solid var(--border-2); border-radius: var(--r-pill);
  background: var(--surface); transition: all var(--t-fast); font-weight: 500;
}
.admin-link:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ============ Tabs ============ */
.tabs-wrap {
  background: rgba(255,255,255,.62);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 0.5px solid var(--border); position: sticky; top: 61px; z-index: 15;
}
.tabs-inner { max-width: 1000px; margin: 0 auto; padding: 10px 14px; overflow-x: auto; }
.tabs { display: flex; gap: 6px; }
.tab-btn {
  padding: 9px 18px; border: 0.5px solid transparent; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--text-2); white-space: nowrap; position: relative;
  border-radius: var(--r-pill); font-family: inherit; font-weight: 500;
  transition: all var(--t-fast);
}
.tab-btn:hover { color: var(--text-1); background: var(--surface); }
.tab-btn.on { color: #fff; background: linear-gradient(140deg, var(--accent-2), var(--accent)); box-shadow: var(--sh-accent); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ Main ============ */
.main { max-width: 1000px; margin: 0 auto; padding: 26px 18px 56px; }
.pane-head { margin-bottom: 18px; }
.pane-head h2 { font-size: var(--fz-2xl); font-weight: 650; margin: 0 0 6px; letter-spacing: .2px; }
.pane-head p { font-size: 13px; color: var(--text-2); margin: 0; max-width: 64ch; }
.hint-inline { color: var(--warn); font-weight: 500; }

/* ============ Card / form ============ */
.card {
  background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--r-xl);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--sh-sm);
}
.field-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.field-row.line2 { justify-content: space-between; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1 1 auto; }
.field.narrow { flex: 0 0 168px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
textarea, input[type="text"], input[type="number"], input[type="password"], select {
  width: 100%; border: 0.5px solid var(--border-2); border-radius: var(--r-m);
  padding: 10px 12px; font-size: 13px; background: var(--surface); color: var(--text-1);
  font-family: inherit; transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
textarea { resize: vertical; line-height: 1.7; font-family: var(--mono); font-size: 12.5px; }
textarea:hover, input:hover, select:hover { border-color: var(--accent-2); }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.hosts-stat { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.inline-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.error-msg { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; background: var(--danger-soft); padding: 9px 13px; border-radius: var(--r-m); border: 0.5px solid rgba(216,70,58,.25); }

/* ============ Buttons (胶囊) ============ */
.btn {
  padding: 10px 22px; border-radius: var(--r-pill); border: 0.5px solid var(--border-2);
  background: var(--surface); color: var(--text-1); font-size: 13px; cursor: pointer; font-family: inherit;
  font-weight: 550; letter-spacing: .2px; display: inline-flex; align-items: center; gap: 7px;
  transition: all var(--t-fast); box-shadow: var(--sh-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-2); transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-sm); }
.btn.primary { background: linear-gradient(140deg, var(--accent-2), var(--accent)); color: #fff; border-color: transparent; box-shadow: var(--sh-accent); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(31,122,100,.38); }
.btn.ghost { background: transparent; border-color: var(--border-2); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); box-shadow: none; }
.btn.sm { padding: 7px 15px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12.5px; padding: 4px 8px;
  border-radius: var(--r-pill); font-family: inherit; font-weight: 550; transition: all var(--t-fast);
}
.link-btn:hover { background: var(--accent-soft); text-decoration: none; }

/* ============ Segmented control ============ */
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-pill); padding: 4px; margin-bottom: 14px; box-shadow: inset 0 1px 2px rgba(20,40,35,.06); }
.seg button {
  padding: 8px 20px; border: none; background: transparent; border-radius: var(--r-pill);
  font-size: 13px; cursor: pointer; color: var(--text-2); font-family: inherit; font-weight: 500;
  transition: all var(--t-fast);
}
.seg button.on { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--sh-sm); }
.col-opts { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.col-opts label { display: inline-flex; align-items: center; gap: 6px; }
.col-opts select { width: auto; padding: 7px 10px; }
.col-opts input[type="text"] { width: 64px; padding: 7px 10px; }

/* ============ IO 双栏 ============ */
.tool-io { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.io-col { display: flex; flex-direction: column; }
.io-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.io-stat { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.preview-box {
  border: 0.5px solid var(--border-2); border-radius: var(--r-m); padding: 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; min-height: 200px;
  background: var(--surface-2); white-space: pre-wrap; word-break: break-all; overflow: auto;
}
.preview-line { padding: 1px 0; }
mark.ins { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 0 2px; }

/* ============ Metrics ============ */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--r-l); padding: 14px 16px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.metric::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--accent-2), var(--accent)); opacity: .9; }
.m-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.m-value { font-size: 23px; font-weight: 600; font-family: var(--mono); color: var(--text-1); }
.m-value.ok { color: var(--success); }
.m-value.fail { color: var(--danger); }

/* ============ Table ============ */
.batch-table-wrap { border: 0.5px solid var(--border); border-radius: var(--r-xl); overflow: auto; max-height: 480px; box-shadow: var(--sh-sm); }
.batch-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.batch-table th {
  position: sticky; top: 0; background: var(--surface-3); font-weight: 700; text-align: left;
  padding: 11px 14px; border-bottom: 0.5px solid var(--border-2); font-size: 12px; color: var(--text-1);
  z-index: 1; letter-spacing: .3px;
}
.batch-table td { padding: 9px 14px; border-bottom: 0.5px solid var(--border); font-size: 12.5px; }
.batch-table td.mono, .mono { font-family: var(--mono); }
.batch-table tbody tr:nth-child(even) { background: var(--surface-2); }
.batch-table tbody tr { transition: background var(--t-fast); }
.batch-table tbody tr:hover { background: var(--accent-soft); }
.batch-table tbody tr.row-fail { background: var(--danger-soft); }
.batch-table tbody tr.row-fail:hover { background: #f8ddd9; }
.row-fail { color: var(--danger); }
.status-ok { color: var(--success); font-weight: 600; }
.status-fail { color: var(--danger); font-weight: 600; }

/* ============ Ping 过滤条 ============ */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 10px 14px; border: 0.5px solid var(--border); border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--sh-sm); }
.filter-label { font-size: 13px; color: var(--text-2); }
.filter-select { border: 0.5px solid var(--border); border-radius: var(--r-pill); padding: 7px 14px; font-size: 13px; background: var(--surface); color: var(--text); cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.filter-select:hover, .filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.filter-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.filter-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.filter-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-family: var(--mono); }

/* ============ 我的节点（常用 Ping 节点） ============ */
.nodes-card { margin-bottom: 18px; }

/* ============ Ping 能力标注 ============ */
.cap-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.cap { display: inline-flex; align-items: center; gap: 4px; padding: 5px 13px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; line-height: 1.4; border: 0.5px solid transparent; transition: all var(--t-fast); cursor: default; white-space: nowrap; }
.cap:hover { background: var(--accent-soft-2); border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--sh-sm); }
.cap b { font-weight: 700; font-size: 12.5px; }
.cap.ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.cap.ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.card-head-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card-head-row h3 { font-size: var(--fz-lg); font-weight: 600; margin: 0; }
.node-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.node-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 0.5px solid var(--border); border-radius: var(--r-l); background: var(--surface-2); cursor: pointer; transition: all var(--t-fast); }
.node-item:hover { border-color: var(--border-2); box-shadow: var(--sh-sm); }
.node-item input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
.node-item .n-name { font-weight: 600; font-size: 13.5px; }
.node-item .n-host { margin-left: auto; font-size: 12px; color: var(--text-2); }


/* ============ Empty / skeleton ============ */
.empty-state { padding: 38px; text-align: center; color: var(--text-2); border: 0.5px dashed var(--border-2); border-radius: var(--r-xl); background: var(--surface); }
.empty-state.ok { color: var(--success); border-color: rgba(26,158,110,.4); background: var(--success-soft); }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.skel { height: 60px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; border-radius: var(--r-l); animation: pulse 1.4s infinite; }
.skeleton-row { height: 42px; background: var(--surface-3); border-radius: var(--r-m); margin-bottom: 8px; animation: pulse 1.4s infinite; }
.skeleton-row.short { width: 60%; }
@keyframes pulse { 0% { background-position: 100% 0; opacity: 1; } 50% { opacity: .55; } 100% { background-position: 0 0; opacity: 1; } }
.hint-line { font-size: 12px; color: var(--text-3); margin: 12px 0 0; }

/* ============ Extension iframe ============ */
.ext-iframe-wrap { border: 0.5px solid var(--border); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-sm); }
.ext-iframe-wrap iframe { width: 100%; min-height: 520px; border: none; display: block; }

/* ============ 文本扩展位（前台可编辑文字） ============ */
.ext-text {
  white-space: pre-wrap; word-break: break-word; font-family: var(--mono);
  font-size: 13px; line-height: 1.85; color: var(--text-1);
  background: var(--surface-2); border: 0.5px solid var(--border); border-radius: var(--r-m); padding: 16px 18px;
}
.ext-edit-bar { display: flex; justify-content: flex-end; margin-top: 12px; }
.ext-insert-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; background: var(--surface-3); border: 0.5px solid var(--border); border-radius: var(--r-m); }
.ext-insert-bar .ext-insert-input { flex: 1 1 180px; width: auto; }
.ext-insert-bar .ext-insert-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.ext-insert-bar .ext-insert-pos { width: auto; padding: 8px 10px; }
.edit-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.edit-body textarea { min-height: 160px; line-height: 1.7; resize: vertical; }
.edit-hint { font-size: 12px; color: var(--text-3); }
.field-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }

/* ============ Detail list ============ */
.detail-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--r-l); overflow: hidden; box-shadow: var(--sh-sm); }
.detail-list li { display: flex; gap: 10px; padding: 8px 16px; font-size: 13px; font-family: var(--mono); border-bottom: 0.5px solid var(--border); }
.detail-list li:last-child { border-bottom: none; }
.detail-list .seq { color: var(--text-3); width: 34px; flex: none; }

/* ============ Dialog modal ============ */
.detail-modal { border: none; border-radius: var(--r-xl); padding: 0; max-width: 580px; width: 92vw; background: var(--surface); box-shadow: var(--sh-lg); }
.detail-modal::backdrop { background: rgba(16,28,24,.42); backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 0.5px solid var(--border); }
.modal-head h3 { font-size: var(--fz-xl); font-weight: 600; margin: 0; }
.modal-close { width: 32px; height: 32px; border-radius: var(--r-pill); border: 0.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 16px; color: var(--text-2); transition: all var(--t-fast); display: grid; place-items: center; }
.modal-close:hover { background: var(--surface-3); color: var(--text-1); }
#modal-body { padding: 18px 22px; }

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--text-1); color: #fff; padding: 11px 20px; border-radius: var(--r-pill);
  font-size: 13px; opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast); z-index: 60;
  box-shadow: var(--sh-md); font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ============ Footer ============ */
.site-footer { max-width: 1000px; margin: 0 auto; padding: 18px; display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); border-top: 0.5px solid var(--border); }

/* ============ Admin page ============ */
.admin-wrap { max-width: 880px; margin: 46px auto; padding: 0 18px; }
.admin-card { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--sh-md); }
.admin-card h1 { font-size: var(--fz-2xl); font-weight: 650; margin: 0 0 6px; }
.admin-card .sub { color: var(--text-2); font-size: 13px; margin: 0 0 22px; }
.login-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.login-row .field { flex: 1 1 200px; }
.tool-list { margin-top: 8px; }
.tool-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 0.5px solid var(--border); border-radius: var(--r-l); margin-bottom: 10px; background: var(--surface-2); transition: all var(--t-fast); }
.tool-item:hover { border-color: var(--border-2); box-shadow: var(--sh-sm); }
.tool-item .ti-main { flex: 1; min-width: 0; }
.tool-item .ti-title { font-weight: 600; font-size: 13.5px; }
.tool-item .ti-url { font-size: 12px; color: var(--text-2); font-family: var(--mono); word-break: break-all; }
.tool-item .ti-actions { display: flex; gap: 8px; align-items: center; }
.tool-item .order-btn { padding: 5px 11px; font-size: 13px; }
.toggle { cursor: pointer; font-size: 12.5px; color: var(--accent); padding: 5px 11px; border-radius: var(--r-pill); transition: all var(--t-fast); font-weight: 500; }
.toggle:hover { background: var(--accent-soft); }
.add-form { display: grid; grid-template-columns: 1fr 2fr 130px; gap: 12px; margin: 16px 0; align-items: end; }
@media (max-width: 640px) { .add-form { grid-template-columns: 1fr; } }
.section-h { font-size: var(--fz-lg); font-weight: 600; margin: 26px 0 12px; display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 0.5px solid var(--border); }
.empty { color: var(--text-3); font-size: 13px; padding: 18px; text-align: center; border: 0.5px dashed var(--border-2); border-radius: var(--r-l); background: var(--surface-2); }
.modal-edit { display: flex; flex-direction: column; gap: 12px; }

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .tool-io { grid-template-columns: 1fr; }
  .metrics, .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
  .field.narrow { flex-basis: 100%; }
  .tabs-wrap { top: 61px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
