/* Lunanova-TunGuard Web - style v1.5 (sidebar panel + login, 2026-11-23)
   NOTE: keep this file pure ASCII (no CJK) so PowerShell cannot mangle it. */

:root {
  --bg: #161718;
  --side: #131415;
  --card: #212224;
  --card-2: #1a1b1d;
  --line: #2e3033;
  --line-2: #3a3d42;
  --text: #eceef1;
  --muted: #9a9ea6;
  --muted-2: #71757d;
  --accent: #2f6bf6;
  --accent-soft: rgba(47, 107, 246, .16);
  --red: #f0555c;
  --yellow: #efb12c;
  --green: #25c17a;
  --purple: #a06bf6;
  --r: 14px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
        "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------------- shell ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 238px;
  flex: none;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--side);
  border-right: 1px solid var(--line);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.side-brand .logo { display: flex; flex: none; }
.side-brand-text { display: flex; flex-direction: column; min-width: 0; }
.side-brand-text strong { font-size: 13.5px; font-weight: 600; }
.side-brand-text em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted-2);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav { flex: 1 1 auto; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: .15s;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-item:hover { background: #1c1d20; color: var(--text); }
.nav-item.active {
  background: rgba(47, 107, 246, .14);
  border-color: rgba(47, 107, 246, .34);
  color: #bcd2ff;
}

.side-foot { padding: 10px; border-top: 1px solid var(--line); }
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1a1b1e;
  text-decoration: none;
  transition: .15s;
}
.side-user:hover { background: #1f2024; border-color: var(--line-2); }
.side-user-text { display: flex; flex-direction: column; min-width: 0; }
.side-user-text b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(160deg, #2f6bf6, #7c5cf6);
}
.avatar-guest { background: #2a2c30; color: var(--muted); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: rgba(22, 23, 24, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 14px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-sep { width: 1px; height: 16px; background: var(--line-2); }

.icon-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: .15s;
}
.icon-btn:hover { color: var(--text); border-color: #4a4e55; background: #26282b; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #26282b;
  font-size: 12px;
  color: var(--muted);
}
.pill .dot { background: #61666e; }
.pill-idle { border-color: rgba(47, 107, 246, .45); background: rgba(47, 107, 246, .12); color: #a9c4ff; }
.pill-idle .dot { background: #5b8dff; }
.pill-live { border-color: rgba(37, 193, 122, .45); background: rgba(37, 193, 122, .12); color: #7fe3b4; }
.pill-live .dot { background: var(--green); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 193, 122, .45); }
  50% { box-shadow: 0 0 0 4px rgba(37, 193, 122, 0); }
}

.content { padding: 18px 22px 34px; display: flex; flex-direction: column; gap: 16px; }
.page { display: none; }
.page.active { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
}

/* ---------------- kpi cards ---------------- */
.cards4 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 12.5px; color: var(--muted); }
.icon-chip {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .07);
  color: #cdd2da;
}
.icon-green { background: rgba(37, 193, 122, .13); color: #6ee3ac; }
.icon-purple { background: rgba(160, 107, 246, .14); color: #c7aaff; }
.num-purple { color: #c7aaff; }

.card-num { margin: 14px 0 0; font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card-num em { font-style: normal; font-size: 12px; font-weight: 400; color: var(--muted-2); margin-left: 6px; }
.card-sub { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 11.5px; color: var(--muted-2); }
.card-bar { height: 4px; margin-top: 14px; border-radius: 99px; background: rgba(255, 255, 255, .10); overflow: hidden; }
.card-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: #cfd6e2; transition: width .35s ease; }
.cards4 > .card:nth-child(4) .card-bar i { background: var(--green); }
.cards4 > .card:nth-child(5) .card-bar i { background: #a06bf6; }
.cards4 > .card:nth-child(2) .card-bar i { background: var(--red); }
.cards4 > .card:nth-child(3) .card-bar i { background: var(--yellow); }
.card-link { cursor: pointer; transition: border-color .15s, background .15s; }
.card-link:hover { border-color: #4a4e55; }
.card-link.card-primary:hover { border-color: #5a88ff; }

.card-primary { background: linear-gradient(160deg, #2f6bf6, #2456cf); border-color: #3d74ff; }
.card-primary .card-title { color: rgba(255, 255, 255, .75); }
.card-primary .card-num { color: #fff; }
.card-primary .card-num em { color: rgba(255, 255, 255, .72); }
.card-primary .card-sub { color: rgba(255, 255, 255, .72); }
.card-primary .icon-chip { background: rgba(255, 255, 255, .18); color: #fff; }
.card-primary .card-bar { background: rgba(255, 255, 255, .26); }
.card-primary .card-bar i { background: #fff; }

/* ---------------- stat strip ---------------- */
.statstrip { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 14px 18px; }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted-2); }
.stat-red b { color: #ff949a; }
.stat-yellow b { color: #f7cb74; }
.stat-green b { color: #6ee3ac; }
.statstrip-empty { display: none; font-size: 12.5px; color: var(--muted-2); }
.statstrip.is-empty .stat { display: none; }
.statstrip.is-empty .statstrip-empty { display: inline; }
.statstrip .btn { margin-left: auto; }

/* ---------------- two columns ---------------- */
.cols { display: grid; grid-template-columns: 1.85fr 1fr; gap: 16px; align-items: start; }
.col-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.config-card form { display: flex; flex-direction: column; height: 100%; }
.config-card .config-foot { margin-top: auto; }

.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-hint { margin: -6px 0 10px; font-size: 11.5px; color: var(--muted-2); }
.card-hint code { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.card-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

/* ---------------- config card ---------------- */
.acct-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.ctrl-line { display: flex; align-items: center; gap: 0; flex-wrap: wrap; padding-top: 4px; }
.ctl { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted-2); padding-right: 24px; }
.ctl + .ctl { padding-left: 24px; border-left: 1px solid var(--line); }
.ctl input[type="number"] {
  width: 68px;
  height: 32px;
  padding: 0 6px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
}
.ctl em { font-style: normal; font-size: 11px; color: var(--muted-2); }
.ctl-switch .switch { height: 32px; }

/* ---------------- machine status ---------------- */
.rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 10px; padding: 4px 0 10px; }
.ring-item { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.ring { position: relative; width: 76px; height: 76px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring-bg { stroke: rgba(255, 255, 255, .08); }
.ring-fg {
  stroke: var(--green);
  stroke-dasharray: 201.1;
  stroke-dashoffset: 201.1;
  transition: stroke-dashoffset .5s ease, stroke .3s ease;
}
.ring-fg.r-warn { stroke: var(--yellow); }
.ring-fg.r-bad { stroke: var(--red); }
.ring b {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ring-label { font-size: 11.5px; color: var(--muted); }
.ring-sub { font-size: 10.5px; color: var(--muted-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.machine-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.m-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-2); }
.m-chip .dot { width: 5px; height: 5px; }
.det-progress { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.det-extra { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }
.det-extra b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- overview detect bar ---------------- */
.det-bar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; padding: 14px 18px; }
.det-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.det-bar .det-progress { margin: 0; padding: 0; border: none; min-width: 0; }

/* ---------------- settings page ---------------- */
.kv-note { display: inline-block; margin-left: 8px; font-size: 11px; color: var(--muted-2); }
.kv dd input[type="number"] { width: 92px; height: 32px; text-align: center; }
.kv dd .switch { height: 32px; }
/* 境外探测：多节点列表 */
.probe-nodes-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; font-size: 12px; color: var(--muted-2); }
.probe-nodes-head em { font-style: normal; margin-left: 6px; color: var(--muted); }
.probe-nodes { display: flex; flex-direction: column; gap: 8px; }
.probe-node-row { display: flex; align-items: center; gap: 8px; }
.probe-node-row input { height: 32px; }
.probe-node-row .pn-name { width: 140px; }
.probe-node-row .pn-url { flex: 1 1 220px; max-width: 300px; font-family: var(--mono); font-size: 12px; }
.probe-node-row .pn-token { width: 150px; font-family: var(--mono); font-size: 12px; }
.probe-node-row .pn-state { min-width: 64px; display: inline-flex; justify-content: flex-end; }
.probe-empty { padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 8px; font-size: 12px; color: var(--muted-2); }
.icp-input {
  width: 100%;
  min-height: 132px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--card-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}
.icp-input:focus { border-color: rgba(47, 107, 246, .65); box-shadow: 0 0 0 3px rgba(47, 107, 246, .16); }
.icp-table tbody td { height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- ip card ---------------- */
.ip-card { display: flex; flex-direction: column; gap: 10px; }
.ip-row { display: flex; align-items: center; gap: 12px; }
.ip-addr { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.ip-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.ip-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }
.ip-sub { font-size: 11.5px; color: var(--muted-2); }
.ip-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 0; }
.ip-strip-ip { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.ip-strip-meta { font-size: 12px; color: var(--muted-2); }
/* 概览：境外探测节点 */
.probe-list { display: flex; flex-direction: column; gap: 6px; }
.probe-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.probe-item .pi-name { min-width: 76px; color: var(--text); }
.probe-item .pi-host { color: var(--muted-2); font-family: var(--mono); font-size: 11.5px; }
.probe-item .pi-ms { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.probe-item.is-off { opacity: .55; }
#logDialog .log-box { height: 44vh; margin: 6px 0 14px; }
#logDialog .card-head { margin-bottom: 6px; }

/* ---------------- form controls ---------------- */
.token-row { display: flex; flex-direction: column; gap: 6px; }
.token-label { font-size: 11.5px; color: var(--muted-2); }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1 1 auto; min-width: 0; font-family: var(--mono); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], select {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #5b5f67; }
input:focus, select:focus { border-color: rgba(47, 107, 246, .65); box-shadow: 0 0 0 3px rgba(47, 107, 246, .16); }
input:disabled { opacity: .55; }
input[type="number"] { font-family: var(--mono); }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
}
.mini-k { font-size: 11.5px; color: var(--muted-2); }
.mini-hint { font-size: 11px; color: var(--muted-2); }
.mini-stat input { height: 30px; }
.mini-switch .switch {
  width: 100%;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #151618;
}

.switch { display: inline-flex; align-items: center; height: 30px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 36px; height: 20px; border-radius: 99px; background: #3a3d42; transition: .2s; }
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b9099;
  transition: .2s;
}
.switch input:checked + .track { background: rgba(47, 107, 246, .85); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }

.config-tip { margin: auto 0 0; padding-top: 14px; font-size: 11.5px; color: var(--muted-2); }
.config-tip b { color: var(--muted); font-weight: 500; }
.config-tip kbd {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: #151618;
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: center;
  color: var(--muted);
}
.config-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.config-btns { display: flex; gap: 8px; }
.hint { font-size: 11.5px; color: var(--muted-2); }

.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #2a2c30;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: .15s;
}
.btn:hover:not(:disabled) { background: #33363b; border-color: #4a4e55; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: #4a7dfa; color: #fff; font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: #3b78ff; border-color: #5a88ff; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-small { height: 28px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; height: 40px; }

.mini-btn {
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #2a2c30;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: .15s;
}
.mini-btn:hover:not(:disabled) { color: var(--text); background: #33363b; }
.mini-btn:disabled { opacity: .45; cursor: not-allowed; }
.mini-btn-xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 6px; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- status list ---------------- */
.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .07);
  font-size: 12.5px;
}
.kv > div:last-child { border-bottom: none; }
.kv dt { color: var(--muted-2); }
.kv dd { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--text); text-align: right; }

.status-progress { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.prog-head { display: flex; align-items: baseline; gap: 10px; font-size: 12px; color: var(--muted); }
.prog-num { font-family: var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.prog-meta { margin-left: auto; font-size: 11.5px; color: var(--muted-2); }
.prog-foot { min-height: 15px; margin-top: 6px; font-size: 11px; color: var(--muted-2); }
.status-progress .card-bar { margin-top: 8px; }

/* ---------------- chips / search ---------------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 27px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: .15s;
}
.chip:hover { color: var(--text); border-color: #4a4e55; }
.chip b { font-weight: 600; font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.chip.active { background: var(--accent-soft); border-color: rgba(47, 107, 246, .55); color: #aec8ff; }
.chip.active b { color: #aec8ff; }
.chip-red.active { background: rgba(240, 85, 92, .14); border-color: rgba(240, 85, 92, .5); color: #ffa2a7; }
.chip-yellow.active { background: rgba(239, 177, 44, .14); border-color: rgba(239, 177, 44, .5); color: #f7cd7c; }
.chip-green.active { background: rgba(37, 193, 122, .14); border-color: rgba(37, 193, 122, .5); color: #7fe7b6; }
.chip-purple.active { background: rgba(160, 107, 246, .16); border-color: rgba(160, 107, 246, .5); color: #c7a6ff; }

.search { width: 240px; }
.select { padding-right: 6px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.check-inline input { accent-color: var(--accent); }

/* ---------------- tables ---------------- */
.table-wrap { width: 100%; }
table.grid { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.grid thead th {
  position: sticky;
  top: 56px;
  z-index: 3;
  padding: 9px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .03em;
  text-align: left;
  white-space: nowrap;
}
.grid tbody td {
  height: 40px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  color: var(--text);
  vertical-align: middle;
  overflow: hidden;
}
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover td { background: rgba(255, 255, 255, .035); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--muted); }
th.sortable.asc::after { content: "\2191"; margin-left: 3px; font-size: 9px; opacity: .85; }
th.sortable.desc::after { content: "\2193"; margin-left: 3px; font-size: 9px; opacity: .85; }

tr.lv-red td:first-child { box-shadow: inset 2px 0 0 var(--red); }
tr.lv-yellow td:first-child { box-shadow: inset 2px 0 0 var(--yellow); }
tr.lv-green td:first-child { box-shadow: inset 2px 0 0 rgba(37, 193, 122, .55); }
.results-table tbody td:first-child { color: var(--muted-2); font-size: 11.5px; }
/* 境外探测没启用时整列隐藏，不留一排空占位 */
.results-table.no-probe th:nth-child(8),
.results-table.no-probe td:nth-child(8) { display: none; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cell-clip, .cell-trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: block; margin-top: 1px; font-size: 11px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub.mono { font-family: var(--mono); }

.linklike {
  display: block;
  max-width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: #7ea6ff;
  font: inherit;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.linklike:hover { color: #a9c4ff; text-decoration: underline; }

.b {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.b-red { background: rgba(240, 85, 92, .14); border-color: rgba(240, 85, 92, .32); color: #ff9aa0; }
.b-yellow { background: rgba(239, 177, 44, .13); border-color: rgba(239, 177, 44, .30); color: #f7cd7c; }
.b-green { background: rgba(37, 193, 122, .13); border-color: rgba(37, 193, 122, .30); color: #7fe7b6; }
.b-blue { background: rgba(90, 160, 255, .13); border-color: rgba(90, 160, 255, .30); color: #9dc6ff; }
.b-purple { background: rgba(160, 107, 246, .14); border-color: rgba(160, 107, 246, .30); color: #c7aaff; }
.b-gray { background: rgba(255, 255, 255, .06); border-color: var(--line-2); color: var(--muted); }

.empty { padding: 26px 12px; text-align: center; color: var(--muted-2); font-size: 12.5px; }
.page-info { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.logs-table { font-size: 12px; }
.logs-table tbody td { height: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- run log ---------------- */
.log-count { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.log-box {
  height: 340px;
  overflow: auto;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  font-size: 12.5px;
  line-height: 1.6;
  color: #b9c2d0;
}
.log-line {
  display: grid;
  grid-template-columns: 54px 44px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 3px 8px;
  border-radius: 6px;
}
.log-line:hover { background: rgba(255, 255, 255, .045); }
.log-time {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #59617a;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.log-tag { display: flex; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .04em;
}
.tag-ok { color: #7fe7b6; border-color: rgba(37, 193, 122, .38); background: rgba(37, 193, 122, .10); }
.tag-info { color: #9dc6ff; border-color: rgba(90, 160, 255, .36); background: rgba(90, 160, 255, .10); }
.tag-warn { color: #f7cd7c; border-color: rgba(239, 177, 44, .38); background: rgba(239, 177, 44, .10); }
.tag-err { color: #ff9aa0; border-color: rgba(240, 85, 92, .45); background: rgba(240, 85, 92, .12); }
.log-body { min-width: 0; white-space: pre-wrap; word-break: break-word; color: #c2cad7; }
.log-ok .log-body { color: #cfe6da; }
.log-info .log-body { color: #cbd8ee; }
.log-warn .log-body { color: #f3d79f; }
.log-err .log-body { color: #ffb9be; }
.log-err { background: rgba(240, 85, 92, .07); }
.log-muted .log-body { color: #98a1b0; }
.log-blank { height: 6px; }
.log-rule { height: 1px; margin: 8px 8px; background: linear-gradient(90deg, var(--line-2), rgba(58, 61, 66, .10)); }
.log-box .empty { padding: 18px 0; }

/* ---------------- dots ---------------- */
.dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: #61666e; display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(37, 193, 122, .15); }
.dot.warn { background: var(--yellow); box-shadow: 0 0 0 3px rgba(239, 177, 44, .15); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(240, 85, 92, .15); }

/* ---------------- recent list ---------------- */
.recent-list { display: flex; flex-direction: column; }
.recent-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 130px 70px;
  align-items: center;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-size: 12.5px;
}
.recent-row > .b { justify-self: start; }
.recent-row:last-child { border-bottom: none; }
.recent-row:hover { background: rgba(255, 255, 255, .03); }
.recent-dom { color: var(--text); }
.recent-user { color: var(--muted); }
.recent-time { color: var(--muted-2); font-size: 11.5px; text-align: right; }

/* ---------------- account page ---------------- */
.acct-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.acct-avatar {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(160deg, #2f6bf6, #7c5cf6);
}
.acct-id h3 { margin: 0; font-size: 15px; font-weight: 600; }
.acct-id p { margin: 3px 0 0; font-size: 12px; color: var(--muted-2); }
.acct-actions { margin-left: auto; display: flex; gap: 8px; }
.kv-2col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 34px; }
.acct-token {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ---------------- login ---------------- */
.login-body {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  overflow: hidden;
  background: radial-gradient(1100px 720px at 50% -18%, #18213a 0%, #0c0e14 55%, #07080c 100%);
}
.login-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .6;
}
.login-aurora {
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  filter: blur(80px);
  opacity: .5;
}
.login-aurora i {
  position: absolute;
  display: block;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: auroraFloat 26s ease-in-out infinite alternate;
}
.login-aurora i:nth-child(1) { left: 2%; top: 2%; background: radial-gradient(circle, rgba(47, 107, 246, .55), transparent 62%); }
.login-aurora i:nth-child(2) { right: 0; top: 18%; background: radial-gradient(circle, rgba(124, 92, 246, .5), transparent 60%); animation-duration: 32s; animation-delay: -7s; }
.login-aurora i:nth-child(3) { left: 26%; bottom: -10%; background: radial-gradient(circle, rgba(37, 193, 122, .3), transparent 62%); animation-duration: 38s; animation-delay: -14s; }
@keyframes auroraFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4%, -6%, 0) scale(1.12); }
  100% { transform: translate3d(-3%, 5%, 0) scale(.95); }
}
@keyframes gridDrift { from { background-position: 0 0, 0 0; } to { background-position: 48px 48px, 48px 48px; } }

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(58% 46% at 50% 34%, #000 18%, transparent 78%);
  -webkit-mask-image: radial-gradient(58% 46% at 50% 34%, #000 18%, transparent 78%);
  animation: gridDrift 26s linear infinite;
}
.login-shell {
  width: 100%;
  max-width: 384px;
  position: relative;
  z-index: 2;
  animation: loginIn .55s cubic-bezier(.2, .8, .25, 1) both;
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.logo-badge {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #2f6bf6, #7c5cf6);
  box-shadow: 0 8px 24px rgba(47, 107, 246, .35);
}
.logo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  border: 1px solid rgba(120, 160, 255, .5);
  animation: logoPulse 3.2s ease-out infinite;
}
@keyframes logoPulse {
  0% { transform: scale(.96); opacity: .8; }
  70% { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}
.login-brand-text b { display: block; font-size: 14px; font-weight: 600; }
.login-brand-text em { font-style: normal; font-size: 11px; color: var(--muted-2); }

.login-card {
  position: relative;
  padding: 24px 22px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .09);
  background: rgba(22, 24, 30, .72);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(130deg, rgba(47, 107, 246, .55), rgba(124, 92, 246, .3) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.login-card h1 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.login-sub { margin: 0 0 18px; font-size: 12px; line-height: 1.75; color: var(--muted-2); }
.login-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.login-field > span:first-child { font-size: 12px; color: var(--muted); }
.login-field input { height: 40px; background: rgba(255, 255, 255, .04); }
.login-field input:focus {
  outline: none;
  border-color: rgba(90, 140, 255, .65);
  box-shadow: 0 0 0 3px rgba(47, 107, 246, .18);
  background: rgba(255, 255, 255, .06);
}
.login-pass { display: flex; gap: 6px; }
.login-pass input { flex: 1 1 auto; min-width: 0; }
.login-pass .mini-btn { height: 40px; }
.login-error {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 85, 92, .35);
  background: rgba(240, 85, 92, .12);
  color: #ffb3b8;
  font-size: 12.5px;
}
.login-card .btn-primary {
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(100deg, #2f6bf6, #5b7cff 45%, #7c5cf6);
  box-shadow: 0 10px 26px rgba(47, 107, 246, .35);
  transition: transform .16s ease, box-shadow .16s ease;
}
.login-card .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(47, 107, 246, .45); }
.login-card .btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-18deg);
  animation: btnSheen 4.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnSheen {
  0%, 62% { left: -60%; }
  82%, 100% { left: 130%; }
}
.login-note { margin: 14px 0 0; font-size: 11.5px; line-height: 1.75; color: var(--muted-2); }
.login-note a { color: #8fb4ff; text-decoration: none; }
.login-note a:hover { text-decoration: underline; }
.login-foot { margin-top: 14px; text-align: center; font-size: 11px; color: #565b64; font-family: var(--mono); }

@media (prefers-reduced-motion: reduce) {
  .login-aurora i, .login-bg, .login-shell, .logo-ring, .login-card .btn-primary::after { animation: none !important; }
  .login-canvas { display: none; }
}

/* ---------------- dialogs / toasts ---------------- */
.modal {
  width: calc(100% - 32px);
  max-width: 620px;
  padding: 20px 22px 18px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: #202124;
  color: var(--text);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
}
.modal::backdrop { background: rgba(10, 11, 12, .72); backdrop-filter: blur(3px); }
.modal h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.modal h3 + h3 { margin-top: 16px; }
.modal ol, .modal ul { margin: 0 0 8px; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.85; }
.modal-note { margin: 10px 0 16px; font-size: 11.5px; color: var(--muted-2); }
.modal .btn { width: 100%; }
.debug-modal { max-width: 880px; }
.changelog-modal { max-width: 700px; }
.changelog { max-height: 62vh; overflow: auto; padding-right: 4px; }
.changelog section { padding: 10px 0; border-bottom: 1px solid var(--line); }
.changelog section:last-child { border-bottom: none; }
.changelog h4 { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.changelog h4 span { margin-left: 8px; font-size: 11px; font-weight: 400; color: var(--muted-2); font-family: var(--mono); }
.changelog ul { margin: 0; padding-left: 16px; }
.changelog li { font-size: 12px; line-height: 1.7; color: var(--muted); }
.changelog li + li { margin-top: 2px; }
.about-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
.about-log .changelog { max-height: 68vh; overflow: auto; padding-right: 4px; }
.ver-chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: rgba(90, 160, 255, .13); border: 1px solid rgba(90, 160, 255, .32); color: #9dc6ff; font-size: 12px; }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.team-card { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 18px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .02); }
.team-avatar { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; color: #fff; background: var(--c, #2f6bf6); }
.team-card b { font-size: 13px; }
.team-role { font-size: 11.5px; color: var(--muted-2); }
.uq-bar { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; flex-wrap: wrap; }
.uq-bar .search { max-width: 320px; }
.userlog-modal { max-width: 1260px; max-height: 86vh; }
.userlog-modal[open] { display: flex; flex-direction: column; }
.userlog-modal form { display: flex; flex-direction: column; min-height: 0; }
.table-wrap-userlog { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
.userlog-table { table-layout: fixed; min-width: 1180px; }
.userlog-table thead th { top: 0; }
.userlog-table tbody td { height: 42px; padding: 5px 10px; }
.userlog-table .ip-time { color: var(--muted); font-size: 11.5px; }
.userlog-table .sub { margin-top: 0; font-size: 11px; }
.userlog-table .dim { color: var(--muted-2); font-size: 11.5px; }
.userlog-table .b { font-size: 10.5px; }
.userlog-table th, .userlog-table td { overflow: hidden; text-overflow: ellipsis; }
.port { color: var(--muted-2); }
.debug-pre {
  max-height: 52vh;
  overflow: auto;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-2);
  font-family: var(--mono);
  font-size: 12px;
  color: #a8b0bd;
}

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #26282b;
  color: var(--text);
  font-size: 12.5px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(6px);
  transition: .18s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(37, 193, 122, .45); }
.toast-warn { border-color: rgba(239, 177, 44, .45); }
.toast-error { border-color: rgba(240, 85, 92, .5); }

.foot { display: flex; justify-content: space-between; gap: 12px; padding: 2px 2px 0; font-size: 11.5px; color: var(--muted-2); }

/* ---------------- responsive ---------------- */
@media (max-width: 1200px) {
  .cards4 { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .kv-2col { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
  .side-nav { flex-direction: row; overflow-x: auto; padding: 8px 10px; gap: 6px; }
  .nav-item { width: auto; white-space: nowrap; }
  .side-foot { border-top: none; padding: 0 10px 10px; }
  .side-user { width: 100%; }
  .content { padding: 14px 14px 28px; }
  .table-wrap { overflow-x: auto; }
  .results-table { min-width: 940px; }
  .logs-table { min-width: 900px; }
  .grid thead th { position: static; }
  .login-left { display: none; }
  .login-right { padding: 28px 20px; }
}
@media (max-width: 600px) {
  .cards4 { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .card-tools { width: 100%; margin-left: 0; }
  .search { flex: 1 1 auto; width: auto; min-width: 120px; }
  .foot { flex-direction: column; gap: 4px; }
  /* 手机上标签的补充说明收起来，避免一行字折成三行 */
  .kv-note { display: none; }
  .probe-node-row { flex-wrap: wrap; }
  .probe-node-row .pn-name { flex: 1 1 120px; width: auto; }
  .probe-node-row .pn-url { flex: 1 1 100%; max-width: none; order: 3; }
  .probe-node-row .pn-token { flex: 1 1 140px; width: auto; order: 4; }
}
