:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --accent: #4f7cff;
  --accent-2: #7c5cff;
  --ok: #2ecc71;
  --warn: #f39c12;
  --danger: #ff5c5c;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 登录页 ---------------- */

.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(79,124,255,.16), transparent 60%),
    radial-gradient(800px 500px at 90% 100%, rgba(124,92,255,.14), transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(79,124,255,.8);
}

.brand h1 {
  font-size: 19px;
  margin: 0;
  letter-spacing: .3px;
}

.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 24px;
}

/* ---------------- 表单 ---------------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,124,255,.15);
}

input::placeholder { color: #5c6478; }

.captcha-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.captcha-row input { flex: 1; }

.captcha-img {
  height: 42px;
  width: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #fff;
  object-fit: cover;
  flex: none;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}

.btn:hover { background: #262b36; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 500;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-danger {
  color: var(--danger);
  border-color: rgba(255,92,92,.35);
  background: rgba(255,92,92,.08);
}

.btn-danger:hover { background: rgba(255,92,92,.16); }

.btn-block { width: 100%; }

.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 提示 ---------------- */

.msg {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.msg.show { display: block; }
.msg.error { background: rgba(255,92,92,.12); color: #ff8a8a; border: 1px solid rgba(255,92,92,.3); }
.msg.ok { background: rgba(46,204,113,.12); color: #6ee7a2; border: 1px solid rgba(46,204,113,.3); }

/* ---------------- 主界面 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(23,26,33,.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand h1 { font-size: 16px; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
}

.hint { color: var(--muted); font-size: 12.5px; }

/* 订阅链接行 */
.sub-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.sub-row input {
  flex: 1;
  min-width: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}

/* 节点表 */
.node-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.node-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.node-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(42,47,58,.6);
  vertical-align: middle;
}

.node-table tr:last-child td { border-bottom: none; }
.node-table tr:hover td { background: rgba(255,255,255,.015); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .2px;
}

.tag-vless { background: rgba(79,124,255,.16); color: #8aabff; border: 1px solid rgba(79,124,255,.3); }
.tag-naive { background: rgba(46,204,113,.14); color: #6ee7a2; border: 1px solid rgba(46,204,113,.28); }
.tag-off { background: rgba(139,147,167,.14); color: var(--muted); border: 1px solid rgba(139,147,167,.25); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 8px 0; }
.check-item { color: var(--muted); font-size: 13px; }
.sub-url-cell { max-width: 300px; overflow-wrap: anywhere; }
.qr-modal { max-width: 420px; }
.qr-image { display: block; width: 280px; height: 280px; margin: 18px auto; image-rendering: pixelated; background: #fff; padding: 8px; }
.access-list { max-height: 420px; overflow: auto; }


.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 13.5px;
}

/* ---------------- 模态框 ---------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 50;
  overflow-y: auto;
}

.modal-mask.show { display: flex; }

.modal {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
}

.modal h3 {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 600;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .container { padding: 16px; }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.section-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.section-title:first-of-type { margin-top: 0; }

/* toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #232833;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error { border-color: rgba(255,92,92,.4); color: #ff9a9a; }
